From f950aa66a1eefed80577f1b1af64bf7ff986d7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Sch=C3=BCnemann?= Date: Tue, 24 May 2022 08:59:28 +0200 Subject: [PATCH] add integration test framework (#15) --- .reuse/dep5 | 3 + Makefile | 10 +- hack/check.sh | 2 +- hack/integration-test.py | 62 + hack/integration-test.sh | 31 +- hack/utils.py | 33 + integration-test/go.mod | 97 + integration-test/go.sum | 1617 + integration-test/pkg/main.go | 340 + integration-test/pkg/test/test_config.go | 115 + integration-test/pkg/test/test_runner.go | 31 + .../pkg/tests/test_create_deployment.go | 160 + .../pkg/tests/test_delete_deployment.go | 79 + .../pkg/tests/test_install_laas.go | 168 + .../pkg/tests/test_uninstall_laas.go | 93 + .../pkg/tests/test_update_deployment.go | 94 + .../pkg/tests/test_verify_delete.go | 86 + .../pkg/tests/test_verify_deployment.go | 202 + integration-test/pkg/util/util.go | 450 + .../github.com/Microsoft/go-winio/.gitignore | 1 + .../github.com/Microsoft/go-winio/CODEOWNERS | 1 + .../github.com/Microsoft/go-winio/LICENSE | 22 + .../github.com/Microsoft/go-winio/README.md | 22 + .../github.com/Microsoft/go-winio/backup.go | 280 + .../github.com/Microsoft/go-winio/ea.go | 137 + .../github.com/Microsoft/go-winio/file.go | 323 + .../github.com/Microsoft/go-winio/fileinfo.go | 73 + .../github.com/Microsoft/go-winio/hvsock.go | 307 + .../github.com/Microsoft/go-winio/pipe.go | 517 + .../Microsoft/go-winio/pkg/guid/guid.go | 237 + .../Microsoft/go-winio/privilege.go | 203 + .../github.com/Microsoft/go-winio/reparse.go | 128 + .../github.com/Microsoft/go-winio/sd.go | 98 + .../github.com/Microsoft/go-winio/syscall.go | 3 + .../Microsoft/go-winio/zsyscall_windows.go | 427 + .../github.com/Microsoft/hcsshim/LICENSE | 21 + .../hcsshim/osversion/osversion_windows.go | 50 + .../hcsshim/osversion/windowsbuilds.go | 38 + .../vendor/github.com/beorn7/perks/LICENSE | 20 + .../beorn7/perks/quantile/exampledata.txt | 2388 + .../beorn7/perks/quantile/stream.go | 316 + .../github.com/cespare/xxhash/v2/.travis.yml | 8 + .../github.com/cespare/xxhash/v2/LICENSE.txt | 22 + .../github.com/cespare/xxhash/v2/README.md | 67 + .../github.com/cespare/xxhash/v2/xxhash.go | 236 + .../cespare/xxhash/v2/xxhash_amd64.go | 13 + .../cespare/xxhash/v2/xxhash_amd64.s | 215 + .../cespare/xxhash/v2/xxhash_other.go | 76 + .../cespare/xxhash/v2/xxhash_safe.go | 15 + .../cespare/xxhash/v2/xxhash_unsafe.go | 46 + .../github.com/containerd/containerd/LICENSE | 191 + .../github.com/containerd/containerd/NOTICE | 16 + .../archive/compression/compression.go | 287 + .../containerd/containerd/content/adaptor.go | 52 + .../containerd/containerd/content/content.go | 182 + .../containerd/containerd/content/helpers.go | 287 + .../containerd/containerd/errdefs/errors.go | 93 + .../containerd/containerd/errdefs/grpc.go | 147 + .../containerd/containerd/filters/adaptor.go | 33 + .../containerd/containerd/filters/filter.go | 179 + .../containerd/containerd/filters/parser.go | 292 + .../containerd/containerd/filters/quote.go | 253 + .../containerd/containerd/filters/scanner.go | 297 + .../containerd/images/annotations.go | 23 + .../containerd/containerd/images/diffid.go | 81 + .../containerd/containerd/images/handlers.go | 288 + .../containerd/containerd/images/image.go | 441 + .../containerd/images/importexport.go | 37 + .../containerd/images/mediatypes.go | 204 + .../containerd/containerd/labels/labels.go | 21 + .../containerd/containerd/labels/validate.go | 37 + .../containerd/containerd/log/context.go | 68 + .../containerd/platforms/compare.go | 193 + .../containerd/platforms/cpuinfo.go | 131 + .../containerd/platforms/database.go | 114 + .../containerd/platforms/defaults.go | 43 + .../containerd/platforms/defaults_unix.go | 24 + .../containerd/platforms/defaults_windows.go | 81 + .../containerd/platforms/platforms.go | 278 + .../containerd/reference/docker/reference.go | 797 + .../containerd/reference/reference.go | 166 + .../containerd/remotes/docker/auth/fetch.go | 209 + .../containerd/remotes/docker/auth/parse.go | 203 + .../containerd/remotes/docker/authorizer.go | 333 + .../containerd/remotes/docker/converter.go | 88 + .../containerd/remotes/docker/errcode.go | 283 + .../containerd/remotes/docker/errdesc.go | 154 + .../containerd/remotes/docker/fetcher.go | 216 + .../containerd/remotes/docker/handler.go | 154 + .../remotes/docker/httpreadseeker.go | 169 + .../containerd/remotes/docker/pusher.go | 445 + .../containerd/remotes/docker/registry.go | 245 + .../containerd/remotes/docker/resolver.go | 667 + .../remotes/docker/schema1/converter.go | 606 + .../containerd/remotes/docker/scope.go | 97 + .../containerd/remotes/docker/status.go | 87 + .../containerd/remotes/errors/errors.go | 56 + .../containerd/containerd/remotes/handlers.go | 331 + .../containerd/containerd/remotes/resolver.go | 82 + .../containerd/containerd/version/version.go | 34 + .../github.com/containerd/continuity/AUTHORS | 44 + .../github.com/containerd/continuity/LICENSE | 191 + .../continuity/pathdriver/path_driver.go | 101 + .../vendor/github.com/davecgh/go-spew/LICENSE | 15 + .../github.com/davecgh/go-spew/spew/bypass.go | 145 + .../davecgh/go-spew/spew/bypasssafe.go | 38 + .../github.com/davecgh/go-spew/spew/common.go | 341 + .../github.com/davecgh/go-spew/spew/config.go | 306 + .../github.com/davecgh/go-spew/spew/doc.go | 211 + .../github.com/davecgh/go-spew/spew/dump.go | 509 + .../github.com/davecgh/go-spew/spew/format.go | 419 + .../github.com/davecgh/go-spew/spew/spew.go | 148 + .../vendor/github.com/docker/cli/AUTHORS | 771 + .../vendor/github.com/docker/cli/LICENSE | 191 + .../vendor/github.com/docker/cli/NOTICE | 19 + .../docker/cli/cli/config/config.go | 163 + .../docker/cli/cli/config/configfile/file.go | 415 + .../cli/cli/config/configfile/file_unix.go | 35 + .../cli/cli/config/configfile/file_windows.go | 5 + .../cli/cli/config/credentials/credentials.go | 17 + .../cli/config/credentials/default_store.go | 21 + .../credentials/default_store_darwin.go | 5 + .../config/credentials/default_store_linux.go | 13 + .../credentials/default_store_unsupported.go | 7 + .../credentials/default_store_windows.go | 5 + .../cli/cli/config/credentials/file_store.go | 81 + .../cli/config/credentials/native_store.go | 143 + .../docker/cli/cli/config/types/authconfig.go | 22 + .../github.com/docker/distribution/LICENSE | 202 + .../registry/client/auth/challenge/addr.go | 27 + .../client/auth/challenge/authchallenge.go | 237 + .../docker/docker-credential-helpers/LICENSE | 20 + .../client/client.go | 121 + .../client/command.go | 56 + .../credentials/credentials.go | 186 + .../credentials/error.go | 102 + .../credentials/helper.go | 14 + .../credentials/version.go | 4 + .../vendor/github.com/docker/docker/AUTHORS | 2080 + .../vendor/github.com/docker/docker/LICENSE | 191 + .../vendor/github.com/docker/docker/NOTICE | 19 + .../docker/pkg/homedir/homedir_linux.go | 109 + .../docker/pkg/homedir/homedir_others.go | 33 + .../docker/docker/pkg/homedir/homedir_unix.go | 34 + .../docker/pkg/homedir/homedir_windows.go | 24 + .../docker/docker/pkg/idtools/idtools.go | 264 + .../docker/docker/pkg/idtools/idtools_unix.go | 231 + .../docker/pkg/idtools/idtools_windows.go | 25 + .../docker/pkg/idtools/usergroupadd_linux.go | 164 + .../pkg/idtools/usergroupadd_unsupported.go | 12 + .../docker/docker/pkg/idtools/utils_unix.go | 32 + .../docker/docker/pkg/mount/flags.go | 137 + .../docker/docker/pkg/mount/flags_freebsd.go | 49 + .../docker/docker/pkg/mount/flags_linux.go | 87 + .../docker/pkg/mount/flags_unsupported.go | 31 + .../docker/docker/pkg/mount/mount.go | 159 + .../docker/pkg/mount/mounter_freebsd.go | 59 + .../docker/docker/pkg/mount/mounter_linux.go | 73 + .../docker/pkg/mount/mounter_unsupported.go | 7 + .../docker/docker/pkg/mount/mountinfo.go | 40 + .../docker/pkg/mount/mountinfo_freebsd.go | 55 + .../docker/pkg/mount/mountinfo_linux.go | 144 + .../docker/pkg/mount/mountinfo_unsupported.go | 12 + .../docker/pkg/mount/mountinfo_windows.go | 6 + .../docker/pkg/mount/sharedsubtree_linux.go | 71 + .../docker/docker/pkg/mount/unmount_unix.go | 22 + .../docker/pkg/mount/unmount_unsupported.go | 7 + .../docker/docker/pkg/system/args_windows.go | 16 + .../docker/docker/pkg/system/chtimes.go | 31 + .../docker/docker/pkg/system/chtimes_unix.go | 14 + .../docker/pkg/system/chtimes_windows.go | 26 + .../docker/docker/pkg/system/errors.go | 13 + .../docker/docker/pkg/system/exitcode.go | 19 + .../docker/docker/pkg/system/filesys.go | 67 + .../docker/pkg/system/filesys_windows.go | 294 + .../docker/docker/pkg/system/init.go | 22 + .../docker/docker/pkg/system/init_unix.go | 12 + .../docker/docker/pkg/system/init_windows.go | 41 + .../docker/docker/pkg/system/lcow.go | 32 + .../docker/docker/pkg/system/lcow_unix.go | 8 + .../docker/docker/pkg/system/lcow_windows.go | 6 + .../docker/docker/pkg/system/lstat_unix.go | 20 + .../docker/docker/pkg/system/lstat_windows.go | 14 + .../docker/docker/pkg/system/meminfo.go | 17 + .../docker/docker/pkg/system/meminfo_linux.go | 65 + .../docker/pkg/system/meminfo_unsupported.go | 8 + .../docker/pkg/system/meminfo_windows.go | 45 + .../docker/docker/pkg/system/mknod.go | 22 + .../docker/docker/pkg/system/mknod_windows.go | 11 + .../docker/docker/pkg/system/path.go | 60 + .../docker/docker/pkg/system/path_unix.go | 10 + .../docker/docker/pkg/system/path_windows.go | 24 + .../docker/docker/pkg/system/process_unix.go | 24 + .../docker/pkg/system/process_windows.go | 18 + .../github.com/docker/docker/pkg/system/rm.go | 80 + .../docker/docker/pkg/system/stat_darwin.go | 13 + .../docker/docker/pkg/system/stat_freebsd.go | 13 + .../docker/docker/pkg/system/stat_linux.go | 20 + .../docker/docker/pkg/system/stat_openbsd.go | 13 + .../docker/docker/pkg/system/stat_solaris.go | 13 + .../docker/docker/pkg/system/stat_unix.go | 66 + .../docker/docker/pkg/system/stat_windows.go | 49 + .../docker/docker/pkg/system/syscall_unix.go | 17 + .../docker/pkg/system/syscall_windows.go | 193 + .../docker/docker/pkg/system/umask.go | 13 + .../docker/docker/pkg/system/umask_windows.go | 7 + .../docker/pkg/system/utimes_freebsd.go | 24 + .../docker/docker/pkg/system/utimes_linux.go | 25 + .../docker/pkg/system/utimes_unsupported.go | 10 + .../docker/docker/pkg/system/xattrs_linux.go | 38 + .../docker/pkg/system/xattrs_unsupported.go | 13 + .../docker/go-units/CONTRIBUTING.md | 67 + .../vendor/github.com/docker/go-units/LICENSE | 191 + .../github.com/docker/go-units/MAINTAINERS | 46 + .../github.com/docker/go-units/README.md | 16 + .../github.com/docker/go-units/circle.yml | 11 + .../github.com/docker/go-units/duration.go | 35 + .../vendor/github.com/docker/go-units/size.go | 108 + .../github.com/docker/go-units/ulimit.go | 123 + .../github.com/evanphx/json-patch/LICENSE | 25 + .../github.com/evanphx/json-patch/README.md | 317 + .../github.com/evanphx/json-patch/errors.go | 38 + .../github.com/evanphx/json-patch/merge.go | 389 + .../github.com/evanphx/json-patch/patch.go | 788 + .../fsnotify/fsnotify/.editorconfig | 12 + .../fsnotify/fsnotify/.gitattributes | 1 + .../github.com/fsnotify/fsnotify/.gitignore | 6 + .../github.com/fsnotify/fsnotify/.travis.yml | 36 + .../github.com/fsnotify/fsnotify/AUTHORS | 52 + .../github.com/fsnotify/fsnotify/CHANGELOG.md | 317 + .../fsnotify/fsnotify/CONTRIBUTING.md | 77 + .../github.com/fsnotify/fsnotify/LICENSE | 28 + .../github.com/fsnotify/fsnotify/README.md | 130 + .../github.com/fsnotify/fsnotify/fen.go | 37 + .../github.com/fsnotify/fsnotify/fsnotify.go | 68 + .../github.com/fsnotify/fsnotify/inotify.go | 337 + .../fsnotify/fsnotify/inotify_poller.go | 187 + .../github.com/fsnotify/fsnotify/kqueue.go | 521 + .../fsnotify/fsnotify/open_mode_bsd.go | 11 + .../fsnotify/fsnotify/open_mode_darwin.go | 12 + .../github.com/fsnotify/fsnotify/windows.go | 561 + .../component-cli/ociclient/cache/cache.go | 265 + .../ociclient/cache/filesystem.go | 489 + .../component-cli/ociclient/cache/inmemory.go | 50 + .../component-cli/ociclient/cache/types.go | 175 + .../component-cli/ociclient/client.go | 803 + .../component-cli/ociclient/constants.go | 19 + .../gardener/component-cli/ociclient/copy.go | 45 + .../ociclient/credentials/builder.go | 175 + .../ociclient/credentials/keyring.go | 380 + .../credentials/secretserver/README.md | 10 + .../credentials/secretserver/secret_server.go | 325 + .../gardener/component-cli/ociclient/doc.go | 7 + .../ociclient/manifest_v1_conversion.go | 266 + .../ociclient/metrics/metrics.go | 78 + .../component-cli/ociclient/oci/artifact.go | 101 + .../component-cli/ociclient/oci/ref.go | 98 + .../ociclient/options/options.go | 99 + .../gardener/component-cli/ociclient/types.go | 212 + .../gardener/component-cli/ociclient/utils.go | 75 + .../pkg/commands/constants/constants.go | 44 + .../component-cli/pkg/logcontext/log.go | 96 + .../gardener/component-cli/pkg/utils/ctf.go | 15 + .../gardener/component-cli/pkg/utils/utils.go | 263 + .../bindings-go/apis/metadata.go | 21 + .../bindings-go/apis/v2/accesstypes.go | 221 + .../bindings-go/apis/v2/codecs.go | 203 + .../apis/v2/componentdescriptor.go | 429 + .../bindings-go/apis/v2/default.go | 68 + .../bindings-go/apis/v2/helper.go | 294 + .../bindings-go/apis/v2/jsonscheme/bindata.go | 254 + .../apis/v2/jsonscheme/jsonscheme.go | 68 + .../bindings-go/apis/v2/list.go | 51 + .../bindings-go/apis/v2/repositorytypes.go | 52 + .../bindings-go/apis/v2/resources.go | 21 + .../bindings-go/apis/v2/unstructured.go | 166 + .../apis/v2/validation/validate_list.go | 48 + .../apis/v2/validation/validation.go | 255 + .../apis/v2/zz_generated_deepcopy.go | 339 + .../component-spec/bindings-go/codec/codec.go | 171 + .../bindings-go/ctf/componentarchive.go | 531 + .../component-spec/bindings-go/ctf/ctf.go | 322 + .../bindings-go/ctf/listresolver.go | 58 + .../bindings-go/oci/constants.go | 42 + .../bindings-go/oci/manifest.go | 191 + .../component-spec/bindings-go/oci/resolve.go | 394 + .../component-spec/bindings-go/oci/types.go | 44 + .../bindings-go/utils/selector/selector.go | 239 + .../landscaper-service/pkg/apis/core/doc.go | 12 + .../pkg/apis/core/register.go | 47 + .../pkg/apis/core/type_instance.go | 87 + .../apis/core/type_landscaperdeployment.go | 66 + .../pkg/apis/core/type_servicetargetconfig.go | 60 + .../pkg/apis/core/types_shared.go | 85 + .../pkg/apis/core/v1alpha1/constants.go | 10 + .../pkg/apis/core/v1alpha1/conversion.go | 13 + .../pkg/apis/core/v1alpha1/defaults.go | 28 + .../pkg/apis/core/v1alpha1/doc.go | 13 + .../pkg/apis/core/v1alpha1/register.go | 65 + .../pkg/apis/core/v1alpha1/types_instance.go | 120 + .../v1alpha1/types_landscaperdeployment.go | 95 + .../v1alpha1/types_servicetargetconfig.go | 112 + .../pkg/apis/core/v1alpha1/types_shared.go | 85 + .../core/v1alpha1/zz_generated.conversion.go | 652 + .../core/v1alpha1/zz_generated.deepcopy.go | 426 + .../core/v1alpha1/zz_generated.defaults.go | 61 + .../pkg/apis/core/zz_generated.deepcopy.go | 426 + .../landscaper-service/pkg/utils/utils.go | 51 + .../gardener/landscaper/apis/LICENSE | 1 + .../gardener/landscaper/apis/config/doc.go | 11 + .../landscaper/apis/config/install/install.go | 32 + .../landscaper/apis/config/register.go | 41 + .../apis/config/types_agent_config.go | 31 + .../apis/config/types_landscaper_config.go | 277 + .../apis/config/v1alpha1/defaults.go | 154 + .../landscaper/apis/config/v1alpha1/doc.go | 12 + .../apis/config/v1alpha1/register.go | 43 + .../config/v1alpha1/types_agent_config.go | 31 + .../v1alpha1/types_landscaper_config.go | 277 + .../v1alpha1/zz_generated.conversion.go | 854 + .../config/v1alpha1/zz_generated.deepcopy.go | 507 + .../config/v1alpha1/zz_generated.defaults.go | 40 + .../apis/config/zz_generated.deepcopy.go | 504 + .../gardener/landscaper/apis/core/doc.go | 11 + .../landscaper/apis/core/install/install.go | 32 + .../gardener/landscaper/apis/core/register.go | 57 + .../landscaper/apis/core/types_blueprint.go | 204 + .../apis/core/types_component_overwrite.go | 57 + .../landscaper/apis/core/types_context.go | 45 + .../landscaper/apis/core/types_dataobject.go | 29 + .../apis/core/types_deployer_registration.go | 55 + .../landscaper/apis/core/types_deployitem.go | 141 + .../landscaper/apis/core/types_environment.go | 83 + .../landscaper/apis/core/types_execution.go | 127 + .../apis/core/types_installation.go | 417 + .../apis/core/types_installationtemplate.go | 63 + .../landscaper/apis/core/types_shared.go | 314 + .../landscaper/apis/core/types_target.go | 63 + .../apis/core/v1alpha1/constants.go | 88 + .../apis/core/v1alpha1/conversion.go | 96 + .../landscaper/apis/core/v1alpha1/defaults.go | 156 + .../landscaper/apis/core/v1alpha1/doc.go | 15 + .../landscaper/apis/core/v1alpha1/register.go | 89 + .../apis/core/v1alpha1/types_blueprint.go | 203 + .../v1alpha1/types_component_overwrite.go | 75 + .../apis/core/v1alpha1/types_context.go | 72 + .../apis/core/v1alpha1/types_dataobject.go | 92 + .../v1alpha1/types_deployer_registration.go | 81 + .../apis/core/v1alpha1/types_deployitem.go | 184 + .../apis/core/v1alpha1/types_environment.go | 107 + .../apis/core/v1alpha1/types_execution.go | 187 + .../apis/core/v1alpha1/types_installation.go | 556 + .../v1alpha1/types_installationtemplate.go | 64 + .../apis/core/v1alpha1/types_shared.go | 330 + .../apis/core/v1alpha1/types_target.go | 173 + .../core/v1alpha1/zz_generated.conversion.go | 3040 + .../core/v1alpha1/zz_generated.deepcopy.go | 2362 + .../core/v1alpha1/zz_generated.defaults.go | 66 + .../apis/core/zz_generated.deepcopy.go | 2319 + .../apis/deployer/container/constants.go | 178 + .../landscaper/apis/deployer/container/doc.go | 11 + .../apis/deployer/container/register.go | 42 + .../apis/deployer/container/types_config.go | 103 + .../apis/deployer/container/types_provider.go | 114 + .../deployer/container/v1alpha1/defaults.go | 32 + .../apis/deployer/container/v1alpha1/doc.go | 12 + .../deployer/container/v1alpha1/register.go | 48 + .../container/v1alpha1/types_config.go | 105 + .../container/v1alpha1/types_provider.go | 115 + .../v1alpha1/zz_generated.conversion.go | 362 + .../v1alpha1/zz_generated.deepcopy.go | 260 + .../v1alpha1/zz_generated.defaults.go | 28 + .../container/zz_generated.deepcopy.go | 260 + .../landscaper/apis/deployer/helm/doc.go | 11 + .../landscaper/apis/deployer/helm/register.go | 42 + .../apis/deployer/helm/types_config.go | 35 + .../apis/deployer/helm/types_provider.go | 195 + .../apis/deployer/helm/v1alpha1/defaults.go | 30 + .../apis/deployer/helm/v1alpha1/doc.go | 12 + .../apis/deployer/helm/v1alpha1/register.go | 44 + .../deployer/helm/v1alpha1/types_config.go | 43 + .../deployer/helm/v1alpha1/types_provider.go | 193 + .../helm/v1alpha1/zz_generated.conversion.go | 520 + .../helm/v1alpha1/zz_generated.deepcopy.go | 392 + .../helm/v1alpha1/zz_generated.defaults.go | 27 + .../deployer/helm/zz_generated.deepcopy.go | 393 + .../deployer/utils/continuousreconcile/doc.go | 9 + .../utils/continuousreconcile/types.go | 44 + .../zz_generated.deepcopy.go | 36 + .../deployer/utils/managedresource/doc.go | 9 + .../deployer/utils/managedresource/types.go | 115 + .../managedresource/zz_generated.deepcopy.go | 150 + .../deployer/utils/readinesschecks/doc.go | 9 + .../readinesschecks/types_healthchecks.go | 70 + .../readinesschecks/zz_generated.deepcopy.go | 129 + .../landscaper/apis/mediatype/constants.go | 55 + .../landscaper/apis/mediatype/mediatype.go | 224 + .../gardener/landscaper/apis/schema/schema.go | 96 + .../landscaper/controller-utils/LICENSE | 1 + .../controller-utils/pkg/kubernetes/docs.go | 7 + .../pkg/kubernetes/kubernetes.go | 646 + .../controller-utils/pkg/logger/config.go | 63 + .../controller-utils/pkg/logger/helper.go | 12 + .../controller-utils/pkg/logger/logger.go | 131 + .../gardener/landscaper/pkg/api/types.go | 103 + .../pkg/landscaper/jsonschema/reference.go | 343 + .../pkg/landscaper/jsonschema/validate.go | 95 + .../registry/components/blueprint.go | 69 + .../registry/components/cdutils/uri.go | 202 + .../registry/components/cdutils/utils.go | 84 + .../pkg/landscaper/registry/components/doc.go | 7 + .../landscaper/registry/components/local.go | 351 + .../landscaper/registry/components/manager.go | 90 + .../pkg/landscaper/registry/components/oci.go | 146 + .../gardener/landscaper/pkg/utils/builders.go | 244 + .../pkg/utils/context_aware_writer.go | 36 + .../landscaper/pkg/utils/controllerconfig.go | 22 + .../pkg/utils/cyclicdependencies.go | 357 + .../landscaper/pkg/utils/miscellaneous.go | 137 + .../landscaper/pkg/utils/ociconfig.go | 62 + .../gardener/landscaper/pkg/utils/tar/tar.go | 203 + .../github.com/gardener/landscapercli/LICENSE | 201 + .../landscapercli/cmd/installations/create.go | 422 + .../cmd/installations/force_delete.go | 194 + .../cmd/installations/inspect.go | 188 + .../cmd/installations/inspect/collector.go | 122 + .../cmd/installations/inspect/printer.go | 113 + .../cmd/installations/inspect/transformer.go | 237 + .../cmd/installations/inspect/tree.go | 67 + .../cmd/installations/installations.go | 39 + .../installations/set_import_parameters.go | 166 + .../landscapercli/cmd/quickstart/install.go | 381 + .../cmd/quickstart/oci_registry.go | 346 + .../cmd/quickstart/quickstart.go | 32 + .../landscapercli/cmd/quickstart/uninstall.go | 181 + .../landscapercli/pkg/logger/config.go | 63 + .../landscapercli/pkg/logger/helper.go | 12 + .../landscapercli/pkg/logger/logger.go | 131 + .../gardener/landscapercli/pkg/util/cmd.go | 86 + .../gardener/landscapercli/pkg/util/const.go | 9 + .../gardener/landscapercli/pkg/util/file.go | 26 + .../landscapercli/pkg/util/k8sclient.go | 68 + .../gardener/landscapercli/pkg/util/paths.go | 38 + .../gardener/landscapercli/pkg/util/util.go | 282 + .../gardener/landscapercli/pkg/util/yaml.go | 66 + .../landscapercli/pkg/version/version.go | 48 + .../landscapercli/pkg/version/version_info.go | 8 + .../vendor/github.com/ghodss/yaml/.gitignore | 20 + .../vendor/github.com/ghodss/yaml/.travis.yml | 7 + .../vendor/github.com/ghodss/yaml/LICENSE | 50 + .../vendor/github.com/ghodss/yaml/README.md | 121 + .../vendor/github.com/ghodss/yaml/fields.go | 501 + .../vendor/github.com/ghodss/yaml/yaml.go | 277 + .../vendor/github.com/go-logr/logr/LICENSE | 201 + .../vendor/github.com/go-logr/logr/README.md | 183 + .../vendor/github.com/go-logr/logr/discard.go | 51 + .../vendor/github.com/go-logr/logr/logr.go | 266 + .../vendor/github.com/go-logr/zapr/.gitignore | 3 + .../vendor/github.com/go-logr/zapr/Gopkg.lock | 52 + .../vendor/github.com/go-logr/zapr/Gopkg.toml | 38 + .../vendor/github.com/go-logr/zapr/LICENSE | 201 + .../vendor/github.com/go-logr/zapr/README.md | 45 + .../vendor/github.com/go-logr/zapr/zapr.go | 186 + .../vendor/github.com/gogo/protobuf/AUTHORS | 15 + .../github.com/gogo/protobuf/CONTRIBUTORS | 23 + .../vendor/github.com/gogo/protobuf/LICENSE | 35 + .../github.com/gogo/protobuf/proto/Makefile | 43 + .../github.com/gogo/protobuf/proto/clone.go | 258 + .../gogo/protobuf/proto/custom_gogo.go | 39 + .../github.com/gogo/protobuf/proto/decode.go | 427 + .../gogo/protobuf/proto/deprecated.go | 63 + .../github.com/gogo/protobuf/proto/discard.go | 350 + .../gogo/protobuf/proto/duration.go | 100 + .../gogo/protobuf/proto/duration_gogo.go | 49 + .../github.com/gogo/protobuf/proto/encode.go | 205 + .../gogo/protobuf/proto/encode_gogo.go | 33 + .../github.com/gogo/protobuf/proto/equal.go | 300 + .../gogo/protobuf/proto/extensions.go | 605 + .../gogo/protobuf/proto/extensions_gogo.go | 389 + .../github.com/gogo/protobuf/proto/lib.go | 973 + .../gogo/protobuf/proto/lib_gogo.go | 50 + .../gogo/protobuf/proto/message_set.go | 181 + .../gogo/protobuf/proto/pointer_reflect.go | 357 + .../protobuf/proto/pointer_reflect_gogo.go | 59 + .../gogo/protobuf/proto/pointer_unsafe.go | 308 + .../protobuf/proto/pointer_unsafe_gogo.go | 56 + .../gogo/protobuf/proto/properties.go | 610 + .../gogo/protobuf/proto/properties_gogo.go | 36 + .../gogo/protobuf/proto/skip_gogo.go | 119 + .../gogo/protobuf/proto/table_marshal.go | 3009 + .../gogo/protobuf/proto/table_marshal_gogo.go | 388 + .../gogo/protobuf/proto/table_merge.go | 676 + .../gogo/protobuf/proto/table_unmarshal.go | 2249 + .../protobuf/proto/table_unmarshal_gogo.go | 385 + .../github.com/gogo/protobuf/proto/text.go | 930 + .../gogo/protobuf/proto/text_gogo.go | 57 + .../gogo/protobuf/proto/text_parser.go | 1018 + .../gogo/protobuf/proto/timestamp.go | 113 + .../gogo/protobuf/proto/timestamp_gogo.go | 49 + .../gogo/protobuf/proto/wrappers.go | 1888 + .../gogo/protobuf/proto/wrappers_gogo.go | 113 + .../gogo/protobuf/sortkeys/sortkeys.go | 101 + .../github.com/golang/groupcache/LICENSE | 191 + .../github.com/golang/groupcache/lru/lru.go | 133 + .../vendor/github.com/golang/protobuf/AUTHORS | 3 + .../github.com/golang/protobuf/CONTRIBUTORS | 3 + .../vendor/github.com/golang/protobuf/LICENSE | 28 + .../golang/protobuf/proto/buffer.go | 324 + .../golang/protobuf/proto/defaults.go | 63 + .../golang/protobuf/proto/deprecated.go | 113 + .../golang/protobuf/proto/discard.go | 58 + .../golang/protobuf/proto/extensions.go | 356 + .../golang/protobuf/proto/properties.go | 306 + .../github.com/golang/protobuf/proto/proto.go | 167 + .../golang/protobuf/proto/registry.go | 317 + .../golang/protobuf/proto/text_decode.go | 801 + .../golang/protobuf/proto/text_encode.go | 560 + .../github.com/golang/protobuf/proto/wire.go | 78 + .../golang/protobuf/proto/wrappers.go | 34 + .../github.com/golang/protobuf/ptypes/any.go | 179 + .../golang/protobuf/ptypes/any/any.pb.go | 62 + .../github.com/golang/protobuf/ptypes/doc.go | 10 + .../golang/protobuf/ptypes/duration.go | 76 + .../protobuf/ptypes/duration/duration.pb.go | 63 + .../golang/protobuf/ptypes/timestamp.go | 112 + .../protobuf/ptypes/timestamp/timestamp.pb.go | 64 + .../vendor/github.com/google/go-cmp/LICENSE | 27 + .../github.com/google/go-cmp/cmp/compare.go | 682 + .../google/go-cmp/cmp/export_panic.go | 15 + .../google/go-cmp/cmp/export_unsafe.go | 35 + .../go-cmp/cmp/internal/diff/debug_disable.go | 17 + .../go-cmp/cmp/internal/diff/debug_enable.go | 122 + .../google/go-cmp/cmp/internal/diff/diff.go | 398 + .../google/go-cmp/cmp/internal/flags/flags.go | 9 + .../cmp/internal/flags/toolchain_legacy.go | 10 + .../cmp/internal/flags/toolchain_recent.go | 10 + .../go-cmp/cmp/internal/function/func.go | 99 + .../google/go-cmp/cmp/internal/value/name.go | 157 + .../cmp/internal/value/pointer_purego.go | 33 + .../cmp/internal/value/pointer_unsafe.go | 36 + .../google/go-cmp/cmp/internal/value/sort.go | 106 + .../google/go-cmp/cmp/internal/value/zero.go | 48 + .../github.com/google/go-cmp/cmp/options.go | 552 + .../github.com/google/go-cmp/cmp/path.go | 378 + .../github.com/google/go-cmp/cmp/report.go | 54 + .../google/go-cmp/cmp/report_compare.go | 432 + .../google/go-cmp/cmp/report_references.go | 264 + .../google/go-cmp/cmp/report_reflect.go | 402 + .../google/go-cmp/cmp/report_slices.go | 613 + .../google/go-cmp/cmp/report_text.go | 431 + .../google/go-cmp/cmp/report_value.go | 121 + .../google/go-containerregistry/LICENSE | 202 + .../internal/redact/redact.go | 35 + .../internal/retry/retry.go | 77 + .../wait/kubernetes_apimachinery_wait.go | 123 + .../go-containerregistry/pkg/authn/README.md | 242 + .../go-containerregistry/pkg/authn/anon.go | 26 + .../go-containerregistry/pkg/authn/auth.go | 30 + .../go-containerregistry/pkg/authn/authn.go | 36 + .../go-containerregistry/pkg/authn/basic.go | 29 + .../go-containerregistry/pkg/authn/bearer.go | 27 + .../go-containerregistry/pkg/authn/doc.go | 17 + .../pkg/authn/keychain.go | 89 + .../pkg/authn/multikeychain.go | 41 + .../go-containerregistry/pkg/logs/logs.go | 39 + .../go-containerregistry/pkg/name/README.md | 3 + .../go-containerregistry/pkg/name/check.go | 43 + .../go-containerregistry/pkg/name/digest.go | 96 + .../go-containerregistry/pkg/name/doc.go | 42 + .../go-containerregistry/pkg/name/errors.go | 37 + .../go-containerregistry/pkg/name/options.go | 83 + .../go-containerregistry/pkg/name/ref.go | 76 + .../go-containerregistry/pkg/name/registry.go | 136 + .../pkg/name/repository.go | 121 + .../go-containerregistry/pkg/name/tag.go | 108 + .../pkg/v1/remote/transport/README.md | 129 + .../pkg/v1/remote/transport/basic.go | 62 + .../pkg/v1/remote/transport/bearer.go | 311 + .../pkg/v1/remote/transport/doc.go | 18 + .../pkg/v1/remote/transport/error.go | 197 + .../pkg/v1/remote/transport/logger.go | 91 + .../pkg/v1/remote/transport/ping.go | 129 + .../pkg/v1/remote/transport/retry.go | 88 + .../pkg/v1/remote/transport/schemer.go | 44 + .../pkg/v1/remote/transport/scope.go | 24 + .../pkg/v1/remote/transport/transport.go | 103 + .../pkg/v1/remote/transport/useragent.go | 94 + .../github.com/google/gofuzz/.travis.yml | 13 + .../github.com/google/gofuzz/CONTRIBUTING.md | 67 + .../vendor/github.com/google/gofuzz/LICENSE | 202 + .../vendor/github.com/google/gofuzz/README.md | 71 + .../vendor/github.com/google/gofuzz/doc.go | 18 + .../vendor/github.com/google/gofuzz/fuzz.go | 506 + .../vendor/github.com/google/uuid/.travis.yml | 9 + .../github.com/google/uuid/CONTRIBUTING.md | 10 + .../github.com/google/uuid/CONTRIBUTORS | 9 + .../vendor/github.com/google/uuid/LICENSE | 27 + .../vendor/github.com/google/uuid/README.md | 19 + .../vendor/github.com/google/uuid/dce.go | 80 + .../vendor/github.com/google/uuid/doc.go | 12 + .../vendor/github.com/google/uuid/hash.go | 53 + .../vendor/github.com/google/uuid/marshal.go | 38 + .../vendor/github.com/google/uuid/node.go | 90 + .../vendor/github.com/google/uuid/node_js.go | 12 + .../vendor/github.com/google/uuid/node_net.go | 33 + .../vendor/github.com/google/uuid/null.go | 118 + .../vendor/github.com/google/uuid/sql.go | 59 + .../vendor/github.com/google/uuid/time.go | 123 + .../vendor/github.com/google/uuid/util.go | 43 + .../vendor/github.com/google/uuid/uuid.go | 294 + .../vendor/github.com/google/uuid/version1.go | 44 + .../vendor/github.com/google/uuid/version4.go | 76 + .../github.com/googleapis/gnostic/LICENSE | 203 + .../googleapis/gnostic/compiler/README.md | 4 + .../googleapis/gnostic/compiler/context.go | 49 + .../googleapis/gnostic/compiler/error.go | 70 + .../googleapis/gnostic/compiler/extensions.go | 85 + .../googleapis/gnostic/compiler/helpers.go | 396 + .../googleapis/gnostic/compiler/main.go | 16 + .../googleapis/gnostic/compiler/reader.go | 307 + .../googleapis/gnostic/extensions/README.md | 13 + .../gnostic/extensions/extension.pb.go | 461 + .../gnostic/extensions/extension.proto | 97 + .../gnostic/extensions/extensions.go | 64 + .../googleapis/gnostic/jsonschema/README.md | 4 + .../googleapis/gnostic/jsonschema/base.go | 84 + .../googleapis/gnostic/jsonschema/display.go | 229 + .../googleapis/gnostic/jsonschema/models.go | 228 + .../gnostic/jsonschema/operations.go | 394 + .../googleapis/gnostic/jsonschema/reader.go | 442 + .../googleapis/gnostic/jsonschema/schema.json | 150 + .../googleapis/gnostic/jsonschema/writer.go | 369 + .../googleapis/gnostic/openapiv2/OpenAPIv2.go | 8818 ++ .../gnostic/openapiv2/OpenAPIv2.pb.go | 7342 ++ .../gnostic/openapiv2/OpenAPIv2.proto | 666 + .../googleapis/gnostic/openapiv2/README.md | 14 + .../googleapis/gnostic/openapiv2/document.go | 41 + .../gnostic/openapiv2/openapi-2.0.json | 1610 + .../github.com/imdario/mergo/.deepsource.toml | 12 + .../github.com/imdario/mergo/.gitignore | 33 + .../github.com/imdario/mergo/.travis.yml | 12 + .../imdario/mergo/CODE_OF_CONDUCT.md | 46 + .../vendor/github.com/imdario/mergo/LICENSE | 28 + .../vendor/github.com/imdario/mergo/README.md | 247 + .../vendor/github.com/imdario/mergo/doc.go | 143 + .../vendor/github.com/imdario/mergo/map.go | 178 + .../vendor/github.com/imdario/mergo/merge.go | 380 + .../vendor/github.com/imdario/mergo/mergo.go | 78 + .../inconshreveable/mousetrap/LICENSE | 13 + .../inconshreveable/mousetrap/README.md | 23 + .../inconshreveable/mousetrap/trap_others.go | 15 + .../inconshreveable/mousetrap/trap_windows.go | 98 + .../mousetrap/trap_windows_1.4.go | 46 + .../github.com/json-iterator/go/.codecov.yml | 3 + .../github.com/json-iterator/go/.gitignore | 4 + .../github.com/json-iterator/go/.travis.yml | 14 + .../github.com/json-iterator/go/Gopkg.lock | 21 + .../github.com/json-iterator/go/Gopkg.toml | 26 + .../github.com/json-iterator/go/LICENSE | 21 + .../github.com/json-iterator/go/README.md | 87 + .../github.com/json-iterator/go/adapter.go | 150 + .../vendor/github.com/json-iterator/go/any.go | 325 + .../github.com/json-iterator/go/any_array.go | 278 + .../github.com/json-iterator/go/any_bool.go | 137 + .../github.com/json-iterator/go/any_float.go | 83 + .../github.com/json-iterator/go/any_int32.go | 74 + .../github.com/json-iterator/go/any_int64.go | 74 + .../json-iterator/go/any_invalid.go | 82 + .../github.com/json-iterator/go/any_nil.go | 69 + .../github.com/json-iterator/go/any_number.go | 123 + .../github.com/json-iterator/go/any_object.go | 374 + .../github.com/json-iterator/go/any_str.go | 166 + .../github.com/json-iterator/go/any_uint32.go | 74 + .../github.com/json-iterator/go/any_uint64.go | 74 + .../github.com/json-iterator/go/build.sh | 12 + .../github.com/json-iterator/go/config.go | 375 + .../go/fuzzy_mode_convert_table.md | 7 + .../github.com/json-iterator/go/iter.go | 349 + .../github.com/json-iterator/go/iter_array.go | 64 + .../github.com/json-iterator/go/iter_float.go | 342 + .../github.com/json-iterator/go/iter_int.go | 346 + .../json-iterator/go/iter_object.go | 267 + .../github.com/json-iterator/go/iter_skip.go | 130 + .../json-iterator/go/iter_skip_sloppy.go | 163 + .../json-iterator/go/iter_skip_strict.go | 99 + .../github.com/json-iterator/go/iter_str.go | 215 + .../github.com/json-iterator/go/jsoniter.go | 18 + .../github.com/json-iterator/go/pool.go | 42 + .../github.com/json-iterator/go/reflect.go | 337 + .../json-iterator/go/reflect_array.go | 104 + .../json-iterator/go/reflect_dynamic.go | 70 + .../json-iterator/go/reflect_extension.go | 483 + .../json-iterator/go/reflect_json_number.go | 112 + .../go/reflect_json_raw_message.go | 76 + .../json-iterator/go/reflect_map.go | 346 + .../json-iterator/go/reflect_marshaler.go | 225 + .../json-iterator/go/reflect_native.go | 453 + .../json-iterator/go/reflect_optional.go | 129 + .../json-iterator/go/reflect_slice.go | 99 + .../go/reflect_struct_decoder.go | 1097 + .../go/reflect_struct_encoder.go | 211 + .../github.com/json-iterator/go/stream.go | 210 + .../json-iterator/go/stream_float.go | 111 + .../github.com/json-iterator/go/stream_int.go | 190 + .../github.com/json-iterator/go/stream_str.go | 372 + .../github.com/json-iterator/go/test.sh | 12 + .../klauspost/compress/.gitattributes | 2 + .../github.com/klauspost/compress/.gitignore | 25 + .../klauspost/compress/.goreleaser.yml | 137 + .../github.com/klauspost/compress/LICENSE | 304 + .../github.com/klauspost/compress/README.md | 438 + .../klauspost/compress/compressible.go | 85 + .../klauspost/compress/fse/README.md | 79 + .../klauspost/compress/fse/bitreader.go | 122 + .../klauspost/compress/fse/bitwriter.go | 168 + .../klauspost/compress/fse/bytereader.go | 47 + .../klauspost/compress/fse/compress.go | 683 + .../klauspost/compress/fse/decompress.go | 374 + .../github.com/klauspost/compress/fse/fse.go | 144 + .../github.com/klauspost/compress/gen.sh | 4 + .../klauspost/compress/huff0/.gitignore | 1 + .../klauspost/compress/huff0/README.md | 89 + .../klauspost/compress/huff0/bitreader.go | 329 + .../klauspost/compress/huff0/bitwriter.go | 210 + .../klauspost/compress/huff0/bytereader.go | 54 + .../klauspost/compress/huff0/compress.go | 720 + .../klauspost/compress/huff0/decompress.go | 1371 + .../klauspost/compress/huff0/huff0.go | 335 + .../compress/internal/snapref/LICENSE | 27 + .../compress/internal/snapref/decode.go | 264 + .../compress/internal/snapref/decode_other.go | 113 + .../compress/internal/snapref/encode.go | 289 + .../compress/internal/snapref/encode_other.go | 236 + .../compress/internal/snapref/snappy.go | 98 + .../github.com/klauspost/compress/s2sx.mod | 4 + .../github.com/klauspost/compress/s2sx.sum | 0 .../klauspost/compress/zstd/README.md | 441 + .../klauspost/compress/zstd/bitreader.go | 136 + .../klauspost/compress/zstd/bitwriter.go | 169 + .../klauspost/compress/zstd/blockdec.go | 736 + .../klauspost/compress/zstd/blockenc.go | 871 + .../compress/zstd/blocktype_string.go | 85 + .../klauspost/compress/zstd/bytebuf.go | 130 + .../klauspost/compress/zstd/bytereader.go | 88 + .../klauspost/compress/zstd/decodeheader.go | 202 + .../klauspost/compress/zstd/decoder.go | 555 + .../compress/zstd/decoder_options.go | 102 + .../klauspost/compress/zstd/dict.go | 122 + .../klauspost/compress/zstd/enc_base.go | 178 + .../klauspost/compress/zstd/enc_best.go | 558 + .../klauspost/compress/zstd/enc_better.go | 1237 + .../klauspost/compress/zstd/enc_dfast.go | 1124 + .../klauspost/compress/zstd/enc_fast.go | 1019 + .../klauspost/compress/zstd/encoder.go | 599 + .../compress/zstd/encoder_options.go | 312 + .../klauspost/compress/zstd/framedec.go | 521 + .../klauspost/compress/zstd/frameenc.go | 137 + .../klauspost/compress/zstd/fse_decoder.go | 385 + .../klauspost/compress/zstd/fse_encoder.go | 725 + .../klauspost/compress/zstd/fse_predefined.go | 158 + .../klauspost/compress/zstd/hash.go | 41 + .../klauspost/compress/zstd/history.go | 89 + .../compress/zstd/internal/xxhash/LICENSE.txt | 22 + .../compress/zstd/internal/xxhash/README.md | 58 + .../compress/zstd/internal/xxhash/xxhash.go | 237 + .../zstd/internal/xxhash/xxhash_amd64.go | 12 + .../zstd/internal/xxhash/xxhash_amd64.s | 215 + .../zstd/internal/xxhash/xxhash_other.go | 77 + .../zstd/internal/xxhash/xxhash_safe.go | 11 + .../klauspost/compress/zstd/seqdec.go | 492 + .../klauspost/compress/zstd/seqenc.go | 114 + .../klauspost/compress/zstd/snappy.go | 435 + .../github.com/klauspost/compress/zstd/zip.go | 122 + .../klauspost/compress/zstd/zstd.go | 152 + .../github.com/mandelsoft/filepath/LICENSE | 27 + .../mandelsoft/filepath/pkg/filepath/eval.go | 130 + .../mandelsoft/filepath/pkg/filepath/orig.go | 71 + .../mandelsoft/filepath/pkg/filepath/path.go | 345 + .../vendor/github.com/mandelsoft/vfs/LICENSE | 201 + .../mandelsoft/vfs/pkg/memoryfs/dir.go | 44 + .../mandelsoft/vfs/pkg/memoryfs/doc.go | 21 + .../mandelsoft/vfs/pkg/memoryfs/filedata.go | 120 + .../mandelsoft/vfs/pkg/memoryfs/memory.go | 46 + .../github.com/mandelsoft/vfs/pkg/osfs/doc.go | 20 + .../mandelsoft/vfs/pkg/osfs/osfs.go | 155 + .../mandelsoft/vfs/pkg/osfs/osfs_unix.go | 25 + .../mandelsoft/vfs/pkg/osfs/osfs_windows.go | 37 + .../mandelsoft/vfs/pkg/osfs/tempfs.go | 48 + .../mandelsoft/vfs/pkg/projectionfs/doc.go | 21 + .../vfs/pkg/projectionfs/projectionfs.go | 53 + .../mandelsoft/vfs/pkg/utils/base.go | 45 + .../mandelsoft/vfs/pkg/utils/eval.go | 110 + .../mandelsoft/vfs/pkg/utils/file.go | 255 + .../mandelsoft/vfs/pkg/utils/fileInfo.go | 74 + .../mandelsoft/vfs/pkg/utils/fssupport.go | 315 + .../mandelsoft/vfs/pkg/utils/mappedfs.go | 294 + .../mandelsoft/vfs/pkg/utils/sorter.go | 29 + .../mandelsoft/vfs/pkg/utils/utils.go | 36 + .../mandelsoft/vfs/pkg/vfs/errors.go | 82 + .../mandelsoft/vfs/pkg/vfs/errors_unix.go | 29 + .../mandelsoft/vfs/pkg/vfs/errors_windows.go | 29 + .../github.com/mandelsoft/vfs/pkg/vfs/eval.go | 114 + .../mandelsoft/vfs/pkg/vfs/interface.go | 174 + .../mandelsoft/vfs/pkg/vfs/tempfile.go | 117 + .../mandelsoft/vfs/pkg/vfs/utils.go | 513 + .../github.com/mandelsoft/vfs/pkg/vfs/vfs.go | 130 + .../github.com/mandelsoft/vfs/pkg/vfs/walk.go | 88 + .../golang_protobuf_extensions/LICENSE | 201 + .../golang_protobuf_extensions/NOTICE | 1 + .../pbutil/.gitignore | 1 + .../pbutil/Makefile | 7 + .../pbutil/decode.go | 75 + .../golang_protobuf_extensions/pbutil/doc.go | 16 + .../pbutil/encode.go | 46 + .../vendor/github.com/moby/locker/LICENSE | 190 + .../vendor/github.com/moby/locker/README.md | 65 + .../vendor/github.com/moby/locker/locker.go | 112 + .../modern-go/concurrent/.gitignore | 1 + .../modern-go/concurrent/.travis.yml | 14 + .../github.com/modern-go/concurrent/LICENSE | 201 + .../github.com/modern-go/concurrent/README.md | 49 + .../modern-go/concurrent/executor.go | 14 + .../modern-go/concurrent/go_above_19.go | 15 + .../modern-go/concurrent/go_below_19.go | 33 + .../github.com/modern-go/concurrent/log.go | 13 + .../github.com/modern-go/concurrent/test.sh | 12 + .../concurrent/unbounded_executor.go | 119 + .../github.com/modern-go/reflect2/.gitignore | 2 + .../github.com/modern-go/reflect2/.travis.yml | 15 + .../github.com/modern-go/reflect2/Gopkg.lock | 15 + .../github.com/modern-go/reflect2/Gopkg.toml | 35 + .../github.com/modern-go/reflect2/LICENSE | 201 + .../github.com/modern-go/reflect2/README.md | 71 + .../modern-go/reflect2/go_above_17.go | 8 + .../modern-go/reflect2/go_above_19.go | 14 + .../modern-go/reflect2/go_below_17.go | 9 + .../modern-go/reflect2/go_below_19.go | 14 + .../github.com/modern-go/reflect2/reflect2.go | 298 + .../modern-go/reflect2/reflect2_amd64.s | 0 .../modern-go/reflect2/reflect2_kind.go | 30 + .../modern-go/reflect2/relfect2_386.s | 0 .../modern-go/reflect2/relfect2_amd64p32.s | 0 .../modern-go/reflect2/relfect2_arm.s | 0 .../modern-go/reflect2/relfect2_arm64.s | 0 .../modern-go/reflect2/relfect2_mips64x.s | 0 .../modern-go/reflect2/relfect2_mipsx.s | 0 .../modern-go/reflect2/relfect2_ppc64x.s | 0 .../modern-go/reflect2/relfect2_s390x.s | 0 .../modern-go/reflect2/safe_field.go | 58 + .../github.com/modern-go/reflect2/safe_map.go | 101 + .../modern-go/reflect2/safe_slice.go | 92 + .../modern-go/reflect2/safe_struct.go | 29 + .../modern-go/reflect2/safe_type.go | 78 + .../github.com/modern-go/reflect2/test.sh | 12 + .../github.com/modern-go/reflect2/type_map.go | 113 + .../modern-go/reflect2/unsafe_array.go | 65 + .../modern-go/reflect2/unsafe_eface.go | 59 + .../modern-go/reflect2/unsafe_field.go | 74 + .../modern-go/reflect2/unsafe_iface.go | 64 + .../modern-go/reflect2/unsafe_link.go | 70 + .../modern-go/reflect2/unsafe_map.go | 138 + .../modern-go/reflect2/unsafe_ptr.go | 46 + .../modern-go/reflect2/unsafe_slice.go | 177 + .../modern-go/reflect2/unsafe_struct.go | 59 + .../modern-go/reflect2/unsafe_type.go | 85 + .../opencontainers/distribution-spec/LICENSE | 201 + .../distribution-spec/specs-go/v1/error.go | 40 + .../specs-go/v1/repository.go | 20 + .../distribution-spec/specs-go/v1/tags.go | 21 + .../opencontainers/go-digest/.mailmap | 4 + .../opencontainers/go-digest/.pullapprove.yml | 28 + .../opencontainers/go-digest/.travis.yml | 5 + .../opencontainers/go-digest/CONTRIBUTING.md | 72 + .../opencontainers/go-digest/LICENSE | 192 + .../opencontainers/go-digest/LICENSE.docs | 425 + .../opencontainers/go-digest/MAINTAINERS | 5 + .../opencontainers/go-digest/README.md | 96 + .../opencontainers/go-digest/algorithm.go | 193 + .../opencontainers/go-digest/digest.go | 157 + .../opencontainers/go-digest/digester.go | 40 + .../opencontainers/go-digest/doc.go | 62 + .../opencontainers/go-digest/verifiers.go | 46 + .../opencontainers/image-spec/LICENSE | 191 + .../image-spec/specs-go/v1/annotations.go | 56 + .../image-spec/specs-go/v1/config.go | 103 + .../image-spec/specs-go/v1/descriptor.go | 64 + .../image-spec/specs-go/v1/index.go | 32 + .../image-spec/specs-go/v1/layout.go | 28 + .../image-spec/specs-go/v1/manifest.go | 35 + .../image-spec/specs-go/v1/mediatype.go | 48 + .../image-spec/specs-go/version.go | 32 + .../image-spec/specs-go/versioned.go | 23 + .../github.com/opencontainers/runc/LICENSE | 191 + .../github.com/opencontainers/runc/NOTICE | 17 + .../runc/libcontainer/user/lookup_unix.go | 156 + .../runc/libcontainer/user/user.go | 604 + .../runc/libcontainer/user/user_fuzzer.go | 42 + .../vendor/github.com/pkg/errors/.gitignore | 24 + .../vendor/github.com/pkg/errors/.travis.yml | 10 + .../vendor/github.com/pkg/errors/LICENSE | 23 + .../vendor/github.com/pkg/errors/Makefile | 44 + .../vendor/github.com/pkg/errors/README.md | 59 + .../vendor/github.com/pkg/errors/appveyor.yml | 32 + .../vendor/github.com/pkg/errors/errors.go | 288 + .../vendor/github.com/pkg/errors/go113.go | 38 + .../vendor/github.com/pkg/errors/stack.go | 177 + .../prometheus/client_golang/LICENSE | 201 + .../prometheus/client_golang/NOTICE | 23 + .../client_golang/prometheus/.gitignore | 1 + .../client_golang/prometheus/README.md | 1 + .../client_golang/prometheus/collector.go | 120 + .../prometheus/collectors/collectors.go | 16 + .../collectors/dbstats_collector.go | 119 + .../collectors/dbstats_collector_go115.go | 30 + .../collectors/dbstats_collector_pre_go115.go | 26 + .../prometheus/collectors/expvar_collector.go | 57 + .../prometheus/collectors/go_collector.go | 69 + .../collectors/process_collector.go | 56 + .../client_golang/prometheus/counter.go | 321 + .../client_golang/prometheus/desc.go | 186 + .../client_golang/prometheus/doc.go | 199 + .../prometheus/expvar_collector.go | 86 + .../client_golang/prometheus/fnv.go | 42 + .../client_golang/prometheus/gauge.go | 289 + .../client_golang/prometheus/go_collector.go | 367 + .../client_golang/prometheus/histogram.go | 642 + .../prometheus/internal/metric.go | 85 + .../client_golang/prometheus/labels.go | 87 + .../client_golang/prometheus/metric.go | 176 + .../client_golang/prometheus/observer.go | 64 + .../prometheus/process_collector.go | 166 + .../prometheus/process_collector_other.go | 65 + .../prometheus/process_collector_windows.go | 116 + .../prometheus/promhttp/delegator.go | 368 + .../client_golang/prometheus/promhttp/http.go | 383 + .../prometheus/promhttp/instrument_client.go | 219 + .../prometheus/promhttp/instrument_server.go | 458 + .../client_golang/prometheus/registry.go | 950 + .../client_golang/prometheus/summary.go | 744 + .../client_golang/prometheus/timer.go | 54 + .../client_golang/prometheus/untyped.go | 42 + .../client_golang/prometheus/value.go | 212 + .../client_golang/prometheus/vec.go | 556 + .../client_golang/prometheus/wrap.go | 214 + .../prometheus/client_model/LICENSE | 201 + .../github.com/prometheus/client_model/NOTICE | 5 + .../prometheus/client_model/go/metrics.pb.go | 723 + .../github.com/prometheus/common/LICENSE | 201 + .../github.com/prometheus/common/NOTICE | 5 + .../prometheus/common/expfmt/decode.go | 429 + .../prometheus/common/expfmt/encode.go | 162 + .../prometheus/common/expfmt/expfmt.go | 41 + .../prometheus/common/expfmt/fuzz.go | 36 + .../common/expfmt/openmetrics_create.go | 527 + .../prometheus/common/expfmt/text_create.go | 465 + .../prometheus/common/expfmt/text_parse.go | 775 + .../bitbucket.org/ww/goautoneg/README.txt | 67 + .../bitbucket.org/ww/goautoneg/autoneg.go | 162 + .../prometheus/common/model/alert.go | 136 + .../prometheus/common/model/fingerprinting.go | 105 + .../github.com/prometheus/common/model/fnv.go | 42 + .../prometheus/common/model/labels.go | 218 + .../prometheus/common/model/labelset.go | 169 + .../prometheus/common/model/metric.go | 102 + .../prometheus/common/model/model.go | 16 + .../prometheus/common/model/signature.go | 144 + .../prometheus/common/model/silence.go | 106 + .../prometheus/common/model/time.go | 317 + .../prometheus/common/model/value.go | 416 + .../github.com/prometheus/procfs/.gitignore | 1 + .../prometheus/procfs/.golangci.yml | 4 + .../prometheus/procfs/CODE_OF_CONDUCT.md | 3 + .../prometheus/procfs/CONTRIBUTING.md | 121 + .../github.com/prometheus/procfs/LICENSE | 201 + .../prometheus/procfs/MAINTAINERS.md | 2 + .../github.com/prometheus/procfs/Makefile | 29 + .../prometheus/procfs/Makefile.common | 302 + .../github.com/prometheus/procfs/NOTICE | 7 + .../github.com/prometheus/procfs/README.md | 61 + .../github.com/prometheus/procfs/SECURITY.md | 6 + .../github.com/prometheus/procfs/arp.go | 85 + .../github.com/prometheus/procfs/buddyinfo.go | 85 + .../github.com/prometheus/procfs/cpuinfo.go | 481 + .../prometheus/procfs/cpuinfo_armx.go | 19 + .../prometheus/procfs/cpuinfo_mipsx.go | 19 + .../prometheus/procfs/cpuinfo_others.go | 19 + .../prometheus/procfs/cpuinfo_ppcx.go | 19 + .../prometheus/procfs/cpuinfo_riscvx.go | 19 + .../prometheus/procfs/cpuinfo_s390x.go | 18 + .../prometheus/procfs/cpuinfo_x86.go | 19 + .../github.com/prometheus/procfs/crypto.go | 153 + .../github.com/prometheus/procfs/doc.go | 45 + .../prometheus/procfs/fixtures.ttar | 6553 ++ .../vendor/github.com/prometheus/procfs/fs.go | 43 + .../github.com/prometheus/procfs/fscache.go | 422 + .../prometheus/procfs/internal/fs/fs.go | 55 + .../prometheus/procfs/internal/util/parse.go | 97 + .../procfs/internal/util/readfile.go | 38 + .../procfs/internal/util/sysreadfile.go | 48 + .../internal/util/sysreadfile_compat.go | 26 + .../procfs/internal/util/valueparser.go | 91 + .../github.com/prometheus/procfs/ipvs.go | 241 + .../prometheus/procfs/kernel_random.go | 62 + .../github.com/prometheus/procfs/loadavg.go | 62 + .../github.com/prometheus/procfs/mdstat.go | 213 + .../github.com/prometheus/procfs/meminfo.go | 277 + .../github.com/prometheus/procfs/mountinfo.go | 180 + .../prometheus/procfs/mountstats.go | 638 + .../prometheus/procfs/net_conntrackstat.go | 153 + .../github.com/prometheus/procfs/net_dev.go | 205 + .../prometheus/procfs/net_ip_socket.go | 220 + .../prometheus/procfs/net_protocols.go | 180 + .../prometheus/procfs/net_sockstat.go | 163 + .../prometheus/procfs/net_softnet.go | 102 + .../github.com/prometheus/procfs/net_tcp.go | 64 + .../github.com/prometheus/procfs/net_udp.go | 64 + .../github.com/prometheus/procfs/net_unix.go | 257 + .../github.com/prometheus/procfs/proc.go | 319 + .../prometheus/procfs/proc_cgroup.go | 98 + .../prometheus/procfs/proc_environ.go | 37 + .../prometheus/procfs/proc_fdinfo.go | 133 + .../github.com/prometheus/procfs/proc_io.go | 59 + .../prometheus/procfs/proc_limits.go | 160 + .../github.com/prometheus/procfs/proc_maps.go | 209 + .../github.com/prometheus/procfs/proc_ns.go | 68 + .../github.com/prometheus/procfs/proc_psi.go | 100 + .../prometheus/procfs/proc_smaps.go | 165 + .../github.com/prometheus/procfs/proc_stat.go | 189 + .../prometheus/procfs/proc_status.go | 170 + .../github.com/prometheus/procfs/schedstat.go | 121 + .../github.com/prometheus/procfs/slab.go | 151 + .../github.com/prometheus/procfs/stat.go | 244 + .../github.com/prometheus/procfs/swaps.go | 89 + .../vendor/github.com/prometheus/procfs/ttar | 413 + .../vendor/github.com/prometheus/procfs/vm.go | 210 + .../github.com/prometheus/procfs/xfrm.go | 186 + .../github.com/prometheus/procfs/zoneinfo.go | 196 + .../github.com/sirupsen/logrus/.gitignore | 4 + .../github.com/sirupsen/logrus/.golangci.yml | 40 + .../github.com/sirupsen/logrus/.travis.yml | 15 + .../github.com/sirupsen/logrus/CHANGELOG.md | 259 + .../vendor/github.com/sirupsen/logrus/LICENSE | 21 + .../github.com/sirupsen/logrus/README.md | 513 + .../github.com/sirupsen/logrus/alt_exit.go | 76 + .../github.com/sirupsen/logrus/appveyor.yml | 14 + .../github.com/sirupsen/logrus/buffer_pool.go | 52 + .../vendor/github.com/sirupsen/logrus/doc.go | 26 + .../github.com/sirupsen/logrus/entry.go | 431 + .../github.com/sirupsen/logrus/exported.go | 270 + .../github.com/sirupsen/logrus/formatter.go | 78 + .../github.com/sirupsen/logrus/hooks.go | 34 + .../sirupsen/logrus/json_formatter.go | 128 + .../github.com/sirupsen/logrus/logger.go | 404 + .../github.com/sirupsen/logrus/logrus.go | 186 + .../logrus/terminal_check_appengine.go | 11 + .../sirupsen/logrus/terminal_check_bsd.go | 13 + .../sirupsen/logrus/terminal_check_js.go | 7 + .../logrus/terminal_check_no_terminal.go | 11 + .../logrus/terminal_check_notappengine.go | 17 + .../sirupsen/logrus/terminal_check_solaris.go | 11 + .../sirupsen/logrus/terminal_check_unix.go | 13 + .../sirupsen/logrus/terminal_check_windows.go | 27 + .../sirupsen/logrus/text_formatter.go | 339 + .../github.com/sirupsen/logrus/writer.go | 70 + .../vendor/github.com/spf13/cobra/.gitignore | 39 + .../github.com/spf13/cobra/.golangci.yml | 48 + .../vendor/github.com/spf13/cobra/.mailmap | 3 + .../github.com/spf13/cobra/CHANGELOG.md | 51 + .../vendor/github.com/spf13/cobra/CONDUCT.md | 37 + .../github.com/spf13/cobra/CONTRIBUTING.md | 50 + .../vendor/github.com/spf13/cobra/LICENSE.txt | 174 + .../vendor/github.com/spf13/cobra/Makefile | 40 + .../vendor/github.com/spf13/cobra/README.md | 125 + .../vendor/github.com/spf13/cobra/args.go | 109 + .../spf13/cobra/bash_completions.go | 685 + .../spf13/cobra/bash_completions.md | 93 + .../spf13/cobra/bash_completionsV2.go | 302 + .../vendor/github.com/spf13/cobra/cobra.go | 222 + .../vendor/github.com/spf13/cobra/command.go | 1680 + .../github.com/spf13/cobra/command_notwin.go | 5 + .../github.com/spf13/cobra/command_win.go | 26 + .../github.com/spf13/cobra/completions.go | 781 + .../spf13/cobra/fish_completions.go | 219 + .../spf13/cobra/fish_completions.md | 4 + .../spf13/cobra/powershell_completions.go | 285 + .../spf13/cobra/powershell_completions.md | 3 + .../spf13/cobra/projects_using_cobra.md | 38 + .../spf13/cobra/shell_completions.go | 84 + .../spf13/cobra/shell_completions.md | 546 + .../github.com/spf13/cobra/user_guide.md | 637 + .../github.com/spf13/cobra/zsh_completions.go | 258 + .../github.com/spf13/cobra/zsh_completions.md | 48 + .../vendor/github.com/spf13/pflag/.gitignore | 2 + .../vendor/github.com/spf13/pflag/.travis.yml | 22 + .../vendor/github.com/spf13/pflag/LICENSE | 28 + .../vendor/github.com/spf13/pflag/README.md | 296 + .../vendor/github.com/spf13/pflag/bool.go | 94 + .../github.com/spf13/pflag/bool_slice.go | 185 + .../vendor/github.com/spf13/pflag/bytes.go | 209 + .../vendor/github.com/spf13/pflag/count.go | 96 + .../vendor/github.com/spf13/pflag/duration.go | 86 + .../github.com/spf13/pflag/duration_slice.go | 166 + .../vendor/github.com/spf13/pflag/flag.go | 1239 + .../vendor/github.com/spf13/pflag/float32.go | 88 + .../github.com/spf13/pflag/float32_slice.go | 174 + .../vendor/github.com/spf13/pflag/float64.go | 84 + .../github.com/spf13/pflag/float64_slice.go | 166 + .../github.com/spf13/pflag/golangflag.go | 105 + .../vendor/github.com/spf13/pflag/int.go | 84 + .../vendor/github.com/spf13/pflag/int16.go | 88 + .../vendor/github.com/spf13/pflag/int32.go | 88 + .../github.com/spf13/pflag/int32_slice.go | 174 + .../vendor/github.com/spf13/pflag/int64.go | 84 + .../github.com/spf13/pflag/int64_slice.go | 166 + .../vendor/github.com/spf13/pflag/int8.go | 88 + .../github.com/spf13/pflag/int_slice.go | 158 + .../vendor/github.com/spf13/pflag/ip.go | 94 + .../vendor/github.com/spf13/pflag/ip_slice.go | 186 + .../vendor/github.com/spf13/pflag/ipmask.go | 122 + .../vendor/github.com/spf13/pflag/ipnet.go | 98 + .../vendor/github.com/spf13/pflag/string.go | 80 + .../github.com/spf13/pflag/string_array.go | 129 + .../github.com/spf13/pflag/string_slice.go | 163 + .../github.com/spf13/pflag/string_to_int.go | 149 + .../github.com/spf13/pflag/string_to_int64.go | 149 + .../spf13/pflag/string_to_string.go | 160 + .../vendor/github.com/spf13/pflag/uint.go | 88 + .../vendor/github.com/spf13/pflag/uint16.go | 88 + .../vendor/github.com/spf13/pflag/uint32.go | 88 + .../vendor/github.com/spf13/pflag/uint64.go | 88 + .../vendor/github.com/spf13/pflag/uint8.go | 88 + .../github.com/spf13/pflag/uint_slice.go | 168 + .../gojsonpointer/LICENSE-APACHE-2.0.txt | 202 + .../xeipuuv/gojsonpointer/README.md | 41 + .../xeipuuv/gojsonpointer/pointer.go | 211 + .../gojsonreference/LICENSE-APACHE-2.0.txt | 202 + .../xeipuuv/gojsonreference/README.md | 10 + .../xeipuuv/gojsonreference/reference.go | 147 + .../xeipuuv/gojsonschema/.gitignore | 3 + .../xeipuuv/gojsonschema/.travis.yml | 9 + .../gojsonschema/LICENSE-APACHE-2.0.txt | 202 + .../github.com/xeipuuv/gojsonschema/README.md | 466 + .../github.com/xeipuuv/gojsonschema/draft.go | 125 + .../github.com/xeipuuv/gojsonschema/errors.go | 364 + .../xeipuuv/gojsonschema/format_checkers.go | 368 + .../xeipuuv/gojsonschema/glide.yaml | 13 + .../xeipuuv/gojsonschema/internalLog.go | 37 + .../xeipuuv/gojsonschema/jsonContext.go | 73 + .../xeipuuv/gojsonschema/jsonLoader.go | 386 + .../xeipuuv/gojsonschema/locales.go | 472 + .../github.com/xeipuuv/gojsonschema/result.go | 220 + .../github.com/xeipuuv/gojsonschema/schema.go | 1087 + .../xeipuuv/gojsonschema/schemaLoader.go | 206 + .../xeipuuv/gojsonschema/schemaPool.go | 215 + .../gojsonschema/schemaReferencePool.go | 68 + .../xeipuuv/gojsonschema/schemaType.go | 83 + .../xeipuuv/gojsonschema/subSchema.go | 149 + .../github.com/xeipuuv/gojsonschema/types.go | 62 + .../github.com/xeipuuv/gojsonschema/utils.go | 197 + .../xeipuuv/gojsonschema/validation.go | 858 + .../vendor/go.uber.org/atomic/.codecov.yml | 19 + .../vendor/go.uber.org/atomic/.gitignore | 12 + .../vendor/go.uber.org/atomic/.travis.yml | 27 + .../vendor/go.uber.org/atomic/CHANGELOG.md | 76 + .../vendor/go.uber.org/atomic/LICENSE.txt | 19 + .../vendor/go.uber.org/atomic/Makefile | 78 + .../vendor/go.uber.org/atomic/README.md | 63 + .../vendor/go.uber.org/atomic/bool.go | 81 + .../vendor/go.uber.org/atomic/bool_ext.go | 53 + .../vendor/go.uber.org/atomic/doc.go | 23 + .../vendor/go.uber.org/atomic/duration.go | 82 + .../vendor/go.uber.org/atomic/duration_ext.go | 40 + .../vendor/go.uber.org/atomic/error.go | 51 + .../vendor/go.uber.org/atomic/error_ext.go | 39 + .../vendor/go.uber.org/atomic/float64.go | 76 + .../vendor/go.uber.org/atomic/float64_ext.go | 47 + .../vendor/go.uber.org/atomic/gen.go | 26 + .../vendor/go.uber.org/atomic/int32.go | 102 + .../vendor/go.uber.org/atomic/int64.go | 102 + .../vendor/go.uber.org/atomic/nocmp.go | 35 + .../vendor/go.uber.org/atomic/string.go | 54 + .../vendor/go.uber.org/atomic/string_ext.go | 43 + .../vendor/go.uber.org/atomic/uint32.go | 102 + .../vendor/go.uber.org/atomic/uint64.go | 102 + .../vendor/go.uber.org/atomic/value.go | 31 + .../vendor/go.uber.org/multierr/.codecov.yml | 15 + .../vendor/go.uber.org/multierr/.gitignore | 4 + .../vendor/go.uber.org/multierr/.travis.yml | 23 + .../vendor/go.uber.org/multierr/CHANGELOG.md | 60 + .../vendor/go.uber.org/multierr/LICENSE.txt | 19 + .../vendor/go.uber.org/multierr/Makefile | 42 + .../vendor/go.uber.org/multierr/README.md | 23 + .../vendor/go.uber.org/multierr/error.go | 449 + .../vendor/go.uber.org/multierr/glide.yaml | 8 + .../vendor/go.uber.org/multierr/go113.go | 52 + .../vendor/go.uber.org/zap/.codecov.yml | 17 + .../vendor/go.uber.org/zap/.gitignore | 32 + .../vendor/go.uber.org/zap/.readme.tmpl | 109 + .../vendor/go.uber.org/zap/CHANGELOG.md | 516 + .../vendor/go.uber.org/zap/CODE_OF_CONDUCT.md | 75 + .../vendor/go.uber.org/zap/CONTRIBUTING.md | 75 + .../vendor/go.uber.org/zap/FAQ.md | 164 + .../vendor/go.uber.org/zap/LICENSE.txt | 19 + .../vendor/go.uber.org/zap/Makefile | 73 + .../vendor/go.uber.org/zap/README.md | 134 + .../vendor/go.uber.org/zap/array.go | 320 + .../vendor/go.uber.org/zap/buffer/buffer.go | 141 + .../vendor/go.uber.org/zap/buffer/pool.go | 49 + .../vendor/go.uber.org/zap/checklicense.sh | 17 + .../vendor/go.uber.org/zap/config.go | 264 + .../vendor/go.uber.org/zap/doc.go | 113 + .../vendor/go.uber.org/zap/encoder.go | 79 + .../vendor/go.uber.org/zap/error.go | 80 + .../vendor/go.uber.org/zap/field.go | 549 + .../vendor/go.uber.org/zap/flag.go | 39 + .../vendor/go.uber.org/zap/glide.yaml | 34 + .../vendor/go.uber.org/zap/global.go | 168 + .../vendor/go.uber.org/zap/global_go112.go | 26 + .../vendor/go.uber.org/zap/global_prego112.go | 26 + .../vendor/go.uber.org/zap/http_handler.go | 132 + .../zap/internal/bufferpool/bufferpool.go | 31 + .../go.uber.org/zap/internal/color/color.go | 44 + .../go.uber.org/zap/internal/exit/exit.go | 64 + .../vendor/go.uber.org/zap/level.go | 132 + .../vendor/go.uber.org/zap/logger.go | 348 + .../vendor/go.uber.org/zap/options.go | 148 + .../vendor/go.uber.org/zap/sink.go | 161 + .../vendor/go.uber.org/zap/stacktrace.go | 85 + .../vendor/go.uber.org/zap/sugar.go | 315 + .../vendor/go.uber.org/zap/time.go | 27 + .../vendor/go.uber.org/zap/writer.go | 99 + .../zap/zapcore/buffered_write_syncer.go | 188 + .../vendor/go.uber.org/zap/zapcore/clock.go | 50 + .../zap/zapcore/console_encoder.go | 161 + .../vendor/go.uber.org/zap/zapcore/core.go | 113 + .../vendor/go.uber.org/zap/zapcore/doc.go | 24 + .../vendor/go.uber.org/zap/zapcore/encoder.go | 443 + .../vendor/go.uber.org/zap/zapcore/entry.go | 262 + .../vendor/go.uber.org/zap/zapcore/error.go | 132 + .../vendor/go.uber.org/zap/zapcore/field.go | 233 + .../vendor/go.uber.org/zap/zapcore/hook.go | 68 + .../go.uber.org/zap/zapcore/increase_level.go | 66 + .../go.uber.org/zap/zapcore/json_encoder.go | 542 + .../vendor/go.uber.org/zap/zapcore/level.go | 175 + .../go.uber.org/zap/zapcore/level_strings.go | 46 + .../go.uber.org/zap/zapcore/marshaler.go | 61 + .../go.uber.org/zap/zapcore/memory_encoder.go | 179 + .../vendor/go.uber.org/zap/zapcore/sampler.go | 210 + .../vendor/go.uber.org/zap/zapcore/tee.go | 81 + .../go.uber.org/zap/zapcore/write_syncer.go | 122 + .../vendor/golang.org/x/net/AUTHORS | 3 + .../vendor/golang.org/x/net/CONTRIBUTORS | 3 + .../vendor/golang.org/x/net/LICENSE | 27 + .../vendor/golang.org/x/net/PATENTS | 22 + .../golang.org/x/net/context/context.go | 56 + .../x/net/context/ctxhttp/ctxhttp.go | 71 + .../vendor/golang.org/x/net/context/go17.go | 73 + .../vendor/golang.org/x/net/context/go19.go | 21 + .../golang.org/x/net/context/pre_go17.go | 301 + .../golang.org/x/net/context/pre_go19.go | 110 + .../golang.org/x/net/http/httpguts/guts.go | 50 + .../golang.org/x/net/http/httpguts/httplex.go | 348 + .../vendor/golang.org/x/net/http2/.gitignore | 2 + .../vendor/golang.org/x/net/http2/Dockerfile | 51 + .../vendor/golang.org/x/net/http2/Makefile | 3 + .../vendor/golang.org/x/net/http2/ascii.go | 53 + .../vendor/golang.org/x/net/http2/ciphers.go | 641 + .../x/net/http2/client_conn_pool.go | 310 + .../golang.org/x/net/http2/databuffer.go | 146 + .../vendor/golang.org/x/net/http2/errors.go | 145 + .../vendor/golang.org/x/net/http2/flow.go | 52 + .../vendor/golang.org/x/net/http2/frame.go | 1648 + .../vendor/golang.org/x/net/http2/go111.go | 30 + .../vendor/golang.org/x/net/http2/go115.go | 27 + .../vendor/golang.org/x/net/http2/gotrack.go | 170 + .../golang.org/x/net/http2/headermap.go | 87 + .../golang.org/x/net/http2/hpack/encode.go | 240 + .../golang.org/x/net/http2/hpack/hpack.go | 504 + .../golang.org/x/net/http2/hpack/huffman.go | 229 + .../golang.org/x/net/http2/hpack/tables.go | 479 + .../vendor/golang.org/x/net/http2/http2.go | 385 + .../golang.org/x/net/http2/not_go111.go | 21 + .../golang.org/x/net/http2/not_go115.go | 31 + .../vendor/golang.org/x/net/http2/pipe.go | 179 + .../vendor/golang.org/x/net/http2/server.go | 3024 + .../golang.org/x/net/http2/transport.go | 2866 + .../vendor/golang.org/x/net/http2/write.go | 370 + .../golang.org/x/net/http2/writesched.go | 248 + .../x/net/http2/writesched_priority.go | 452 + .../x/net/http2/writesched_random.go | 77 + .../golang.org/x/net/idna/idna10.0.0.go | 770 + .../vendor/golang.org/x/net/idna/idna9.0.0.go | 718 + .../vendor/golang.org/x/net/idna/punycode.go | 203 + .../golang.org/x/net/idna/tables10.0.0.go | 4560 ++ .../golang.org/x/net/idna/tables11.0.0.go | 4654 ++ .../golang.org/x/net/idna/tables12.0.0.go | 4734 ++ .../golang.org/x/net/idna/tables13.0.0.go | 4840 ++ .../golang.org/x/net/idna/tables9.0.0.go | 4487 ++ .../vendor/golang.org/x/net/idna/trie.go | 72 + .../vendor/golang.org/x/net/idna/trieval.go | 119 + .../vendor/golang.org/x/oauth2/.travis.yml | 13 + .../vendor/golang.org/x/oauth2/AUTHORS | 3 + .../golang.org/x/oauth2/CONTRIBUTING.md | 26 + .../vendor/golang.org/x/oauth2/CONTRIBUTORS | 3 + .../vendor/golang.org/x/oauth2/LICENSE | 27 + .../vendor/golang.org/x/oauth2/README.md | 36 + .../x/oauth2/internal/client_appengine.go | 14 + .../golang.org/x/oauth2/internal/doc.go | 6 + .../golang.org/x/oauth2/internal/oauth2.go | 37 + .../golang.org/x/oauth2/internal/token.go | 294 + .../golang.org/x/oauth2/internal/transport.go | 33 + .../vendor/golang.org/x/oauth2/oauth2.go | 381 + .../vendor/golang.org/x/oauth2/token.go | 178 + .../vendor/golang.org/x/oauth2/transport.go | 89 + .../vendor/golang.org/x/sync/AUTHORS | 3 + .../vendor/golang.org/x/sync/CONTRIBUTORS | 3 + .../vendor/golang.org/x/sync/LICENSE | 27 + .../vendor/golang.org/x/sync/PATENTS | 22 + .../golang.org/x/sync/errgroup/errgroup.go | 66 + .../golang.org/x/sync/semaphore/semaphore.go | 136 + .../vendor/golang.org/x/sys/AUTHORS | 3 + .../vendor/golang.org/x/sys/CONTRIBUTORS | 3 + .../vendor/golang.org/x/sys/LICENSE | 27 + .../vendor/golang.org/x/sys/PATENTS | 22 + .../golang.org/x/sys/execabs/execabs.go | 102 + .../sys/internal/unsafeheader/unsafeheader.go | 30 + .../vendor/golang.org/x/sys/plan9/asm.s | 8 + .../golang.org/x/sys/plan9/asm_plan9_386.s | 30 + .../golang.org/x/sys/plan9/asm_plan9_amd64.s | 30 + .../golang.org/x/sys/plan9/asm_plan9_arm.s | 25 + .../golang.org/x/sys/plan9/const_plan9.go | 70 + .../golang.org/x/sys/plan9/dir_plan9.go | 212 + .../golang.org/x/sys/plan9/env_plan9.go | 31 + .../golang.org/x/sys/plan9/errors_plan9.go | 50 + .../vendor/golang.org/x/sys/plan9/mkall.sh | 150 + .../vendor/golang.org/x/sys/plan9/mkerrors.sh | 246 + .../golang.org/x/sys/plan9/mksysnum_plan9.sh | 23 + .../golang.org/x/sys/plan9/pwd_go15_plan9.go | 21 + .../golang.org/x/sys/plan9/pwd_plan9.go | 23 + .../vendor/golang.org/x/sys/plan9/race.go | 30 + .../vendor/golang.org/x/sys/plan9/race0.go | 25 + .../vendor/golang.org/x/sys/plan9/str.go | 22 + .../vendor/golang.org/x/sys/plan9/syscall.go | 116 + .../golang.org/x/sys/plan9/syscall_plan9.go | 349 + .../x/sys/plan9/zsyscall_plan9_386.go | 284 + .../x/sys/plan9/zsyscall_plan9_amd64.go | 284 + .../x/sys/plan9/zsyscall_plan9_arm.go | 284 + .../golang.org/x/sys/plan9/zsysnum_plan9.go | 49 + .../vendor/golang.org/x/sys/unix/.gitignore | 2 + .../vendor/golang.org/x/sys/unix/README.md | 184 + .../golang.org/x/sys/unix/affinity_linux.go | 86 + .../vendor/golang.org/x/sys/unix/aliases.go | 15 + .../golang.org/x/sys/unix/asm_aix_ppc64.s | 18 + .../golang.org/x/sys/unix/asm_bsd_386.s | 29 + .../golang.org/x/sys/unix/asm_bsd_amd64.s | 29 + .../golang.org/x/sys/unix/asm_bsd_arm.s | 29 + .../golang.org/x/sys/unix/asm_bsd_arm64.s | 29 + .../golang.org/x/sys/unix/asm_linux_386.s | 66 + .../golang.org/x/sys/unix/asm_linux_amd64.s | 58 + .../golang.org/x/sys/unix/asm_linux_arm.s | 57 + .../golang.org/x/sys/unix/asm_linux_arm64.s | 53 + .../golang.org/x/sys/unix/asm_linux_mips64x.s | 57 + .../golang.org/x/sys/unix/asm_linux_mipsx.s | 55 + .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 45 + .../golang.org/x/sys/unix/asm_linux_riscv64.s | 49 + .../golang.org/x/sys/unix/asm_linux_s390x.s | 57 + .../x/sys/unix/asm_openbsd_mips64.s | 30 + .../golang.org/x/sys/unix/asm_solaris_amd64.s | 18 + .../golang.org/x/sys/unix/asm_zos_s390x.s | 426 + .../golang.org/x/sys/unix/bluetooth_linux.go | 36 + .../golang.org/x/sys/unix/cap_freebsd.go | 196 + .../vendor/golang.org/x/sys/unix/constants.go | 14 + .../golang.org/x/sys/unix/dev_aix_ppc.go | 27 + .../golang.org/x/sys/unix/dev_aix_ppc64.go | 29 + .../golang.org/x/sys/unix/dev_darwin.go | 24 + .../golang.org/x/sys/unix/dev_dragonfly.go | 30 + .../golang.org/x/sys/unix/dev_freebsd.go | 30 + .../vendor/golang.org/x/sys/unix/dev_linux.go | 42 + .../golang.org/x/sys/unix/dev_netbsd.go | 29 + .../golang.org/x/sys/unix/dev_openbsd.go | 29 + .../vendor/golang.org/x/sys/unix/dev_zos.go | 29 + .../vendor/golang.org/x/sys/unix/dirent.go | 103 + .../golang.org/x/sys/unix/endian_big.go | 10 + .../golang.org/x/sys/unix/endian_little.go | 10 + .../vendor/golang.org/x/sys/unix/env_unix.go | 32 + .../vendor/golang.org/x/sys/unix/epoll_zos.go | 221 + .../x/sys/unix/errors_freebsd_386.go | 233 + .../x/sys/unix/errors_freebsd_amd64.go | 233 + .../x/sys/unix/errors_freebsd_arm.go | 226 + .../x/sys/unix/errors_freebsd_arm64.go | 17 + .../vendor/golang.org/x/sys/unix/fcntl.go | 37 + .../golang.org/x/sys/unix/fcntl_darwin.go | 24 + .../x/sys/unix/fcntl_linux_32bit.go | 14 + .../vendor/golang.org/x/sys/unix/fdset.go | 30 + .../golang.org/x/sys/unix/fstatfs_zos.go | 164 + .../vendor/golang.org/x/sys/unix/gccgo.go | 60 + .../vendor/golang.org/x/sys/unix/gccgo_c.c | 45 + .../x/sys/unix/gccgo_linux_amd64.go | 21 + .../golang.org/x/sys/unix/ifreq_linux.go | 149 + .../vendor/golang.org/x/sys/unix/ioctl.go | 75 + .../golang.org/x/sys/unix/ioctl_linux.go | 196 + .../vendor/golang.org/x/sys/unix/ioctl_zos.go | 74 + .../vendor/golang.org/x/sys/unix/mkall.sh | 231 + .../vendor/golang.org/x/sys/unix/mkerrors.sh | 762 + .../golang.org/x/sys/unix/pagesize_unix.go | 16 + .../golang.org/x/sys/unix/pledge_openbsd.go | 163 + .../golang.org/x/sys/unix/ptrace_darwin.go | 12 + .../golang.org/x/sys/unix/ptrace_ios.go | 12 + .../vendor/golang.org/x/sys/unix/race.go | 31 + .../vendor/golang.org/x/sys/unix/race0.go | 26 + .../x/sys/unix/readdirent_getdents.go | 13 + .../x/sys/unix/readdirent_getdirentries.go | 20 + .../x/sys/unix/sockcmsg_dragonfly.go | 16 + .../golang.org/x/sys/unix/sockcmsg_linux.go | 36 + .../golang.org/x/sys/unix/sockcmsg_unix.go | 93 + .../x/sys/unix/sockcmsg_unix_other.go | 47 + .../vendor/golang.org/x/sys/unix/str.go | 27 + .../vendor/golang.org/x/sys/unix/syscall.go | 95 + .../golang.org/x/sys/unix/syscall_aix.go | 553 + .../golang.org/x/sys/unix/syscall_aix_ppc.go | 54 + .../x/sys/unix/syscall_aix_ppc64.go | 85 + .../golang.org/x/sys/unix/syscall_bsd.go | 664 + .../x/sys/unix/syscall_darwin.1_12.go | 32 + .../x/sys/unix/syscall_darwin.1_13.go | 108 + .../golang.org/x/sys/unix/syscall_darwin.go | 722 + .../x/sys/unix/syscall_darwin_amd64.go | 51 + .../x/sys/unix/syscall_darwin_arm64.go | 51 + .../x/sys/unix/syscall_darwin_libSystem.go | 27 + .../x/sys/unix/syscall_dragonfly.go | 541 + .../x/sys/unix/syscall_dragonfly_amd64.go | 57 + .../golang.org/x/sys/unix/syscall_freebsd.go | 872 + .../x/sys/unix/syscall_freebsd_386.go | 67 + .../x/sys/unix/syscall_freebsd_amd64.go | 67 + .../x/sys/unix/syscall_freebsd_arm.go | 63 + .../x/sys/unix/syscall_freebsd_arm64.go | 63 + .../golang.org/x/sys/unix/syscall_illumos.go | 186 + .../golang.org/x/sys/unix/syscall_linux.go | 2426 + .../x/sys/unix/syscall_linux_386.go | 354 + .../x/sys/unix/syscall_linux_amd64.go | 151 + .../x/sys/unix/syscall_linux_amd64_gc.go | 13 + .../x/sys/unix/syscall_linux_arm.go | 249 + .../x/sys/unix/syscall_linux_arm64.go | 199 + .../golang.org/x/sys/unix/syscall_linux_gc.go | 15 + .../x/sys/unix/syscall_linux_gc_386.go | 17 + .../x/sys/unix/syscall_linux_gc_arm.go | 14 + .../x/sys/unix/syscall_linux_gccgo_386.go | 31 + .../x/sys/unix/syscall_linux_gccgo_arm.go | 21 + .../x/sys/unix/syscall_linux_mips64x.go | 196 + .../x/sys/unix/syscall_linux_mipsx.go | 208 + .../x/sys/unix/syscall_linux_ppc.go | 237 + .../x/sys/unix/syscall_linux_ppc64x.go | 123 + .../x/sys/unix/syscall_linux_riscv64.go | 184 + .../x/sys/unix/syscall_linux_s390x.go | 311 + .../x/sys/unix/syscall_linux_sparc64.go | 119 + .../golang.org/x/sys/unix/syscall_netbsd.go | 618 + .../x/sys/unix/syscall_netbsd_386.go | 38 + .../x/sys/unix/syscall_netbsd_amd64.go | 38 + .../x/sys/unix/syscall_netbsd_arm.go | 38 + .../x/sys/unix/syscall_netbsd_arm64.go | 38 + .../golang.org/x/sys/unix/syscall_openbsd.go | 390 + .../x/sys/unix/syscall_openbsd_386.go | 42 + .../x/sys/unix/syscall_openbsd_amd64.go | 42 + .../x/sys/unix/syscall_openbsd_arm.go | 42 + .../x/sys/unix/syscall_openbsd_arm64.go | 42 + .../x/sys/unix/syscall_openbsd_mips64.go | 35 + .../golang.org/x/sys/unix/syscall_solaris.go | 986 + .../x/sys/unix/syscall_solaris_amd64.go | 28 + .../golang.org/x/sys/unix/syscall_unix.go | 435 + .../golang.org/x/sys/unix/syscall_unix_gc.go | 18 + .../x/sys/unix/syscall_unix_gc_ppc64x.go | 25 + .../x/sys/unix/syscall_zos_s390x.go | 1829 + .../golang.org/x/sys/unix/sysvshm_linux.go | 21 + .../golang.org/x/sys/unix/sysvshm_unix.go | 61 + .../x/sys/unix/sysvshm_unix_other.go | 14 + .../golang.org/x/sys/unix/timestruct.go | 77 + .../golang.org/x/sys/unix/unveil_openbsd.go | 42 + .../vendor/golang.org/x/sys/unix/xattr_bsd.go | 241 + .../golang.org/x/sys/unix/zerrors_aix_ppc.go | 1385 + .../x/sys/unix/zerrors_aix_ppc64.go | 1386 + .../x/sys/unix/zerrors_darwin_amd64.go | 1892 + .../x/sys/unix/zerrors_darwin_arm64.go | 1892 + .../x/sys/unix/zerrors_dragonfly_amd64.go | 1738 + .../x/sys/unix/zerrors_freebsd_386.go | 1948 + .../x/sys/unix/zerrors_freebsd_amd64.go | 1947 + .../x/sys/unix/zerrors_freebsd_arm.go | 1846 + .../x/sys/unix/zerrors_freebsd_arm64.go | 1948 + .../golang.org/x/sys/unix/zerrors_linux.go | 2969 + .../x/sys/unix/zerrors_linux_386.go | 822 + .../x/sys/unix/zerrors_linux_amd64.go | 822 + .../x/sys/unix/zerrors_linux_arm.go | 828 + .../x/sys/unix/zerrors_linux_arm64.go | 819 + .../x/sys/unix/zerrors_linux_mips.go | 829 + .../x/sys/unix/zerrors_linux_mips64.go | 829 + .../x/sys/unix/zerrors_linux_mips64le.go | 829 + .../x/sys/unix/zerrors_linux_mipsle.go | 829 + .../x/sys/unix/zerrors_linux_ppc.go | 881 + .../x/sys/unix/zerrors_linux_ppc64.go | 885 + .../x/sys/unix/zerrors_linux_ppc64le.go | 885 + .../x/sys/unix/zerrors_linux_riscv64.go | 809 + .../x/sys/unix/zerrors_linux_s390x.go | 884 + .../x/sys/unix/zerrors_linux_sparc64.go | 879 + .../x/sys/unix/zerrors_netbsd_386.go | 1780 + .../x/sys/unix/zerrors_netbsd_amd64.go | 1770 + .../x/sys/unix/zerrors_netbsd_arm.go | 1759 + .../x/sys/unix/zerrors_netbsd_arm64.go | 1770 + .../x/sys/unix/zerrors_openbsd_386.go | 1668 + .../x/sys/unix/zerrors_openbsd_amd64.go | 1775 + .../x/sys/unix/zerrors_openbsd_arm.go | 1670 + .../x/sys/unix/zerrors_openbsd_arm64.go | 1798 + .../x/sys/unix/zerrors_openbsd_mips64.go | 1863 + .../x/sys/unix/zerrors_solaris_amd64.go | 1557 + .../x/sys/unix/zerrors_zos_s390x.go | 860 + .../x/sys/unix/zptrace_armnn_linux.go | 42 + .../x/sys/unix/zptrace_linux_arm64.go | 17 + .../x/sys/unix/zptrace_mipsnn_linux.go | 51 + .../x/sys/unix/zptrace_mipsnnle_linux.go | 51 + .../x/sys/unix/zptrace_x86_linux.go | 81 + .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 1485 + .../x/sys/unix/zsyscall_aix_ppc64.go | 1443 + .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 1192 + .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 1070 + .../x/sys/unix/zsyscall_darwin_amd64.1_13.go | 40 + .../x/sys/unix/zsyscall_darwin_amd64.1_13.s | 25 + .../x/sys/unix/zsyscall_darwin_amd64.go | 2490 + .../x/sys/unix/zsyscall_darwin_amd64.s | 883 + .../x/sys/unix/zsyscall_darwin_arm64.1_13.go | 40 + .../x/sys/unix/zsyscall_darwin_arm64.1_13.s | 25 + .../x/sys/unix/zsyscall_darwin_arm64.go | 2490 + .../x/sys/unix/zsyscall_darwin_arm64.s | 859 + .../x/sys/unix/zsyscall_dragonfly_amd64.go | 1679 + .../x/sys/unix/zsyscall_freebsd_386.go | 2016 + .../x/sys/unix/zsyscall_freebsd_amd64.go | 2016 + .../x/sys/unix/zsyscall_freebsd_arm.go | 2016 + .../x/sys/unix/zsyscall_freebsd_arm64.go | 2016 + .../x/sys/unix/zsyscall_illumos_amd64.go | 128 + .../golang.org/x/sys/unix/zsyscall_linux.go | 2019 + .../x/sys/unix/zsyscall_linux_386.go | 526 + .../x/sys/unix/zsyscall_linux_amd64.go | 693 + .../x/sys/unix/zsyscall_linux_arm.go | 663 + .../x/sys/unix/zsyscall_linux_arm64.go | 603 + .../x/sys/unix/zsyscall_linux_mips.go | 704 + .../x/sys/unix/zsyscall_linux_mips64.go | 698 + .../x/sys/unix/zsyscall_linux_mips64le.go | 698 + .../x/sys/unix/zsyscall_linux_mipsle.go | 704 + .../x/sys/unix/zsyscall_linux_ppc.go | 709 + .../x/sys/unix/zsyscall_linux_ppc64.go | 755 + .../x/sys/unix/zsyscall_linux_ppc64le.go | 755 + .../x/sys/unix/zsyscall_linux_riscv64.go | 583 + .../x/sys/unix/zsyscall_linux_s390x.go | 535 + .../x/sys/unix/zsyscall_linux_sparc64.go | 699 + .../x/sys/unix/zsyscall_netbsd_386.go | 1862 + .../x/sys/unix/zsyscall_netbsd_amd64.go | 1862 + .../x/sys/unix/zsyscall_netbsd_arm.go | 1862 + .../x/sys/unix/zsyscall_netbsd_arm64.go | 1862 + .../x/sys/unix/zsyscall_openbsd_386.go | 1693 + .../x/sys/unix/zsyscall_openbsd_amd64.go | 1693 + .../x/sys/unix/zsyscall_openbsd_arm.go | 1693 + .../x/sys/unix/zsyscall_openbsd_arm64.go | 1693 + .../x/sys/unix/zsyscall_openbsd_mips64.go | 1693 + .../x/sys/unix/zsyscall_solaris_amd64.go | 2053 + .../x/sys/unix/zsyscall_zos_s390x.go | 1255 + .../x/sys/unix/zsysctl_openbsd_386.go | 274 + .../x/sys/unix/zsysctl_openbsd_amd64.go | 272 + .../x/sys/unix/zsysctl_openbsd_arm.go | 274 + .../x/sys/unix/zsysctl_openbsd_arm64.go | 276 + .../x/sys/unix/zsysctl_openbsd_mips64.go | 280 + .../x/sys/unix/zsysnum_darwin_amd64.go | 440 + .../x/sys/unix/zsysnum_darwin_arm64.go | 438 + .../x/sys/unix/zsysnum_dragonfly_amd64.go | 317 + .../x/sys/unix/zsysnum_freebsd_386.go | 397 + .../x/sys/unix/zsysnum_freebsd_amd64.go | 397 + .../x/sys/unix/zsysnum_freebsd_arm.go | 397 + .../x/sys/unix/zsysnum_freebsd_arm64.go | 397 + .../x/sys/unix/zsysnum_linux_386.go | 447 + .../x/sys/unix/zsysnum_linux_amd64.go | 369 + .../x/sys/unix/zsysnum_linux_arm.go | 410 + .../x/sys/unix/zsysnum_linux_arm64.go | 314 + .../x/sys/unix/zsysnum_linux_mips.go | 431 + .../x/sys/unix/zsysnum_linux_mips64.go | 361 + .../x/sys/unix/zsysnum_linux_mips64le.go | 361 + .../x/sys/unix/zsysnum_linux_mipsle.go | 431 + .../x/sys/unix/zsysnum_linux_ppc.go | 438 + .../x/sys/unix/zsysnum_linux_ppc64.go | 410 + .../x/sys/unix/zsysnum_linux_ppc64le.go | 410 + .../x/sys/unix/zsysnum_linux_riscv64.go | 312 + .../x/sys/unix/zsysnum_linux_s390x.go | 375 + .../x/sys/unix/zsysnum_linux_sparc64.go | 389 + .../x/sys/unix/zsysnum_netbsd_386.go | 275 + .../x/sys/unix/zsysnum_netbsd_amd64.go | 275 + .../x/sys/unix/zsysnum_netbsd_arm.go | 275 + .../x/sys/unix/zsysnum_netbsd_arm64.go | 275 + .../x/sys/unix/zsysnum_openbsd_386.go | 219 + .../x/sys/unix/zsysnum_openbsd_amd64.go | 219 + .../x/sys/unix/zsysnum_openbsd_arm.go | 219 + .../x/sys/unix/zsysnum_openbsd_arm64.go | 218 + .../x/sys/unix/zsysnum_openbsd_mips64.go | 221 + .../x/sys/unix/zsysnum_zos_s390x.go | 2670 + .../golang.org/x/sys/unix/ztypes_aix_ppc.go | 354 + .../golang.org/x/sys/unix/ztypes_aix_ppc64.go | 358 + .../x/sys/unix/ztypes_darwin_amd64.go | 768 + .../x/sys/unix/ztypes_darwin_arm64.go | 768 + .../x/sys/unix/ztypes_dragonfly_amd64.go | 474 + .../x/sys/unix/ztypes_freebsd_386.go | 723 + .../x/sys/unix/ztypes_freebsd_amd64.go | 726 + .../x/sys/unix/ztypes_freebsd_arm.go | 707 + .../x/sys/unix/ztypes_freebsd_arm64.go | 704 + .../x/sys/unix/ztypes_illumos_amd64.go | 42 + .../golang.org/x/sys/unix/ztypes_linux.go | 3958 + .../golang.org/x/sys/unix/ztypes_linux_386.go | 670 + .../x/sys/unix/ztypes_linux_amd64.go | 685 + .../golang.org/x/sys/unix/ztypes_linux_arm.go | 665 + .../x/sys/unix/ztypes_linux_arm64.go | 664 + .../x/sys/unix/ztypes_linux_mips.go | 670 + .../x/sys/unix/ztypes_linux_mips64.go | 667 + .../x/sys/unix/ztypes_linux_mips64le.go | 667 + .../x/sys/unix/ztypes_linux_mipsle.go | 670 + .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 678 + .../x/sys/unix/ztypes_linux_ppc64.go | 673 + .../x/sys/unix/ztypes_linux_ppc64le.go | 673 + .../x/sys/unix/ztypes_linux_riscv64.go | 692 + .../x/sys/unix/ztypes_linux_s390x.go | 687 + .../x/sys/unix/ztypes_linux_sparc64.go | 668 + .../x/sys/unix/ztypes_netbsd_386.go | 502 + .../x/sys/unix/ztypes_netbsd_amd64.go | 510 + .../x/sys/unix/ztypes_netbsd_arm.go | 507 + .../x/sys/unix/ztypes_netbsd_arm64.go | 510 + .../x/sys/unix/ztypes_openbsd_386.go | 575 + .../x/sys/unix/ztypes_openbsd_amd64.go | 575 + .../x/sys/unix/ztypes_openbsd_arm.go | 576 + .../x/sys/unix/ztypes_openbsd_arm64.go | 569 + .../x/sys/unix/ztypes_openbsd_mips64.go | 569 + .../x/sys/unix/ztypes_solaris_amd64.go | 482 + .../golang.org/x/sys/unix/ztypes_zos_s390x.go | 406 + .../golang.org/x/sys/windows/aliases.go | 13 + .../golang.org/x/sys/windows/dll_windows.go | 416 + .../vendor/golang.org/x/sys/windows/empty.s | 9 + .../golang.org/x/sys/windows/env_windows.go | 54 + .../golang.org/x/sys/windows/eventlog.go | 20 + .../golang.org/x/sys/windows/exec_windows.go | 195 + .../x/sys/windows/memory_windows.go | 37 + .../golang.org/x/sys/windows/mkerrors.bash | 70 + .../x/sys/windows/mkknownfolderids.bash | 27 + .../golang.org/x/sys/windows/mksyscall.go | 9 + .../vendor/golang.org/x/sys/windows/race.go | 30 + .../vendor/golang.org/x/sys/windows/race0.go | 25 + .../x/sys/windows/security_windows.go | 1444 + .../golang.org/x/sys/windows/service.go | 237 + .../x/sys/windows/setupapierrors_windows.go | 100 + .../vendor/golang.org/x/sys/windows/str.go | 22 + .../golang.org/x/sys/windows/syscall.go | 112 + .../x/sys/windows/syscall_windows.go | 1677 + .../golang.org/x/sys/windows/types_windows.go | 2789 + .../x/sys/windows/types_windows_386.go | 35 + .../x/sys/windows/types_windows_amd64.go | 34 + .../x/sys/windows/types_windows_arm.go | 35 + .../x/sys/windows/types_windows_arm64.go | 34 + .../x/sys/windows/zerrors_windows.go | 9468 +++ .../x/sys/windows/zknownfolderids_windows.go | 149 + .../x/sys/windows/zsyscall_windows.go | 3704 + .../vendor/golang.org/x/term/AUTHORS | 3 + .../vendor/golang.org/x/term/CONTRIBUTING.md | 26 + .../vendor/golang.org/x/term/CONTRIBUTORS | 3 + .../vendor/golang.org/x/term/LICENSE | 27 + .../vendor/golang.org/x/term/PATENTS | 22 + .../vendor/golang.org/x/term/README.md | 19 + .../vendor/golang.org/x/term/term.go | 58 + .../vendor/golang.org/x/term/term_plan9.go | 42 + .../vendor/golang.org/x/term/term_solaris.go | 111 + .../vendor/golang.org/x/term/term_unix.go | 92 + .../vendor/golang.org/x/term/term_unix_aix.go | 10 + .../vendor/golang.org/x/term/term_unix_bsd.go | 13 + .../golang.org/x/term/term_unix_linux.go | 10 + .../vendor/golang.org/x/term/term_unix_zos.go | 10 + .../golang.org/x/term/term_unsupported.go | 39 + .../vendor/golang.org/x/term/term_windows.go | 79 + .../vendor/golang.org/x/term/terminal.go | 987 + .../vendor/golang.org/x/text/AUTHORS | 3 + .../vendor/golang.org/x/text/CONTRIBUTORS | 3 + .../vendor/golang.org/x/text/LICENSE | 27 + .../vendor/golang.org/x/text/PATENTS | 22 + .../x/text/secure/bidirule/bidirule.go | 336 + .../x/text/secure/bidirule/bidirule10.0.0.go | 12 + .../x/text/secure/bidirule/bidirule9.0.0.go | 15 + .../golang.org/x/text/transform/transform.go | 709 + .../golang.org/x/text/unicode/bidi/bidi.go | 359 + .../golang.org/x/text/unicode/bidi/bracket.go | 335 + .../golang.org/x/text/unicode/bidi/core.go | 1071 + .../golang.org/x/text/unicode/bidi/prop.go | 206 + .../x/text/unicode/bidi/tables10.0.0.go | 1816 + .../x/text/unicode/bidi/tables11.0.0.go | 1888 + .../x/text/unicode/bidi/tables12.0.0.go | 1924 + .../x/text/unicode/bidi/tables13.0.0.go | 1956 + .../x/text/unicode/bidi/tables9.0.0.go | 1782 + .../golang.org/x/text/unicode/bidi/trieval.go | 60 + .../x/text/unicode/norm/composition.go | 512 + .../x/text/unicode/norm/forminfo.go | 278 + .../golang.org/x/text/unicode/norm/input.go | 109 + .../golang.org/x/text/unicode/norm/iter.go | 458 + .../x/text/unicode/norm/normalize.go | 609 + .../x/text/unicode/norm/readwriter.go | 125 + .../x/text/unicode/norm/tables10.0.0.go | 7658 ++ .../x/text/unicode/norm/tables11.0.0.go | 7694 ++ .../x/text/unicode/norm/tables12.0.0.go | 7711 ++ .../x/text/unicode/norm/tables13.0.0.go | 7761 ++ .../x/text/unicode/norm/tables9.0.0.go | 7638 ++ .../x/text/unicode/norm/transform.go | 88 + .../golang.org/x/text/unicode/norm/trie.go | 54 + .../vendor/golang.org/x/time/AUTHORS | 3 + .../vendor/golang.org/x/time/CONTRIBUTORS | 3 + .../vendor/golang.org/x/time/LICENSE | 27 + .../vendor/golang.org/x/time/PATENTS | 22 + .../vendor/golang.org/x/time/rate/rate.go | 388 + .../vendor/gomodules.xyz/jsonpatch/v2/LICENSE | 202 + .../gomodules.xyz/jsonpatch/v2/jsonpatch.go | 334 + .../google.golang.org/appengine/LICENSE | 202 + .../appengine/internal/api.go | 678 + .../appengine/internal/api_classic.go | 169 + .../appengine/internal/api_common.go | 123 + .../appengine/internal/app_id.go | 28 + .../appengine/internal/base/api_base.pb.go | 308 + .../appengine/internal/base/api_base.proto | 33 + .../internal/datastore/datastore_v3.pb.go | 4367 + .../internal/datastore/datastore_v3.proto | 551 + .../appengine/internal/identity.go | 55 + .../appengine/internal/identity_classic.go | 61 + .../appengine/internal/identity_flex.go | 11 + .../appengine/internal/identity_vm.go | 134 + .../appengine/internal/internal.go | 110 + .../appengine/internal/log/log_service.pb.go | 1313 + .../appengine/internal/log/log_service.proto | 150 + .../appengine/internal/main.go | 16 + .../appengine/internal/main_common.go | 7 + .../appengine/internal/main_vm.go | 69 + .../appengine/internal/metadata.go | 60 + .../appengine/internal/net.go | 56 + .../appengine/internal/regen.sh | 40 + .../internal/remote_api/remote_api.pb.go | 361 + .../internal/remote_api/remote_api.proto | 44 + .../appengine/internal/transaction.go | 115 + .../internal/urlfetch/urlfetch_service.pb.go | 527 + .../internal/urlfetch/urlfetch_service.proto | 64 + .../appengine/urlfetch/urlfetch.go | 210 + .../vendor/google.golang.org/genproto/LICENSE | 202 + .../googleapis/rpc/status/status.pb.go | 201 + .../vendor/google.golang.org/grpc/AUTHORS | 1 + .../vendor/google.golang.org/grpc/LICENSE | 202 + .../vendor/google.golang.org/grpc/NOTICE.txt | 13 + .../grpc/codes/code_string.go | 62 + .../google.golang.org/grpc/codes/codes.go | 244 + .../grpc/internal/status/status.go | 166 + .../google.golang.org/grpc/status/status.go | 129 + .../vendor/google.golang.org/protobuf/AUTHORS | 3 + .../google.golang.org/protobuf/CONTRIBUTORS | 3 + .../vendor/google.golang.org/protobuf/LICENSE | 27 + .../vendor/google.golang.org/protobuf/PATENTS | 22 + .../protobuf/encoding/prototext/decode.go | 770 + .../protobuf/encoding/prototext/doc.go | 7 + .../protobuf/encoding/prototext/encode.go | 371 + .../protobuf/encoding/protowire/wire.go | 538 + .../protobuf/internal/descfmt/stringer.go | 318 + .../protobuf/internal/descopts/options.go | 29 + .../protobuf/internal/detrand/rand.go | 69 + .../internal/encoding/defval/default.go | 213 + .../encoding/messageset/messageset.go | 241 + .../protobuf/internal/encoding/tag/tag.go | 207 + .../protobuf/internal/encoding/text/decode.go | 665 + .../internal/encoding/text/decode_number.go | 190 + .../internal/encoding/text/decode_string.go | 161 + .../internal/encoding/text/decode_token.go | 373 + .../protobuf/internal/encoding/text/doc.go | 29 + .../protobuf/internal/encoding/text/encode.go | 270 + .../protobuf/internal/errors/errors.go | 89 + .../protobuf/internal/errors/is_go112.go | 39 + .../protobuf/internal/errors/is_go113.go | 12 + .../protobuf/internal/filedesc/build.go | 158 + .../protobuf/internal/filedesc/desc.go | 631 + .../protobuf/internal/filedesc/desc_init.go | 471 + .../protobuf/internal/filedesc/desc_lazy.go | 704 + .../protobuf/internal/filedesc/desc_list.go | 450 + .../internal/filedesc/desc_list_gen.go | 356 + .../protobuf/internal/filedesc/placeholder.go | 107 + .../protobuf/internal/filetype/build.go | 297 + .../protobuf/internal/flags/flags.go | 24 + .../internal/flags/proto_legacy_disable.go | 9 + .../internal/flags/proto_legacy_enable.go | 9 + .../protobuf/internal/genid/any_gen.go | 34 + .../protobuf/internal/genid/api_gen.go | 106 + .../protobuf/internal/genid/descriptor_gen.go | 829 + .../protobuf/internal/genid/doc.go | 11 + .../protobuf/internal/genid/duration_gen.go | 34 + .../protobuf/internal/genid/empty_gen.go | 19 + .../protobuf/internal/genid/field_mask_gen.go | 31 + .../protobuf/internal/genid/goname.go | 25 + .../protobuf/internal/genid/map_entry.go | 16 + .../internal/genid/source_context_gen.go | 31 + .../protobuf/internal/genid/struct_gen.go | 116 + .../protobuf/internal/genid/timestamp_gen.go | 34 + .../protobuf/internal/genid/type_gen.go | 184 + .../protobuf/internal/genid/wrappers.go | 13 + .../protobuf/internal/genid/wrappers_gen.go | 175 + .../protobuf/internal/impl/api_export.go | 177 + .../protobuf/internal/impl/checkinit.go | 141 + .../protobuf/internal/impl/codec_extension.go | 223 + .../protobuf/internal/impl/codec_field.go | 830 + .../protobuf/internal/impl/codec_gen.go | 5637 ++ .../protobuf/internal/impl/codec_map.go | 388 + .../protobuf/internal/impl/codec_map_go111.go | 37 + .../protobuf/internal/impl/codec_map_go112.go | 11 + .../protobuf/internal/impl/codec_message.go | 217 + .../internal/impl/codec_messageset.go | 123 + .../protobuf/internal/impl/codec_reflect.go | 209 + .../protobuf/internal/impl/codec_tables.go | 557 + .../protobuf/internal/impl/codec_unsafe.go | 17 + .../protobuf/internal/impl/convert.go | 496 + .../protobuf/internal/impl/convert_list.go | 141 + .../protobuf/internal/impl/convert_map.go | 121 + .../protobuf/internal/impl/decode.go | 276 + .../protobuf/internal/impl/encode.go | 201 + .../protobuf/internal/impl/enum.go | 21 + .../protobuf/internal/impl/extension.go | 156 + .../protobuf/internal/impl/legacy_enum.go | 219 + .../protobuf/internal/impl/legacy_export.go | 92 + .../internal/impl/legacy_extension.go | 176 + .../protobuf/internal/impl/legacy_file.go | 81 + .../protobuf/internal/impl/legacy_message.go | 565 + .../protobuf/internal/impl/merge.go | 176 + .../protobuf/internal/impl/merge_gen.go | 209 + .../protobuf/internal/impl/message.go | 276 + .../protobuf/internal/impl/message_reflect.go | 465 + .../internal/impl/message_reflect_field.go | 543 + .../internal/impl/message_reflect_gen.go | 249 + .../protobuf/internal/impl/pointer_reflect.go | 178 + .../protobuf/internal/impl/pointer_unsafe.go | 174 + .../protobuf/internal/impl/validate.go | 576 + .../protobuf/internal/impl/weak.go | 74 + .../protobuf/internal/order/order.go | 89 + .../protobuf/internal/order/range.go | 115 + .../protobuf/internal/pragma/pragma.go | 29 + .../protobuf/internal/set/ints.go | 58 + .../protobuf/internal/strs/strings.go | 196 + .../protobuf/internal/strs/strings_pure.go | 27 + .../protobuf/internal/strs/strings_unsafe.go | 94 + .../protobuf/internal/version/version.go | 79 + .../protobuf/proto/checkinit.go | 71 + .../protobuf/proto/decode.go | 278 + .../protobuf/proto/decode_gen.go | 603 + .../google.golang.org/protobuf/proto/doc.go | 94 + .../protobuf/proto/encode.go | 319 + .../protobuf/proto/encode_gen.go | 97 + .../google.golang.org/protobuf/proto/equal.go | 167 + .../protobuf/proto/extension.go | 92 + .../google.golang.org/protobuf/proto/merge.go | 139 + .../protobuf/proto/messageset.go | 93 + .../google.golang.org/protobuf/proto/proto.go | 43 + .../protobuf/proto/proto_methods.go | 19 + .../protobuf/proto/proto_reflect.go | 19 + .../google.golang.org/protobuf/proto/reset.go | 43 + .../google.golang.org/protobuf/proto/size.go | 97 + .../protobuf/proto/size_gen.go | 55 + .../protobuf/proto/wrappers.go | 29 + .../protobuf/reflect/protodesc/desc.go | 276 + .../protobuf/reflect/protodesc/desc_init.go | 248 + .../reflect/protodesc/desc_resolve.go | 286 + .../reflect/protodesc/desc_validate.go | 374 + .../protobuf/reflect/protodesc/proto.go | 252 + .../protobuf/reflect/protoreflect/methods.go | 77 + .../protobuf/reflect/protoreflect/proto.go | 504 + .../protobuf/reflect/protoreflect/source.go | 128 + .../reflect/protoreflect/source_gen.go | 461 + .../protobuf/reflect/protoreflect/type.go | 665 + .../protobuf/reflect/protoreflect/value.go | 285 + .../reflect/protoreflect/value_pure.go | 59 + .../reflect/protoreflect/value_union.go | 411 + .../reflect/protoreflect/value_unsafe.go | 98 + .../reflect/protoregistry/registry.go | 880 + .../protobuf/runtime/protoiface/legacy.go | 15 + .../protobuf/runtime/protoiface/methods.go | 167 + .../protobuf/runtime/protoimpl/impl.go | 44 + .../protobuf/runtime/protoimpl/version.go | 56 + .../types/descriptorpb/descriptor.pb.go | 3957 + .../protobuf/types/known/anypb/any.pb.go | 498 + .../types/known/durationpb/duration.pb.go | 379 + .../types/known/timestamppb/timestamp.pb.go | 390 + .../vendor/gopkg.in/inf.v0/LICENSE | 28 + .../vendor/gopkg.in/inf.v0/dec.go | 615 + .../vendor/gopkg.in/inf.v0/rounder.go | 145 + .../vendor/gopkg.in/yaml.v2/.travis.yml | 17 + .../vendor/gopkg.in/yaml.v2/LICENSE | 201 + .../vendor/gopkg.in/yaml.v2/LICENSE.libyaml | 31 + .../vendor/gopkg.in/yaml.v2/NOTICE | 13 + .../vendor/gopkg.in/yaml.v2/README.md | 133 + .../vendor/gopkg.in/yaml.v2/apic.go | 744 + .../vendor/gopkg.in/yaml.v2/decode.go | 815 + .../vendor/gopkg.in/yaml.v2/emitterc.go | 1685 + .../vendor/gopkg.in/yaml.v2/encode.go | 390 + .../vendor/gopkg.in/yaml.v2/parserc.go | 1095 + .../vendor/gopkg.in/yaml.v2/readerc.go | 412 + .../vendor/gopkg.in/yaml.v2/resolve.go | 258 + .../vendor/gopkg.in/yaml.v2/scannerc.go | 2711 + .../vendor/gopkg.in/yaml.v2/sorter.go | 113 + .../vendor/gopkg.in/yaml.v2/writerc.go | 26 + .../vendor/gopkg.in/yaml.v2/yaml.go | 478 + .../vendor/gopkg.in/yaml.v2/yamlh.go | 739 + .../vendor/gopkg.in/yaml.v2/yamlprivateh.go | 173 + .../vendor/gopkg.in/yaml.v3/LICENSE | 50 + .../vendor/gopkg.in/yaml.v3/NOTICE | 13 + .../vendor/gopkg.in/yaml.v3/README.md | 150 + .../vendor/gopkg.in/yaml.v3/apic.go | 747 + .../vendor/gopkg.in/yaml.v3/decode.go | 950 + .../vendor/gopkg.in/yaml.v3/emitterc.go | 2020 + .../vendor/gopkg.in/yaml.v3/encode.go | 577 + .../vendor/gopkg.in/yaml.v3/parserc.go | 1249 + .../vendor/gopkg.in/yaml.v3/readerc.go | 434 + .../vendor/gopkg.in/yaml.v3/resolve.go | 326 + .../vendor/gopkg.in/yaml.v3/scannerc.go | 3038 + .../vendor/gopkg.in/yaml.v3/sorter.go | 134 + .../vendor/gopkg.in/yaml.v3/writerc.go | 48 + .../vendor/gopkg.in/yaml.v3/yaml.go | 698 + .../vendor/gopkg.in/yaml.v3/yamlh.go | 807 + .../vendor/gopkg.in/yaml.v3/yamlprivateh.go | 198 + integration-test/vendor/k8s.io/api/LICENSE | 202 + .../vendor/k8s.io/api/admission/v1/doc.go | 23 + .../k8s.io/api/admission/v1/generated.pb.go | 1783 + .../k8s.io/api/admission/v1/generated.proto | 167 + .../k8s.io/api/admission/v1/register.go | 53 + .../vendor/k8s.io/api/admission/v1/types.go | 169 + .../v1/types_swagger_doc_generated.go | 78 + .../api/admission/v1/zz_generated.deepcopy.go | 141 + .../k8s.io/api/admission/v1beta1/doc.go | 24 + .../api/admission/v1beta1/generated.pb.go | 1783 + .../api/admission/v1beta1/generated.proto | 167 + .../k8s.io/api/admission/v1beta1/register.go | 53 + .../k8s.io/api/admission/v1beta1/types.go | 174 + .../v1beta1/types_swagger_doc_generated.go | 78 + .../v1beta1/zz_generated.deepcopy.go | 141 + .../zz_generated.prerelease-lifecycle.go | 49 + .../api/admissionregistration/v1/doc.go | 26 + .../admissionregistration/v1/generated.pb.go | 3413 + .../admissionregistration/v1/generated.proto | 479 + .../api/admissionregistration/v1/register.go | 56 + .../api/admissionregistration/v1/types.go | 555 + .../v1/types_swagger_doc_generated.go | 151 + .../v1/zz_generated.deepcopy.go | 396 + .../api/admissionregistration/v1beta1/doc.go | 27 + .../v1beta1/generated.pb.go | 3414 + .../v1beta1/generated.proto | 487 + .../admissionregistration/v1beta1/register.go | 56 + .../admissionregistration/v1beta1/types.go | 579 + .../v1beta1/types_swagger_doc_generated.go | 151 + .../v1beta1/zz_generated.deepcopy.go | 396 + .../zz_generated.prerelease-lifecycle.go | 121 + .../api/apiserverinternal/v1alpha1/doc.go | 25 + .../v1alpha1/generated.pb.go | 1700 + .../v1alpha1/generated.proto | 124 + .../apiserverinternal/v1alpha1/register.go | 48 + .../api/apiserverinternal/v1alpha1/types.go | 130 + .../v1alpha1/types_swagger_doc_generated.go | 95 + .../v1alpha1/zz_generated.deepcopy.go | 175 + .../vendor/k8s.io/api/apps/v1/doc.go | 21 + .../vendor/k8s.io/api/apps/v1/generated.pb.go | 8256 ++ .../vendor/k8s.io/api/apps/v1/generated.proto | 743 + .../vendor/k8s.io/api/apps/v1/register.go | 60 + .../vendor/k8s.io/api/apps/v1/types.go | 872 + .../apps/v1/types_swagger_doc_generated.go | 371 + .../api/apps/v1/zz_generated.deepcopy.go | 777 + .../vendor/k8s.io/api/apps/v1beta1/doc.go | 22 + .../k8s.io/api/apps/v1beta1/generated.pb.go | 6232 ++ .../k8s.io/api/apps/v1beta1/generated.proto | 497 + .../k8s.io/api/apps/v1beta1/register.go | 58 + .../vendor/k8s.io/api/apps/v1beta1/types.go | 612 + .../v1beta1/types_swagger_doc_generated.go | 275 + .../api/apps/v1beta1/zz_generated.deepcopy.go | 594 + .../zz_generated.prerelease-lifecycle.go | 217 + .../vendor/k8s.io/api/apps/v1beta2/doc.go | 22 + .../k8s.io/api/apps/v1beta2/generated.pb.go | 9023 +++ .../k8s.io/api/apps/v1beta2/generated.proto | 788 + .../k8s.io/api/apps/v1beta2/register.go | 61 + .../vendor/k8s.io/api/apps/v1beta2/types.go | 957 + .../v1beta2/types_swagger_doc_generated.go | 399 + .../api/apps/v1beta2/zz_generated.deepcopy.go | 844 + .../zz_generated.prerelease-lifecycle.go | 289 + .../k8s.io/api/authentication/v1/doc.go | 22 + .../api/authentication/v1/generated.pb.go | 2554 + .../api/authentication/v1/generated.proto | 188 + .../k8s.io/api/authentication/v1/register.go | 52 + .../k8s.io/api/authentication/v1/types.go | 199 + .../v1/types_swagger_doc_generated.go | 119 + .../v1/zz_generated.deepcopy.go | 244 + .../k8s.io/api/authentication/v1beta1/doc.go | 23 + .../authentication/v1beta1/generated.pb.go | 1543 + .../authentication/v1beta1/generated.proto | 120 + .../api/authentication/v1beta1/register.go | 51 + .../api/authentication/v1beta1/types.go | 115 + .../v1beta1/types_swagger_doc_generated.go | 75 + .../v1beta1/zz_generated.deepcopy.go | 152 + .../zz_generated.prerelease-lifecycle.go | 49 + .../vendor/k8s.io/api/authorization/v1/doc.go | 23 + .../api/authorization/v1/generated.pb.go | 4045 + .../api/authorization/v1/generated.proto | 281 + .../k8s.io/api/authorization/v1/register.go | 55 + .../k8s.io/api/authorization/v1/types.go | 277 + .../v1/types_swagger_doc_generated.go | 178 + .../authorization/v1/zz_generated.deepcopy.go | 385 + .../k8s.io/api/authorization/v1beta1/doc.go | 24 + .../api/authorization/v1beta1/generated.pb.go | 4045 + .../api/authorization/v1beta1/generated.proto | 281 + .../api/authorization/v1beta1/register.go | 55 + .../k8s.io/api/authorization/v1beta1/types.go | 289 + .../v1beta1/types_swagger_doc_generated.go | 178 + .../v1beta1/zz_generated.deepcopy.go | 385 + .../zz_generated.prerelease-lifecycle.go | 121 + .../vendor/k8s.io/api/autoscaling/v1/doc.go | 21 + .../k8s.io/api/autoscaling/v1/generated.pb.go | 6182 ++ .../k8s.io/api/autoscaling/v1/generated.proto | 495 + .../k8s.io/api/autoscaling/v1/register.go | 53 + .../vendor/k8s.io/api/autoscaling/v1/types.go | 506 + .../v1/types_swagger_doc_generated.go | 276 + .../autoscaling/v1/zz_generated.deepcopy.go | 573 + .../k8s.io/api/autoscaling/v2beta1/doc.go | 22 + .../api/autoscaling/v2beta1/generated.pb.go | 5715 ++ .../api/autoscaling/v2beta1/generated.proto | 475 + .../api/autoscaling/v2beta1/register.go | 52 + .../k8s.io/api/autoscaling/v2beta1/types.go | 487 + .../v2beta1/types_swagger_doc_generated.go | 247 + .../v2beta1/zz_generated.deepcopy.go | 524 + .../zz_generated.prerelease-lifecycle.go | 73 + .../k8s.io/api/autoscaling/v2beta2/doc.go | 22 + .../api/autoscaling/v2beta2/generated.pb.go | 6599 ++ .../api/autoscaling/v2beta2/generated.proto | 493 + .../api/autoscaling/v2beta2/register.go | 50 + .../k8s.io/api/autoscaling/v2beta2/types.go | 539 + .../v2beta2/types_swagger_doc_generated.go | 297 + .../v2beta2/zz_generated.deepcopy.go | 609 + .../zz_generated.prerelease-lifecycle.go | 57 + .../vendor/k8s.io/api/batch/v1/doc.go | 21 + .../k8s.io/api/batch/v1/generated.pb.go | 3610 + .../k8s.io/api/batch/v1/generated.proto | 370 + .../vendor/k8s.io/api/batch/v1/register.go | 54 + .../vendor/k8s.io/api/batch/v1/types.go | 437 + .../batch/v1/types_swagger_doc_generated.go | 166 + .../api/batch/v1/zz_generated.deepcopy.go | 376 + .../vendor/k8s.io/api/batch/v1beta1/doc.go | 22 + .../k8s.io/api/batch/v1beta1/generated.pb.go | 1779 + .../k8s.io/api/batch/v1beta1/generated.proto | 142 + .../k8s.io/api/batch/v1beta1/register.go | 53 + .../vendor/k8s.io/api/batch/v1beta1/types.go | 173 + .../v1beta1/types_swagger_doc_generated.go | 97 + .../batch/v1beta1/zz_generated.deepcopy.go | 198 + .../zz_generated.prerelease-lifecycle.go | 91 + .../vendor/k8s.io/api/certificates/v1/doc.go | 23 + .../api/certificates/v1/generated.pb.go | 2055 + .../api/certificates/v1/generated.proto | 250 + .../k8s.io/api/certificates/v1/register.go | 61 + .../k8s.io/api/certificates/v1/types.go | 308 + .../v1/types_swagger_doc_generated.go | 89 + .../certificates/v1/zz_generated.deepcopy.go | 203 + .../k8s.io/api/certificates/v1beta1/doc.go | 24 + .../api/certificates/v1beta1/generated.pb.go | 2060 + .../api/certificates/v1beta1/generated.proto | 201 + .../api/certificates/v1beta1/register.go | 59 + .../k8s.io/api/certificates/v1beta1/types.go | 262 + .../v1beta1/types_swagger_doc_generated.go | 78 + .../v1beta1/zz_generated.deepcopy.go | 208 + .../zz_generated.prerelease-lifecycle.go | 73 + .../vendor/k8s.io/api/coordination/v1/doc.go | 23 + .../api/coordination/v1/generated.pb.go | 967 + .../api/coordination/v1/generated.proto | 80 + .../k8s.io/api/coordination/v1/register.go | 53 + .../k8s.io/api/coordination/v1/types.go | 74 + .../v1/types_swagger_doc_generated.go | 63 + .../coordination/v1/zz_generated.deepcopy.go | 124 + .../k8s.io/api/coordination/v1beta1/doc.go | 24 + .../api/coordination/v1beta1/generated.pb.go | 967 + .../api/coordination/v1beta1/generated.proto | 80 + .../api/coordination/v1beta1/register.go | 53 + .../k8s.io/api/coordination/v1beta1/types.go | 80 + .../v1beta1/types_swagger_doc_generated.go | 63 + .../v1beta1/zz_generated.deepcopy.go | 124 + .../zz_generated.prerelease-lifecycle.go | 73 + .../api/core/v1/annotation_key_constants.go | 151 + .../vendor/k8s.io/api/core/v1/doc.go | 22 + .../vendor/k8s.io/api/core/v1/generated.pb.go | 67239 ++++++++++++++++ .../vendor/k8s.io/api/core/v1/generated.proto | 5651 ++ .../vendor/k8s.io/api/core/v1/lifecycle.go | 37 + .../k8s.io/api/core/v1/objectreference.go | 33 + .../vendor/k8s.io/api/core/v1/register.go | 99 + .../vendor/k8s.io/api/core/v1/resource.go | 59 + .../vendor/k8s.io/api/core/v1/taint.go | 39 + .../vendor/k8s.io/api/core/v1/toleration.go | 56 + .../vendor/k8s.io/api/core/v1/types.go | 6367 ++ .../core/v1/types_swagger_doc_generated.go | 2516 + .../k8s.io/api/core/v1/well_known_labels.go | 70 + .../k8s.io/api/core/v1/well_known_taints.go | 48 + .../api/core/v1/zz_generated.deepcopy.go | 5929 ++ .../vendor/k8s.io/api/discovery/v1/doc.go | 22 + .../k8s.io/api/discovery/v1/generated.pb.go | 2251 + .../k8s.io/api/discovery/v1/generated.proto | 197 + .../k8s.io/api/discovery/v1/register.go | 56 + .../vendor/k8s.io/api/discovery/v1/types.go | 195 + .../v1/types_swagger_doc_generated.go | 109 + .../api/discovery/v1/well_known_labels.go | 32 + .../api/discovery/v1/zz_generated.deepcopy.go | 257 + .../k8s.io/api/discovery/v1beta1/doc.go | 23 + .../api/discovery/v1beta1/generated.pb.go | 2205 + .../api/discovery/v1beta1/generated.proto | 200 + .../k8s.io/api/discovery/v1beta1/register.go | 56 + .../k8s.io/api/discovery/v1beta1/types.go | 205 + .../v1beta1/types_swagger_doc_generated.go | 108 + .../discovery/v1beta1/well_known_labels.go | 32 + .../v1beta1/zz_generated.deepcopy.go | 252 + .../zz_generated.prerelease-lifecycle.go | 73 + .../vendor/k8s.io/api/events/v1/doc.go | 23 + .../k8s.io/api/events/v1/generated.pb.go | 1397 + .../k8s.io/api/events/v1/generated.proto | 128 + .../vendor/k8s.io/api/events/v1/register.go | 53 + .../vendor/k8s.io/api/events/v1/types.go | 123 + .../events/v1/types_swagger_doc_generated.go | 73 + .../api/events/v1/zz_generated.deepcopy.go | 117 + .../vendor/k8s.io/api/events/v1beta1/doc.go | 24 + .../k8s.io/api/events/v1beta1/generated.pb.go | 1397 + .../k8s.io/api/events/v1beta1/generated.proto | 130 + .../k8s.io/api/events/v1beta1/register.go | 53 + .../vendor/k8s.io/api/events/v1beta1/types.go | 131 + .../v1beta1/types_swagger_doc_generated.go | 73 + .../events/v1beta1/zz_generated.deepcopy.go | 117 + .../zz_generated.prerelease-lifecycle.go | 57 + .../k8s.io/api/extensions/v1beta1/doc.go | 22 + .../api/extensions/v1beta1/generated.pb.go | 15231 ++++ .../api/extensions/v1beta1/generated.proto | 1273 + .../k8s.io/api/extensions/v1beta1/register.go | 65 + .../k8s.io/api/extensions/v1beta1/types.go | 1560 + .../v1beta1/types_swagger_doc_generated.go | 660 + .../v1beta1/zz_generated.deepcopy.go | 1499 + .../zz_generated.prerelease-lifecycle.go | 349 + .../k8s.io/api/flowcontrol/v1alpha1/doc.go | 25 + .../api/flowcontrol/v1alpha1/generated.pb.go | 5367 ++ .../api/flowcontrol/v1alpha1/generated.proto | 438 + .../api/flowcontrol/v1alpha1/register.go | 58 + .../k8s.io/api/flowcontrol/v1alpha1/types.go | 545 + .../v1alpha1/types_swagger_doc_generated.go | 261 + .../v1alpha1/zz_generated.deepcopy.go | 541 + .../zz_generated.prerelease-lifecycle.go | 121 + .../k8s.io/api/flowcontrol/v1beta1/doc.go | 25 + .../api/flowcontrol/v1beta1/generated.pb.go | 5367 ++ .../api/flowcontrol/v1beta1/generated.proto | 438 + .../api/flowcontrol/v1beta1/register.go | 58 + .../k8s.io/api/flowcontrol/v1beta1/types.go | 577 + .../v1beta1/types_swagger_doc_generated.go | 261 + .../v1beta1/zz_generated.deepcopy.go | 541 + .../zz_generated.prerelease-lifecycle.go | 93 + .../vendor/k8s.io/api/networking/v1/doc.go | 22 + .../k8s.io/api/networking/v1/generated.pb.go | 5861 ++ .../k8s.io/api/networking/v1/generated.proto | 504 + .../k8s.io/api/networking/v1/register.go | 57 + .../vendor/k8s.io/api/networking/v1/types.go | 560 + .../v1/types_swagger_doc_generated.go | 276 + .../networking/v1/well_known_annotations.go | 25 + .../networking/v1/zz_generated.deepcopy.go | 660 + .../k8s.io/api/networking/v1beta1/doc.go | 23 + .../api/networking/v1beta1/generated.pb.go | 3485 + .../api/networking/v1beta1/generated.proto | 305 + .../k8s.io/api/networking/v1beta1/register.go | 58 + .../k8s.io/api/networking/v1beta1/types.go | 366 + .../v1beta1/types_swagger_doc_generated.go | 173 + .../v1beta1/well_known_annotations.go | 32 + .../v1beta1/zz_generated.deepcopy.go | 382 + .../zz_generated.prerelease-lifecycle.go | 121 + .../vendor/k8s.io/api/node/v1/doc.go | 23 + .../vendor/k8s.io/api/node/v1/generated.pb.go | 1399 + .../vendor/k8s.io/api/node/v1/generated.proto | 110 + .../vendor/k8s.io/api/node/v1/register.go | 52 + .../vendor/k8s.io/api/node/v1/types.go | 108 + .../node/v1/types_swagger_doc_generated.go | 71 + .../api/node/v1/zz_generated.deepcopy.go | 148 + .../vendor/k8s.io/api/node/v1alpha1/doc.go | 23 + .../k8s.io/api/node/v1alpha1/generated.pb.go | 1568 + .../k8s.io/api/node/v1alpha1/generated.proto | 119 + .../k8s.io/api/node/v1alpha1/register.go | 52 + .../vendor/k8s.io/api/node/v1alpha1/types.go | 117 + .../v1alpha1/types_swagger_doc_generated.go | 80 + .../node/v1alpha1/zz_generated.deepcopy.go | 165 + .../vendor/k8s.io/api/node/v1beta1/doc.go | 24 + .../k8s.io/api/node/v1beta1/generated.pb.go | 1400 + .../k8s.io/api/node/v1beta1/generated.proto | 109 + .../k8s.io/api/node/v1beta1/register.go | 52 + .../vendor/k8s.io/api/node/v1beta1/types.go | 111 + .../v1beta1/types_swagger_doc_generated.go | 71 + .../api/node/v1beta1/zz_generated.deepcopy.go | 148 + .../zz_generated.prerelease-lifecycle.go | 57 + .../vendor/k8s.io/api/policy/v1/doc.go | 24 + .../k8s.io/api/policy/v1/generated.pb.go | 1681 + .../k8s.io/api/policy/v1/generated.proto | 151 + .../vendor/k8s.io/api/policy/v1/register.go | 52 + .../vendor/k8s.io/api/policy/v1/types.go | 172 + .../policy/v1/types_swagger_doc_generated.go | 87 + .../api/policy/v1/zz_generated.deepcopy.go | 180 + .../vendor/k8s.io/api/policy/v1beta1/doc.go | 25 + .../k8s.io/api/policy/v1beta1/generated.pb.go | 5565 ++ .../k8s.io/api/policy/v1beta1/generated.proto | 430 + .../k8s.io/api/policy/v1beta1/register.go | 56 + .../vendor/k8s.io/api/policy/v1beta1/types.go | 554 + .../v1beta1/types_swagger_doc_generated.go | 247 + .../policy/v1beta1/zz_generated.deepcopy.go | 547 + .../zz_generated.prerelease-lifecycle.go | 127 + .../vendor/k8s.io/api/rbac/v1/doc.go | 23 + .../vendor/k8s.io/api/rbac/v1/generated.pb.go | 3230 + .../vendor/k8s.io/api/rbac/v1/generated.proto | 201 + .../vendor/k8s.io/api/rbac/v1/register.go | 58 + .../vendor/k8s.io/api/rbac/v1/types.go | 239 + .../rbac/v1/types_swagger_doc_generated.go | 158 + .../api/rbac/v1/zz_generated.deepcopy.go | 389 + .../vendor/k8s.io/api/rbac/v1alpha1/doc.go | 23 + .../k8s.io/api/rbac/v1alpha1/generated.pb.go | 3231 + .../k8s.io/api/rbac/v1alpha1/generated.proto | 208 + .../k8s.io/api/rbac/v1alpha1/register.go | 58 + .../vendor/k8s.io/api/rbac/v1alpha1/types.go | 246 + .../v1alpha1/types_swagger_doc_generated.go | 158 + .../rbac/v1alpha1/zz_generated.deepcopy.go | 389 + .../vendor/k8s.io/api/rbac/v1beta1/doc.go | 24 + .../k8s.io/api/rbac/v1beta1/generated.pb.go | 3230 + .../k8s.io/api/rbac/v1beta1/generated.proto | 208 + .../k8s.io/api/rbac/v1beta1/register.go | 58 + .../vendor/k8s.io/api/rbac/v1beta1/types.go | 277 + .../v1beta1/types_swagger_doc_generated.go | 158 + .../api/rbac/v1beta1/zz_generated.deepcopy.go | 389 + .../zz_generated.prerelease-lifecycle.go | 217 + .../vendor/k8s.io/api/scheduling/v1/doc.go | 23 + .../k8s.io/api/scheduling/v1/generated.pb.go | 729 + .../k8s.io/api/scheduling/v1/generated.proto | 75 + .../k8s.io/api/scheduling/v1/register.go | 55 + .../vendor/k8s.io/api/scheduling/v1/types.go | 74 + .../v1/types_swagger_doc_generated.go | 53 + .../scheduling/v1/zz_generated.deepcopy.go | 90 + .../k8s.io/api/scheduling/v1alpha1/doc.go | 23 + .../api/scheduling/v1alpha1/generated.pb.go | 729 + .../api/scheduling/v1alpha1/generated.proto | 76 + .../api/scheduling/v1alpha1/register.go | 52 + .../k8s.io/api/scheduling/v1alpha1/types.go | 75 + .../v1alpha1/types_swagger_doc_generated.go | 53 + .../v1alpha1/zz_generated.deepcopy.go | 90 + .../k8s.io/api/scheduling/v1beta1/doc.go | 24 + .../api/scheduling/v1beta1/generated.pb.go | 729 + .../api/scheduling/v1beta1/generated.proto | 76 + .../k8s.io/api/scheduling/v1beta1/register.go | 52 + .../k8s.io/api/scheduling/v1beta1/types.go | 83 + .../v1beta1/types_swagger_doc_generated.go | 53 + .../v1beta1/zz_generated.deepcopy.go | 90 + .../zz_generated.prerelease-lifecycle.go | 73 + .../vendor/k8s.io/api/storage/v1/doc.go | 22 + .../k8s.io/api/storage/v1/generated.pb.go | 4787 ++ .../k8s.io/api/storage/v1/generated.proto | 462 + .../vendor/k8s.io/api/storage/v1/register.go | 62 + .../vendor/k8s.io/api/storage/v1/types.go | 563 + .../storage/v1/types_swagger_doc_generated.go | 214 + .../api/storage/v1/zz_generated.deepcopy.go | 537 + .../vendor/k8s.io/api/storage/v1alpha1/doc.go | 23 + .../api/storage/v1alpha1/generated.pb.go | 2399 + .../api/storage/v1alpha1/generated.proto | 227 + .../k8s.io/api/storage/v1alpha1/register.go | 52 + .../k8s.io/api/storage/v1alpha1/types.go | 246 + .../v1alpha1/types_swagger_doc_generated.go | 116 + .../storage/v1alpha1/zz_generated.deepcopy.go | 255 + .../zz_generated.prerelease-lifecycle.go | 121 + .../vendor/k8s.io/api/storage/v1beta1/doc.go | 23 + .../api/storage/v1beta1/generated.pb.go | 5390 ++ .../api/storage/v1beta1/generated.proto | 555 + .../k8s.io/api/storage/v1beta1/register.go | 65 + .../k8s.io/api/storage/v1beta1/types.go | 687 + .../v1beta1/types_swagger_doc_generated.go | 237 + .../storage/v1beta1/zz_generated.deepcopy.go | 612 + .../zz_generated.prerelease-lifecycle.go | 253 + .../vendor/k8s.io/apimachinery/LICENSE | 202 + .../apimachinery/pkg/api/equality/semantic.go | 49 + .../k8s.io/apimachinery/pkg/api/errors/OWNERS | 20 + .../k8s.io/apimachinery/pkg/api/errors/doc.go | 18 + .../apimachinery/pkg/api/errors/errors.go | 697 + .../k8s.io/apimachinery/pkg/api/meta/OWNERS | 18 + .../apimachinery/pkg/api/meta/conditions.go | 102 + .../k8s.io/apimachinery/pkg/api/meta/doc.go | 19 + .../apimachinery/pkg/api/meta/errors.go | 121 + .../pkg/api/meta/firsthit_restmapper.go | 97 + .../k8s.io/apimachinery/pkg/api/meta/help.go | 264 + .../apimachinery/pkg/api/meta/interfaces.go | 134 + .../k8s.io/apimachinery/pkg/api/meta/lazy.go | 104 + .../k8s.io/apimachinery/pkg/api/meta/meta.go | 644 + .../pkg/api/meta/multirestmapper.go | 210 + .../apimachinery/pkg/api/meta/priority.go | 222 + .../apimachinery/pkg/api/meta/restmapper.go | 521 + .../apimachinery/pkg/api/resource/OWNERS | 12 + .../apimachinery/pkg/api/resource/amount.go | 299 + .../pkg/api/resource/generated.pb.go | 89 + .../pkg/api/resource/generated.proto | 88 + .../apimachinery/pkg/api/resource/math.go | 310 + .../apimachinery/pkg/api/resource/quantity.go | 776 + .../pkg/api/resource/quantity_proto.go | 288 + .../pkg/api/resource/scale_int.go | 95 + .../apimachinery/pkg/api/resource/suffix.go | 198 + .../pkg/api/resource/zz_generated.deepcopy.go | 27 + .../pkg/apis/meta/internalversion/doc.go | 20 + .../pkg/apis/meta/internalversion/register.go | 88 + .../apis/meta/internalversion/scheme/doc.go | 17 + .../meta/internalversion/scheme/register.go | 39 + .../pkg/apis/meta/internalversion/types.go | 80 + .../zz_generated.conversion.go | 145 + .../internalversion/zz_generated.deepcopy.go | 96 + .../apimachinery/pkg/apis/meta/v1/OWNERS | 23 + .../pkg/apis/meta/v1/controller_ref.go | 65 + .../pkg/apis/meta/v1/conversion.go | 355 + .../apimachinery/pkg/apis/meta/v1/deepcopy.go | 46 + .../apimachinery/pkg/apis/meta/v1/doc.go | 24 + .../apimachinery/pkg/apis/meta/v1/duration.go | 65 + .../pkg/apis/meta/v1/generated.pb.go | 11449 +++ .../pkg/apis/meta/v1/generated.proto | 1125 + .../pkg/apis/meta/v1/group_version.go | 157 + .../apimachinery/pkg/apis/meta/v1/helpers.go | 298 + .../apimachinery/pkg/apis/meta/v1/labels.go | 55 + .../apimachinery/pkg/apis/meta/v1/meta.go | 180 + .../pkg/apis/meta/v1/micro_time.go | 181 + .../pkg/apis/meta/v1/micro_time_fuzz.go | 39 + .../pkg/apis/meta/v1/micro_time_proto.go | 80 + .../apimachinery/pkg/apis/meta/v1/register.go | 107 + .../apimachinery/pkg/apis/meta/v1/time.go | 182 + .../pkg/apis/meta/v1/time_fuzz.go | 39 + .../pkg/apis/meta/v1/time_proto.go | 100 + .../apimachinery/pkg/apis/meta/v1/types.go | 1444 + .../meta/v1/types_swagger_doc_generated.go | 459 + .../pkg/apis/meta/v1/unstructured/helpers.go | 500 + .../apis/meta/v1/unstructured/unstructured.go | 496 + .../meta/v1/unstructured/unstructured_list.go | 210 + .../v1/unstructured/zz_generated.deepcopy.go | 55 + .../apimachinery/pkg/apis/meta/v1/watch.go | 89 + .../apis/meta/v1/zz_generated.conversion.go | 505 + .../pkg/apis/meta/v1/zz_generated.deepcopy.go | 1187 + .../pkg/apis/meta/v1/zz_generated.defaults.go | 32 + .../pkg/apis/meta/v1beta1/conversion.go | 46 + .../pkg/apis/meta/v1beta1/deepcopy.go | 17 + .../apimachinery/pkg/apis/meta/v1beta1/doc.go | 23 + .../pkg/apis/meta/v1beta1/generated.pb.go | 412 + .../pkg/apis/meta/v1beta1/generated.proto | 41 + .../pkg/apis/meta/v1beta1/register.go | 62 + .../pkg/apis/meta/v1beta1/types.go | 84 + .../v1beta1/types_swagger_doc_generated.go | 40 + .../meta/v1beta1/zz_generated.deepcopy.go | 59 + .../meta/v1beta1/zz_generated.defaults.go | 32 + .../apimachinery/pkg/conversion/converter.go | 233 + .../apimachinery/pkg/conversion/deep_equal.go | 36 + .../k8s.io/apimachinery/pkg/conversion/doc.go | 24 + .../apimachinery/pkg/conversion/helper.go | 39 + .../pkg/conversion/queryparams/convert.go | 194 + .../pkg/conversion/queryparams/doc.go | 19 + .../k8s.io/apimachinery/pkg/fields/doc.go | 19 + .../k8s.io/apimachinery/pkg/fields/fields.go | 62 + .../apimachinery/pkg/fields/requirements.go | 30 + .../apimachinery/pkg/fields/selector.go | 478 + .../k8s.io/apimachinery/pkg/labels/doc.go | 19 + .../k8s.io/apimachinery/pkg/labels/labels.go | 172 + .../apimachinery/pkg/labels/selector.go | 956 + .../pkg/labels/zz_generated.deepcopy.go | 42 + .../k8s.io/apimachinery/pkg/runtime/codec.go | 396 + .../apimachinery/pkg/runtime/codec_check.go | 56 + .../apimachinery/pkg/runtime/conversion.go | 196 + .../apimachinery/pkg/runtime/converter.go | 710 + .../k8s.io/apimachinery/pkg/runtime/doc.go | 51 + .../apimachinery/pkg/runtime/embedded.go | 149 + .../k8s.io/apimachinery/pkg/runtime/error.go | 151 + .../apimachinery/pkg/runtime/extension.go | 51 + .../apimachinery/pkg/runtime/generated.pb.go | 846 + .../apimachinery/pkg/runtime/generated.proto | 127 + .../k8s.io/apimachinery/pkg/runtime/helper.go | 259 + .../apimachinery/pkg/runtime/interfaces.go | 344 + .../k8s.io/apimachinery/pkg/runtime/mapper.go | 98 + .../apimachinery/pkg/runtime/negotiate.go | 113 + .../apimachinery/pkg/runtime/register.go | 31 + .../pkg/runtime/schema/generated.pb.go | 59 + .../pkg/runtime/schema/generated.proto | 26 + .../pkg/runtime/schema/group_version.go | 305 + .../pkg/runtime/schema/interfaces.go | 40 + .../k8s.io/apimachinery/pkg/runtime/scheme.go | 728 + .../pkg/runtime/scheme_builder.go | 48 + .../pkg/runtime/serializer/codec_factory.go | 322 + .../pkg/runtime/serializer/json/json.go | 388 + .../pkg/runtime/serializer/json/meta.go | 63 + .../runtime/serializer/negotiated_codec.go | 43 + .../pkg/runtime/serializer/protobuf/doc.go | 18 + .../runtime/serializer/protobuf/protobuf.go | 465 + .../serializer/recognizer/recognizer.go | 122 + .../runtime/serializer/streaming/streaming.go | 137 + .../serializer/versioning/versioning.go | 250 + .../pkg/runtime/swagger_doc_generator.go | 262 + .../k8s.io/apimachinery/pkg/runtime/types.go | 126 + .../apimachinery/pkg/runtime/types_proto.go | 89 + .../pkg/runtime/zz_generated.deepcopy.go | 75 + .../apimachinery/pkg/selection/operator.go | 33 + .../k8s.io/apimachinery/pkg/types/doc.go | 18 + .../apimachinery/pkg/types/namespacedname.go | 39 + .../k8s.io/apimachinery/pkg/types/nodename.go | 43 + .../k8s.io/apimachinery/pkg/types/patch.go | 29 + .../k8s.io/apimachinery/pkg/types/uid.go | 22 + .../apimachinery/pkg/util/cache/expiring.go | 192 + .../pkg/util/cache/lruexpirecache.go | 160 + .../apimachinery/pkg/util/clock/clock.go | 445 + .../k8s.io/apimachinery/pkg/util/diff/diff.go | 157 + .../apimachinery/pkg/util/errors/doc.go | 18 + .../apimachinery/pkg/util/errors/errors.go | 249 + .../apimachinery/pkg/util/framer/framer.go | 170 + .../pkg/util/intstr/generated.pb.go | 369 + .../pkg/util/intstr/generated.proto | 43 + .../pkg/util/intstr/instr_fuzz.go | 42 + .../apimachinery/pkg/util/intstr/intstr.go | 223 + .../k8s.io/apimachinery/pkg/util/json/json.go | 159 + .../pkg/util/managedfields/extract.go | 101 + .../apimachinery/pkg/util/mergepatch/OWNERS | 7 + .../pkg/util/mergepatch/errors.go | 102 + .../apimachinery/pkg/util/mergepatch/util.go | 133 + .../pkg/util/naming/from_stack.go | 93 + .../k8s.io/apimachinery/pkg/util/net/http.go | 774 + .../apimachinery/pkg/util/net/interface.go | 499 + .../apimachinery/pkg/util/net/port_range.go | 149 + .../apimachinery/pkg/util/net/port_split.go | 77 + .../k8s.io/apimachinery/pkg/util/net/util.go | 56 + .../apimachinery/pkg/util/runtime/runtime.go | 173 + .../k8s.io/apimachinery/pkg/util/sets/byte.go | 205 + .../k8s.io/apimachinery/pkg/util/sets/doc.go | 20 + .../apimachinery/pkg/util/sets/empty.go | 23 + .../k8s.io/apimachinery/pkg/util/sets/int.go | 205 + .../apimachinery/pkg/util/sets/int32.go | 205 + .../apimachinery/pkg/util/sets/int64.go | 205 + .../apimachinery/pkg/util/sets/string.go | 205 + .../pkg/util/strategicpatch/OWNERS | 8 + .../pkg/util/strategicpatch/errors.go | 49 + .../pkg/util/strategicpatch/meta.go | 194 + .../pkg/util/strategicpatch/patch.go | 2171 + .../pkg/util/strategicpatch/types.go | 193 + .../k8s.io/apimachinery/pkg/util/uuid/uuid.go | 27 + .../pkg/util/validation/field/errors.go | 272 + .../pkg/util/validation/field/path.go | 117 + .../pkg/util/validation/validation.go | 503 + .../k8s.io/apimachinery/pkg/util/wait/doc.go | 19 + .../k8s.io/apimachinery/pkg/util/wait/wait.go | 752 + .../apimachinery/pkg/util/yaml/decoder.go | 369 + .../k8s.io/apimachinery/pkg/version/doc.go | 20 + .../apimachinery/pkg/version/helpers.go | 88 + .../k8s.io/apimachinery/pkg/version/types.go | 37 + .../k8s.io/apimachinery/pkg/watch/doc.go | 19 + .../k8s.io/apimachinery/pkg/watch/filter.go | 105 + .../k8s.io/apimachinery/pkg/watch/mux.go | 299 + .../apimachinery/pkg/watch/streamwatcher.go | 136 + .../k8s.io/apimachinery/pkg/watch/watch.go | 324 + .../pkg/watch/zz_generated.deepcopy.go | 40 + .../third_party/forked/golang/LICENSE | 27 + .../third_party/forked/golang/PATENTS | 22 + .../third_party/forked/golang/json/OWNERS | 7 + .../third_party/forked/golang/json/fields.go | 513 + .../forked/golang/reflect/deep_equal.go | 388 + .../vendor/k8s.io/client-go/LICENSE | 202 + .../v1/mutatingwebhook.go | 141 + .../v1/mutatingwebhookconfiguration.go | 270 + .../admissionregistration/v1/rule.go | 76 + .../v1/rulewithoperations.go | 84 + .../v1/servicereference.go | 66 + .../v1/validatingwebhook.go | 132 + .../v1/validatingwebhookconfiguration.go | 270 + .../v1/webhookclientconfig.go | 59 + .../v1beta1/mutatingwebhook.go | 141 + .../v1beta1/mutatingwebhookconfiguration.go | 270 + .../admissionregistration/v1beta1/rule.go | 76 + .../v1beta1/rulewithoperations.go | 84 + .../v1beta1/servicereference.go | 66 + .../v1beta1/validatingwebhook.go | 132 + .../v1beta1/validatingwebhookconfiguration.go | 270 + .../v1beta1/webhookclientconfig.go | 59 + .../v1alpha1/serverstorageversion.go | 59 + .../v1alpha1/storageversion.go | 274 + .../v1alpha1/storageversioncondition.go | 89 + .../v1alpha1/storageversionstatus.go | 67 + .../apps/v1/controllerrevision.go | 277 + .../applyconfigurations/apps/v1/daemonset.go | 276 + .../apps/v1/daemonsetcondition.go | 81 + .../apps/v1/daemonsetspec.go | 80 + .../apps/v1/daemonsetstatus.go | 125 + .../apps/v1/daemonsetupdatestrategy.go | 52 + .../applyconfigurations/apps/v1/deployment.go | 276 + .../apps/v1/deploymentcondition.go | 90 + .../apps/v1/deploymentspec.go | 107 + .../apps/v1/deploymentstatus.go | 107 + .../apps/v1/deploymentstrategy.go | 52 + .../applyconfigurations/apps/v1/replicaset.go | 276 + .../apps/v1/replicasetcondition.go | 81 + .../apps/v1/replicasetspec.go | 71 + .../apps/v1/replicasetstatus.go | 89 + .../apps/v1/rollingupdatedaemonset.go | 52 + .../apps/v1/rollingupdatedeployment.go | 52 + .../v1/rollingupdatestatefulsetstrategy.go | 39 + .../apps/v1/statefulset.go | 276 + .../apps/v1/statefulsetcondition.go | 81 + .../apps/v1/statefulsetspec.go | 122 + .../apps/v1/statefulsetstatus.go | 125 + .../apps/v1/statefulsetupdatestrategy.go | 52 + .../apps/v1beta1/controllerrevision.go | 277 + .../apps/v1beta1/deployment.go | 276 + .../apps/v1beta1/deploymentcondition.go | 90 + .../apps/v1beta1/deploymentspec.go | 116 + .../apps/v1beta1/deploymentstatus.go | 107 + .../apps/v1beta1/deploymentstrategy.go | 52 + .../apps/v1beta1/rollbackconfig.go | 39 + .../apps/v1beta1/rollingupdatedeployment.go | 52 + .../rollingupdatestatefulsetstrategy.go | 39 + .../apps/v1beta1/statefulset.go | 276 + .../apps/v1beta1/statefulsetcondition.go | 81 + .../apps/v1beta1/statefulsetspec.go | 122 + .../apps/v1beta1/statefulsetstatus.go | 125 + .../apps/v1beta1/statefulsetupdatestrategy.go | 52 + .../apps/v1beta2/controllerrevision.go | 277 + .../apps/v1beta2/daemonset.go | 276 + .../apps/v1beta2/daemonsetcondition.go | 81 + .../apps/v1beta2/daemonsetspec.go | 80 + .../apps/v1beta2/daemonsetstatus.go | 125 + .../apps/v1beta2/daemonsetupdatestrategy.go | 52 + .../apps/v1beta2/deployment.go | 276 + .../apps/v1beta2/deploymentcondition.go | 90 + .../apps/v1beta2/deploymentspec.go | 107 + .../apps/v1beta2/deploymentstatus.go | 107 + .../apps/v1beta2/deploymentstrategy.go | 52 + .../apps/v1beta2/replicaset.go | 276 + .../apps/v1beta2/replicasetcondition.go | 81 + .../apps/v1beta2/replicasetspec.go | 71 + .../apps/v1beta2/replicasetstatus.go | 89 + .../apps/v1beta2/rollingupdatedaemonset.go | 52 + .../apps/v1beta2/rollingupdatedeployment.go | 52 + .../rollingupdatestatefulsetstrategy.go | 39 + .../applyconfigurations/apps/v1beta2/scale.go | 233 + .../apps/v1beta2/statefulset.go | 276 + .../apps/v1beta2/statefulsetcondition.go | 81 + .../apps/v1beta2/statefulsetspec.go | 122 + .../apps/v1beta2/statefulsetstatus.go | 125 + .../apps/v1beta2/statefulsetupdatestrategy.go | 52 + .../v1/crossversionobjectreference.go | 57 + .../autoscaling/v1/horizontalpodautoscaler.go | 276 + .../v1/horizontalpodautoscalerspec.go | 66 + .../v1/horizontalpodautoscalerstatus.go | 79 + .../autoscaling/v1/scale.go | 232 + .../autoscaling/v1/scalespec.go | 39 + .../autoscaling/v1/scalestatus.go | 48 + .../v2beta1/containerresourcemetricsource.go | 71 + .../v2beta1/containerresourcemetricstatus.go | 71 + .../v2beta1/crossversionobjectreference.go | 57 + .../v2beta1/externalmetricsource.go | 71 + .../v2beta1/externalmetricstatus.go | 71 + .../v2beta1/horizontalpodautoscaler.go | 276 + .../horizontalpodautoscalercondition.go | 81 + .../v2beta1/horizontalpodautoscalerspec.go | 71 + .../v2beta1/horizontalpodautoscalerstatus.go | 98 + .../autoscaling/v2beta1/metricspec.go | 88 + .../autoscaling/v2beta1/metricstatus.go | 88 + .../autoscaling/v2beta1/objectmetricsource.go | 80 + .../autoscaling/v2beta1/objectmetricstatus.go | 80 + .../autoscaling/v2beta1/podsmetricsource.go | 62 + .../autoscaling/v2beta1/podsmetricstatus.go | 62 + .../v2beta1/resourcemetricsource.go | 62 + .../v2beta1/resourcemetricstatus.go | 62 + .../v2beta2/containerresourcemetricsource.go | 61 + .../v2beta2/containerresourcemetricstatus.go | 61 + .../v2beta2/crossversionobjectreference.go | 57 + .../v2beta2/externalmetricsource.go | 48 + .../v2beta2/externalmetricstatus.go | 48 + .../v2beta2/horizontalpodautoscaler.go | 276 + .../horizontalpodautoscalerbehavior.go | 48 + .../horizontalpodautoscalercondition.go | 81 + .../v2beta2/horizontalpodautoscalerspec.go | 80 + .../v2beta2/horizontalpodautoscalerstatus.go | 98 + .../autoscaling/v2beta2/hpascalingpolicy.go | 61 + .../autoscaling/v2beta2/hpascalingrules.go | 66 + .../autoscaling/v2beta2/metricidentifier.go | 52 + .../autoscaling/v2beta2/metricspec.go | 88 + .../autoscaling/v2beta2/metricstatus.go | 88 + .../autoscaling/v2beta2/metrictarget.go | 71 + .../autoscaling/v2beta2/metricvaluestatus.go | 61 + .../autoscaling/v2beta2/objectmetricsource.go | 57 + .../autoscaling/v2beta2/objectmetricstatus.go | 57 + .../autoscaling/v2beta2/podsmetricsource.go | 48 + .../autoscaling/v2beta2/podsmetricstatus.go | 48 + .../v2beta2/resourcemetricsource.go | 52 + .../v2beta2/resourcemetricstatus.go | 52 + .../applyconfigurations/batch/v1/cronjob.go | 276 + .../batch/v1/cronjobspec.go | 97 + .../batch/v1/cronjobstatus.go | 67 + .../applyconfigurations/batch/v1/job.go | 276 + .../batch/v1/jobcondition.go | 90 + .../applyconfigurations/batch/v1/jobspec.go | 126 + .../applyconfigurations/batch/v1/jobstatus.go | 111 + .../batch/v1/jobtemplatespec.go | 206 + .../batch/v1/uncountedterminatedpods.go | 56 + .../batch/v1beta1/cronjob.go | 276 + .../batch/v1beta1/cronjobspec.go | 97 + .../batch/v1beta1/cronjobstatus.go | 67 + .../batch/v1beta1/jobtemplatespec.go | 207 + .../v1/certificatesigningrequest.go | 274 + .../v1/certificatesigningrequestcondition.go | 90 + .../v1/certificatesigningrequestspec.go | 118 + .../v1/certificatesigningrequeststatus.go | 55 + .../v1beta1/certificatesigningrequest.go | 274 + .../certificatesigningrequestcondition.go | 90 + .../v1beta1/certificatesigningrequestspec.go | 118 + .../certificatesigningrequeststatus.go | 55 + .../coordination/v1/lease.go | 267 + .../coordination/v1/leasespec.go | 79 + .../coordination/v1beta1/lease.go | 267 + .../coordination/v1beta1/leasespec.go | 79 + .../applyconfigurations/core/v1/affinity.go | 57 + .../core/v1/attachedvolume.go | 52 + .../v1/awselasticblockstorevolumesource.go | 66 + .../core/v1/azurediskvolumesource.go | 88 + .../v1/azurefilepersistentvolumesource.go | 66 + .../core/v1/azurefilevolumesource.go | 57 + .../core/v1/capabilities.go | 56 + .../core/v1/cephfspersistentvolumesource.go | 86 + .../core/v1/cephfsvolumesource.go | 86 + .../core/v1/cinderpersistentvolumesource.go | 66 + .../core/v1/cindervolumesource.go | 66 + .../core/v1/clientipconfig.go | 39 + .../core/v1/componentcondition.go | 70 + .../core/v1/componentstatus.go | 270 + .../applyconfigurations/core/v1/configmap.go | 297 + .../core/v1/configmapenvsource.go | 48 + .../core/v1/configmapkeyselector.go | 57 + .../core/v1/configmapnodeconfigsource.go | 79 + .../core/v1/configmapprojection.go | 62 + .../core/v1/configmapvolumesource.go | 71 + .../applyconfigurations/core/v1/container.go | 261 + .../core/v1/containerimage.go | 50 + .../core/v1/containerport.go | 79 + .../core/v1/containerstate.go | 57 + .../core/v1/containerstaterunning.go | 43 + .../core/v1/containerstateterminated.go | 97 + .../core/v1/containerstatewaiting.go | 48 + .../core/v1/containerstatus.go | 111 + .../core/v1/csipersistentvolumesource.go | 117 + .../core/v1/csivolumesource.go | 81 + .../core/v1/daemonendpoint.go | 39 + .../core/v1/downwardapiprojection.go | 44 + .../core/v1/downwardapivolumefile.go | 66 + .../core/v1/downwardapivolumesource.go | 53 + .../core/v1/emptydirvolumesource.go | 53 + .../core/v1/endpointaddress.go | 66 + .../core/v1/endpointport.go | 70 + .../applyconfigurations/core/v1/endpoints.go | 272 + .../core/v1/endpointsubset.go | 72 + .../core/v1/envfromsource.go | 57 + .../applyconfigurations/core/v1/envvar.go | 57 + .../core/v1/envvarsource.go | 66 + .../core/v1/ephemeralcontainer.go | 249 + .../core/v1/ephemeralcontainercommon.go | 261 + .../core/v1/ephemeralvolumesource.go | 39 + .../applyconfigurations/core/v1/event.go | 384 + .../core/v1/eventseries.go | 52 + .../core/v1/eventsource.go | 48 + .../applyconfigurations/core/v1/execaction.go | 41 + .../core/v1/fcvolumesource.go | 79 + .../core/v1/flexpersistentvolumesource.go | 81 + .../core/v1/flexvolumesource.go | 81 + .../core/v1/flockervolumesource.go | 48 + .../core/v1/gcepersistentdiskvolumesource.go | 66 + .../core/v1/gitrepovolumesource.go | 57 + .../v1/glusterfspersistentvolumesource.go | 66 + .../core/v1/glusterfsvolumesource.go | 57 + .../applyconfigurations/core/v1/handler.go | 57 + .../applyconfigurations/core/v1/hostalias.go | 50 + .../core/v1/hostpathvolumesource.go | 52 + .../core/v1/httpgetaction.go | 85 + .../applyconfigurations/core/v1/httpheader.go | 48 + .../core/v1/iscsipersistentvolumesource.go | 131 + .../core/v1/iscsivolumesource.go | 131 + .../applyconfigurations/core/v1/keytopath.go | 57 + .../applyconfigurations/core/v1/lifecycle.go | 48 + .../applyconfigurations/core/v1/limitrange.go | 267 + .../core/v1/limitrangeitem.go | 88 + .../core/v1/limitrangespec.go | 44 + .../core/v1/loadbalanceringress.go | 62 + .../core/v1/loadbalancerstatus.go | 44 + .../core/v1/localobjectreference.go | 39 + .../core/v1/localvolumesource.go | 48 + .../applyconfigurations/core/v1/namespace.go | 274 + .../core/v1/namespacecondition.go | 80 + .../core/v1/namespacespec.go | 45 + .../core/v1/namespacestatus.go | 57 + .../core/v1/nfsvolumesource.go | 57 + .../applyconfigurations/core/v1/node.go | 274 + .../core/v1/nodeaddress.go | 52 + .../core/v1/nodeaffinity.go | 53 + .../core/v1/nodecondition.go | 89 + .../core/v1/nodeconfigsource.go | 39 + .../core/v1/nodeconfigstatus.go | 66 + .../core/v1/nodedaemonendpoints.go | 39 + .../core/v1/nodeselector.go | 44 + .../core/v1/nodeselectorrequirement.go | 63 + .../core/v1/nodeselectorterm.go | 58 + .../applyconfigurations/core/v1/nodespec.go | 100 + .../applyconfigurations/core/v1/nodestatus.go | 155 + .../core/v1/nodesysteminfo.go | 120 + .../core/v1/objectfieldselector.go | 48 + .../core/v1/objectreference.go | 97 + .../core/v1/persistentvolume.go | 274 + .../core/v1/persistentvolumeclaim.go | 276 + .../core/v1/persistentvolumeclaimcondition.go | 89 + .../core/v1/persistentvolumeclaimspec.go | 109 + .../core/v1/persistentvolumeclaimstatus.go | 77 + .../core/v1/persistentvolumeclaimtemplate.go | 206 + .../v1/persistentvolumeclaimvolumesource.go | 48 + .../core/v1/persistentvolumesource.go | 228 + .../core/v1/persistentvolumespec.go | 287 + .../core/v1/persistentvolumestatus.go | 61 + .../v1/photonpersistentdiskvolumesource.go | 48 + .../applyconfigurations/core/v1/pod.go | 276 + .../core/v1/podaffinity.go | 58 + .../core/v1/podaffinityterm.go | 72 + .../core/v1/podantiaffinity.go | 58 + .../core/v1/podcondition.go | 89 + .../core/v1/poddnsconfig.go | 66 + .../core/v1/poddnsconfigoption.go | 48 + .../applyconfigurations/core/v1/podip.go | 39 + .../core/v1/podreadinessgate.go | 43 + .../core/v1/podsecuritycontext.go | 131 + .../applyconfigurations/core/v1/podspec.go | 400 + .../applyconfigurations/core/v1/podstatus.go | 177 + .../core/v1/podtemplate.go | 267 + .../core/v1/podtemplatespec.go | 206 + .../applyconfigurations/core/v1/portstatus.go | 61 + .../core/v1/portworxvolumesource.go | 57 + .../core/v1/preferredschedulingterm.go | 48 + .../applyconfigurations/core/v1/probe.go | 109 + .../core/v1/projectedvolumesource.go | 53 + .../core/v1/quobytevolumesource.go | 84 + .../core/v1/rbdpersistentvolumesource.go | 104 + .../core/v1/rbdvolumesource.go | 104 + .../core/v1/replicationcontroller.go | 276 + .../core/v1/replicationcontrollercondition.go | 80 + .../core/v1/replicationcontrollerspec.go | 72 + .../core/v1/replicationcontrollerstatus.go | 89 + .../core/v1/resourcefieldselector.go | 61 + .../core/v1/resourcequota.go | 276 + .../core/v1/resourcequotaspec.go | 63 + .../core/v1/resourcequotastatus.go | 52 + .../core/v1/resourcerequirements.go | 52 + .../core/v1/scaleiopersistentvolumesource.go | 120 + .../core/v1/scaleiovolumesource.go | 120 + .../v1/scopedresourceselectorrequirement.go | 63 + .../core/v1/scopeselector.go | 44 + .../core/v1/seccompprofile.go | 52 + .../applyconfigurations/core/v1/secret.go | 306 + .../core/v1/secretenvsource.go | 48 + .../core/v1/secretkeyselector.go | 57 + .../core/v1/secretprojection.go | 62 + .../core/v1/secretreference.go | 48 + .../core/v1/secretvolumesource.go | 71 + .../core/v1/securitycontext.go | 133 + .../core/v1/selinuxoptions.go | 66 + .../applyconfigurations/core/v1/service.go | 276 + .../core/v1/serviceaccount.go | 295 + .../core/v1/serviceaccounttokenprojection.go | 57 + .../core/v1/serviceport.go | 89 + .../core/v1/servicespec.go | 224 + .../core/v1/servicestatus.go | 57 + .../core/v1/sessionaffinityconfig.go | 39 + .../v1/storageospersistentvolumesource.go | 75 + .../core/v1/storageosvolumesource.go | 75 + .../applyconfigurations/core/v1/sysctl.go | 48 + .../applyconfigurations/core/v1/taint.go | 71 + .../core/v1/tcpsocketaction.go | 52 + .../applyconfigurations/core/v1/toleration.go | 79 + .../v1/topologyselectorlabelrequirement.go | 50 + .../core/v1/topologyselectorterm.go | 44 + .../core/v1/topologyspreadconstraint.go | 71 + .../core/v1/typedlocalobjectreference.go | 57 + .../applyconfigurations/core/v1/volume.go | 272 + .../core/v1/volumedevice.go | 48 + .../core/v1/volumemount.go | 88 + .../core/v1/volumenodeaffinity.go | 39 + .../core/v1/volumeprojection.go | 66 + .../core/v1/volumesource.go | 291 + .../core/v1/vspherevirtualdiskvolumesource.go | 66 + .../core/v1/weightedpodaffinityterm.go | 48 + .../core/v1/windowssecuritycontextoptions.go | 66 + .../discovery/v1/endpoint.go | 114 + .../discovery/v1/endpointconditions.go | 57 + .../discovery/v1/endpointhints.go | 44 + .../discovery/v1/endpointport.go | 70 + .../discovery/v1/endpointslice.go | 295 + .../discovery/v1/forzone.go | 39 + .../discovery/v1beta1/endpoint.go | 105 + .../discovery/v1beta1/endpointconditions.go | 57 + .../discovery/v1beta1/endpointhints.go | 44 + .../discovery/v1beta1/endpointport.go | 70 + .../discovery/v1beta1/endpointslice.go | 295 + .../discovery/v1beta1/forzone.go | 39 + .../applyconfigurations/events/v1/event.go | 385 + .../events/v1/eventseries.go | 52 + .../events/v1beta1/event.go | 385 + .../events/v1beta1/eventseries.go | 52 + .../extensions/v1beta1/allowedcsidriver.go | 39 + .../extensions/v1beta1/allowedflexvolume.go | 39 + .../extensions/v1beta1/allowedhostpath.go | 48 + .../extensions/v1beta1/daemonset.go | 276 + .../extensions/v1beta1/daemonsetcondition.go | 81 + .../extensions/v1beta1/daemonsetspec.go | 89 + .../extensions/v1beta1/daemonsetstatus.go | 125 + .../v1beta1/daemonsetupdatestrategy.go | 52 + .../extensions/v1beta1/deployment.go | 276 + .../extensions/v1beta1/deploymentcondition.go | 90 + .../extensions/v1beta1/deploymentspec.go | 116 + .../extensions/v1beta1/deploymentstatus.go | 107 + .../extensions/v1beta1/deploymentstrategy.go | 52 + .../v1beta1/fsgroupstrategyoptions.go | 57 + .../extensions/v1beta1/hostportrange.go | 48 + .../extensions/v1beta1/httpingresspath.go | 61 + .../v1beta1/httpingressrulevalue.go | 44 + .../extensions/v1beta1/idrange.go | 48 + .../extensions/v1beta1/ingress.go | 276 + .../extensions/v1beta1/ingressbackend.go | 62 + .../extensions/v1beta1/ingressrule.go | 48 + .../extensions/v1beta1/ingressrulevalue.go | 39 + .../extensions/v1beta1/ingressspec.go | 76 + .../extensions/v1beta1/ingressstatus.go | 43 + .../extensions/v1beta1/ingresstls.go | 50 + .../extensions/v1beta1/ipblock.go | 50 + .../extensions/v1beta1/networkpolicy.go | 267 + .../v1beta1/networkpolicyegressrule.go | 58 + .../v1beta1/networkpolicyingressrule.go | 58 + .../extensions/v1beta1/networkpolicypeer.go | 61 + .../extensions/v1beta1/networkpolicyport.go | 62 + .../extensions/v1beta1/networkpolicyspec.go | 83 + .../extensions/v1beta1/podsecuritypolicy.go | 265 + .../v1beta1/podsecuritypolicyspec.go | 285 + .../extensions/v1beta1/replicaset.go | 276 + .../extensions/v1beta1/replicasetcondition.go | 81 + .../extensions/v1beta1/replicasetspec.go | 71 + .../extensions/v1beta1/replicasetstatus.go | 89 + .../extensions/v1beta1/rollbackconfig.go | 39 + .../v1beta1/rollingupdatedaemonset.go | 52 + .../v1beta1/rollingupdatedeployment.go | 52 + .../v1beta1/runasgroupstrategyoptions.go | 57 + .../v1beta1/runasuserstrategyoptions.go | 57 + .../v1beta1/runtimeclassstrategyoptions.go | 50 + .../extensions/v1beta1/scale.go | 233 + .../v1beta1/selinuxstrategyoptions.go | 53 + .../supplementalgroupsstrategyoptions.go | 57 + .../v1alpha1/flowdistinguishermethod.go | 43 + .../flowcontrol/v1alpha1/flowschema.go | 274 + .../v1alpha1/flowschemacondition.go | 80 + .../flowcontrol/v1alpha1/flowschemaspec.go | 71 + .../flowcontrol/v1alpha1/flowschemastatus.go | 44 + .../flowcontrol/v1alpha1/groupsubject.go | 39 + .../limitedprioritylevelconfiguration.go | 48 + .../flowcontrol/v1alpha1/limitresponse.go | 52 + .../v1alpha1/nonresourcepolicyrule.go | 52 + .../v1alpha1/policyruleswithsubjects.go | 72 + .../v1alpha1/prioritylevelconfiguration.go | 274 + .../prioritylevelconfigurationcondition.go | 80 + .../prioritylevelconfigurationreference.go | 39 + .../prioritylevelconfigurationspec.go | 52 + .../prioritylevelconfigurationstatus.go | 44 + .../v1alpha1/queuingconfiguration.go | 57 + .../v1alpha1/resourcepolicyrule.go | 83 + .../v1alpha1/serviceaccountsubject.go | 48 + .../flowcontrol/v1alpha1/subject.go | 70 + .../flowcontrol/v1alpha1/usersubject.go | 39 + .../v1beta1/flowdistinguishermethod.go | 43 + .../flowcontrol/v1beta1/flowschema.go | 274 + .../v1beta1/flowschemacondition.go | 80 + .../flowcontrol/v1beta1/flowschemaspec.go | 71 + .../flowcontrol/v1beta1/flowschemastatus.go | 44 + .../flowcontrol/v1beta1/groupsubject.go | 39 + .../limitedprioritylevelconfiguration.go | 48 + .../flowcontrol/v1beta1/limitresponse.go | 52 + .../v1beta1/nonresourcepolicyrule.go | 52 + .../v1beta1/policyruleswithsubjects.go | 72 + .../v1beta1/prioritylevelconfiguration.go | 274 + .../prioritylevelconfigurationcondition.go | 80 + .../prioritylevelconfigurationreference.go | 39 + .../v1beta1/prioritylevelconfigurationspec.go | 52 + .../prioritylevelconfigurationstatus.go | 44 + .../v1beta1/queuingconfiguration.go | 57 + .../flowcontrol/v1beta1/resourcepolicyrule.go | 83 + .../v1beta1/serviceaccountsubject.go | 48 + .../flowcontrol/v1beta1/subject.go | 70 + .../flowcontrol/v1beta1/usersubject.go | 39 + .../applyconfigurations/internal/internal.go | 10848 +++ .../applyconfigurations/meta/v1/condition.go | 88 + .../meta/v1/deleteoptions.go | 98 + .../meta/v1/labelselector.go | 59 + .../meta/v1/labelselectorrequirement.go | 63 + .../meta/v1/managedfieldsentry.go | 97 + .../applyconfigurations/meta/v1/objectmeta.go | 189 + .../meta/v1/ownerreference.go | 88 + .../meta/v1/preconditions.go | 52 + .../applyconfigurations/meta/v1/typemeta.go | 48 + .../networking/v1/httpingresspath.go | 61 + .../networking/v1/httpingressrulevalue.go | 44 + .../networking/v1/ingress.go | 276 + .../networking/v1/ingressbackend.go | 52 + .../networking/v1/ingressclass.go | 265 + .../v1/ingressclassparametersreference.go | 75 + .../networking/v1/ingressclassspec.go | 48 + .../networking/v1/ingressrule.go | 48 + .../networking/v1/ingressrulevalue.go | 39 + .../networking/v1/ingressservicebackend.go | 48 + .../networking/v1/ingressspec.go | 76 + .../networking/v1/ingressstatus.go | 43 + .../networking/v1/ingresstls.go | 50 + .../networking/v1/ipblock.go | 50 + .../networking/v1/networkpolicy.go | 267 + .../networking/v1/networkpolicyegressrule.go | 58 + .../networking/v1/networkpolicyingressrule.go | 58 + .../networking/v1/networkpolicypeer.go | 61 + .../networking/v1/networkpolicyport.go | 62 + .../networking/v1/networkpolicyspec.go | 83 + .../networking/v1/servicebackendport.go | 48 + .../networking/v1beta1/httpingresspath.go | 61 + .../v1beta1/httpingressrulevalue.go | 44 + .../networking/v1beta1/ingress.go | 276 + .../networking/v1beta1/ingressbackend.go | 62 + .../networking/v1beta1/ingressclass.go | 265 + .../ingressclassparametersreference.go | 75 + .../networking/v1beta1/ingressclassspec.go | 48 + .../networking/v1beta1/ingressrule.go | 48 + .../networking/v1beta1/ingressrulevalue.go | 39 + .../networking/v1beta1/ingressspec.go | 76 + .../networking/v1beta1/ingressstatus.go | 43 + .../networking/v1beta1/ingresstls.go | 50 + .../applyconfigurations/node/v1/overhead.go | 43 + .../node/v1/runtimeclass.go | 283 + .../applyconfigurations/node/v1/scheduling.go | 63 + .../node/v1alpha1/overhead.go | 43 + .../node/v1alpha1/runtimeclass.go | 265 + .../node/v1alpha1/runtimeclassspec.go | 57 + .../node/v1alpha1/scheduling.go | 63 + .../node/v1beta1/overhead.go | 43 + .../node/v1beta1/runtimeclass.go | 283 + .../node/v1beta1/scheduling.go | 63 + .../applyconfigurations/policy/v1/eviction.go | 267 + .../policy/v1/poddisruptionbudget.go | 276 + .../policy/v1/poddisruptionbudgetspec.go | 62 + .../policy/v1/poddisruptionbudgetstatus.go | 109 + .../policy/v1beta1/allowedcsidriver.go | 39 + .../policy/v1beta1/allowedflexvolume.go | 39 + .../policy/v1beta1/allowedhostpath.go | 48 + .../policy/v1beta1/eviction.go | 267 + .../policy/v1beta1/fsgroupstrategyoptions.go | 57 + .../policy/v1beta1/hostportrange.go | 48 + .../policy/v1beta1/idrange.go | 48 + .../policy/v1beta1/poddisruptionbudget.go | 276 + .../policy/v1beta1/poddisruptionbudgetspec.go | 62 + .../v1beta1/poddisruptionbudgetstatus.go | 109 + .../policy/v1beta1/podsecuritypolicy.go | 265 + .../policy/v1beta1/podsecuritypolicyspec.go | 285 + .../v1beta1/runasgroupstrategyoptions.go | 57 + .../v1beta1/runasuserstrategyoptions.go | 57 + .../v1beta1/runtimeclassstrategyoptions.go | 50 + .../policy/v1beta1/selinuxstrategyoptions.go | 53 + .../supplementalgroupsstrategyoptions.go | 57 + .../rbac/v1/aggregationrule.go | 48 + .../rbac/v1/clusterrole.go | 279 + .../rbac/v1/clusterrolebinding.go | 279 + .../applyconfigurations/rbac/v1/policyrule.go | 85 + .../applyconfigurations/rbac/v1/role.go | 272 + .../rbac/v1/rolebinding.go | 281 + .../applyconfigurations/rbac/v1/roleref.go | 57 + .../applyconfigurations/rbac/v1/subject.go | 66 + .../rbac/v1alpha1/aggregationrule.go | 48 + .../rbac/v1alpha1/clusterrole.go | 279 + .../rbac/v1alpha1/clusterrolebinding.go | 279 + .../rbac/v1alpha1/policyrule.go | 85 + .../applyconfigurations/rbac/v1alpha1/role.go | 272 + .../rbac/v1alpha1/rolebinding.go | 281 + .../rbac/v1alpha1/roleref.go | 57 + .../rbac/v1alpha1/subject.go | 66 + .../rbac/v1beta1/aggregationrule.go | 48 + .../rbac/v1beta1/clusterrole.go | 279 + .../rbac/v1beta1/clusterrolebinding.go | 279 + .../rbac/v1beta1/policyrule.go | 85 + .../applyconfigurations/rbac/v1beta1/role.go | 272 + .../rbac/v1beta1/rolebinding.go | 281 + .../rbac/v1beta1/roleref.go | 57 + .../rbac/v1beta1/subject.go | 66 + .../scheduling/v1/priorityclass.go | 293 + .../scheduling/v1alpha1/priorityclass.go | 293 + .../scheduling/v1beta1/priorityclass.go | 293 + .../storage/v1/csidriver.go | 265 + .../storage/v1/csidriverspec.go | 104 + .../applyconfigurations/storage/v1/csinode.go | 265 + .../storage/v1/csinodedriver.go | 68 + .../storage/v1/csinodespec.go | 44 + .../storage/v1/storageclass.go | 334 + .../storage/v1/tokenrequest.go | 48 + .../storage/v1/volumeattachment.go | 274 + .../storage/v1/volumeattachmentsource.go | 52 + .../storage/v1/volumeattachmentspec.go | 57 + .../storage/v1/volumeattachmentstatus.go | 72 + .../storage/v1/volumeerror.go | 52 + .../storage/v1/volumenoderesources.go | 39 + .../storage/v1alpha1/csistoragecapacity.go | 295 + .../storage/v1alpha1/volumeattachment.go | 274 + .../v1alpha1/volumeattachmentsource.go | 52 + .../storage/v1alpha1/volumeattachmentspec.go | 57 + .../v1alpha1/volumeattachmentstatus.go | 72 + .../storage/v1alpha1/volumeerror.go | 52 + .../storage/v1beta1/csidriver.go | 265 + .../storage/v1beta1/csidriverspec.go | 104 + .../storage/v1beta1/csinode.go | 265 + .../storage/v1beta1/csinodedriver.go | 68 + .../storage/v1beta1/csinodespec.go | 44 + .../storage/v1beta1/csistoragecapacity.go | 295 + .../storage/v1beta1/storageclass.go | 334 + .../storage/v1beta1/tokenrequest.go | 48 + .../storage/v1beta1/volumeattachment.go | 274 + .../storage/v1beta1/volumeattachmentsource.go | 52 + .../storage/v1beta1/volumeattachmentspec.go | 57 + .../storage/v1beta1/volumeattachmentstatus.go | 72 + .../storage/v1beta1/volumeerror.go | 52 + .../storage/v1beta1/volumenoderesources.go | 39 + .../client-go/discovery/discovery_client.go | 517 + .../vendor/k8s.io/client-go/discovery/doc.go | 19 + .../k8s.io/client-go/discovery/helper.go | 125 + .../k8s.io/client-go/dynamic/interface.go | 61 + .../vendor/k8s.io/client-go/dynamic/scheme.go | 108 + .../vendor/k8s.io/client-go/dynamic/simple.go | 327 + .../k8s.io/client-go/kubernetes/clientset.go | 685 + .../vendor/k8s.io/client-go/kubernetes/doc.go | 20 + .../k8s.io/client-go/kubernetes/import.go | 19 + .../k8s.io/client-go/kubernetes/scheme/doc.go | 20 + .../client-go/kubernetes/scheme/register.go | 140 + .../v1/admissionregistration_client.go | 94 + .../typed/admissionregistration/v1/doc.go | 20 + .../v1/generated_expansion.go | 23 + .../v1/mutatingwebhookconfiguration.go | 197 + .../v1/validatingwebhookconfiguration.go | 197 + .../v1beta1/admissionregistration_client.go | 94 + .../admissionregistration/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 23 + .../v1beta1/mutatingwebhookconfiguration.go | 197 + .../v1beta1/validatingwebhookconfiguration.go | 197 + .../v1alpha1/apiserverinternal_client.go | 89 + .../typed/apiserverinternal/v1alpha1/doc.go | 20 + .../v1alpha1/generated_expansion.go | 21 + .../v1alpha1/storageversion.go | 243 + .../kubernetes/typed/apps/v1/apps_client.go | 109 + .../typed/apps/v1/controllerrevision.go | 208 + .../kubernetes/typed/apps/v1/daemonset.go | 256 + .../kubernetes/typed/apps/v1/deployment.go | 316 + .../client-go/kubernetes/typed/apps/v1/doc.go | 20 + .../typed/apps/v1/generated_expansion.go | 29 + .../kubernetes/typed/apps/v1/replicaset.go | 316 + .../kubernetes/typed/apps/v1/statefulset.go | 316 + .../typed/apps/v1beta1/apps_client.go | 99 + .../typed/apps/v1beta1/controllerrevision.go | 208 + .../typed/apps/v1beta1/deployment.go | 256 + .../kubernetes/typed/apps/v1beta1/doc.go | 20 + .../typed/apps/v1beta1/generated_expansion.go | 25 + .../typed/apps/v1beta1/statefulset.go | 256 + .../typed/apps/v1beta2/apps_client.go | 109 + .../typed/apps/v1beta2/controllerrevision.go | 208 + .../typed/apps/v1beta2/daemonset.go | 256 + .../typed/apps/v1beta2/deployment.go | 256 + .../kubernetes/typed/apps/v1beta2/doc.go | 20 + .../typed/apps/v1beta2/generated_expansion.go | 29 + .../typed/apps/v1beta2/replicaset.go | 256 + .../typed/apps/v1beta2/statefulset.go | 314 + .../v1/authentication_client.go | 89 + .../kubernetes/typed/authentication/v1/doc.go | 20 + .../authentication/v1/generated_expansion.go | 21 + .../typed/authentication/v1/tokenreview.go | 64 + .../v1beta1/authentication_client.go | 89 + .../typed/authentication/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 21 + .../authentication/v1beta1/tokenreview.go | 64 + .../authorization/v1/authorization_client.go | 104 + .../kubernetes/typed/authorization/v1/doc.go | 20 + .../authorization/v1/generated_expansion.go | 27 + .../v1/localsubjectaccessreview.go | 67 + .../v1/selfsubjectaccessreview.go | 64 + .../v1/selfsubjectrulesreview.go | 64 + .../authorization/v1/subjectaccessreview.go | 64 + .../v1beta1/authorization_client.go | 104 + .../typed/authorization/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 27 + .../v1beta1/localsubjectaccessreview.go | 67 + .../v1beta1/selfsubjectaccessreview.go | 64 + .../v1beta1/selfsubjectrulesreview.go | 64 + .../v1beta1/subjectaccessreview.go | 64 + .../autoscaling/v1/autoscaling_client.go | 89 + .../kubernetes/typed/autoscaling/v1/doc.go | 20 + .../autoscaling/v1/generated_expansion.go | 21 + .../autoscaling/v1/horizontalpodautoscaler.go | 256 + .../autoscaling/v2beta1/autoscaling_client.go | 89 + .../typed/autoscaling/v2beta1/doc.go | 20 + .../v2beta1/generated_expansion.go | 21 + .../v2beta1/horizontalpodautoscaler.go | 256 + .../autoscaling/v2beta2/autoscaling_client.go | 89 + .../typed/autoscaling/v2beta2/doc.go | 20 + .../v2beta2/generated_expansion.go | 21 + .../v2beta2/horizontalpodautoscaler.go | 256 + .../kubernetes/typed/batch/v1/batch_client.go | 94 + .../kubernetes/typed/batch/v1/cronjob.go | 256 + .../kubernetes/typed/batch/v1/doc.go | 20 + .../typed/batch/v1/generated_expansion.go | 23 + .../kubernetes/typed/batch/v1/job.go | 256 + .../typed/batch/v1beta1/batch_client.go | 89 + .../kubernetes/typed/batch/v1beta1/cronjob.go | 256 + .../kubernetes/typed/batch/v1beta1/doc.go | 20 + .../batch/v1beta1/generated_expansion.go | 21 + .../certificates/v1/certificates_client.go | 89 + .../v1/certificatesigningrequest.go | 259 + .../kubernetes/typed/certificates/v1/doc.go | 20 + .../certificates/v1/generated_expansion.go | 21 + .../v1beta1/certificates_client.go | 89 + .../v1beta1/certificatesigningrequest.go | 243 + .../certificatesigningrequest_expansion.go | 42 + .../typed/certificates/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 19 + .../coordination/v1/coordination_client.go | 89 + .../kubernetes/typed/coordination/v1/doc.go | 20 + .../coordination/v1/generated_expansion.go | 21 + .../kubernetes/typed/coordination/v1/lease.go | 208 + .../v1beta1/coordination_client.go | 89 + .../typed/coordination/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 21 + .../typed/coordination/v1beta1/lease.go | 208 + .../typed/core/v1/componentstatus.go | 197 + .../kubernetes/typed/core/v1/configmap.go | 208 + .../kubernetes/typed/core/v1/core_client.go | 164 + .../client-go/kubernetes/typed/core/v1/doc.go | 20 + .../kubernetes/typed/core/v1/endpoints.go | 208 + .../kubernetes/typed/core/v1/event.go | 208 + .../typed/core/v1/event_expansion.go | 165 + .../typed/core/v1/generated_expansion.go | 41 + .../kubernetes/typed/core/v1/limitrange.go | 208 + .../kubernetes/typed/core/v1/namespace.go | 227 + .../typed/core/v1/namespace_expansion.go | 37 + .../kubernetes/typed/core/v1/node.go | 243 + .../typed/core/v1/node_expansion.go | 45 + .../typed/core/v1/persistentvolume.go | 243 + .../typed/core/v1/persistentvolumeclaim.go | 256 + .../client-go/kubernetes/typed/core/v1/pod.go | 273 + .../kubernetes/typed/core/v1/pod_expansion.go | 85 + .../kubernetes/typed/core/v1/podtemplate.go | 208 + .../typed/core/v1/replicationcontroller.go | 289 + .../kubernetes/typed/core/v1/resourcequota.go | 256 + .../kubernetes/typed/core/v1/secret.go | 208 + .../kubernetes/typed/core/v1/service.go | 239 + .../typed/core/v1/service_expansion.go | 41 + .../typed/core/v1/serviceaccount.go | 226 + .../typed/discovery/v1/discovery_client.go | 89 + .../kubernetes/typed/discovery/v1/doc.go | 20 + .../typed/discovery/v1/endpointslice.go | 208 + .../typed/discovery/v1/generated_expansion.go | 21 + .../discovery/v1beta1/discovery_client.go | 89 + .../kubernetes/typed/discovery/v1beta1/doc.go | 20 + .../typed/discovery/v1beta1/endpointslice.go | 208 + .../discovery/v1beta1/generated_expansion.go | 21 + .../kubernetes/typed/events/v1/doc.go | 20 + .../kubernetes/typed/events/v1/event.go | 208 + .../typed/events/v1/events_client.go | 89 + .../typed/events/v1/generated_expansion.go | 21 + .../kubernetes/typed/events/v1beta1/doc.go | 20 + .../kubernetes/typed/events/v1beta1/event.go | 208 + .../typed/events/v1beta1/event_expansion.go | 99 + .../typed/events/v1beta1/events_client.go | 89 + .../events/v1beta1/generated_expansion.go | 19 + .../typed/extensions/v1beta1/daemonset.go | 256 + .../typed/extensions/v1beta1/deployment.go | 314 + .../v1beta1/deployment_expansion.go | 35 + .../typed/extensions/v1beta1/doc.go | 20 + .../extensions/v1beta1/extensions_client.go | 114 + .../extensions/v1beta1/generated_expansion.go | 29 + .../typed/extensions/v1beta1/ingress.go | 256 + .../typed/extensions/v1beta1/networkpolicy.go | 208 + .../extensions/v1beta1/podsecuritypolicy.go | 197 + .../typed/extensions/v1beta1/replicaset.go | 314 + .../typed/flowcontrol/v1alpha1/doc.go | 20 + .../v1alpha1/flowcontrol_client.go | 94 + .../typed/flowcontrol/v1alpha1/flowschema.go | 243 + .../v1alpha1/generated_expansion.go | 23 + .../v1alpha1/prioritylevelconfiguration.go | 243 + .../typed/flowcontrol/v1beta1/doc.go | 20 + .../flowcontrol/v1beta1/flowcontrol_client.go | 94 + .../typed/flowcontrol/v1beta1/flowschema.go | 243 + .../v1beta1/generated_expansion.go | 23 + .../v1beta1/prioritylevelconfiguration.go | 243 + .../kubernetes/typed/networking/v1/doc.go | 20 + .../networking/v1/generated_expansion.go | 25 + .../kubernetes/typed/networking/v1/ingress.go | 256 + .../typed/networking/v1/ingressclass.go | 197 + .../typed/networking/v1/networking_client.go | 99 + .../typed/networking/v1/networkpolicy.go | 208 + .../typed/networking/v1beta1/doc.go | 20 + .../networking/v1beta1/generated_expansion.go | 23 + .../typed/networking/v1beta1/ingress.go | 256 + .../typed/networking/v1beta1/ingressclass.go | 197 + .../networking/v1beta1/networking_client.go | 94 + .../client-go/kubernetes/typed/node/v1/doc.go | 20 + .../typed/node/v1/generated_expansion.go | 21 + .../kubernetes/typed/node/v1/node_client.go | 89 + .../kubernetes/typed/node/v1/runtimeclass.go | 197 + .../kubernetes/typed/node/v1alpha1/doc.go | 20 + .../node/v1alpha1/generated_expansion.go | 21 + .../typed/node/v1alpha1/node_client.go | 89 + .../typed/node/v1alpha1/runtimeclass.go | 197 + .../kubernetes/typed/node/v1beta1/doc.go | 20 + .../typed/node/v1beta1/generated_expansion.go | 21 + .../typed/node/v1beta1/node_client.go | 89 + .../typed/node/v1beta1/runtimeclass.go | 197 + .../kubernetes/typed/policy/v1/doc.go | 20 + .../kubernetes/typed/policy/v1/eviction.go | 48 + .../typed/policy/v1/eviction_expansion.go | 40 + .../typed/policy/v1/generated_expansion.go | 21 + .../typed/policy/v1/poddisruptionbudget.go | 256 + .../typed/policy/v1/policy_client.go | 94 + .../kubernetes/typed/policy/v1beta1/doc.go | 20 + .../typed/policy/v1beta1/eviction.go | 48 + .../policy/v1beta1/eviction_expansion.go | 40 + .../policy/v1beta1/generated_expansion.go | 23 + .../policy/v1beta1/poddisruptionbudget.go | 256 + .../typed/policy/v1beta1/podsecuritypolicy.go | 197 + .../typed/policy/v1beta1/policy_client.go | 99 + .../kubernetes/typed/rbac/v1/clusterrole.go | 197 + .../typed/rbac/v1/clusterrolebinding.go | 197 + .../client-go/kubernetes/typed/rbac/v1/doc.go | 20 + .../typed/rbac/v1/generated_expansion.go | 27 + .../kubernetes/typed/rbac/v1/rbac_client.go | 104 + .../kubernetes/typed/rbac/v1/role.go | 208 + .../kubernetes/typed/rbac/v1/rolebinding.go | 208 + .../typed/rbac/v1alpha1/clusterrole.go | 197 + .../typed/rbac/v1alpha1/clusterrolebinding.go | 197 + .../kubernetes/typed/rbac/v1alpha1/doc.go | 20 + .../rbac/v1alpha1/generated_expansion.go | 27 + .../typed/rbac/v1alpha1/rbac_client.go | 104 + .../kubernetes/typed/rbac/v1alpha1/role.go | 208 + .../typed/rbac/v1alpha1/rolebinding.go | 208 + .../typed/rbac/v1beta1/clusterrole.go | 197 + .../typed/rbac/v1beta1/clusterrolebinding.go | 197 + .../kubernetes/typed/rbac/v1beta1/doc.go | 20 + .../typed/rbac/v1beta1/generated_expansion.go | 27 + .../typed/rbac/v1beta1/rbac_client.go | 104 + .../kubernetes/typed/rbac/v1beta1/role.go | 208 + .../typed/rbac/v1beta1/rolebinding.go | 208 + .../kubernetes/typed/scheduling/v1/doc.go | 20 + .../scheduling/v1/generated_expansion.go | 21 + .../typed/scheduling/v1/priorityclass.go | 197 + .../typed/scheduling/v1/scheduling_client.go | 89 + .../typed/scheduling/v1alpha1/doc.go | 20 + .../v1alpha1/generated_expansion.go | 21 + .../scheduling/v1alpha1/priorityclass.go | 197 + .../scheduling/v1alpha1/scheduling_client.go | 89 + .../typed/scheduling/v1beta1/doc.go | 20 + .../scheduling/v1beta1/generated_expansion.go | 21 + .../typed/scheduling/v1beta1/priorityclass.go | 197 + .../scheduling/v1beta1/scheduling_client.go | 89 + .../kubernetes/typed/storage/v1/csidriver.go | 197 + .../kubernetes/typed/storage/v1/csinode.go | 197 + .../kubernetes/typed/storage/v1/doc.go | 20 + .../typed/storage/v1/generated_expansion.go | 27 + .../typed/storage/v1/storage_client.go | 104 + .../typed/storage/v1/storageclass.go | 197 + .../typed/storage/v1/volumeattachment.go | 243 + .../storage/v1alpha1/csistoragecapacity.go | 208 + .../kubernetes/typed/storage/v1alpha1/doc.go | 20 + .../storage/v1alpha1/generated_expansion.go | 23 + .../typed/storage/v1alpha1/storage_client.go | 94 + .../storage/v1alpha1/volumeattachment.go | 243 + .../typed/storage/v1beta1/csidriver.go | 197 + .../typed/storage/v1beta1/csinode.go | 197 + .../storage/v1beta1/csistoragecapacity.go | 208 + .../kubernetes/typed/storage/v1beta1/doc.go | 20 + .../storage/v1beta1/generated_expansion.go | 29 + .../typed/storage/v1beta1/storage_client.go | 109 + .../typed/storage/v1beta1/storageclass.go | 197 + .../typed/storage/v1beta1/volumeattachment.go | 243 + .../k8s.io/client-go/metadata/interface.go | 49 + .../k8s.io/client-go/metadata/metadata.go | 307 + .../pkg/apis/clientauthentication/OWNERS | 9 + .../pkg/apis/clientauthentication/doc.go | 20 + .../clientauthentication/install/install.go | 36 + .../pkg/apis/clientauthentication/register.go | 50 + .../pkg/apis/clientauthentication/types.go | 138 + .../clientauthentication/v1/conversion.go | 28 + .../pkg/apis/clientauthentication/v1/doc.go | 24 + .../apis/clientauthentication/v1/register.go | 55 + .../pkg/apis/clientauthentication/v1/types.go | 122 + .../v1/zz_generated.conversion.go | 200 + .../v1/zz_generated.deepcopy.go | 119 + .../v1/zz_generated.defaults.go | 32 + .../v1alpha1/conversion.go | 27 + .../apis/clientauthentication/v1alpha1/doc.go | 24 + .../clientauthentication/v1alpha1/register.go | 55 + .../clientauthentication/v1alpha1/types.go | 78 + .../v1alpha1/zz_generated.conversion.go | 172 + .../v1alpha1/zz_generated.deepcopy.go | 128 + .../v1alpha1/zz_generated.defaults.go | 32 + .../v1beta1/conversion.go | 28 + .../apis/clientauthentication/v1beta1/doc.go | 24 + .../clientauthentication/v1beta1/register.go | 55 + .../clientauthentication/v1beta1/types.go | 122 + .../v1beta1/zz_generated.conversion.go | 200 + .../v1beta1/zz_generated.deepcopy.go | 119 + .../v1beta1/zz_generated.defaults.go | 32 + .../zz_generated.deepcopy.go | 157 + .../client-go/pkg/version/.gitattributes | 1 + .../k8s.io/client-go/pkg/version/base.go | 63 + .../k8s.io/client-go/pkg/version/doc.go | 21 + .../k8s.io/client-go/pkg/version/version.go | 42 + .../plugin/pkg/client/auth/exec/exec.go | 538 + .../plugin/pkg/client/auth/exec/metrics.go | 111 + .../vendor/k8s.io/client-go/rest/OWNERS | 22 + .../vendor/k8s.io/client-go/rest/client.go | 201 + .../vendor/k8s.io/client-go/rest/config.go | 645 + .../vendor/k8s.io/client-go/rest/exec.go | 85 + .../vendor/k8s.io/client-go/rest/plugin.go | 83 + .../vendor/k8s.io/client-go/rest/request.go | 1433 + .../vendor/k8s.io/client-go/rest/transport.go | 130 + .../vendor/k8s.io/client-go/rest/url_utils.go | 97 + .../k8s.io/client-go/rest/urlbackoff.go | 107 + .../vendor/k8s.io/client-go/rest/warnings.go | 147 + .../k8s.io/client-go/rest/watch/decoder.go | 72 + .../k8s.io/client-go/rest/watch/encoder.go | 56 + .../k8s.io/client-go/rest/with_retry.go | 232 + .../client-go/rest/zz_generated.deepcopy.go | 57 + .../restmapper/category_expansion.go | 119 + .../k8s.io/client-go/restmapper/discovery.go | 338 + .../k8s.io/client-go/restmapper/shortcut.go | 172 + .../vendor/k8s.io/client-go/tools/auth/OWNERS | 9 + .../k8s.io/client-go/tools/auth/clientauth.go | 126 + .../k8s.io/client-go/tools/cache/OWNERS | 38 + .../client-go/tools/cache/controller.go | 420 + .../client-go/tools/cache/delta_fifo.go | 742 + .../k8s.io/client-go/tools/cache/doc.go | 24 + .../client-go/tools/cache/expiration_cache.go | 215 + .../tools/cache/expiration_cache_fakes.go | 57 + .../tools/cache/fake_custom_store.go | 102 + .../k8s.io/client-go/tools/cache/fifo.go | 373 + .../k8s.io/client-go/tools/cache/heap.go | 322 + .../k8s.io/client-go/tools/cache/index.go | 101 + .../k8s.io/client-go/tools/cache/listers.go | 183 + .../k8s.io/client-go/tools/cache/listwatch.go | 112 + .../client-go/tools/cache/mutation_cache.go | 262 + .../tools/cache/mutation_detector.go | 166 + .../k8s.io/client-go/tools/cache/reflector.go | 615 + .../tools/cache/reflector_metrics.go | 89 + .../client-go/tools/cache/shared_informer.go | 814 + .../k8s.io/client-go/tools/cache/store.go | 271 + .../tools/cache/thread_safe_store.go | 324 + .../client-go/tools/cache/undelta_store.go | 89 + .../client-go/tools/clientcmd/api/doc.go | 19 + .../client-go/tools/clientcmd/api/helpers.go | 191 + .../tools/clientcmd/api/latest/latest.go | 61 + .../client-go/tools/clientcmd/api/register.go | 46 + .../client-go/tools/clientcmd/api/types.go | 367 + .../tools/clientcmd/api/v1/conversion.go | 174 + .../tools/clientcmd/api/v1/defaults.go | 37 + .../client-go/tools/clientcmd/api/v1/doc.go | 21 + .../tools/clientcmd/api/v1/register.go | 56 + .../client-go/tools/clientcmd/api/v1/types.go | 263 + .../api/v1/zz_generated.conversion.go | 453 + .../clientcmd/api/v1/zz_generated.deepcopy.go | 348 + .../clientcmd/api/v1/zz_generated.defaults.go | 42 + .../clientcmd/api/zz_generated.deepcopy.go | 327 + .../client-go/tools/clientcmd/auth_loaders.go | 111 + .../tools/clientcmd/client_config.go | 635 + .../client-go/tools/clientcmd/config.go | 500 + .../k8s.io/client-go/tools/clientcmd/doc.go | 37 + .../k8s.io/client-go/tools/clientcmd/flag.go | 49 + .../client-go/tools/clientcmd/helpers.go | 50 + .../client-go/tools/clientcmd/loader.go | 646 + .../tools/clientcmd/merged_client_builder.go | 172 + .../client-go/tools/clientcmd/overrides.go | 251 + .../client-go/tools/clientcmd/validation.go | 360 + .../client-go/tools/leaderelection/OWNERS | 12 + .../tools/leaderelection/healthzadaptor.go | 69 + .../tools/leaderelection/leaderelection.go | 418 + .../client-go/tools/leaderelection/metrics.go | 109 + .../resourcelock/configmaplock.go | 122 + .../resourcelock/endpointslock.go | 117 + .../leaderelection/resourcelock/interface.go | 161 + .../leaderelection/resourcelock/leaselock.go | 135 + .../leaderelection/resourcelock/multilock.go | 104 + .../k8s.io/client-go/tools/metrics/OWNERS | 6 + .../k8s.io/client-go/tools/metrics/metrics.go | 125 + .../k8s.io/client-go/tools/pager/pager.go | 247 + .../k8s.io/client-go/tools/record/OWNERS | 6 + .../k8s.io/client-go/tools/record/doc.go | 19 + .../k8s.io/client-go/tools/record/event.go | 383 + .../client-go/tools/record/events_cache.go | 511 + .../k8s.io/client-go/tools/record/fake.go | 66 + .../client-go/tools/record/util/util.go | 40 + .../k8s.io/client-go/tools/reference/ref.go | 109 + .../vendor/k8s.io/client-go/transport/OWNERS | 9 + .../k8s.io/client-go/transport/cache.go | 158 + .../client-go/transport/cert_rotation.go | 176 + .../k8s.io/client-go/transport/config.go | 145 + .../client-go/transport/round_trippers.go | 580 + .../client-go/transport/token_source.go | 196 + .../k8s.io/client-go/transport/transport.go | 331 + .../vendor/k8s.io/client-go/util/cert/OWNERS | 9 + .../vendor/k8s.io/client-go/util/cert/cert.go | 207 + .../vendor/k8s.io/client-go/util/cert/csr.go | 75 + .../vendor/k8s.io/client-go/util/cert/io.go | 113 + .../vendor/k8s.io/client-go/util/cert/pem.go | 73 + .../client-go/util/cert/server_inspection.go | 102 + .../util/connrotation/connrotation.go | 133 + .../client-go/util/flowcontrol/backoff.go | 149 + .../client-go/util/flowcontrol/throttle.go | 159 + .../k8s.io/client-go/util/homedir/homedir.go | 92 + .../k8s.io/client-go/util/keyutil/OWNERS | 7 + .../k8s.io/client-go/util/keyutil/key.go | 323 + .../util/workqueue/default_rate_limiters.go | 211 + .../util/workqueue/delaying_queue.go | 280 + .../k8s.io/client-go/util/workqueue/doc.go | 26 + .../client-go/util/workqueue/metrics.go | 261 + .../client-go/util/workqueue/parallelizer.go | 101 + .../k8s.io/client-go/util/workqueue/queue.go | 218 + .../util/workqueue/rate_limiting_queue.go | 69 + .../vendor/k8s.io/component-base/LICENSE | 202 + .../k8s.io/component-base/config/OWNERS | 14 + .../k8s.io/component-base/config/doc.go | 19 + .../k8s.io/component-base/config/types.go | 91 + .../config/v1alpha1/conversion.go | 61 + .../config/v1alpha1/defaults.go | 113 + .../component-base/config/v1alpha1/doc.go | 20 + .../config/v1alpha1/register.go | 31 + .../component-base/config/v1alpha1/types.go | 93 + .../v1alpha1/zz_generated.conversion.go | 154 + .../config/v1alpha1/zz_generated.deepcopy.go | 103 + .../config/zz_generated.deepcopy.go | 88 + .../vendor/k8s.io/klog/v2/.gitignore | 17 + .../vendor/k8s.io/klog/v2/CONTRIBUTING.md | 22 + .../vendor/k8s.io/klog/v2/LICENSE | 191 + integration-test/vendor/k8s.io/klog/v2/OWNERS | 19 + .../vendor/k8s.io/klog/v2/README.md | 103 + .../vendor/k8s.io/klog/v2/RELEASE.md | 9 + .../vendor/k8s.io/klog/v2/SECURITY.md | 22 + .../vendor/k8s.io/klog/v2/SECURITY_CONTACTS | 20 + .../vendor/k8s.io/klog/v2/code-of-conduct.md | 3 + .../vendor/k8s.io/klog/v2/klog.go | 1605 + .../vendor/k8s.io/klog/v2/klog_file.go | 164 + .../vendor/k8s.io/kube-openapi/LICENSE | 202 + .../k8s.io/kube-openapi/pkg/util/proto/OWNERS | 2 + .../k8s.io/kube-openapi/pkg/util/proto/doc.go | 19 + .../kube-openapi/pkg/util/proto/document.go | 362 + .../kube-openapi/pkg/util/proto/openapi.go | 285 + integration-test/vendor/k8s.io/utils/LICENSE | 202 + .../k8s.io/utils/buffer/ring_growing.go | 72 + .../vendor/k8s.io/utils/integer/integer.go | 73 + .../vendor/k8s.io/utils/pointer/OWNERS | 10 + .../vendor/k8s.io/utils/pointer/README.md | 3 + .../vendor/k8s.io/utils/pointer/pointer.go | 245 + .../vendor/k8s.io/utils/trace/README.md | 67 + .../vendor/k8s.io/utils/trace/trace.go | 282 + integration-test/vendor/modules.txt | 661 + .../sigs.k8s.io/controller-runtime/LICENSE | 201 + .../controller-runtime/pkg/cache/cache.go | 231 + .../controller-runtime/pkg/cache/doc.go | 19 + .../pkg/cache/informer_cache.go | 217 + .../pkg/cache/internal/cache_reader.go | 218 + .../pkg/cache/internal/deleg_map.go | 125 + .../pkg/cache/internal/disabledeepcopy.go | 35 + .../pkg/cache/internal/informers_map.go | 478 + .../pkg/cache/internal/selector.go | 43 + .../pkg/cache/multi_namespace_cache.go | 331 + .../pkg/certwatcher/certwatcher.go | 163 + .../controller-runtime/pkg/certwatcher/doc.go | 23 + .../pkg/client/apiutil/apimachinery.go | 196 + .../pkg/client/apiutil/dynamicrestmapper.go | 285 + .../controller-runtime/pkg/client/client.go | 328 + .../pkg/client/client_cache.go | 150 + .../controller-runtime/pkg/client/codec.go | 40 + .../controller-runtime/pkg/client/doc.go | 49 + .../controller-runtime/pkg/client/dryrun.go | 106 + .../pkg/client/interfaces.go | 145 + .../pkg/client/metadata_client.go | 195 + .../pkg/client/namespaced_client.go | 213 + .../controller-runtime/pkg/client/object.go | 77 + .../controller-runtime/pkg/client/options.go | 697 + .../controller-runtime/pkg/client/patch.go | 213 + .../controller-runtime/pkg/client/split.go | 141 + .../pkg/client/typed_client.go | 205 + .../pkg/client/unstructured_client.go | 277 + .../controller-runtime/pkg/client/watch.go | 118 + .../controller-runtime/pkg/cluster/cluster.go | 270 + .../pkg/cluster/internal.go | 128 + .../controller-runtime/pkg/config/config.go | 112 + .../controller-runtime/pkg/config/doc.go | 25 + .../pkg/config/v1alpha1/doc.go | 20 + .../pkg/config/v1alpha1/register.go | 37 + .../pkg/config/v1alpha1/types.go | 157 + .../config/v1alpha1/zz_generated.deepcopy.go | 152 + .../pkg/controller/controller.go | 141 + .../controllerutil/controllerutil.go | 389 + .../pkg/controller/controllerutil/doc.go | 20 + .../controller-runtime/pkg/controller/doc.go | 25 + .../controller-runtime/pkg/event/doc.go | 28 + .../controller-runtime/pkg/event/event.go | 55 + .../controller-runtime/pkg/handler/doc.go | 38 + .../controller-runtime/pkg/handler/enqueue.go | 90 + .../pkg/handler/enqueue_mapped.go | 97 + .../pkg/handler/enqueue_owner.go | 189 + .../pkg/handler/eventhandler.go | 104 + .../controller-runtime/pkg/healthz/doc.go | 32 + .../controller-runtime/pkg/healthz/healthz.go | 206 + .../pkg/internal/controller/controller.go | 351 + .../internal/controller/metrics/metrics.go | 78 + .../pkg/internal/log/log.go | 32 + .../pkg/internal/objectutil/objectutil.go | 78 + .../pkg/internal/recorder/recorder.go | 176 + .../pkg/leaderelection/doc.go | 24 + .../pkg/leaderelection/leader_election.go | 126 + .../controller-runtime/pkg/log/deleg.go | 216 + .../controller-runtime/pkg/log/log.go | 99 + .../controller-runtime/pkg/log/null.go | 60 + .../pkg/log/warning_handler.go | 76 + .../controller-runtime/pkg/manager/doc.go | 21 + .../pkg/manager/internal.go | 709 + .../controller-runtime/pkg/manager/manager.go | 579 + .../pkg/metrics/client_go_adapter.go | 231 + .../controller-runtime/pkg/metrics/doc.go | 20 + .../pkg/metrics/listener.go | 52 + .../pkg/metrics/registry.go | 30 + .../pkg/metrics/workqueue.go | 130 + .../controller-runtime/pkg/predicate/doc.go | 20 + .../pkg/predicate/predicate.go | 333 + .../controller-runtime/pkg/ratelimiter/doc.go | 22 + .../pkg/ratelimiter/ratelimiter.go | 30 + .../controller-runtime/pkg/reconcile/doc.go | 21 + .../pkg/reconcile/reconcile.go | 102 + .../pkg/recorder/recorder.go | 31 + .../pkg/runtime/inject/doc.go | 22 + .../pkg/runtime/inject/inject.go | 164 + .../controller-runtime/pkg/scheme/scheme.go | 94 + .../controller-runtime/pkg/source/doc.go | 22 + .../pkg/source/internal/eventsource.go | 138 + .../controller-runtime/pkg/source/source.go | 366 + .../pkg/webhook/admission/decode.go | 72 + .../pkg/webhook/admission/defaulter.go | 74 + .../pkg/webhook/admission/defaulter_custom.go | 85 + .../pkg/webhook/admission/doc.go | 28 + .../pkg/webhook/admission/http.go | 146 + .../pkg/webhook/admission/inject.go | 31 + .../pkg/webhook/admission/multi.go | 147 + .../pkg/webhook/admission/response.go | 121 + .../pkg/webhook/admission/validator.go | 122 + .../pkg/webhook/admission/validator_custom.go | 111 + .../pkg/webhook/admission/webhook.go | 255 + .../controller-runtime/pkg/webhook/alias.go | 79 + .../controller-runtime/pkg/webhook/doc.go | 28 + .../pkg/webhook/internal/metrics/metrics.go | 85 + .../controller-runtime/pkg/webhook/server.go | 339 + .../structured-merge-diff/v4/LICENSE | 201 + .../structured-merge-diff/v4/fieldpath/doc.go | 21 + .../v4/fieldpath/element.go | 317 + .../v4/fieldpath/fromvalue.go | 134 + .../v4/fieldpath/managers.go | 144 + .../v4/fieldpath/path.go | 118 + .../v4/fieldpath/pathelementmap.go | 85 + .../v4/fieldpath/serialize-pe.go | 168 + .../v4/fieldpath/serialize.go | 238 + .../structured-merge-diff/v4/fieldpath/set.go | 505 + .../structured-merge-diff/v4/schema/doc.go | 28 + .../v4/schema/elements.go | 261 + .../structured-merge-diff/v4/schema/equals.go | 199 + .../v4/schema/schemaschema.go | 161 + .../structured-merge-diff/v4/typed/doc.go | 18 + .../structured-merge-diff/v4/typed/helpers.go | 256 + .../structured-merge-diff/v4/typed/merge.go | 353 + .../structured-merge-diff/v4/typed/parser.go | 151 + .../v4/typed/reconcile_schema.go | 290 + .../structured-merge-diff/v4/typed/remove.go | 165 + .../v4/typed/tofieldset.go | 168 + .../structured-merge-diff/v4/typed/typed.go | 321 + .../structured-merge-diff/v4/typed/union.go | 276 + .../v4/typed/validate.go | 195 + .../v4/value/allocator.go | 203 + .../structured-merge-diff/v4/value/doc.go | 21 + .../structured-merge-diff/v4/value/fields.go | 97 + .../v4/value/jsontagutil.go | 91 + .../structured-merge-diff/v4/value/list.go | 139 + .../v4/value/listreflect.go | 98 + .../v4/value/listunstructured.go | 74 + .../structured-merge-diff/v4/value/map.go | 270 + .../v4/value/mapreflect.go | 209 + .../v4/value/mapunstructured.go | 190 + .../v4/value/reflectcache.go | 467 + .../structured-merge-diff/v4/value/scalar.go | 50 + .../v4/value/structreflect.go | 208 + .../structured-merge-diff/v4/value/value.go | 347 + .../v4/value/valuereflect.go | 294 + .../v4/value/valueunstructured.go | 178 + .../vendor/sigs.k8s.io/yaml/.gitignore | 20 + .../vendor/sigs.k8s.io/yaml/.travis.yml | 13 + .../vendor/sigs.k8s.io/yaml/CONTRIBUTING.md | 31 + .../vendor/sigs.k8s.io/yaml/LICENSE | 50 + .../vendor/sigs.k8s.io/yaml/OWNERS | 27 + .../vendor/sigs.k8s.io/yaml/README.md | 123 + .../vendor/sigs.k8s.io/yaml/RELEASE.md | 9 + .../vendor/sigs.k8s.io/yaml/SECURITY_CONTACTS | 17 + .../sigs.k8s.io/yaml/code-of-conduct.md | 3 + .../vendor/sigs.k8s.io/yaml/fields.go | 502 + .../vendor/sigs.k8s.io/yaml/yaml.go | 380 + .../vendor/sigs.k8s.io/yaml/yaml_go110.go | 14 + pkg/utils/utils.go | 5 + test/utils/controller.go | 8 +- test/utils/envtest/environment.go | 10 +- test/utils/envtest/state.go | 30 +- test/utils/envtest/types.go | 5 +- 3610 files changed, 1089845 insertions(+), 29 deletions(-) create mode 100755 hack/integration-test.py create mode 100644 hack/utils.py create mode 100644 integration-test/go.mod create mode 100644 integration-test/go.sum create mode 100644 integration-test/pkg/main.go create mode 100644 integration-test/pkg/test/test_config.go create mode 100644 integration-test/pkg/test/test_runner.go create mode 100644 integration-test/pkg/tests/test_create_deployment.go create mode 100644 integration-test/pkg/tests/test_delete_deployment.go create mode 100644 integration-test/pkg/tests/test_install_laas.go create mode 100644 integration-test/pkg/tests/test_uninstall_laas.go create mode 100644 integration-test/pkg/tests/test_update_deployment.go create mode 100644 integration-test/pkg/tests/test_verify_delete.go create mode 100644 integration-test/pkg/tests/test_verify_deployment.go create mode 100644 integration-test/pkg/util/util.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/.gitignore create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/CODEOWNERS create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/LICENSE create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/README.md create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/backup.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/ea.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/file.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/fileinfo.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/hvsock.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/pipe.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/privilege.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/reparse.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/sd.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/syscall.go create mode 100644 integration-test/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go create mode 100644 integration-test/vendor/github.com/Microsoft/hcsshim/LICENSE create mode 100644 integration-test/vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go create mode 100644 integration-test/vendor/github.com/Microsoft/hcsshim/osversion/windowsbuilds.go create mode 100644 integration-test/vendor/github.com/beorn7/perks/LICENSE create mode 100644 integration-test/vendor/github.com/beorn7/perks/quantile/exampledata.txt create mode 100644 integration-test/vendor/github.com/beorn7/perks/quantile/stream.go create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/.travis.yml create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/LICENSE.txt create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/README.md create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/xxhash.go create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_other.go create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go create mode 100644 integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/LICENSE create mode 100644 integration-test/vendor/github.com/containerd/containerd/NOTICE create mode 100644 integration-test/vendor/github.com/containerd/containerd/archive/compression/compression.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/content/adaptor.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/content/content.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/content/helpers.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/errdefs/errors.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/errdefs/grpc.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/filters/adaptor.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/filters/filter.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/filters/parser.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/filters/quote.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/filters/scanner.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/images/annotations.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/images/diffid.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/images/handlers.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/images/image.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/images/importexport.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/images/mediatypes.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/labels/labels.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/labels/validate.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/log/context.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/platforms/compare.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/platforms/cpuinfo.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/platforms/database.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/platforms/defaults.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/platforms/defaults_unix.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/platforms/defaults_windows.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/platforms/platforms.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/reference/docker/reference.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/reference/reference.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/auth/fetch.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/auth/parse.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/authorizer.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/converter.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/errcode.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/errdesc.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/fetcher.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/handler.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/httpreadseeker.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/pusher.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/registry.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/resolver.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/scope.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/docker/status.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/errors/errors.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/handlers.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/remotes/resolver.go create mode 100644 integration-test/vendor/github.com/containerd/containerd/version/version.go create mode 100644 integration-test/vendor/github.com/containerd/continuity/AUTHORS create mode 100644 integration-test/vendor/github.com/containerd/continuity/LICENSE create mode 100644 integration-test/vendor/github.com/containerd/continuity/pathdriver/path_driver.go create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/LICENSE create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/spew/bypass.go create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/spew/common.go create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/spew/config.go create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/spew/doc.go create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/spew/dump.go create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/spew/format.go create mode 100644 integration-test/vendor/github.com/davecgh/go-spew/spew/spew.go create mode 100644 integration-test/vendor/github.com/docker/cli/AUTHORS create mode 100644 integration-test/vendor/github.com/docker/cli/LICENSE create mode 100644 integration-test/vendor/github.com/docker/cli/NOTICE create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/config.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/configfile/file.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/configfile/file_windows.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/credentials/credentials.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_darwin.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_linux.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_windows.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/credentials/file_store.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/credentials/native_store.go create mode 100644 integration-test/vendor/github.com/docker/cli/cli/config/types/authconfig.go create mode 100644 integration-test/vendor/github.com/docker/distribution/LICENSE create mode 100644 integration-test/vendor/github.com/docker/distribution/registry/client/auth/challenge/addr.go create mode 100644 integration-test/vendor/github.com/docker/distribution/registry/client/auth/challenge/authchallenge.go create mode 100644 integration-test/vendor/github.com/docker/docker-credential-helpers/LICENSE create mode 100644 integration-test/vendor/github.com/docker/docker-credential-helpers/client/client.go create mode 100644 integration-test/vendor/github.com/docker/docker-credential-helpers/client/command.go create mode 100644 integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/credentials.go create mode 100644 integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/error.go create mode 100644 integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/helper.go create mode 100644 integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/version.go create mode 100644 integration-test/vendor/github.com/docker/docker/AUTHORS create mode 100644 integration-test/vendor/github.com/docker/docker/LICENSE create mode 100644 integration-test/vendor/github.com/docker/docker/NOTICE create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/idtools/utils_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/flags.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/flags_freebsd.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/flags_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/flags_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mount.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_freebsd.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/sharedsubtree_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/unmount_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/mount/unmount_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/args_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/chtimes.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/chtimes_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/chtimes_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/errors.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/exitcode.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/filesys.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/filesys_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/init.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/init_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/init_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/lcow.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/lcow_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/lcow_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/lstat_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/lstat_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/meminfo.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/mknod.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/mknod_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/path.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/path_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/path_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/process_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/process_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/rm.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/stat_darwin.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/stat_freebsd.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/stat_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/stat_solaris.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/stat_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/stat_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/syscall_unix.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/syscall_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/umask.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/umask_windows.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/utimes_freebsd.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/utimes_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/xattrs_linux.go create mode 100644 integration-test/vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go create mode 100644 integration-test/vendor/github.com/docker/go-units/CONTRIBUTING.md create mode 100644 integration-test/vendor/github.com/docker/go-units/LICENSE create mode 100644 integration-test/vendor/github.com/docker/go-units/MAINTAINERS create mode 100644 integration-test/vendor/github.com/docker/go-units/README.md create mode 100644 integration-test/vendor/github.com/docker/go-units/circle.yml create mode 100644 integration-test/vendor/github.com/docker/go-units/duration.go create mode 100644 integration-test/vendor/github.com/docker/go-units/size.go create mode 100644 integration-test/vendor/github.com/docker/go-units/ulimit.go create mode 100644 integration-test/vendor/github.com/evanphx/json-patch/LICENSE create mode 100644 integration-test/vendor/github.com/evanphx/json-patch/README.md create mode 100644 integration-test/vendor/github.com/evanphx/json-patch/errors.go create mode 100644 integration-test/vendor/github.com/evanphx/json-patch/merge.go create mode 100644 integration-test/vendor/github.com/evanphx/json-patch/patch.go create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/.editorconfig create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/.gitattributes create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/.gitignore create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/.travis.yml create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/AUTHORS create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/LICENSE create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/README.md create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/fen.go create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/fsnotify.go create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/inotify.go create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/inotify_poller.go create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/kqueue.go create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go create mode 100644 integration-test/vendor/github.com/fsnotify/fsnotify/windows.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/cache.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/filesystem.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/inmemory.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/types.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/client.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/constants.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/copy.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/builder.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/keyring.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/secretserver/README.md create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/secretserver/secret_server.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/doc.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/manifest_v1_conversion.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/metrics/metrics.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/oci/artifact.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/oci/ref.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/options/options.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/types.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/ociclient/utils.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/pkg/commands/constants/constants.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/pkg/logcontext/log.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/pkg/utils/ctf.go create mode 100644 integration-test/vendor/github.com/gardener/component-cli/pkg/utils/utils.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/metadata.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/accesstypes.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/codecs.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/componentdescriptor.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/default.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/helper.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme/bindata.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme/jsonscheme.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/list.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/repositorytypes.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/resources.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/unstructured.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/validation/validate_list.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/validation/validation.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/zz_generated_deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/codec/codec.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/componentarchive.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/ctf.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/listresolver.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/constants.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/manifest.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/resolve.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/types.go create mode 100644 integration-test/vendor/github.com/gardener/component-spec/bindings-go/utils/selector/selector.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_instance.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_landscaperdeployment.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_servicetargetconfig.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/types_shared.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/constants.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/conversion.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_instance.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_landscaperdeployment.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_servicetargetconfig.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_shared.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.conversion.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper-service/pkg/utils/utils.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/LICENSE create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/install/install.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/types_agent_config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/types_landscaper_config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/types_agent_config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/types_landscaper_config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.conversion.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/config/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/install/install.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_blueprint.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_component_overwrite.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_context.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_dataobject.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_deployer_registration.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_deployitem.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_environment.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_execution.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_installation.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_installationtemplate.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_shared.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/types_target.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/constants.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/conversion.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_blueprint.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_component_overwrite.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_context.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_dataobject.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_deployer_registration.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_deployitem.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_environment.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_execution.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_installation.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_installationtemplate.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_shared.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_target.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.conversion.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/core/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/constants.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/types_config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/types_provider.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/types_config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/types_provider.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.conversion.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/types_config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/types_provider.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/register.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/types_config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/types_provider.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.conversion.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.defaults.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/types.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/types.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/types_healthchecks.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/mediatype/constants.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/mediatype/mediatype.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/apis/schema/schema.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/controller-utils/LICENSE create mode 100644 integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/kubernetes/docs.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/kubernetes/kubernetes.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/config.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/helper.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/logger.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/api/types.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/jsonschema/reference.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/jsonschema/validate.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/blueprint.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils/uri.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils/utils.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/doc.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/local.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/manager.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/oci.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/utils/builders.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/utils/context_aware_writer.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/utils/controllerconfig.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/utils/cyclicdependencies.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/utils/miscellaneous.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/utils/ociconfig.go create mode 100644 integration-test/vendor/github.com/gardener/landscaper/pkg/utils/tar/tar.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/LICENSE create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/create.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/force_delete.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/collector.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/printer.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/transformer.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/tree.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/installations.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/set_import_parameters.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/install.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/oci_registry.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/quickstart.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/uninstall.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/config.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/helper.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/logger.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/util/cmd.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/util/const.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/util/file.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/util/k8sclient.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/util/paths.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/util/util.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/util/yaml.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/version/version.go create mode 100644 integration-test/vendor/github.com/gardener/landscapercli/pkg/version/version_info.go create mode 100644 integration-test/vendor/github.com/ghodss/yaml/.gitignore create mode 100644 integration-test/vendor/github.com/ghodss/yaml/.travis.yml create mode 100644 integration-test/vendor/github.com/ghodss/yaml/LICENSE create mode 100644 integration-test/vendor/github.com/ghodss/yaml/README.md create mode 100644 integration-test/vendor/github.com/ghodss/yaml/fields.go create mode 100644 integration-test/vendor/github.com/ghodss/yaml/yaml.go create mode 100644 integration-test/vendor/github.com/go-logr/logr/LICENSE create mode 100644 integration-test/vendor/github.com/go-logr/logr/README.md create mode 100644 integration-test/vendor/github.com/go-logr/logr/discard.go create mode 100644 integration-test/vendor/github.com/go-logr/logr/logr.go create mode 100644 integration-test/vendor/github.com/go-logr/zapr/.gitignore create mode 100644 integration-test/vendor/github.com/go-logr/zapr/Gopkg.lock create mode 100644 integration-test/vendor/github.com/go-logr/zapr/Gopkg.toml create mode 100644 integration-test/vendor/github.com/go-logr/zapr/LICENSE create mode 100644 integration-test/vendor/github.com/go-logr/zapr/README.md create mode 100644 integration-test/vendor/github.com/go-logr/zapr/zapr.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/AUTHORS create mode 100644 integration-test/vendor/github.com/gogo/protobuf/CONTRIBUTORS create mode 100644 integration-test/vendor/github.com/gogo/protobuf/LICENSE create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/Makefile create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/clone.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/custom_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/decode.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/deprecated.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/discard.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/duration.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/duration_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/encode.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/encode_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/equal.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/extensions.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/lib.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/lib_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/message_set.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/properties.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/properties_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/skip_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/table_marshal.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/table_merge.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/text.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/text_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/text_parser.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/timestamp.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/wrappers.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go create mode 100644 integration-test/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go create mode 100644 integration-test/vendor/github.com/golang/groupcache/LICENSE create mode 100644 integration-test/vendor/github.com/golang/groupcache/lru/lru.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/AUTHORS create mode 100644 integration-test/vendor/github.com/golang/protobuf/CONTRIBUTORS create mode 100644 integration-test/vendor/github.com/golang/protobuf/LICENSE create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/buffer.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/defaults.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/deprecated.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/discard.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/extensions.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/properties.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/proto.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/registry.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/text_decode.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/text_encode.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/wire.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/proto/wrappers.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/ptypes/any.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/ptypes/doc.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/ptypes/duration.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/ptypes/timestamp.go create mode 100644 integration-test/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/LICENSE create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/compare.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/export_panic.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/export_unsafe.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/function/func.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/name.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/options.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/path.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/report.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/report_compare.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/report_references.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/report_reflect.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/report_slices.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/report_text.go create mode 100644 integration-test/vendor/github.com/google/go-cmp/cmp/report_value.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/LICENSE create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/internal/redact/redact.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/internal/retry/retry.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/internal/retry/wait/kubernetes_apimachinery_wait.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/README.md create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/anon.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/auth.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/authn.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/basic.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/bearer.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/doc.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/keychain.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/multikeychain.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/logs/logs.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/README.md create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/check.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/digest.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/doc.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/errors.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/options.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/ref.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/registry.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/repository.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/name/tag.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/README.md create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/basic.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/bearer.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/doc.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/error.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/logger.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/ping.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/retry.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/schemer.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/scope.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/transport.go create mode 100644 integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/useragent.go create mode 100644 integration-test/vendor/github.com/google/gofuzz/.travis.yml create mode 100644 integration-test/vendor/github.com/google/gofuzz/CONTRIBUTING.md create mode 100644 integration-test/vendor/github.com/google/gofuzz/LICENSE create mode 100644 integration-test/vendor/github.com/google/gofuzz/README.md create mode 100644 integration-test/vendor/github.com/google/gofuzz/doc.go create mode 100644 integration-test/vendor/github.com/google/gofuzz/fuzz.go create mode 100644 integration-test/vendor/github.com/google/uuid/.travis.yml create mode 100644 integration-test/vendor/github.com/google/uuid/CONTRIBUTING.md create mode 100644 integration-test/vendor/github.com/google/uuid/CONTRIBUTORS create mode 100644 integration-test/vendor/github.com/google/uuid/LICENSE create mode 100644 integration-test/vendor/github.com/google/uuid/README.md create mode 100644 integration-test/vendor/github.com/google/uuid/dce.go create mode 100644 integration-test/vendor/github.com/google/uuid/doc.go create mode 100644 integration-test/vendor/github.com/google/uuid/hash.go create mode 100644 integration-test/vendor/github.com/google/uuid/marshal.go create mode 100644 integration-test/vendor/github.com/google/uuid/node.go create mode 100644 integration-test/vendor/github.com/google/uuid/node_js.go create mode 100644 integration-test/vendor/github.com/google/uuid/node_net.go create mode 100644 integration-test/vendor/github.com/google/uuid/null.go create mode 100644 integration-test/vendor/github.com/google/uuid/sql.go create mode 100644 integration-test/vendor/github.com/google/uuid/time.go create mode 100644 integration-test/vendor/github.com/google/uuid/util.go create mode 100644 integration-test/vendor/github.com/google/uuid/uuid.go create mode 100644 integration-test/vendor/github.com/google/uuid/version1.go create mode 100644 integration-test/vendor/github.com/google/uuid/version4.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/LICENSE create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/compiler/README.md create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/compiler/context.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/compiler/error.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/compiler/extensions.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/compiler/helpers.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/compiler/main.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/compiler/reader.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/extensions/README.md create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/extensions/extension.pb.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/extensions/extension.proto create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/extensions/extensions.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/jsonschema/README.md create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/jsonschema/base.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/jsonschema/display.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/jsonschema/models.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/jsonschema/operations.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/jsonschema/reader.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/jsonschema/schema.json create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/jsonschema/writer.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.pb.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.proto create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/openapiv2/README.md create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/openapiv2/document.go create mode 100644 integration-test/vendor/github.com/googleapis/gnostic/openapiv2/openapi-2.0.json create mode 100644 integration-test/vendor/github.com/imdario/mergo/.deepsource.toml create mode 100644 integration-test/vendor/github.com/imdario/mergo/.gitignore create mode 100644 integration-test/vendor/github.com/imdario/mergo/.travis.yml create mode 100644 integration-test/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md create mode 100644 integration-test/vendor/github.com/imdario/mergo/LICENSE create mode 100644 integration-test/vendor/github.com/imdario/mergo/README.md create mode 100644 integration-test/vendor/github.com/imdario/mergo/doc.go create mode 100644 integration-test/vendor/github.com/imdario/mergo/map.go create mode 100644 integration-test/vendor/github.com/imdario/mergo/merge.go create mode 100644 integration-test/vendor/github.com/imdario/mergo/mergo.go create mode 100644 integration-test/vendor/github.com/inconshreveable/mousetrap/LICENSE create mode 100644 integration-test/vendor/github.com/inconshreveable/mousetrap/README.md create mode 100644 integration-test/vendor/github.com/inconshreveable/mousetrap/trap_others.go create mode 100644 integration-test/vendor/github.com/inconshreveable/mousetrap/trap_windows.go create mode 100644 integration-test/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/.codecov.yml create mode 100644 integration-test/vendor/github.com/json-iterator/go/.gitignore create mode 100644 integration-test/vendor/github.com/json-iterator/go/.travis.yml create mode 100644 integration-test/vendor/github.com/json-iterator/go/Gopkg.lock create mode 100644 integration-test/vendor/github.com/json-iterator/go/Gopkg.toml create mode 100644 integration-test/vendor/github.com/json-iterator/go/LICENSE create mode 100644 integration-test/vendor/github.com/json-iterator/go/README.md create mode 100644 integration-test/vendor/github.com/json-iterator/go/adapter.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_array.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_bool.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_float.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_int32.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_int64.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_invalid.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_nil.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_number.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_object.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_str.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_uint32.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/any_uint64.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/build.sh create mode 100644 integration-test/vendor/github.com/json-iterator/go/config.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter_array.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter_float.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter_int.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter_object.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter_skip.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter_skip_sloppy.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter_skip_strict.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/iter_str.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/jsoniter.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/pool.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_array.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_dynamic.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_extension.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_json_number.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_json_raw_message.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_map.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_marshaler.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_native.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_optional.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_slice.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_struct_decoder.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/reflect_struct_encoder.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/stream.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/stream_float.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/stream_int.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/stream_str.go create mode 100644 integration-test/vendor/github.com/json-iterator/go/test.sh create mode 100644 integration-test/vendor/github.com/klauspost/compress/.gitattributes create mode 100644 integration-test/vendor/github.com/klauspost/compress/.gitignore create mode 100644 integration-test/vendor/github.com/klauspost/compress/.goreleaser.yml create mode 100644 integration-test/vendor/github.com/klauspost/compress/LICENSE create mode 100644 integration-test/vendor/github.com/klauspost/compress/README.md create mode 100644 integration-test/vendor/github.com/klauspost/compress/compressible.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/fse/README.md create mode 100644 integration-test/vendor/github.com/klauspost/compress/fse/bitreader.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/fse/bitwriter.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/fse/bytereader.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/fse/compress.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/fse/decompress.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/fse/fse.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/gen.sh create mode 100644 integration-test/vendor/github.com/klauspost/compress/huff0/.gitignore create mode 100644 integration-test/vendor/github.com/klauspost/compress/huff0/README.md create mode 100644 integration-test/vendor/github.com/klauspost/compress/huff0/bitreader.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/huff0/bitwriter.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/huff0/bytereader.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/huff0/compress.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/huff0/decompress.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/huff0/huff0.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/internal/snapref/LICENSE create mode 100644 integration-test/vendor/github.com/klauspost/compress/internal/snapref/decode.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/internal/snapref/decode_other.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/internal/snapref/encode.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/internal/snapref/encode_other.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/internal/snapref/snappy.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/s2sx.mod create mode 100644 integration-test/vendor/github.com/klauspost/compress/s2sx.sum create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/README.md create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/bitreader.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/bitwriter.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/blockdec.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/blockenc.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/blocktype_string.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/bytebuf.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/bytereader.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/decodeheader.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/decoder.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/decoder_options.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/dict.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/enc_base.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/enc_best.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/enc_better.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/enc_dfast.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/enc_fast.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/encoder.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/encoder_options.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/framedec.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/frameenc.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/fse_decoder.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/fse_encoder.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/fse_predefined.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/hash.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/history.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/seqdec.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/seqenc.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/snappy.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/zip.go create mode 100644 integration-test/vendor/github.com/klauspost/compress/zstd/zstd.go create mode 100644 integration-test/vendor/github.com/mandelsoft/filepath/LICENSE create mode 100644 integration-test/vendor/github.com/mandelsoft/filepath/pkg/filepath/eval.go create mode 100644 integration-test/vendor/github.com/mandelsoft/filepath/pkg/filepath/orig.go create mode 100644 integration-test/vendor/github.com/mandelsoft/filepath/pkg/filepath/path.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/LICENSE create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/memoryfs/dir.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/memoryfs/doc.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/memoryfs/filedata.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/memoryfs/memory.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/osfs/doc.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/osfs/osfs.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/osfs/osfs_unix.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/osfs/osfs_windows.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/osfs/tempfs.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/projectionfs/doc.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/projectionfs/projectionfs.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/utils/base.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/utils/eval.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/utils/file.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/utils/fileInfo.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/utils/fssupport.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/utils/mappedfs.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/utils/sorter.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/utils/utils.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/errors.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/errors_unix.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/errors_windows.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/eval.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/interface.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/tempfile.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/utils.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/vfs.go create mode 100644 integration-test/vendor/github.com/mandelsoft/vfs/pkg/vfs/walk.go create mode 100644 integration-test/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE create mode 100644 integration-test/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE create mode 100644 integration-test/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore create mode 100644 integration-test/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile create mode 100644 integration-test/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go create mode 100644 integration-test/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go create mode 100644 integration-test/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go create mode 100644 integration-test/vendor/github.com/moby/locker/LICENSE create mode 100644 integration-test/vendor/github.com/moby/locker/README.md create mode 100644 integration-test/vendor/github.com/moby/locker/locker.go create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/.gitignore create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/.travis.yml create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/LICENSE create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/README.md create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/executor.go create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/go_above_19.go create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/go_below_19.go create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/log.go create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/test.sh create mode 100644 integration-test/vendor/github.com/modern-go/concurrent/unbounded_executor.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/.gitignore create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/.travis.yml create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/Gopkg.lock create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/Gopkg.toml create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/LICENSE create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/README.md create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/go_above_17.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/go_above_19.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/go_below_17.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/go_below_19.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/reflect2.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/reflect2_amd64.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/reflect2_kind.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/relfect2_386.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/relfect2_amd64p32.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/relfect2_arm.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/relfect2_arm64.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/relfect2_mips64x.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/relfect2_mipsx.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/relfect2_ppc64x.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/relfect2_s390x.s create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/safe_field.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/safe_map.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/safe_slice.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/safe_struct.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/safe_type.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/test.sh create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/type_map.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_array.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_eface.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_field.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_iface.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_link.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_map.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_ptr.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_slice.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_struct.go create mode 100644 integration-test/vendor/github.com/modern-go/reflect2/unsafe_type.go create mode 100644 integration-test/vendor/github.com/opencontainers/distribution-spec/LICENSE create mode 100644 integration-test/vendor/github.com/opencontainers/distribution-spec/specs-go/v1/error.go create mode 100644 integration-test/vendor/github.com/opencontainers/distribution-spec/specs-go/v1/repository.go create mode 100644 integration-test/vendor/github.com/opencontainers/distribution-spec/specs-go/v1/tags.go create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/.mailmap create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/.pullapprove.yml create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/.travis.yml create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/CONTRIBUTING.md create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/LICENSE create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/LICENSE.docs create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/MAINTAINERS create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/README.md create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/algorithm.go create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/digest.go create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/digester.go create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/doc.go create mode 100644 integration-test/vendor/github.com/opencontainers/go-digest/verifiers.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/LICENSE create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/v1/config.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/v1/layout.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/version.go create mode 100644 integration-test/vendor/github.com/opencontainers/image-spec/specs-go/versioned.go create mode 100644 integration-test/vendor/github.com/opencontainers/runc/LICENSE create mode 100644 integration-test/vendor/github.com/opencontainers/runc/NOTICE create mode 100644 integration-test/vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go create mode 100644 integration-test/vendor/github.com/opencontainers/runc/libcontainer/user/user.go create mode 100644 integration-test/vendor/github.com/opencontainers/runc/libcontainer/user/user_fuzzer.go create mode 100644 integration-test/vendor/github.com/pkg/errors/.gitignore create mode 100644 integration-test/vendor/github.com/pkg/errors/.travis.yml create mode 100644 integration-test/vendor/github.com/pkg/errors/LICENSE create mode 100644 integration-test/vendor/github.com/pkg/errors/Makefile create mode 100644 integration-test/vendor/github.com/pkg/errors/README.md create mode 100644 integration-test/vendor/github.com/pkg/errors/appveyor.yml create mode 100644 integration-test/vendor/github.com/pkg/errors/errors.go create mode 100644 integration-test/vendor/github.com/pkg/errors/go113.go create mode 100644 integration-test/vendor/github.com/pkg/errors/stack.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/LICENSE create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/NOTICE create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/.gitignore create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/README.md create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/collector.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/collectors/collectors.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/collectors/dbstats_collector.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/collectors/dbstats_collector_go115.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/collectors/dbstats_collector_pre_go115.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/collectors/expvar_collector.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/collectors/go_collector.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/collectors/process_collector.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/counter.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/desc.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/doc.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/fnv.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/gauge.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/histogram.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/labels.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/metric.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/observer.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/registry.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/summary.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/timer.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/untyped.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/value.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/vec.go create mode 100644 integration-test/vendor/github.com/prometheus/client_golang/prometheus/wrap.go create mode 100644 integration-test/vendor/github.com/prometheus/client_model/LICENSE create mode 100644 integration-test/vendor/github.com/prometheus/client_model/NOTICE create mode 100644 integration-test/vendor/github.com/prometheus/client_model/go/metrics.pb.go create mode 100644 integration-test/vendor/github.com/prometheus/common/LICENSE create mode 100644 integration-test/vendor/github.com/prometheus/common/NOTICE create mode 100644 integration-test/vendor/github.com/prometheus/common/expfmt/decode.go create mode 100644 integration-test/vendor/github.com/prometheus/common/expfmt/encode.go create mode 100644 integration-test/vendor/github.com/prometheus/common/expfmt/expfmt.go create mode 100644 integration-test/vendor/github.com/prometheus/common/expfmt/fuzz.go create mode 100644 integration-test/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go create mode 100644 integration-test/vendor/github.com/prometheus/common/expfmt/text_create.go create mode 100644 integration-test/vendor/github.com/prometheus/common/expfmt/text_parse.go create mode 100644 integration-test/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt create mode 100644 integration-test/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/alert.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/fingerprinting.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/fnv.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/labels.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/labelset.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/metric.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/model.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/signature.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/silence.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/time.go create mode 100644 integration-test/vendor/github.com/prometheus/common/model/value.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/.gitignore create mode 100644 integration-test/vendor/github.com/prometheus/procfs/.golangci.yml create mode 100644 integration-test/vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md create mode 100644 integration-test/vendor/github.com/prometheus/procfs/CONTRIBUTING.md create mode 100644 integration-test/vendor/github.com/prometheus/procfs/LICENSE create mode 100644 integration-test/vendor/github.com/prometheus/procfs/MAINTAINERS.md create mode 100644 integration-test/vendor/github.com/prometheus/procfs/Makefile create mode 100644 integration-test/vendor/github.com/prometheus/procfs/Makefile.common create mode 100644 integration-test/vendor/github.com/prometheus/procfs/NOTICE create mode 100644 integration-test/vendor/github.com/prometheus/procfs/README.md create mode 100644 integration-test/vendor/github.com/prometheus/procfs/SECURITY.md create mode 100644 integration-test/vendor/github.com/prometheus/procfs/arp.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/buddyinfo.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/cpuinfo.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/cpuinfo_armx.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/cpuinfo_others.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/cpuinfo_x86.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/crypto.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/doc.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/fixtures.ttar create mode 100644 integration-test/vendor/github.com/prometheus/procfs/fs.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/fscache.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/internal/fs/fs.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/internal/util/parse.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/internal/util/readfile.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/internal/util/valueparser.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/ipvs.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/kernel_random.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/loadavg.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/mdstat.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/meminfo.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/mountinfo.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/mountstats.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_conntrackstat.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_dev.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_ip_socket.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_protocols.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_sockstat.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_softnet.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_tcp.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_udp.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/net_unix.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_cgroup.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_environ.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_fdinfo.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_io.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_limits.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_maps.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_ns.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_psi.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_smaps.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_stat.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/proc_status.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/schedstat.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/slab.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/stat.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/swaps.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/ttar create mode 100644 integration-test/vendor/github.com/prometheus/procfs/vm.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/xfrm.go create mode 100644 integration-test/vendor/github.com/prometheus/procfs/zoneinfo.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/.gitignore create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/.golangci.yml create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/.travis.yml create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/CHANGELOG.md create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/LICENSE create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/README.md create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/alt_exit.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/appveyor.yml create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/buffer_pool.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/doc.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/entry.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/exported.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/formatter.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/hooks.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/json_formatter.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/logger.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/logrus.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/terminal_check_js.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/terminal_check_solaris.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/terminal_check_unix.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/terminal_check_windows.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/text_formatter.go create mode 100644 integration-test/vendor/github.com/sirupsen/logrus/writer.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/.gitignore create mode 100644 integration-test/vendor/github.com/spf13/cobra/.golangci.yml create mode 100644 integration-test/vendor/github.com/spf13/cobra/.mailmap create mode 100644 integration-test/vendor/github.com/spf13/cobra/CHANGELOG.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/CONDUCT.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/CONTRIBUTING.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/LICENSE.txt create mode 100644 integration-test/vendor/github.com/spf13/cobra/Makefile create mode 100644 integration-test/vendor/github.com/spf13/cobra/README.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/args.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/bash_completions.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/bash_completions.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/bash_completionsV2.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/cobra.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/command.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/command_notwin.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/command_win.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/completions.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/fish_completions.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/fish_completions.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/powershell_completions.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/powershell_completions.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/projects_using_cobra.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/shell_completions.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/shell_completions.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/user_guide.md create mode 100644 integration-test/vendor/github.com/spf13/cobra/zsh_completions.go create mode 100644 integration-test/vendor/github.com/spf13/cobra/zsh_completions.md create mode 100644 integration-test/vendor/github.com/spf13/pflag/.gitignore create mode 100644 integration-test/vendor/github.com/spf13/pflag/.travis.yml create mode 100644 integration-test/vendor/github.com/spf13/pflag/LICENSE create mode 100644 integration-test/vendor/github.com/spf13/pflag/README.md create mode 100644 integration-test/vendor/github.com/spf13/pflag/bool.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/bool_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/bytes.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/count.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/duration.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/duration_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/flag.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/float32.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/float32_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/float64.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/float64_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/golangflag.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/int.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/int16.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/int32.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/int32_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/int64.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/int64_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/int8.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/int_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/ip.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/ip_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/ipmask.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/ipnet.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/string.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/string_array.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/string_slice.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/string_to_int.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/string_to_int64.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/string_to_string.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/uint.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/uint16.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/uint32.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/uint64.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/uint8.go create mode 100644 integration-test/vendor/github.com/spf13/pflag/uint_slice.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonpointer/LICENSE-APACHE-2.0.txt create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonpointer/README.md create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonpointer/pointer.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonreference/LICENSE-APACHE-2.0.txt create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonreference/README.md create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonreference/reference.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/.gitignore create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/.travis.yml create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/LICENSE-APACHE-2.0.txt create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/README.md create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/draft.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/errors.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/format_checkers.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/glide.yaml create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/internalLog.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/jsonContext.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/jsonLoader.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/locales.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/result.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/schema.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/schemaLoader.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/schemaPool.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/schemaReferencePool.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/schemaType.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/subSchema.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/types.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/utils.go create mode 100644 integration-test/vendor/github.com/xeipuuv/gojsonschema/validation.go create mode 100644 integration-test/vendor/go.uber.org/atomic/.codecov.yml create mode 100644 integration-test/vendor/go.uber.org/atomic/.gitignore create mode 100644 integration-test/vendor/go.uber.org/atomic/.travis.yml create mode 100644 integration-test/vendor/go.uber.org/atomic/CHANGELOG.md create mode 100644 integration-test/vendor/go.uber.org/atomic/LICENSE.txt create mode 100644 integration-test/vendor/go.uber.org/atomic/Makefile create mode 100644 integration-test/vendor/go.uber.org/atomic/README.md create mode 100644 integration-test/vendor/go.uber.org/atomic/bool.go create mode 100644 integration-test/vendor/go.uber.org/atomic/bool_ext.go create mode 100644 integration-test/vendor/go.uber.org/atomic/doc.go create mode 100644 integration-test/vendor/go.uber.org/atomic/duration.go create mode 100644 integration-test/vendor/go.uber.org/atomic/duration_ext.go create mode 100644 integration-test/vendor/go.uber.org/atomic/error.go create mode 100644 integration-test/vendor/go.uber.org/atomic/error_ext.go create mode 100644 integration-test/vendor/go.uber.org/atomic/float64.go create mode 100644 integration-test/vendor/go.uber.org/atomic/float64_ext.go create mode 100644 integration-test/vendor/go.uber.org/atomic/gen.go create mode 100644 integration-test/vendor/go.uber.org/atomic/int32.go create mode 100644 integration-test/vendor/go.uber.org/atomic/int64.go create mode 100644 integration-test/vendor/go.uber.org/atomic/nocmp.go create mode 100644 integration-test/vendor/go.uber.org/atomic/string.go create mode 100644 integration-test/vendor/go.uber.org/atomic/string_ext.go create mode 100644 integration-test/vendor/go.uber.org/atomic/uint32.go create mode 100644 integration-test/vendor/go.uber.org/atomic/uint64.go create mode 100644 integration-test/vendor/go.uber.org/atomic/value.go create mode 100644 integration-test/vendor/go.uber.org/multierr/.codecov.yml create mode 100644 integration-test/vendor/go.uber.org/multierr/.gitignore create mode 100644 integration-test/vendor/go.uber.org/multierr/.travis.yml create mode 100644 integration-test/vendor/go.uber.org/multierr/CHANGELOG.md create mode 100644 integration-test/vendor/go.uber.org/multierr/LICENSE.txt create mode 100644 integration-test/vendor/go.uber.org/multierr/Makefile create mode 100644 integration-test/vendor/go.uber.org/multierr/README.md create mode 100644 integration-test/vendor/go.uber.org/multierr/error.go create mode 100644 integration-test/vendor/go.uber.org/multierr/glide.yaml create mode 100644 integration-test/vendor/go.uber.org/multierr/go113.go create mode 100644 integration-test/vendor/go.uber.org/zap/.codecov.yml create mode 100644 integration-test/vendor/go.uber.org/zap/.gitignore create mode 100644 integration-test/vendor/go.uber.org/zap/.readme.tmpl create mode 100644 integration-test/vendor/go.uber.org/zap/CHANGELOG.md create mode 100644 integration-test/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md create mode 100644 integration-test/vendor/go.uber.org/zap/CONTRIBUTING.md create mode 100644 integration-test/vendor/go.uber.org/zap/FAQ.md create mode 100644 integration-test/vendor/go.uber.org/zap/LICENSE.txt create mode 100644 integration-test/vendor/go.uber.org/zap/Makefile create mode 100644 integration-test/vendor/go.uber.org/zap/README.md create mode 100644 integration-test/vendor/go.uber.org/zap/array.go create mode 100644 integration-test/vendor/go.uber.org/zap/buffer/buffer.go create mode 100644 integration-test/vendor/go.uber.org/zap/buffer/pool.go create mode 100644 integration-test/vendor/go.uber.org/zap/checklicense.sh create mode 100644 integration-test/vendor/go.uber.org/zap/config.go create mode 100644 integration-test/vendor/go.uber.org/zap/doc.go create mode 100644 integration-test/vendor/go.uber.org/zap/encoder.go create mode 100644 integration-test/vendor/go.uber.org/zap/error.go create mode 100644 integration-test/vendor/go.uber.org/zap/field.go create mode 100644 integration-test/vendor/go.uber.org/zap/flag.go create mode 100644 integration-test/vendor/go.uber.org/zap/glide.yaml create mode 100644 integration-test/vendor/go.uber.org/zap/global.go create mode 100644 integration-test/vendor/go.uber.org/zap/global_go112.go create mode 100644 integration-test/vendor/go.uber.org/zap/global_prego112.go create mode 100644 integration-test/vendor/go.uber.org/zap/http_handler.go create mode 100644 integration-test/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go create mode 100644 integration-test/vendor/go.uber.org/zap/internal/color/color.go create mode 100644 integration-test/vendor/go.uber.org/zap/internal/exit/exit.go create mode 100644 integration-test/vendor/go.uber.org/zap/level.go create mode 100644 integration-test/vendor/go.uber.org/zap/logger.go create mode 100644 integration-test/vendor/go.uber.org/zap/options.go create mode 100644 integration-test/vendor/go.uber.org/zap/sink.go create mode 100644 integration-test/vendor/go.uber.org/zap/stacktrace.go create mode 100644 integration-test/vendor/go.uber.org/zap/sugar.go create mode 100644 integration-test/vendor/go.uber.org/zap/time.go create mode 100644 integration-test/vendor/go.uber.org/zap/writer.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/buffered_write_syncer.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/clock.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/console_encoder.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/core.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/doc.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/encoder.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/entry.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/error.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/field.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/hook.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/increase_level.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/json_encoder.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/level.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/level_strings.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/marshaler.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/memory_encoder.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/sampler.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/tee.go create mode 100644 integration-test/vendor/go.uber.org/zap/zapcore/write_syncer.go create mode 100644 integration-test/vendor/golang.org/x/net/AUTHORS create mode 100644 integration-test/vendor/golang.org/x/net/CONTRIBUTORS create mode 100644 integration-test/vendor/golang.org/x/net/LICENSE create mode 100644 integration-test/vendor/golang.org/x/net/PATENTS create mode 100644 integration-test/vendor/golang.org/x/net/context/context.go create mode 100644 integration-test/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go create mode 100644 integration-test/vendor/golang.org/x/net/context/go17.go create mode 100644 integration-test/vendor/golang.org/x/net/context/go19.go create mode 100644 integration-test/vendor/golang.org/x/net/context/pre_go17.go create mode 100644 integration-test/vendor/golang.org/x/net/context/pre_go19.go create mode 100644 integration-test/vendor/golang.org/x/net/http/httpguts/guts.go create mode 100644 integration-test/vendor/golang.org/x/net/http/httpguts/httplex.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/.gitignore create mode 100644 integration-test/vendor/golang.org/x/net/http2/Dockerfile create mode 100644 integration-test/vendor/golang.org/x/net/http2/Makefile create mode 100644 integration-test/vendor/golang.org/x/net/http2/ascii.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/ciphers.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/client_conn_pool.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/databuffer.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/errors.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/flow.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/frame.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/go111.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/go115.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/gotrack.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/headermap.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/hpack/encode.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/hpack/hpack.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/hpack/huffman.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/hpack/tables.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/http2.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/not_go111.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/not_go115.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/pipe.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/server.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/transport.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/write.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/writesched.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/writesched_priority.go create mode 100644 integration-test/vendor/golang.org/x/net/http2/writesched_random.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/idna10.0.0.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/idna9.0.0.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/punycode.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/tables10.0.0.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/tables11.0.0.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/tables12.0.0.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/tables13.0.0.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/tables9.0.0.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/trie.go create mode 100644 integration-test/vendor/golang.org/x/net/idna/trieval.go create mode 100644 integration-test/vendor/golang.org/x/oauth2/.travis.yml create mode 100644 integration-test/vendor/golang.org/x/oauth2/AUTHORS create mode 100644 integration-test/vendor/golang.org/x/oauth2/CONTRIBUTING.md create mode 100644 integration-test/vendor/golang.org/x/oauth2/CONTRIBUTORS create mode 100644 integration-test/vendor/golang.org/x/oauth2/LICENSE create mode 100644 integration-test/vendor/golang.org/x/oauth2/README.md create mode 100644 integration-test/vendor/golang.org/x/oauth2/internal/client_appengine.go create mode 100644 integration-test/vendor/golang.org/x/oauth2/internal/doc.go create mode 100644 integration-test/vendor/golang.org/x/oauth2/internal/oauth2.go create mode 100644 integration-test/vendor/golang.org/x/oauth2/internal/token.go create mode 100644 integration-test/vendor/golang.org/x/oauth2/internal/transport.go create mode 100644 integration-test/vendor/golang.org/x/oauth2/oauth2.go create mode 100644 integration-test/vendor/golang.org/x/oauth2/token.go create mode 100644 integration-test/vendor/golang.org/x/oauth2/transport.go create mode 100644 integration-test/vendor/golang.org/x/sync/AUTHORS create mode 100644 integration-test/vendor/golang.org/x/sync/CONTRIBUTORS create mode 100644 integration-test/vendor/golang.org/x/sync/LICENSE create mode 100644 integration-test/vendor/golang.org/x/sync/PATENTS create mode 100644 integration-test/vendor/golang.org/x/sync/errgroup/errgroup.go create mode 100644 integration-test/vendor/golang.org/x/sync/semaphore/semaphore.go create mode 100644 integration-test/vendor/golang.org/x/sys/AUTHORS create mode 100644 integration-test/vendor/golang.org/x/sys/CONTRIBUTORS create mode 100644 integration-test/vendor/golang.org/x/sys/LICENSE create mode 100644 integration-test/vendor/golang.org/x/sys/PATENTS create mode 100644 integration-test/vendor/golang.org/x/sys/execabs/execabs.go create mode 100644 integration-test/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/asm.s create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/asm_plan9_386.s create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/asm_plan9_arm.s create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/const_plan9.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/dir_plan9.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/env_plan9.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/errors_plan9.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/mkall.sh create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/mkerrors.sh create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/pwd_plan9.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/race.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/race0.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/str.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/syscall.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/syscall_plan9.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/plan9/zsysnum_plan9.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/.gitignore create mode 100644 integration-test/vendor/golang.org/x/sys/unix/README.md create mode 100644 integration-test/vendor/golang.org/x/sys/unix/affinity_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/aliases.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_bsd_386.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_bsd_arm.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_386.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_amd64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_arm.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_arm64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_linux_s390x.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/asm_zos_s390x.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/bluetooth_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/cap_freebsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/constants.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_aix_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_darwin.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_dragonfly.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_freebsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_netbsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_openbsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dev_zos.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/dirent.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/endian_big.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/endian_little.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/env_unix.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/epoll_zos.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/errors_freebsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/errors_freebsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/fcntl.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/fcntl_darwin.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/fdset.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/fstatfs_zos.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/gccgo.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/gccgo_c.c create mode 100644 integration-test/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ifreq_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ioctl.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ioctl_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ioctl_zos.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/mkall.sh create mode 100644 integration-test/vendor/golang.org/x/sys/unix/mkerrors.sh create mode 100644 integration-test/vendor/golang.org/x/sys/unix/pagesize_unix.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/pledge_openbsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ptrace_darwin.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ptrace_ios.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/race.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/race0.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/readdirent_getdents.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/sockcmsg_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/sockcmsg_unix.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/str.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_aix.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_bsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_darwin.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_dragonfly.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_freebsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_illumos.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_gc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_netbsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_openbsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_solaris.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_unix.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_unix_gc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/sysvshm_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/sysvshm_unix.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/timestruct.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/unveil_openbsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/xattr_bsd.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/aliases.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/dll_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/empty.s create mode 100644 integration-test/vendor/golang.org/x/sys/windows/env_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/eventlog.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/exec_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/memory_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/mkerrors.bash create mode 100644 integration-test/vendor/golang.org/x/sys/windows/mkknownfolderids.bash create mode 100644 integration-test/vendor/golang.org/x/sys/windows/mksyscall.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/race.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/race0.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/security_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/service.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/setupapierrors_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/str.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/syscall.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/syscall_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/types_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/types_windows_386.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/types_windows_amd64.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/types_windows_arm.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/types_windows_arm64.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/zerrors_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go create mode 100644 integration-test/vendor/golang.org/x/sys/windows/zsyscall_windows.go create mode 100644 integration-test/vendor/golang.org/x/term/AUTHORS create mode 100644 integration-test/vendor/golang.org/x/term/CONTRIBUTING.md create mode 100644 integration-test/vendor/golang.org/x/term/CONTRIBUTORS create mode 100644 integration-test/vendor/golang.org/x/term/LICENSE create mode 100644 integration-test/vendor/golang.org/x/term/PATENTS create mode 100644 integration-test/vendor/golang.org/x/term/README.md create mode 100644 integration-test/vendor/golang.org/x/term/term.go create mode 100644 integration-test/vendor/golang.org/x/term/term_plan9.go create mode 100644 integration-test/vendor/golang.org/x/term/term_solaris.go create mode 100644 integration-test/vendor/golang.org/x/term/term_unix.go create mode 100644 integration-test/vendor/golang.org/x/term/term_unix_aix.go create mode 100644 integration-test/vendor/golang.org/x/term/term_unix_bsd.go create mode 100644 integration-test/vendor/golang.org/x/term/term_unix_linux.go create mode 100644 integration-test/vendor/golang.org/x/term/term_unix_zos.go create mode 100644 integration-test/vendor/golang.org/x/term/term_unsupported.go create mode 100644 integration-test/vendor/golang.org/x/term/term_windows.go create mode 100644 integration-test/vendor/golang.org/x/term/terminal.go create mode 100644 integration-test/vendor/golang.org/x/text/AUTHORS create mode 100644 integration-test/vendor/golang.org/x/text/CONTRIBUTORS create mode 100644 integration-test/vendor/golang.org/x/text/LICENSE create mode 100644 integration-test/vendor/golang.org/x/text/PATENTS create mode 100644 integration-test/vendor/golang.org/x/text/secure/bidirule/bidirule.go create mode 100644 integration-test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/transform/transform.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/bidi.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/bracket.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/core.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/prop.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/bidi/trieval.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/composition.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/forminfo.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/input.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/iter.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/normalize.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/readwriter.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/transform.go create mode 100644 integration-test/vendor/golang.org/x/text/unicode/norm/trie.go create mode 100644 integration-test/vendor/golang.org/x/time/AUTHORS create mode 100644 integration-test/vendor/golang.org/x/time/CONTRIBUTORS create mode 100644 integration-test/vendor/golang.org/x/time/LICENSE create mode 100644 integration-test/vendor/golang.org/x/time/PATENTS create mode 100644 integration-test/vendor/golang.org/x/time/rate/rate.go create mode 100644 integration-test/vendor/gomodules.xyz/jsonpatch/v2/LICENSE create mode 100644 integration-test/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go create mode 100644 integration-test/vendor/google.golang.org/appengine/LICENSE create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/api.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/api_classic.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/api_common.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/app_id.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/base/api_base.pb.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/base/api_base.proto create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/identity.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/identity_classic.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/identity_flex.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/identity_vm.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/internal.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/log/log_service.pb.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/log/log_service.proto create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/main.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/main_common.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/main_vm.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/metadata.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/net.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/regen.sh create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/transaction.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go create mode 100644 integration-test/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto create mode 100644 integration-test/vendor/google.golang.org/appengine/urlfetch/urlfetch.go create mode 100644 integration-test/vendor/google.golang.org/genproto/LICENSE create mode 100644 integration-test/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go create mode 100644 integration-test/vendor/google.golang.org/grpc/AUTHORS create mode 100644 integration-test/vendor/google.golang.org/grpc/LICENSE create mode 100644 integration-test/vendor/google.golang.org/grpc/NOTICE.txt create mode 100644 integration-test/vendor/google.golang.org/grpc/codes/code_string.go create mode 100644 integration-test/vendor/google.golang.org/grpc/codes/codes.go create mode 100644 integration-test/vendor/google.golang.org/grpc/internal/status/status.go create mode 100644 integration-test/vendor/google.golang.org/grpc/status/status.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/AUTHORS create mode 100644 integration-test/vendor/google.golang.org/protobuf/CONTRIBUTORS create mode 100644 integration-test/vendor/google.golang.org/protobuf/LICENSE create mode 100644 integration-test/vendor/google.golang.org/protobuf/PATENTS create mode 100644 integration-test/vendor/google.golang.org/protobuf/encoding/prototext/decode.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/encoding/prototext/doc.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/encoding/prototext/encode.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/encoding/protowire/wire.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/descopts/options.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/detrand/rand.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/errors/errors.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/errors/is_go112.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/errors/is_go113.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/filedesc/build.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/filedesc/desc.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/filetype/build.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/flags/flags.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/any_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/api_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/doc.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/goname.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/map_entry.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/type_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/wrappers.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/api_export.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/checkinit.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_field.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_map.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_message.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/convert.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/convert_list.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/convert_map.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/decode.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/encode.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/enum.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/extension.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/merge.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/message.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/validate.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/impl/weak.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/order/order.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/order/range.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/pragma/pragma.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/set/ints.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/strs/strings.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/internal/version/version.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/checkinit.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/decode.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/decode_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/doc.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/encode.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/encode_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/equal.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/extension.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/merge.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/messageset.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/proto.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/proto_methods.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/proto_reflect.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/reset.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/size.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/size_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/proto/wrappers.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go create mode 100644 integration-test/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go create mode 100644 integration-test/vendor/gopkg.in/inf.v0/LICENSE create mode 100644 integration-test/vendor/gopkg.in/inf.v0/dec.go create mode 100644 integration-test/vendor/gopkg.in/inf.v0/rounder.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/.travis.yml create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/LICENSE create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/LICENSE.libyaml create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/NOTICE create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/README.md create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/apic.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/decode.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/emitterc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/encode.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/parserc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/readerc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/resolve.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/scannerc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/sorter.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/writerc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/yaml.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/yamlh.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v2/yamlprivateh.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/LICENSE create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/NOTICE create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/README.md create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/apic.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/decode.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/emitterc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/encode.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/parserc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/readerc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/resolve.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/scannerc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/sorter.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/writerc.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/yaml.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/yamlh.go create mode 100644 integration-test/vendor/gopkg.in/yaml.v3/yamlprivateh.go create mode 100644 integration-test/vendor/k8s.io/api/LICENSE create mode 100644 integration-test/vendor/k8s.io/api/admission/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/admission/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/admission/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/admission/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/apiserverinternal/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/apiserverinternal/v1alpha1/register.go create mode 100644 integration-test/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go create mode 100644 integration-test/vendor/k8s.io/api/apiserverinternal/v1alpha1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/apiserverinternal/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/apps/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta2/doc.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta2/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta2/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta2/register.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta2/types.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta2/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta2/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/apps/v1beta2/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/authentication/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/authorization/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta2/doc.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta2/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta2/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta2/register.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta2/types.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta2/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/batch/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/batch/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/batch/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/coordination/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/annotation_key_constants.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/core/v1/lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/objectreference.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/resource.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/taint.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/toleration.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/well_known_labels.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/well_known_taints.go create mode 100644 integration-test/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1/well_known_labels.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/well_known_labels.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/discovery/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/events/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/events/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/events/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/extensions/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/extensions/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/extensions/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/extensions/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/extensions/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/extensions/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/extensions/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1alpha1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1alpha1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1alpha1/register.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1alpha1/types.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1alpha1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1alpha1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/flowcontrol/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/networking/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1/well_known_annotations.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/well_known_annotations.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/networking/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/node/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1alpha1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1alpha1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/node/v1alpha1/register.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1alpha1/types.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1alpha1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/node/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/node/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/policy/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/policy/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/policy/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1alpha1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1alpha1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1alpha1/register.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1alpha1/types.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1alpha1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/rbac/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1alpha1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1alpha1/register.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1alpha1/types.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/scheduling/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/storage/v1/register.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1/types.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1alpha1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1alpha1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/storage/v1alpha1/register.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1alpha1/types.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1alpha1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1alpha1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/api/storage/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/api/storage/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/LICENSE create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/errors/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/errors.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/firsthit_restmapper.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/help.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/lazy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/meta.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/priority.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/math.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/scale_int.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme/register.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_fuzz.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_fuzz.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_proto.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/watch.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/conversion.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/conversion/converter.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/conversion/deep_equal.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/conversion/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/conversion/helper.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/fields/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/fields/fields.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/fields/requirements.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/fields/selector.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/labels/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/labels/labels.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/labels/selector.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/codec.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/conversion.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/converter.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/embedded.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/error.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/extension.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/helper.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/mapper.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/negotiate.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/register.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/schema/interfaces.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/scheme_builder.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/meta.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/negotiated_codec.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/recognizer.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/types.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/types_proto.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/selection/operator.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/types/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/types/nodename.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/types/patch.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/types/uid.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/clock/clock.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/errors/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/json/json.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/mergepatch/errors.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/naming/from_stack.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/net/http.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/net/interface.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/net/port_range.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/net/port_split.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/net/util.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/sets/byte.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/sets/empty.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/sets/int.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/sets/int32.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/sets/int64.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/sets/string.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/errors.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/types.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/uuid/uuid.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/wait/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/version/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/version/helpers.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/version/types.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/watch/doc.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/watch/filter.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/watch/mux.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/watch/watch.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/third_party/forked/golang/LICENSE create mode 100644 integration-test/vendor/k8s.io/apimachinery/third_party/forked/golang/PATENTS create mode 100644 integration-test/vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS create mode 100644 integration-test/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go create mode 100644 integration-test/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go create mode 100644 integration-test/vendor/k8s.io/client-go/LICENSE create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhook.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/servicereference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhook.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/webhookclientconfig.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhook.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/rule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/rulewithoperations.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/servicereference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhook.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/webhookclientconfig.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/serverstorageversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversioncondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversionstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/controllerrevision.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetupdatestrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentstrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicaset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatedaemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatedeployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatestatefulsetstrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetupdatestrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/controllerrevision.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentstrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollbackconfig.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollingupdatedeployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollingupdatestatefulsetstrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetupdatestrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/controllerrevision.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetupdatestrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentstrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicaset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatedaemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatedeployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatestatefulsetstrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/scale.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetupdatestrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/crossversionobjectreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scale.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scalespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scalestatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/crossversionobjectreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalercondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/crossversionobjectreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerbehavior.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalercondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingpolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingrules.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricidentifier.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metrictarget.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricvaluestatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjob.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjobspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjobstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/job.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobtemplatespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1/uncountedterminatedpods.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjob.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjobspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjobstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/jobtemplatespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequest.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequestcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequestspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequeststatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequestcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequestspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequeststatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/lease.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/coordination/v1/leasespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/lease.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/affinity.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/attachedvolume.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/awselasticblockstorevolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/azurediskvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/azurefilepersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/azurefilevolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/capabilities.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/cephfspersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/cephfsvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/cinderpersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/cindervolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/clientipconfig.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/componentcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/componentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmap.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapenvsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapkeyselector.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapnodeconfigsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapprojection.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/container.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/containerimage.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/containerport.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstate.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstaterunning.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstateterminated.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstatewaiting.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/csipersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/csivolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/daemonendpoint.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapiprojection.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumefile.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/emptydirvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointaddress.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointport.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/endpoints.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointsubset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/envfromsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/envvar.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/envvarsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainer.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainercommon.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/event.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/eventseries.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/eventsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/execaction.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/fcvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/flexpersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/flexvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/flockervolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/gcepersistentdiskvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/gitrepovolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/glusterfspersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/glusterfsvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/handler.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/hostalias.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/hostpathvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/httpgetaction.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/httpheader.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/iscsipersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/iscsivolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/keytopath.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/lifecycle.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrange.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrangeitem.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrangespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/loadbalanceringress.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/loadbalancerstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/localobjectreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/localvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/namespace.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacecondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacestatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nfsvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/node.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeaddress.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeaffinity.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodecondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeconfigsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeconfigstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodedaemonendpoints.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselector.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselectorrequirement.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselectorterm.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodestatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodesysteminfo.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/objectfieldselector.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/objectreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolume.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaim.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimtemplate.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumestatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/photonpersistentdiskvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/pod.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podaffinity.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podaffinityterm.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podantiaffinity.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/poddnsconfig.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/poddnsconfigoption.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podip.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podreadinessgate.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podsecuritycontext.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplate.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplatespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/portstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/portworxvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/preferredschedulingterm.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/probe.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/projectedvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/quobytevolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/rbdpersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/rbdvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontroller.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollercondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollerspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollerstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcefieldselector.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequota.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequotaspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequotastatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcerequirements.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/scaleiopersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/scaleiovolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/scopedresourceselectorrequirement.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/scopeselector.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/seccompprofile.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/secret.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretenvsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretkeyselector.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretprojection.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/secretvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/securitycontext.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/selinuxoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/service.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccount.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccounttokenprojection.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceport.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/servicespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/servicestatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/sessionaffinityconfig.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/storageospersistentvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/storageosvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/sysctl.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/taint.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/tcpsocketaction.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/toleration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyselectorlabelrequirement.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyselectorterm.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyspreadconstraint.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/typedlocalobjectreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/volume.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumedevice.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemount.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumenodeaffinity.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumeprojection.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/vspherevirtualdiskvolumesource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/weightedpodaffinityterm.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/core/v1/windowssecuritycontextoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpoint.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointconditions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointhints.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointport.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointslice.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1/forzone.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpoint.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointconditions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointhints.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointport.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointslice.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/forzone.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/events/v1/event.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/events/v1/eventseries.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/event.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/eventseries.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedcsidriver.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedflexvolume.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedhostpath.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetupdatestrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentstrategy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/fsgroupstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/hostportrange.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/httpingresspath.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/httpingressrulevalue.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/idrange.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingress.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressbackend.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrulevalue.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingresstls.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ipblock.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyegressrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyingressrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicypeer.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyport.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/podsecuritypolicyspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicaset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollbackconfig.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollingupdatedaemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollingupdatedeployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runasgroupstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runasuserstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runtimeclassstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/scale.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/selinuxstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/supplementalgroupsstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowdistinguishermethod.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschema.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemacondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemaspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemastatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/groupsubject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/limitedprioritylevelconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/limitresponse.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/nonresourcepolicyrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/policyruleswithsubjects.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/queuingconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/resourcepolicyrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/serviceaccountsubject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/subject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/usersubject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowdistinguishermethod.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschema.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemacondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemaspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemastatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/groupsubject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/limitedprioritylevelconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/limitresponse.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/nonresourcepolicyrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/policyruleswithsubjects.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationcondition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/queuingconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/resourcepolicyrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/serviceaccountsubject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/subject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/usersubject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/condition.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/deleteoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/labelselector.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/labelselectorrequirement.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/managedfieldsentry.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/objectmeta.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/ownerreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/preconditions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/meta/v1/typemeta.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/httpingresspath.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/httpingressrulevalue.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingress.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressbackend.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclassparametersreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclassspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrulevalue.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressservicebackend.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingresstls.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipblock.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyegressrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyingressrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicypeer.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyport.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicebackendport.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/httpingresspath.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/httpingressrulevalue.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingress.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressbackend.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclassparametersreference.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclassspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrulevalue.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingresstls.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1/overhead.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1/runtimeclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1/scheduling.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/overhead.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclassspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/scheduling.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/overhead.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/runtimeclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/scheduling.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1/eviction.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudget.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedcsidriver.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedflexvolume.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedhostpath.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/eviction.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/fsgroupstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/hostportrange.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/idrange.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudget.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/podsecuritypolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/podsecuritypolicyspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runasgroupstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runasuserstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runtimeclassstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/selinuxstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/supplementalgroupsstrategyoptions.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/aggregationrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrole.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/policyrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/role.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/rolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/roleref.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1/subject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/aggregationrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrole.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/policyrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/role.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/rolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/roleref.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/subject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/aggregationrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrole.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/policyrule.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/role.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/rolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/roleref.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/subject.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1/priorityclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/priorityclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/priorityclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriver.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinode.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodedriver.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/storageclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/tokenrequest.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeerror.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumenoderesources.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/csistoragecapacity.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeerror.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriver.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinode.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodedriver.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodespec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csistoragecapacity.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storageclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/tokenrequest.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachment.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentsource.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentspec.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeerror.go create mode 100644 integration-test/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumenoderesources.go create mode 100644 integration-test/vendor/k8s.io/client-go/discovery/discovery_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/discovery/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/discovery/helper.go create mode 100644 integration-test/vendor/k8s.io/client-go/dynamic/interface.go create mode 100644 integration-test/vendor/k8s.io/client-go/dynamic/scheme.go create mode 100644 integration-test/vendor/k8s.io/client-go/dynamic/simple.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/clientset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/import.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/scheme/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/scheme/register.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/admissionregistration_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingwebhookconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/validatingwebhookconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/admissionregistration_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/mutatingwebhookconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/validatingwebhookconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/apiserverinternal_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/storageversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/apps_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/controllerrevision.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/daemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/deployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/replicaset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1/statefulset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/apps_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/controllerrevision.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/deployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/statefulset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/apps_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/controllerrevision.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/daemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/deployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/replicaset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/statefulset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/authentication_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/tokenreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/authentication_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/tokenreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/authorization_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/localsubjectaccessreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/selfsubjectaccessreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/selfsubjectrulesreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/subjectaccessreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/authorization_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/localsubjectaccessreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/selfsubjectaccessreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/selfsubjectrulesreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/subjectaccessreview.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/autoscaling_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/horizontalpodautoscaler.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/autoscaling_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/horizontalpodautoscaler.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/autoscaling_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/batch_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/cronjob.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1/job.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/batch_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/cronjob.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificates_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificatesigningrequest.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificates_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificatesigningrequest.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificatesigningrequest_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/coordination_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/lease.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/coordination_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/lease.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/componentstatus.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/configmap.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/core_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/endpoints.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/event.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/event_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/limitrange.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/namespace.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/namespace_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/node.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/node_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/persistentvolume.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/persistentvolumeclaim.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/pod.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/pod_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/podtemplate.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/replicationcontroller.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/resourcequota.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/secret.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/service.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/service_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/core/v1/serviceaccount.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/discovery_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/endpointslice.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/discovery_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/endpointslice.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1/event.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1/events_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/event.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/event_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/events_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/daemonset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/deployment.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/deployment_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/extensions_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/ingress.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/networkpolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/podsecuritypolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/replicaset.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/flowcontrol_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/flowschema.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/prioritylevelconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/flowcontrol_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/flowschema.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/prioritylevelconfiguration.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/ingress.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/ingressclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/networking_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1/networkpolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/ingress.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/ingressclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/networking_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1/node_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1/runtimeclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/node_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/runtimeclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/node_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/runtimeclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/eviction.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/eviction_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/poddisruptionbudget.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1/policy_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/eviction.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/eviction_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/poddisruptionbudget.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/podsecuritypolicy.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/policy_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/clusterrole.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/clusterrolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/rbac_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/role.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/rolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/clusterrole.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/clusterrolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/rbac_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/role.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/rolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/priorityclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/scheduling_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/priorityclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/priorityclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csidriver.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csinode.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/storage_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/storageclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1/volumeattachment.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/csistoragecapacity.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/storage_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/volumeattachment.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csidriver.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csinode.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csistoragecapacity.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/generated_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/storage_client.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/storageclass.go create mode 100644 integration-test/vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/volumeattachment.go create mode 100644 integration-test/vendor/k8s.io/client-go/metadata/interface.go create mode 100644 integration-test/vendor/k8s.io/client-go/metadata/metadata.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/install/install.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/register.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/types.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/conversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/register.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/types.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.conversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.defaults.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/conversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/register.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/types.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/zz_generated.conversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/zz_generated.defaults.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/conversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/register.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/types.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.defaults.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/apis/clientauthentication/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/version/.gitattributes create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/version/base.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/version/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/pkg/version/version.go create mode 100644 integration-test/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go create mode 100644 integration-test/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/metrics.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/rest/client.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/config.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/exec.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/plugin.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/request.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/transport.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/url_utils.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/urlbackoff.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/warnings.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/watch/decoder.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/watch/encoder.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/with_retry.go create mode 100644 integration-test/vendor/k8s.io/client-go/rest/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/client-go/restmapper/category_expansion.go create mode 100644 integration-test/vendor/k8s.io/client-go/restmapper/discovery.go create mode 100644 integration-test/vendor/k8s.io/client-go/restmapper/shortcut.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/auth/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/tools/auth/clientauth.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/controller.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/delta_fifo.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/expiration_cache.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/expiration_cache_fakes.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/fake_custom_store.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/fifo.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/heap.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/index.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/listers.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/listwatch.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/mutation_cache.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/mutation_detector.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/reflector.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/reflector_metrics.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/shared_informer.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/store.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/thread_safe_store.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/cache/undelta_store.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/helpers.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/latest/latest.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/register.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/types.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/v1/conversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/v1/defaults.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/v1/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/v1/register.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/v1/types.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.conversion.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.defaults.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/api/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/auth_loaders.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/client_config.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/config.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/flag.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/helpers.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/loader.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/overrides.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/clientcmd/validation.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/healthzadaptor.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/metrics.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/configmaplock.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/endpointslock.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/interface.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/leaselock.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/multilock.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/metrics/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/tools/metrics/metrics.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/pager/pager.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/record/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/tools/record/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/record/event.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/record/events_cache.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/record/fake.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/record/util/util.go create mode 100644 integration-test/vendor/k8s.io/client-go/tools/reference/ref.go create mode 100644 integration-test/vendor/k8s.io/client-go/transport/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/transport/cache.go create mode 100644 integration-test/vendor/k8s.io/client-go/transport/cert_rotation.go create mode 100644 integration-test/vendor/k8s.io/client-go/transport/config.go create mode 100644 integration-test/vendor/k8s.io/client-go/transport/round_trippers.go create mode 100644 integration-test/vendor/k8s.io/client-go/transport/token_source.go create mode 100644 integration-test/vendor/k8s.io/client-go/transport/transport.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/cert/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/util/cert/cert.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/cert/csr.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/cert/io.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/cert/pem.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/cert/server_inspection.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/connrotation/connrotation.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/flowcontrol/backoff.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/flowcontrol/throttle.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/homedir/homedir.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/keyutil/OWNERS create mode 100644 integration-test/vendor/k8s.io/client-go/util/keyutil/key.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/workqueue/default_rate_limiters.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/workqueue/delaying_queue.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/workqueue/doc.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/workqueue/metrics.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/workqueue/parallelizer.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/workqueue/queue.go create mode 100644 integration-test/vendor/k8s.io/client-go/util/workqueue/rate_limiting_queue.go create mode 100644 integration-test/vendor/k8s.io/component-base/LICENSE create mode 100644 integration-test/vendor/k8s.io/component-base/config/OWNERS create mode 100644 integration-test/vendor/k8s.io/component-base/config/doc.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/types.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/v1alpha1/conversion.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/v1alpha1/defaults.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/v1alpha1/doc.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/v1alpha1/register.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/v1alpha1/types.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/v1alpha1/zz_generated.conversion.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/component-base/config/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/k8s.io/klog/v2/.gitignore create mode 100644 integration-test/vendor/k8s.io/klog/v2/CONTRIBUTING.md create mode 100644 integration-test/vendor/k8s.io/klog/v2/LICENSE create mode 100644 integration-test/vendor/k8s.io/klog/v2/OWNERS create mode 100644 integration-test/vendor/k8s.io/klog/v2/README.md create mode 100644 integration-test/vendor/k8s.io/klog/v2/RELEASE.md create mode 100644 integration-test/vendor/k8s.io/klog/v2/SECURITY.md create mode 100644 integration-test/vendor/k8s.io/klog/v2/SECURITY_CONTACTS create mode 100644 integration-test/vendor/k8s.io/klog/v2/code-of-conduct.md create mode 100644 integration-test/vendor/k8s.io/klog/v2/klog.go create mode 100644 integration-test/vendor/k8s.io/klog/v2/klog_file.go create mode 100644 integration-test/vendor/k8s.io/kube-openapi/LICENSE create mode 100644 integration-test/vendor/k8s.io/kube-openapi/pkg/util/proto/OWNERS create mode 100644 integration-test/vendor/k8s.io/kube-openapi/pkg/util/proto/doc.go create mode 100644 integration-test/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go create mode 100644 integration-test/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go create mode 100644 integration-test/vendor/k8s.io/utils/LICENSE create mode 100644 integration-test/vendor/k8s.io/utils/buffer/ring_growing.go create mode 100644 integration-test/vendor/k8s.io/utils/integer/integer.go create mode 100644 integration-test/vendor/k8s.io/utils/pointer/OWNERS create mode 100644 integration-test/vendor/k8s.io/utils/pointer/README.md create mode 100644 integration-test/vendor/k8s.io/utils/pointer/pointer.go create mode 100644 integration-test/vendor/k8s.io/utils/trace/README.md create mode 100644 integration-test/vendor/k8s.io/utils/trace/trace.go create mode 100644 integration-test/vendor/modules.txt create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/LICENSE create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/cache.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/informer_cache.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/cache_reader.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/deleg_map.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/disabledeepcopy.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/informers_map.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/internal/selector.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cache/multi_namespace_cache.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/certwatcher/certwatcher.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/certwatcher/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/apiutil/apimachinery.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/apiutil/dynamicrestmapper.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/client.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/client_cache.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/codec.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/dryrun.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/interfaces.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/metadata_client.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/namespaced_client.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/object.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/options.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/patch.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/split.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/typed_client.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/unstructured_client.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/client/watch.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cluster/cluster.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/cluster/internal.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/config/config.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/config/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/register.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/types.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/zz_generated.deepcopy.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controller.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllerutil/controllerutil.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllerutil/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/controller/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/event/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/event/event.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/handler/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/handler/enqueue.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/handler/enqueue_mapped.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/handler/enqueue_owner.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/handler/eventhandler.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/healthz/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/healthz/healthz.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/metrics/metrics.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/internal/log/log.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/objectutil.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/internal/recorder/recorder.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/leaderelection/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/leaderelection/leader_election.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/log/deleg.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/log/log.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/log/null.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/log/warning_handler.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/manager/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/manager/internal.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/manager/manager.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/metrics/client_go_adapter.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/metrics/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/metrics/listener.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/metrics/registry.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/metrics/workqueue.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/predicate/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/predicate/predicate.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/ratelimiter/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/ratelimiter/ratelimiter.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/reconcile/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/reconcile/reconcile.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/recorder/recorder.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/runtime/inject/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/runtime/inject/inject.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/scheme/scheme.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/source/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/source/internal/eventsource.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/source/source.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/decode.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/defaulter.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/defaulter_custom.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/http.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/inject.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/multi.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/response.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/validator.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/validator_custom.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/webhook.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/alias.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics/metrics.go create mode 100644 integration-test/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/server.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/LICENSE create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/element.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/fromvalue.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/managers.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/path.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/serialize-pe.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/serialize.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/set.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/equals.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/reconcile_schema.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/allocator.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/doc.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/fields.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/jsontagutil.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/list.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/listreflect.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/listunstructured.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/map.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/scalar.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/structreflect.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/value.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/valuereflect.go create mode 100644 integration-test/vendor/sigs.k8s.io/structured-merge-diff/v4/value/valueunstructured.go create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/.gitignore create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/.travis.yml create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/CONTRIBUTING.md create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/LICENSE create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/OWNERS create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/README.md create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/RELEASE.md create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/SECURITY_CONTACTS create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/code-of-conduct.md create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/fields.go create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/yaml.go create mode 100644 integration-test/vendor/sigs.k8s.io/yaml/yaml_go110.go diff --git a/.reuse/dep5 b/.reuse/dep5 index 010207781..81a4a2177 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -15,6 +15,9 @@ Files: go.sum VERSION vendor/* + integration-test/vendor/* + integration-test/go.mod + integration-test/go.sum pkg/crdmanager/crdresources/* pkg/apis/.schemes/* pkg/apis/openapi/api_violations.report diff --git a/Makefile b/Makefile index 7fd6aa080..f0cf7e19c 100644 --- a/Makefile +++ b/Makefile @@ -18,14 +18,16 @@ install-requirements: .PHONY: revendor revendor: @$(REPO_ROOT)/hack/revendor.sh + @cd $(REPO_ROOT)/integration-test && $(REPO_ROOT)/hack/revendor.sh .PHONY: format format: - @$(REPO_ROOT)/hack/format.sh $(REPO_ROOT)/pkg $(REPO_ROOT)/cmd $(REPO_ROOT)/hack + @$(REPO_ROOT)/hack/format.sh $(REPO_ROOT)/pkg $(REPO_ROOT)/cmd $(REPO_ROOT)/hack $(REPO_ROOT)/test $(REPO_ROOT)/integration-test/pkg .PHONY: check check: - @$(REPO_ROOT)/hack/check.sh --golangci-lint-config=./.golangci.yaml $(REPO_ROOT)/cmd/... $(REPO_ROOT)/pkg/... $(REPO_ROOT)/hack/... + @$(REPO_ROOT)/hack/check.sh --golangci-lint-config=./.golangci.yaml $(REPO_ROOT)/cmd/... $(REPO_ROOT)/pkg/... $(REPO_ROOT)/hack/... $(REPO_ROOT)/test/... + @cd $(REPO_ROOT)/integration-test && $(REPO_ROOT)/hack/check.sh --golangci-lint-config=$(REPO_ROOT)/.golangci.yaml ./pkg/... .PHONY: verify verify: check @@ -38,6 +40,10 @@ setup-testenv: test: setup-testenv @$(REPO_ROOT)/hack/test.sh +.PHONY: integration-test +integration-test: + @cd $(REPO_ROOT)/integration-test && go run ./pkg --kubeconfig $(KUBECONFIG) --laas-version $(EFFECTIVE_VERSION) --laas-repository $(REGISTRY) --provider-type $(CLUSTER_PROVIDER_TYPE) + .PHONY: generate-code generate-code: @cd $(REPO_ROOT)/pkg/apis && $(REPO_ROOT)/hack/generate.sh ./... && cd $(REPO_ROOT) diff --git a/hack/check.sh b/hack/check.sh index fa30b2e47..1b3647bc3 100755 --- a/hack/check.sh +++ b/hack/check.sh @@ -30,7 +30,7 @@ folders=() for f in $@; do folders+=( "$(echo $f | sed 's/\(.*\)\/\.\.\./\1/')" ) done -unformatted_files="$(goimports -l -local=github.com/gardener/landscapercli ${folders[*]})" +unformatted_files="$(goimports -l -local=github.com/gardener/landscaper-service ${folders[*]})" if [[ "$unformatted_files" ]]; then echo "Unformatted files detected:" echo "$unformatted_files" diff --git a/hack/integration-test.py b/hack/integration-test.py new file mode 100755 index 000000000..cabefbc52 --- /dev/null +++ b/hack/integration-test.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +# +# SPDX-License-Identifier: Apache-2.0 + +import os +import sys +import utils +import yaml +import json +import model.container_registry +import oci.auth as oa + +from util import ctx +from subprocess import run + +project_root = os.environ["PROJECT_ROOT"] +target_cluster = os.environ["TARGET_CLUSTER"] +target_cluster_provider = os.environ["TARGET_CLUSTER_PROVIDER"] +laas_version = os.environ["LAAS_VERSION"] +laas_repository = os.environ["LAAS_REPOSITORY"] +repo_ctx_base_url = os.environ["REPO_CTX_BASE_URL"] +repo_auth_url = os.environ["REPO_AUTH_URL"] + +factory = ctx().cfg_factory() +print(f"Getting kubeconfig for {target_cluster}") +landscape_kubeconfig = factory.kubernetes(target_cluster) + +print(f"Getting credentials for {repo_ctx_base_url}") +cr_conf = model.container_registry.find_config(repo_ctx_base_url, oa.Privileges.READONLY) + +with utils.TempFileAuto(prefix="landscape_kubeconfig_") as kubeconfig_temp_file, utils.TempFileAuto(prefix="registry_auth_", suffix=".json") as registry_temp_file: + kubeconfig_temp_file.write(yaml.safe_dump(landscape_kubeconfig.kubeconfig())) + landscape_kubeconfig_path = kubeconfig_temp_file.switch() + + auth = utils.base64_encode_to_string(cr_conf.credentials().username() + ":" + cr_conf.credentials().passwd()) + auths = { + "auths": { + repo_auth_url: { + "auth": auth + } + } + } + + registry_temp_file.write(json.dumps(auths)) + registry_secrets_path = registry_temp_file.switch() + + command = ["go", "run", "./pkg/main.go", + "--kubeconfig", landscape_kubeconfig_path, + "--provider-type", target_cluster_provider, + "--laas-version", laas_version, + "--laas-repository", laas_repository, + "--registry-secrets", registry_secrets_path] + + print(f"Running integration test with command: {' '.join(command)}") + + mod_path = os.path.join(project_root, "integration-test") + run = run(command, cwd=mod_path) + + if run.returncode != 0: + raise EnvironmentError("Integration test exited with errors") diff --git a/hack/integration-test.sh b/hack/integration-test.sh index 673d5690e..04534b846 100755 --- a/hack/integration-test.sh +++ b/hack/integration-test.sh @@ -1,6 +1,34 @@ #!/bin/sh +# SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +apk add --no-cache --no-progress bash + +if ! command -v git &> /dev/null +then + apk add --no-cache --no-progress git +fi + PROJECT_ROOT="$(dirname $0)/.." +TARGET_CLUSTER="laas-integration-test" +TARGET_CLUSTER_PROVIDER="gcp" +LAAS_VERSION="$("${SOURCE_PATH}"/hack/get-version.sh)" +LAAS_REPOSITORY="eu.gcr.io/sap-se-gcr-k8s-private/cnudie/gardener/development" +REPO_AUTH_URL="https://eu.gcr.io" +REPO_CTX_BASE_URL="eu.gcr.io/sap-se-gcr-k8s-private" + +export PROJECT_ROOT +export TARGET_CLUSTER +export TARGET_CLUSTER_PROVIDER +export LAAS_VERSION +export LAAS_REPOSITORY +export REPO_AUTH_URL +export REPO_CTX_BASE_URL + if ! command -v curl &> /dev/null then @@ -19,7 +47,6 @@ then echo "Helm could not be found" echo "Try installing it..." export DESIRED_VERSION="v3.7.1" - apk add --no-cache --no-progress bash curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash # symlink to /bin/helm3 as it is required by the integration test script ln -s "$(which helm)" /bin/helm3 @@ -38,3 +65,5 @@ pip3 install --upgrade pip echo "Running pip3 install gardener-cicd-libs" pip3 install gardener-cicd-libs + +"${PROJECT_ROOT}/hack/integration-test.py" diff --git a/hack/utils.py b/hack/utils.py new file mode 100644 index 000000000..c06ae5cfd --- /dev/null +++ b/hack/utils.py @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +# +# SPDX-License-Identifier: Apache-2.0 + +import os +import tempfile +import base64 + + +class TempFileAuto(object): + def __init__(self, prefix=None, mode='w+', suffix=".yaml"): + self.file_obj = tempfile.NamedTemporaryFile(mode=mode, prefix=prefix, suffix=suffix, delete=False) + self.name = self.file_obj.name + def __enter__(self): + return self + def write(self, b): + self.file_obj.write(b) + def writelines(self, lines): + self.file_obj.writelines(lines) + def switch(self): + self.file_obj.close() + return self.file_obj.name + def __exit__(self, type, value, traceback): + if not self.file_obj.closed: + self.file_obj.close() + os.remove(self.file_obj.name) + return False + +def base64_encode_to_string(value): + value = value.rstrip() + if isinstance(value, str): + value = value.encode('utf-8') + return base64.b64encode(value).decode('utf-8') \ No newline at end of file diff --git a/integration-test/go.mod b/integration-test/go.mod new file mode 100644 index 000000000..f3a016654 --- /dev/null +++ b/integration-test/go.mod @@ -0,0 +1,97 @@ +module github.com/gardener/landscaper-service/test/integration + +go 1.17 + +require ( + github.com/gardener/component-spec/bindings-go v0.0.53 + github.com/gardener/landscaper-service v0.0.0-00010101000000-000000000000 + github.com/gardener/landscaper/apis v0.23.0 + github.com/gardener/landscaper/controller-utils v0.23.0 + github.com/gardener/landscapercli v0.16.1-0.20220408051006-1a25c3c0b246 + github.com/go-logr/logr v0.4.0 + k8s.io/api v0.22.2 + k8s.io/apimachinery v0.22.2 + k8s.io/client-go v0.22.2 + sigs.k8s.io/controller-runtime v0.10.3 +) + +require ( + github.com/Microsoft/go-winio v0.5.0 // indirect + github.com/Microsoft/hcsshim v0.8.23 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/containerd/containerd v1.5.10 // indirect + github.com/containerd/continuity v0.2.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/docker/cli v20.10.7+incompatible // indirect + github.com/docker/distribution v2.7.1+incompatible // indirect + github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible // indirect + github.com/docker/docker-credential-helpers v0.6.3 // indirect + github.com/docker/go-units v0.4.0 // indirect + github.com/evanphx/json-patch v4.11.0+incompatible // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/gardener/component-cli v0.36.0 // indirect + github.com/gardener/landscaper v0.21.0 // indirect + github.com/ghodss/yaml v1.0.0 // indirect + github.com/go-logr/zapr v0.4.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.6 // indirect + github.com/google/go-containerregistry v0.5.0 // indirect + github.com/google/gofuzz v1.1.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/googleapis/gnostic v0.5.5 // indirect + github.com/imdario/mergo v0.3.12 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/json-iterator/go v1.1.11 // indirect + github.com/klauspost/compress v1.13.6 // indirect + github.com/mandelsoft/filepath v0.0.0-20200909114706-3df73d378d55 // indirect + github.com/mandelsoft/spiff v1.6.1 // indirect + github.com/mandelsoft/vfs v0.0.0-20210530103237-5249dc39ce91 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/moby/locker v1.0.1 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/opencontainers/distribution-spec v1.0.0-rc1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect + github.com/opencontainers/runc v1.0.2 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + github.com/sirupsen/logrus v1.8.1 // indirect + github.com/spf13/cobra v1.2.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/xeipuuv/gojsonschema v1.2.0 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + go.uber.org/zap v1.19.1 // indirect + golang.org/x/net v0.0.0-20211005215030-d2e5035098b3 // indirect + golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602 // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef // indirect + golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect + gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e // indirect + google.golang.org/grpc v1.41.0 // indirect + google.golang.org/protobuf v1.27.1 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + k8s.io/component-base v0.22.2 // indirect + k8s.io/klog/v2 v2.9.0 // indirect + k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect + k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect + sigs.k8s.io/yaml v1.2.0 // indirect +) + +replace github.com/gardener/landscaper-service => ../ diff --git a/integration-test/go.sum b/integration-test/go.sum new file mode 100644 index 000000000..e476f4535 --- /dev/null +++ b/integration-test/go.sum @@ -0,0 +1,1617 @@ +bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= +bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210608223527-2377c96fe795/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= +github.com/Azure/go-autorest/autorest v0.11.12/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= +github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= +github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= +github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= +github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= +github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= +github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= +github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= +github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= +github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= +github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= +github.com/Masterminds/squirrel v1.5.0/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= +github.com/Masterminds/vcs v1.13.1/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA= +github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= +github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU= +github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= +github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= +github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= +github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= +github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= +github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= +github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= +github.com/Microsoft/hcsshim v0.8.18/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= +github.com/Microsoft/hcsshim v0.8.23 h1:47MSwtKGXet80aIn+7h4YI6fwPmwIghAnsx2aOUrG2M= +github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= +github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= +github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= +github.com/ahmetb/gen-crd-api-reference-docs v0.3.0/go.mod h1:TdjdkYhlOifCQWPs1UdTma97kQQMozf5h26hTuG70u8= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= +github.com/aws/aws-sdk-go v1.34.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= +github.com/b4b4r07/go-pipe v0.0.0-20191010045404-84b446f57366/go.mod h1:1ymsiQNa3qebVEEVtuIdhtAXRfjO4qFCFq1bBUOT2HE= +github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= +github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= +github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= +github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= +github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= +github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw= +github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= +github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= +github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= +github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= +github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudfoundry-incubator/candiedyaml v0.0.0-20170901234223-a41693b7b7af/go.mod h1:dOLSIXcRQJiDS1vlrYFNJicoHNZLsBKideE+70hGdV4= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= +github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= +github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= +github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= +github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= +github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E= +github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= +github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= +github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601/go.mod h1:X9rLEHIqSf/wfK8NsPqxJmeZgW4pcfzdXITDrUSJ6uI= +github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= +github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= +github.com/containerd/cgroups v0.0.0-20200710171044-318312a37340/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= +github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= +github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= +github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= +github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= +github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4qcS3XoQ5xkw= +github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= +github.com/containerd/containerd v1.2.10/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.1-0.20191213020239-082f7e3aed57/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.0-beta.2.0.20200729163537-40b22ef07410/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.9/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= +github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= +github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= +github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= +github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.2/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.4/go.mod h1:sx18RgvW6ABJ4iYUw7Q5x7bgFOAB9B6G7+yO0XBc4zw= +github.com/containerd/containerd v1.5.5/go.mod h1:oSTh0QpT1w6jYcGmbiSbxv9OSQYaa88mPyWIuU79zyo= +github.com/containerd/containerd v1.5.10 h1:3cQ2uRVCkJVcx5VombsE7105Gl9Wrl7ORAO3+4+ogf4= +github.com/containerd/containerd v1.5.10/go.mod h1:fvQqCfadDGga5HZyn3j4+dx56qj2I9YwBrlSdalvJYQ= +github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= +github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= +github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= +github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= +github.com/containerd/continuity v0.2.0 h1:j/9Wnn+hrEWjLvHuIxUU1YI5JjEjVlT2AA68cse9rwY= +github.com/containerd/continuity v0.2.0/go.mod h1:wCYX+dRqZdImhGucXOqTQn05AhX6EUDaGEMUzTFFpLg= +github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= +github.com/containerd/fifo v0.0.0-20201026212402-0724c46b320c/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= +github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= +github.com/containerd/fifo v1.0.0/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= +github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU= +github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk= +github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/go-runc v0.0.0-20190911050354-e029b79d8cda/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g= +github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= +github.com/containerd/go-runc v1.0.0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= +github.com/containerd/imgcrypt v1.0.1/go.mod h1:mdd8cEPW7TPgNG4FpuP3sGBiQ7Yi/zak9TYCG3juvb0= +github.com/containerd/imgcrypt v1.0.4-0.20210301171431-0ae5c75f59ba/go.mod h1:6TNsg0ctmizkrOgXRNQjAPFWpMYRWuiB6dSF4Pfa5SA= +github.com/containerd/imgcrypt v1.1.1-0.20210312161619-7ed62a527887/go.mod h1:5AZJNI6sLHJljKuI9IHnw1pWqo/F0nGDOuR9zgTs7ow= +github.com/containerd/imgcrypt v1.1.1/go.mod h1:xpLnwiQmEUJPvQoAapeb2SNCxz7Xr6PJrXQb0Dpc4ms= +github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c= +github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= +github.com/containerd/nri v0.1.0/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= +github.com/containerd/stargz-snapshotter/estargz v0.4.1/go.mod h1:x7Q9dg9QYb4+ELgxmo4gBUeJB0tl5dqH1Sdz0nJU1QM= +github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= +github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= +github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= +github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ= +github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= +github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk= +github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= +github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= +github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw= +github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y= +github.com/containerd/zfs v0.0.0-20210315114300-dde8f0fda960/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containerd/zfs v1.0.0/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM= +github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8= +github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc= +github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgUV4GP9qXPfu4= +github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= +github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= +github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyphar/filepath-securejoin v0.2.2 h1:jCwT2GTP+PY5nBz3c/YL5PAIbusElVrPujOBSCj8xRg= +github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= +github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= +github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= +github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= +github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE= +github.com/denisenkom/go-mssqldb v0.9.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= +github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= +github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/distribution/distribution/v3 v3.0.0-20210804104954-38ab4c606ee3/go.mod h1:gt38b7cvVKazi5XkHvINNytZXgTEntyhtyM3HQz46Nk= +github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v20.10.0-rc1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v20.10.7+incompatible h1:pv/3NqibQKphWZiAskMzdz8w0PRbtTaEB+f6NwdU7Is= +github.com/docker/cli v20.10.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= +github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= +github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v1.4.2-0.20200203170920-46ec8731fbce/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible h1:iWPIG7pWIsCwT6ZtHnTUpoVMnete7O/pzd9HFE3+tn8= +github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.6.3 h1:zI2p9+1NQYdnG6sMU26EX4aVGlqbInSQxQXLvzJ4RPQ= +github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= +github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= +github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= +github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= +github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/drone/envsubst v1.0.2/go.mod h1:bkZbnc/2vh1M12Ecn7EYScpI4YGYU0etwLJICOWi8Z0= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= +github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.11.0+incompatible h1:glyUF9yIYtMHzn8xaKw5rMhdWcwsYV8dZHIq5567/xs= +github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4= +github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= +github.com/fvbommel/sortorder v1.0.1/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= +github.com/gardener/component-cli v0.32.0/go.mod h1:8nPKm/bS2jEeEu5VefDM+SHfa1TsUP/rUC4TV8xBhfE= +github.com/gardener/component-cli v0.36.0 h1:J0DoH9UOG9JtjaVWjpTph2MPCPkPGydWEhgiFzwAsd8= +github.com/gardener/component-cli v0.36.0/go.mod h1:dxxc1foZ+YSnhX6Ji3gK+Ok5Fn5RTlVDAdzRtyu2HJw= +github.com/gardener/component-spec/bindings-go v0.0.41/go.mod h1:kQFMTWowNAp9tOp6aImQa/NoLzfvX29jN5Qgud9rpQU= +github.com/gardener/component-spec/bindings-go v0.0.52/go.mod h1:kQFMTWowNAp9tOp6aImQa/NoLzfvX29jN5Qgud9rpQU= +github.com/gardener/component-spec/bindings-go v0.0.53 h1:9M6YOs8FYDSmGJqNqdCFolo3buuQalJSuUy7X8FIXm4= +github.com/gardener/component-spec/bindings-go v0.0.53/go.mod h1:kQFMTWowNAp9tOp6aImQa/NoLzfvX29jN5Qgud9rpQU= +github.com/gardener/image-vector v0.6.0/go.mod h1:32SHGcbmmueeK9VkawsFcEbsoENXQPIuuYiFBUP+vMQ= +github.com/gardener/image-vector v0.9.0 h1:Njc/IywnV1mQjQyJH7Xv/M3kggXYos6OjkOk3nP14Ek= +github.com/gardener/image-vector v0.9.0/go.mod h1:32SHGcbmmueeK9VkawsFcEbsoENXQPIuuYiFBUP+vMQ= +github.com/gardener/landscaper v0.21.0 h1:gkrRQYDyHOOKnbE4HEFx3Ci5x+l5616S6CXY9zCrfL0= +github.com/gardener/landscaper v0.21.0/go.mod h1:uFVmNmNm1160qgfoJaiuwEVA8/F2i00ma0vkpFIalW0= +github.com/gardener/landscaper/apis v0.21.0/go.mod h1:XFDwxQgoSR0qHv8WzYuT7MC4yEVR6vJ/PWiQB4B0cfA= +github.com/gardener/landscaper/apis v0.23.0 h1:gGbqTz+jvZYqlwlmGwkGkCWCz49lRym+ZCJuoAYA2uU= +github.com/gardener/landscaper/apis v0.23.0/go.mod h1:XFDwxQgoSR0qHv8WzYuT7MC4yEVR6vJ/PWiQB4B0cfA= +github.com/gardener/landscaper/controller-utils v0.21.0/go.mod h1:Cyc1sOtqgkbKwuWFY7653973UYAWSyVHfC1tSvGp0gg= +github.com/gardener/landscaper/controller-utils v0.23.0 h1:hih1f4pnYORvMRj2imu32cE4Ktq0sxPX4cpmSXq4BKw= +github.com/gardener/landscaper/controller-utils v0.23.0/go.mod h1:5vtFK3GgyR96iCFKr/RXaWNE/Vq8XlV2swfQ4OZkmR0= +github.com/gardener/landscapercli v0.16.1-0.20220408051006-1a25c3c0b246 h1:A69TSI7+42A6toiLjNVfp/I+zICwq0Py/UNMvUHIFYM= +github.com/gardener/landscapercli v0.16.1-0.20220408051006-1a25c3c0b246/go.mod h1:JsTKVdfg8iPqLL/mH4bjKXrBkuNqncOx5PyupzqSUGk= +github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= +github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= +github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc= +github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/zapr v0.3.0/go.mod h1:qhKdvif7YF5GI9NWEpyxTSSBdGmzkNguibrdCNVPunU= +github.com/go-logr/zapr v0.4.0 h1:uc1uML3hRYL9/ZZPdgHS/n8Nzo+eaYL/Efxkkamf7OM= +github.com/go-logr/zapr v0.4.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= +github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/spec v0.19.5/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= +github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/gobuffalo/logger v1.0.3/go.mod h1:SoeejUwldiS7ZsyCBphOGURmWdwUFXs0J7TCjEhjKxM= +github.com/gobuffalo/packd v1.0.0/go.mod h1:6VTc4htmJRFB7u1m/4LeMTWjFoYrUiBkU9Fdec9hrhI= +github.com/gobuffalo/packr/v2 v2.8.1/go.mod h1:c/PLlOuTU+p3SybaJATW3H6lX/iK7xEz5OeMf+NnJpg= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godror/godror v0.24.2/go.mod h1:wZv/9vPiUib6tkoDl+AZ/QLf5YZgMravZ7jxH2eQWAE= +github.com/gofrs/flock v0.8.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= +github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0 h1:jlYHihg//f7RRwuPfptm04yp4s7O6Kw8EZiVYIGcH0g= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= +github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-containerregistry v0.5.0 h1:eb9sinv4PKm0AUwQGov0mvIdA4pyBGjRofxN4tWnMwM= +github.com/google/go-containerregistry v0.5.0/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= +github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= +github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= +github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= +github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= +github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= +github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/joncalhoun/pipe v0.0.0-20170510025636-72505674a733/go.mod h1:2MNFZhLx2HMHTN4xKH6FhpoQWqmD8Ato8QOE2hp5hY4= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/karrick/godirwalk v1.15.8/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kortschak/utter v1.0.1/go.mod h1:vSmSjbyrlKjjsL71193LmzBOKgwePk9DH6uFaWHIInc= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= +github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= +github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mandelsoft/filepath v0.0.0-20200909114706-3df73d378d55 h1:mFdiUG86O2iW+iDEpZKXf64efMWO4JvDT+zN3znUGIc= +github.com/mandelsoft/filepath v0.0.0-20200909114706-3df73d378d55/go.mod h1:n4xEiUD2HNHnn2w5ZKF0qgjDecHVCWAl5DxZ7+pcFU8= +github.com/mandelsoft/spiff v1.5.0/go.mod h1:ySrI0I40exZhvVthh/L0KKtYwLzwDG6jAZVypeqHmk4= +github.com/mandelsoft/spiff v1.6.1 h1:jQynFfykV3wTwel+SWTOEVp6dBM+FKOVcHYRUXIFfiM= +github.com/mandelsoft/spiff v1.6.1/go.mod h1:ySrI0I40exZhvVthh/L0KKtYwLzwDG6jAZVypeqHmk4= +github.com/mandelsoft/vfs v0.0.0-20210530103237-5249dc39ce91 h1:IW3qfn0AelV/4nLyVxFqZ5mJGTv7jGdqEWcFXiybLJs= +github.com/mandelsoft/vfs v0.0.0-20210530103237-5249dc39ce91/go.mod h1:74aV7kulg9C434HiI3zNALN79QHc9IZMN+SI4UdLn14= +github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc= +github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-oci8 v0.1.1/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= +github.com/mattn/go-shellwords v1.0.11/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/copystructure v1.1.1 h1:Bp6x9R1Wn16SIz3OfeDr0b7RnCG2OB66Y7PQyC/cvq4= +github.com/mitchellh/copystructure v1.1.1/go.mod h1:EBArHfARyrSWO/+Wyr9zwEkc6XMFB9XyNgFNmRkZZU4= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= +github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= +github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= +github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= +github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= +github.com/moby/term v0.0.0-20210610120745-9d4ed1856297/go.mod h1:vgPCkQMyxTZ7IDy8SXRufE172gr8+K/JE/7hHFxHW3A= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= +github.com/onsi/gomega v1.10.4/go.mod h1:g/HbgYopi++010VEqkFgJHKC09uJiW9UkXvMUuKHUCQ= +github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= +github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= +github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/opencontainers/distribution-spec v1.0.0-rc1 h1:nuQ2aIFPy01fNMoeoY7TCedORpU9Wmm/nkMiGErgrmY= +github.com/opencontainers/distribution-spec v1.0.0-rc1/go.mod h1:copR2flp+jTEvQIFMb6MIx45OkrxzqyjszPDT3hx/5Q= +github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= +github.com/opencontainers/runc v1.0.1/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runc v1.0.2 h1:opHZMaswlyxz1OuGpBE53Dwe4/xF7EZTY0A2L/FpCOg= +github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= +github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= +github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= +github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= +github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= +github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rubenv/sql-migrate v0.0.0-20210614095031-55d5740dbbcc/go.mod h1:HFLT6i9iR4QBOF5rdCyjddC9t59ArqWJV2xx+jwcCMo= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/cobra v1.2.0/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= +github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= +github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= +github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= +github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= +github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= +github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= +go.etcd.io/etcd/pkg/v3 v3.5.0/go.mod h1:UzJGatBQ1lXChBkQF0AuAtkRQMYnHubxAEYIrC3MSsE= +go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD00Szc= +go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4= +go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4= +go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= +go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= +go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= +go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= +go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= +go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= +go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= +go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5/go.mod h1:nmDLcffg48OtT/PSW0Hg7FvpRQsQh5OSqIylirxKC7o= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723 h1:sHOAIxRGBp443oHZIPB+HsUGaksVCXVQENPxwTfQdH4= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.8.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211005215030-d2e5035098b3 h1:G64nFNerDErBd2KdvHvIn3Ee6ccUQBTfhDZEO0DccfU= +golang.org/x/net v0.0.0-20211005215030-d2e5035098b3/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602 h1:0Ja1LBD+yisY6RWM/BH7TJVXWsSjs2VwBSmvSX4HdBc= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190812073006-9eafafc0a87e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200806060901-a37d78b92225/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef h1:fPxZ3Umkct3LZ8gK9nbk+DWDJ9fstZa2grBn+lWVKPs= +golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= +golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200308013534-11ec41452d41/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gomodules.xyz/jsonpatch/v2 v2.2.0 h1:4pT439QV83L+G9FkcCriY6EkpcK6r6bK+A5FBUMI7qY= +gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY= +google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190522204451-c2c4e71fbf69/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e h1:Im71rbA1N3CbIag/PumYhQcNR8bLNmuOtRIyOnnLsT8= +google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= +google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/gorp.v1 v1.7.2/go.mod h1:Wo3h+DBQZIxATwftsglhdD/62zRFPhGhTiu5jUJmCaw= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/pipe.v2 v2.0.0-20140414041502-3c2ca4d52544/go.mod h1:UhTeH/yXCK/KY7TX24mqPkaQ7gZeqmWd/8SSS8B3aHw= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= +gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= +helm.sh/helm/v3 v3.7.0 h1:jRZCCdrOEfJI1LgStRAbmDJQkAwZkFy6gr4OlwrE2Ro= +helm.sh/helm/v3 v3.7.0/go.mod h1:DajHtQTe8KrjNmvy5gxWkosFKaADrS3uRS5EkDtsmI4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= +k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= +k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= +k8s.io/api v0.21.2/go.mod h1:Lv6UGJZ1rlMI1qusN8ruAp9PUBFyBwpEHAdG24vIsiU= +k8s.io/api v0.22.1/go.mod h1:bh13rkTp3F1XEaLGykbyRD2QaTTzPm0e/BMd8ptFONY= +k8s.io/api v0.22.2 h1:M8ZzAD0V6725Fjg53fKeTJxGsJvRbk4TEm/fexHMtfw= +k8s.io/api v0.22.2/go.mod h1:y3ydYpLJAaDI+BbSe2xmGcqxiWHmWjkEeIbiwHvnPR8= +k8s.io/apiextensions-apiserver v0.21.2/go.mod h1:+Axoz5/l3AYpGLlhJDfcVQzCerVYq3K3CvDMvw6X1RA= +k8s.io/apiextensions-apiserver v0.22.1/go.mod h1:HeGmorjtRmRLE+Q8dJu6AYRoZccvCMsghwS8XTUYb2c= +k8s.io/apiextensions-apiserver v0.22.2 h1:zK7qI8Ery7j2CaN23UCFaC1hj7dMiI87n01+nKuewd4= +k8s.io/apiextensions-apiserver v0.22.2/go.mod h1:2E0Ve/isxNl7tWLSUDgi6+cmwHi5fQRdwGVCxbC+KFA= +k8s.io/apimachinery v0.18.6/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko= +k8s.io/apimachinery v0.19.4/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= +k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= +k8s.io/apimachinery v0.21.2/go.mod h1:CdTY8fU/BlvAbJ2z/8kBwimGki5Zp8/fbVuLY8gJumM= +k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= +k8s.io/apimachinery v0.22.2 h1:ejz6y/zNma8clPVfNDLnPbleBo6MpoFy/HBiBqCouVk= +k8s.io/apimachinery v0.22.2/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= +k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= +k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= +k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= +k8s.io/apiserver v0.21.2/go.mod h1:lN4yBoGyiNT7SC1dmNk0ue6a5Wi6O3SWOIw91TsucQw= +k8s.io/apiserver v0.22.1/go.mod h1:2mcM6dzSt+XndzVQJX21Gx0/Klo7Aen7i0Ai6tIa400= +k8s.io/apiserver v0.22.2/go.mod h1:vrpMmbyjWrgdyOvZTSpsusQq5iigKNWv9o9KlDAbBHI= +k8s.io/cli-runtime v0.22.1/go.mod h1:YqwGrlXeEk15Yn3em2xzr435UGwbrCw5x+COQoTYfoo= +k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= +k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= +k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= +k8s.io/client-go v0.21.2/go.mod h1:HdJ9iknWpbl3vMGtib6T2PyI/VYxiZfq936WNVHBRrA= +k8s.io/client-go v0.22.1/go.mod h1:BquC5A4UOo4qVDUtoc04/+Nxp1MeHcVc1HJm1KmG8kk= +k8s.io/client-go v0.22.2 h1:DaSQgs02aCC1QcwUdkKZWOeaVsQjYvWv8ZazcZ6JcHc= +k8s.io/client-go v0.22.2/go.mod h1:sAlhrkVDf50ZHx6z4K0S40wISNTarf1r800F+RlCF6U= +k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= +k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0= +k8s.io/code-generator v0.21.2/go.mod h1:8mXJDCB7HcRo1xiEQstcguZkbxZaqeUOrO9SsicWs3U= +k8s.io/code-generator v0.22.1/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= +k8s.io/code-generator v0.22.2/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= +k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= +k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= +k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= +k8s.io/component-base v0.21.2/go.mod h1:9lvmIThzdlrJj5Hp8Z/TOgIkdfsNARQ1pT+3PByuiuc= +k8s.io/component-base v0.22.1/go.mod h1:0D+Bl8rrnsPN9v0dyYvkqFfBeAd4u7n77ze+p8CMiPo= +k8s.io/component-base v0.22.2 h1:vNIvE0AIrLhjX8drH0BgCNJcR4QZxMXcJzBsDplDx9M= +k8s.io/component-base v0.22.2/go.mod h1:5Br2QhI9OTe79p+TzPe9JKNQYvEKbq9rTJDWllunGug= +k8s.io/component-helpers v0.22.1/go.mod h1:QvBcDbX+qU5I2tMZABBF5fRwAlQwiv771IGBHK9WYh4= +k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= +k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= +k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= +k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= +k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20201203183100-97869a43a9d9/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v0.2.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= +k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/klog/v2 v2.9.0 h1:D7HV+n1V57XeZ0m6tdRkfknthUaM06VFbWldOFh8kzM= +k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= +k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= +k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= +k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= +k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= +k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e h1:KLHHjkdQFomZy8+06csTWZ0m1343QqxZhR2LJ1OxCYM= +k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= +k8s.io/kubectl v0.22.1/go.mod h1:mjAOgEbMNMtZWxnfM6jd+nPjPsaoLqO5xanc78WcSbw= +k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= +k8s.io/metrics v0.22.1/go.mod h1:i/ZNap89UkV1gLa26dn7fhKAdheJaKy+moOqJbiif7E= +k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a h1:8dYfu/Fc9Gz2rNJKB9IQRGgQOh2clmRzNIPPY1xLY5g= +k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +oras.land/oras-go v0.4.0/go.mod h1:VJcU+VE4rkclUbum5C0O7deEZbBYnsnpbGSACwTjOcg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/letsencrypt v0.0.3/go.mod h1:buyQKZ6IXrRnB7TdkHP0RyEybLx18HHyOSoTyoOLqNY= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.19/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/controller-runtime v0.10.0/go.mod h1:GCdh6kqV6IY4LK0JLwX0Zm6g233RtVGdb/f0+KSfprg= +sigs.k8s.io/controller-runtime v0.10.3 h1:s5Ttmw/B4AuIbwrXD3sfBkXwnPMMWrqpVj4WRt1dano= +sigs.k8s.io/controller-runtime v0.10.3/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY= +sigs.k8s.io/kustomize/api v0.8.11/go.mod h1:a77Ls36JdfCWojpUqR6m60pdGY1AYFix4AH83nJtY1g= +sigs.k8s.io/kustomize/cmd/config v0.9.13/go.mod h1:7547FLF8W/lTaDf0BDqFTbZxM9zqwEJqCKN9sSR0xSs= +sigs.k8s.io/kustomize/kustomize/v4 v4.2.0/go.mod h1:MOkR6fmhwG7hEDRXBYELTi5GSFcLwfqwzTRHW3kv5go= +sigs.k8s.io/kustomize/kyaml v0.11.0/go.mod h1:GNMwjim4Ypgp/MueD3zXHLRJEjz7RvtPae0AwlvEMFM= +sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= +sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.1.0/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.1.2 h1:Hr/htKFmJEbtMgS/UD0N+gtgctAqz81t3nu+sPzynno= +sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/integration-test/pkg/main.go b/integration-test/pkg/main.go new file mode 100644 index 000000000..5cc5c3893 --- /dev/null +++ b/integration-test/pkg/main.go @@ -0,0 +1,340 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package main + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "os" + "text/template" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "github.com/gardener/landscaper/controller-utils/pkg/logger" + cliquickstart "github.com/gardener/landscapercli/cmd/quickstart" + cliutil "github.com/gardener/landscapercli/pkg/util" + "github.com/go-logr/logr" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/tools/clientcmd" + "sigs.k8s.io/controller-runtime/pkg/client" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" + + "github.com/gardener/landscaper-service/test/integration/pkg/test" + "github.com/gardener/landscaper-service/test/integration/pkg/tests" + "github.com/gardener/landscaper-service/test/integration/pkg/util" +) + +var ( + // tests are run in the order they are defined here + integrationTests = []test.TestRunner{ + new(tests.InstallLAASTestRunner), + new(tests.CreateDeploymentRunner), + new(tests.VerifyDeploymentRunner), + new(tests.UpdateDeploymentRunner), + new(tests.VerifyDeploymentRunner), + new(tests.DeleteDeploymentRunner), + // Delete verification disabled for now, because the clea-up steps + // are not yet implemented correctly. + //new(tests.VerifyDeleteRunner), + new(tests.UninstallLAASTestRunner), + } +) + +func main() { + err := run() + if err != nil { + fmt.Fprintf(os.Stderr, "error while running integration test: %s\n", err.Error()) + os.Exit(1) + } +} + +func run() error { + config := test.ParseConfig() + if err := test.VerifyConfig(config); err != nil { + return err + } + + landscaperVersion, err := util.GetLandscaperVersion(test.RepoRootDir) + if err != nil { + return err + } + + config.LandscaperVersion = landscaperVersion + + ctx := context.Background() + defer ctx.Done() + + log, err := logger.NewCliLogger() + if err != nil { + return err + } + + logger.SetLogger(log) + + log.Info("running integration test with flags", + "LAAS Component", config.LaasComponent, + "LAAS Version", config.LaasVersion, + "LAAS Repository", config.LaasRepository, + "Landscaper Version", config.LandscaperVersion, + "Landscaper Namespace", config.LandscaperNamespace, + "LAAS Namespace", config.LaasNamespace, + "Test Namespace", config.TestNamespace, + "Provider Type", config.ProviderType, + ) + + cfg, err := clientcmd.BuildConfigFromFlags("", config.Kubeconfig) + if err != nil { + return err + } + + kclient, err := client.New(cfg, client.Options{ + Scheme: test.Scheme(), + }) + if err != nil { + return err + } + + log.Info("========== Uninstalling Landscaper ==========") + if err := uninstallLandscaper(ctx, log, kclient, config); err != nil { + return err + } + + log.Info("========== Cleaning up before test ==========") + if err := cleanupResources(ctx, log, kclient, config); err != nil { + return err + } + + log.Info("========== Installing Landscaper ==========") + if err := installLandscaper(ctx, config); err != nil { + return err + } + + log.Info("========== Creating prerequisites ==========") + namespace := &corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: config.LaasNamespace, + }, + } + + if err := kclient.Create(ctx, namespace); err != nil { + return fmt.Errorf("failed to create laas namespace: %w", err) + } + + namespace = &corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: config.TestNamespace, + }, + } + + if err := kclient.Create(ctx, namespace); err != nil { + return fmt.Errorf("failed to create test namespace: %w", err) + } + + target, err := util.BuildKubernetesClusterTarget(ctx, kclient, config.Kubeconfig, config.LaasNamespace) + if err != nil { + return fmt.Errorf("cannot build target: %w", err) + } + + if err := util.BuildLandscaperContext(ctx, kclient, config.RegistryPullSecrets, "laas", config.LaasNamespace); err != nil { + return fmt.Errorf("cannot build landscaper context: %w", err) + } + + return runTestSuite(ctx, log, kclient, config, target) +} + +// runTestSuite runs the tests defined in integrationTests +func runTestSuite(ctx context.Context, log logr.Logger, kclient client.Client, config *test.TestConfig, target *lsv1alpha1.Target) error { + log.Info("========== Running test suite ==========") + testObjects := &test.SharedTestObjects{ + Installations: make(map[string]*lsv1alpha1.Installation), + ServiceTargetConfigs: make(map[string]*lssv1alpha1.ServiceTargetConfig), + LandscaperDeployments: make(map[string]*lssv1alpha1.LandscaperDeployment), + HostingClusterNamespaces: make([]string, 0), + } + for _, runner := range integrationTests { + log.Info("running test", "name", runner.Name()) + runner.Init(ctx, log, kclient, config, target, testObjects) + if err := runner.Run(); err != nil { + log.Error(err, "error while running test", "name", runner.Name()) + return err + } + } + + return nil +} + +// uninstallLandscaper uninstalls the landscaper including the namespace it is installed in +func uninstallLandscaper(ctx context.Context, log logr.Logger, kclient client.Client, config *test.TestConfig) error { + uninstallArgs := []string{ + "--kubeconfig", + config.Kubeconfig, + "--namespace", + config.LandscaperNamespace, + "--delete-namespace", + } + + uninstallCmd := cliquickstart.NewUninstallCommand(ctx) + uninstallCmd.SetArgs(uninstallArgs) + + if err := uninstallCmd.Execute(); err != nil { + return fmt.Errorf("failed to uninstall landscaper: %w", err) + } + + if err := util.DeleteValidatingWebhookConfiguration(ctx, kclient, "landscaper-validation-webhook", config.LandscaperNamespace); err != nil { + return err + } + + if err := util.ForceDeleteInstallations(ctx, log, kclient, config.Kubeconfig, config.LandscaperNamespace); err != nil { + return err + } + + if err := util.RemoveFinalizerLandscaperResources(ctx, kclient, config.LandscaperNamespace); err != nil { + return err + } + + log.Info("Waiting for resources to be deleted on the K8s cluster...") + namespace := &corev1.Namespace{} + timeout, err := cliutil.CheckAndWaitUntilObjectNotExistAnymore(kclient, types.NamespacedName{Name: config.LandscaperNamespace}, namespace, config.SleepTime, config.MaxRetries) + + if err != nil { + return err + } + + if timeout { + return fmt.Errorf("waiting for landscaper namespace deletion timed out") + } + + return nil +} + +// buildLandscaperValues builds the landscaper chart values +func buildLandscaperValues(namespace string) ([]byte, error) { + const valuesTemplate = ` +landscaper: + landscaper: + registryConfig: # contains optional oci secrets + allowPlainHttpRegistries: true + secrets: {} + deployers: + - container + - helm + - manifest + deployerManagement: + namespace: {{ .Namespace }} + agent: + namespace: {{ .Namespace }} +` + + t, err := template.New("valuesTemplate").Parse(valuesTemplate) + if err != nil { + return nil, err + } + + data := struct { + Namespace string + }{ + Namespace: namespace, + } + + b := &bytes.Buffer{} + if err := t.Execute(b, data); err != nil { + return nil, fmt.Errorf("could not template helm values: %w", err) + } + + return b.Bytes(), nil +} + +// installLandscaper installs the landscaper +func installLandscaper(ctx context.Context, config *test.TestConfig) error { + landscaperValues, err := buildLandscaperValues(config.LandscaperNamespace) + if err != nil { + return fmt.Errorf("cannot template landscaper values: %w", err) + } + + tmpFile, err := ioutil.TempFile(".", "landscaper-values-") + if err != nil { + return fmt.Errorf("cannot create temporary file: %w", err) + } + defer func() { + if err := os.Remove(tmpFile.Name()); err != nil { + fmt.Printf("Cannot remove temporary file %s: %s", tmpFile.Name(), err.Error()) + } + }() + + if err := ioutil.WriteFile(tmpFile.Name(), []byte(landscaperValues), os.ModePerm); err != nil { + return fmt.Errorf("cannot write to file: %w", err) + } + + installArgs := []string{ + "--kubeconfig", + config.Kubeconfig, + "--landscaper-values", + tmpFile.Name(), + "--namespace", + config.LandscaperNamespace, + "--landscaper-chart-version", + config.LandscaperVersion, + } + installCmd := cliquickstart.NewInstallCommand(ctx) + installCmd.SetArgs(installArgs) + + if err := installCmd.Execute(); err != nil { + return fmt.Errorf("install command failed: %w", err) + } + + return nil +} + +// cleanupResources removes all landscaper and laas resource in the laas and test namespace. +// It also tries to remove all virtual cluster namespaces that are still present in the cluster. +func cleanupResources(ctx context.Context, log logr.Logger, kclient client.Client, config *test.TestConfig) error { + // LAAS Namespace + if err := util.DeleteValidatingWebhookConfiguration(ctx, kclient, "landscaper-service-validation-webhook", config.LaasNamespace); err != nil { + return err + } + + if err := util.RemoveFinalizerLandscaperResources(ctx, kclient, config.LaasNamespace); err != nil { + return err + } + + if err := util.RemoveFinalizerLaasResources(ctx, kclient, config.LaasNamespace); err != nil { + return err + } + + if err := util.CleanupLaasResources(ctx, log, kclient, config.LaasNamespace, config.SleepTime, config.MaxRetries); err != nil { + return err + } + + if err := cliutil.DeleteNamespace(kclient, config.LaasNamespace, config.SleepTime, config.MaxRetries); err != nil { + return err + } + + // Test Namespace + if err := util.RemoveFinalizerLaasResources(ctx, kclient, config.TestNamespace); err != nil { + return err + } + + if err := util.CleanupLaasResources(ctx, log, kclient, config.TestNamespace, config.SleepTime, config.MaxRetries); err != nil { + return err + } + + if err := util.RemoveFinalizerLandscaperResources(ctx, kclient, config.TestNamespace); err != nil { + return err + } + + if err := cliutil.DeleteNamespace(kclient, config.TestNamespace, config.SleepTime, config.MaxRetries); err != nil { + return err + } + + if err := util.DeleteVirtualClusterNamespaces(ctx, log, kclient, config.SleepTime, config.MaxRetries); err != nil { + return err + } + + return nil +} diff --git a/integration-test/pkg/test/test_config.go b/integration-test/pkg/test/test_config.go new file mode 100644 index 000000000..3f5e2ed0c --- /dev/null +++ b/integration-test/pkg/test/test_config.go @@ -0,0 +1,115 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package test + +import ( + "flag" + "fmt" + "time" + + "k8s.io/apimachinery/pkg/runtime" + k8serrors "k8s.io/apimachinery/pkg/util/errors" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" +) + +var ( + scheme = runtime.NewScheme() +) + +const ( + // LaasComponentDefault is the default Landscaper As A Service component name + LaasComponentDefault = "github.com/gardener/landscaper-service" + // RepoRootDir is the laas repository root directory + RepoRootDir = "./.." +) + +func init() { + utilruntime.Must(clientgoscheme.AddToScheme(scheme)) + utilruntime.Must(lsv1alpha1.AddToScheme(scheme)) + utilruntime.Must(lssv1alpha1.AddToScheme(scheme)) +} + +// TestConfig contains all the configured flags of the integration test. +type TestConfig struct { + Kubeconfig string + RegistryPullSecrets string + MaxRetries int + SleepTime time.Duration + LaasComponent string + LaasVersion string + LaasRepository string + LandscaperNamespace string + LaasNamespace string + TestNamespace string + LandscaperVersion string + ProviderType string +} + +// ParseConfig parses the TestConfig from the command line arguments. +func ParseConfig() *TestConfig { + var ( + kubeconfig, + registryPullSecrets, + laasComponent, laasVersion, LaasRepository, + landscaperNamespace, laasNamespace, testNamespace, + providerType string + maxRetries int + ) + + flag.StringVar(&kubeconfig, "kubeconfig", "", "path to the kubeconfig of the cluster") + flag.StringVar(®istryPullSecrets, "registry-secrets", "", "registry pull secrets") + flag.IntVar(&maxRetries, "max-retries", 10, "max retries (every 10s) for all waiting operations") + flag.StringVar(&laasVersion, "laas-version", "", "landscaper as a service version") + flag.StringVar(&LaasRepository, "laas-repository", "", "landscaper as a service repository url") + flag.StringVar(&laasComponent, "laas-component", LaasComponentDefault, "landscaper as a service component") + flag.StringVar(&landscaperNamespace, "landscaper-namespace", "ls-system", "name of the landscaper namespace") + flag.StringVar(&laasNamespace, "laas-namespace", "laas-system", "name of the landscaper as a service namespace") + flag.StringVar(&testNamespace, "test-namespace", "laas-test", "name of the landscaper as a service integration test namespace") + flag.StringVar(&providerType, "provider-type", "gcp", "the cloud provider of the provided kubeconfig") + flag.Parse() + + return &TestConfig{ + Kubeconfig: kubeconfig, + RegistryPullSecrets: registryPullSecrets, + MaxRetries: maxRetries, + SleepTime: 10 * time.Second, + LaasComponent: laasComponent, + LaasVersion: laasVersion, + LaasRepository: LaasRepository, + LandscaperNamespace: landscaperNamespace, + LaasNamespace: laasNamespace, + TestNamespace: testNamespace, + ProviderType: providerType, + } +} + +// VerifyConfig validates the given TestConfig. +func VerifyConfig(config *TestConfig) error { + errorList := make([]error, 0) + + if len(config.Kubeconfig) == 0 { + errorList = append(errorList, fmt.Errorf("flag \"kubeconfig\" may not be empty")) + } + if len(config.RegistryPullSecrets) == 0 { + errorList = append(errorList, fmt.Errorf("flag \"registry-secrets\" may not be empty")) + } + if len(config.LaasVersion) == 0 { + errorList = append(errorList, fmt.Errorf("flag \"laas-version\" may not be empty")) + } + if len(config.LaasRepository) == 0 { + errorList = append(errorList, fmt.Errorf("flag \"laas-repository\" may not be empty")) + } + return k8serrors.NewAggregate(errorList) +} + +// Scheme returns the integration test scheme. +func Scheme() *runtime.Scheme { + return scheme +} diff --git a/integration-test/pkg/test/test_runner.go b/integration-test/pkg/test/test_runner.go new file mode 100644 index 000000000..d34aa9843 --- /dev/null +++ b/integration-test/pkg/test/test_runner.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package test + +import ( + "context" + + "github.com/go-logr/logr" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" +) + +// SharedTestObjects holds objects that are shared between tests. +type SharedTestObjects struct { + Installations map[string]*lsv1alpha1.Installation + ServiceTargetConfigs map[string]*lssv1alpha1.ServiceTargetConfig + LandscaperDeployments map[string]*lssv1alpha1.LandscaperDeployment + HostingClusterNamespaces []string +} + +// A TestRunner implements an integration test. +type TestRunner interface { + Init(ctx context.Context, log logr.Logger, kclient client.Client, config *TestConfig, target *lsv1alpha1.Target, testObjects *SharedTestObjects) + Name() string + Run() error +} diff --git a/integration-test/pkg/tests/test_create_deployment.go b/integration-test/pkg/tests/test_create_deployment.go new file mode 100644 index 000000000..8e6545928 --- /dev/null +++ b/integration-test/pkg/tests/test_create_deployment.go @@ -0,0 +1,160 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package tests + +import ( + "context" + "crypto/sha1" + "encoding/hex" + "fmt" + + "github.com/go-logr/logr" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cliutil "github.com/gardener/landscapercli/pkg/util" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" + "github.com/gardener/landscaper-service/test/integration/pkg/test" +) + +type CreateDeploymentRunner struct { + ctx context.Context + log logr.Logger + kclient client.Client + config *test.TestConfig + target *lsv1alpha1.Target + testObjects *test.SharedTestObjects +} + +func (r *CreateDeploymentRunner) Init( + ctx context.Context, log logr.Logger, + kclient client.Client, config *test.TestConfig, + target *lsv1alpha1.Target, testObjects *test.SharedTestObjects) { + r.ctx = ctx + r.log = log.WithName(r.Name()) + r.kclient = kclient + r.config = config + r.target = target + r.testObjects = testObjects +} + +func (r *CreateDeploymentRunner) Name() string { + return "CreateDeployment" +} + +func (r *CreateDeploymentRunner) Run() error { + r.log.Info("creating landscaper deployment") + if err := r.createDeployment(); err != nil { + return err + } + return nil +} + +func (r *CreateDeploymentRunner) createDeployment() error { + deployment := &lssv1alpha1.LandscaperDeployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test", + Namespace: r.config.TestNamespace, + }, + Spec: lssv1alpha1.LandscaperDeploymentSpec{ + TenantId: createTenantId("test-tenant"), + Purpose: "integration-test", + LandscaperConfiguration: lssv1alpha1.LandscaperConfiguration{ + Deployers: []string{ + "helm", + "manifest", + }, + }, + }, + } + + if err := r.kclient.Create(r.ctx, deployment); err != nil { + return fmt.Errorf("failed to create deployment: %w", err) + } + + r.log.Info("waiting for instance being created") + + timeout, err := cliutil.CheckConditionPeriodically(func() (bool, error) { + if err := r.kclient.Get(r.ctx, types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}, deployment); err != nil { + return false, err + } + + if deployment.Status.InstanceRef != nil { + return true, nil + } + + return false, nil + }, r.config.SleepTime, r.config.MaxRetries) + + if err != nil { + return fmt.Errorf("failed to wait for instance being created: %w", err) + } + if timeout { + return fmt.Errorf("timeout while wating for instance being created") + } + + instance := &lssv1alpha1.Instance{} + + r.log.Info("waiting for installation being created") + + timeout, err = cliutil.CheckConditionPeriodically(func() (bool, error) { + if err := r.kclient.Get( + r.ctx, + types.NamespacedName{Name: deployment.Status.InstanceRef.Name, Namespace: deployment.Status.InstanceRef.Namespace}, + instance); err != nil { + + return false, err + } + + if instance.Status.InstallationRef != nil { + return true, nil + } + + return false, nil + }, r.config.SleepTime, r.config.MaxRetries) + + if err != nil { + return fmt.Errorf("failed to wait for installation being created: %w", err) + } + if timeout { + return fmt.Errorf("timeout while wating for installation being created") + } + + r.log.Info("waiting for installation being succeeded") + + timeout, err = cliutil.CheckAndWaitUntilLandscaperInstallationSucceeded( + r.kclient, + types.NamespacedName{Name: instance.Status.InstallationRef.Name, Namespace: instance.Status.InstallationRef.Namespace}, + r.config.SleepTime, + r.config.MaxRetries*10) + + if err != nil || timeout { + installation := &lsv1alpha1.Installation{} + if err := r.kclient.Get(r.ctx, types.NamespacedName{Name: instance.Status.InstallationRef.Name, Namespace: instance.Status.InstallationRef.Namespace}, installation); err == nil { + r.log.Error(fmt.Errorf("installation failed"), "installation", "last error", installation.Status.LastError) + } + } + + if err != nil { + return fmt.Errorf("installation for landscaper deployment %s failed: %w", deployment.Name, err) + } + if timeout { + return fmt.Errorf("waiting for installation of landscaper deployment %s timed out", deployment.Name) + } + + r.testObjects.LandscaperDeployments[types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}.String()] = deployment + + return nil +} + +func createTenantId(name string) string { + h := sha1.New() + id := h.Sum([]byte(name)) + return fmt.Sprintf("vc-%s", hex.EncodeToString(id[:4])) +} diff --git a/integration-test/pkg/tests/test_delete_deployment.go b/integration-test/pkg/tests/test_delete_deployment.go new file mode 100644 index 000000000..255249d4a --- /dev/null +++ b/integration-test/pkg/tests/test_delete_deployment.go @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package tests + +import ( + "context" + "fmt" + + "github.com/go-logr/logr" + + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cliutil "github.com/gardener/landscapercli/pkg/util" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" + "github.com/gardener/landscaper-service/test/integration/pkg/test" +) + +type DeleteDeploymentRunner struct { + ctx context.Context + log logr.Logger + kclient client.Client + config *test.TestConfig + target *lsv1alpha1.Target + testObjects *test.SharedTestObjects +} + +func (r *DeleteDeploymentRunner) Init( + ctx context.Context, log logr.Logger, + kclient client.Client, config *test.TestConfig, + target *lsv1alpha1.Target, testObjects *test.SharedTestObjects) { + r.ctx = ctx + r.log = log.WithName(r.Name()) + r.kclient = kclient + r.config = config + r.target = target + r.testObjects = testObjects +} + +func (r *DeleteDeploymentRunner) Name() string { + return "DeleteDeployment" +} + +func (r *DeleteDeploymentRunner) Run() error { + for _, deployment := range r.testObjects.LandscaperDeployments { + if err := r.deleteDeployment(deployment); err != nil { + return err + } + } + return nil +} + +func (r *DeleteDeploymentRunner) deleteDeployment(deployment *lssv1alpha1.LandscaperDeployment) error { + r.log.Info("deleting deployment", "name", deployment.Name) + + if err := r.kclient.Delete(r.ctx, deployment); err != nil { + return fmt.Errorf("failed to delete deployment %q: %w", deployment.Name, err) + } + + r.log.Info("waiting for deployment to be deleted", "name", deployment.Name) + timeout, err := cliutil.CheckAndWaitUntilObjectNotExistAnymore( + r.kclient, + types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}, deployment, + r.config.SleepTime, r.config.MaxRetries*5) + + if err != nil { + return fmt.Errorf("failed to wait for deployment %q to be deleted: %w", deployment.Name, err) + } + + if timeout { + return fmt.Errorf("waiting for deployment %q to be deleted timed out", deployment.Name) + } + + return nil +} diff --git a/integration-test/pkg/tests/test_install_laas.go b/integration-test/pkg/tests/test_install_laas.go new file mode 100644 index 000000000..f94d24872 --- /dev/null +++ b/integration-test/pkg/tests/test_install_laas.go @@ -0,0 +1,168 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package tests + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/go-logr/logr" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cliutil "github.com/gardener/landscapercli/pkg/util" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" + lssutils "github.com/gardener/landscaper-service/pkg/utils" + "github.com/gardener/landscaper-service/test/integration/pkg/test" +) + +type InstallLAASTestRunner struct { + ctx context.Context + log logr.Logger + kclient client.Client + config *test.TestConfig + target *lsv1alpha1.Target + testObjects *test.SharedTestObjects +} + +func (r *InstallLAASTestRunner) Init( + ctx context.Context, log logr.Logger, + kclient client.Client, config *test.TestConfig, + target *lsv1alpha1.Target, testObjects *test.SharedTestObjects) { + r.ctx = ctx + r.log = log.WithName(r.Name()) + r.kclient = kclient + r.config = config + r.target = target + r.testObjects = testObjects +} + +func (r *InstallLAASTestRunner) Name() string { + return "InstallLAAS" +} + +func (r *InstallLAASTestRunner) Run() error { + r.log.Info("creating installation") + if err := r.createInstallation(); err != nil { + return err + } + + r.log.Info("creating service target config") + if err := r.createServiceTargetConfig(); err != nil { + return err + } + + return nil +} + +func (r *InstallLAASTestRunner) createServiceTargetConfig() error { + serviceTargetConfig := &lssv1alpha1.ServiceTargetConfig{ + ObjectMeta: metav1.ObjectMeta{ + Name: "default-target", + Namespace: r.config.LaasNamespace, + Labels: map[string]string{ + lssv1alpha1.ServiceTargetConfigVisibleLabelName: "true", + }, + }, + Spec: lssv1alpha1.ServiceTargetConfigSpec{ + ProviderType: r.config.ProviderType, + Priority: 0, + SecretRef: lssv1alpha1.SecretReference{ + ObjectReference: lssv1alpha1.ObjectReference{ + Name: r.target.Name, + Namespace: r.config.LaasNamespace, + }, + Key: "kubeconfig", + }, + }, + } + + if err := r.kclient.Create(r.ctx, serviceTargetConfig); err != nil { + return fmt.Errorf("failed to create service target config: %w", err) + } + + r.testObjects.ServiceTargetConfigs[types.NamespacedName{Name: serviceTargetConfig.Name, Namespace: serviceTargetConfig.Namespace}.String()] = serviceTargetConfig + + return nil +} + +func (r *InstallLAASTestRunner) createInstallation() error { + registryPullSecrets := []lssv1alpha1.ObjectReference{ + { + Name: "laas", + Namespace: r.config.LaasNamespace, + }, + } + + registryPullSecretsRaw, err := json.Marshal(registryPullSecrets) + if err != nil { + return fmt.Errorf("failed to marshal registry pull secrets: %w", err) + } + + installation := &lsv1alpha1.Installation{ + ObjectMeta: metav1.ObjectMeta{ + Name: "laas", + Namespace: r.config.LaasNamespace, + }, + Spec: lsv1alpha1.InstallationSpec{ + Context: "laas", + ComponentDescriptor: &lsv1alpha1.ComponentDescriptorDefinition{ + Reference: &lsv1alpha1.ComponentDescriptorReference{ + RepositoryContext: cdv2.NewUnstructuredType(cdv2.OCIRegistryType, map[string]interface{}{ + "baseUrl": r.config.LaasRepository, + }), + ComponentName: r.config.LaasComponent, + Version: r.config.LaasVersion, + }, + }, + Blueprint: lsv1alpha1.BlueprintDefinition{ + Reference: &lsv1alpha1.RemoteBlueprintReference{ + ResourceName: "landscaper-service-blueprint", + }, + }, + Imports: lsv1alpha1.InstallationImports{ + Targets: []lsv1alpha1.TargetImport{ + { + Name: "targetCluster", + Target: fmt.Sprintf("#%s", r.target.Name), + }, + }, + }, + ImportDataMappings: map[string]lsv1alpha1.AnyJSON{ + "namespace": lssutils.StringToAnyJSON(r.config.LaasNamespace), + "verbosity": lssutils.IntToAnyJSON(5), + "registryPullSecrets": lsv1alpha1.NewAnyJSON(registryPullSecretsRaw), + }, + }, + } + + if err := r.kclient.Create(r.ctx, installation); err != nil { + return fmt.Errorf("failed to create installation: %w", err) + } + + timeout, err := cliutil.CheckAndWaitUntilLandscaperInstallationSucceeded(r.kclient, types.NamespacedName{Name: installation.Name, Namespace: installation.Namespace}, r.config.SleepTime, r.config.MaxRetries) + if err != nil || timeout { + if err := r.kclient.Get(r.ctx, types.NamespacedName{Name: installation.Name, Namespace: installation.Namespace}, installation); err == nil { + r.log.Error(fmt.Errorf("installation failed"), "installation", "last error", installation.Status.LastError) + } + } + + if err != nil { + return fmt.Errorf("failed to wait for installation to be ready: %w", err) + } + if timeout { + return fmt.Errorf("waiting for installation timed out") + } + + r.testObjects.Installations[types.NamespacedName{Name: installation.Name, Namespace: installation.Namespace}.String()] = installation + + return nil +} diff --git a/integration-test/pkg/tests/test_uninstall_laas.go b/integration-test/pkg/tests/test_uninstall_laas.go new file mode 100644 index 000000000..bf5373ffe --- /dev/null +++ b/integration-test/pkg/tests/test_uninstall_laas.go @@ -0,0 +1,93 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package tests + +import ( + "context" + "fmt" + + "github.com/go-logr/logr" + + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cliutil "github.com/gardener/landscapercli/pkg/util" + + "github.com/gardener/landscaper-service/test/integration/pkg/test" +) + +type UninstallLAASTestRunner struct { + ctx context.Context + log logr.Logger + kclient client.Client + config *test.TestConfig + target *lsv1alpha1.Target + testObjects *test.SharedTestObjects +} + +func (r *UninstallLAASTestRunner) Init( + ctx context.Context, log logr.Logger, + kclient client.Client, config *test.TestConfig, + target *lsv1alpha1.Target, testObjects *test.SharedTestObjects) { + r.ctx = ctx + r.log = log.WithName(r.Name()) + r.kclient = kclient + r.config = config + r.target = target + r.testObjects = testObjects +} + +func (r *UninstallLAASTestRunner) Name() string { + return "UninstallLAAS" +} + +func (r *UninstallLAASTestRunner) Run() error { + r.log.Info("deleting default service target config") + if err := r.deleteServiceTargetConfig(); err != nil { + return err + } + + r.log.Info("deleting laas installation") + if err := r.deleteInstallation(); err != nil { + return err + } + + return nil +} + +func (r *UninstallLAASTestRunner) deleteServiceTargetConfig() error { + serviceTargetConfig := r.testObjects.ServiceTargetConfigs[types.NamespacedName{Name: "default-target", Namespace: r.config.LaasNamespace}.String()] + + if err := r.kclient.Delete(r.ctx, serviceTargetConfig); err != nil { + return fmt.Errorf("failed to delete service target config: %w", err) + } + + return nil +} + +func (r *UninstallLAASTestRunner) deleteInstallation() error { + installation := r.testObjects.Installations[types.NamespacedName{Name: "laas", Namespace: r.config.LaasNamespace}.String()] + + if err := r.kclient.Delete(r.ctx, installation); err != nil { + return fmt.Errorf("failed to delete laas installation: %w", err) + } + + timeout, err := cliutil.CheckAndWaitUntilObjectNotExistAnymore( + r.kclient, + types.NamespacedName{Name: installation.Name, Namespace: installation.Namespace}, + installation, + r.config.SleepTime, + r.config.MaxRetries) + + if err != nil { + return fmt.Errorf("failed to wait for laas installation to be deleted: %w", err) + } + if timeout { + return fmt.Errorf("waiting for laas installation to be deleted timed out") + } + + return nil +} diff --git a/integration-test/pkg/tests/test_update_deployment.go b/integration-test/pkg/tests/test_update_deployment.go new file mode 100644 index 000000000..c56732239 --- /dev/null +++ b/integration-test/pkg/tests/test_update_deployment.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package tests + +import ( + "context" + "fmt" + "time" + + "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cliutil "github.com/gardener/landscapercli/pkg/util" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" + "github.com/gardener/landscaper-service/test/integration/pkg/test" +) + +type UpdateDeploymentRunner struct { + ctx context.Context + log logr.Logger + kclient client.Client + config *test.TestConfig + target *lsv1alpha1.Target + testObjects *test.SharedTestObjects +} + +func (r *UpdateDeploymentRunner) Init( + ctx context.Context, log logr.Logger, + kclient client.Client, config *test.TestConfig, + target *lsv1alpha1.Target, testObjects *test.SharedTestObjects) { + r.ctx = ctx + r.log = log.WithName(r.Name()) + r.kclient = kclient + r.config = config + r.target = target + r.testObjects = testObjects +} + +func (r *UpdateDeploymentRunner) Name() string { + return "UpdateDeployment" +} + +func (r *UpdateDeploymentRunner) Run() error { + for _, deployment := range r.testObjects.LandscaperDeployments { + if err := r.updateDeployment(deployment); err != nil { + return err + } + } + + return nil +} + +func (r *UpdateDeploymentRunner) updateDeployment(deployment *lssv1alpha1.LandscaperDeployment) error { + r.log.Info("updating deployment", "name", deployment.Name) + deployment.Spec.LandscaperConfiguration.Deployers = append(deployment.Spec.LandscaperConfiguration.Deployers, "container") + + if err := r.kclient.Update(r.ctx, deployment); err != nil { + return fmt.Errorf("failed to update deployment %q: %w", deployment.Name, err) + } + + instance := &lssv1alpha1.Instance{} + if err := r.kclient.Get( + r.ctx, + types.NamespacedName{Name: deployment.Status.InstanceRef.Name, Namespace: deployment.Status.InstanceRef.Namespace}, + instance); err != nil { + return fmt.Errorf("failed to retrieve instance for deployment %q: %w", deployment.Name, err) + } + + // waiting for a state change, because installations are already succeeded + time.Sleep(10 * time.Second) + + r.log.Info("waiting for installation being succeeded") + + timeout, err := cliutil.CheckAndWaitUntilLandscaperInstallationSucceeded( + r.kclient, + types.NamespacedName{Name: instance.Status.InstallationRef.Name, Namespace: instance.Status.InstallationRef.Namespace}, + r.config.SleepTime, + r.config.MaxRetries*10) + + if err != nil { + return fmt.Errorf("installation for landscaper deployment %s failed: %w", deployment.Name, err) + } + if timeout { + return fmt.Errorf("waiting for installation of landscaper deployment %s timed out", deployment.Name) + } + + r.testObjects.LandscaperDeployments[types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}.String()] = deployment + return nil +} diff --git a/integration-test/pkg/tests/test_verify_delete.go b/integration-test/pkg/tests/test_verify_delete.go new file mode 100644 index 000000000..86bc30dfb --- /dev/null +++ b/integration-test/pkg/tests/test_verify_delete.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package tests + +import ( + "context" + "fmt" + + "github.com/go-logr/logr" + + corev1 "k8s.io/api/core/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + + "github.com/gardener/landscaper-service/test/integration/pkg/test" +) + +type VerifyDeleteRunner struct { + ctx context.Context + log logr.Logger + kclient client.Client + config *test.TestConfig + target *lsv1alpha1.Target + testObjects *test.SharedTestObjects +} + +func (r *VerifyDeleteRunner) Init( + ctx context.Context, log logr.Logger, + kclient client.Client, config *test.TestConfig, + target *lsv1alpha1.Target, testObjects *test.SharedTestObjects) { + r.ctx = ctx + r.log = log.WithName(r.Name()) + r.kclient = kclient + r.config = config + r.target = target + r.testObjects = testObjects +} + +func (r *VerifyDeleteRunner) Name() string { + return "VerifyDelete" +} + +func (r *VerifyDeleteRunner) Run() error { + for _, namespace := range r.testObjects.HostingClusterNamespaces { + if err := r.verifyNamespace(namespace); err != nil { + return err + } + } + return nil +} + +func (r *VerifyDeleteRunner) verifyNamespace(namespace string) error { + r.log.Info("verifying namespace", "name", namespace) + + pvcList := &corev1.PersistentVolumeClaimList{} + if err := r.kclient.List(r.ctx, pvcList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list persistent volume claims in namespace %q: %w", namespace, err) + } + + if len(pvcList.Items) > 0 { + return fmt.Errorf("there are persistent volume claims existing in namespace %q", namespace) + } + + podList := &corev1.PodList{} + if err := r.kclient.List(r.ctx, podList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list pods in namespace %q: %w", namespace, err) + } + + if len(podList.Items) > 0 { + return fmt.Errorf("there are pods existing in namespace %q", namespace) + } + + serviceList := &corev1.ServiceList{} + if err := r.kclient.List(r.ctx, serviceList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list services in namespace %q: %w", namespace, err) + } + + if len(serviceList.Items) > 0 { + return fmt.Errorf("there are services existing in namespace %q", namespace) + } + + return nil +} diff --git a/integration-test/pkg/tests/test_verify_deployment.go b/integration-test/pkg/tests/test_verify_deployment.go new file mode 100644 index 000000000..473f015a8 --- /dev/null +++ b/integration-test/pkg/tests/test_verify_deployment.go @@ -0,0 +1,202 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package tests + +import ( + "context" + "encoding/base64" + "encoding/json" + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/go-logr/logr" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/tools/clientcmd" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cliutil "github.com/gardener/landscapercli/pkg/util" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" + "github.com/gardener/landscaper-service/test/integration/pkg/test" +) + +type VerifyDeploymentRunner struct { + ctx context.Context + log logr.Logger + kclient client.Client + config *test.TestConfig + target *lsv1alpha1.Target + testObjects *test.SharedTestObjects +} + +func (r *VerifyDeploymentRunner) Init( + ctx context.Context, log logr.Logger, + kclient client.Client, config *test.TestConfig, + target *lsv1alpha1.Target, testObjects *test.SharedTestObjects) { + r.ctx = ctx + r.log = log.WithName(r.Name()) + r.kclient = kclient + r.config = config + r.target = target + r.testObjects = testObjects +} + +func (r *VerifyDeploymentRunner) Name() string { + return "VerifyDeployment" +} + +func (r *VerifyDeploymentRunner) Run() error { + for _, deployment := range r.testObjects.LandscaperDeployments { + if err := r.verifyDeployment(deployment); err != nil { + return err + } + } + return nil +} + +func (r *VerifyDeploymentRunner) verifyDeployment(deployment *lssv1alpha1.LandscaperDeployment) error { + instance := &lssv1alpha1.Instance{} + if err := r.kclient.Get( + r.ctx, + types.NamespacedName{Name: deployment.Status.InstanceRef.Name, Namespace: deployment.Status.InstanceRef.Namespace}, + instance); err != nil { + return fmt.Errorf("failed to get instance for deployment %q: %w", deployment.Name, err) + } + + installation := &lsv1alpha1.Installation{} + if err := r.kclient.Get( + r.ctx, + types.NamespacedName{Name: instance.Status.InstallationRef.Name, Namespace: instance.Status.InstallationRef.Namespace}, + installation); err != nil { + return fmt.Errorf("failed to get installation for instance %q: %w", instance.Name, err) + } + + hostingClusterNamespaceRaw, ok := installation.Spec.ImportDataMappings["hostingClusterNamespace"] + + if !ok { + return fmt.Errorf("installation has no hostingClusterNamespace setting") + } + + var hostingClusterNamespace string + if err := json.Unmarshal(hostingClusterNamespaceRaw.RawMessage, &hostingClusterNamespace); err != nil { + return fmt.Errorf("failed to unmarshal hostingClusterNamespace: %w", err) + } + + if err := r.verifyPods(hostingClusterNamespace, len(instance.Spec.LandscaperConfiguration.Deployers)); err != nil { + return err + } + + if err := r.verifyKubeconfig(instance); err != nil { + return err + } + + r.testObjects.HostingClusterNamespaces = append(r.testObjects.HostingClusterNamespaces, hostingClusterNamespace) + + return nil +} + +func (r *VerifyDeploymentRunner) verifyPods(namespace string, numDeployers int) error { + expectedPods := []string{ + "landscaper-controller", + "landscaper-webhooks", + "etcd-main", + "etcd-events", + "apiserver", + "controller-manager,", + } + + r.log.Info("waiting for pods to be created") + + podList := &corev1.PodList{} + timeout, err := cliutil.CheckConditionPeriodically(func() (bool, error) { + if err := r.kclient.List(r.ctx, podList, &client.ListOptions{Namespace: namespace}); err != nil { + return false, fmt.Errorf("failed to list pods in namespace %q: %w", namespace, err) + } + if len(podList.Items) >= (len(expectedPods) + numDeployers) { + return true, nil + } + return false, nil + }, r.config.SleepTime, r.config.MaxRetries*5) + + if err != nil { + return err + } + if timeout { + return fmt.Errorf("incomplete number pods in namespace %q, expected %d, actual %d", namespace, len(expectedPods)+numDeployers, len(podList.Items)) + } + + r.log.Info("waiting for pods to become running") + + timeout, err = cliutil.CheckConditionPeriodically(func() (bool, error) { + if err := r.kclient.List(r.ctx, podList, &client.ListOptions{Namespace: namespace}); err != nil { + return false, fmt.Errorf("failed to list pods in namespace %q: %w", namespace, err) + } + + for _, pod := range podList.Items { + if pod.Status.Phase != corev1.PodRunning { + return false, nil + } + } + + return true, nil + }, r.config.SleepTime, r.config.MaxRetries) + + if err != nil { + return err + } + if timeout { + return fmt.Errorf("not all pods in namespace %q are running", namespace) + } + + return nil +} + +func (r *VerifyDeploymentRunner) verifyKubeconfig(instance *lssv1alpha1.Instance) error { + r.log.Info("verifying kubeconfig for instance", "name", instance.Name) + + kubeconfig, err := base64.StdEncoding.DecodeString(instance.Status.ClusterKubeconfig) + if err != nil { + return fmt.Errorf("failed to decode kubeconfig of instance %q: %w", instance.Name, err) + } + + laasClientCfg, err := clientcmd.Load(kubeconfig) + if err != nil { + return fmt.Errorf("failed to load kubeconfig of instance %q: %w", instance.Name, err) + } + + loader := clientcmd.NewDefaultClientConfig(*laasClientCfg, nil) + laasRestConfig, err := loader.ClientConfig() + if err != nil { + return fmt.Errorf("failed to load rest config of instance %q: %err", instance.Name, err) + } + + laasClient, err := client.New(laasRestConfig, client.Options{ + Scheme: test.Scheme(), + }) + if err != nil { + return fmt.Errorf("failed create client for instance %q: %err", instance.Name, err) + } + + namespace := &corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + GenerateName: "itest-", + }, + } + + if err := laasClient.Create(r.ctx, namespace); err != nil { + return fmt.Errorf("failed to create namespace on cluster for instance %q: %w", instance.Name, err) + } + + installationList := &lsv1alpha1.InstallationList{} + if err := laasClient.List(r.ctx, installationList, &client.ListOptions{Namespace: namespace.Name}); err != nil { + return fmt.Errorf("failed to list installations on cluster for instance %q: %w", instance.Name, err) + } + + return nil +} diff --git a/integration-test/pkg/util/util.go b/integration-test/pkg/util/util.go new file mode 100644 index 000000000..19d8e11b2 --- /dev/null +++ b/integration-test/pkg/util/util.go @@ -0,0 +1,450 @@ +// SPDX-FileCopyrightText: 2022 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package util + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "path" + "strings" + "time" + + "github.com/go-logr/logr" + + admissionv1 "k8s.io/api/admissionregistration/v1" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + k8serrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/json" + "k8s.io/apimachinery/pkg/util/yaml" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cliinstallations "github.com/gardener/landscapercli/cmd/installations" + cliutil "github.com/gardener/landscapercli/pkg/util" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" +) + +// GetLandscaperVersion reads the landscaper version out of the LAAS component descriptor +func GetLandscaperVersion(repoRootDir string) (string, error) { + + var landscaperVersion string + + compReferencesFile := path.Join(repoRootDir, ".landscaper", "component-references.yaml") + raw, err := ioutil.ReadFile(compReferencesFile) + if err != nil { + return "", err + } + + r := bytes.NewReader(raw) + dec := yaml.NewYAMLOrJSONDecoder(r, 1024) + + var componentReferences map[string]interface{} + for dec.Decode(&componentReferences) == nil { + name, ok := componentReferences["name"] + if !ok { + continue + } + if name != "landscaper-service" { + continue + } + version, ok := componentReferences["version"] + if !ok { + continue + } + landscaperVersion = version.(string) + break + } + + if len(landscaperVersion) == 0 { + return "", fmt.Errorf("landscaper version not found") + } + + return landscaperVersion, nil +} + +// ForceDeleteInstallations calls landscaper-cli force delete on the given namespace. +func ForceDeleteInstallations(ctx context.Context, log logr.Logger, kclient client.Client, kubeConfig, namespace string) error { + installationList := &lsv1alpha1.InstallationList{} + if err := kclient.List(ctx, installationList, &client.ListOptions{Namespace: namespace}); err != nil { + return err + } + + for _, installation := range installationList.Items { + if err := kclient.Get(ctx, types.NamespacedName{Name: installation.Name, Namespace: installation.Namespace}, &installation); err != nil { + if k8serrors.IsNotFound(err) { + continue + } + return err + } + + log.Info("Deleting installation", "name", installation.Name) + forceDeleteCommand := cliinstallations.NewForceDeleteCommand(ctx) + forceDeleteCommand.SetArgs([]string{ + installation.Name, + "--kubeconfig", + kubeConfig, + "--namespace", + namespace, + }) + if err := forceDeleteCommand.Execute(); err != nil { + return err + } + } + + return nil +} + +// CleanupLaasResources tries to remove all landscaper deployments, instances and service target configs in the given namespace. +func CleanupLaasResources(ctx context.Context, log logr.Logger, kclient client.Client, namespace string, sleepTime time.Duration, maxRetries int) error { + deploymentList := &lssv1alpha1.LandscaperDeploymentList{} + if err := kclient.List(ctx, deploymentList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list landscaper deployments: %w", err) + } + + for _, deployment := range deploymentList.Items { + log.Info("Deleting landscaper deployment", "name", deployment.Name) + if err := kclient.Delete(ctx, &deployment); err != nil { + if !k8serrors.IsNotFound(err) { + return fmt.Errorf("failed to delete landscaper deployment %q: %w", deployment.Name, err) + } + } + _, err := cliutil.CheckAndWaitUntilObjectNotExistAnymore( + kclient, + types.NamespacedName{Name: deployment.Name, Namespace: deployment.Namespace}, + &deployment, sleepTime, maxRetries) + + if err != nil { + return fmt.Errorf("failed to wait for landscaper deployment %q to be deleted: %w", deployment.Name, err) + } + } + + serviceTargetConfigList := &lssv1alpha1.ServiceTargetConfigList{} + if err := kclient.List(ctx, serviceTargetConfigList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list service target configs: %w", err) + } + + for _, serviceTargetConfig := range serviceTargetConfigList.Items { + log.Info("Deleting service target config", "name", serviceTargetConfig.Name) + if err := kclient.Delete(ctx, &serviceTargetConfig); err != nil { + if !k8serrors.IsNotFound(err) { + return fmt.Errorf("failed to delete service target config %q: %w", serviceTargetConfig.Name, err) + } + } + _, err := cliutil.CheckAndWaitUntilObjectNotExistAnymore( + kclient, + types.NamespacedName{Name: serviceTargetConfig.Name, Namespace: serviceTargetConfig.Namespace}, + &serviceTargetConfig, sleepTime, maxRetries) + + if err != nil { + return fmt.Errorf("failed to wait for service target config %q to be deleted: %w", serviceTargetConfig.Name, err) + } + } + + return nil +} + +// FinalizerPatch removes the finalizer of the given object. +type FinalizerPatch struct { + Patch map[string]interface{} +} + +func (FinalizerPatch) Type() types.PatchType { + return types.MergePatchType +} + +func (FinalizerPatch) Data(_ client.Object) ([]byte, error) { + patch := map[string]interface{}{ + "metadata": map[string]interface{}{ + "finalizers": nil, + }, + } + + patchRaw, err := json.Marshal(patch) + if err != nil { + return nil, fmt.Errorf("failed to marshal patch: %w", err) + } + + return patchRaw, nil +} + +// RemoveFinalizerLandscaperResources removes the finalizer of all landscaper resources in the given namespace. +func RemoveFinalizerLandscaperResources(ctx context.Context, kclient client.Client, namespace string) error { + patch := FinalizerPatch{} + + podList := &corev1.PodList{} + if err := kclient.List(ctx, podList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list pods: %w", err) + } + + for _, pod := range podList.Items { + if err := kclient.Patch(ctx, &pod, patch); err != nil { + return fmt.Errorf("failed to patch pod %q: %w", pod.Name, err) + } + } + + installationList := &lsv1alpha1.InstallationList{} + if err := kclient.List(ctx, installationList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list installations: %w", err) + } + + for _, installation := range installationList.Items { + if err := kclient.Patch(ctx, &installation, patch); err != nil { + return fmt.Errorf("failed to patch installation %q: %w", installation.Name, err) + } + } + + executionList := &lsv1alpha1.ExecutionList{} + if err := kclient.List(ctx, executionList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list executions: %w", err) + } + + for _, execution := range executionList.Items { + if err := kclient.Patch(ctx, &execution, patch); err != nil { + return fmt.Errorf("failed to patch execution %q: %w", execution.Name, err) + } + } + + deployItemList := &lsv1alpha1.DeployItemList{} + if err := kclient.List(ctx, deployItemList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list deploy items: %w", err) + } + + for _, deployItem := range deployItemList.Items { + if err := kclient.Patch(ctx, &deployItem, patch); err != nil { + return fmt.Errorf("failed to patch deploy item %q: %w", deployItem.Name, err) + } + } + + return nil +} + +// RemoveFinalizerLaasResources removes the finalizer of all laas resources in the given namespace. +func RemoveFinalizerLaasResources(ctx context.Context, kclient client.Client, namespace string) error { + patch := FinalizerPatch{} + + deploymentList := &lssv1alpha1.LandscaperDeploymentList{} + if err := kclient.List(ctx, deploymentList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list landscaper deployments: %w", err) + } + + for _, deployment := range deploymentList.Items { + if err := kclient.Patch(ctx, &deployment, patch); err != nil { + return fmt.Errorf("failed to patch landscaper deployment: %w", err) + } + } + + instanceList := &lssv1alpha1.InstanceList{} + if err := kclient.List(ctx, instanceList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list instances: %w", err) + } + + for _, instance := range instanceList.Items { + if err := kclient.Patch(ctx, &instance, patch); err != nil { + return fmt.Errorf("failed to patch instance: %w", err) + } + } + + serviceTargetConfigList := &lssv1alpha1.ServiceTargetConfigList{} + if err := kclient.List(ctx, serviceTargetConfigList, &client.ListOptions{Namespace: namespace}); err != nil { + return fmt.Errorf("failed to list service target configs: %w", err) + } + + for _, serviceTargetConfig := range serviceTargetConfigList.Items { + if err := kclient.Patch(ctx, &serviceTargetConfig, patch); err != nil { + return fmt.Errorf("failed to patch service target config: %w", err) + } + } + + return nil +} + +// DeleteValidatingWebhookConfiguration deletes the validating webhook configuration of the given name in the given namespace. +func DeleteValidatingWebhookConfiguration(ctx context.Context, kclient client.Client, name, namespace string) error { + validationConfig := &admissionv1.ValidatingWebhookConfiguration{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + } + + if err := kclient.Delete(ctx, validationConfig); err != nil { + if !k8serrors.IsNotFound(err) { + return fmt.Errorf("failed to delete validating webhook configuration %s/%s: %w", name, namespace, err) + } + } + + return nil +} + +// DeleteVirtualClusterNamespaces tries to delete all virtual cluster namespaces in the cluster. +func DeleteVirtualClusterNamespaces(ctx context.Context, log logr.Logger, kclient client.Client, sleepTime time.Duration, maxRetries int) error { + namespaces := &corev1.NamespaceList{} + + if err := kclient.List(ctx, namespaces); err != nil { + return fmt.Errorf("failed to list namespaces: %w", err) + } + + for _, namespace := range namespaces.Items { + if strings.HasPrefix(namespace.Name, "vc-") { + log.Info("pruning namespace", "name", namespace.Name) + + if err := RemoveFinalizerLandscaperResources(ctx, kclient, namespace.Name); err != nil { + return fmt.Errorf("failed to remove finalizers for landscaper resources in namespace %q: %w", namespace.Name, err) + } + + deployment := &appsv1.Deployment{} + if err := kclient.DeleteAllOf(ctx, deployment, &client.DeleteAllOfOptions{ + ListOptions: client.ListOptions{ + Namespace: namespace.Name, + }, + DeleteOptions: client.DeleteOptions{}, + }); err != nil { + return fmt.Errorf("failed to delete deployments in namespace %q: %w", namespace.Name, err) + } + + statefulSet := &appsv1.StatefulSet{} + if err := kclient.DeleteAllOf(ctx, statefulSet, &client.DeleteAllOfOptions{ + ListOptions: client.ListOptions{ + Namespace: namespace.Name, + }, + DeleteOptions: client.DeleteOptions{}, + }); err != nil { + return fmt.Errorf("failed to delete stateful sets in namespace %q: %w", namespace.Name, err) + } + + pod := &corev1.Pod{} + if err := kclient.DeleteAllOf(ctx, pod, &client.DeleteAllOfOptions{ + ListOptions: client.ListOptions{ + Namespace: namespace.Name, + }, + DeleteOptions: client.DeleteOptions{}, + }); err != nil { + return fmt.Errorf("failed to delete pods sets in namespace %q: %w", namespace.Name, err) + } + + pvc := &corev1.PersistentVolumeClaim{} + if err := kclient.DeleteAllOf(ctx, pvc, &client.DeleteAllOfOptions{ + ListOptions: client.ListOptions{ + Namespace: namespace.Name, + }, + DeleteOptions: client.DeleteOptions{}, + }); err != nil { + return fmt.Errorf("failed to delete persistent volume clains in namespace %q: %w", namespace.Name, err) + } + + log.Info("deleting namespace", "name", namespace.Name) + err := cliutil.DeleteNamespace(kclient, namespace.Name, sleepTime, maxRetries) + if err != nil { + return fmt.Errorf("failed to delete namespace %q: %w", namespace.Name, err) + } + } + } + + return nil +} + +// BuildKubernetesClusterTarget builds a landscaper target of the given kubeconfig in the given namespace. +func BuildKubernetesClusterTarget(ctx context.Context, kclient client.Client, kubeConfig, namespace string) (*lsv1alpha1.Target, error) { + kubeConfigContent, err := ioutil.ReadFile(kubeConfig) + if err != nil { + return nil, fmt.Errorf("cannot read kubeconfig: %w", err) + } + + secret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "default-target", + Namespace: namespace, + }, + Type: corev1.SecretTypeOpaque, + StringData: map[string]string{ + "kubeconfig": string(kubeConfigContent), + }, + } + + if err := kclient.Create(ctx, secret); err != nil { + return nil, fmt.Errorf("failed to create default target secret: %w", err) + } + + targetConfig := map[string]interface{}{ + "kubeconfig": map[string]interface{}{ + "secretRef": map[string]interface{}{ + "name": "default-target", + "namespace": namespace, + "key": "kubeconfig", + }, + }, + } + + targetConfigRaw, err := json.Marshal(targetConfig) + if err != nil { + return nil, fmt.Errorf("failed to marshal target config: %w", err) + } + + target := &lsv1alpha1.Target{ + ObjectMeta: metav1.ObjectMeta{ + Name: "default-target", + Namespace: namespace, + }, + Spec: lsv1alpha1.TargetSpec{ + Type: lsv1alpha1.KubernetesClusterTargetType, + Configuration: lsv1alpha1.NewAnyJSON(targetConfigRaw), + }, + } + + if err := kclient.Create(ctx, target); err != nil { + return nil, fmt.Errorf("failed to create default target: %w", err) + } + + return target, nil +} + +// BuildLandscaperContext builds a landscaper context containing the given registry pull secrets in the given namespace. +func BuildLandscaperContext(ctx context.Context, kclient client.Client, registryPullSecretsFile, name string, namespaces ...string) error { + registryPullSecrets, err := ioutil.ReadFile(registryPullSecretsFile) + if err != nil { + return fmt.Errorf("failed to read registry pull secret: %w", err) + } + + for _, namespace := range namespaces { + secret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + StringData: map[string]string{ + corev1.DockerConfigJsonKey: string(registryPullSecrets), + }, + Type: corev1.SecretTypeDockerConfigJson, + } + + if err := kclient.Create(ctx, secret); err != nil { + return fmt.Errorf("failed to create dockerconfigjson secret: %w", err) + } + + landscaperContext := &lsv1alpha1.Context{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + RegistryPullSecrets: []corev1.LocalObjectReference{ + { + Name: name, + }, + }, + } + + if err := kclient.Create(ctx, landscaperContext); err != nil { + return fmt.Errorf("failed to create landscaper context: %w", err) + } + } + + return nil +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/.gitignore b/integration-test/vendor/github.com/Microsoft/go-winio/.gitignore new file mode 100644 index 000000000..b883f1fdc --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/.gitignore @@ -0,0 +1 @@ +*.exe diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/CODEOWNERS b/integration-test/vendor/github.com/Microsoft/go-winio/CODEOWNERS new file mode 100644 index 000000000..ae1b4942b --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/CODEOWNERS @@ -0,0 +1 @@ + * @microsoft/containerplat diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/LICENSE b/integration-test/vendor/github.com/Microsoft/go-winio/LICENSE new file mode 100644 index 000000000..b8b569d77 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/README.md b/integration-test/vendor/github.com/Microsoft/go-winio/README.md new file mode 100644 index 000000000..60c93fe50 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/README.md @@ -0,0 +1,22 @@ +# go-winio [![Build Status](https://github.com/microsoft/go-winio/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/go-winio/actions/workflows/ci.yml) + +This repository contains utilities for efficiently performing Win32 IO operations in +Go. Currently, this is focused on accessing named pipes and other file handles, and +for using named pipes as a net transport. + +This code relies on IO completion ports to avoid blocking IO on system threads, allowing Go +to reuse the thread to schedule another goroutine. This limits support to Windows Vista and +newer operating systems. This is similar to the implementation of network sockets in Go's net +package. + +Please see the LICENSE file for licensing information. + +This project has adopted the [Microsoft Open Source Code of +Conduct](https://opensource.microsoft.com/codeofconduct/). For more information +see the [Code of Conduct +FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact +[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional +questions or comments. + +Thanks to natefinch for the inspiration for this library. See https://github.com/natefinch/npipe +for another named pipe implementation. diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/backup.go b/integration-test/vendor/github.com/Microsoft/go-winio/backup.go new file mode 100644 index 000000000..2be34af43 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/backup.go @@ -0,0 +1,280 @@ +// +build windows + +package winio + +import ( + "encoding/binary" + "errors" + "fmt" + "io" + "io/ioutil" + "os" + "runtime" + "syscall" + "unicode/utf16" +) + +//sys backupRead(h syscall.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) = BackupRead +//sys backupWrite(h syscall.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) = BackupWrite + +const ( + BackupData = uint32(iota + 1) + BackupEaData + BackupSecurity + BackupAlternateData + BackupLink + BackupPropertyData + BackupObjectId + BackupReparseData + BackupSparseBlock + BackupTxfsData +) + +const ( + StreamSparseAttributes = uint32(8) +) + +const ( + WRITE_DAC = 0x40000 + WRITE_OWNER = 0x80000 + ACCESS_SYSTEM_SECURITY = 0x1000000 +) + +// BackupHeader represents a backup stream of a file. +type BackupHeader struct { + Id uint32 // The backup stream ID + Attributes uint32 // Stream attributes + Size int64 // The size of the stream in bytes + Name string // The name of the stream (for BackupAlternateData only). + Offset int64 // The offset of the stream in the file (for BackupSparseBlock only). +} + +type win32StreamId struct { + StreamId uint32 + Attributes uint32 + Size uint64 + NameSize uint32 +} + +// BackupStreamReader reads from a stream produced by the BackupRead Win32 API and produces a series +// of BackupHeader values. +type BackupStreamReader struct { + r io.Reader + bytesLeft int64 +} + +// NewBackupStreamReader produces a BackupStreamReader from any io.Reader. +func NewBackupStreamReader(r io.Reader) *BackupStreamReader { + return &BackupStreamReader{r, 0} +} + +// Next returns the next backup stream and prepares for calls to Read(). It skips the remainder of the current stream if +// it was not completely read. +func (r *BackupStreamReader) Next() (*BackupHeader, error) { + if r.bytesLeft > 0 { + if s, ok := r.r.(io.Seeker); ok { + // Make sure Seek on io.SeekCurrent sometimes succeeds + // before trying the actual seek. + if _, err := s.Seek(0, io.SeekCurrent); err == nil { + if _, err = s.Seek(r.bytesLeft, io.SeekCurrent); err != nil { + return nil, err + } + r.bytesLeft = 0 + } + } + if _, err := io.Copy(ioutil.Discard, r); err != nil { + return nil, err + } + } + var wsi win32StreamId + if err := binary.Read(r.r, binary.LittleEndian, &wsi); err != nil { + return nil, err + } + hdr := &BackupHeader{ + Id: wsi.StreamId, + Attributes: wsi.Attributes, + Size: int64(wsi.Size), + } + if wsi.NameSize != 0 { + name := make([]uint16, int(wsi.NameSize/2)) + if err := binary.Read(r.r, binary.LittleEndian, name); err != nil { + return nil, err + } + hdr.Name = syscall.UTF16ToString(name) + } + if wsi.StreamId == BackupSparseBlock { + if err := binary.Read(r.r, binary.LittleEndian, &hdr.Offset); err != nil { + return nil, err + } + hdr.Size -= 8 + } + r.bytesLeft = hdr.Size + return hdr, nil +} + +// Read reads from the current backup stream. +func (r *BackupStreamReader) Read(b []byte) (int, error) { + if r.bytesLeft == 0 { + return 0, io.EOF + } + if int64(len(b)) > r.bytesLeft { + b = b[:r.bytesLeft] + } + n, err := r.r.Read(b) + r.bytesLeft -= int64(n) + if err == io.EOF { + err = io.ErrUnexpectedEOF + } else if r.bytesLeft == 0 && err == nil { + err = io.EOF + } + return n, err +} + +// BackupStreamWriter writes a stream compatible with the BackupWrite Win32 API. +type BackupStreamWriter struct { + w io.Writer + bytesLeft int64 +} + +// NewBackupStreamWriter produces a BackupStreamWriter on top of an io.Writer. +func NewBackupStreamWriter(w io.Writer) *BackupStreamWriter { + return &BackupStreamWriter{w, 0} +} + +// WriteHeader writes the next backup stream header and prepares for calls to Write(). +func (w *BackupStreamWriter) WriteHeader(hdr *BackupHeader) error { + if w.bytesLeft != 0 { + return fmt.Errorf("missing %d bytes", w.bytesLeft) + } + name := utf16.Encode([]rune(hdr.Name)) + wsi := win32StreamId{ + StreamId: hdr.Id, + Attributes: hdr.Attributes, + Size: uint64(hdr.Size), + NameSize: uint32(len(name) * 2), + } + if hdr.Id == BackupSparseBlock { + // Include space for the int64 block offset + wsi.Size += 8 + } + if err := binary.Write(w.w, binary.LittleEndian, &wsi); err != nil { + return err + } + if len(name) != 0 { + if err := binary.Write(w.w, binary.LittleEndian, name); err != nil { + return err + } + } + if hdr.Id == BackupSparseBlock { + if err := binary.Write(w.w, binary.LittleEndian, hdr.Offset); err != nil { + return err + } + } + w.bytesLeft = hdr.Size + return nil +} + +// Write writes to the current backup stream. +func (w *BackupStreamWriter) Write(b []byte) (int, error) { + if w.bytesLeft < int64(len(b)) { + return 0, fmt.Errorf("too many bytes by %d", int64(len(b))-w.bytesLeft) + } + n, err := w.w.Write(b) + w.bytesLeft -= int64(n) + return n, err +} + +// BackupFileReader provides an io.ReadCloser interface on top of the BackupRead Win32 API. +type BackupFileReader struct { + f *os.File + includeSecurity bool + ctx uintptr +} + +// NewBackupFileReader returns a new BackupFileReader from a file handle. If includeSecurity is true, +// Read will attempt to read the security descriptor of the file. +func NewBackupFileReader(f *os.File, includeSecurity bool) *BackupFileReader { + r := &BackupFileReader{f, includeSecurity, 0} + return r +} + +// Read reads a backup stream from the file by calling the Win32 API BackupRead(). +func (r *BackupFileReader) Read(b []byte) (int, error) { + var bytesRead uint32 + err := backupRead(syscall.Handle(r.f.Fd()), b, &bytesRead, false, r.includeSecurity, &r.ctx) + if err != nil { + return 0, &os.PathError{"BackupRead", r.f.Name(), err} + } + runtime.KeepAlive(r.f) + if bytesRead == 0 { + return 0, io.EOF + } + return int(bytesRead), nil +} + +// Close frees Win32 resources associated with the BackupFileReader. It does not close +// the underlying file. +func (r *BackupFileReader) Close() error { + if r.ctx != 0 { + backupRead(syscall.Handle(r.f.Fd()), nil, nil, true, false, &r.ctx) + runtime.KeepAlive(r.f) + r.ctx = 0 + } + return nil +} + +// BackupFileWriter provides an io.WriteCloser interface on top of the BackupWrite Win32 API. +type BackupFileWriter struct { + f *os.File + includeSecurity bool + ctx uintptr +} + +// NewBackupFileWriter returns a new BackupFileWriter from a file handle. If includeSecurity is true, +// Write() will attempt to restore the security descriptor from the stream. +func NewBackupFileWriter(f *os.File, includeSecurity bool) *BackupFileWriter { + w := &BackupFileWriter{f, includeSecurity, 0} + return w +} + +// Write restores a portion of the file using the provided backup stream. +func (w *BackupFileWriter) Write(b []byte) (int, error) { + var bytesWritten uint32 + err := backupWrite(syscall.Handle(w.f.Fd()), b, &bytesWritten, false, w.includeSecurity, &w.ctx) + if err != nil { + return 0, &os.PathError{"BackupWrite", w.f.Name(), err} + } + runtime.KeepAlive(w.f) + if int(bytesWritten) != len(b) { + return int(bytesWritten), errors.New("not all bytes could be written") + } + return len(b), nil +} + +// Close frees Win32 resources associated with the BackupFileWriter. It does not +// close the underlying file. +func (w *BackupFileWriter) Close() error { + if w.ctx != 0 { + backupWrite(syscall.Handle(w.f.Fd()), nil, nil, true, false, &w.ctx) + runtime.KeepAlive(w.f) + w.ctx = 0 + } + return nil +} + +// OpenForBackup opens a file or directory, potentially skipping access checks if the backup +// or restore privileges have been acquired. +// +// If the file opened was a directory, it cannot be used with Readdir(). +func OpenForBackup(path string, access uint32, share uint32, createmode uint32) (*os.File, error) { + winPath, err := syscall.UTF16FromString(path) + if err != nil { + return nil, err + } + h, err := syscall.CreateFile(&winPath[0], access, share, nil, createmode, syscall.FILE_FLAG_BACKUP_SEMANTICS|syscall.FILE_FLAG_OPEN_REPARSE_POINT, 0) + if err != nil { + err = &os.PathError{Op: "open", Path: path, Err: err} + return nil, err + } + return os.NewFile(uintptr(h), path), nil +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/ea.go b/integration-test/vendor/github.com/Microsoft/go-winio/ea.go new file mode 100644 index 000000000..4051c1b33 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/ea.go @@ -0,0 +1,137 @@ +package winio + +import ( + "bytes" + "encoding/binary" + "errors" +) + +type fileFullEaInformation struct { + NextEntryOffset uint32 + Flags uint8 + NameLength uint8 + ValueLength uint16 +} + +var ( + fileFullEaInformationSize = binary.Size(&fileFullEaInformation{}) + + errInvalidEaBuffer = errors.New("invalid extended attribute buffer") + errEaNameTooLarge = errors.New("extended attribute name too large") + errEaValueTooLarge = errors.New("extended attribute value too large") +) + +// ExtendedAttribute represents a single Windows EA. +type ExtendedAttribute struct { + Name string + Value []byte + Flags uint8 +} + +func parseEa(b []byte) (ea ExtendedAttribute, nb []byte, err error) { + var info fileFullEaInformation + err = binary.Read(bytes.NewReader(b), binary.LittleEndian, &info) + if err != nil { + err = errInvalidEaBuffer + return + } + + nameOffset := fileFullEaInformationSize + nameLen := int(info.NameLength) + valueOffset := nameOffset + int(info.NameLength) + 1 + valueLen := int(info.ValueLength) + nextOffset := int(info.NextEntryOffset) + if valueLen+valueOffset > len(b) || nextOffset < 0 || nextOffset > len(b) { + err = errInvalidEaBuffer + return + } + + ea.Name = string(b[nameOffset : nameOffset+nameLen]) + ea.Value = b[valueOffset : valueOffset+valueLen] + ea.Flags = info.Flags + if info.NextEntryOffset != 0 { + nb = b[info.NextEntryOffset:] + } + return +} + +// DecodeExtendedAttributes decodes a list of EAs from a FILE_FULL_EA_INFORMATION +// buffer retrieved from BackupRead, ZwQueryEaFile, etc. +func DecodeExtendedAttributes(b []byte) (eas []ExtendedAttribute, err error) { + for len(b) != 0 { + ea, nb, err := parseEa(b) + if err != nil { + return nil, err + } + + eas = append(eas, ea) + b = nb + } + return +} + +func writeEa(buf *bytes.Buffer, ea *ExtendedAttribute, last bool) error { + if int(uint8(len(ea.Name))) != len(ea.Name) { + return errEaNameTooLarge + } + if int(uint16(len(ea.Value))) != len(ea.Value) { + return errEaValueTooLarge + } + entrySize := uint32(fileFullEaInformationSize + len(ea.Name) + 1 + len(ea.Value)) + withPadding := (entrySize + 3) &^ 3 + nextOffset := uint32(0) + if !last { + nextOffset = withPadding + } + info := fileFullEaInformation{ + NextEntryOffset: nextOffset, + Flags: ea.Flags, + NameLength: uint8(len(ea.Name)), + ValueLength: uint16(len(ea.Value)), + } + + err := binary.Write(buf, binary.LittleEndian, &info) + if err != nil { + return err + } + + _, err = buf.Write([]byte(ea.Name)) + if err != nil { + return err + } + + err = buf.WriteByte(0) + if err != nil { + return err + } + + _, err = buf.Write(ea.Value) + if err != nil { + return err + } + + _, err = buf.Write([]byte{0, 0, 0}[0 : withPadding-entrySize]) + if err != nil { + return err + } + + return nil +} + +// EncodeExtendedAttributes encodes a list of EAs into a FILE_FULL_EA_INFORMATION +// buffer for use with BackupWrite, ZwSetEaFile, etc. +func EncodeExtendedAttributes(eas []ExtendedAttribute) ([]byte, error) { + var buf bytes.Buffer + for i := range eas { + last := false + if i == len(eas)-1 { + last = true + } + + err := writeEa(&buf, &eas[i], last) + if err != nil { + return nil, err + } + } + return buf.Bytes(), nil +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/file.go b/integration-test/vendor/github.com/Microsoft/go-winio/file.go new file mode 100644 index 000000000..0385e4108 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/file.go @@ -0,0 +1,323 @@ +// +build windows + +package winio + +import ( + "errors" + "io" + "runtime" + "sync" + "sync/atomic" + "syscall" + "time" +) + +//sys cancelIoEx(file syscall.Handle, o *syscall.Overlapped) (err error) = CancelIoEx +//sys createIoCompletionPort(file syscall.Handle, port syscall.Handle, key uintptr, threadCount uint32) (newport syscall.Handle, err error) = CreateIoCompletionPort +//sys getQueuedCompletionStatus(port syscall.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) = GetQueuedCompletionStatus +//sys setFileCompletionNotificationModes(h syscall.Handle, flags uint8) (err error) = SetFileCompletionNotificationModes +//sys wsaGetOverlappedResult(h syscall.Handle, o *syscall.Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult + +type atomicBool int32 + +func (b *atomicBool) isSet() bool { return atomic.LoadInt32((*int32)(b)) != 0 } +func (b *atomicBool) setFalse() { atomic.StoreInt32((*int32)(b), 0) } +func (b *atomicBool) setTrue() { atomic.StoreInt32((*int32)(b), 1) } +func (b *atomicBool) swap(new bool) bool { + var newInt int32 + if new { + newInt = 1 + } + return atomic.SwapInt32((*int32)(b), newInt) == 1 +} + +const ( + cFILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1 + cFILE_SKIP_SET_EVENT_ON_HANDLE = 2 +) + +var ( + ErrFileClosed = errors.New("file has already been closed") + ErrTimeout = &timeoutError{} +) + +type timeoutError struct{} + +func (e *timeoutError) Error() string { return "i/o timeout" } +func (e *timeoutError) Timeout() bool { return true } +func (e *timeoutError) Temporary() bool { return true } + +type timeoutChan chan struct{} + +var ioInitOnce sync.Once +var ioCompletionPort syscall.Handle + +// ioResult contains the result of an asynchronous IO operation +type ioResult struct { + bytes uint32 + err error +} + +// ioOperation represents an outstanding asynchronous Win32 IO +type ioOperation struct { + o syscall.Overlapped + ch chan ioResult +} + +func initIo() { + h, err := createIoCompletionPort(syscall.InvalidHandle, 0, 0, 0xffffffff) + if err != nil { + panic(err) + } + ioCompletionPort = h + go ioCompletionProcessor(h) +} + +// win32File implements Reader, Writer, and Closer on a Win32 handle without blocking in a syscall. +// It takes ownership of this handle and will close it if it is garbage collected. +type win32File struct { + handle syscall.Handle + wg sync.WaitGroup + wgLock sync.RWMutex + closing atomicBool + socket bool + readDeadline deadlineHandler + writeDeadline deadlineHandler +} + +type deadlineHandler struct { + setLock sync.Mutex + channel timeoutChan + channelLock sync.RWMutex + timer *time.Timer + timedout atomicBool +} + +// makeWin32File makes a new win32File from an existing file handle +func makeWin32File(h syscall.Handle) (*win32File, error) { + f := &win32File{handle: h} + ioInitOnce.Do(initIo) + _, err := createIoCompletionPort(h, ioCompletionPort, 0, 0xffffffff) + if err != nil { + return nil, err + } + err = setFileCompletionNotificationModes(h, cFILE_SKIP_COMPLETION_PORT_ON_SUCCESS|cFILE_SKIP_SET_EVENT_ON_HANDLE) + if err != nil { + return nil, err + } + f.readDeadline.channel = make(timeoutChan) + f.writeDeadline.channel = make(timeoutChan) + return f, nil +} + +func MakeOpenFile(h syscall.Handle) (io.ReadWriteCloser, error) { + // If we return the result of makeWin32File directly, it can result in an + // interface-wrapped nil, rather than a nil interface value. + f, err := makeWin32File(h) + if err != nil { + return nil, err + } + return f, nil +} + +// closeHandle closes the resources associated with a Win32 handle +func (f *win32File) closeHandle() { + f.wgLock.Lock() + // Atomically set that we are closing, releasing the resources only once. + if !f.closing.swap(true) { + f.wgLock.Unlock() + // cancel all IO and wait for it to complete + cancelIoEx(f.handle, nil) + f.wg.Wait() + // at this point, no new IO can start + syscall.Close(f.handle) + f.handle = 0 + } else { + f.wgLock.Unlock() + } +} + +// Close closes a win32File. +func (f *win32File) Close() error { + f.closeHandle() + return nil +} + +// prepareIo prepares for a new IO operation. +// The caller must call f.wg.Done() when the IO is finished, prior to Close() returning. +func (f *win32File) prepareIo() (*ioOperation, error) { + f.wgLock.RLock() + if f.closing.isSet() { + f.wgLock.RUnlock() + return nil, ErrFileClosed + } + f.wg.Add(1) + f.wgLock.RUnlock() + c := &ioOperation{} + c.ch = make(chan ioResult) + return c, nil +} + +// ioCompletionProcessor processes completed async IOs forever +func ioCompletionProcessor(h syscall.Handle) { + for { + var bytes uint32 + var key uintptr + var op *ioOperation + err := getQueuedCompletionStatus(h, &bytes, &key, &op, syscall.INFINITE) + if op == nil { + panic(err) + } + op.ch <- ioResult{bytes, err} + } +} + +// asyncIo processes the return value from ReadFile or WriteFile, blocking until +// the operation has actually completed. +func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) { + if err != syscall.ERROR_IO_PENDING { + return int(bytes), err + } + + if f.closing.isSet() { + cancelIoEx(f.handle, &c.o) + } + + var timeout timeoutChan + if d != nil { + d.channelLock.Lock() + timeout = d.channel + d.channelLock.Unlock() + } + + var r ioResult + select { + case r = <-c.ch: + err = r.err + if err == syscall.ERROR_OPERATION_ABORTED { + if f.closing.isSet() { + err = ErrFileClosed + } + } else if err != nil && f.socket { + // err is from Win32. Query the overlapped structure to get the winsock error. + var bytes, flags uint32 + err = wsaGetOverlappedResult(f.handle, &c.o, &bytes, false, &flags) + } + case <-timeout: + cancelIoEx(f.handle, &c.o) + r = <-c.ch + err = r.err + if err == syscall.ERROR_OPERATION_ABORTED { + err = ErrTimeout + } + } + + // runtime.KeepAlive is needed, as c is passed via native + // code to ioCompletionProcessor, c must remain alive + // until the channel read is complete. + runtime.KeepAlive(c) + return int(r.bytes), err +} + +// Read reads from a file handle. +func (f *win32File) Read(b []byte) (int, error) { + c, err := f.prepareIo() + if err != nil { + return 0, err + } + defer f.wg.Done() + + if f.readDeadline.timedout.isSet() { + return 0, ErrTimeout + } + + var bytes uint32 + err = syscall.ReadFile(f.handle, b, &bytes, &c.o) + n, err := f.asyncIo(c, &f.readDeadline, bytes, err) + runtime.KeepAlive(b) + + // Handle EOF conditions. + if err == nil && n == 0 && len(b) != 0 { + return 0, io.EOF + } else if err == syscall.ERROR_BROKEN_PIPE { + return 0, io.EOF + } else { + return n, err + } +} + +// Write writes to a file handle. +func (f *win32File) Write(b []byte) (int, error) { + c, err := f.prepareIo() + if err != nil { + return 0, err + } + defer f.wg.Done() + + if f.writeDeadline.timedout.isSet() { + return 0, ErrTimeout + } + + var bytes uint32 + err = syscall.WriteFile(f.handle, b, &bytes, &c.o) + n, err := f.asyncIo(c, &f.writeDeadline, bytes, err) + runtime.KeepAlive(b) + return n, err +} + +func (f *win32File) SetReadDeadline(deadline time.Time) error { + return f.readDeadline.set(deadline) +} + +func (f *win32File) SetWriteDeadline(deadline time.Time) error { + return f.writeDeadline.set(deadline) +} + +func (f *win32File) Flush() error { + return syscall.FlushFileBuffers(f.handle) +} + +func (f *win32File) Fd() uintptr { + return uintptr(f.handle) +} + +func (d *deadlineHandler) set(deadline time.Time) error { + d.setLock.Lock() + defer d.setLock.Unlock() + + if d.timer != nil { + if !d.timer.Stop() { + <-d.channel + } + d.timer = nil + } + d.timedout.setFalse() + + select { + case <-d.channel: + d.channelLock.Lock() + d.channel = make(chan struct{}) + d.channelLock.Unlock() + default: + } + + if deadline.IsZero() { + return nil + } + + timeoutIO := func() { + d.timedout.setTrue() + close(d.channel) + } + + now := time.Now() + duration := deadline.Sub(now) + if deadline.After(now) { + // Deadline is in the future, set a timer to wait + d.timer = time.AfterFunc(duration, timeoutIO) + } else { + // Deadline is in the past. Cancel all pending IO now. + timeoutIO() + } + return nil +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/fileinfo.go b/integration-test/vendor/github.com/Microsoft/go-winio/fileinfo.go new file mode 100644 index 000000000..3ab6bff69 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/fileinfo.go @@ -0,0 +1,73 @@ +// +build windows + +package winio + +import ( + "os" + "runtime" + "unsafe" + + "golang.org/x/sys/windows" +) + +// FileBasicInfo contains file access time and file attributes information. +type FileBasicInfo struct { + CreationTime, LastAccessTime, LastWriteTime, ChangeTime windows.Filetime + FileAttributes uint32 + pad uint32 // padding +} + +// GetFileBasicInfo retrieves times and attributes for a file. +func GetFileBasicInfo(f *os.File) (*FileBasicInfo, error) { + bi := &FileBasicInfo{} + if err := windows.GetFileInformationByHandleEx(windows.Handle(f.Fd()), windows.FileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { + return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} + } + runtime.KeepAlive(f) + return bi, nil +} + +// SetFileBasicInfo sets times and attributes for a file. +func SetFileBasicInfo(f *os.File, bi *FileBasicInfo) error { + if err := windows.SetFileInformationByHandle(windows.Handle(f.Fd()), windows.FileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { + return &os.PathError{Op: "SetFileInformationByHandle", Path: f.Name(), Err: err} + } + runtime.KeepAlive(f) + return nil +} + +// FileStandardInfo contains extended information for the file. +// FILE_STANDARD_INFO in WinBase.h +// https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_standard_info +type FileStandardInfo struct { + AllocationSize, EndOfFile int64 + NumberOfLinks uint32 + DeletePending, Directory bool +} + +// GetFileStandardInfo retrieves ended information for the file. +func GetFileStandardInfo(f *os.File) (*FileStandardInfo, error) { + si := &FileStandardInfo{} + if err := windows.GetFileInformationByHandleEx(windows.Handle(f.Fd()), windows.FileStandardInfo, (*byte)(unsafe.Pointer(si)), uint32(unsafe.Sizeof(*si))); err != nil { + return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} + } + runtime.KeepAlive(f) + return si, nil +} + +// FileIDInfo contains the volume serial number and file ID for a file. This pair should be +// unique on a system. +type FileIDInfo struct { + VolumeSerialNumber uint64 + FileID [16]byte +} + +// GetFileID retrieves the unique (volume, file ID) pair for a file. +func GetFileID(f *os.File) (*FileIDInfo, error) { + fileID := &FileIDInfo{} + if err := windows.GetFileInformationByHandleEx(windows.Handle(f.Fd()), windows.FileIdInfo, (*byte)(unsafe.Pointer(fileID)), uint32(unsafe.Sizeof(*fileID))); err != nil { + return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} + } + runtime.KeepAlive(f) + return fileID, nil +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/hvsock.go b/integration-test/vendor/github.com/Microsoft/go-winio/hvsock.go new file mode 100644 index 000000000..b632f8f8b --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/hvsock.go @@ -0,0 +1,307 @@ +// +build windows + +package winio + +import ( + "fmt" + "io" + "net" + "os" + "syscall" + "time" + "unsafe" + + "github.com/Microsoft/go-winio/pkg/guid" +) + +//sys bind(s syscall.Handle, name unsafe.Pointer, namelen int32) (err error) [failretval==socketError] = ws2_32.bind + +const ( + afHvSock = 34 // AF_HYPERV + + socketError = ^uintptr(0) +) + +// An HvsockAddr is an address for a AF_HYPERV socket. +type HvsockAddr struct { + VMID guid.GUID + ServiceID guid.GUID +} + +type rawHvsockAddr struct { + Family uint16 + _ uint16 + VMID guid.GUID + ServiceID guid.GUID +} + +// Network returns the address's network name, "hvsock". +func (addr *HvsockAddr) Network() string { + return "hvsock" +} + +func (addr *HvsockAddr) String() string { + return fmt.Sprintf("%s:%s", &addr.VMID, &addr.ServiceID) +} + +// VsockServiceID returns an hvsock service ID corresponding to the specified AF_VSOCK port. +func VsockServiceID(port uint32) guid.GUID { + g, _ := guid.FromString("00000000-facb-11e6-bd58-64006a7986d3") + g.Data1 = port + return g +} + +func (addr *HvsockAddr) raw() rawHvsockAddr { + return rawHvsockAddr{ + Family: afHvSock, + VMID: addr.VMID, + ServiceID: addr.ServiceID, + } +} + +func (addr *HvsockAddr) fromRaw(raw *rawHvsockAddr) { + addr.VMID = raw.VMID + addr.ServiceID = raw.ServiceID +} + +// HvsockListener is a socket listener for the AF_HYPERV address family. +type HvsockListener struct { + sock *win32File + addr HvsockAddr +} + +// HvsockConn is a connected socket of the AF_HYPERV address family. +type HvsockConn struct { + sock *win32File + local, remote HvsockAddr +} + +func newHvSocket() (*win32File, error) { + fd, err := syscall.Socket(afHvSock, syscall.SOCK_STREAM, 1) + if err != nil { + return nil, os.NewSyscallError("socket", err) + } + f, err := makeWin32File(fd) + if err != nil { + syscall.Close(fd) + return nil, err + } + f.socket = true + return f, nil +} + +// ListenHvsock listens for connections on the specified hvsock address. +func ListenHvsock(addr *HvsockAddr) (_ *HvsockListener, err error) { + l := &HvsockListener{addr: *addr} + sock, err := newHvSocket() + if err != nil { + return nil, l.opErr("listen", err) + } + sa := addr.raw() + err = bind(sock.handle, unsafe.Pointer(&sa), int32(unsafe.Sizeof(sa))) + if err != nil { + return nil, l.opErr("listen", os.NewSyscallError("socket", err)) + } + err = syscall.Listen(sock.handle, 16) + if err != nil { + return nil, l.opErr("listen", os.NewSyscallError("listen", err)) + } + return &HvsockListener{sock: sock, addr: *addr}, nil +} + +func (l *HvsockListener) opErr(op string, err error) error { + return &net.OpError{Op: op, Net: "hvsock", Addr: &l.addr, Err: err} +} + +// Addr returns the listener's network address. +func (l *HvsockListener) Addr() net.Addr { + return &l.addr +} + +// Accept waits for the next connection and returns it. +func (l *HvsockListener) Accept() (_ net.Conn, err error) { + sock, err := newHvSocket() + if err != nil { + return nil, l.opErr("accept", err) + } + defer func() { + if sock != nil { + sock.Close() + } + }() + c, err := l.sock.prepareIo() + if err != nil { + return nil, l.opErr("accept", err) + } + defer l.sock.wg.Done() + + // AcceptEx, per documentation, requires an extra 16 bytes per address. + const addrlen = uint32(16 + unsafe.Sizeof(rawHvsockAddr{})) + var addrbuf [addrlen * 2]byte + + var bytes uint32 + err = syscall.AcceptEx(l.sock.handle, sock.handle, &addrbuf[0], 0, addrlen, addrlen, &bytes, &c.o) + _, err = l.sock.asyncIo(c, nil, bytes, err) + if err != nil { + return nil, l.opErr("accept", os.NewSyscallError("acceptex", err)) + } + conn := &HvsockConn{ + sock: sock, + } + conn.local.fromRaw((*rawHvsockAddr)(unsafe.Pointer(&addrbuf[0]))) + conn.remote.fromRaw((*rawHvsockAddr)(unsafe.Pointer(&addrbuf[addrlen]))) + sock = nil + return conn, nil +} + +// Close closes the listener, causing any pending Accept calls to fail. +func (l *HvsockListener) Close() error { + return l.sock.Close() +} + +/* Need to finish ConnectEx handling +func DialHvsock(ctx context.Context, addr *HvsockAddr) (*HvsockConn, error) { + sock, err := newHvSocket() + if err != nil { + return nil, err + } + defer func() { + if sock != nil { + sock.Close() + } + }() + c, err := sock.prepareIo() + if err != nil { + return nil, err + } + defer sock.wg.Done() + var bytes uint32 + err = windows.ConnectEx(windows.Handle(sock.handle), sa, nil, 0, &bytes, &c.o) + _, err = sock.asyncIo(ctx, c, nil, bytes, err) + if err != nil { + return nil, err + } + conn := &HvsockConn{ + sock: sock, + remote: *addr, + } + sock = nil + return conn, nil +} +*/ + +func (conn *HvsockConn) opErr(op string, err error) error { + return &net.OpError{Op: op, Net: "hvsock", Source: &conn.local, Addr: &conn.remote, Err: err} +} + +func (conn *HvsockConn) Read(b []byte) (int, error) { + c, err := conn.sock.prepareIo() + if err != nil { + return 0, conn.opErr("read", err) + } + defer conn.sock.wg.Done() + buf := syscall.WSABuf{Buf: &b[0], Len: uint32(len(b))} + var flags, bytes uint32 + err = syscall.WSARecv(conn.sock.handle, &buf, 1, &bytes, &flags, &c.o, nil) + n, err := conn.sock.asyncIo(c, &conn.sock.readDeadline, bytes, err) + if err != nil { + if _, ok := err.(syscall.Errno); ok { + err = os.NewSyscallError("wsarecv", err) + } + return 0, conn.opErr("read", err) + } else if n == 0 { + err = io.EOF + } + return n, err +} + +func (conn *HvsockConn) Write(b []byte) (int, error) { + t := 0 + for len(b) != 0 { + n, err := conn.write(b) + if err != nil { + return t + n, err + } + t += n + b = b[n:] + } + return t, nil +} + +func (conn *HvsockConn) write(b []byte) (int, error) { + c, err := conn.sock.prepareIo() + if err != nil { + return 0, conn.opErr("write", err) + } + defer conn.sock.wg.Done() + buf := syscall.WSABuf{Buf: &b[0], Len: uint32(len(b))} + var bytes uint32 + err = syscall.WSASend(conn.sock.handle, &buf, 1, &bytes, 0, &c.o, nil) + n, err := conn.sock.asyncIo(c, &conn.sock.writeDeadline, bytes, err) + if err != nil { + if _, ok := err.(syscall.Errno); ok { + err = os.NewSyscallError("wsasend", err) + } + return 0, conn.opErr("write", err) + } + return n, err +} + +// Close closes the socket connection, failing any pending read or write calls. +func (conn *HvsockConn) Close() error { + return conn.sock.Close() +} + +func (conn *HvsockConn) shutdown(how int) error { + err := syscall.Shutdown(conn.sock.handle, syscall.SHUT_RD) + if err != nil { + return os.NewSyscallError("shutdown", err) + } + return nil +} + +// CloseRead shuts down the read end of the socket. +func (conn *HvsockConn) CloseRead() error { + err := conn.shutdown(syscall.SHUT_RD) + if err != nil { + return conn.opErr("close", err) + } + return nil +} + +// CloseWrite shuts down the write end of the socket, notifying the other endpoint that +// no more data will be written. +func (conn *HvsockConn) CloseWrite() error { + err := conn.shutdown(syscall.SHUT_WR) + if err != nil { + return conn.opErr("close", err) + } + return nil +} + +// LocalAddr returns the local address of the connection. +func (conn *HvsockConn) LocalAddr() net.Addr { + return &conn.local +} + +// RemoteAddr returns the remote address of the connection. +func (conn *HvsockConn) RemoteAddr() net.Addr { + return &conn.remote +} + +// SetDeadline implements the net.Conn SetDeadline method. +func (conn *HvsockConn) SetDeadline(t time.Time) error { + conn.SetReadDeadline(t) + conn.SetWriteDeadline(t) + return nil +} + +// SetReadDeadline implements the net.Conn SetReadDeadline method. +func (conn *HvsockConn) SetReadDeadline(t time.Time) error { + return conn.sock.SetReadDeadline(t) +} + +// SetWriteDeadline implements the net.Conn SetWriteDeadline method. +func (conn *HvsockConn) SetWriteDeadline(t time.Time) error { + return conn.sock.SetWriteDeadline(t) +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/pipe.go b/integration-test/vendor/github.com/Microsoft/go-winio/pipe.go new file mode 100644 index 000000000..96700a73d --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/pipe.go @@ -0,0 +1,517 @@ +// +build windows + +package winio + +import ( + "context" + "errors" + "fmt" + "io" + "net" + "os" + "runtime" + "syscall" + "time" + "unsafe" +) + +//sys connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) = ConnectNamedPipe +//sys createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) [failretval==syscall.InvalidHandle] = CreateNamedPipeW +//sys createFile(name string, access uint32, mode uint32, sa *syscall.SecurityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) [failretval==syscall.InvalidHandle] = CreateFileW +//sys getNamedPipeInfo(pipe syscall.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) = GetNamedPipeInfo +//sys getNamedPipeHandleState(pipe syscall.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW +//sys localAlloc(uFlags uint32, length uint32) (ptr uintptr) = LocalAlloc +//sys ntCreateNamedPipeFile(pipe *syscall.Handle, access uint32, oa *objectAttributes, iosb *ioStatusBlock, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (status ntstatus) = ntdll.NtCreateNamedPipeFile +//sys rtlNtStatusToDosError(status ntstatus) (winerr error) = ntdll.RtlNtStatusToDosErrorNoTeb +//sys rtlDosPathNameToNtPathName(name *uint16, ntName *unicodeString, filePart uintptr, reserved uintptr) (status ntstatus) = ntdll.RtlDosPathNameToNtPathName_U +//sys rtlDefaultNpAcl(dacl *uintptr) (status ntstatus) = ntdll.RtlDefaultNpAcl + +type ioStatusBlock struct { + Status, Information uintptr +} + +type objectAttributes struct { + Length uintptr + RootDirectory uintptr + ObjectName *unicodeString + Attributes uintptr + SecurityDescriptor *securityDescriptor + SecurityQoS uintptr +} + +type unicodeString struct { + Length uint16 + MaximumLength uint16 + Buffer uintptr +} + +type securityDescriptor struct { + Revision byte + Sbz1 byte + Control uint16 + Owner uintptr + Group uintptr + Sacl uintptr + Dacl uintptr +} + +type ntstatus int32 + +func (status ntstatus) Err() error { + if status >= 0 { + return nil + } + return rtlNtStatusToDosError(status) +} + +const ( + cERROR_PIPE_BUSY = syscall.Errno(231) + cERROR_NO_DATA = syscall.Errno(232) + cERROR_PIPE_CONNECTED = syscall.Errno(535) + cERROR_SEM_TIMEOUT = syscall.Errno(121) + + cSECURITY_SQOS_PRESENT = 0x100000 + cSECURITY_ANONYMOUS = 0 + + cPIPE_TYPE_MESSAGE = 4 + + cPIPE_READMODE_MESSAGE = 2 + + cFILE_OPEN = 1 + cFILE_CREATE = 2 + + cFILE_PIPE_MESSAGE_TYPE = 1 + cFILE_PIPE_REJECT_REMOTE_CLIENTS = 2 + + cSE_DACL_PRESENT = 4 +) + +var ( + // ErrPipeListenerClosed is returned for pipe operations on listeners that have been closed. + // This error should match net.errClosing since docker takes a dependency on its text. + ErrPipeListenerClosed = errors.New("use of closed network connection") + + errPipeWriteClosed = errors.New("pipe has been closed for write") +) + +type win32Pipe struct { + *win32File + path string +} + +type win32MessageBytePipe struct { + win32Pipe + writeClosed bool + readEOF bool +} + +type pipeAddress string + +func (f *win32Pipe) LocalAddr() net.Addr { + return pipeAddress(f.path) +} + +func (f *win32Pipe) RemoteAddr() net.Addr { + return pipeAddress(f.path) +} + +func (f *win32Pipe) SetDeadline(t time.Time) error { + f.SetReadDeadline(t) + f.SetWriteDeadline(t) + return nil +} + +// CloseWrite closes the write side of a message pipe in byte mode. +func (f *win32MessageBytePipe) CloseWrite() error { + if f.writeClosed { + return errPipeWriteClosed + } + err := f.win32File.Flush() + if err != nil { + return err + } + _, err = f.win32File.Write(nil) + if err != nil { + return err + } + f.writeClosed = true + return nil +} + +// Write writes bytes to a message pipe in byte mode. Zero-byte writes are ignored, since +// they are used to implement CloseWrite(). +func (f *win32MessageBytePipe) Write(b []byte) (int, error) { + if f.writeClosed { + return 0, errPipeWriteClosed + } + if len(b) == 0 { + return 0, nil + } + return f.win32File.Write(b) +} + +// Read reads bytes from a message pipe in byte mode. A read of a zero-byte message on a message +// mode pipe will return io.EOF, as will all subsequent reads. +func (f *win32MessageBytePipe) Read(b []byte) (int, error) { + if f.readEOF { + return 0, io.EOF + } + n, err := f.win32File.Read(b) + if err == io.EOF { + // If this was the result of a zero-byte read, then + // it is possible that the read was due to a zero-size + // message. Since we are simulating CloseWrite with a + // zero-byte message, ensure that all future Read() calls + // also return EOF. + f.readEOF = true + } else if err == syscall.ERROR_MORE_DATA { + // ERROR_MORE_DATA indicates that the pipe's read mode is message mode + // and the message still has more bytes. Treat this as a success, since + // this package presents all named pipes as byte streams. + err = nil + } + return n, err +} + +func (s pipeAddress) Network() string { + return "pipe" +} + +func (s pipeAddress) String() string { + return string(s) +} + +// tryDialPipe attempts to dial the pipe at `path` until `ctx` cancellation or timeout. +func tryDialPipe(ctx context.Context, path *string, access uint32) (syscall.Handle, error) { + for { + + select { + case <-ctx.Done(): + return syscall.Handle(0), ctx.Err() + default: + h, err := createFile(*path, access, 0, nil, syscall.OPEN_EXISTING, syscall.FILE_FLAG_OVERLAPPED|cSECURITY_SQOS_PRESENT|cSECURITY_ANONYMOUS, 0) + if err == nil { + return h, nil + } + if err != cERROR_PIPE_BUSY { + return h, &os.PathError{Err: err, Op: "open", Path: *path} + } + // Wait 10 msec and try again. This is a rather simplistic + // view, as we always try each 10 milliseconds. + time.Sleep(10 * time.Millisecond) + } + } +} + +// DialPipe connects to a named pipe by path, timing out if the connection +// takes longer than the specified duration. If timeout is nil, then we use +// a default timeout of 2 seconds. (We do not use WaitNamedPipe.) +func DialPipe(path string, timeout *time.Duration) (net.Conn, error) { + var absTimeout time.Time + if timeout != nil { + absTimeout = time.Now().Add(*timeout) + } else { + absTimeout = time.Now().Add(2 * time.Second) + } + ctx, _ := context.WithDeadline(context.Background(), absTimeout) + conn, err := DialPipeContext(ctx, path) + if err == context.DeadlineExceeded { + return nil, ErrTimeout + } + return conn, err +} + +// DialPipeContext attempts to connect to a named pipe by `path` until `ctx` +// cancellation or timeout. +func DialPipeContext(ctx context.Context, path string) (net.Conn, error) { + return DialPipeAccess(ctx, path, syscall.GENERIC_READ|syscall.GENERIC_WRITE) +} + +// DialPipeAccess attempts to connect to a named pipe by `path` with `access` until `ctx` +// cancellation or timeout. +func DialPipeAccess(ctx context.Context, path string, access uint32) (net.Conn, error) { + var err error + var h syscall.Handle + h, err = tryDialPipe(ctx, &path, access) + if err != nil { + return nil, err + } + + var flags uint32 + err = getNamedPipeInfo(h, &flags, nil, nil, nil) + if err != nil { + return nil, err + } + + f, err := makeWin32File(h) + if err != nil { + syscall.Close(h) + return nil, err + } + + // If the pipe is in message mode, return a message byte pipe, which + // supports CloseWrite(). + if flags&cPIPE_TYPE_MESSAGE != 0 { + return &win32MessageBytePipe{ + win32Pipe: win32Pipe{win32File: f, path: path}, + }, nil + } + return &win32Pipe{win32File: f, path: path}, nil +} + +type acceptResponse struct { + f *win32File + err error +} + +type win32PipeListener struct { + firstHandle syscall.Handle + path string + config PipeConfig + acceptCh chan (chan acceptResponse) + closeCh chan int + doneCh chan int +} + +func makeServerPipeHandle(path string, sd []byte, c *PipeConfig, first bool) (syscall.Handle, error) { + path16, err := syscall.UTF16FromString(path) + if err != nil { + return 0, &os.PathError{Op: "open", Path: path, Err: err} + } + + var oa objectAttributes + oa.Length = unsafe.Sizeof(oa) + + var ntPath unicodeString + if err := rtlDosPathNameToNtPathName(&path16[0], &ntPath, 0, 0).Err(); err != nil { + return 0, &os.PathError{Op: "open", Path: path, Err: err} + } + defer localFree(ntPath.Buffer) + oa.ObjectName = &ntPath + + // The security descriptor is only needed for the first pipe. + if first { + if sd != nil { + len := uint32(len(sd)) + sdb := localAlloc(0, len) + defer localFree(sdb) + copy((*[0xffff]byte)(unsafe.Pointer(sdb))[:], sd) + oa.SecurityDescriptor = (*securityDescriptor)(unsafe.Pointer(sdb)) + } else { + // Construct the default named pipe security descriptor. + var dacl uintptr + if err := rtlDefaultNpAcl(&dacl).Err(); err != nil { + return 0, fmt.Errorf("getting default named pipe ACL: %s", err) + } + defer localFree(dacl) + + sdb := &securityDescriptor{ + Revision: 1, + Control: cSE_DACL_PRESENT, + Dacl: dacl, + } + oa.SecurityDescriptor = sdb + } + } + + typ := uint32(cFILE_PIPE_REJECT_REMOTE_CLIENTS) + if c.MessageMode { + typ |= cFILE_PIPE_MESSAGE_TYPE + } + + disposition := uint32(cFILE_OPEN) + access := uint32(syscall.GENERIC_READ | syscall.GENERIC_WRITE | syscall.SYNCHRONIZE) + if first { + disposition = cFILE_CREATE + // By not asking for read or write access, the named pipe file system + // will put this pipe into an initially disconnected state, blocking + // client connections until the next call with first == false. + access = syscall.SYNCHRONIZE + } + + timeout := int64(-50 * 10000) // 50ms + + var ( + h syscall.Handle + iosb ioStatusBlock + ) + err = ntCreateNamedPipeFile(&h, access, &oa, &iosb, syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE, disposition, 0, typ, 0, 0, 0xffffffff, uint32(c.InputBufferSize), uint32(c.OutputBufferSize), &timeout).Err() + if err != nil { + return 0, &os.PathError{Op: "open", Path: path, Err: err} + } + + runtime.KeepAlive(ntPath) + return h, nil +} + +func (l *win32PipeListener) makeServerPipe() (*win32File, error) { + h, err := makeServerPipeHandle(l.path, nil, &l.config, false) + if err != nil { + return nil, err + } + f, err := makeWin32File(h) + if err != nil { + syscall.Close(h) + return nil, err + } + return f, nil +} + +func (l *win32PipeListener) makeConnectedServerPipe() (*win32File, error) { + p, err := l.makeServerPipe() + if err != nil { + return nil, err + } + + // Wait for the client to connect. + ch := make(chan error) + go func(p *win32File) { + ch <- connectPipe(p) + }(p) + + select { + case err = <-ch: + if err != nil { + p.Close() + p = nil + } + case <-l.closeCh: + // Abort the connect request by closing the handle. + p.Close() + p = nil + err = <-ch + if err == nil || err == ErrFileClosed { + err = ErrPipeListenerClosed + } + } + return p, err +} + +func (l *win32PipeListener) listenerRoutine() { + closed := false + for !closed { + select { + case <-l.closeCh: + closed = true + case responseCh := <-l.acceptCh: + var ( + p *win32File + err error + ) + for { + p, err = l.makeConnectedServerPipe() + // If the connection was immediately closed by the client, try + // again. + if err != cERROR_NO_DATA { + break + } + } + responseCh <- acceptResponse{p, err} + closed = err == ErrPipeListenerClosed + } + } + syscall.Close(l.firstHandle) + l.firstHandle = 0 + // Notify Close() and Accept() callers that the handle has been closed. + close(l.doneCh) +} + +// PipeConfig contain configuration for the pipe listener. +type PipeConfig struct { + // SecurityDescriptor contains a Windows security descriptor in SDDL format. + SecurityDescriptor string + + // MessageMode determines whether the pipe is in byte or message mode. In either + // case the pipe is read in byte mode by default. The only practical difference in + // this implementation is that CloseWrite() is only supported for message mode pipes; + // CloseWrite() is implemented as a zero-byte write, but zero-byte writes are only + // transferred to the reader (and returned as io.EOF in this implementation) + // when the pipe is in message mode. + MessageMode bool + + // InputBufferSize specifies the size of the input buffer, in bytes. + InputBufferSize int32 + + // OutputBufferSize specifies the size of the output buffer, in bytes. + OutputBufferSize int32 +} + +// ListenPipe creates a listener on a Windows named pipe path, e.g. \\.\pipe\mypipe. +// The pipe must not already exist. +func ListenPipe(path string, c *PipeConfig) (net.Listener, error) { + var ( + sd []byte + err error + ) + if c == nil { + c = &PipeConfig{} + } + if c.SecurityDescriptor != "" { + sd, err = SddlToSecurityDescriptor(c.SecurityDescriptor) + if err != nil { + return nil, err + } + } + h, err := makeServerPipeHandle(path, sd, c, true) + if err != nil { + return nil, err + } + l := &win32PipeListener{ + firstHandle: h, + path: path, + config: *c, + acceptCh: make(chan (chan acceptResponse)), + closeCh: make(chan int), + doneCh: make(chan int), + } + go l.listenerRoutine() + return l, nil +} + +func connectPipe(p *win32File) error { + c, err := p.prepareIo() + if err != nil { + return err + } + defer p.wg.Done() + + err = connectNamedPipe(p.handle, &c.o) + _, err = p.asyncIo(c, nil, 0, err) + if err != nil && err != cERROR_PIPE_CONNECTED { + return err + } + return nil +} + +func (l *win32PipeListener) Accept() (net.Conn, error) { + ch := make(chan acceptResponse) + select { + case l.acceptCh <- ch: + response := <-ch + err := response.err + if err != nil { + return nil, err + } + if l.config.MessageMode { + return &win32MessageBytePipe{ + win32Pipe: win32Pipe{win32File: response.f, path: l.path}, + }, nil + } + return &win32Pipe{win32File: response.f, path: l.path}, nil + case <-l.doneCh: + return nil, ErrPipeListenerClosed + } +} + +func (l *win32PipeListener) Close() error { + select { + case l.closeCh <- 1: + <-l.doneCh + case <-l.doneCh: + } + return nil +} + +func (l *win32PipeListener) Addr() net.Addr { + return pipeAddress(l.path) +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go b/integration-test/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go new file mode 100644 index 000000000..f497c0e39 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go @@ -0,0 +1,237 @@ +// +build windows + +// Package guid provides a GUID type. The backing structure for a GUID is +// identical to that used by the golang.org/x/sys/windows GUID type. +// There are two main binary encodings used for a GUID, the big-endian encoding, +// and the Windows (mixed-endian) encoding. See here for details: +// https://en.wikipedia.org/wiki/Universally_unique_identifier#Encoding +package guid + +import ( + "crypto/rand" + "crypto/sha1" + "encoding" + "encoding/binary" + "fmt" + "strconv" + + "golang.org/x/sys/windows" +) + +// Variant specifies which GUID variant (or "type") of the GUID. It determines +// how the entirety of the rest of the GUID is interpreted. +type Variant uint8 + +// The variants specified by RFC 4122. +const ( + // VariantUnknown specifies a GUID variant which does not conform to one of + // the variant encodings specified in RFC 4122. + VariantUnknown Variant = iota + VariantNCS + VariantRFC4122 + VariantMicrosoft + VariantFuture +) + +// Version specifies how the bits in the GUID were generated. For instance, a +// version 4 GUID is randomly generated, and a version 5 is generated from the +// hash of an input string. +type Version uint8 + +var _ = (encoding.TextMarshaler)(GUID{}) +var _ = (encoding.TextUnmarshaler)(&GUID{}) + +// GUID represents a GUID/UUID. It has the same structure as +// golang.org/x/sys/windows.GUID so that it can be used with functions expecting +// that type. It is defined as its own type so that stringification and +// marshaling can be supported. The representation matches that used by native +// Windows code. +type GUID windows.GUID + +// NewV4 returns a new version 4 (pseudorandom) GUID, as defined by RFC 4122. +func NewV4() (GUID, error) { + var b [16]byte + if _, err := rand.Read(b[:]); err != nil { + return GUID{}, err + } + + g := FromArray(b) + g.setVersion(4) // Version 4 means randomly generated. + g.setVariant(VariantRFC4122) + + return g, nil +} + +// NewV5 returns a new version 5 (generated from a string via SHA-1 hashing) +// GUID, as defined by RFC 4122. The RFC is unclear on the encoding of the name, +// and the sample code treats it as a series of bytes, so we do the same here. +// +// Some implementations, such as those found on Windows, treat the name as a +// big-endian UTF16 stream of bytes. If that is desired, the string can be +// encoded as such before being passed to this function. +func NewV5(namespace GUID, name []byte) (GUID, error) { + b := sha1.New() + namespaceBytes := namespace.ToArray() + b.Write(namespaceBytes[:]) + b.Write(name) + + a := [16]byte{} + copy(a[:], b.Sum(nil)) + + g := FromArray(a) + g.setVersion(5) // Version 5 means generated from a string. + g.setVariant(VariantRFC4122) + + return g, nil +} + +func fromArray(b [16]byte, order binary.ByteOrder) GUID { + var g GUID + g.Data1 = order.Uint32(b[0:4]) + g.Data2 = order.Uint16(b[4:6]) + g.Data3 = order.Uint16(b[6:8]) + copy(g.Data4[:], b[8:16]) + return g +} + +func (g GUID) toArray(order binary.ByteOrder) [16]byte { + b := [16]byte{} + order.PutUint32(b[0:4], g.Data1) + order.PutUint16(b[4:6], g.Data2) + order.PutUint16(b[6:8], g.Data3) + copy(b[8:16], g.Data4[:]) + return b +} + +// FromArray constructs a GUID from a big-endian encoding array of 16 bytes. +func FromArray(b [16]byte) GUID { + return fromArray(b, binary.BigEndian) +} + +// ToArray returns an array of 16 bytes representing the GUID in big-endian +// encoding. +func (g GUID) ToArray() [16]byte { + return g.toArray(binary.BigEndian) +} + +// FromWindowsArray constructs a GUID from a Windows encoding array of bytes. +func FromWindowsArray(b [16]byte) GUID { + return fromArray(b, binary.LittleEndian) +} + +// ToWindowsArray returns an array of 16 bytes representing the GUID in Windows +// encoding. +func (g GUID) ToWindowsArray() [16]byte { + return g.toArray(binary.LittleEndian) +} + +func (g GUID) String() string { + return fmt.Sprintf( + "%08x-%04x-%04x-%04x-%012x", + g.Data1, + g.Data2, + g.Data3, + g.Data4[:2], + g.Data4[2:]) +} + +// FromString parses a string containing a GUID and returns the GUID. The only +// format currently supported is the `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` +// format. +func FromString(s string) (GUID, error) { + if len(s) != 36 { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + + var g GUID + + data1, err := strconv.ParseUint(s[0:8], 16, 32) + if err != nil { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + g.Data1 = uint32(data1) + + data2, err := strconv.ParseUint(s[9:13], 16, 16) + if err != nil { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + g.Data2 = uint16(data2) + + data3, err := strconv.ParseUint(s[14:18], 16, 16) + if err != nil { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + g.Data3 = uint16(data3) + + for i, x := range []int{19, 21, 24, 26, 28, 30, 32, 34} { + v, err := strconv.ParseUint(s[x:x+2], 16, 8) + if err != nil { + return GUID{}, fmt.Errorf("invalid GUID %q", s) + } + g.Data4[i] = uint8(v) + } + + return g, nil +} + +func (g *GUID) setVariant(v Variant) { + d := g.Data4[0] + switch v { + case VariantNCS: + d = (d & 0x7f) + case VariantRFC4122: + d = (d & 0x3f) | 0x80 + case VariantMicrosoft: + d = (d & 0x1f) | 0xc0 + case VariantFuture: + d = (d & 0x0f) | 0xe0 + case VariantUnknown: + fallthrough + default: + panic(fmt.Sprintf("invalid variant: %d", v)) + } + g.Data4[0] = d +} + +// Variant returns the GUID variant, as defined in RFC 4122. +func (g GUID) Variant() Variant { + b := g.Data4[0] + if b&0x80 == 0 { + return VariantNCS + } else if b&0xc0 == 0x80 { + return VariantRFC4122 + } else if b&0xe0 == 0xc0 { + return VariantMicrosoft + } else if b&0xe0 == 0xe0 { + return VariantFuture + } + return VariantUnknown +} + +func (g *GUID) setVersion(v Version) { + g.Data3 = (g.Data3 & 0x0fff) | (uint16(v) << 12) +} + +// Version returns the GUID version, as defined in RFC 4122. +func (g GUID) Version() Version { + return Version((g.Data3 & 0xF000) >> 12) +} + +// MarshalText returns the textual representation of the GUID. +func (g GUID) MarshalText() ([]byte, error) { + return []byte(g.String()), nil +} + +// UnmarshalText takes the textual representation of a GUID, and unmarhals it +// into this GUID. +func (g *GUID) UnmarshalText(text []byte) error { + g2, err := FromString(string(text)) + if err != nil { + return err + } + *g = g2 + return nil +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/privilege.go b/integration-test/vendor/github.com/Microsoft/go-winio/privilege.go new file mode 100644 index 000000000..c3dd7c217 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/privilege.go @@ -0,0 +1,203 @@ +// +build windows + +package winio + +import ( + "bytes" + "encoding/binary" + "fmt" + "runtime" + "sync" + "syscall" + "unicode/utf16" + + "golang.org/x/sys/windows" +) + +//sys adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) [true] = advapi32.AdjustTokenPrivileges +//sys impersonateSelf(level uint32) (err error) = advapi32.ImpersonateSelf +//sys revertToSelf() (err error) = advapi32.RevertToSelf +//sys openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) = advapi32.OpenThreadToken +//sys getCurrentThread() (h syscall.Handle) = GetCurrentThread +//sys lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) = advapi32.LookupPrivilegeValueW +//sys lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) = advapi32.LookupPrivilegeNameW +//sys lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) = advapi32.LookupPrivilegeDisplayNameW + +const ( + SE_PRIVILEGE_ENABLED = 2 + + ERROR_NOT_ALL_ASSIGNED syscall.Errno = 1300 + + SeBackupPrivilege = "SeBackupPrivilege" + SeRestorePrivilege = "SeRestorePrivilege" + SeSecurityPrivilege = "SeSecurityPrivilege" +) + +const ( + securityAnonymous = iota + securityIdentification + securityImpersonation + securityDelegation +) + +var ( + privNames = make(map[string]uint64) + privNameMutex sync.Mutex +) + +// PrivilegeError represents an error enabling privileges. +type PrivilegeError struct { + privileges []uint64 +} + +func (e *PrivilegeError) Error() string { + s := "" + if len(e.privileges) > 1 { + s = "Could not enable privileges " + } else { + s = "Could not enable privilege " + } + for i, p := range e.privileges { + if i != 0 { + s += ", " + } + s += `"` + s += getPrivilegeName(p) + s += `"` + } + return s +} + +// RunWithPrivilege enables a single privilege for a function call. +func RunWithPrivilege(name string, fn func() error) error { + return RunWithPrivileges([]string{name}, fn) +} + +// RunWithPrivileges enables privileges for a function call. +func RunWithPrivileges(names []string, fn func() error) error { + privileges, err := mapPrivileges(names) + if err != nil { + return err + } + runtime.LockOSThread() + defer runtime.UnlockOSThread() + token, err := newThreadToken() + if err != nil { + return err + } + defer releaseThreadToken(token) + err = adjustPrivileges(token, privileges, SE_PRIVILEGE_ENABLED) + if err != nil { + return err + } + return fn() +} + +func mapPrivileges(names []string) ([]uint64, error) { + var privileges []uint64 + privNameMutex.Lock() + defer privNameMutex.Unlock() + for _, name := range names { + p, ok := privNames[name] + if !ok { + err := lookupPrivilegeValue("", name, &p) + if err != nil { + return nil, err + } + privNames[name] = p + } + privileges = append(privileges, p) + } + return privileges, nil +} + +// EnableProcessPrivileges enables privileges globally for the process. +func EnableProcessPrivileges(names []string) error { + return enableDisableProcessPrivilege(names, SE_PRIVILEGE_ENABLED) +} + +// DisableProcessPrivileges disables privileges globally for the process. +func DisableProcessPrivileges(names []string) error { + return enableDisableProcessPrivilege(names, 0) +} + +func enableDisableProcessPrivilege(names []string, action uint32) error { + privileges, err := mapPrivileges(names) + if err != nil { + return err + } + + p, _ := windows.GetCurrentProcess() + var token windows.Token + err = windows.OpenProcessToken(p, windows.TOKEN_ADJUST_PRIVILEGES|windows.TOKEN_QUERY, &token) + if err != nil { + return err + } + + defer token.Close() + return adjustPrivileges(token, privileges, action) +} + +func adjustPrivileges(token windows.Token, privileges []uint64, action uint32) error { + var b bytes.Buffer + binary.Write(&b, binary.LittleEndian, uint32(len(privileges))) + for _, p := range privileges { + binary.Write(&b, binary.LittleEndian, p) + binary.Write(&b, binary.LittleEndian, action) + } + prevState := make([]byte, b.Len()) + reqSize := uint32(0) + success, err := adjustTokenPrivileges(token, false, &b.Bytes()[0], uint32(len(prevState)), &prevState[0], &reqSize) + if !success { + return err + } + if err == ERROR_NOT_ALL_ASSIGNED { + return &PrivilegeError{privileges} + } + return nil +} + +func getPrivilegeName(luid uint64) string { + var nameBuffer [256]uint16 + bufSize := uint32(len(nameBuffer)) + err := lookupPrivilegeName("", &luid, &nameBuffer[0], &bufSize) + if err != nil { + return fmt.Sprintf("", luid) + } + + var displayNameBuffer [256]uint16 + displayBufSize := uint32(len(displayNameBuffer)) + var langID uint32 + err = lookupPrivilegeDisplayName("", &nameBuffer[0], &displayNameBuffer[0], &displayBufSize, &langID) + if err != nil { + return fmt.Sprintf("", string(utf16.Decode(nameBuffer[:bufSize]))) + } + + return string(utf16.Decode(displayNameBuffer[:displayBufSize])) +} + +func newThreadToken() (windows.Token, error) { + err := impersonateSelf(securityImpersonation) + if err != nil { + return 0, err + } + + var token windows.Token + err = openThreadToken(getCurrentThread(), syscall.TOKEN_ADJUST_PRIVILEGES|syscall.TOKEN_QUERY, false, &token) + if err != nil { + rerr := revertToSelf() + if rerr != nil { + panic(rerr) + } + return 0, err + } + return token, nil +} + +func releaseThreadToken(h windows.Token) { + err := revertToSelf() + if err != nil { + panic(err) + } + h.Close() +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/reparse.go b/integration-test/vendor/github.com/Microsoft/go-winio/reparse.go new file mode 100644 index 000000000..fc1ee4d3a --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/reparse.go @@ -0,0 +1,128 @@ +package winio + +import ( + "bytes" + "encoding/binary" + "fmt" + "strings" + "unicode/utf16" + "unsafe" +) + +const ( + reparseTagMountPoint = 0xA0000003 + reparseTagSymlink = 0xA000000C +) + +type reparseDataBuffer struct { + ReparseTag uint32 + ReparseDataLength uint16 + Reserved uint16 + SubstituteNameOffset uint16 + SubstituteNameLength uint16 + PrintNameOffset uint16 + PrintNameLength uint16 +} + +// ReparsePoint describes a Win32 symlink or mount point. +type ReparsePoint struct { + Target string + IsMountPoint bool +} + +// UnsupportedReparsePointError is returned when trying to decode a non-symlink or +// mount point reparse point. +type UnsupportedReparsePointError struct { + Tag uint32 +} + +func (e *UnsupportedReparsePointError) Error() string { + return fmt.Sprintf("unsupported reparse point %x", e.Tag) +} + +// DecodeReparsePoint decodes a Win32 REPARSE_DATA_BUFFER structure containing either a symlink +// or a mount point. +func DecodeReparsePoint(b []byte) (*ReparsePoint, error) { + tag := binary.LittleEndian.Uint32(b[0:4]) + return DecodeReparsePointData(tag, b[8:]) +} + +func DecodeReparsePointData(tag uint32, b []byte) (*ReparsePoint, error) { + isMountPoint := false + switch tag { + case reparseTagMountPoint: + isMountPoint = true + case reparseTagSymlink: + default: + return nil, &UnsupportedReparsePointError{tag} + } + nameOffset := 8 + binary.LittleEndian.Uint16(b[4:6]) + if !isMountPoint { + nameOffset += 4 + } + nameLength := binary.LittleEndian.Uint16(b[6:8]) + name := make([]uint16, nameLength/2) + err := binary.Read(bytes.NewReader(b[nameOffset:nameOffset+nameLength]), binary.LittleEndian, &name) + if err != nil { + return nil, err + } + return &ReparsePoint{string(utf16.Decode(name)), isMountPoint}, nil +} + +func isDriveLetter(c byte) bool { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') +} + +// EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink or +// mount point. +func EncodeReparsePoint(rp *ReparsePoint) []byte { + // Generate an NT path and determine if this is a relative path. + var ntTarget string + relative := false + if strings.HasPrefix(rp.Target, `\\?\`) { + ntTarget = `\??\` + rp.Target[4:] + } else if strings.HasPrefix(rp.Target, `\\`) { + ntTarget = `\??\UNC\` + rp.Target[2:] + } else if len(rp.Target) >= 2 && isDriveLetter(rp.Target[0]) && rp.Target[1] == ':' { + ntTarget = `\??\` + rp.Target + } else { + ntTarget = rp.Target + relative = true + } + + // The paths must be NUL-terminated even though they are counted strings. + target16 := utf16.Encode([]rune(rp.Target + "\x00")) + ntTarget16 := utf16.Encode([]rune(ntTarget + "\x00")) + + size := int(unsafe.Sizeof(reparseDataBuffer{})) - 8 + size += len(ntTarget16)*2 + len(target16)*2 + + tag := uint32(reparseTagMountPoint) + if !rp.IsMountPoint { + tag = reparseTagSymlink + size += 4 // Add room for symlink flags + } + + data := reparseDataBuffer{ + ReparseTag: tag, + ReparseDataLength: uint16(size), + SubstituteNameOffset: 0, + SubstituteNameLength: uint16((len(ntTarget16) - 1) * 2), + PrintNameOffset: uint16(len(ntTarget16) * 2), + PrintNameLength: uint16((len(target16) - 1) * 2), + } + + var b bytes.Buffer + binary.Write(&b, binary.LittleEndian, &data) + if !rp.IsMountPoint { + flags := uint32(0) + if relative { + flags |= 1 + } + binary.Write(&b, binary.LittleEndian, flags) + } + + binary.Write(&b, binary.LittleEndian, ntTarget16) + binary.Write(&b, binary.LittleEndian, target16) + return b.Bytes() +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/sd.go b/integration-test/vendor/github.com/Microsoft/go-winio/sd.go new file mode 100644 index 000000000..db1b370a1 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/sd.go @@ -0,0 +1,98 @@ +// +build windows + +package winio + +import ( + "syscall" + "unsafe" +) + +//sys lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) = advapi32.LookupAccountNameW +//sys convertSidToStringSid(sid *byte, str **uint16) (err error) = advapi32.ConvertSidToStringSidW +//sys convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) = advapi32.ConvertStringSecurityDescriptorToSecurityDescriptorW +//sys convertSecurityDescriptorToStringSecurityDescriptor(sd *byte, revision uint32, secInfo uint32, sddl **uint16, sddlSize *uint32) (err error) = advapi32.ConvertSecurityDescriptorToStringSecurityDescriptorW +//sys localFree(mem uintptr) = LocalFree +//sys getSecurityDescriptorLength(sd uintptr) (len uint32) = advapi32.GetSecurityDescriptorLength + +const ( + cERROR_NONE_MAPPED = syscall.Errno(1332) +) + +type AccountLookupError struct { + Name string + Err error +} + +func (e *AccountLookupError) Error() string { + if e.Name == "" { + return "lookup account: empty account name specified" + } + var s string + switch e.Err { + case cERROR_NONE_MAPPED: + s = "not found" + default: + s = e.Err.Error() + } + return "lookup account " + e.Name + ": " + s +} + +type SddlConversionError struct { + Sddl string + Err error +} + +func (e *SddlConversionError) Error() string { + return "convert " + e.Sddl + ": " + e.Err.Error() +} + +// LookupSidByName looks up the SID of an account by name +func LookupSidByName(name string) (sid string, err error) { + if name == "" { + return "", &AccountLookupError{name, cERROR_NONE_MAPPED} + } + + var sidSize, sidNameUse, refDomainSize uint32 + err = lookupAccountName(nil, name, nil, &sidSize, nil, &refDomainSize, &sidNameUse) + if err != nil && err != syscall.ERROR_INSUFFICIENT_BUFFER { + return "", &AccountLookupError{name, err} + } + sidBuffer := make([]byte, sidSize) + refDomainBuffer := make([]uint16, refDomainSize) + err = lookupAccountName(nil, name, &sidBuffer[0], &sidSize, &refDomainBuffer[0], &refDomainSize, &sidNameUse) + if err != nil { + return "", &AccountLookupError{name, err} + } + var strBuffer *uint16 + err = convertSidToStringSid(&sidBuffer[0], &strBuffer) + if err != nil { + return "", &AccountLookupError{name, err} + } + sid = syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(strBuffer))[:]) + localFree(uintptr(unsafe.Pointer(strBuffer))) + return sid, nil +} + +func SddlToSecurityDescriptor(sddl string) ([]byte, error) { + var sdBuffer uintptr + err := convertStringSecurityDescriptorToSecurityDescriptor(sddl, 1, &sdBuffer, nil) + if err != nil { + return nil, &SddlConversionError{sddl, err} + } + defer localFree(sdBuffer) + sd := make([]byte, getSecurityDescriptorLength(sdBuffer)) + copy(sd, (*[0xffff]byte)(unsafe.Pointer(sdBuffer))[:len(sd)]) + return sd, nil +} + +func SecurityDescriptorToSddl(sd []byte) (string, error) { + var sddl *uint16 + // The returned string length seems to including an aribtrary number of terminating NULs. + // Don't use it. + err := convertSecurityDescriptorToStringSecurityDescriptor(&sd[0], 1, 0xff, &sddl, nil) + if err != nil { + return "", err + } + defer localFree(uintptr(unsafe.Pointer(sddl))) + return syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(sddl))[:]), nil +} diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/syscall.go b/integration-test/vendor/github.com/Microsoft/go-winio/syscall.go new file mode 100644 index 000000000..5955c99fd --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/syscall.go @@ -0,0 +1,3 @@ +package winio + +//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go file.go pipe.go sd.go fileinfo.go privilege.go backup.go hvsock.go diff --git a/integration-test/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go b/integration-test/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go new file mode 100644 index 000000000..176ff75e3 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go @@ -0,0 +1,427 @@ +// Code generated by 'go generate'; DO NOT EDIT. + +package winio + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/windows" +) + +var _ unsafe.Pointer + +// Do the interface allocations only once for common +// Errno values. +const ( + errnoERROR_IO_PENDING = 997 +) + +var ( + errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_EINVAL error = syscall.EINVAL +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e syscall.Errno) error { + switch e { + case 0: + return errERROR_EINVAL + case errnoERROR_IO_PENDING: + return errERROR_IO_PENDING + } + // TODO: add more here, after collecting data on the common + // error values see on Windows. (perhaps when running + // all.bat?) + return e +} + +var ( + modadvapi32 = windows.NewLazySystemDLL("advapi32.dll") + modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + modntdll = windows.NewLazySystemDLL("ntdll.dll") + modws2_32 = windows.NewLazySystemDLL("ws2_32.dll") + + procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges") + procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW") + procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW") + procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW") + procGetSecurityDescriptorLength = modadvapi32.NewProc("GetSecurityDescriptorLength") + procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf") + procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW") + procLookupPrivilegeDisplayNameW = modadvapi32.NewProc("LookupPrivilegeDisplayNameW") + procLookupPrivilegeNameW = modadvapi32.NewProc("LookupPrivilegeNameW") + procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW") + procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken") + procRevertToSelf = modadvapi32.NewProc("RevertToSelf") + procBackupRead = modkernel32.NewProc("BackupRead") + procBackupWrite = modkernel32.NewProc("BackupWrite") + procCancelIoEx = modkernel32.NewProc("CancelIoEx") + procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe") + procCreateFileW = modkernel32.NewProc("CreateFileW") + procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort") + procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW") + procGetCurrentThread = modkernel32.NewProc("GetCurrentThread") + procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW") + procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo") + procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus") + procLocalAlloc = modkernel32.NewProc("LocalAlloc") + procLocalFree = modkernel32.NewProc("LocalFree") + procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes") + procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile") + procRtlDefaultNpAcl = modntdll.NewProc("RtlDefaultNpAcl") + procRtlDosPathNameToNtPathName_U = modntdll.NewProc("RtlDosPathNameToNtPathName_U") + procRtlNtStatusToDosErrorNoTeb = modntdll.NewProc("RtlNtStatusToDosErrorNoTeb") + procWSAGetOverlappedResult = modws2_32.NewProc("WSAGetOverlappedResult") + procbind = modws2_32.NewProc("bind") +) + +func adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) { + var _p0 uint32 + if releaseAll { + _p0 = 1 + } + r0, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(input)), uintptr(outputSize), uintptr(unsafe.Pointer(output)), uintptr(unsafe.Pointer(requiredSize))) + success = r0 != 0 + if true { + err = errnoErr(e1) + } + return +} + +func convertSecurityDescriptorToStringSecurityDescriptor(sd *byte, revision uint32, secInfo uint32, sddl **uint16, sddlSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(secInfo), uintptr(unsafe.Pointer(sddl)), uintptr(unsafe.Pointer(sddlSize)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func convertSidToStringSid(sid *byte, str **uint16) (err error) { + r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(str)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(str) + if err != nil { + return + } + return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size) +} + +func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd *uintptr, size *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getSecurityDescriptorLength(sd uintptr) (len uint32) { + r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(sd), 0, 0) + len = uint32(r0) + return +} + +func impersonateSelf(level uint32) (err error) { + r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(level), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(accountName) + if err != nil { + return + } + return _lookupAccountName(systemName, _p0, sid, sidSize, refDomain, refDomainSize, sidNameUse) +} + +func _lookupAccountName(systemName *uint16, accountName *uint16, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) { + r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidSize)), uintptr(unsafe.Pointer(refDomain)), uintptr(unsafe.Pointer(refDomainSize)), uintptr(unsafe.Pointer(sidNameUse)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(systemName) + if err != nil { + return + } + return _lookupPrivilegeDisplayName(_p0, name, buffer, size, languageId) +} + +func _lookupPrivilegeDisplayName(systemName *uint16, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procLookupPrivilegeDisplayNameW.Addr(), 5, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(languageId)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(systemName) + if err != nil { + return + } + return _lookupPrivilegeName(_p0, luid, buffer, size) +} + +func _lookupPrivilegeName(systemName *uint16, luid *uint64, buffer *uint16, size *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procLookupPrivilegeNameW.Addr(), 4, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(luid)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(systemName) + if err != nil { + return + } + var _p1 *uint16 + _p1, err = syscall.UTF16PtrFromString(name) + if err != nil { + return + } + return _lookupPrivilegeValue(_p0, _p1, luid) +} + +func _lookupPrivilegeValue(systemName *uint16, name *uint16, luid *uint64) (err error) { + r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) { + var _p0 uint32 + if openAsSelf { + _p0 = 1 + } + r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(accessMask), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func revertToSelf() (err error) { + r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func backupRead(h syscall.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) { + var _p0 *byte + if len(b) > 0 { + _p0 = &b[0] + } + var _p1 uint32 + if abort { + _p1 = 1 + } + var _p2 uint32 + if processSecurity { + _p2 = 1 + } + r1, _, e1 := syscall.Syscall9(procBackupRead.Addr(), 7, uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesRead)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func backupWrite(h syscall.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) { + var _p0 *byte + if len(b) > 0 { + _p0 = &b[0] + } + var _p1 uint32 + if abort { + _p1 = 1 + } + var _p2 uint32 + if processSecurity { + _p2 = 1 + } + r1, _, e1 := syscall.Syscall9(procBackupWrite.Addr(), 7, uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesWritten)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func cancelIoEx(file syscall.Handle, o *syscall.Overlapped) (err error) { + r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(file), uintptr(unsafe.Pointer(o)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) { + r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(o)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func createFile(name string, access uint32, mode uint32, sa *syscall.SecurityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(name) + if err != nil { + return + } + return _createFile(_p0, access, mode, sa, createmode, attrs, templatefile) +} + +func _createFile(name *uint16, access uint32, mode uint32, sa *syscall.SecurityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) { + r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) + handle = syscall.Handle(r0) + if handle == syscall.InvalidHandle { + err = errnoErr(e1) + } + return +} + +func createIoCompletionPort(file syscall.Handle, port syscall.Handle, key uintptr, threadCount uint32) (newport syscall.Handle, err error) { + r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(file), uintptr(port), uintptr(key), uintptr(threadCount), 0, 0) + newport = syscall.Handle(r0) + if newport == 0 { + err = errnoErr(e1) + } + return +} + +func createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(name) + if err != nil { + return + } + return _createNamedPipe(_p0, flags, pipeMode, maxInstances, outSize, inSize, defaultTimeout, sa) +} + +func _createNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) { + r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0) + handle = syscall.Handle(r0) + if handle == syscall.InvalidHandle { + err = errnoErr(e1) + } + return +} + +func getCurrentThread() (h syscall.Handle) { + r0, _, _ := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0) + h = syscall.Handle(r0) + return +} + +func getNamedPipeHandleState(pipe syscall.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { + r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getNamedPipeInfo(pipe syscall.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func getQueuedCompletionStatus(port syscall.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(port), uintptr(unsafe.Pointer(bytes)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(o)), uintptr(timeout), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func localAlloc(uFlags uint32, length uint32) (ptr uintptr) { + r0, _, _ := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(uFlags), uintptr(length), 0) + ptr = uintptr(r0) + return +} + +func localFree(mem uintptr) { + syscall.Syscall(procLocalFree.Addr(), 1, uintptr(mem), 0, 0) + return +} + +func setFileCompletionNotificationModes(h syscall.Handle, flags uint8) (err error) { + r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(h), uintptr(flags), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func ntCreateNamedPipeFile(pipe *syscall.Handle, access uint32, oa *objectAttributes, iosb *ioStatusBlock, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (status ntstatus) { + r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0) + status = ntstatus(r0) + return +} + +func rtlDefaultNpAcl(dacl *uintptr) (status ntstatus) { + r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(dacl)), 0, 0) + status = ntstatus(r0) + return +} + +func rtlDosPathNameToNtPathName(name *uint16, ntName *unicodeString, filePart uintptr, reserved uintptr) (status ntstatus) { + r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(ntName)), uintptr(filePart), uintptr(reserved), 0, 0) + status = ntstatus(r0) + return +} + +func rtlNtStatusToDosError(status ntstatus) (winerr error) { + r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(status), 0, 0) + if r0 != 0 { + winerr = syscall.Errno(r0) + } + return +} + +func wsaGetOverlappedResult(h syscall.Handle, o *syscall.Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) { + var _p0 uint32 + if wait { + _p0 = 1 + } + r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func bind(s syscall.Handle, name unsafe.Pointer, namelen int32) (err error) { + r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + if r1 == socketError { + err = errnoErr(e1) + } + return +} diff --git a/integration-test/vendor/github.com/Microsoft/hcsshim/LICENSE b/integration-test/vendor/github.com/Microsoft/hcsshim/LICENSE new file mode 100644 index 000000000..49d21669a --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/hcsshim/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/integration-test/vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go b/integration-test/vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go new file mode 100644 index 000000000..3ab3bcd89 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go @@ -0,0 +1,50 @@ +package osversion + +import ( + "fmt" + "sync" + + "golang.org/x/sys/windows" +) + +// OSVersion is a wrapper for Windows version information +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx +type OSVersion struct { + Version uint32 + MajorVersion uint8 + MinorVersion uint8 + Build uint16 +} + +var ( + osv OSVersion + once sync.Once +) + +// Get gets the operating system version on Windows. +// The calling application must be manifested to get the correct version information. +func Get() OSVersion { + once.Do(func() { + var err error + osv = OSVersion{} + osv.Version, err = windows.GetVersion() + if err != nil { + // GetVersion never fails. + panic(err) + } + osv.MajorVersion = uint8(osv.Version & 0xFF) + osv.MinorVersion = uint8(osv.Version >> 8 & 0xFF) + osv.Build = uint16(osv.Version >> 16) + }) + return osv +} + +// Build gets the build-number on Windows +// The calling application must be manifested to get the correct version information. +func Build() uint16 { + return Get().Build +} + +func (osv OSVersion) ToString() string { + return fmt.Sprintf("%d.%d.%d", osv.MajorVersion, osv.MinorVersion, osv.Build) +} diff --git a/integration-test/vendor/github.com/Microsoft/hcsshim/osversion/windowsbuilds.go b/integration-test/vendor/github.com/Microsoft/hcsshim/osversion/windowsbuilds.go new file mode 100644 index 000000000..e9267b955 --- /dev/null +++ b/integration-test/vendor/github.com/Microsoft/hcsshim/osversion/windowsbuilds.go @@ -0,0 +1,38 @@ +package osversion + +const ( + // RS1 (version 1607, codename "Redstone 1") corresponds to Windows Server + // 2016 (ltsc2016) and Windows 10 (Anniversary Update). + RS1 = 14393 + + // RS2 (version 1703, codename "Redstone 2") was a client-only update, and + // corresponds to Windows 10 (Creators Update). + RS2 = 15063 + + // RS3 (version 1709, codename "Redstone 3") corresponds to Windows Server + // 1709 (Semi-Annual Channel (SAC)), and Windows 10 (Fall Creators Update). + RS3 = 16299 + + // RS4 (version 1803, codename "Redstone 4") corresponds to Windows Server + // 1803 (Semi-Annual Channel (SAC)), and Windows 10 (April 2018 Update). + RS4 = 17134 + + // RS5 (version 1809, codename "Redstone 5") corresponds to Windows Server + // 2019 (ltsc2019), and Windows 10 (October 2018 Update). + RS5 = 17763 + + // V19H1 (version 1903) corresponds to Windows Server 1903 (semi-annual + // channel). + V19H1 = 18362 + + // V19H2 (version 1909) corresponds to Windows Server 1909 (semi-annual + // channel). + V19H2 = 18363 + + // V20H1 (version 2004) corresponds to Windows Server 2004 (semi-annual + // channel). + V20H1 = 19041 + + // V20H2 corresponds to Windows Server 20H2 (semi-annual channel). + V20H2 = 19042 +) diff --git a/integration-test/vendor/github.com/beorn7/perks/LICENSE b/integration-test/vendor/github.com/beorn7/perks/LICENSE new file mode 100644 index 000000000..339177be6 --- /dev/null +++ b/integration-test/vendor/github.com/beorn7/perks/LICENSE @@ -0,0 +1,20 @@ +Copyright (C) 2013 Blake Mizerany + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/integration-test/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/integration-test/vendor/github.com/beorn7/perks/quantile/exampledata.txt new file mode 100644 index 000000000..1602287d7 --- /dev/null +++ b/integration-test/vendor/github.com/beorn7/perks/quantile/exampledata.txt @@ -0,0 +1,2388 @@ +8 +5 +26 +12 +5 +235 +13 +6 +28 +30 +3 +3 +3 +3 +5 +2 +33 +7 +2 +4 +7 +12 +14 +5 +8 +3 +10 +4 +5 +3 +6 +6 +209 +20 +3 +10 +14 +3 +4 +6 +8 +5 +11 +7 +3 +2 +3 +3 +212 +5 +222 +4 +10 +10 +5 +6 +3 +8 +3 +10 +254 +220 +2 +3 +5 +24 +5 +4 +222 +7 +3 +3 +223 +8 +15 +12 +14 +14 +3 +2 +2 +3 +13 +3 +11 +4 +4 +6 +5 +7 +13 +5 +3 +5 +2 +5 +3 +5 +2 +7 +15 +17 +14 +3 +6 +6 +3 +17 +5 +4 +7 +6 +4 +4 +8 +6 +8 +3 +9 +3 +6 +3 +4 +5 +3 +3 +660 +4 +6 +10 +3 +6 +3 +2 +5 +13 +2 +4 +4 +10 +4 +8 +4 +3 +7 +9 +9 +3 +10 +37 +3 +13 +4 +12 +3 +6 +10 +8 +5 +21 +2 +3 +8 +3 +2 +3 +3 +4 +12 +2 +4 +8 +8 +4 +3 +2 +20 +1 +6 +32 +2 +11 +6 +18 +3 +8 +11 +3 +212 +3 +4 +2 +6 +7 +12 +11 +3 +2 +16 +10 +6 +4 +6 +3 +2 +7 +3 +2 +2 +2 +2 +5 +6 +4 +3 +10 +3 +4 +6 +5 +3 +4 +4 +5 +6 +4 +3 +4 +4 +5 +7 +5 +5 +3 +2 +7 +2 +4 +12 +4 +5 +6 +2 +4 +4 +8 +4 +15 +13 +7 +16 +5 +3 +23 +5 +5 +7 +3 +2 +9 +8 +7 +5 +8 +11 +4 +10 +76 +4 +47 +4 +3 +2 +7 +4 +2 +3 +37 +10 +4 +2 +20 +5 +4 +4 +10 +10 +4 +3 +7 +23 +240 +7 +13 +5 +5 +3 +3 +2 +5 +4 +2 +8 +7 +19 +2 +23 +8 +7 +2 +5 +3 +8 +3 +8 +13 +5 +5 +5 +2 +3 +23 +4 +9 +8 +4 +3 +3 +5 +220 +2 +3 +4 +6 +14 +3 +53 +6 +2 +5 +18 +6 +3 +219 +6 +5 +2 +5 +3 +6 +5 +15 +4 +3 +17 +3 +2 +4 +7 +2 +3 +3 +4 +4 +3 +2 +664 +6 +3 +23 +5 +5 +16 +5 +8 +2 +4 +2 +24 +12 +3 +2 +3 +5 +8 +3 +5 +4 +3 +14 +3 +5 +8 +2 +3 +7 +9 +4 +2 +3 +6 +8 +4 +3 +4 +6 +5 +3 +3 +6 +3 +19 +4 +4 +6 +3 +6 +3 +5 +22 +5 +4 +4 +3 +8 +11 +4 +9 +7 +6 +13 +4 +4 +4 +6 +17 +9 +3 +3 +3 +4 +3 +221 +5 +11 +3 +4 +2 +12 +6 +3 +5 +7 +5 +7 +4 +9 +7 +14 +37 +19 +217 +16 +3 +5 +2 +2 +7 +19 +7 +6 +7 +4 +24 +5 +11 +4 +7 +7 +9 +13 +3 +4 +3 +6 +28 +4 +4 +5 +5 +2 +5 +6 +4 +4 +6 +10 +5 +4 +3 +2 +3 +3 +6 +5 +5 +4 +3 +2 +3 +7 +4 +6 +18 +16 +8 +16 +4 +5 +8 +6 +9 +13 +1545 +6 +215 +6 +5 +6 +3 +45 +31 +5 +2 +2 +4 +3 +3 +2 +5 +4 +3 +5 +7 +7 +4 +5 +8 +5 +4 +749 +2 +31 +9 +11 +2 +11 +5 +4 +4 +7 +9 +11 +4 +5 +4 +7 +3 +4 +6 +2 +15 +3 +4 +3 +4 +3 +5 +2 +13 +5 +5 +3 +3 +23 +4 +4 +5 +7 +4 +13 +2 +4 +3 +4 +2 +6 +2 +7 +3 +5 +5 +3 +29 +5 +4 +4 +3 +10 +2 +3 +79 +16 +6 +6 +7 +7 +3 +5 +5 +7 +4 +3 +7 +9 +5 +6 +5 +9 +6 +3 +6 +4 +17 +2 +10 +9 +3 +6 +2 +3 +21 +22 +5 +11 +4 +2 +17 +2 +224 +2 +14 +3 +4 +4 +2 +4 +4 +4 +4 +5 +3 +4 +4 +10 +2 +6 +3 +3 +5 +7 +2 +7 +5 +6 +3 +218 +2 +2 +5 +2 +6 +3 +5 +222 +14 +6 +33 +3 +2 +5 +3 +3 +3 +9 +5 +3 +3 +2 +7 +4 +3 +4 +3 +5 +6 +5 +26 +4 +13 +9 +7 +3 +221 +3 +3 +4 +4 +4 +4 +2 +18 +5 +3 +7 +9 +6 +8 +3 +10 +3 +11 +9 +5 +4 +17 +5 +5 +6 +6 +3 +2 +4 +12 +17 +6 +7 +218 +4 +2 +4 +10 +3 +5 +15 +3 +9 +4 +3 +3 +6 +29 +3 +3 +4 +5 +5 +3 +8 +5 +6 +6 +7 +5 +3 +5 +3 +29 +2 +31 +5 +15 +24 +16 +5 +207 +4 +3 +3 +2 +15 +4 +4 +13 +5 +5 +4 +6 +10 +2 +7 +8 +4 +6 +20 +5 +3 +4 +3 +12 +12 +5 +17 +7 +3 +3 +3 +6 +10 +3 +5 +25 +80 +4 +9 +3 +2 +11 +3 +3 +2 +3 +8 +7 +5 +5 +19 +5 +3 +3 +12 +11 +2 +6 +5 +5 +5 +3 +3 +3 +4 +209 +14 +3 +2 +5 +19 +4 +4 +3 +4 +14 +5 +6 +4 +13 +9 +7 +4 +7 +10 +2 +9 +5 +7 +2 +8 +4 +6 +5 +5 +222 +8 +7 +12 +5 +216 +3 +4 +4 +6 +3 +14 +8 +7 +13 +4 +3 +3 +3 +3 +17 +5 +4 +3 +33 +6 +6 +33 +7 +5 +3 +8 +7 +5 +2 +9 +4 +2 +233 +24 +7 +4 +8 +10 +3 +4 +15 +2 +16 +3 +3 +13 +12 +7 +5 +4 +207 +4 +2 +4 +27 +15 +2 +5 +2 +25 +6 +5 +5 +6 +13 +6 +18 +6 +4 +12 +225 +10 +7 +5 +2 +2 +11 +4 +14 +21 +8 +10 +3 +5 +4 +232 +2 +5 +5 +3 +7 +17 +11 +6 +6 +23 +4 +6 +3 +5 +4 +2 +17 +3 +6 +5 +8 +3 +2 +2 +14 +9 +4 +4 +2 +5 +5 +3 +7 +6 +12 +6 +10 +3 +6 +2 +2 +19 +5 +4 +4 +9 +2 +4 +13 +3 +5 +6 +3 +6 +5 +4 +9 +6 +3 +5 +7 +3 +6 +6 +4 +3 +10 +6 +3 +221 +3 +5 +3 +6 +4 +8 +5 +3 +6 +4 +4 +2 +54 +5 +6 +11 +3 +3 +4 +4 +4 +3 +7 +3 +11 +11 +7 +10 +6 +13 +223 +213 +15 +231 +7 +3 +7 +228 +2 +3 +4 +4 +5 +6 +7 +4 +13 +3 +4 +5 +3 +6 +4 +6 +7 +2 +4 +3 +4 +3 +3 +6 +3 +7 +3 +5 +18 +5 +6 +8 +10 +3 +3 +3 +2 +4 +2 +4 +4 +5 +6 +6 +4 +10 +13 +3 +12 +5 +12 +16 +8 +4 +19 +11 +2 +4 +5 +6 +8 +5 +6 +4 +18 +10 +4 +2 +216 +6 +6 +6 +2 +4 +12 +8 +3 +11 +5 +6 +14 +5 +3 +13 +4 +5 +4 +5 +3 +28 +6 +3 +7 +219 +3 +9 +7 +3 +10 +6 +3 +4 +19 +5 +7 +11 +6 +15 +19 +4 +13 +11 +3 +7 +5 +10 +2 +8 +11 +2 +6 +4 +6 +24 +6 +3 +3 +3 +3 +6 +18 +4 +11 +4 +2 +5 +10 +8 +3 +9 +5 +3 +4 +5 +6 +2 +5 +7 +4 +4 +14 +6 +4 +4 +5 +5 +7 +2 +4 +3 +7 +3 +3 +6 +4 +5 +4 +4 +4 +3 +3 +3 +3 +8 +14 +2 +3 +5 +3 +2 +4 +5 +3 +7 +3 +3 +18 +3 +4 +4 +5 +7 +3 +3 +3 +13 +5 +4 +8 +211 +5 +5 +3 +5 +2 +5 +4 +2 +655 +6 +3 +5 +11 +2 +5 +3 +12 +9 +15 +11 +5 +12 +217 +2 +6 +17 +3 +3 +207 +5 +5 +4 +5 +9 +3 +2 +8 +5 +4 +3 +2 +5 +12 +4 +14 +5 +4 +2 +13 +5 +8 +4 +225 +4 +3 +4 +5 +4 +3 +3 +6 +23 +9 +2 +6 +7 +233 +4 +4 +6 +18 +3 +4 +6 +3 +4 +4 +2 +3 +7 +4 +13 +227 +4 +3 +5 +4 +2 +12 +9 +17 +3 +7 +14 +6 +4 +5 +21 +4 +8 +9 +2 +9 +25 +16 +3 +6 +4 +7 +8 +5 +2 +3 +5 +4 +3 +3 +5 +3 +3 +3 +2 +3 +19 +2 +4 +3 +4 +2 +3 +4 +4 +2 +4 +3 +3 +3 +2 +6 +3 +17 +5 +6 +4 +3 +13 +5 +3 +3 +3 +4 +9 +4 +2 +14 +12 +4 +5 +24 +4 +3 +37 +12 +11 +21 +3 +4 +3 +13 +4 +2 +3 +15 +4 +11 +4 +4 +3 +8 +3 +4 +4 +12 +8 +5 +3 +3 +4 +2 +220 +3 +5 +223 +3 +3 +3 +10 +3 +15 +4 +241 +9 +7 +3 +6 +6 +23 +4 +13 +7 +3 +4 +7 +4 +9 +3 +3 +4 +10 +5 +5 +1 +5 +24 +2 +4 +5 +5 +6 +14 +3 +8 +2 +3 +5 +13 +13 +3 +5 +2 +3 +15 +3 +4 +2 +10 +4 +4 +4 +5 +5 +3 +5 +3 +4 +7 +4 +27 +3 +6 +4 +15 +3 +5 +6 +6 +5 +4 +8 +3 +9 +2 +6 +3 +4 +3 +7 +4 +18 +3 +11 +3 +3 +8 +9 +7 +24 +3 +219 +7 +10 +4 +5 +9 +12 +2 +5 +4 +4 +4 +3 +3 +19 +5 +8 +16 +8 +6 +22 +3 +23 +3 +242 +9 +4 +3 +3 +5 +7 +3 +3 +5 +8 +3 +7 +5 +14 +8 +10 +3 +4 +3 +7 +4 +6 +7 +4 +10 +4 +3 +11 +3 +7 +10 +3 +13 +6 +8 +12 +10 +5 +7 +9 +3 +4 +7 +7 +10 +8 +30 +9 +19 +4 +3 +19 +15 +4 +13 +3 +215 +223 +4 +7 +4 +8 +17 +16 +3 +7 +6 +5 +5 +4 +12 +3 +7 +4 +4 +13 +4 +5 +2 +5 +6 +5 +6 +6 +7 +10 +18 +23 +9 +3 +3 +6 +5 +2 +4 +2 +7 +3 +3 +2 +5 +5 +14 +10 +224 +6 +3 +4 +3 +7 +5 +9 +3 +6 +4 +2 +5 +11 +4 +3 +3 +2 +8 +4 +7 +4 +10 +7 +3 +3 +18 +18 +17 +3 +3 +3 +4 +5 +3 +3 +4 +12 +7 +3 +11 +13 +5 +4 +7 +13 +5 +4 +11 +3 +12 +3 +6 +4 +4 +21 +4 +6 +9 +5 +3 +10 +8 +4 +6 +4 +4 +6 +5 +4 +8 +6 +4 +6 +4 +4 +5 +9 +6 +3 +4 +2 +9 +3 +18 +2 +4 +3 +13 +3 +6 +6 +8 +7 +9 +3 +2 +16 +3 +4 +6 +3 +2 +33 +22 +14 +4 +9 +12 +4 +5 +6 +3 +23 +9 +4 +3 +5 +5 +3 +4 +5 +3 +5 +3 +10 +4 +5 +5 +8 +4 +4 +6 +8 +5 +4 +3 +4 +6 +3 +3 +3 +5 +9 +12 +6 +5 +9 +3 +5 +3 +2 +2 +2 +18 +3 +2 +21 +2 +5 +4 +6 +4 +5 +10 +3 +9 +3 +2 +10 +7 +3 +6 +6 +4 +4 +8 +12 +7 +3 +7 +3 +3 +9 +3 +4 +5 +4 +4 +5 +5 +10 +15 +4 +4 +14 +6 +227 +3 +14 +5 +216 +22 +5 +4 +2 +2 +6 +3 +4 +2 +9 +9 +4 +3 +28 +13 +11 +4 +5 +3 +3 +2 +3 +3 +5 +3 +4 +3 +5 +23 +26 +3 +4 +5 +6 +4 +6 +3 +5 +5 +3 +4 +3 +2 +2 +2 +7 +14 +3 +6 +7 +17 +2 +2 +15 +14 +16 +4 +6 +7 +13 +6 +4 +5 +6 +16 +3 +3 +28 +3 +6 +15 +3 +9 +2 +4 +6 +3 +3 +22 +4 +12 +6 +7 +2 +5 +4 +10 +3 +16 +6 +9 +2 +5 +12 +7 +5 +5 +5 +5 +2 +11 +9 +17 +4 +3 +11 +7 +3 +5 +15 +4 +3 +4 +211 +8 +7 +5 +4 +7 +6 +7 +6 +3 +6 +5 +6 +5 +3 +4 +4 +26 +4 +6 +10 +4 +4 +3 +2 +3 +3 +4 +5 +9 +3 +9 +4 +4 +5 +5 +8 +2 +4 +2 +3 +8 +4 +11 +19 +5 +8 +6 +3 +5 +6 +12 +3 +2 +4 +16 +12 +3 +4 +4 +8 +6 +5 +6 +6 +219 +8 +222 +6 +16 +3 +13 +19 +5 +4 +3 +11 +6 +10 +4 +7 +7 +12 +5 +3 +3 +5 +6 +10 +3 +8 +2 +5 +4 +7 +2 +4 +4 +2 +12 +9 +6 +4 +2 +40 +2 +4 +10 +4 +223 +4 +2 +20 +6 +7 +24 +5 +4 +5 +2 +20 +16 +6 +5 +13 +2 +3 +3 +19 +3 +2 +4 +5 +6 +7 +11 +12 +5 +6 +7 +7 +3 +5 +3 +5 +3 +14 +3 +4 +4 +2 +11 +1 +7 +3 +9 +6 +11 +12 +5 +8 +6 +221 +4 +2 +12 +4 +3 +15 +4 +5 +226 +7 +218 +7 +5 +4 +5 +18 +4 +5 +9 +4 +4 +2 +9 +18 +18 +9 +5 +6 +6 +3 +3 +7 +3 +5 +4 +4 +4 +12 +3 +6 +31 +5 +4 +7 +3 +6 +5 +6 +5 +11 +2 +2 +11 +11 +6 +7 +5 +8 +7 +10 +5 +23 +7 +4 +3 +5 +34 +2 +5 +23 +7 +3 +6 +8 +4 +4 +4 +2 +5 +3 +8 +5 +4 +8 +25 +2 +3 +17 +8 +3 +4 +8 +7 +3 +15 +6 +5 +7 +21 +9 +5 +6 +6 +5 +3 +2 +3 +10 +3 +6 +3 +14 +7 +4 +4 +8 +7 +8 +2 +6 +12 +4 +213 +6 +5 +21 +8 +2 +5 +23 +3 +11 +2 +3 +6 +25 +2 +3 +6 +7 +6 +6 +4 +4 +6 +3 +17 +9 +7 +6 +4 +3 +10 +7 +2 +3 +3 +3 +11 +8 +3 +7 +6 +4 +14 +36 +3 +4 +3 +3 +22 +13 +21 +4 +2 +7 +4 +4 +17 +15 +3 +7 +11 +2 +4 +7 +6 +209 +6 +3 +2 +2 +24 +4 +9 +4 +3 +3 +3 +29 +2 +2 +4 +3 +3 +5 +4 +6 +3 +3 +2 +4 diff --git a/integration-test/vendor/github.com/beorn7/perks/quantile/stream.go b/integration-test/vendor/github.com/beorn7/perks/quantile/stream.go new file mode 100644 index 000000000..d7d14f8eb --- /dev/null +++ b/integration-test/vendor/github.com/beorn7/perks/quantile/stream.go @@ -0,0 +1,316 @@ +// Package quantile computes approximate quantiles over an unbounded data +// stream within low memory and CPU bounds. +// +// A small amount of accuracy is traded to achieve the above properties. +// +// Multiple streams can be merged before calling Query to generate a single set +// of results. This is meaningful when the streams represent the same type of +// data. See Merge and Samples. +// +// For more detailed information about the algorithm used, see: +// +// Effective Computation of Biased Quantiles over Data Streams +// +// http://www.cs.rutgers.edu/~muthu/bquant.pdf +package quantile + +import ( + "math" + "sort" +) + +// Sample holds an observed value and meta information for compression. JSON +// tags have been added for convenience. +type Sample struct { + Value float64 `json:",string"` + Width float64 `json:",string"` + Delta float64 `json:",string"` +} + +// Samples represents a slice of samples. It implements sort.Interface. +type Samples []Sample + +func (a Samples) Len() int { return len(a) } +func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value } +func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] } + +type invariant func(s *stream, r float64) float64 + +// NewLowBiased returns an initialized Stream for low-biased quantiles +// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but +// error guarantees can still be given even for the lower ranks of the data +// distribution. +// +// The provided epsilon is a relative error, i.e. the true quantile of a value +// returned by a query is guaranteed to be within (1±Epsilon)*Quantile. +// +// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error +// properties. +func NewLowBiased(epsilon float64) *Stream { + ƒ := func(s *stream, r float64) float64 { + return 2 * epsilon * r + } + return newStream(ƒ) +} + +// NewHighBiased returns an initialized Stream for high-biased quantiles +// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but +// error guarantees can still be given even for the higher ranks of the data +// distribution. +// +// The provided epsilon is a relative error, i.e. the true quantile of a value +// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile). +// +// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error +// properties. +func NewHighBiased(epsilon float64) *Stream { + ƒ := func(s *stream, r float64) float64 { + return 2 * epsilon * (s.n - r) + } + return newStream(ƒ) +} + +// NewTargeted returns an initialized Stream concerned with a particular set of +// quantile values that are supplied a priori. Knowing these a priori reduces +// space and computation time. The targets map maps the desired quantiles to +// their absolute errors, i.e. the true quantile of a value returned by a query +// is guaranteed to be within (Quantile±Epsilon). +// +// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties. +func NewTargeted(targetMap map[float64]float64) *Stream { + // Convert map to slice to avoid slow iterations on a map. + // ƒ is called on the hot path, so converting the map to a slice + // beforehand results in significant CPU savings. + targets := targetMapToSlice(targetMap) + + ƒ := func(s *stream, r float64) float64 { + var m = math.MaxFloat64 + var f float64 + for _, t := range targets { + if t.quantile*s.n <= r { + f = (2 * t.epsilon * r) / t.quantile + } else { + f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile) + } + if f < m { + m = f + } + } + return m + } + return newStream(ƒ) +} + +type target struct { + quantile float64 + epsilon float64 +} + +func targetMapToSlice(targetMap map[float64]float64) []target { + targets := make([]target, 0, len(targetMap)) + + for quantile, epsilon := range targetMap { + t := target{ + quantile: quantile, + epsilon: epsilon, + } + targets = append(targets, t) + } + + return targets +} + +// Stream computes quantiles for a stream of float64s. It is not thread-safe by +// design. Take care when using across multiple goroutines. +type Stream struct { + *stream + b Samples + sorted bool +} + +func newStream(ƒ invariant) *Stream { + x := &stream{ƒ: ƒ} + return &Stream{x, make(Samples, 0, 500), true} +} + +// Insert inserts v into the stream. +func (s *Stream) Insert(v float64) { + s.insert(Sample{Value: v, Width: 1}) +} + +func (s *Stream) insert(sample Sample) { + s.b = append(s.b, sample) + s.sorted = false + if len(s.b) == cap(s.b) { + s.flush() + } +} + +// Query returns the computed qth percentiles value. If s was created with +// NewTargeted, and q is not in the set of quantiles provided a priori, Query +// will return an unspecified result. +func (s *Stream) Query(q float64) float64 { + if !s.flushed() { + // Fast path when there hasn't been enough data for a flush; + // this also yields better accuracy for small sets of data. + l := len(s.b) + if l == 0 { + return 0 + } + i := int(math.Ceil(float64(l) * q)) + if i > 0 { + i -= 1 + } + s.maybeSort() + return s.b[i].Value + } + s.flush() + return s.stream.query(q) +} + +// Merge merges samples into the underlying streams samples. This is handy when +// merging multiple streams from separate threads, database shards, etc. +// +// ATTENTION: This method is broken and does not yield correct results. The +// underlying algorithm is not capable of merging streams correctly. +func (s *Stream) Merge(samples Samples) { + sort.Sort(samples) + s.stream.merge(samples) +} + +// Reset reinitializes and clears the list reusing the samples buffer memory. +func (s *Stream) Reset() { + s.stream.reset() + s.b = s.b[:0] +} + +// Samples returns stream samples held by s. +func (s *Stream) Samples() Samples { + if !s.flushed() { + return s.b + } + s.flush() + return s.stream.samples() +} + +// Count returns the total number of samples observed in the stream +// since initialization. +func (s *Stream) Count() int { + return len(s.b) + s.stream.count() +} + +func (s *Stream) flush() { + s.maybeSort() + s.stream.merge(s.b) + s.b = s.b[:0] +} + +func (s *Stream) maybeSort() { + if !s.sorted { + s.sorted = true + sort.Sort(s.b) + } +} + +func (s *Stream) flushed() bool { + return len(s.stream.l) > 0 +} + +type stream struct { + n float64 + l []Sample + ƒ invariant +} + +func (s *stream) reset() { + s.l = s.l[:0] + s.n = 0 +} + +func (s *stream) insert(v float64) { + s.merge(Samples{{v, 1, 0}}) +} + +func (s *stream) merge(samples Samples) { + // TODO(beorn7): This tries to merge not only individual samples, but + // whole summaries. The paper doesn't mention merging summaries at + // all. Unittests show that the merging is inaccurate. Find out how to + // do merges properly. + var r float64 + i := 0 + for _, sample := range samples { + for ; i < len(s.l); i++ { + c := s.l[i] + if c.Value > sample.Value { + // Insert at position i. + s.l = append(s.l, Sample{}) + copy(s.l[i+1:], s.l[i:]) + s.l[i] = Sample{ + sample.Value, + sample.Width, + math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1), + // TODO(beorn7): How to calculate delta correctly? + } + i++ + goto inserted + } + r += c.Width + } + s.l = append(s.l, Sample{sample.Value, sample.Width, 0}) + i++ + inserted: + s.n += sample.Width + r += sample.Width + } + s.compress() +} + +func (s *stream) count() int { + return int(s.n) +} + +func (s *stream) query(q float64) float64 { + t := math.Ceil(q * s.n) + t += math.Ceil(s.ƒ(s, t) / 2) + p := s.l[0] + var r float64 + for _, c := range s.l[1:] { + r += p.Width + if r+c.Width+c.Delta > t { + return p.Value + } + p = c + } + return p.Value +} + +func (s *stream) compress() { + if len(s.l) < 2 { + return + } + x := s.l[len(s.l)-1] + xi := len(s.l) - 1 + r := s.n - 1 - x.Width + + for i := len(s.l) - 2; i >= 0; i-- { + c := s.l[i] + if c.Width+x.Width+x.Delta <= s.ƒ(s, r) { + x.Width += c.Width + s.l[xi] = x + // Remove element at i. + copy(s.l[i:], s.l[i+1:]) + s.l = s.l[:len(s.l)-1] + xi -= 1 + } else { + x = c + xi = i + } + r -= c.Width + } +} + +func (s *stream) samples() Samples { + samples := make(Samples, len(s.l)) + copy(samples, s.l) + return samples +} diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/.travis.yml b/integration-test/vendor/github.com/cespare/xxhash/v2/.travis.yml new file mode 100644 index 000000000..c516ea88d --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/.travis.yml @@ -0,0 +1,8 @@ +language: go +go: + - "1.x" + - master +env: + - TAGS="" + - TAGS="-tags purego" +script: go test $TAGS -v ./... diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/LICENSE.txt b/integration-test/vendor/github.com/cespare/xxhash/v2/LICENSE.txt new file mode 100644 index 000000000..24b53065f --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2016 Caleb Spare + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/README.md b/integration-test/vendor/github.com/cespare/xxhash/v2/README.md new file mode 100644 index 000000000..2fd8693c2 --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/README.md @@ -0,0 +1,67 @@ +# xxhash + +[![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash) +[![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash) + +xxhash is a Go implementation of the 64-bit +[xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a +high-quality hashing algorithm that is much faster than anything in the Go +standard library. + +This package provides a straightforward API: + +``` +func Sum64(b []byte) uint64 +func Sum64String(s string) uint64 +type Digest struct{ ... } + func New() *Digest +``` + +The `Digest` type implements hash.Hash64. Its key methods are: + +``` +func (*Digest) Write([]byte) (int, error) +func (*Digest) WriteString(string) (int, error) +func (*Digest) Sum64() uint64 +``` + +This implementation provides a fast pure-Go implementation and an even faster +assembly implementation for amd64. + +## Compatibility + +This package is in a module and the latest code is in version 2 of the module. +You need a version of Go with at least "minimal module compatibility" to use +github.com/cespare/xxhash/v2: + +* 1.9.7+ for Go 1.9 +* 1.10.3+ for Go 1.10 +* Go 1.11 or later + +I recommend using the latest release of Go. + +## Benchmarks + +Here are some quick benchmarks comparing the pure-Go and assembly +implementations of Sum64. + +| input size | purego | asm | +| --- | --- | --- | +| 5 B | 979.66 MB/s | 1291.17 MB/s | +| 100 B | 7475.26 MB/s | 7973.40 MB/s | +| 4 KB | 17573.46 MB/s | 17602.65 MB/s | +| 10 MB | 17131.46 MB/s | 17142.16 MB/s | + +These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using +the following commands under Go 1.11.2: + +``` +$ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes' +$ go test -benchtime 10s -bench '/xxhash,direct,bytes' +``` + +## Projects using this package + +- [InfluxDB](https://github.com/influxdata/influxdb) +- [Prometheus](https://github.com/prometheus/prometheus) +- [FreeCache](https://github.com/coocood/freecache) diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash.go b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash.go new file mode 100644 index 000000000..db0b35fbe --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash.go @@ -0,0 +1,236 @@ +// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described +// at http://cyan4973.github.io/xxHash/. +package xxhash + +import ( + "encoding/binary" + "errors" + "math/bits" +) + +const ( + prime1 uint64 = 11400714785074694791 + prime2 uint64 = 14029467366897019727 + prime3 uint64 = 1609587929392839161 + prime4 uint64 = 9650029242287828579 + prime5 uint64 = 2870177450012600261 +) + +// NOTE(caleb): I'm using both consts and vars of the primes. Using consts where +// possible in the Go code is worth a small (but measurable) performance boost +// by avoiding some MOVQs. Vars are needed for the asm and also are useful for +// convenience in the Go code in a few places where we need to intentionally +// avoid constant arithmetic (e.g., v1 := prime1 + prime2 fails because the +// result overflows a uint64). +var ( + prime1v = prime1 + prime2v = prime2 + prime3v = prime3 + prime4v = prime4 + prime5v = prime5 +) + +// Digest implements hash.Hash64. +type Digest struct { + v1 uint64 + v2 uint64 + v3 uint64 + v4 uint64 + total uint64 + mem [32]byte + n int // how much of mem is used +} + +// New creates a new Digest that computes the 64-bit xxHash algorithm. +func New() *Digest { + var d Digest + d.Reset() + return &d +} + +// Reset clears the Digest's state so that it can be reused. +func (d *Digest) Reset() { + d.v1 = prime1v + prime2 + d.v2 = prime2 + d.v3 = 0 + d.v4 = -prime1v + d.total = 0 + d.n = 0 +} + +// Size always returns 8 bytes. +func (d *Digest) Size() int { return 8 } + +// BlockSize always returns 32 bytes. +func (d *Digest) BlockSize() int { return 32 } + +// Write adds more data to d. It always returns len(b), nil. +func (d *Digest) Write(b []byte) (n int, err error) { + n = len(b) + d.total += uint64(n) + + if d.n+n < 32 { + // This new data doesn't even fill the current block. + copy(d.mem[d.n:], b) + d.n += n + return + } + + if d.n > 0 { + // Finish off the partial block. + copy(d.mem[d.n:], b) + d.v1 = round(d.v1, u64(d.mem[0:8])) + d.v2 = round(d.v2, u64(d.mem[8:16])) + d.v3 = round(d.v3, u64(d.mem[16:24])) + d.v4 = round(d.v4, u64(d.mem[24:32])) + b = b[32-d.n:] + d.n = 0 + } + + if len(b) >= 32 { + // One or more full blocks left. + nw := writeBlocks(d, b) + b = b[nw:] + } + + // Store any remaining partial block. + copy(d.mem[:], b) + d.n = len(b) + + return +} + +// Sum appends the current hash to b and returns the resulting slice. +func (d *Digest) Sum(b []byte) []byte { + s := d.Sum64() + return append( + b, + byte(s>>56), + byte(s>>48), + byte(s>>40), + byte(s>>32), + byte(s>>24), + byte(s>>16), + byte(s>>8), + byte(s), + ) +} + +// Sum64 returns the current hash. +func (d *Digest) Sum64() uint64 { + var h uint64 + + if d.total >= 32 { + v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 + h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) + h = mergeRound(h, v1) + h = mergeRound(h, v2) + h = mergeRound(h, v3) + h = mergeRound(h, v4) + } else { + h = d.v3 + prime5 + } + + h += d.total + + i, end := 0, d.n + for ; i+8 <= end; i += 8 { + k1 := round(0, u64(d.mem[i:i+8])) + h ^= k1 + h = rol27(h)*prime1 + prime4 + } + if i+4 <= end { + h ^= uint64(u32(d.mem[i:i+4])) * prime1 + h = rol23(h)*prime2 + prime3 + i += 4 + } + for i < end { + h ^= uint64(d.mem[i]) * prime5 + h = rol11(h) * prime1 + i++ + } + + h ^= h >> 33 + h *= prime2 + h ^= h >> 29 + h *= prime3 + h ^= h >> 32 + + return h +} + +const ( + magic = "xxh\x06" + marshaledSize = len(magic) + 8*5 + 32 +) + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (d *Digest) MarshalBinary() ([]byte, error) { + b := make([]byte, 0, marshaledSize) + b = append(b, magic...) + b = appendUint64(b, d.v1) + b = appendUint64(b, d.v2) + b = appendUint64(b, d.v3) + b = appendUint64(b, d.v4) + b = appendUint64(b, d.total) + b = append(b, d.mem[:d.n]...) + b = b[:len(b)+len(d.mem)-d.n] + return b, nil +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +func (d *Digest) UnmarshalBinary(b []byte) error { + if len(b) < len(magic) || string(b[:len(magic)]) != magic { + return errors.New("xxhash: invalid hash state identifier") + } + if len(b) != marshaledSize { + return errors.New("xxhash: invalid hash state size") + } + b = b[len(magic):] + b, d.v1 = consumeUint64(b) + b, d.v2 = consumeUint64(b) + b, d.v3 = consumeUint64(b) + b, d.v4 = consumeUint64(b) + b, d.total = consumeUint64(b) + copy(d.mem[:], b) + b = b[len(d.mem):] + d.n = int(d.total % uint64(len(d.mem))) + return nil +} + +func appendUint64(b []byte, x uint64) []byte { + var a [8]byte + binary.LittleEndian.PutUint64(a[:], x) + return append(b, a[:]...) +} + +func consumeUint64(b []byte) ([]byte, uint64) { + x := u64(b) + return b[8:], x +} + +func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) } +func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) } + +func round(acc, input uint64) uint64 { + acc += input * prime2 + acc = rol31(acc) + acc *= prime1 + return acc +} + +func mergeRound(acc, val uint64) uint64 { + val = round(0, val) + acc ^= val + acc = acc*prime1 + prime4 + return acc +} + +func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) } +func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) } +func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) } +func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) } +func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) } +func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) } +func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) } +func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) } diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go new file mode 100644 index 000000000..ad14b807f --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go @@ -0,0 +1,13 @@ +// +build !appengine +// +build gc +// +build !purego + +package xxhash + +// Sum64 computes the 64-bit xxHash digest of b. +// +//go:noescape +func Sum64(b []byte) uint64 + +//go:noescape +func writeBlocks(d *Digest, b []byte) int diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s new file mode 100644 index 000000000..d580e32ae --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s @@ -0,0 +1,215 @@ +// +build !appengine +// +build gc +// +build !purego + +#include "textflag.h" + +// Register allocation: +// AX h +// CX pointer to advance through b +// DX n +// BX loop end +// R8 v1, k1 +// R9 v2 +// R10 v3 +// R11 v4 +// R12 tmp +// R13 prime1v +// R14 prime2v +// R15 prime4v + +// round reads from and advances the buffer pointer in CX. +// It assumes that R13 has prime1v and R14 has prime2v. +#define round(r) \ + MOVQ (CX), R12 \ + ADDQ $8, CX \ + IMULQ R14, R12 \ + ADDQ R12, r \ + ROLQ $31, r \ + IMULQ R13, r + +// mergeRound applies a merge round on the two registers acc and val. +// It assumes that R13 has prime1v, R14 has prime2v, and R15 has prime4v. +#define mergeRound(acc, val) \ + IMULQ R14, val \ + ROLQ $31, val \ + IMULQ R13, val \ + XORQ val, acc \ + IMULQ R13, acc \ + ADDQ R15, acc + +// func Sum64(b []byte) uint64 +TEXT ·Sum64(SB), NOSPLIT, $0-32 + // Load fixed primes. + MOVQ ·prime1v(SB), R13 + MOVQ ·prime2v(SB), R14 + MOVQ ·prime4v(SB), R15 + + // Load slice. + MOVQ b_base+0(FP), CX + MOVQ b_len+8(FP), DX + LEAQ (CX)(DX*1), BX + + // The first loop limit will be len(b)-32. + SUBQ $32, BX + + // Check whether we have at least one block. + CMPQ DX, $32 + JLT noBlocks + + // Set up initial state (v1, v2, v3, v4). + MOVQ R13, R8 + ADDQ R14, R8 + MOVQ R14, R9 + XORQ R10, R10 + XORQ R11, R11 + SUBQ R13, R11 + + // Loop until CX > BX. +blockLoop: + round(R8) + round(R9) + round(R10) + round(R11) + + CMPQ CX, BX + JLE blockLoop + + MOVQ R8, AX + ROLQ $1, AX + MOVQ R9, R12 + ROLQ $7, R12 + ADDQ R12, AX + MOVQ R10, R12 + ROLQ $12, R12 + ADDQ R12, AX + MOVQ R11, R12 + ROLQ $18, R12 + ADDQ R12, AX + + mergeRound(AX, R8) + mergeRound(AX, R9) + mergeRound(AX, R10) + mergeRound(AX, R11) + + JMP afterBlocks + +noBlocks: + MOVQ ·prime5v(SB), AX + +afterBlocks: + ADDQ DX, AX + + // Right now BX has len(b)-32, and we want to loop until CX > len(b)-8. + ADDQ $24, BX + + CMPQ CX, BX + JG fourByte + +wordLoop: + // Calculate k1. + MOVQ (CX), R8 + ADDQ $8, CX + IMULQ R14, R8 + ROLQ $31, R8 + IMULQ R13, R8 + + XORQ R8, AX + ROLQ $27, AX + IMULQ R13, AX + ADDQ R15, AX + + CMPQ CX, BX + JLE wordLoop + +fourByte: + ADDQ $4, BX + CMPQ CX, BX + JG singles + + MOVL (CX), R8 + ADDQ $4, CX + IMULQ R13, R8 + XORQ R8, AX + + ROLQ $23, AX + IMULQ R14, AX + ADDQ ·prime3v(SB), AX + +singles: + ADDQ $4, BX + CMPQ CX, BX + JGE finalize + +singlesLoop: + MOVBQZX (CX), R12 + ADDQ $1, CX + IMULQ ·prime5v(SB), R12 + XORQ R12, AX + + ROLQ $11, AX + IMULQ R13, AX + + CMPQ CX, BX + JL singlesLoop + +finalize: + MOVQ AX, R12 + SHRQ $33, R12 + XORQ R12, AX + IMULQ R14, AX + MOVQ AX, R12 + SHRQ $29, R12 + XORQ R12, AX + IMULQ ·prime3v(SB), AX + MOVQ AX, R12 + SHRQ $32, R12 + XORQ R12, AX + + MOVQ AX, ret+24(FP) + RET + +// writeBlocks uses the same registers as above except that it uses AX to store +// the d pointer. + +// func writeBlocks(d *Digest, b []byte) int +TEXT ·writeBlocks(SB), NOSPLIT, $0-40 + // Load fixed primes needed for round. + MOVQ ·prime1v(SB), R13 + MOVQ ·prime2v(SB), R14 + + // Load slice. + MOVQ b_base+8(FP), CX + MOVQ b_len+16(FP), DX + LEAQ (CX)(DX*1), BX + SUBQ $32, BX + + // Load vN from d. + MOVQ d+0(FP), AX + MOVQ 0(AX), R8 // v1 + MOVQ 8(AX), R9 // v2 + MOVQ 16(AX), R10 // v3 + MOVQ 24(AX), R11 // v4 + + // We don't need to check the loop condition here; this function is + // always called with at least one block of data to process. +blockLoop: + round(R8) + round(R9) + round(R10) + round(R11) + + CMPQ CX, BX + JLE blockLoop + + // Copy vN back to d. + MOVQ R8, 0(AX) + MOVQ R9, 8(AX) + MOVQ R10, 16(AX) + MOVQ R11, 24(AX) + + // The number of bytes written is CX minus the old base pointer. + SUBQ b_base+8(FP), CX + MOVQ CX, ret+32(FP) + + RET diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_other.go new file mode 100644 index 000000000..4a5a82160 --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_other.go @@ -0,0 +1,76 @@ +// +build !amd64 appengine !gc purego + +package xxhash + +// Sum64 computes the 64-bit xxHash digest of b. +func Sum64(b []byte) uint64 { + // A simpler version would be + // d := New() + // d.Write(b) + // return d.Sum64() + // but this is faster, particularly for small inputs. + + n := len(b) + var h uint64 + + if n >= 32 { + v1 := prime1v + prime2 + v2 := prime2 + v3 := uint64(0) + v4 := -prime1v + for len(b) >= 32 { + v1 = round(v1, u64(b[0:8:len(b)])) + v2 = round(v2, u64(b[8:16:len(b)])) + v3 = round(v3, u64(b[16:24:len(b)])) + v4 = round(v4, u64(b[24:32:len(b)])) + b = b[32:len(b):len(b)] + } + h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) + h = mergeRound(h, v1) + h = mergeRound(h, v2) + h = mergeRound(h, v3) + h = mergeRound(h, v4) + } else { + h = prime5 + } + + h += uint64(n) + + i, end := 0, len(b) + for ; i+8 <= end; i += 8 { + k1 := round(0, u64(b[i:i+8:len(b)])) + h ^= k1 + h = rol27(h)*prime1 + prime4 + } + if i+4 <= end { + h ^= uint64(u32(b[i:i+4:len(b)])) * prime1 + h = rol23(h)*prime2 + prime3 + i += 4 + } + for ; i < end; i++ { + h ^= uint64(b[i]) * prime5 + h = rol11(h) * prime1 + } + + h ^= h >> 33 + h *= prime2 + h ^= h >> 29 + h *= prime3 + h ^= h >> 32 + + return h +} + +func writeBlocks(d *Digest, b []byte) int { + v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 + n := len(b) + for len(b) >= 32 { + v1 = round(v1, u64(b[0:8:len(b)])) + v2 = round(v2, u64(b[8:16:len(b)])) + v3 = round(v3, u64(b[16:24:len(b)])) + v4 = round(v4, u64(b[24:32:len(b)])) + b = b[32:len(b):len(b)] + } + d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 + return n - len(b) +} diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go new file mode 100644 index 000000000..fc9bea7a3 --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go @@ -0,0 +1,15 @@ +// +build appengine + +// This file contains the safe implementations of otherwise unsafe-using code. + +package xxhash + +// Sum64String computes the 64-bit xxHash digest of s. +func Sum64String(s string) uint64 { + return Sum64([]byte(s)) +} + +// WriteString adds more data to d. It always returns len(s), nil. +func (d *Digest) WriteString(s string) (n int, err error) { + return d.Write([]byte(s)) +} diff --git a/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go new file mode 100644 index 000000000..53bf76efb --- /dev/null +++ b/integration-test/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go @@ -0,0 +1,46 @@ +// +build !appengine + +// This file encapsulates usage of unsafe. +// xxhash_safe.go contains the safe implementations. + +package xxhash + +import ( + "reflect" + "unsafe" +) + +// Notes: +// +// See https://groups.google.com/d/msg/golang-nuts/dcjzJy-bSpw/tcZYBzQqAQAJ +// for some discussion about these unsafe conversions. +// +// In the future it's possible that compiler optimizations will make these +// unsafe operations unnecessary: https://golang.org/issue/2205. +// +// Both of these wrapper functions still incur function call overhead since they +// will not be inlined. We could write Go/asm copies of Sum64 and Digest.Write +// for strings to squeeze out a bit more speed. Mid-stack inlining should +// eventually fix this. + +// Sum64String computes the 64-bit xxHash digest of s. +// It may be faster than Sum64([]byte(s)) by avoiding a copy. +func Sum64String(s string) uint64 { + var b []byte + bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data + bh.Len = len(s) + bh.Cap = len(s) + return Sum64(b) +} + +// WriteString adds more data to d. It always returns len(s), nil. +// It may be faster than Write([]byte(s)) by avoiding a copy. +func (d *Digest) WriteString(s string) (n int, err error) { + var b []byte + bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data + bh.Len = len(s) + bh.Cap = len(s) + return d.Write(b) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/LICENSE b/integration-test/vendor/github.com/containerd/containerd/LICENSE new file mode 100644 index 000000000..584149b6e --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://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 + + Copyright The containerd Authors + + 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 + + https://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. diff --git a/integration-test/vendor/github.com/containerd/containerd/NOTICE b/integration-test/vendor/github.com/containerd/containerd/NOTICE new file mode 100644 index 000000000..8915f0277 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/NOTICE @@ -0,0 +1,16 @@ +Docker +Copyright 2012-2015 Docker, Inc. + +This product includes software developed at Docker, Inc. (https://www.docker.com). + +The following is courtesy of our legal counsel: + + +Use and transfer of Docker may be subject to certain restrictions by the +United States and other governments. +It is your responsibility to ensure that your use and/or transfer does not +violate applicable laws. + +For more information, please see https://www.bis.doc.gov + +See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. diff --git a/integration-test/vendor/github.com/containerd/containerd/archive/compression/compression.go b/integration-test/vendor/github.com/containerd/containerd/archive/compression/compression.go new file mode 100644 index 000000000..a883e4d58 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/archive/compression/compression.go @@ -0,0 +1,287 @@ +/* + Copyright The containerd Authors. + + 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 compression + +import ( + "bufio" + "bytes" + "compress/gzip" + "context" + "fmt" + "io" + "os" + "os/exec" + "strconv" + "sync" + + "github.com/containerd/containerd/log" + "github.com/klauspost/compress/zstd" +) + +type ( + // Compression is the state represents if compressed or not. + Compression int +) + +const ( + // Uncompressed represents the uncompressed. + Uncompressed Compression = iota + // Gzip is gzip compression algorithm. + Gzip + // Zstd is zstd compression algorithm. + Zstd +) + +const disablePigzEnv = "CONTAINERD_DISABLE_PIGZ" + +var ( + initPigz sync.Once + unpigzPath string +) + +var ( + bufioReader32KPool = &sync.Pool{ + New: func() interface{} { return bufio.NewReaderSize(nil, 32*1024) }, + } +) + +// DecompressReadCloser include the stream after decompress and the compress method detected. +type DecompressReadCloser interface { + io.ReadCloser + // GetCompression returns the compress method which is used before decompressing + GetCompression() Compression +} + +type readCloserWrapper struct { + io.Reader + compression Compression + closer func() error +} + +func (r *readCloserWrapper) Close() error { + if r.closer != nil { + return r.closer() + } + return nil +} + +func (r *readCloserWrapper) GetCompression() Compression { + return r.compression +} + +type writeCloserWrapper struct { + io.Writer + closer func() error +} + +func (w *writeCloserWrapper) Close() error { + if w.closer != nil { + w.closer() + } + return nil +} + +type bufferedReader struct { + buf *bufio.Reader +} + +func newBufferedReader(r io.Reader) *bufferedReader { + buf := bufioReader32KPool.Get().(*bufio.Reader) + buf.Reset(r) + return &bufferedReader{buf} +} + +func (r *bufferedReader) Read(p []byte) (n int, err error) { + if r.buf == nil { + return 0, io.EOF + } + n, err = r.buf.Read(p) + if err == io.EOF { + r.buf.Reset(nil) + bufioReader32KPool.Put(r.buf) + r.buf = nil + } + return +} + +func (r *bufferedReader) Peek(n int) ([]byte, error) { + if r.buf == nil { + return nil, io.EOF + } + return r.buf.Peek(n) +} + +// DetectCompression detects the compression algorithm of the source. +func DetectCompression(source []byte) Compression { + for compression, m := range map[Compression][]byte{ + Gzip: {0x1F, 0x8B, 0x08}, + Zstd: {0x28, 0xb5, 0x2f, 0xfd}, + } { + if len(source) < len(m) { + // Len too short + continue + } + if bytes.Equal(m, source[:len(m)]) { + return compression + } + } + return Uncompressed +} + +// DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive. +func DecompressStream(archive io.Reader) (DecompressReadCloser, error) { + buf := newBufferedReader(archive) + bs, err := buf.Peek(10) + if err != nil && err != io.EOF { + // Note: we'll ignore any io.EOF error because there are some odd + // cases where the layer.tar file will be empty (zero bytes) and + // that results in an io.EOF from the Peek() call. So, in those + // cases we'll just treat it as a non-compressed stream and + // that means just create an empty layer. + // See Issue docker/docker#18170 + return nil, err + } + + switch compression := DetectCompression(bs); compression { + case Uncompressed: + return &readCloserWrapper{ + Reader: buf, + compression: compression, + }, nil + case Gzip: + ctx, cancel := context.WithCancel(context.Background()) + gzReader, err := gzipDecompress(ctx, buf) + if err != nil { + cancel() + return nil, err + } + + return &readCloserWrapper{ + Reader: gzReader, + compression: compression, + closer: func() error { + cancel() + return gzReader.Close() + }, + }, nil + case Zstd: + zstdReader, err := zstd.NewReader(buf) + if err != nil { + return nil, err + } + return &readCloserWrapper{ + Reader: zstdReader, + compression: compression, + closer: func() error { + zstdReader.Close() + return nil + }, + }, nil + + default: + return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension()) + } +} + +// CompressStream compresses the dest with specified compression algorithm. +func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) { + switch compression { + case Uncompressed: + return &writeCloserWrapper{dest, nil}, nil + case Gzip: + return gzip.NewWriter(dest), nil + case Zstd: + return zstd.NewWriter(dest) + default: + return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension()) + } +} + +// Extension returns the extension of a file that uses the specified compression algorithm. +func (compression *Compression) Extension() string { + switch *compression { + case Gzip: + return "gz" + case Zstd: + return "zst" + } + return "" +} + +func gzipDecompress(ctx context.Context, buf io.Reader) (io.ReadCloser, error) { + initPigz.Do(func() { + if unpigzPath = detectPigz(); unpigzPath != "" { + log.L.Debug("using pigz for decompression") + } + }) + + if unpigzPath == "" { + return gzip.NewReader(buf) + } + + return cmdStream(exec.CommandContext(ctx, unpigzPath, "-d", "-c"), buf) +} + +func cmdStream(cmd *exec.Cmd, in io.Reader) (io.ReadCloser, error) { + reader, writer := io.Pipe() + + cmd.Stdin = in + cmd.Stdout = writer + + var errBuf bytes.Buffer + cmd.Stderr = &errBuf + + if err := cmd.Start(); err != nil { + return nil, err + } + + go func() { + if err := cmd.Wait(); err != nil { + writer.CloseWithError(fmt.Errorf("%s: %s", err, errBuf.String())) + } else { + writer.Close() + } + }() + + return reader, nil +} + +func detectPigz() string { + path, err := exec.LookPath("unpigz") + if err != nil { + log.L.WithError(err).Debug("unpigz not found, falling back to go gzip") + return "" + } + + // Check if pigz disabled via CONTAINERD_DISABLE_PIGZ env variable + value := os.Getenv(disablePigzEnv) + if value == "" { + return path + } + + disable, err := strconv.ParseBool(value) + if err != nil { + log.L.WithError(err).Warnf("could not parse %s: %s", disablePigzEnv, value) + return path + } + + if disable { + return "" + } + + return path +} diff --git a/integration-test/vendor/github.com/containerd/containerd/content/adaptor.go b/integration-test/vendor/github.com/containerd/containerd/content/adaptor.go new file mode 100644 index 000000000..88bad2610 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/content/adaptor.go @@ -0,0 +1,52 @@ +/* + Copyright The containerd Authors. + + 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 content + +import ( + "strings" + + "github.com/containerd/containerd/filters" +) + +// AdaptInfo returns `filters.Adaptor` that handles `content.Info`. +func AdaptInfo(info Info) filters.Adaptor { + return filters.AdapterFunc(func(fieldpath []string) (string, bool) { + if len(fieldpath) == 0 { + return "", false + } + + switch fieldpath[0] { + case "digest": + return info.Digest.String(), true + case "size": + // TODO: support size based filtering + case "labels": + return checkMap(fieldpath[1:], info.Labels) + } + + return "", false + }) +} + +func checkMap(fieldpath []string, m map[string]string) (string, bool) { + if len(m) == 0 { + return "", false + } + + value, ok := m[strings.Join(fieldpath, ".")] + return value, ok +} diff --git a/integration-test/vendor/github.com/containerd/containerd/content/content.go b/integration-test/vendor/github.com/containerd/containerd/content/content.go new file mode 100644 index 000000000..ff17a8417 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/content/content.go @@ -0,0 +1,182 @@ +/* + Copyright The containerd Authors. + + 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 content + +import ( + "context" + "io" + "time" + + "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ReaderAt extends the standard io.ReaderAt interface with reporting of Size and io.Closer +type ReaderAt interface { + io.ReaderAt + io.Closer + Size() int64 +} + +// Provider provides a reader interface for specific content +type Provider interface { + // ReaderAt only requires desc.Digest to be set. + // Other fields in the descriptor may be used internally for resolving + // the location of the actual data. + ReaderAt(ctx context.Context, desc ocispec.Descriptor) (ReaderAt, error) +} + +// Ingester writes content +type Ingester interface { + // Some implementations require WithRef to be included in opts. + Writer(ctx context.Context, opts ...WriterOpt) (Writer, error) +} + +// Info holds content specific information +// +// TODO(stevvooe): Consider a very different name for this struct. Info is way +// to general. It also reads very weird in certain context, like pluralization. +type Info struct { + Digest digest.Digest + Size int64 + CreatedAt time.Time + UpdatedAt time.Time + Labels map[string]string +} + +// Status of a content operation +type Status struct { + Ref string + Offset int64 + Total int64 + Expected digest.Digest + StartedAt time.Time + UpdatedAt time.Time +} + +// WalkFunc defines the callback for a blob walk. +type WalkFunc func(Info) error + +// Manager provides methods for inspecting, listing and removing content. +type Manager interface { + // Info will return metadata about content available in the content store. + // + // If the content is not present, ErrNotFound will be returned. + Info(ctx context.Context, dgst digest.Digest) (Info, error) + + // Update updates mutable information related to content. + // If one or more fieldpaths are provided, only those + // fields will be updated. + // Mutable fields: + // labels.* + Update(ctx context.Context, info Info, fieldpaths ...string) (Info, error) + + // Walk will call fn for each item in the content store which + // match the provided filters. If no filters are given all + // items will be walked. + Walk(ctx context.Context, fn WalkFunc, filters ...string) error + + // Delete removes the content from the store. + Delete(ctx context.Context, dgst digest.Digest) error +} + +// IngestManager provides methods for managing ingests. +type IngestManager interface { + // Status returns the status of the provided ref. + Status(ctx context.Context, ref string) (Status, error) + + // ListStatuses returns the status of any active ingestions whose ref match the + // provided regular expression. If empty, all active ingestions will be + // returned. + ListStatuses(ctx context.Context, filters ...string) ([]Status, error) + + // Abort completely cancels the ingest operation targeted by ref. + Abort(ctx context.Context, ref string) error +} + +// Writer handles the write of content into a content store +type Writer interface { + // Close closes the writer, if the writer has not been + // committed this allows resuming or aborting. + // Calling Close on a closed writer will not error. + io.WriteCloser + + // Digest may return empty digest or panics until committed. + Digest() digest.Digest + + // Commit commits the blob (but no roll-back is guaranteed on an error). + // size and expected can be zero-value when unknown. + // Commit always closes the writer, even on error. + // ErrAlreadyExists aborts the writer. + Commit(ctx context.Context, size int64, expected digest.Digest, opts ...Opt) error + + // Status returns the current state of write + Status() (Status, error) + + // Truncate updates the size of the target blob + Truncate(size int64) error +} + +// Store combines the methods of content-oriented interfaces into a set that +// are commonly provided by complete implementations. +type Store interface { + Manager + Provider + IngestManager + Ingester +} + +// Opt is used to alter the mutable properties of content +type Opt func(*Info) error + +// WithLabels allows labels to be set on content +func WithLabels(labels map[string]string) Opt { + return func(info *Info) error { + info.Labels = labels + return nil + } +} + +// WriterOpts is internally used by WriterOpt. +type WriterOpts struct { + Ref string + Desc ocispec.Descriptor +} + +// WriterOpt is used for passing options to Ingester.Writer. +type WriterOpt func(*WriterOpts) error + +// WithDescriptor specifies an OCI descriptor. +// Writer may optionally use the descriptor internally for resolving +// the location of the actual data. +// Write does not require any field of desc to be set. +// If the data size is unknown, desc.Size should be set to 0. +// Some implementations may also accept negative values as "unknown". +func WithDescriptor(desc ocispec.Descriptor) WriterOpt { + return func(opts *WriterOpts) error { + opts.Desc = desc + return nil + } +} + +// WithRef specifies a ref string. +func WithRef(ref string) WriterOpt { + return func(opts *WriterOpts) error { + opts.Ref = ref + return nil + } +} diff --git a/integration-test/vendor/github.com/containerd/containerd/content/helpers.go b/integration-test/vendor/github.com/containerd/containerd/content/helpers.go new file mode 100644 index 000000000..00fae1fc8 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/content/helpers.go @@ -0,0 +1,287 @@ +/* + Copyright The containerd Authors. + + 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 content + +import ( + "context" + "io" + "io/ioutil" + "math/rand" + "sync" + "time" + + "github.com/containerd/containerd/errdefs" + "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +var bufPool = sync.Pool{ + New: func() interface{} { + buffer := make([]byte, 1<<20) + return &buffer + }, +} + +// NewReader returns a io.Reader from a ReaderAt +func NewReader(ra ReaderAt) io.Reader { + rd := io.NewSectionReader(ra, 0, ra.Size()) + return rd +} + +// ReadBlob retrieves the entire contents of the blob from the provider. +// +// Avoid using this for large blobs, such as layers. +func ReadBlob(ctx context.Context, provider Provider, desc ocispec.Descriptor) ([]byte, error) { + ra, err := provider.ReaderAt(ctx, desc) + if err != nil { + return nil, err + } + defer ra.Close() + + p := make([]byte, ra.Size()) + + n, err := ra.ReadAt(p, 0) + if err == io.EOF { + if int64(n) != ra.Size() { + err = io.ErrUnexpectedEOF + } else { + err = nil + } + } + return p, err +} + +// WriteBlob writes data with the expected digest into the content store. If +// expected already exists, the method returns immediately and the reader will +// not be consumed. +// +// This is useful when the digest and size are known beforehand. +// +// Copy is buffered, so no need to wrap reader in buffered io. +func WriteBlob(ctx context.Context, cs Ingester, ref string, r io.Reader, desc ocispec.Descriptor, opts ...Opt) error { + cw, err := OpenWriter(ctx, cs, WithRef(ref), WithDescriptor(desc)) + if err != nil { + if !errdefs.IsAlreadyExists(err) { + return errors.Wrap(err, "failed to open writer") + } + + return nil // all ready present + } + defer cw.Close() + + return Copy(ctx, cw, r, desc.Size, desc.Digest, opts...) +} + +// OpenWriter opens a new writer for the given reference, retrying if the writer +// is locked until the reference is available or returns an error. +func OpenWriter(ctx context.Context, cs Ingester, opts ...WriterOpt) (Writer, error) { + var ( + cw Writer + err error + retry = 16 + ) + for { + cw, err = cs.Writer(ctx, opts...) + if err != nil { + if !errdefs.IsUnavailable(err) { + return nil, err + } + + // TODO: Check status to determine if the writer is active, + // continue waiting while active, otherwise return lock + // error or abort. Requires asserting for an ingest manager + + select { + case <-time.After(time.Millisecond * time.Duration(rand.Intn(retry))): + if retry < 2048 { + retry = retry << 1 + } + continue + case <-ctx.Done(): + // Propagate lock error + return nil, err + } + + } + break + } + + return cw, err +} + +// Copy copies data with the expected digest from the reader into the +// provided content store writer. This copy commits the writer. +// +// This is useful when the digest and size are known beforehand. When +// the size or digest is unknown, these values may be empty. +// +// Copy is buffered, so no need to wrap reader in buffered io. +func Copy(ctx context.Context, cw Writer, r io.Reader, size int64, expected digest.Digest, opts ...Opt) error { + ws, err := cw.Status() + if err != nil { + return errors.Wrap(err, "failed to get status") + } + + if ws.Offset > 0 { + r, err = seekReader(r, ws.Offset, size) + if err != nil { + return errors.Wrapf(err, "unable to resume write to %v", ws.Ref) + } + } + + copied, err := copyWithBuffer(cw, r) + if err != nil { + return errors.Wrap(err, "failed to copy") + } + if size != 0 && copied < size-ws.Offset { + // Short writes would return its own error, this indicates a read failure + return errors.Wrapf(io.ErrUnexpectedEOF, "failed to read expected number of bytes") + } + + if err := cw.Commit(ctx, size, expected, opts...); err != nil { + if !errdefs.IsAlreadyExists(err) { + return errors.Wrapf(err, "failed commit on ref %q", ws.Ref) + } + } + + return nil +} + +// CopyReaderAt copies to a writer from a given reader at for the given +// number of bytes. This copy does not commit the writer. +func CopyReaderAt(cw Writer, ra ReaderAt, n int64) error { + ws, err := cw.Status() + if err != nil { + return err + } + + copied, err := copyWithBuffer(cw, io.NewSectionReader(ra, ws.Offset, n)) + if err != nil { + return errors.Wrap(err, "failed to copy") + } + if copied < n { + // Short writes would return its own error, this indicates a read failure + return errors.Wrap(io.ErrUnexpectedEOF, "failed to read expected number of bytes") + } + return nil +} + +// CopyReader copies to a writer from a given reader, returning +// the number of bytes copied. +// Note: if the writer has a non-zero offset, the total number +// of bytes read may be greater than those copied if the reader +// is not an io.Seeker. +// This copy does not commit the writer. +func CopyReader(cw Writer, r io.Reader) (int64, error) { + ws, err := cw.Status() + if err != nil { + return 0, errors.Wrap(err, "failed to get status") + } + + if ws.Offset > 0 { + r, err = seekReader(r, ws.Offset, 0) + if err != nil { + return 0, errors.Wrapf(err, "unable to resume write to %v", ws.Ref) + } + } + + return copyWithBuffer(cw, r) +} + +// seekReader attempts to seek the reader to the given offset, either by +// resolving `io.Seeker`, by detecting `io.ReaderAt`, or discarding +// up to the given offset. +func seekReader(r io.Reader, offset, size int64) (io.Reader, error) { + // attempt to resolve r as a seeker and setup the offset. + seeker, ok := r.(io.Seeker) + if ok { + nn, err := seeker.Seek(offset, io.SeekStart) + if nn != offset { + return nil, errors.Wrapf(err, "failed to seek to offset %v", offset) + } + + if err != nil { + return nil, err + } + + return r, nil + } + + // ok, let's try io.ReaderAt! + readerAt, ok := r.(io.ReaderAt) + if ok && size > offset { + sr := io.NewSectionReader(readerAt, offset, size) + return sr, nil + } + + // well then, let's just discard up to the offset + n, err := copyWithBuffer(ioutil.Discard, io.LimitReader(r, offset)) + if err != nil { + return nil, errors.Wrap(err, "failed to discard to offset") + } + if n != offset { + return nil, errors.Errorf("unable to discard to offset") + } + + return r, nil +} + +// copyWithBuffer is very similar to io.CopyBuffer https://golang.org/pkg/io/#CopyBuffer +// but instead of using Read to read from the src, we use ReadAtLeast to make sure we have +// a full buffer before we do a write operation to dst to reduce overheads associated +// with the write operations of small buffers. +func copyWithBuffer(dst io.Writer, src io.Reader) (written int64, err error) { + // If the reader has a WriteTo method, use it to do the copy. + // Avoids an allocation and a copy. + if wt, ok := src.(io.WriterTo); ok { + return wt.WriteTo(dst) + } + // Similarly, if the writer has a ReadFrom method, use it to do the copy. + if rt, ok := dst.(io.ReaderFrom); ok { + return rt.ReadFrom(src) + } + bufRef := bufPool.Get().(*[]byte) + defer bufPool.Put(bufRef) + buf := *bufRef + for { + nr, er := io.ReadAtLeast(src, buf, len(buf)) + if nr > 0 { + nw, ew := dst.Write(buf[0:nr]) + if nw > 0 { + written += int64(nw) + } + if ew != nil { + err = ew + break + } + if nr != nw { + err = io.ErrShortWrite + break + } + } + if er != nil { + // If an EOF happens after reading fewer than the requested bytes, + // ReadAtLeast returns ErrUnexpectedEOF. + if er != io.EOF && er != io.ErrUnexpectedEOF { + err = er + } + break + } + } + return +} diff --git a/integration-test/vendor/github.com/containerd/containerd/errdefs/errors.go b/integration-test/vendor/github.com/containerd/containerd/errdefs/errors.go new file mode 100644 index 000000000..05a35228c --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/errdefs/errors.go @@ -0,0 +1,93 @@ +/* + Copyright The containerd Authors. + + 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 errdefs defines the common errors used throughout containerd +// packages. +// +// Use with errors.Wrap and error.Wrapf to add context to an error. +// +// To detect an error class, use the IsXXX functions to tell whether an error +// is of a certain type. +// +// The functions ToGRPC and FromGRPC can be used to map server-side and +// client-side errors to the correct types. +package errdefs + +import ( + "context" + + "github.com/pkg/errors" +) + +// Definitions of common error types used throughout containerd. All containerd +// errors returned by most packages will map into one of these errors classes. +// Packages should return errors of these types when they want to instruct a +// client to take a particular action. +// +// For the most part, we just try to provide local grpc errors. Most conditions +// map very well to those defined by grpc. +var ( + ErrUnknown = errors.New("unknown") // used internally to represent a missed mapping. + ErrInvalidArgument = errors.New("invalid argument") + ErrNotFound = errors.New("not found") + ErrAlreadyExists = errors.New("already exists") + ErrFailedPrecondition = errors.New("failed precondition") + ErrUnavailable = errors.New("unavailable") + ErrNotImplemented = errors.New("not implemented") // represents not supported and unimplemented +) + +// IsInvalidArgument returns true if the error is due to an invalid argument +func IsInvalidArgument(err error) bool { + return errors.Is(err, ErrInvalidArgument) +} + +// IsNotFound returns true if the error is due to a missing object +func IsNotFound(err error) bool { + return errors.Is(err, ErrNotFound) +} + +// IsAlreadyExists returns true if the error is due to an already existing +// metadata item +func IsAlreadyExists(err error) bool { + return errors.Is(err, ErrAlreadyExists) +} + +// IsFailedPrecondition returns true if an operation could not proceed to the +// lack of a particular condition +func IsFailedPrecondition(err error) bool { + return errors.Is(err, ErrFailedPrecondition) +} + +// IsUnavailable returns true if the error is due to a resource being unavailable +func IsUnavailable(err error) bool { + return errors.Is(err, ErrUnavailable) +} + +// IsNotImplemented returns true if the error is due to not being implemented +func IsNotImplemented(err error) bool { + return errors.Is(err, ErrNotImplemented) +} + +// IsCanceled returns true if the error is due to `context.Canceled`. +func IsCanceled(err error) bool { + return errors.Is(err, context.Canceled) +} + +// IsDeadlineExceeded returns true if the error is due to +// `context.DeadlineExceeded`. +func IsDeadlineExceeded(err error) bool { + return errors.Is(err, context.DeadlineExceeded) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/errdefs/grpc.go b/integration-test/vendor/github.com/containerd/containerd/errdefs/grpc.go new file mode 100644 index 000000000..209f63bd0 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/errdefs/grpc.go @@ -0,0 +1,147 @@ +/* + Copyright The containerd Authors. + + 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 errdefs + +import ( + "context" + "strings" + + "github.com/pkg/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// ToGRPC will attempt to map the backend containerd error into a grpc error, +// using the original error message as a description. +// +// Further information may be extracted from certain errors depending on their +// type. +// +// If the error is unmapped, the original error will be returned to be handled +// by the regular grpc error handling stack. +func ToGRPC(err error) error { + if err == nil { + return nil + } + + if isGRPCError(err) { + // error has already been mapped to grpc + return err + } + + switch { + case IsInvalidArgument(err): + return status.Errorf(codes.InvalidArgument, err.Error()) + case IsNotFound(err): + return status.Errorf(codes.NotFound, err.Error()) + case IsAlreadyExists(err): + return status.Errorf(codes.AlreadyExists, err.Error()) + case IsFailedPrecondition(err): + return status.Errorf(codes.FailedPrecondition, err.Error()) + case IsUnavailable(err): + return status.Errorf(codes.Unavailable, err.Error()) + case IsNotImplemented(err): + return status.Errorf(codes.Unimplemented, err.Error()) + case IsCanceled(err): + return status.Errorf(codes.Canceled, err.Error()) + case IsDeadlineExceeded(err): + return status.Errorf(codes.DeadlineExceeded, err.Error()) + } + + return err +} + +// ToGRPCf maps the error to grpc error codes, assembling the formatting string +// and combining it with the target error string. +// +// This is equivalent to errors.ToGRPC(errors.Wrapf(err, format, args...)) +func ToGRPCf(err error, format string, args ...interface{}) error { + return ToGRPC(errors.Wrapf(err, format, args...)) +} + +// FromGRPC returns the underlying error from a grpc service based on the grpc error code +func FromGRPC(err error) error { + if err == nil { + return nil + } + + var cls error // divide these into error classes, becomes the cause + + switch code(err) { + case codes.InvalidArgument: + cls = ErrInvalidArgument + case codes.AlreadyExists: + cls = ErrAlreadyExists + case codes.NotFound: + cls = ErrNotFound + case codes.Unavailable: + cls = ErrUnavailable + case codes.FailedPrecondition: + cls = ErrFailedPrecondition + case codes.Unimplemented: + cls = ErrNotImplemented + case codes.Canceled: + cls = context.Canceled + case codes.DeadlineExceeded: + cls = context.DeadlineExceeded + default: + cls = ErrUnknown + } + + msg := rebaseMessage(cls, err) + if msg != "" { + err = errors.Wrap(cls, msg) + } else { + err = errors.WithStack(cls) + } + + return err +} + +// rebaseMessage removes the repeats for an error at the end of an error +// string. This will happen when taking an error over grpc then remapping it. +// +// Effectively, we just remove the string of cls from the end of err if it +// appears there. +func rebaseMessage(cls error, err error) string { + desc := errDesc(err) + clss := cls.Error() + if desc == clss { + return "" + } + + return strings.TrimSuffix(desc, ": "+clss) +} + +func isGRPCError(err error) bool { + _, ok := status.FromError(err) + return ok +} + +func code(err error) codes.Code { + if s, ok := status.FromError(err); ok { + return s.Code() + } + return codes.Unknown +} + +func errDesc(err error) string { + if s, ok := status.FromError(err); ok { + return s.Message() + } + return err.Error() +} diff --git a/integration-test/vendor/github.com/containerd/containerd/filters/adaptor.go b/integration-test/vendor/github.com/containerd/containerd/filters/adaptor.go new file mode 100644 index 000000000..5a9c559c1 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/filters/adaptor.go @@ -0,0 +1,33 @@ +/* + Copyright The containerd Authors. + + 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 filters + +// Adaptor specifies the mapping of fieldpaths to a type. For the given field +// path, the value and whether it is present should be returned. The mapping of +// the fieldpath to a field is deferred to the adaptor implementation, but +// should generally follow protobuf field path/mask semantics. +type Adaptor interface { + Field(fieldpath []string) (value string, present bool) +} + +// AdapterFunc allows implementation specific matching of fieldpaths +type AdapterFunc func(fieldpath []string) (string, bool) + +// Field returns the field name and true if it exists +func (fn AdapterFunc) Field(fieldpath []string) (string, bool) { + return fn(fieldpath) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/filters/filter.go b/integration-test/vendor/github.com/containerd/containerd/filters/filter.go new file mode 100644 index 000000000..cf09d8d9e --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/filters/filter.go @@ -0,0 +1,179 @@ +/* + Copyright The containerd Authors. + + 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 filters defines a syntax and parser that can be used for the +// filtration of items across the containerd API. The core is built on the +// concept of protobuf field paths, with quoting. Several operators allow the +// user to flexibly select items based on field presence, equality, inequality +// and regular expressions. Flexible adaptors support working with any type. +// +// The syntax is fairly familiar, if you've used container ecosystem +// projects. At the core, we base it on the concept of protobuf field +// paths, augmenting with the ability to quote portions of the field path +// to match arbitrary labels. These "selectors" come in the following +// syntax: +// +// ``` +// [] +// ``` +// +// A basic example is as follows: +// +// ``` +// name==foo +// ``` +// +// This would match all objects that have a field `name` with the value +// `foo`. If we only want to test if the field is present, we can omit the +// operator. This is most useful for matching labels in containerd. The +// following will match objects that have the field "labels" and have the +// label "foo" defined: +// +// ``` +// labels.foo +// ``` +// +// We also allow for quoting of parts of the field path to allow matching +// of arbitrary items: +// +// ``` +// labels."very complex label"==something +// ``` +// +// We also define `!=` and `~=` as operators. The `!=` will match all +// objects that don't match the value for a field and `~=` will compile the +// target value as a regular expression and match the field value against that. +// +// Selectors can be combined using a comma, such that the resulting +// selector will require all selectors are matched for the object to match. +// The following example will match objects that are named `foo` and have +// the label `bar`: +// +// ``` +// name==foo,labels.bar +// ``` +// +package filters + +import ( + "regexp" + + "github.com/containerd/containerd/log" +) + +// Filter matches specific resources based the provided filter +type Filter interface { + Match(adaptor Adaptor) bool +} + +// FilterFunc is a function that handles matching with an adaptor +type FilterFunc func(Adaptor) bool + +// Match matches the FilterFunc returning true if the object matches the filter +func (fn FilterFunc) Match(adaptor Adaptor) bool { + return fn(adaptor) +} + +// Always is a filter that always returns true for any type of object +var Always FilterFunc = func(adaptor Adaptor) bool { + return true +} + +// Any allows multiple filters to be matched against the object +type Any []Filter + +// Match returns true if any of the provided filters are true +func (m Any) Match(adaptor Adaptor) bool { + for _, m := range m { + if m.Match(adaptor) { + return true + } + } + + return false +} + +// All allows multiple filters to be matched against the object +type All []Filter + +// Match only returns true if all filters match the object +func (m All) Match(adaptor Adaptor) bool { + for _, m := range m { + if !m.Match(adaptor) { + return false + } + } + + return true +} + +type operator int + +const ( + operatorPresent = iota + operatorEqual + operatorNotEqual + operatorMatches +) + +func (op operator) String() string { + switch op { + case operatorPresent: + return "?" + case operatorEqual: + return "==" + case operatorNotEqual: + return "!=" + case operatorMatches: + return "~=" + } + + return "unknown" +} + +type selector struct { + fieldpath []string + operator operator + value string + re *regexp.Regexp +} + +func (m selector) Match(adaptor Adaptor) bool { + value, present := adaptor.Field(m.fieldpath) + + switch m.operator { + case operatorPresent: + return present + case operatorEqual: + return present && value == m.value + case operatorNotEqual: + return value != m.value + case operatorMatches: + if m.re == nil { + r, err := regexp.Compile(m.value) + if err != nil { + log.L.Errorf("error compiling regexp %q", m.value) + return false + } + + m.re = r + } + + return m.re.MatchString(value) + default: + return false + } +} diff --git a/integration-test/vendor/github.com/containerd/containerd/filters/parser.go b/integration-test/vendor/github.com/containerd/containerd/filters/parser.go new file mode 100644 index 000000000..0825d668c --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/filters/parser.go @@ -0,0 +1,292 @@ +/* + Copyright The containerd Authors. + + 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 filters + +import ( + "fmt" + "io" + + "github.com/containerd/containerd/errdefs" + "github.com/pkg/errors" +) + +/* +Parse the strings into a filter that may be used with an adaptor. + +The filter is made up of zero or more selectors. + +The format is a comma separated list of expressions, in the form of +``, known as selectors. All selectors must match the +target object for the filter to be true. + +We define the operators "==" for equality, "!=" for not equal and "~=" for a +regular expression. If the operator and value are not present, the matcher will +test for the presence of a value, as defined by the target object. + +The formal grammar is as follows: + +selectors := selector ("," selector)* +selector := fieldpath (operator value) +fieldpath := field ('.' field)* +field := quoted | [A-Za-z] [A-Za-z0-9_]+ +operator := "==" | "!=" | "~=" +value := quoted | [^\s,]+ +quoted := + +*/ +func Parse(s string) (Filter, error) { + // special case empty to match all + if s == "" { + return Always, nil + } + + p := parser{input: s} + return p.parse() +} + +// ParseAll parses each filter in ss and returns a filter that will return true +// if any filter matches the expression. +// +// If no filters are provided, the filter will match anything. +func ParseAll(ss ...string) (Filter, error) { + if len(ss) == 0 { + return Always, nil + } + + var fs []Filter + for _, s := range ss { + f, err := Parse(s) + if err != nil { + return nil, errors.Wrap(errdefs.ErrInvalidArgument, err.Error()) + } + + fs = append(fs, f) + } + + return Any(fs), nil +} + +type parser struct { + input string + scanner scanner +} + +func (p *parser) parse() (Filter, error) { + p.scanner.init(p.input) + + ss, err := p.selectors() + if err != nil { + return nil, errors.Wrap(err, "filters") + } + + return ss, nil +} + +func (p *parser) selectors() (Filter, error) { + s, err := p.selector() + if err != nil { + return nil, err + } + + ss := All{s} + +loop: + for { + tok := p.scanner.peek() + switch tok { + case ',': + pos, tok, _ := p.scanner.scan() + if tok != tokenSeparator { + return nil, p.mkerr(pos, "expected a separator") + } + + s, err := p.selector() + if err != nil { + return nil, err + } + + ss = append(ss, s) + case tokenEOF: + break loop + default: + return nil, p.mkerr(p.scanner.ppos, "unexpected input: %v", string(tok)) + } + } + + return ss, nil +} + +func (p *parser) selector() (selector, error) { + fieldpath, err := p.fieldpath() + if err != nil { + return selector{}, err + } + + switch p.scanner.peek() { + case ',', tokenSeparator, tokenEOF: + return selector{ + fieldpath: fieldpath, + operator: operatorPresent, + }, nil + } + + op, err := p.operator() + if err != nil { + return selector{}, err + } + + var allowAltQuotes bool + if op == operatorMatches { + allowAltQuotes = true + } + + value, err := p.value(allowAltQuotes) + if err != nil { + if err == io.EOF { + return selector{}, io.ErrUnexpectedEOF + } + return selector{}, err + } + + return selector{ + fieldpath: fieldpath, + value: value, + operator: op, + }, nil +} + +func (p *parser) fieldpath() ([]string, error) { + f, err := p.field() + if err != nil { + return nil, err + } + + fs := []string{f} +loop: + for { + tok := p.scanner.peek() // lookahead to consume field separator + + switch tok { + case '.': + pos, tok, _ := p.scanner.scan() // consume separator + if tok != tokenSeparator { + return nil, p.mkerr(pos, "expected a field separator (`.`)") + } + + f, err := p.field() + if err != nil { + return nil, err + } + + fs = append(fs, f) + default: + // let the layer above handle the other bad cases. + break loop + } + } + + return fs, nil +} + +func (p *parser) field() (string, error) { + pos, tok, s := p.scanner.scan() + switch tok { + case tokenField: + return s, nil + case tokenQuoted: + return p.unquote(pos, s, false) + case tokenIllegal: + return "", p.mkerr(pos, p.scanner.err) + } + + return "", p.mkerr(pos, "expected field or quoted") +} + +func (p *parser) operator() (operator, error) { + pos, tok, s := p.scanner.scan() + switch tok { + case tokenOperator: + switch s { + case "==": + return operatorEqual, nil + case "!=": + return operatorNotEqual, nil + case "~=": + return operatorMatches, nil + default: + return 0, p.mkerr(pos, "unsupported operator %q", s) + } + case tokenIllegal: + return 0, p.mkerr(pos, p.scanner.err) + } + + return 0, p.mkerr(pos, `expected an operator ("=="|"!="|"~=")`) +} + +func (p *parser) value(allowAltQuotes bool) (string, error) { + pos, tok, s := p.scanner.scan() + + switch tok { + case tokenValue, tokenField: + return s, nil + case tokenQuoted: + return p.unquote(pos, s, allowAltQuotes) + case tokenIllegal: + return "", p.mkerr(pos, p.scanner.err) + } + + return "", p.mkerr(pos, "expected value or quoted") +} + +func (p *parser) unquote(pos int, s string, allowAlts bool) (string, error) { + if !allowAlts && s[0] != '\'' && s[0] != '"' { + return "", p.mkerr(pos, "invalid quote encountered") + } + + uq, err := unquote(s) + if err != nil { + return "", p.mkerr(pos, "unquoting failed: %v", err) + } + + return uq, nil +} + +type parseError struct { + input string + pos int + msg string +} + +func (pe parseError) Error() string { + if pe.pos < len(pe.input) { + before := pe.input[:pe.pos] + location := pe.input[pe.pos : pe.pos+1] // need to handle end + after := pe.input[pe.pos+1:] + + return fmt.Sprintf("[%s >|%s|< %s]: %v", before, location, after, pe.msg) + } + + return fmt.Sprintf("[%s]: %v", pe.input, pe.msg) +} + +func (p *parser) mkerr(pos int, format string, args ...interface{}) error { + return errors.Wrap(parseError{ + input: p.input, + pos: pos, + msg: fmt.Sprintf(format, args...), + }, "parse error") +} diff --git a/integration-test/vendor/github.com/containerd/containerd/filters/quote.go b/integration-test/vendor/github.com/containerd/containerd/filters/quote.go new file mode 100644 index 000000000..2d64e23a3 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/filters/quote.go @@ -0,0 +1,253 @@ +/* + Copyright The containerd Authors. + + 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 filters + +import ( + "unicode/utf8" + + "github.com/pkg/errors" +) + +// NOTE(stevvooe): Most of this code in this file is copied from the stdlib +// strconv package and modified to be able to handle quoting with `/` and `|` +// as delimiters. The copyright is held by the Go authors. + +var errQuoteSyntax = errors.New("quote syntax error") + +// UnquoteChar decodes the first character or byte in the escaped string +// or character literal represented by the string s. +// It returns four values: +// +// 1) value, the decoded Unicode code point or byte value; +// 2) multibyte, a boolean indicating whether the decoded character requires a multibyte UTF-8 representation; +// 3) tail, the remainder of the string after the character; and +// 4) an error that will be nil if the character is syntactically valid. +// +// The second argument, quote, specifies the type of literal being parsed +// and therefore which escaped quote character is permitted. +// If set to a single quote, it permits the sequence \' and disallows unescaped '. +// If set to a double quote, it permits \" and disallows unescaped ". +// If set to zero, it does not permit either escape and allows both quote characters to appear unescaped. +// +// This is from Go strconv package, modified to support `|` and `/` as double +// quotes for use with regular expressions. +func unquoteChar(s string, quote byte) (value rune, multibyte bool, tail string, err error) { + // easy cases + switch c := s[0]; { + case c == quote && (quote == '\'' || quote == '"' || quote == '/' || quote == '|'): + err = errQuoteSyntax + return + case c >= utf8.RuneSelf: + r, size := utf8.DecodeRuneInString(s) + return r, true, s[size:], nil + case c != '\\': + return rune(s[0]), false, s[1:], nil + } + + // hard case: c is backslash + if len(s) <= 1 { + err = errQuoteSyntax + return + } + c := s[1] + s = s[2:] + + switch c { + case 'a': + value = '\a' + case 'b': + value = '\b' + case 'f': + value = '\f' + case 'n': + value = '\n' + case 'r': + value = '\r' + case 't': + value = '\t' + case 'v': + value = '\v' + case 'x', 'u', 'U': + n := 0 + switch c { + case 'x': + n = 2 + case 'u': + n = 4 + case 'U': + n = 8 + } + var v rune + if len(s) < n { + err = errQuoteSyntax + return + } + for j := 0; j < n; j++ { + x, ok := unhex(s[j]) + if !ok { + err = errQuoteSyntax + return + } + v = v<<4 | x + } + s = s[n:] + if c == 'x' { + // single-byte string, possibly not UTF-8 + value = v + break + } + if v > utf8.MaxRune { + err = errQuoteSyntax + return + } + value = v + multibyte = true + case '0', '1', '2', '3', '4', '5', '6', '7': + v := rune(c) - '0' + if len(s) < 2 { + err = errQuoteSyntax + return + } + for j := 0; j < 2; j++ { // one digit already; two more + x := rune(s[j]) - '0' + if x < 0 || x > 7 { + err = errQuoteSyntax + return + } + v = (v << 3) | x + } + s = s[2:] + if v > 255 { + err = errQuoteSyntax + return + } + value = v + case '\\': + value = '\\' + case '\'', '"', '|', '/': + if c != quote { + err = errQuoteSyntax + return + } + value = rune(c) + default: + err = errQuoteSyntax + return + } + tail = s + return +} + +// unquote interprets s as a single-quoted, double-quoted, +// or backquoted Go string literal, returning the string value +// that s quotes. (If s is single-quoted, it would be a Go +// character literal; Unquote returns the corresponding +// one-character string.) +// +// This is modified from the standard library to support `|` and `/` as quote +// characters for use with regular expressions. +func unquote(s string) (string, error) { + n := len(s) + if n < 2 { + return "", errQuoteSyntax + } + quote := s[0] + if quote != s[n-1] { + return "", errQuoteSyntax + } + s = s[1 : n-1] + + if quote == '`' { + if contains(s, '`') { + return "", errQuoteSyntax + } + if contains(s, '\r') { + // -1 because we know there is at least one \r to remove. + buf := make([]byte, 0, len(s)-1) + for i := 0; i < len(s); i++ { + if s[i] != '\r' { + buf = append(buf, s[i]) + } + } + return string(buf), nil + } + return s, nil + } + if quote != '"' && quote != '\'' && quote != '|' && quote != '/' { + return "", errQuoteSyntax + } + if contains(s, '\n') { + return "", errQuoteSyntax + } + + // Is it trivial? Avoid allocation. + if !contains(s, '\\') && !contains(s, quote) { + switch quote { + case '"', '/', '|': // pipe and slash are treated like double quote + return s, nil + case '\'': + r, size := utf8.DecodeRuneInString(s) + if size == len(s) && (r != utf8.RuneError || size != 1) { + return s, nil + } + } + } + + var runeTmp [utf8.UTFMax]byte + buf := make([]byte, 0, 3*len(s)/2) // Try to avoid more allocations. + for len(s) > 0 { + c, multibyte, ss, err := unquoteChar(s, quote) + if err != nil { + return "", err + } + s = ss + if c < utf8.RuneSelf || !multibyte { + buf = append(buf, byte(c)) + } else { + n := utf8.EncodeRune(runeTmp[:], c) + buf = append(buf, runeTmp[:n]...) + } + if quote == '\'' && len(s) != 0 { + // single-quoted must be single character + return "", errQuoteSyntax + } + } + return string(buf), nil +} + +// contains reports whether the string contains the byte c. +func contains(s string, c byte) bool { + for i := 0; i < len(s); i++ { + if s[i] == c { + return true + } + } + return false +} + +func unhex(b byte) (v rune, ok bool) { + c := rune(b) + switch { + case '0' <= c && c <= '9': + return c - '0', true + case 'a' <= c && c <= 'f': + return c - 'a' + 10, true + case 'A' <= c && c <= 'F': + return c - 'A' + 10, true + } + return +} diff --git a/integration-test/vendor/github.com/containerd/containerd/filters/scanner.go b/integration-test/vendor/github.com/containerd/containerd/filters/scanner.go new file mode 100644 index 000000000..6a485467b --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/filters/scanner.go @@ -0,0 +1,297 @@ +/* + Copyright The containerd Authors. + + 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 filters + +import ( + "unicode" + "unicode/utf8" +) + +const ( + tokenEOF = -(iota + 1) + tokenQuoted + tokenValue + tokenField + tokenSeparator + tokenOperator + tokenIllegal +) + +type token rune + +func (t token) String() string { + switch t { + case tokenEOF: + return "EOF" + case tokenQuoted: + return "Quoted" + case tokenValue: + return "Value" + case tokenField: + return "Field" + case tokenSeparator: + return "Separator" + case tokenOperator: + return "Operator" + case tokenIllegal: + return "Illegal" + } + + return string(t) +} + +func (t token) GoString() string { + return "token" + t.String() +} + +type scanner struct { + input string + pos int + ppos int // bounds the current rune in the string + value bool + err string +} + +func (s *scanner) init(input string) { + s.input = input + s.pos = 0 + s.ppos = 0 +} + +func (s *scanner) next() rune { + if s.pos >= len(s.input) { + return tokenEOF + } + s.pos = s.ppos + + r, w := utf8.DecodeRuneInString(s.input[s.ppos:]) + s.ppos += w + if r == utf8.RuneError { + if w > 0 { + s.error("rune error") + return tokenIllegal + } + return tokenEOF + } + + if r == 0 { + s.error("unexpected null") + return tokenIllegal + } + + return r +} + +func (s *scanner) peek() rune { + pos := s.pos + ppos := s.ppos + ch := s.next() + s.pos = pos + s.ppos = ppos + return ch +} + +func (s *scanner) scan() (nextp int, tk token, text string) { + var ( + ch = s.next() + pos = s.pos + ) + +chomp: + switch { + case ch == tokenEOF: + case ch == tokenIllegal: + case isQuoteRune(ch): + if !s.scanQuoted(ch) { + return pos, tokenIllegal, s.input[pos:s.ppos] + } + return pos, tokenQuoted, s.input[pos:s.ppos] + case isSeparatorRune(ch): + s.value = false + return pos, tokenSeparator, s.input[pos:s.ppos] + case isOperatorRune(ch): + s.scanOperator() + s.value = true + return pos, tokenOperator, s.input[pos:s.ppos] + case unicode.IsSpace(ch): + // chomp + ch = s.next() + pos = s.pos + goto chomp + case s.value: + s.scanValue() + s.value = false + return pos, tokenValue, s.input[pos:s.ppos] + case isFieldRune(ch): + s.scanField() + return pos, tokenField, s.input[pos:s.ppos] + } + + return s.pos, token(ch), "" +} + +func (s *scanner) scanField() { + for { + ch := s.peek() + if !isFieldRune(ch) { + break + } + s.next() + } +} + +func (s *scanner) scanOperator() { + for { + ch := s.peek() + switch ch { + case '=', '!', '~': + s.next() + default: + return + } + } +} + +func (s *scanner) scanValue() { + for { + ch := s.peek() + if !isValueRune(ch) { + break + } + s.next() + } +} + +func (s *scanner) scanQuoted(quote rune) bool { + var illegal bool + ch := s.next() // read character after quote + for ch != quote { + if ch == '\n' || ch < 0 { + s.error("quoted literal not terminated") + return false + } + if ch == '\\' { + var legal bool + ch, legal = s.scanEscape(quote) + if !legal { + illegal = true + } + } else { + ch = s.next() + } + } + return !illegal +} + +func (s *scanner) scanEscape(quote rune) (ch rune, legal bool) { + ch = s.next() // read character after '/' + switch ch { + case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', quote: + // nothing to do + ch = s.next() + legal = true + case '0', '1', '2', '3', '4', '5', '6', '7': + ch, legal = s.scanDigits(ch, 8, 3) + case 'x': + ch, legal = s.scanDigits(s.next(), 16, 2) + case 'u': + ch, legal = s.scanDigits(s.next(), 16, 4) + case 'U': + ch, legal = s.scanDigits(s.next(), 16, 8) + default: + s.error("illegal escape sequence") + } + return +} + +func (s *scanner) scanDigits(ch rune, base, n int) (rune, bool) { + for n > 0 && digitVal(ch) < base { + ch = s.next() + n-- + } + if n > 0 { + s.error("illegal numeric escape sequence") + return ch, false + } + return ch, true +} + +func (s *scanner) error(msg string) { + if s.err == "" { + s.err = msg + } +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch - '0') + case 'a' <= ch && ch <= 'f': + return int(ch - 'a' + 10) + case 'A' <= ch && ch <= 'F': + return int(ch - 'A' + 10) + } + return 16 // larger than any legal digit val +} + +func isFieldRune(r rune) bool { + return (r == '_' || isAlphaRune(r) || isDigitRune(r)) +} + +func isAlphaRune(r rune) bool { + return r >= 'A' && r <= 'Z' || r >= 'a' && r <= 'z' +} + +func isDigitRune(r rune) bool { + return r >= '0' && r <= '9' +} + +func isOperatorRune(r rune) bool { + switch r { + case '=', '!', '~': + return true + } + + return false +} + +func isQuoteRune(r rune) bool { + switch r { + case '/', '|', '"': // maybe add single quoting? + return true + } + + return false +} + +func isSeparatorRune(r rune) bool { + switch r { + case ',', '.': + return true + } + + return false +} + +func isValueRune(r rune) bool { + return r != ',' && !unicode.IsSpace(r) && + (unicode.IsLetter(r) || + unicode.IsDigit(r) || + unicode.IsNumber(r) || + unicode.IsGraphic(r) || + unicode.IsPunct(r)) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/images/annotations.go b/integration-test/vendor/github.com/containerd/containerd/images/annotations.go new file mode 100644 index 000000000..47d92104c --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/images/annotations.go @@ -0,0 +1,23 @@ +/* + Copyright The containerd Authors. + + 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 images + +const ( + // AnnotationImageName is an annotation on a Descriptor in an index.json + // containing the `Name` value as used by an `Image` struct + AnnotationImageName = "io.containerd.image.name" +) diff --git a/integration-test/vendor/github.com/containerd/containerd/images/diffid.go b/integration-test/vendor/github.com/containerd/containerd/images/diffid.go new file mode 100644 index 000000000..56193cc28 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/images/diffid.go @@ -0,0 +1,81 @@ +/* + Copyright The containerd Authors. + + 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 images + +import ( + "context" + "io" + + "github.com/containerd/containerd/archive/compression" + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/labels" + "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/sirupsen/logrus" +) + +// GetDiffID gets the diff ID of the layer blob descriptor. +func GetDiffID(ctx context.Context, cs content.Store, desc ocispec.Descriptor) (digest.Digest, error) { + switch desc.MediaType { + case + // If the layer is already uncompressed, we can just return its digest + MediaTypeDockerSchema2Layer, + ocispec.MediaTypeImageLayer, + MediaTypeDockerSchema2LayerForeign, + ocispec.MediaTypeImageLayerNonDistributable: + return desc.Digest, nil + } + info, err := cs.Info(ctx, desc.Digest) + if err != nil { + return "", err + } + v, ok := info.Labels[labels.LabelUncompressed] + if ok { + // Fast path: if the image is already unpacked, we can use the label value + return digest.Parse(v) + } + // if the image is not unpacked, we may not have the label + ra, err := cs.ReaderAt(ctx, desc) + if err != nil { + return "", err + } + defer ra.Close() + r := content.NewReader(ra) + uR, err := compression.DecompressStream(r) + if err != nil { + return "", err + } + defer uR.Close() + digester := digest.Canonical.Digester() + hashW := digester.Hash() + if _, err := io.Copy(hashW, uR); err != nil { + return "", err + } + if err := ra.Close(); err != nil { + return "", err + } + digest := digester.Digest() + // memorize the computed value + if info.Labels == nil { + info.Labels = make(map[string]string) + } + info.Labels[labels.LabelUncompressed] = digest.String() + if _, err := cs.Update(ctx, info, "labels"); err != nil { + logrus.WithError(err).Warnf("failed to set %s label for %s", labels.LabelUncompressed, desc.Digest) + } + return digest, nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/images/handlers.go b/integration-test/vendor/github.com/containerd/containerd/images/handlers.go new file mode 100644 index 000000000..05a9017bc --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/images/handlers.go @@ -0,0 +1,288 @@ +/* + Copyright The containerd Authors. + + 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 images + +import ( + "context" + "fmt" + "sort" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/platforms" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" + "golang.org/x/sync/errgroup" + "golang.org/x/sync/semaphore" +) + +var ( + // ErrSkipDesc is used to skip processing of a descriptor and + // its descendants. + ErrSkipDesc = fmt.Errorf("skip descriptor") + + // ErrStopHandler is used to signify that the descriptor + // has been handled and should not be handled further. + // This applies only to a single descriptor in a handler + // chain and does not apply to descendant descriptors. + ErrStopHandler = fmt.Errorf("stop handler") +) + +// Handler handles image manifests +type Handler interface { + Handle(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) +} + +// HandlerFunc function implementing the Handler interface +type HandlerFunc func(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) + +// Handle image manifests +func (fn HandlerFunc) Handle(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) { + return fn(ctx, desc) +} + +// Handlers returns a handler that will run the handlers in sequence. +// +// A handler may return `ErrStopHandler` to stop calling additional handlers +func Handlers(handlers ...Handler) HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) { + var children []ocispec.Descriptor + for _, handler := range handlers { + ch, err := handler.Handle(ctx, desc) + if err != nil { + if errors.Is(err, ErrStopHandler) { + break + } + return nil, err + } + + children = append(children, ch...) + } + + return children, nil + } +} + +// Walk the resources of an image and call the handler for each. If the handler +// decodes the sub-resources for each image, +// +// This differs from dispatch in that each sibling resource is considered +// synchronously. +func Walk(ctx context.Context, handler Handler, descs ...ocispec.Descriptor) error { + for _, desc := range descs { + + children, err := handler.Handle(ctx, desc) + if err != nil { + if errors.Is(err, ErrSkipDesc) { + continue // don't traverse the children. + } + return err + } + + if len(children) > 0 { + if err := Walk(ctx, handler, children...); err != nil { + return err + } + } + } + + return nil +} + +// Dispatch runs the provided handler for content specified by the descriptors. +// If the handler decode subresources, they will be visited, as well. +// +// Handlers for siblings are run in parallel on the provided descriptors. A +// handler may return `ErrSkipDesc` to signal to the dispatcher to not traverse +// any children. +// +// A concurrency limiter can be passed in to limit the number of concurrent +// handlers running. When limiter is nil, there is no limit. +// +// Typically, this function will be used with `FetchHandler`, often composed +// with other handlers. +// +// If any handler returns an error, the dispatch session will be canceled. +func Dispatch(ctx context.Context, handler Handler, limiter *semaphore.Weighted, descs ...ocispec.Descriptor) error { + eg, ctx2 := errgroup.WithContext(ctx) + for _, desc := range descs { + desc := desc + + if limiter != nil { + if err := limiter.Acquire(ctx, 1); err != nil { + return err + } + } + + eg.Go(func() error { + desc := desc + + children, err := handler.Handle(ctx2, desc) + if limiter != nil { + limiter.Release(1) + } + if err != nil { + if errors.Is(err, ErrSkipDesc) { + return nil // don't traverse the children. + } + return err + } + + if len(children) > 0 { + return Dispatch(ctx2, handler, limiter, children...) + } + + return nil + }) + } + + return eg.Wait() +} + +// ChildrenHandler decodes well-known manifest types and returns their children. +// +// This is useful for supporting recursive fetch and other use cases where you +// want to do a full walk of resources. +// +// One can also replace this with another implementation to allow descending of +// arbitrary types. +func ChildrenHandler(provider content.Provider) HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + return Children(ctx, provider, desc) + } +} + +// SetChildrenLabels is a handler wrapper which sets labels for the content on +// the children returned by the handler and passes through the children. +// Must follow a handler that returns the children to be labeled. +func SetChildrenLabels(manager content.Manager, f HandlerFunc) HandlerFunc { + return SetChildrenMappedLabels(manager, f, nil) +} + +// SetChildrenMappedLabels is a handler wrapper which sets labels for the content on +// the children returned by the handler and passes through the children. +// Must follow a handler that returns the children to be labeled. +// The label map allows the caller to control the labels per child descriptor. +// For returned labels, the index of the child will be appended to the end +// except for the first index when the returned label does not end with '.'. +func SetChildrenMappedLabels(manager content.Manager, f HandlerFunc, labelMap func(ocispec.Descriptor) []string) HandlerFunc { + if labelMap == nil { + labelMap = ChildGCLabels + } + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + children, err := f(ctx, desc) + if err != nil { + return children, err + } + + if len(children) > 0 { + var ( + info = content.Info{ + Digest: desc.Digest, + Labels: map[string]string{}, + } + fields = []string{} + keys = map[string]uint{} + ) + for _, ch := range children { + labelKeys := labelMap(ch) + for _, key := range labelKeys { + idx := keys[key] + keys[key] = idx + 1 + if idx > 0 || key[len(key)-1] == '.' { + key = fmt.Sprintf("%s%d", key, idx) + } + + info.Labels[key] = ch.Digest.String() + fields = append(fields, "labels."+key) + } + } + + _, err := manager.Update(ctx, info, fields...) + if err != nil { + return nil, err + } + } + + return children, err + } +} + +// FilterPlatforms is a handler wrapper which limits the descriptors returned +// based on matching the specified platform matcher. +func FilterPlatforms(f HandlerFunc, m platforms.Matcher) HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + children, err := f(ctx, desc) + if err != nil { + return children, err + } + + var descs []ocispec.Descriptor + + if m == nil { + descs = children + } else { + for _, d := range children { + if d.Platform == nil || m.Match(*d.Platform) { + descs = append(descs, d) + } + } + } + + return descs, nil + } +} + +// LimitManifests is a handler wrapper which filters the manifest descriptors +// returned using the provided platform. +// The results will be ordered according to the comparison operator and +// use the ordering in the manifests for equal matches. +// A limit of 0 or less is considered no limit. +// A not found error is returned if no manifest is matched. +func LimitManifests(f HandlerFunc, m platforms.MatchComparer, n int) HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + children, err := f(ctx, desc) + if err != nil { + return children, err + } + + switch desc.MediaType { + case ocispec.MediaTypeImageIndex, MediaTypeDockerSchema2ManifestList: + sort.SliceStable(children, func(i, j int) bool { + if children[i].Platform == nil { + return false + } + if children[j].Platform == nil { + return true + } + return m.Less(*children[i].Platform, *children[j].Platform) + }) + + if n > 0 { + if len(children) == 0 { + return children, errors.Wrap(errdefs.ErrNotFound, "no match for platform in manifest") + } + if len(children) > n { + children = children[:n] + } + } + default: + // only limit manifests from an index + } + return children, nil + } +} diff --git a/integration-test/vendor/github.com/containerd/containerd/images/image.go b/integration-test/vendor/github.com/containerd/containerd/images/image.go new file mode 100644 index 000000000..2e5cd61c9 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/images/image.go @@ -0,0 +1,441 @@ +/* + Copyright The containerd Authors. + + 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 images + +import ( + "context" + "encoding/json" + "fmt" + "sort" + "time" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/platforms" + digest "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +// Image provides the model for how containerd views container images. +type Image struct { + // Name of the image. + // + // To be pulled, it must be a reference compatible with resolvers. + // + // This field is required. + Name string + + // Labels provide runtime decoration for the image record. + // + // There is no default behavior for how these labels are propagated. They + // only decorate the static metadata object. + // + // This field is optional. + Labels map[string]string + + // Target describes the root content for this image. Typically, this is + // a manifest, index or manifest list. + Target ocispec.Descriptor + + CreatedAt, UpdatedAt time.Time +} + +// DeleteOptions provide options on image delete +type DeleteOptions struct { + Synchronous bool +} + +// DeleteOpt allows configuring a delete operation +type DeleteOpt func(context.Context, *DeleteOptions) error + +// SynchronousDelete is used to indicate that an image deletion and removal of +// the image resources should occur synchronously before returning a result. +func SynchronousDelete() DeleteOpt { + return func(ctx context.Context, o *DeleteOptions) error { + o.Synchronous = true + return nil + } +} + +// Store and interact with images +type Store interface { + Get(ctx context.Context, name string) (Image, error) + List(ctx context.Context, filters ...string) ([]Image, error) + Create(ctx context.Context, image Image) (Image, error) + + // Update will replace the data in the store with the provided image. If + // one or more fieldpaths are provided, only those fields will be updated. + Update(ctx context.Context, image Image, fieldpaths ...string) (Image, error) + + Delete(ctx context.Context, name string, opts ...DeleteOpt) error +} + +// TODO(stevvooe): Many of these functions make strong platform assumptions, +// which are untrue in a lot of cases. More refactoring must be done here to +// make this work in all cases. + +// Config resolves the image configuration descriptor. +// +// The caller can then use the descriptor to resolve and process the +// configuration of the image. +func (image *Image) Config(ctx context.Context, provider content.Provider, platform platforms.MatchComparer) (ocispec.Descriptor, error) { + return Config(ctx, provider, image.Target, platform) +} + +// RootFS returns the unpacked diffids that make up and images rootfs. +// +// These are used to verify that a set of layers unpacked to the expected +// values. +func (image *Image) RootFS(ctx context.Context, provider content.Provider, platform platforms.MatchComparer) ([]digest.Digest, error) { + desc, err := image.Config(ctx, provider, platform) + if err != nil { + return nil, err + } + return RootFS(ctx, provider, desc) +} + +// Size returns the total size of an image's packed resources. +func (image *Image) Size(ctx context.Context, provider content.Provider, platform platforms.MatchComparer) (int64, error) { + var size int64 + return size, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + if desc.Size < 0 { + return nil, errors.Errorf("invalid size %v in %v (%v)", desc.Size, desc.Digest, desc.MediaType) + } + size += desc.Size + return nil, nil + }), LimitManifests(FilterPlatforms(ChildrenHandler(provider), platform), platform, 1)), image.Target) +} + +type platformManifest struct { + p *ocispec.Platform + m *ocispec.Manifest +} + +// Manifest resolves a manifest from the image for the given platform. +// +// When a manifest descriptor inside of a manifest index does not have +// a platform defined, the platform from the image config is considered. +// +// If the descriptor points to a non-index manifest, then the manifest is +// unmarshalled and returned without considering the platform inside of the +// config. +// +// TODO(stevvooe): This violates the current platform agnostic approach to this +// package by returning a specific manifest type. We'll need to refactor this +// to return a manifest descriptor or decide that we want to bring the API in +// this direction because this abstraction is not needed.` +func Manifest(ctx context.Context, provider content.Provider, image ocispec.Descriptor, platform platforms.MatchComparer) (ocispec.Manifest, error) { + var ( + limit = 1 + m []platformManifest + wasIndex bool + ) + + if err := Walk(ctx, HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + switch desc.MediaType { + case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: + p, err := content.ReadBlob(ctx, provider, desc) + if err != nil { + return nil, err + } + + if err := validateMediaType(p, desc.MediaType); err != nil { + return nil, errors.Wrapf(err, "manifest: invalid desc %s", desc.Digest) + } + + var manifest ocispec.Manifest + if err := json.Unmarshal(p, &manifest); err != nil { + return nil, err + } + + if desc.Digest != image.Digest && platform != nil { + if desc.Platform != nil && !platform.Match(*desc.Platform) { + return nil, nil + } + + if desc.Platform == nil { + p, err := content.ReadBlob(ctx, provider, manifest.Config) + if err != nil { + return nil, err + } + + var image ocispec.Image + if err := json.Unmarshal(p, &image); err != nil { + return nil, err + } + + if !platform.Match(platforms.Normalize(ocispec.Platform{OS: image.OS, Architecture: image.Architecture})) { + return nil, nil + } + + } + } + + m = append(m, platformManifest{ + p: desc.Platform, + m: &manifest, + }) + + return nil, nil + case MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + p, err := content.ReadBlob(ctx, provider, desc) + if err != nil { + return nil, err + } + + if err := validateMediaType(p, desc.MediaType); err != nil { + return nil, errors.Wrapf(err, "manifest: invalid desc %s", desc.Digest) + } + + var idx ocispec.Index + if err := json.Unmarshal(p, &idx); err != nil { + return nil, err + } + + if platform == nil { + return idx.Manifests, nil + } + + var descs []ocispec.Descriptor + for _, d := range idx.Manifests { + if d.Platform == nil || platform.Match(*d.Platform) { + descs = append(descs, d) + } + } + + sort.SliceStable(descs, func(i, j int) bool { + if descs[i].Platform == nil { + return false + } + if descs[j].Platform == nil { + return true + } + return platform.Less(*descs[i].Platform, *descs[j].Platform) + }) + + wasIndex = true + + if len(descs) > limit { + return descs[:limit], nil + } + return descs, nil + } + return nil, errors.Wrapf(errdefs.ErrNotFound, "unexpected media type %v for %v", desc.MediaType, desc.Digest) + }), image); err != nil { + return ocispec.Manifest{}, err + } + + if len(m) == 0 { + err := errors.Wrapf(errdefs.ErrNotFound, "manifest %v", image.Digest) + if wasIndex { + err = errors.Wrapf(errdefs.ErrNotFound, "no match for platform in manifest %v", image.Digest) + } + return ocispec.Manifest{}, err + } + return *m[0].m, nil +} + +// Config resolves the image configuration descriptor using a content provided +// to resolve child resources on the image. +// +// The caller can then use the descriptor to resolve and process the +// configuration of the image. +func Config(ctx context.Context, provider content.Provider, image ocispec.Descriptor, platform platforms.MatchComparer) (ocispec.Descriptor, error) { + manifest, err := Manifest(ctx, provider, image, platform) + if err != nil { + return ocispec.Descriptor{}, err + } + return manifest.Config, err +} + +// Platforms returns one or more platforms supported by the image. +func Platforms(ctx context.Context, provider content.Provider, image ocispec.Descriptor) ([]ocispec.Platform, error) { + var platformSpecs []ocispec.Platform + return platformSpecs, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + if desc.Platform != nil { + platformSpecs = append(platformSpecs, *desc.Platform) + return nil, ErrSkipDesc + } + + switch desc.MediaType { + case MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig: + p, err := content.ReadBlob(ctx, provider, desc) + if err != nil { + return nil, err + } + + var image ocispec.Image + if err := json.Unmarshal(p, &image); err != nil { + return nil, err + } + + platformSpecs = append(platformSpecs, + platforms.Normalize(ocispec.Platform{OS: image.OS, Architecture: image.Architecture})) + } + return nil, nil + }), ChildrenHandler(provider)), image) +} + +// Check returns nil if the all components of an image are available in the +// provider for the specified platform. +// +// If available is true, the caller can assume that required represents the +// complete set of content required for the image. +// +// missing will have the components that are part of required but not available +// in the provider. +// +// If there is a problem resolving content, an error will be returned. +func Check(ctx context.Context, provider content.Provider, image ocispec.Descriptor, platform platforms.MatchComparer) (available bool, required, present, missing []ocispec.Descriptor, err error) { + mfst, err := Manifest(ctx, provider, image, platform) + if err != nil { + if errdefs.IsNotFound(err) { + return false, []ocispec.Descriptor{image}, nil, []ocispec.Descriptor{image}, nil + } + + return false, nil, nil, nil, errors.Wrapf(err, "failed to check image %v", image.Digest) + } + + // TODO(stevvooe): It is possible that referenced conponents could have + // children, but this is rare. For now, we ignore this and only verify + // that manifest components are present. + required = append([]ocispec.Descriptor{mfst.Config}, mfst.Layers...) + + for _, desc := range required { + ra, err := provider.ReaderAt(ctx, desc) + if err != nil { + if errdefs.IsNotFound(err) { + missing = append(missing, desc) + continue + } else { + return false, nil, nil, nil, errors.Wrapf(err, "failed to check image %v", desc.Digest) + } + } + ra.Close() + present = append(present, desc) + + } + + return true, required, present, missing, nil +} + +// Children returns the immediate children of content described by the descriptor. +func Children(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + var descs []ocispec.Descriptor + switch desc.MediaType { + case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: + p, err := content.ReadBlob(ctx, provider, desc) + if err != nil { + return nil, err + } + + if err := validateMediaType(p, desc.MediaType); err != nil { + return nil, errors.Wrapf(err, "children: invalid desc %s", desc.Digest) + } + + // TODO(stevvooe): We just assume oci manifest, for now. There may be + // subtle differences from the docker version. + var manifest ocispec.Manifest + if err := json.Unmarshal(p, &manifest); err != nil { + return nil, err + } + + descs = append(descs, manifest.Config) + descs = append(descs, manifest.Layers...) + case MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + p, err := content.ReadBlob(ctx, provider, desc) + if err != nil { + return nil, err + } + + if err := validateMediaType(p, desc.MediaType); err != nil { + return nil, errors.Wrapf(err, "children: invalid desc %s", desc.Digest) + } + + var index ocispec.Index + if err := json.Unmarshal(p, &index); err != nil { + return nil, err + } + + descs = append(descs, index.Manifests...) + default: + if IsLayerType(desc.MediaType) || IsKnownConfig(desc.MediaType) { + // childless data types. + return nil, nil + } + log.G(ctx).Debugf("encountered unknown type %v; children may not be fetched", desc.MediaType) + } + + return descs, nil +} + +// unknownDocument represents a manifest, manifest list, or index that has not +// yet been validated. +type unknownDocument struct { + MediaType string `json:"mediaType,omitempty"` + Config json.RawMessage `json:"config,omitempty"` + Layers json.RawMessage `json:"layers,omitempty"` + Manifests json.RawMessage `json:"manifests,omitempty"` + FSLayers json.RawMessage `json:"fsLayers,omitempty"` // schema 1 +} + +// validateMediaType returns an error if the byte slice is invalid JSON or if +// the media type identifies the blob as one format but it contains elements of +// another format. +func validateMediaType(b []byte, mt string) error { + var doc unknownDocument + if err := json.Unmarshal(b, &doc); err != nil { + return err + } + if len(doc.FSLayers) != 0 { + return fmt.Errorf("media-type: schema 1 not supported") + } + switch mt { + case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: + if len(doc.Manifests) != 0 || + doc.MediaType == MediaTypeDockerSchema2ManifestList || + doc.MediaType == ocispec.MediaTypeImageIndex { + return fmt.Errorf("media-type: expected manifest but found index (%s)", mt) + } + case MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + if len(doc.Config) != 0 || len(doc.Layers) != 0 || + doc.MediaType == MediaTypeDockerSchema2Manifest || + doc.MediaType == ocispec.MediaTypeImageManifest { + return fmt.Errorf("media-type: expected index but found manifest (%s)", mt) + } + } + return nil +} + +// RootFS returns the unpacked diffids that make up and images rootfs. +// +// These are used to verify that a set of layers unpacked to the expected +// values. +func RootFS(ctx context.Context, provider content.Provider, configDesc ocispec.Descriptor) ([]digest.Digest, error) { + p, err := content.ReadBlob(ctx, provider, configDesc) + if err != nil { + return nil, err + } + + var config ocispec.Image + if err := json.Unmarshal(p, &config); err != nil { + return nil, err + } + return config.RootFS.DiffIDs, nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/images/importexport.go b/integration-test/vendor/github.com/containerd/containerd/images/importexport.go new file mode 100644 index 000000000..843adcadc --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/images/importexport.go @@ -0,0 +1,37 @@ +/* + Copyright The containerd Authors. + + 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 images + +import ( + "context" + "io" + + "github.com/containerd/containerd/content" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// Importer is the interface for image importer. +type Importer interface { + // Import imports an image from a tar stream. + Import(ctx context.Context, store content.Store, reader io.Reader) (ocispec.Descriptor, error) +} + +// Exporter is the interface for image exporter. +type Exporter interface { + // Export exports an image to a tar stream. + Export(ctx context.Context, store content.Provider, desc ocispec.Descriptor, writer io.Writer) error +} diff --git a/integration-test/vendor/github.com/containerd/containerd/images/mediatypes.go b/integration-test/vendor/github.com/containerd/containerd/images/mediatypes.go new file mode 100644 index 000000000..785d71291 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/images/mediatypes.go @@ -0,0 +1,204 @@ +/* + Copyright The containerd Authors. + + 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 images + +import ( + "context" + "sort" + "strings" + + "github.com/containerd/containerd/errdefs" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +// mediatype definitions for image components handled in containerd. +// +// oci components are generally referenced directly, although we may centralize +// here for clarity. +const ( + MediaTypeDockerSchema2Layer = "application/vnd.docker.image.rootfs.diff.tar" + MediaTypeDockerSchema2LayerForeign = "application/vnd.docker.image.rootfs.foreign.diff.tar" + MediaTypeDockerSchema2LayerGzip = "application/vnd.docker.image.rootfs.diff.tar.gzip" + MediaTypeDockerSchema2LayerForeignGzip = "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip" + MediaTypeDockerSchema2Config = "application/vnd.docker.container.image.v1+json" + MediaTypeDockerSchema2Manifest = "application/vnd.docker.distribution.manifest.v2+json" + MediaTypeDockerSchema2ManifestList = "application/vnd.docker.distribution.manifest.list.v2+json" + // Checkpoint/Restore Media Types + MediaTypeContainerd1Checkpoint = "application/vnd.containerd.container.criu.checkpoint.criu.tar" + MediaTypeContainerd1CheckpointPreDump = "application/vnd.containerd.container.criu.checkpoint.predump.tar" + MediaTypeContainerd1Resource = "application/vnd.containerd.container.resource.tar" + MediaTypeContainerd1RW = "application/vnd.containerd.container.rw.tar" + MediaTypeContainerd1CheckpointConfig = "application/vnd.containerd.container.checkpoint.config.v1+proto" + MediaTypeContainerd1CheckpointOptions = "application/vnd.containerd.container.checkpoint.options.v1+proto" + MediaTypeContainerd1CheckpointRuntimeName = "application/vnd.containerd.container.checkpoint.runtime.name" + MediaTypeContainerd1CheckpointRuntimeOptions = "application/vnd.containerd.container.checkpoint.runtime.options+proto" + // Legacy Docker schema1 manifest + MediaTypeDockerSchema1Manifest = "application/vnd.docker.distribution.manifest.v1+prettyjws" + // Encypted media types + MediaTypeImageLayerEncrypted = ocispec.MediaTypeImageLayer + "+encrypted" + MediaTypeImageLayerGzipEncrypted = ocispec.MediaTypeImageLayerGzip + "+encrypted" +) + +// DiffCompression returns the compression as defined by the layer diff media +// type. For Docker media types without compression, "unknown" is returned to +// indicate that the media type may be compressed. If the media type is not +// recognized as a layer diff, then it returns errdefs.ErrNotImplemented +func DiffCompression(ctx context.Context, mediaType string) (string, error) { + base, ext := parseMediaTypes(mediaType) + switch base { + case MediaTypeDockerSchema2Layer, MediaTypeDockerSchema2LayerForeign: + if len(ext) > 0 { + // Type is wrapped + return "", nil + } + // These media types may have been compressed but failed to + // use the correct media type. The decompression function + // should detect and handle this case. + return "unknown", nil + case MediaTypeDockerSchema2LayerGzip, MediaTypeDockerSchema2LayerForeignGzip: + if len(ext) > 0 { + // Type is wrapped + return "", nil + } + return "gzip", nil + case ocispec.MediaTypeImageLayer, ocispec.MediaTypeImageLayerNonDistributable: + if len(ext) > 0 { + switch ext[len(ext)-1] { + case "gzip": + return "gzip", nil + case "zstd": + return "zstd", nil + } + } + return "", nil + default: + return "", errors.Wrapf(errdefs.ErrNotImplemented, "unrecognised mediatype %s", mediaType) + } +} + +// parseMediaTypes splits the media type into the base type and +// an array of sorted extensions +func parseMediaTypes(mt string) (string, []string) { + if mt == "" { + return "", []string{} + } + + s := strings.Split(mt, "+") + ext := s[1:] + sort.Strings(ext) + + return s[0], ext +} + +// IsNonDistributable returns true if the media type is non-distributable. +func IsNonDistributable(mt string) bool { + return strings.HasPrefix(mt, "application/vnd.oci.image.layer.nondistributable.") || + strings.HasPrefix(mt, "application/vnd.docker.image.rootfs.foreign.") +} + +// IsLayerType returns true if the media type is a layer +func IsLayerType(mt string) bool { + if strings.HasPrefix(mt, "application/vnd.oci.image.layer.") { + return true + } + + // Parse Docker media types, strip off any + suffixes first + base, _ := parseMediaTypes(mt) + switch base { + case MediaTypeDockerSchema2Layer, MediaTypeDockerSchema2LayerGzip, + MediaTypeDockerSchema2LayerForeign, MediaTypeDockerSchema2LayerForeignGzip: + return true + } + return false +} + +// IsDockerType returns true if the media type has "application/vnd.docker." prefix +func IsDockerType(mt string) bool { + return strings.HasPrefix(mt, "application/vnd.docker.") +} + +// IsManifestType returns true if the media type is an OCI-compatible manifest. +// No support for schema1 manifest. +func IsManifestType(mt string) bool { + switch mt { + case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: + return true + default: + return false + } +} + +// IsIndexType returns true if the media type is an OCI-compatible index. +func IsIndexType(mt string) bool { + switch mt { + case ocispec.MediaTypeImageIndex, MediaTypeDockerSchema2ManifestList: + return true + default: + return false + } +} + +// IsConfigType returns true if the media type is an OCI-compatible image config. +// No support for containerd checkpoint configs. +func IsConfigType(mt string) bool { + switch mt { + case MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig: + return true + default: + return false + } +} + +// IsKnownConfig returns true if the media type is a known config type, +// including containerd checkpoint configs +func IsKnownConfig(mt string) bool { + switch mt { + case MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig, + MediaTypeContainerd1Checkpoint, MediaTypeContainerd1CheckpointConfig: + return true + } + return false +} + +// ChildGCLabels returns the label for a given descriptor to reference it +func ChildGCLabels(desc ocispec.Descriptor) []string { + mt := desc.MediaType + if IsKnownConfig(mt) { + return []string{"containerd.io/gc.ref.content.config"} + } + + switch mt { + case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: + return []string{"containerd.io/gc.ref.content.m."} + } + + if IsLayerType(mt) { + return []string{"containerd.io/gc.ref.content.l."} + } + + return []string{"containerd.io/gc.ref.content."} +} + +// ChildGCLabelsFilterLayers returns the labels for a given descriptor to +// reference it, skipping layer media types +func ChildGCLabelsFilterLayers(desc ocispec.Descriptor) []string { + if IsLayerType(desc.MediaType) { + return nil + } + return ChildGCLabels(desc) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/labels/labels.go b/integration-test/vendor/github.com/containerd/containerd/labels/labels.go new file mode 100644 index 000000000..d76ff2cf9 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/labels/labels.go @@ -0,0 +1,21 @@ +/* + Copyright The containerd Authors. + + 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 labels + +// LabelUncompressed is added to compressed layer contents. +// The value is digest of the uncompressed content. +const LabelUncompressed = "containerd.io/uncompressed" diff --git a/integration-test/vendor/github.com/containerd/containerd/labels/validate.go b/integration-test/vendor/github.com/containerd/containerd/labels/validate.go new file mode 100644 index 000000000..0de461663 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/labels/validate.go @@ -0,0 +1,37 @@ +/* + Copyright The containerd Authors. + + 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 labels + +import ( + "github.com/containerd/containerd/errdefs" + "github.com/pkg/errors" +) + +const ( + maxSize = 4096 +) + +// Validate a label's key and value are under 4096 bytes +func Validate(k, v string) error { + if (len(k) + len(v)) > maxSize { + if len(k) > 10 { + k = k[:10] + } + return errors.Wrapf(errdefs.ErrInvalidArgument, "label key and value greater than maximum size (%d bytes), key: %s", maxSize, k) + } + return nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/log/context.go b/integration-test/vendor/github.com/containerd/containerd/log/context.go new file mode 100644 index 000000000..37b6a7d1c --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/log/context.go @@ -0,0 +1,68 @@ +/* + Copyright The containerd Authors. + + 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 log + +import ( + "context" + + "github.com/sirupsen/logrus" +) + +var ( + // G is an alias for GetLogger. + // + // We may want to define this locally to a package to get package tagged log + // messages. + G = GetLogger + + // L is an alias for the standard logger. + L = logrus.NewEntry(logrus.StandardLogger()) +) + +type ( + loggerKey struct{} +) + +const ( + // RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to + // ensure the formatted time is always the same number of characters. + RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00" + + // TextFormat represents the text logging format + TextFormat = "text" + + // JSONFormat represents the JSON logging format + JSONFormat = "json" +) + +// WithLogger returns a new context with the provided logger. Use in +// combination with logger.WithField(s) for great effect. +func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context { + return context.WithValue(ctx, loggerKey{}, logger) +} + +// GetLogger retrieves the current logger from the context. If no logger is +// available, the default logger is returned. +func GetLogger(ctx context.Context) *logrus.Entry { + logger := ctx.Value(loggerKey{}) + + if logger == nil { + return L + } + + return logger.(*logrus.Entry) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/platforms/compare.go b/integration-test/vendor/github.com/containerd/containerd/platforms/compare.go new file mode 100644 index 000000000..c7657e186 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/platforms/compare.go @@ -0,0 +1,193 @@ +/* + Copyright The containerd Authors. + + 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 platforms + +import ( + "strconv" + "strings" + + specs "github.com/opencontainers/image-spec/specs-go/v1" +) + +// MatchComparer is able to match and compare platforms to +// filter and sort platforms. +type MatchComparer interface { + Matcher + + Less(specs.Platform, specs.Platform) bool +} + +// platformVector returns an (ordered) vector of appropriate specs.Platform +// objects to try matching for the given platform object (see platforms.Only). +func platformVector(platform specs.Platform) []specs.Platform { + vector := []specs.Platform{platform} + + switch platform.Architecture { + case "amd64": + vector = append(vector, specs.Platform{ + Architecture: "386", + OS: platform.OS, + OSVersion: platform.OSVersion, + OSFeatures: platform.OSFeatures, + Variant: platform.Variant, + }) + case "arm": + if armVersion, err := strconv.Atoi(strings.TrimPrefix(platform.Variant, "v")); err == nil && armVersion > 5 { + for armVersion--; armVersion >= 5; armVersion-- { + vector = append(vector, specs.Platform{ + Architecture: platform.Architecture, + OS: platform.OS, + OSVersion: platform.OSVersion, + OSFeatures: platform.OSFeatures, + Variant: "v" + strconv.Itoa(armVersion), + }) + } + } + case "arm64": + variant := platform.Variant + if variant == "" { + variant = "v8" + } + vector = append(vector, platformVector(specs.Platform{ + Architecture: "arm", + OS: platform.OS, + OSVersion: platform.OSVersion, + OSFeatures: platform.OSFeatures, + Variant: variant, + })...) + } + + return vector +} + +// Only returns a match comparer for a single platform +// using default resolution logic for the platform. +// +// For arm/v8, will also match arm/v7, arm/v6 and arm/v5 +// For arm/v7, will also match arm/v6 and arm/v5 +// For arm/v6, will also match arm/v5 +// For amd64, will also match 386 +func Only(platform specs.Platform) MatchComparer { + return Ordered(platformVector(Normalize(platform))...) +} + +// OnlyStrict returns a match comparer for a single platform. +// +// Unlike Only, OnlyStrict does not match sub platforms. +// So, "arm/vN" will not match "arm/vM" where M < N, +// and "amd64" will not also match "386". +// +// OnlyStrict matches non-canonical forms. +// So, "arm64" matches "arm/64/v8". +func OnlyStrict(platform specs.Platform) MatchComparer { + return Ordered(Normalize(platform)) +} + +// Ordered returns a platform MatchComparer which matches any of the platforms +// but orders them in order they are provided. +func Ordered(platforms ...specs.Platform) MatchComparer { + matchers := make([]Matcher, len(platforms)) + for i := range platforms { + matchers[i] = NewMatcher(platforms[i]) + } + return orderedPlatformComparer{ + matchers: matchers, + } +} + +// Any returns a platform MatchComparer which matches any of the platforms +// with no preference for ordering. +func Any(platforms ...specs.Platform) MatchComparer { + matchers := make([]Matcher, len(platforms)) + for i := range platforms { + matchers[i] = NewMatcher(platforms[i]) + } + return anyPlatformComparer{ + matchers: matchers, + } +} + +// All is a platform MatchComparer which matches all platforms +// with preference for ordering. +var All MatchComparer = allPlatformComparer{} + +type orderedPlatformComparer struct { + matchers []Matcher +} + +func (c orderedPlatformComparer) Match(platform specs.Platform) bool { + for _, m := range c.matchers { + if m.Match(platform) { + return true + } + } + return false +} + +func (c orderedPlatformComparer) Less(p1 specs.Platform, p2 specs.Platform) bool { + for _, m := range c.matchers { + p1m := m.Match(p1) + p2m := m.Match(p2) + if p1m && !p2m { + return true + } + if p1m || p2m { + return false + } + } + return false +} + +type anyPlatformComparer struct { + matchers []Matcher +} + +func (c anyPlatformComparer) Match(platform specs.Platform) bool { + for _, m := range c.matchers { + if m.Match(platform) { + return true + } + } + return false +} + +func (c anyPlatformComparer) Less(p1, p2 specs.Platform) bool { + var p1m, p2m bool + for _, m := range c.matchers { + if !p1m && m.Match(p1) { + p1m = true + } + if !p2m && m.Match(p2) { + p2m = true + } + if p1m && p2m { + return false + } + } + // If one matches, and the other does, sort match first + return p1m && !p2m +} + +type allPlatformComparer struct{} + +func (allPlatformComparer) Match(specs.Platform) bool { + return true +} + +func (allPlatformComparer) Less(specs.Platform, specs.Platform) bool { + return false +} diff --git a/integration-test/vendor/github.com/containerd/containerd/platforms/cpuinfo.go b/integration-test/vendor/github.com/containerd/containerd/platforms/cpuinfo.go new file mode 100644 index 000000000..4a7177e31 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/platforms/cpuinfo.go @@ -0,0 +1,131 @@ +/* + Copyright The containerd Authors. + + 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 platforms + +import ( + "bufio" + "os" + "runtime" + "strings" + "sync" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/log" + "github.com/pkg/errors" +) + +// Present the ARM instruction set architecture, eg: v7, v8 +// Don't use this value directly; call cpuVariant() instead. +var cpuVariantValue string + +var cpuVariantOnce sync.Once + +func cpuVariant() string { + cpuVariantOnce.Do(func() { + if isArmArch(runtime.GOARCH) { + cpuVariantValue = getCPUVariant() + } + }) + return cpuVariantValue +} + +// For Linux, the kernel has already detected the ABI, ISA and Features. +// So we don't need to access the ARM registers to detect platform information +// by ourselves. We can just parse these information from /proc/cpuinfo +func getCPUInfo(pattern string) (info string, err error) { + if !isLinuxOS(runtime.GOOS) { + return "", errors.Wrapf(errdefs.ErrNotImplemented, "getCPUInfo for OS %s", runtime.GOOS) + } + + cpuinfo, err := os.Open("/proc/cpuinfo") + if err != nil { + return "", err + } + defer cpuinfo.Close() + + // Start to Parse the Cpuinfo line by line. For SMP SoC, we parse + // the first core is enough. + scanner := bufio.NewScanner(cpuinfo) + for scanner.Scan() { + newline := scanner.Text() + list := strings.Split(newline, ":") + + if len(list) > 1 && strings.EqualFold(strings.TrimSpace(list[0]), pattern) { + return strings.TrimSpace(list[1]), nil + } + } + + // Check whether the scanner encountered errors + err = scanner.Err() + if err != nil { + return "", err + } + + return "", errors.Wrapf(errdefs.ErrNotFound, "getCPUInfo for pattern: %s", pattern) +} + +func getCPUVariant() string { + if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { + // Windows/Darwin only supports v7 for ARM32 and v8 for ARM64 and so we can use + // runtime.GOARCH to determine the variants + var variant string + switch runtime.GOARCH { + case "arm64": + variant = "v8" + case "arm": + variant = "v7" + default: + variant = "unknown" + } + + return variant + } + + variant, err := getCPUInfo("Cpu architecture") + if err != nil { + log.L.WithError(err).Error("failure getting variant") + return "" + } + + // handle edge case for Raspberry Pi ARMv6 devices (which due to a kernel quirk, report "CPU architecture: 7") + // https://www.raspberrypi.org/forums/viewtopic.php?t=12614 + if runtime.GOARCH == "arm" && variant == "7" { + model, err := getCPUInfo("model name") + if err == nil && strings.HasPrefix(strings.ToLower(model), "armv6-compatible") { + variant = "6" + } + } + + switch strings.ToLower(variant) { + case "8", "aarch64": + variant = "v8" + case "7", "7m", "?(12)", "?(13)", "?(14)", "?(15)", "?(16)", "?(17)": + variant = "v7" + case "6", "6tej": + variant = "v6" + case "5", "5t", "5te", "5tej": + variant = "v5" + case "4", "4t": + variant = "v4" + case "3": + variant = "v3" + default: + variant = "unknown" + } + + return variant +} diff --git a/integration-test/vendor/github.com/containerd/containerd/platforms/database.go b/integration-test/vendor/github.com/containerd/containerd/platforms/database.go new file mode 100644 index 000000000..6ede94061 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/platforms/database.go @@ -0,0 +1,114 @@ +/* + Copyright The containerd Authors. + + 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 platforms + +import ( + "runtime" + "strings" +) + +// isLinuxOS returns true if the operating system is Linux. +// +// The OS value should be normalized before calling this function. +func isLinuxOS(os string) bool { + return os == "linux" +} + +// These function are generated from https://golang.org/src/go/build/syslist.go. +// +// We use switch statements because they are slightly faster than map lookups +// and use a little less memory. + +// isKnownOS returns true if we know about the operating system. +// +// The OS value should be normalized before calling this function. +func isKnownOS(os string) bool { + switch os { + case "aix", "android", "darwin", "dragonfly", "freebsd", "hurd", "illumos", "js", "linux", "nacl", "netbsd", "openbsd", "plan9", "solaris", "windows", "zos": + return true + } + return false +} + +// isArmArch returns true if the architecture is ARM. +// +// The arch value should be normalized before being passed to this function. +func isArmArch(arch string) bool { + switch arch { + case "arm", "arm64": + return true + } + return false +} + +// isKnownArch returns true if we know about the architecture. +// +// The arch value should be normalized before being passed to this function. +func isKnownArch(arch string) bool { + switch arch { + case "386", "amd64", "amd64p32", "arm", "armbe", "arm64", "arm64be", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le", "ppc", "riscv", "riscv64", "s390", "s390x", "sparc", "sparc64", "wasm": + return true + } + return false +} + +func normalizeOS(os string) string { + if os == "" { + return runtime.GOOS + } + os = strings.ToLower(os) + + switch os { + case "macos": + os = "darwin" + } + return os +} + +// normalizeArch normalizes the architecture. +func normalizeArch(arch, variant string) (string, string) { + arch, variant = strings.ToLower(arch), strings.ToLower(variant) + switch arch { + case "i386": + arch = "386" + variant = "" + case "x86_64", "x86-64": + arch = "amd64" + variant = "" + case "aarch64", "arm64": + arch = "arm64" + switch variant { + case "8", "v8": + variant = "" + } + case "armhf": + arch = "arm" + variant = "v7" + case "armel": + arch = "arm" + variant = "v6" + case "arm": + switch variant { + case "", "7": + variant = "v7" + case "5", "6", "8": + variant = "v" + variant + } + } + + return arch, variant +} diff --git a/integration-test/vendor/github.com/containerd/containerd/platforms/defaults.go b/integration-test/vendor/github.com/containerd/containerd/platforms/defaults.go new file mode 100644 index 000000000..cb77fbc9f --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/platforms/defaults.go @@ -0,0 +1,43 @@ +/* + Copyright The containerd Authors. + + 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 platforms + +import ( + "runtime" + + specs "github.com/opencontainers/image-spec/specs-go/v1" +) + +// DefaultString returns the default string specifier for the platform. +func DefaultString() string { + return Format(DefaultSpec()) +} + +// DefaultSpec returns the current platform's default platform specification. +func DefaultSpec() specs.Platform { + return specs.Platform{ + OS: runtime.GOOS, + Architecture: runtime.GOARCH, + // The Variant field will be empty if arch != ARM. + Variant: cpuVariant(), + } +} + +// DefaultStrict returns strict form of Default. +func DefaultStrict() MatchComparer { + return OnlyStrict(DefaultSpec()) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/platforms/defaults_unix.go b/integration-test/vendor/github.com/containerd/containerd/platforms/defaults_unix.go new file mode 100644 index 000000000..e8a7d5ffa --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/platforms/defaults_unix.go @@ -0,0 +1,24 @@ +// +build !windows + +/* + Copyright The containerd Authors. + + 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 platforms + +// Default returns the default matcher for the platform. +func Default() MatchComparer { + return Only(DefaultSpec()) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/platforms/defaults_windows.go b/integration-test/vendor/github.com/containerd/containerd/platforms/defaults_windows.go new file mode 100644 index 000000000..0c380e3b7 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/platforms/defaults_windows.go @@ -0,0 +1,81 @@ +// +build windows + +/* + Copyright The containerd Authors. + + 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 platforms + +import ( + "fmt" + "runtime" + "strconv" + "strings" + + imagespec "github.com/opencontainers/image-spec/specs-go/v1" + specs "github.com/opencontainers/image-spec/specs-go/v1" + "golang.org/x/sys/windows" +) + +type matchComparer struct { + defaults Matcher + osVersionPrefix string +} + +// Match matches platform with the same windows major, minor +// and build version. +func (m matchComparer) Match(p imagespec.Platform) bool { + if m.defaults.Match(p) { + // TODO(windows): Figure out whether OSVersion is deprecated. + return strings.HasPrefix(p.OSVersion, m.osVersionPrefix) + } + return false +} + +// Less sorts matched platforms in front of other platforms. +// For matched platforms, it puts platforms with larger revision +// number in front. +func (m matchComparer) Less(p1, p2 imagespec.Platform) bool { + m1, m2 := m.Match(p1), m.Match(p2) + if m1 && m2 { + r1, r2 := revision(p1.OSVersion), revision(p2.OSVersion) + return r1 > r2 + } + return m1 && !m2 +} + +func revision(v string) int { + parts := strings.Split(v, ".") + if len(parts) < 4 { + return 0 + } + r, err := strconv.Atoi(parts[3]) + if err != nil { + return 0 + } + return r +} + +// Default returns the current platform's default platform specification. +func Default() MatchComparer { + major, minor, build := windows.RtlGetNtVersionNumbers() + return matchComparer{ + defaults: Ordered(DefaultSpec(), specs.Platform{ + OS: "linux", + Architecture: runtime.GOARCH, + }), + osVersionPrefix: fmt.Sprintf("%d.%d.%d", major, minor, build), + } +} diff --git a/integration-test/vendor/github.com/containerd/containerd/platforms/platforms.go b/integration-test/vendor/github.com/containerd/containerd/platforms/platforms.go new file mode 100644 index 000000000..088bdea05 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/platforms/platforms.go @@ -0,0 +1,278 @@ +/* + Copyright The containerd Authors. + + 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 platforms provides a toolkit for normalizing, matching and +// specifying container platforms. +// +// Centered around OCI platform specifications, we define a string-based +// specifier syntax that can be used for user input. With a specifier, users +// only need to specify the parts of the platform that are relevant to their +// context, providing an operating system or architecture or both. +// +// How do I use this package? +// +// The vast majority of use cases should simply use the match function with +// user input. The first step is to parse a specifier into a matcher: +// +// m, err := Parse("linux") +// if err != nil { ... } +// +// Once you have a matcher, use it to match against the platform declared by a +// component, typically from an image or runtime. Since extracting an images +// platform is a little more involved, we'll use an example against the +// platform default: +// +// if ok := m.Match(Default()); !ok { /* doesn't match */ } +// +// This can be composed in loops for resolving runtimes or used as a filter for +// fetch and select images. +// +// More details of the specifier syntax and platform spec follow. +// +// Declaring Platform Support +// +// Components that have strict platform requirements should use the OCI +// platform specification to declare their support. Typically, this will be +// images and runtimes that should make these declaring which platform they +// support specifically. This looks roughly as follows: +// +// type Platform struct { +// Architecture string +// OS string +// Variant string +// } +// +// Most images and runtimes should at least set Architecture and OS, according +// to their GOARCH and GOOS values, respectively (follow the OCI image +// specification when in doubt). ARM should set variant under certain +// discussions, which are outlined below. +// +// Platform Specifiers +// +// While the OCI platform specifications provide a tool for components to +// specify structured information, user input typically doesn't need the full +// context and much can be inferred. To solve this problem, we introduced +// "specifiers". A specifier has the format +// `||/[/]`. The user can provide either the +// operating system or the architecture or both. +// +// An example of a common specifier is `linux/amd64`. If the host has a default +// of runtime that matches this, the user can simply provide the component that +// matters. For example, if a image provides amd64 and arm64 support, the +// operating system, `linux` can be inferred, so they only have to provide +// `arm64` or `amd64`. Similar behavior is implemented for operating systems, +// where the architecture may be known but a runtime may support images from +// different operating systems. +// +// Normalization +// +// Because not all users are familiar with the way the Go runtime represents +// platforms, several normalizations have been provided to make this package +// easier to user. +// +// The following are performed for architectures: +// +// Value Normalized +// aarch64 arm64 +// armhf arm +// armel arm/v6 +// i386 386 +// x86_64 amd64 +// x86-64 amd64 +// +// We also normalize the operating system `macos` to `darwin`. +// +// ARM Support +// +// To qualify ARM architecture, the Variant field is used to qualify the arm +// version. The most common arm version, v7, is represented without the variant +// unless it is explicitly provided. This is treated as equivalent to armhf. A +// previous architecture, armel, will be normalized to arm/v6. +// +// While these normalizations are provided, their support on arm platforms has +// not yet been fully implemented and tested. +package platforms + +import ( + "regexp" + "runtime" + "strconv" + "strings" + + "github.com/containerd/containerd/errdefs" + specs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +var ( + specifierRe = regexp.MustCompile(`^[A-Za-z0-9_-]+$`) +) + +// Matcher matches platforms specifications, provided by an image or runtime. +type Matcher interface { + Match(platform specs.Platform) bool +} + +// NewMatcher returns a simple matcher based on the provided platform +// specification. The returned matcher only looks for equality based on os, +// architecture and variant. +// +// One may implement their own matcher if this doesn't provide the required +// functionality. +// +// Applications should opt to use `Match` over directly parsing specifiers. +func NewMatcher(platform specs.Platform) Matcher { + return &matcher{ + Platform: Normalize(platform), + } +} + +type matcher struct { + specs.Platform +} + +func (m *matcher) Match(platform specs.Platform) bool { + normalized := Normalize(platform) + return m.OS == normalized.OS && + m.Architecture == normalized.Architecture && + m.Variant == normalized.Variant +} + +func (m *matcher) String() string { + return Format(m.Platform) +} + +// Parse parses the platform specifier syntax into a platform declaration. +// +// Platform specifiers are in the format `||/[/]`. +// The minimum required information for a platform specifier is the operating +// system or architecture. If there is only a single string (no slashes), the +// value will be matched against the known set of operating systems, then fall +// back to the known set of architectures. The missing component will be +// inferred based on the local environment. +func Parse(specifier string) (specs.Platform, error) { + if strings.Contains(specifier, "*") { + // TODO(stevvooe): need to work out exact wildcard handling + return specs.Platform{}, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: wildcards not yet supported", specifier) + } + + parts := strings.Split(specifier, "/") + + for _, part := range parts { + if !specifierRe.MatchString(part) { + return specs.Platform{}, errors.Wrapf(errdefs.ErrInvalidArgument, "%q is an invalid component of %q: platform specifier component must match %q", part, specifier, specifierRe.String()) + } + } + + var p specs.Platform + switch len(parts) { + case 1: + // in this case, we will test that the value might be an OS, then look + // it up. If it is not known, we'll treat it as an architecture. Since + // we have very little information about the platform here, we are + // going to be a little more strict if we don't know about the argument + // value. + p.OS = normalizeOS(parts[0]) + if isKnownOS(p.OS) { + // picks a default architecture + p.Architecture = runtime.GOARCH + if p.Architecture == "arm" && cpuVariant() != "v7" { + p.Variant = cpuVariant() + } + + return p, nil + } + + p.Architecture, p.Variant = normalizeArch(parts[0], "") + if p.Architecture == "arm" && p.Variant == "v7" { + p.Variant = "" + } + if isKnownArch(p.Architecture) { + p.OS = runtime.GOOS + return p, nil + } + + return specs.Platform{}, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: unknown operating system or architecture", specifier) + case 2: + // In this case, we treat as a regular os/arch pair. We don't care + // about whether or not we know of the platform. + p.OS = normalizeOS(parts[0]) + p.Architecture, p.Variant = normalizeArch(parts[1], "") + if p.Architecture == "arm" && p.Variant == "v7" { + p.Variant = "" + } + + return p, nil + case 3: + // we have a fully specified variant, this is rare + p.OS = normalizeOS(parts[0]) + p.Architecture, p.Variant = normalizeArch(parts[1], parts[2]) + if p.Architecture == "arm64" && p.Variant == "" { + p.Variant = "v8" + } + + return p, nil + } + + return specs.Platform{}, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: cannot parse platform specifier", specifier) +} + +// MustParse is like Parses but panics if the specifier cannot be parsed. +// Simplifies initialization of global variables. +func MustParse(specifier string) specs.Platform { + p, err := Parse(specifier) + if err != nil { + panic("platform: Parse(" + strconv.Quote(specifier) + "): " + err.Error()) + } + return p +} + +// Format returns a string specifier from the provided platform specification. +func Format(platform specs.Platform) string { + if platform.OS == "" { + return "unknown" + } + + return joinNotEmpty(platform.OS, platform.Architecture, platform.Variant) +} + +func joinNotEmpty(s ...string) string { + var ss []string + for _, s := range s { + if s == "" { + continue + } + + ss = append(ss, s) + } + + return strings.Join(ss, "/") +} + +// Normalize validates and translate the platform to the canonical value. +// +// For example, if "Aarch64" is encountered, we change it to "arm64" or if +// "x86_64" is encountered, it becomes "amd64". +func Normalize(platform specs.Platform) specs.Platform { + platform.OS = normalizeOS(platform.OS) + platform.Architecture, platform.Variant = normalizeArch(platform.Architecture, platform.Variant) + + // these fields are deprecated, remove them + platform.OSFeatures = nil + platform.OSVersion = "" + + return platform +} diff --git a/integration-test/vendor/github.com/containerd/containerd/reference/docker/reference.go b/integration-test/vendor/github.com/containerd/containerd/reference/docker/reference.go new file mode 100644 index 000000000..0998639b0 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/reference/docker/reference.go @@ -0,0 +1,797 @@ +/* + Copyright The containerd Authors. + + 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 docker provides a general type to represent any way of referencing images within the registry. +// Its main purpose is to abstract tags and digests (content-addressable hash). +// +// Grammar +// +// reference := name [ ":" tag ] [ "@" digest ] +// name := [domain '/'] path-component ['/' path-component]* +// domain := domain-component ['.' domain-component]* [':' port-number] +// domain-component := /([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])/ +// port-number := /[0-9]+/ +// path-component := alpha-numeric [separator alpha-numeric]* +// alpha-numeric := /[a-z0-9]+/ +// separator := /[_.]|__|[-]*/ +// +// tag := /[\w][\w.-]{0,127}/ +// +// digest := digest-algorithm ":" digest-hex +// digest-algorithm := digest-algorithm-component [ digest-algorithm-separator digest-algorithm-component ]* +// digest-algorithm-separator := /[+.-_]/ +// digest-algorithm-component := /[A-Za-z][A-Za-z0-9]*/ +// digest-hex := /[0-9a-fA-F]{32,}/ ; At least 128 bit digest value +// +// identifier := /[a-f0-9]{64}/ +// short-identifier := /[a-f0-9]{6,64}/ +package docker + +import ( + "errors" + "fmt" + "path" + "regexp" + "strings" + + "github.com/opencontainers/go-digest" +) + +const ( + // NameTotalLengthMax is the maximum total number of characters in a repository name. + NameTotalLengthMax = 255 +) + +var ( + // ErrReferenceInvalidFormat represents an error while trying to parse a string as a reference. + ErrReferenceInvalidFormat = errors.New("invalid reference format") + + // ErrTagInvalidFormat represents an error while trying to parse a string as a tag. + ErrTagInvalidFormat = errors.New("invalid tag format") + + // ErrDigestInvalidFormat represents an error while trying to parse a string as a tag. + ErrDigestInvalidFormat = errors.New("invalid digest format") + + // ErrNameContainsUppercase is returned for invalid repository names that contain uppercase characters. + ErrNameContainsUppercase = errors.New("repository name must be lowercase") + + // ErrNameEmpty is returned for empty, invalid repository names. + ErrNameEmpty = errors.New("repository name must have at least one component") + + // ErrNameTooLong is returned when a repository name is longer than NameTotalLengthMax. + ErrNameTooLong = fmt.Errorf("repository name must not be more than %v characters", NameTotalLengthMax) + + // ErrNameNotCanonical is returned when a name is not canonical. + ErrNameNotCanonical = errors.New("repository name must be canonical") +) + +// Reference is an opaque object reference identifier that may include +// modifiers such as a hostname, name, tag, and digest. +type Reference interface { + // String returns the full reference + String() string +} + +// Field provides a wrapper type for resolving correct reference types when +// working with encoding. +type Field struct { + reference Reference +} + +// AsField wraps a reference in a Field for encoding. +func AsField(reference Reference) Field { + return Field{reference} +} + +// Reference unwraps the reference type from the field to +// return the Reference object. This object should be +// of the appropriate type to further check for different +// reference types. +func (f Field) Reference() Reference { + return f.reference +} + +// MarshalText serializes the field to byte text which +// is the string of the reference. +func (f Field) MarshalText() (p []byte, err error) { + return []byte(f.reference.String()), nil +} + +// UnmarshalText parses text bytes by invoking the +// reference parser to ensure the appropriately +// typed reference object is wrapped by field. +func (f *Field) UnmarshalText(p []byte) error { + r, err := Parse(string(p)) + if err != nil { + return err + } + + f.reference = r + return nil +} + +// Named is an object with a full name +type Named interface { + Reference + Name() string +} + +// Tagged is an object which has a tag +type Tagged interface { + Reference + Tag() string +} + +// NamedTagged is an object including a name and tag. +type NamedTagged interface { + Named + Tag() string +} + +// Digested is an object which has a digest +// in which it can be referenced by +type Digested interface { + Reference + Digest() digest.Digest +} + +// Canonical reference is an object with a fully unique +// name including a name with domain and digest +type Canonical interface { + Named + Digest() digest.Digest +} + +// namedRepository is a reference to a repository with a name. +// A namedRepository has both domain and path components. +type namedRepository interface { + Named + Domain() string + Path() string +} + +// Domain returns the domain part of the Named reference +func Domain(named Named) string { + if r, ok := named.(namedRepository); ok { + return r.Domain() + } + domain, _ := splitDomain(named.Name()) + return domain +} + +// Path returns the name without the domain part of the Named reference +func Path(named Named) (name string) { + if r, ok := named.(namedRepository); ok { + return r.Path() + } + _, path := splitDomain(named.Name()) + return path +} + +func splitDomain(name string) (string, string) { + match := anchoredNameRegexp.FindStringSubmatch(name) + if len(match) != 3 { + return "", name + } + return match[1], match[2] +} + +// SplitHostname splits a named reference into a +// hostname and name string. If no valid hostname is +// found, the hostname is empty and the full value +// is returned as name +// DEPRECATED: Use Domain or Path +func SplitHostname(named Named) (string, string) { + if r, ok := named.(namedRepository); ok { + return r.Domain(), r.Path() + } + return splitDomain(named.Name()) +} + +// Parse parses s and returns a syntactically valid Reference. +// If an error was encountered it is returned, along with a nil Reference. +// NOTE: Parse will not handle short digests. +func Parse(s string) (Reference, error) { + matches := ReferenceRegexp.FindStringSubmatch(s) + if matches == nil { + if s == "" { + return nil, ErrNameEmpty + } + if ReferenceRegexp.FindStringSubmatch(strings.ToLower(s)) != nil { + return nil, ErrNameContainsUppercase + } + return nil, ErrReferenceInvalidFormat + } + + if len(matches[1]) > NameTotalLengthMax { + return nil, ErrNameTooLong + } + + var repo repository + + nameMatch := anchoredNameRegexp.FindStringSubmatch(matches[1]) + if len(nameMatch) == 3 { + repo.domain = nameMatch[1] + repo.path = nameMatch[2] + } else { + repo.domain = "" + repo.path = matches[1] + } + + ref := reference{ + namedRepository: repo, + tag: matches[2], + } + if matches[3] != "" { + var err error + ref.digest, err = digest.Parse(matches[3]) + if err != nil { + return nil, err + } + } + + r := getBestReferenceType(ref) + if r == nil { + return nil, ErrNameEmpty + } + + return r, nil +} + +// ParseNamed parses s and returns a syntactically valid reference implementing +// the Named interface. The reference must have a name and be in the canonical +// form, otherwise an error is returned. +// If an error was encountered it is returned, along with a nil Reference. +// NOTE: ParseNamed will not handle short digests. +func ParseNamed(s string) (Named, error) { + named, err := ParseNormalizedNamed(s) + if err != nil { + return nil, err + } + if named.String() != s { + return nil, ErrNameNotCanonical + } + return named, nil +} + +// WithName returns a named object representing the given string. If the input +// is invalid ErrReferenceInvalidFormat will be returned. +func WithName(name string) (Named, error) { + if len(name) > NameTotalLengthMax { + return nil, ErrNameTooLong + } + + match := anchoredNameRegexp.FindStringSubmatch(name) + if match == nil || len(match) != 3 { + return nil, ErrReferenceInvalidFormat + } + return repository{ + domain: match[1], + path: match[2], + }, nil +} + +// WithTag combines the name from "name" and the tag from "tag" to form a +// reference incorporating both the name and the tag. +func WithTag(name Named, tag string) (NamedTagged, error) { + if !anchoredTagRegexp.MatchString(tag) { + return nil, ErrTagInvalidFormat + } + var repo repository + if r, ok := name.(namedRepository); ok { + repo.domain = r.Domain() + repo.path = r.Path() + } else { + repo.path = name.Name() + } + if canonical, ok := name.(Canonical); ok { + return reference{ + namedRepository: repo, + tag: tag, + digest: canonical.Digest(), + }, nil + } + return taggedReference{ + namedRepository: repo, + tag: tag, + }, nil +} + +// WithDigest combines the name from "name" and the digest from "digest" to form +// a reference incorporating both the name and the digest. +func WithDigest(name Named, digest digest.Digest) (Canonical, error) { + if !anchoredDigestRegexp.MatchString(digest.String()) { + return nil, ErrDigestInvalidFormat + } + var repo repository + if r, ok := name.(namedRepository); ok { + repo.domain = r.Domain() + repo.path = r.Path() + } else { + repo.path = name.Name() + } + if tagged, ok := name.(Tagged); ok { + return reference{ + namedRepository: repo, + tag: tagged.Tag(), + digest: digest, + }, nil + } + return canonicalReference{ + namedRepository: repo, + digest: digest, + }, nil +} + +// TrimNamed removes any tag or digest from the named reference. +func TrimNamed(ref Named) Named { + domain, path := SplitHostname(ref) + return repository{ + domain: domain, + path: path, + } +} + +func getBestReferenceType(ref reference) Reference { + if ref.Name() == "" { + // Allow digest only references + if ref.digest != "" { + return digestReference(ref.digest) + } + return nil + } + if ref.tag == "" { + if ref.digest != "" { + return canonicalReference{ + namedRepository: ref.namedRepository, + digest: ref.digest, + } + } + return ref.namedRepository + } + if ref.digest == "" { + return taggedReference{ + namedRepository: ref.namedRepository, + tag: ref.tag, + } + } + + return ref +} + +type reference struct { + namedRepository + tag string + digest digest.Digest +} + +func (r reference) String() string { + return r.Name() + ":" + r.tag + "@" + r.digest.String() +} + +func (r reference) Tag() string { + return r.tag +} + +func (r reference) Digest() digest.Digest { + return r.digest +} + +type repository struct { + domain string + path string +} + +func (r repository) String() string { + return r.Name() +} + +func (r repository) Name() string { + if r.domain == "" { + return r.path + } + return r.domain + "/" + r.path +} + +func (r repository) Domain() string { + return r.domain +} + +func (r repository) Path() string { + return r.path +} + +type digestReference digest.Digest + +func (d digestReference) String() string { + return digest.Digest(d).String() +} + +func (d digestReference) Digest() digest.Digest { + return digest.Digest(d) +} + +type taggedReference struct { + namedRepository + tag string +} + +func (t taggedReference) String() string { + return t.Name() + ":" + t.tag +} + +func (t taggedReference) Tag() string { + return t.tag +} + +type canonicalReference struct { + namedRepository + digest digest.Digest +} + +func (c canonicalReference) String() string { + return c.Name() + "@" + c.digest.String() +} + +func (c canonicalReference) Digest() digest.Digest { + return c.digest +} + +var ( + // alphaNumericRegexp defines the alpha numeric atom, typically a + // component of names. This only allows lower case characters and digits. + alphaNumericRegexp = match(`[a-z0-9]+`) + + // separatorRegexp defines the separators allowed to be embedded in name + // components. This allow one period, one or two underscore and multiple + // dashes. + separatorRegexp = match(`(?:[._]|__|[-]*)`) + + // nameComponentRegexp restricts registry path component names to start + // with at least one letter or number, with following parts able to be + // separated by one period, one or two underscore and multiple dashes. + nameComponentRegexp = expression( + alphaNumericRegexp, + optional(repeated(separatorRegexp, alphaNumericRegexp))) + + // domainComponentRegexp restricts the registry domain component of a + // repository name to start with a component as defined by DomainRegexp + // and followed by an optional port. + domainComponentRegexp = match(`(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])`) + + // DomainRegexp defines the structure of potential domain components + // that may be part of image names. This is purposely a subset of what is + // allowed by DNS to ensure backwards compatibility with Docker image + // names. + DomainRegexp = expression( + domainComponentRegexp, + optional(repeated(literal(`.`), domainComponentRegexp)), + optional(literal(`:`), match(`[0-9]+`))) + + // TagRegexp matches valid tag names. From docker/docker:graph/tags.go. + TagRegexp = match(`[\w][\w.-]{0,127}`) + + // anchoredTagRegexp matches valid tag names, anchored at the start and + // end of the matched string. + anchoredTagRegexp = anchored(TagRegexp) + + // DigestRegexp matches valid digests. + DigestRegexp = match(`[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][[:xdigit:]]{32,}`) + + // anchoredDigestRegexp matches valid digests, anchored at the start and + // end of the matched string. + anchoredDigestRegexp = anchored(DigestRegexp) + + // NameRegexp is the format for the name component of references. The + // regexp has capturing groups for the domain and name part omitting + // the separating forward slash from either. + NameRegexp = expression( + optional(DomainRegexp, literal(`/`)), + nameComponentRegexp, + optional(repeated(literal(`/`), nameComponentRegexp))) + + // anchoredNameRegexp is used to parse a name value, capturing the + // domain and trailing components. + anchoredNameRegexp = anchored( + optional(capture(DomainRegexp), literal(`/`)), + capture(nameComponentRegexp, + optional(repeated(literal(`/`), nameComponentRegexp)))) + + // ReferenceRegexp is the full supported format of a reference. The regexp + // is anchored and has capturing groups for name, tag, and digest + // components. + ReferenceRegexp = anchored(capture(NameRegexp), + optional(literal(":"), capture(TagRegexp)), + optional(literal("@"), capture(DigestRegexp))) + + // IdentifierRegexp is the format for string identifier used as a + // content addressable identifier using sha256. These identifiers + // are like digests without the algorithm, since sha256 is used. + IdentifierRegexp = match(`([a-f0-9]{64})`) + + // ShortIdentifierRegexp is the format used to represent a prefix + // of an identifier. A prefix may be used to match a sha256 identifier + // within a list of trusted identifiers. + ShortIdentifierRegexp = match(`([a-f0-9]{6,64})`) + + // anchoredIdentifierRegexp is used to check or match an + // identifier value, anchored at start and end of string. + anchoredIdentifierRegexp = anchored(IdentifierRegexp) +) + +// match compiles the string to a regular expression. +var match = regexp.MustCompile + +// literal compiles s into a literal regular expression, escaping any regexp +// reserved characters. +func literal(s string) *regexp.Regexp { + re := match(regexp.QuoteMeta(s)) + + if _, complete := re.LiteralPrefix(); !complete { + panic("must be a literal") + } + + return re +} + +// expression defines a full expression, where each regular expression must +// follow the previous. +func expression(res ...*regexp.Regexp) *regexp.Regexp { + var s string + for _, re := range res { + s += re.String() + } + + return match(s) +} + +// optional wraps the expression in a non-capturing group and makes the +// production optional. +func optional(res ...*regexp.Regexp) *regexp.Regexp { + return match(group(expression(res...)).String() + `?`) +} + +// repeated wraps the regexp in a non-capturing group to get one or more +// matches. +func repeated(res ...*regexp.Regexp) *regexp.Regexp { + return match(group(expression(res...)).String() + `+`) +} + +// group wraps the regexp in a non-capturing group. +func group(res ...*regexp.Regexp) *regexp.Regexp { + return match(`(?:` + expression(res...).String() + `)`) +} + +// capture wraps the expression in a capturing group. +func capture(res ...*regexp.Regexp) *regexp.Regexp { + return match(`(` + expression(res...).String() + `)`) +} + +// anchored anchors the regular expression by adding start and end delimiters. +func anchored(res ...*regexp.Regexp) *regexp.Regexp { + return match(`^` + expression(res...).String() + `$`) +} + +var ( + legacyDefaultDomain = "index.docker.io" + defaultDomain = "docker.io" + officialRepoName = "library" + defaultTag = "latest" +) + +// normalizedNamed represents a name which has been +// normalized and has a familiar form. A familiar name +// is what is used in Docker UI. An example normalized +// name is "docker.io/library/ubuntu" and corresponding +// familiar name of "ubuntu". +type normalizedNamed interface { + Named + Familiar() Named +} + +// ParseNormalizedNamed parses a string into a named reference +// transforming a familiar name from Docker UI to a fully +// qualified reference. If the value may be an identifier +// use ParseAnyReference. +func ParseNormalizedNamed(s string) (Named, error) { + if ok := anchoredIdentifierRegexp.MatchString(s); ok { + return nil, fmt.Errorf("invalid repository name (%s), cannot specify 64-byte hexadecimal strings", s) + } + domain, remainder := splitDockerDomain(s) + var remoteName string + if tagSep := strings.IndexRune(remainder, ':'); tagSep > -1 { + remoteName = remainder[:tagSep] + } else { + remoteName = remainder + } + if strings.ToLower(remoteName) != remoteName { + return nil, errors.New("invalid reference format: repository name must be lowercase") + } + + ref, err := Parse(domain + "/" + remainder) + if err != nil { + return nil, err + } + named, isNamed := ref.(Named) + if !isNamed { + return nil, fmt.Errorf("reference %s has no name", ref.String()) + } + return named, nil +} + +// ParseDockerRef normalizes the image reference following the docker convention. This is added +// mainly for backward compatibility. +// The reference returned can only be either tagged or digested. For reference contains both tag +// and digest, the function returns digested reference, e.g. docker.io/library/busybox:latest@ +// sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa will be returned as +// docker.io/library/busybox@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa. +func ParseDockerRef(ref string) (Named, error) { + named, err := ParseNormalizedNamed(ref) + if err != nil { + return nil, err + } + if _, ok := named.(NamedTagged); ok { + if canonical, ok := named.(Canonical); ok { + // The reference is both tagged and digested, only + // return digested. + newNamed, err := WithName(canonical.Name()) + if err != nil { + return nil, err + } + newCanonical, err := WithDigest(newNamed, canonical.Digest()) + if err != nil { + return nil, err + } + return newCanonical, nil + } + } + return TagNameOnly(named), nil +} + +// splitDockerDomain splits a repository name to domain and remotename string. +// If no valid domain is found, the default domain is used. Repository name +// needs to be already validated before. +func splitDockerDomain(name string) (domain, remainder string) { + i := strings.IndexRune(name, '/') + if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != "localhost") { + domain, remainder = defaultDomain, name + } else { + domain, remainder = name[:i], name[i+1:] + } + if domain == legacyDefaultDomain { + domain = defaultDomain + } + if domain == defaultDomain && !strings.ContainsRune(remainder, '/') { + remainder = officialRepoName + "/" + remainder + } + return +} + +// familiarizeName returns a shortened version of the name familiar +// to to the Docker UI. Familiar names have the default domain +// "docker.io" and "library/" repository prefix removed. +// For example, "docker.io/library/redis" will have the familiar +// name "redis" and "docker.io/dmcgowan/myapp" will be "dmcgowan/myapp". +// Returns a familiarized named only reference. +func familiarizeName(named namedRepository) repository { + repo := repository{ + domain: named.Domain(), + path: named.Path(), + } + + if repo.domain == defaultDomain { + repo.domain = "" + // Handle official repositories which have the pattern "library/" + if split := strings.Split(repo.path, "/"); len(split) == 2 && split[0] == officialRepoName { + repo.path = split[1] + } + } + return repo +} + +func (r reference) Familiar() Named { + return reference{ + namedRepository: familiarizeName(r.namedRepository), + tag: r.tag, + digest: r.digest, + } +} + +func (r repository) Familiar() Named { + return familiarizeName(r) +} + +func (t taggedReference) Familiar() Named { + return taggedReference{ + namedRepository: familiarizeName(t.namedRepository), + tag: t.tag, + } +} + +func (c canonicalReference) Familiar() Named { + return canonicalReference{ + namedRepository: familiarizeName(c.namedRepository), + digest: c.digest, + } +} + +// TagNameOnly adds the default tag "latest" to a reference if it only has +// a repo name. +func TagNameOnly(ref Named) Named { + if IsNameOnly(ref) { + namedTagged, err := WithTag(ref, defaultTag) + if err != nil { + // Default tag must be valid, to create a NamedTagged + // type with non-validated input the WithTag function + // should be used instead + panic(err) + } + return namedTagged + } + return ref +} + +// ParseAnyReference parses a reference string as a possible identifier, +// full digest, or familiar name. +func ParseAnyReference(ref string) (Reference, error) { + if ok := anchoredIdentifierRegexp.MatchString(ref); ok { + return digestReference("sha256:" + ref), nil + } + if dgst, err := digest.Parse(ref); err == nil { + return digestReference(dgst), nil + } + + return ParseNormalizedNamed(ref) +} + +// IsNameOnly returns true if reference only contains a repo name. +func IsNameOnly(ref Named) bool { + if _, ok := ref.(NamedTagged); ok { + return false + } + if _, ok := ref.(Canonical); ok { + return false + } + return true +} + +// FamiliarName returns the familiar name string +// for the given named, familiarizing if needed. +func FamiliarName(ref Named) string { + if nn, ok := ref.(normalizedNamed); ok { + return nn.Familiar().Name() + } + return ref.Name() +} + +// FamiliarString returns the familiar string representation +// for the given reference, familiarizing if needed. +func FamiliarString(ref Reference) string { + if nn, ok := ref.(normalizedNamed); ok { + return nn.Familiar().String() + } + return ref.String() +} + +// FamiliarMatch reports whether ref matches the specified pattern. +// See https://godoc.org/path#Match for supported patterns. +func FamiliarMatch(pattern string, ref Reference) (bool, error) { + matched, err := path.Match(pattern, FamiliarString(ref)) + if namedRef, isNamed := ref.(Named); isNamed && !matched { + matched, _ = path.Match(pattern, FamiliarName(namedRef)) + } + return matched, err +} diff --git a/integration-test/vendor/github.com/containerd/containerd/reference/reference.go b/integration-test/vendor/github.com/containerd/containerd/reference/reference.go new file mode 100644 index 000000000..a4bf6da60 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/reference/reference.go @@ -0,0 +1,166 @@ +/* + Copyright The containerd Authors. + + 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 reference + +import ( + "errors" + "fmt" + "net/url" + "path" + "regexp" + "strings" + + digest "github.com/opencontainers/go-digest" +) + +var ( + // ErrInvalid is returned when there is an invalid reference + ErrInvalid = errors.New("invalid reference") + // ErrObjectRequired is returned when the object is required + ErrObjectRequired = errors.New("object required") + // ErrHostnameRequired is returned when the hostname is required + ErrHostnameRequired = errors.New("hostname required") +) + +// Spec defines the main components of a reference specification. +// +// A reference specification is a schema-less URI parsed into common +// components. The two main components, locator and object, are required to be +// supported by remotes. It represents a superset of the naming define in +// docker's reference schema. It aims to be compatible but not prescriptive. +// +// While the interpretation of the components, locator and object, are up to +// the remote, we define a few common parts, accessible via helper methods. +// +// The first is the hostname, which is part of the locator. This doesn't need +// to map to a physical resource, but it must parse as a hostname. We refer to +// this as the namespace. +// +// The other component made accessible by helper method is the digest. This is +// part of the object identifier, always prefixed with an '@'. If present, the +// remote may use the digest portion directly or resolve it against a prefix. +// If the object does not include the `@` symbol, the return value for `Digest` +// will be empty. +type Spec struct { + // Locator is the host and path portion of the specification. The host + // portion may refer to an actual host or just a namespace of related + // images. + // + // Typically, the locator may used to resolve the remote to fetch specific + // resources. + Locator string + + // Object contains the identifier for the remote resource. Classically, + // this is a tag but can refer to anything in a remote. By convention, any + // portion that may be a partial or whole digest will be preceded by an + // `@`. Anything preceding the `@` will be referred to as the "tag". + // + // In practice, we will see this broken down into the following formats: + // + // 1. + // 2. @ + // 3. @ + // + // We define the tag to be anything except '@' and ':'. may + // be a full valid digest or shortened version, possibly with elided + // algorithm. + Object string +} + +var splitRe = regexp.MustCompile(`[:@]`) + +// Parse parses the string into a structured ref. +func Parse(s string) (Spec, error) { + if strings.Contains(s, "://") { + return Spec{}, ErrInvalid + } + + u, err := url.Parse("dummy://" + s) + if err != nil { + return Spec{}, err + } + + if u.Scheme != "dummy" { + return Spec{}, ErrInvalid + } + + if u.Host == "" { + return Spec{}, ErrHostnameRequired + } + + var object string + + if idx := splitRe.FindStringIndex(u.Path); idx != nil { + // This allows us to retain the @ to signify digests or shortened digests in + // the object. + object = u.Path[idx[0]:] + if object[:1] == ":" { + object = object[1:] + } + u.Path = u.Path[:idx[0]] + } + + return Spec{ + Locator: path.Join(u.Host, u.Path), + Object: object, + }, nil +} + +// Hostname returns the hostname portion of the locator. +// +// Remotes are not required to directly access the resources at this host. This +// method is provided for convenience. +func (r Spec) Hostname() string { + i := strings.Index(r.Locator, "/") + + if i < 0 { + return r.Locator + } + return r.Locator[:i] +} + +// Digest returns the digest portion of the reference spec. This may be a +// partial or invalid digest, which may be used to lookup a complete digest. +func (r Spec) Digest() digest.Digest { + _, dgst := SplitObject(r.Object) + return dgst +} + +// String returns the normalized string for the ref. +func (r Spec) String() string { + if r.Object == "" { + return r.Locator + } + if r.Object[:1] == "@" { + return fmt.Sprintf("%v%v", r.Locator, r.Object) + } + + return fmt.Sprintf("%v:%v", r.Locator, r.Object) +} + +// SplitObject provides two parts of the object spec, delimited by an `@` +// symbol. +// +// Either may be empty and it is the callers job to validate them +// appropriately. +func SplitObject(obj string) (tag string, dgst digest.Digest) { + parts := strings.SplitAfterN(obj, "@", 2) + if len(parts) < 2 { + return parts[0], "" + } + return parts[0], digest.Digest(parts[1]) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/auth/fetch.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/auth/fetch.go new file mode 100644 index 000000000..8b0a87e75 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/auth/fetch.go @@ -0,0 +1,209 @@ +/* + Copyright The containerd Authors. + + 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 + +import ( + "context" + "encoding/json" + "net/http" + "net/url" + "strings" + "time" + + "github.com/containerd/containerd/log" + remoteserrors "github.com/containerd/containerd/remotes/errors" + "github.com/containerd/containerd/version" + "github.com/pkg/errors" + "golang.org/x/net/context/ctxhttp" +) + +var ( + // ErrNoToken is returned if a request is successful but the body does not + // contain an authorization token. + ErrNoToken = errors.New("authorization server did not include a token in the response") +) + +// GenerateTokenOptions generates options for fetching a token based on a challenge +func GenerateTokenOptions(ctx context.Context, host, username, secret string, c Challenge) (TokenOptions, error) { + realm, ok := c.Parameters["realm"] + if !ok { + return TokenOptions{}, errors.New("no realm specified for token auth challenge") + } + + realmURL, err := url.Parse(realm) + if err != nil { + return TokenOptions{}, errors.Wrap(err, "invalid token auth challenge realm") + } + + to := TokenOptions{ + Realm: realmURL.String(), + Service: c.Parameters["service"], + Username: username, + Secret: secret, + } + + scope, ok := c.Parameters["scope"] + if ok { + to.Scopes = append(to.Scopes, scope) + } else { + log.G(ctx).WithField("host", host).Debug("no scope specified for token auth challenge") + } + + return to, nil +} + +// TokenOptions are options for requesting a token +type TokenOptions struct { + Realm string + Service string + Scopes []string + Username string + Secret string +} + +// OAuthTokenResponse is response from fetching token with a OAuth POST request +type OAuthTokenResponse struct { + AccessToken string `json:"access_token"` + RefreshToken string `json:"refresh_token"` + ExpiresIn int `json:"expires_in"` + IssuedAt time.Time `json:"issued_at"` + Scope string `json:"scope"` +} + +// FetchTokenWithOAuth fetches a token using a POST request +func FetchTokenWithOAuth(ctx context.Context, client *http.Client, headers http.Header, clientID string, to TokenOptions) (*OAuthTokenResponse, error) { + form := url.Values{} + if len(to.Scopes) > 0 { + form.Set("scope", strings.Join(to.Scopes, " ")) + } + form.Set("service", to.Service) + form.Set("client_id", clientID) + + if to.Username == "" { + form.Set("grant_type", "refresh_token") + form.Set("refresh_token", to.Secret) + } else { + form.Set("grant_type", "password") + form.Set("username", to.Username) + form.Set("password", to.Secret) + } + + req, err := http.NewRequest("POST", to.Realm, strings.NewReader(form.Encode())) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") + for k, v := range headers { + req.Header[k] = append(req.Header[k], v...) + } + if len(req.Header.Get("User-Agent")) == 0 { + req.Header.Set("User-Agent", "containerd/"+version.Version) + } + + resp, err := ctxhttp.Do(ctx, client, req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + if resp.StatusCode < 200 || resp.StatusCode >= 400 { + return nil, errors.WithStack(remoteserrors.NewUnexpectedStatusErr(resp)) + } + + decoder := json.NewDecoder(resp.Body) + + var tr OAuthTokenResponse + if err = decoder.Decode(&tr); err != nil { + return nil, errors.Wrap(err, "unable to decode token response") + } + + if tr.AccessToken == "" { + return nil, errors.WithStack(ErrNoToken) + } + + return &tr, nil +} + +// FetchTokenResponse is response from fetching token with GET request +type FetchTokenResponse struct { + Token string `json:"token"` + AccessToken string `json:"access_token"` + ExpiresIn int `json:"expires_in"` + IssuedAt time.Time `json:"issued_at"` + RefreshToken string `json:"refresh_token"` +} + +// FetchToken fetches a token using a GET request +func FetchToken(ctx context.Context, client *http.Client, headers http.Header, to TokenOptions) (*FetchTokenResponse, error) { + req, err := http.NewRequest("GET", to.Realm, nil) + if err != nil { + return nil, err + } + + for k, v := range headers { + req.Header[k] = append(req.Header[k], v...) + } + if len(req.Header.Get("User-Agent")) == 0 { + req.Header.Set("User-Agent", "containerd/"+version.Version) + } + + reqParams := req.URL.Query() + + if to.Service != "" { + reqParams.Add("service", to.Service) + } + + for _, scope := range to.Scopes { + reqParams.Add("scope", scope) + } + + if to.Secret != "" { + req.SetBasicAuth(to.Username, to.Secret) + } + + req.URL.RawQuery = reqParams.Encode() + + resp, err := ctxhttp.Do(ctx, client, req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + if resp.StatusCode < 200 || resp.StatusCode >= 400 { + return nil, errors.WithStack(remoteserrors.NewUnexpectedStatusErr(resp)) + } + + decoder := json.NewDecoder(resp.Body) + + var tr FetchTokenResponse + if err = decoder.Decode(&tr); err != nil { + return nil, errors.Wrap(err, "unable to decode token response") + } + + // `access_token` is equivalent to `token` and if both are specified + // the choice is undefined. Canonicalize `access_token` by sticking + // things in `token`. + if tr.AccessToken != "" { + tr.Token = tr.AccessToken + } + + if tr.Token == "" { + return nil, errors.WithStack(ErrNoToken) + } + + return &tr, nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/auth/parse.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/auth/parse.go new file mode 100644 index 000000000..223fa2d05 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/auth/parse.go @@ -0,0 +1,203 @@ +/* + Copyright The containerd Authors. + + 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 + +import ( + "net/http" + "sort" + "strings" +) + +// AuthenticationScheme defines scheme of the authentication method +type AuthenticationScheme byte + +const ( + // BasicAuth is scheme for Basic HTTP Authentication RFC 7617 + BasicAuth AuthenticationScheme = 1 << iota + // DigestAuth is scheme for HTTP Digest Access Authentication RFC 7616 + DigestAuth + // BearerAuth is scheme for OAuth 2.0 Bearer Tokens RFC 6750 + BearerAuth +) + +// Challenge carries information from a WWW-Authenticate response header. +// See RFC 2617. +type Challenge struct { + // scheme is the auth-scheme according to RFC 2617 + Scheme AuthenticationScheme + + // parameters are the auth-params according to RFC 2617 + Parameters map[string]string +} + +type byScheme []Challenge + +func (bs byScheme) Len() int { return len(bs) } +func (bs byScheme) Swap(i, j int) { bs[i], bs[j] = bs[j], bs[i] } + +// Sort in priority order: token > digest > basic +func (bs byScheme) Less(i, j int) bool { return bs[i].Scheme > bs[j].Scheme } + +// Octet types from RFC 2616. +type octetType byte + +var octetTypes [256]octetType + +const ( + isToken octetType = 1 << iota + isSpace +) + +func init() { + // OCTET = + // CHAR = + // CTL = + // CR = + // LF = + // SP = + // HT = + // <"> = + // CRLF = CR LF + // LWS = [CRLF] 1*( SP | HT ) + // TEXT = + // separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> + // | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT + // token = 1* + // qdtext = > + + for c := 0; c < 256; c++ { + var t octetType + isCtl := c <= 31 || c == 127 + isChar := 0 <= c && c <= 127 + isSeparator := strings.ContainsRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) + if strings.ContainsRune(" \t\r\n", rune(c)) { + t |= isSpace + } + if isChar && !isCtl && !isSeparator { + t |= isToken + } + octetTypes[c] = t + } +} + +// ParseAuthHeader parses challenges from WWW-Authenticate header +func ParseAuthHeader(header http.Header) []Challenge { + challenges := []Challenge{} + for _, h := range header[http.CanonicalHeaderKey("WWW-Authenticate")] { + v, p := parseValueAndParams(h) + var s AuthenticationScheme + switch v { + case "basic": + s = BasicAuth + case "digest": + s = DigestAuth + case "bearer": + s = BearerAuth + default: + continue + } + challenges = append(challenges, Challenge{Scheme: s, Parameters: p}) + } + sort.Stable(byScheme(challenges)) + return challenges +} + +func parseValueAndParams(header string) (value string, params map[string]string) { + params = make(map[string]string) + value, s := expectToken(header) + if value == "" { + return + } + value = strings.ToLower(value) + for { + var pkey string + pkey, s = expectToken(skipSpace(s)) + if pkey == "" { + return + } + if !strings.HasPrefix(s, "=") { + return + } + var pvalue string + pvalue, s = expectTokenOrQuoted(s[1:]) + if pvalue == "" { + return + } + pkey = strings.ToLower(pkey) + params[pkey] = pvalue + s = skipSpace(s) + if !strings.HasPrefix(s, ",") { + return + } + s = s[1:] + } +} + +func skipSpace(s string) (rest string) { + i := 0 + for ; i < len(s); i++ { + if octetTypes[s[i]]&isSpace == 0 { + break + } + } + return s[i:] +} + +func expectToken(s string) (token, rest string) { + i := 0 + for ; i < len(s); i++ { + if octetTypes[s[i]]&isToken == 0 { + break + } + } + return s[:i], s[i:] +} + +func expectTokenOrQuoted(s string) (value string, rest string) { + if !strings.HasPrefix(s, "\"") { + return expectToken(s) + } + s = s[1:] + for i := 0; i < len(s); i++ { + switch s[i] { + case '"': + return s[:i], s[i+1:] + case '\\': + p := make([]byte, len(s)-1) + j := copy(p, s[:i]) + escape := true + for i = i + 1; i < len(s); i++ { + b := s[i] + switch { + case escape: + escape = false + p[j] = b + j++ + case b == '\\': + escape = true + case b == '"': + return string(p[:j]), s[i+1:] + default: + p[j] = b + j++ + } + } + return "", "" + } + } + return "", "" +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/authorizer.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/authorizer.go new file mode 100644 index 000000000..67e4aea8d --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/authorizer.go @@ -0,0 +1,333 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "context" + "encoding/base64" + "fmt" + "net/http" + "strings" + "sync" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/remotes/docker/auth" + remoteerrors "github.com/containerd/containerd/remotes/errors" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" +) + +type dockerAuthorizer struct { + credentials func(string) (string, string, error) + + client *http.Client + header http.Header + mu sync.Mutex + + // indexed by host name + handlers map[string]*authHandler +} + +// NewAuthorizer creates a Docker authorizer using the provided function to +// get credentials for the token server or basic auth. +// Deprecated: Use NewDockerAuthorizer +func NewAuthorizer(client *http.Client, f func(string) (string, string, error)) Authorizer { + return NewDockerAuthorizer(WithAuthClient(client), WithAuthCreds(f)) +} + +type authorizerConfig struct { + credentials func(string) (string, string, error) + client *http.Client + header http.Header +} + +// AuthorizerOpt configures an authorizer +type AuthorizerOpt func(*authorizerConfig) + +// WithAuthClient provides the HTTP client for the authorizer +func WithAuthClient(client *http.Client) AuthorizerOpt { + return func(opt *authorizerConfig) { + opt.client = client + } +} + +// WithAuthCreds provides a credential function to the authorizer +func WithAuthCreds(creds func(string) (string, string, error)) AuthorizerOpt { + return func(opt *authorizerConfig) { + opt.credentials = creds + } +} + +// WithAuthHeader provides HTTP headers for authorization +func WithAuthHeader(hdr http.Header) AuthorizerOpt { + return func(opt *authorizerConfig) { + opt.header = hdr + } +} + +// NewDockerAuthorizer creates an authorizer using Docker's registry +// authentication spec. +// See https://docs.docker.com/registry/spec/auth/ +func NewDockerAuthorizer(opts ...AuthorizerOpt) Authorizer { + var ao authorizerConfig + for _, opt := range opts { + opt(&ao) + } + + if ao.client == nil { + ao.client = http.DefaultClient + } + + return &dockerAuthorizer{ + credentials: ao.credentials, + client: ao.client, + header: ao.header, + handlers: make(map[string]*authHandler), + } +} + +// Authorize handles auth request. +func (a *dockerAuthorizer) Authorize(ctx context.Context, req *http.Request) error { + // skip if there is no auth handler + ah := a.getAuthHandler(req.URL.Host) + if ah == nil { + return nil + } + + auth, err := ah.authorize(ctx) + if err != nil { + return err + } + + req.Header.Set("Authorization", auth) + return nil +} + +func (a *dockerAuthorizer) getAuthHandler(host string) *authHandler { + a.mu.Lock() + defer a.mu.Unlock() + + return a.handlers[host] +} + +func (a *dockerAuthorizer) AddResponses(ctx context.Context, responses []*http.Response) error { + last := responses[len(responses)-1] + host := last.Request.URL.Host + + a.mu.Lock() + defer a.mu.Unlock() + for _, c := range auth.ParseAuthHeader(last.Header) { + if c.Scheme == auth.BearerAuth { + if err := invalidAuthorization(c, responses); err != nil { + delete(a.handlers, host) + return err + } + + // reuse existing handler + // + // assume that one registry will return the common + // challenge information, including realm and service. + // and the resource scope is only different part + // which can be provided by each request. + if _, ok := a.handlers[host]; ok { + return nil + } + + var username, secret string + if a.credentials != nil { + var err error + username, secret, err = a.credentials(host) + if err != nil { + return err + } + } + + common, err := auth.GenerateTokenOptions(ctx, host, username, secret, c) + if err != nil { + return err + } + + a.handlers[host] = newAuthHandler(a.client, a.header, c.Scheme, common) + return nil + } else if c.Scheme == auth.BasicAuth && a.credentials != nil { + username, secret, err := a.credentials(host) + if err != nil { + return err + } + + if username != "" && secret != "" { + common := auth.TokenOptions{ + Username: username, + Secret: secret, + } + + a.handlers[host] = newAuthHandler(a.client, a.header, c.Scheme, common) + return nil + } + } + } + return errors.Wrap(errdefs.ErrNotImplemented, "failed to find supported auth scheme") +} + +// authResult is used to control limit rate. +type authResult struct { + sync.WaitGroup + token string + err error +} + +// authHandler is used to handle auth request per registry server. +type authHandler struct { + sync.Mutex + + header http.Header + + client *http.Client + + // only support basic and bearer schemes + scheme auth.AuthenticationScheme + + // common contains common challenge answer + common auth.TokenOptions + + // scopedTokens caches token indexed by scopes, which used in + // bearer auth case + scopedTokens map[string]*authResult +} + +func newAuthHandler(client *http.Client, hdr http.Header, scheme auth.AuthenticationScheme, opts auth.TokenOptions) *authHandler { + return &authHandler{ + header: hdr, + client: client, + scheme: scheme, + common: opts, + scopedTokens: map[string]*authResult{}, + } +} + +func (ah *authHandler) authorize(ctx context.Context) (string, error) { + switch ah.scheme { + case auth.BasicAuth: + return ah.doBasicAuth(ctx) + case auth.BearerAuth: + return ah.doBearerAuth(ctx) + default: + return "", errors.Wrapf(errdefs.ErrNotImplemented, "failed to find supported auth scheme: %s", string(ah.scheme)) + } +} + +func (ah *authHandler) doBasicAuth(ctx context.Context) (string, error) { + username, secret := ah.common.Username, ah.common.Secret + + if username == "" || secret == "" { + return "", fmt.Errorf("failed to handle basic auth because missing username or secret") + } + + auth := base64.StdEncoding.EncodeToString([]byte(username + ":" + secret)) + return fmt.Sprintf("Basic %s", auth), nil +} + +func (ah *authHandler) doBearerAuth(ctx context.Context) (token string, err error) { + // copy common tokenOptions + to := ah.common + + to.Scopes = GetTokenScopes(ctx, to.Scopes) + + // Docs: https://docs.docker.com/registry/spec/auth/scope + scoped := strings.Join(to.Scopes, " ") + + ah.Lock() + if r, exist := ah.scopedTokens[scoped]; exist { + ah.Unlock() + r.Wait() + return r.token, r.err + } + + // only one fetch token job + r := new(authResult) + r.Add(1) + ah.scopedTokens[scoped] = r + ah.Unlock() + + defer func() { + token = fmt.Sprintf("Bearer %s", token) + r.token, r.err = token, err + r.Done() + }() + + // fetch token for the resource scope + if to.Secret != "" { + defer func() { + err = errors.Wrap(err, "failed to fetch oauth token") + }() + // credential information is provided, use oauth POST endpoint + // TODO: Allow setting client_id + resp, err := auth.FetchTokenWithOAuth(ctx, ah.client, ah.header, "containerd-client", to) + if err != nil { + var errStatus remoteerrors.ErrUnexpectedStatus + if errors.As(err, &errStatus) { + // Registries without support for POST may return 404 for POST /v2/token. + // As of September 2017, GCR is known to return 404. + // As of February 2018, JFrog Artifactory is known to return 401. + if (errStatus.StatusCode == 405 && to.Username != "") || errStatus.StatusCode == 404 || errStatus.StatusCode == 401 { + resp, err := auth.FetchToken(ctx, ah.client, ah.header, to) + if err != nil { + return "", err + } + return resp.Token, nil + } + log.G(ctx).WithFields(logrus.Fields{ + "status": errStatus.Status, + "body": string(errStatus.Body), + }).Debugf("token request failed") + } + return "", err + } + return resp.AccessToken, nil + } + // do request anonymously + resp, err := auth.FetchToken(ctx, ah.client, ah.header, to) + if err != nil { + return "", errors.Wrap(err, "failed to fetch anonymous token") + } + return resp.Token, nil +} + +func invalidAuthorization(c auth.Challenge, responses []*http.Response) error { + errStr := c.Parameters["error"] + if errStr == "" { + return nil + } + + n := len(responses) + if n == 1 || (n > 1 && !sameRequest(responses[n-2].Request, responses[n-1].Request)) { + return nil + } + + return errors.Wrapf(ErrInvalidAuthorization, "server message: %s", errStr) +} + +func sameRequest(r1, r2 *http.Request) bool { + if r1.Method != r2.Method { + return false + } + if *r1.URL != *r2.URL { + return false + } + return true +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/converter.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/converter.go new file mode 100644 index 000000000..43e6b372c --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/converter.go @@ -0,0 +1,88 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/remotes" + digest "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +// LegacyConfigMediaType should be replaced by OCI image spec. +// +// More detail: docker/distribution#1622 +const LegacyConfigMediaType = "application/octet-stream" + +// ConvertManifest changes application/octet-stream to schema2 config media type if need. +// +// NOTE: +// 1. original manifest will be deleted by next gc round. +// 2. don't cover manifest list. +func ConvertManifest(ctx context.Context, store content.Store, desc ocispec.Descriptor) (ocispec.Descriptor, error) { + if !(desc.MediaType == images.MediaTypeDockerSchema2Manifest || + desc.MediaType == ocispec.MediaTypeImageManifest) { + + log.G(ctx).Warnf("do nothing for media type: %s", desc.MediaType) + return desc, nil + } + + // read manifest data + mb, err := content.ReadBlob(ctx, store, desc) + if err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to read index data") + } + + var manifest ocispec.Manifest + if err := json.Unmarshal(mb, &manifest); err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to unmarshal data into manifest") + } + + // check config media type + if manifest.Config.MediaType != LegacyConfigMediaType { + return desc, nil + } + + manifest.Config.MediaType = images.MediaTypeDockerSchema2Config + data, err := json.MarshalIndent(manifest, "", " ") + if err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to marshal manifest") + } + + // update manifest with gc labels + desc.Digest = digest.Canonical.FromBytes(data) + desc.Size = int64(len(data)) + + labels := map[string]string{} + for i, c := range append([]ocispec.Descriptor{manifest.Config}, manifest.Layers...) { + labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i)] = c.Digest.String() + } + + ref := remotes.MakeRefKey(ctx, desc) + if err := content.WriteBlob(ctx, store, ref, bytes.NewReader(data), desc, content.WithLabels(labels)); err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to update content") + } + return desc, nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/errcode.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/errcode.go new file mode 100644 index 000000000..8c623bcbe --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/errcode.go @@ -0,0 +1,283 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "encoding/json" + "fmt" + "strings" +) + +// ErrorCoder is the base interface for ErrorCode and Error allowing +// users of each to just call ErrorCode to get the real ID of each +type ErrorCoder interface { + ErrorCode() ErrorCode +} + +// ErrorCode represents the error type. The errors are serialized via strings +// and the integer format may change and should *never* be exported. +type ErrorCode int + +var _ error = ErrorCode(0) + +// ErrorCode just returns itself +func (ec ErrorCode) ErrorCode() ErrorCode { + return ec +} + +// Error returns the ID/Value +func (ec ErrorCode) Error() string { + // NOTE(stevvooe): Cannot use message here since it may have unpopulated args. + return strings.ToLower(strings.Replace(ec.String(), "_", " ", -1)) +} + +// Descriptor returns the descriptor for the error code. +func (ec ErrorCode) Descriptor() ErrorDescriptor { + d, ok := errorCodeToDescriptors[ec] + + if !ok { + return ErrorCodeUnknown.Descriptor() + } + + return d +} + +// String returns the canonical identifier for this error code. +func (ec ErrorCode) String() string { + return ec.Descriptor().Value +} + +// Message returned the human-readable error message for this error code. +func (ec ErrorCode) Message() string { + return ec.Descriptor().Message +} + +// MarshalText encodes the receiver into UTF-8-encoded text and returns the +// result. +func (ec ErrorCode) MarshalText() (text []byte, err error) { + return []byte(ec.String()), nil +} + +// UnmarshalText decodes the form generated by MarshalText. +func (ec *ErrorCode) UnmarshalText(text []byte) error { + desc, ok := idToDescriptors[string(text)] + + if !ok { + desc = ErrorCodeUnknown.Descriptor() + } + + *ec = desc.Code + + return nil +} + +// WithMessage creates a new Error struct based on the passed-in info and +// overrides the Message property. +func (ec ErrorCode) WithMessage(message string) Error { + return Error{ + Code: ec, + Message: message, + } +} + +// WithDetail creates a new Error struct based on the passed-in info and +// set the Detail property appropriately +func (ec ErrorCode) WithDetail(detail interface{}) Error { + return Error{ + Code: ec, + Message: ec.Message(), + }.WithDetail(detail) +} + +// WithArgs creates a new Error struct and sets the Args slice +func (ec ErrorCode) WithArgs(args ...interface{}) Error { + return Error{ + Code: ec, + Message: ec.Message(), + }.WithArgs(args...) +} + +// Error provides a wrapper around ErrorCode with extra Details provided. +type Error struct { + Code ErrorCode `json:"code"` + Message string `json:"message"` + Detail interface{} `json:"detail,omitempty"` + + // TODO(duglin): See if we need an "args" property so we can do the + // variable substitution right before showing the message to the user +} + +var _ error = Error{} + +// ErrorCode returns the ID/Value of this Error +func (e Error) ErrorCode() ErrorCode { + return e.Code +} + +// Error returns a human readable representation of the error. +func (e Error) Error() string { + return fmt.Sprintf("%s: %s", e.Code.Error(), e.Message) +} + +// WithDetail will return a new Error, based on the current one, but with +// some Detail info added +func (e Error) WithDetail(detail interface{}) Error { + return Error{ + Code: e.Code, + Message: e.Message, + Detail: detail, + } +} + +// WithArgs uses the passed-in list of interface{} as the substitution +// variables in the Error's Message string, but returns a new Error +func (e Error) WithArgs(args ...interface{}) Error { + return Error{ + Code: e.Code, + Message: fmt.Sprintf(e.Code.Message(), args...), + Detail: e.Detail, + } +} + +// ErrorDescriptor provides relevant information about a given error code. +type ErrorDescriptor struct { + // Code is the error code that this descriptor describes. + Code ErrorCode + + // Value provides a unique, string key, often captilized with + // underscores, to identify the error code. This value is used as the + // keyed value when serializing api errors. + Value string + + // Message is a short, human readable description of the error condition + // included in API responses. + Message string + + // Description provides a complete account of the errors purpose, suitable + // for use in documentation. + Description string + + // HTTPStatusCode provides the http status code that is associated with + // this error condition. + HTTPStatusCode int +} + +// ParseErrorCode returns the value by the string error code. +// `ErrorCodeUnknown` will be returned if the error is not known. +func ParseErrorCode(value string) ErrorCode { + ed, ok := idToDescriptors[value] + if ok { + return ed.Code + } + + return ErrorCodeUnknown +} + +// Errors provides the envelope for multiple errors and a few sugar methods +// for use within the application. +type Errors []error + +var _ error = Errors{} + +func (errs Errors) Error() string { + switch len(errs) { + case 0: + return "" + case 1: + return errs[0].Error() + default: + msg := "errors:\n" + for _, err := range errs { + msg += err.Error() + "\n" + } + return msg + } +} + +// Len returns the current number of errors. +func (errs Errors) Len() int { + return len(errs) +} + +// MarshalJSON converts slice of error, ErrorCode or Error into a +// slice of Error - then serializes +func (errs Errors) MarshalJSON() ([]byte, error) { + var tmpErrs struct { + Errors []Error `json:"errors,omitempty"` + } + + for _, daErr := range errs { + var err Error + + switch daErr := daErr.(type) { + case ErrorCode: + err = daErr.WithDetail(nil) + case Error: + err = daErr + default: + err = ErrorCodeUnknown.WithDetail(daErr) + + } + + // If the Error struct was setup and they forgot to set the + // Message field (meaning its "") then grab it from the ErrCode + msg := err.Message + if msg == "" { + msg = err.Code.Message() + } + + tmpErrs.Errors = append(tmpErrs.Errors, Error{ + Code: err.Code, + Message: msg, + Detail: err.Detail, + }) + } + + return json.Marshal(tmpErrs) +} + +// UnmarshalJSON deserializes []Error and then converts it into slice of +// Error or ErrorCode +func (errs *Errors) UnmarshalJSON(data []byte) error { + var tmpErrs struct { + Errors []Error + } + + if err := json.Unmarshal(data, &tmpErrs); err != nil { + return err + } + + var newErrs Errors + for _, daErr := range tmpErrs.Errors { + // If Message is empty or exactly matches the Code's message string + // then just use the Code, no need for a full Error struct + if daErr.Detail == nil && (daErr.Message == "" || daErr.Message == daErr.Code.Message()) { + // Error's w/o details get converted to ErrorCode + newErrs = append(newErrs, daErr.Code) + } else { + // Error's w/ details are untouched + newErrs = append(newErrs, Error{ + Code: daErr.Code, + Message: daErr.Message, + Detail: daErr.Detail, + }) + } + } + + *errs = newErrs + return nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/errdesc.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/errdesc.go new file mode 100644 index 000000000..b2bd4d82b --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/errdesc.go @@ -0,0 +1,154 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "fmt" + "net/http" + "sort" + "sync" +) + +var ( + errorCodeToDescriptors = map[ErrorCode]ErrorDescriptor{} + idToDescriptors = map[string]ErrorDescriptor{} + groupToDescriptors = map[string][]ErrorDescriptor{} +) + +var ( + // ErrorCodeUnknown is a generic error that can be used as a last + // resort if there is no situation-specific error message that can be used + ErrorCodeUnknown = Register("errcode", ErrorDescriptor{ + Value: "UNKNOWN", + Message: "unknown error", + Description: `Generic error returned when the error does not have an + API classification.`, + HTTPStatusCode: http.StatusInternalServerError, + }) + + // ErrorCodeUnsupported is returned when an operation is not supported. + ErrorCodeUnsupported = Register("errcode", ErrorDescriptor{ + Value: "UNSUPPORTED", + Message: "The operation is unsupported.", + Description: `The operation was unsupported due to a missing + implementation or invalid set of parameters.`, + HTTPStatusCode: http.StatusMethodNotAllowed, + }) + + // ErrorCodeUnauthorized is returned if a request requires + // authentication. + ErrorCodeUnauthorized = Register("errcode", ErrorDescriptor{ + Value: "UNAUTHORIZED", + Message: "authentication required", + Description: `The access controller was unable to authenticate + the client. Often this will be accompanied by a + Www-Authenticate HTTP response header indicating how to + authenticate.`, + HTTPStatusCode: http.StatusUnauthorized, + }) + + // ErrorCodeDenied is returned if a client does not have sufficient + // permission to perform an action. + ErrorCodeDenied = Register("errcode", ErrorDescriptor{ + Value: "DENIED", + Message: "requested access to the resource is denied", + Description: `The access controller denied access for the + operation on a resource.`, + HTTPStatusCode: http.StatusForbidden, + }) + + // ErrorCodeUnavailable provides a common error to report unavailability + // of a service or endpoint. + ErrorCodeUnavailable = Register("errcode", ErrorDescriptor{ + Value: "UNAVAILABLE", + Message: "service unavailable", + Description: "Returned when a service is not available", + HTTPStatusCode: http.StatusServiceUnavailable, + }) + + // ErrorCodeTooManyRequests is returned if a client attempts too many + // times to contact a service endpoint. + ErrorCodeTooManyRequests = Register("errcode", ErrorDescriptor{ + Value: "TOOMANYREQUESTS", + Message: "too many requests", + Description: `Returned when a client attempts to contact a + service too many times`, + HTTPStatusCode: http.StatusTooManyRequests, + }) +) + +var nextCode = 1000 +var registerLock sync.Mutex + +// Register will make the passed-in error known to the environment and +// return a new ErrorCode +func Register(group string, descriptor ErrorDescriptor) ErrorCode { + registerLock.Lock() + defer registerLock.Unlock() + + descriptor.Code = ErrorCode(nextCode) + + if _, ok := idToDescriptors[descriptor.Value]; ok { + panic(fmt.Sprintf("ErrorValue %q is already registered", descriptor.Value)) + } + if _, ok := errorCodeToDescriptors[descriptor.Code]; ok { + panic(fmt.Sprintf("ErrorCode %v is already registered", descriptor.Code)) + } + + groupToDescriptors[group] = append(groupToDescriptors[group], descriptor) + errorCodeToDescriptors[descriptor.Code] = descriptor + idToDescriptors[descriptor.Value] = descriptor + + nextCode++ + return descriptor.Code +} + +type byValue []ErrorDescriptor + +func (a byValue) Len() int { return len(a) } +func (a byValue) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byValue) Less(i, j int) bool { return a[i].Value < a[j].Value } + +// GetGroupNames returns the list of Error group names that are registered +func GetGroupNames() []string { + keys := []string{} + + for k := range groupToDescriptors { + keys = append(keys, k) + } + sort.Strings(keys) + return keys +} + +// GetErrorCodeGroup returns the named group of error descriptors +func GetErrorCodeGroup(name string) []ErrorDescriptor { + desc := groupToDescriptors[name] + sort.Sort(byValue(desc)) + return desc +} + +// GetErrorAllDescriptors returns a slice of all ErrorDescriptors that are +// registered, irrespective of what group they're in +func GetErrorAllDescriptors() []ErrorDescriptor { + result := []ErrorDescriptor{} + + for _, group := range GetGroupNames() { + result = append(result, GetErrorCodeGroup(group)...) + } + sort.Sort(byValue(result)) + return result +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/fetcher.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/fetcher.go new file mode 100644 index 000000000..4b2c10e9a --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/fetcher.go @@ -0,0 +1,216 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "context" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/log" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +type dockerFetcher struct { + *dockerBase +} + +func (r dockerFetcher) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error) { + ctx = log.WithLogger(ctx, log.G(ctx).WithField("digest", desc.Digest)) + + hosts := r.filterHosts(HostCapabilityPull) + if len(hosts) == 0 { + return nil, errors.Wrap(errdefs.ErrNotFound, "no pull hosts") + } + + ctx, err := ContextWithRepositoryScope(ctx, r.refspec, false) + if err != nil { + return nil, err + } + + return newHTTPReadSeeker(desc.Size, func(offset int64) (io.ReadCloser, error) { + // firstly try fetch via external urls + for _, us := range desc.URLs { + ctx = log.WithLogger(ctx, log.G(ctx).WithField("url", us)) + + u, err := url.Parse(us) + if err != nil { + log.G(ctx).WithError(err).Debug("failed to parse") + continue + } + if u.Scheme != "http" && u.Scheme != "https" { + log.G(ctx).Debug("non-http(s) alternative url is unsupported") + continue + } + log.G(ctx).Debug("trying alternative url") + + // Try this first, parse it + host := RegistryHost{ + Client: http.DefaultClient, + Host: u.Host, + Scheme: u.Scheme, + Path: u.Path, + Capabilities: HostCapabilityPull, + } + req := r.request(host, http.MethodGet) + // Strip namespace from base + req.path = u.Path + if u.RawQuery != "" { + req.path = req.path + "?" + u.RawQuery + } + + rc, err := r.open(ctx, req, desc.MediaType, offset) + if err != nil { + if errdefs.IsNotFound(err) { + continue // try one of the other urls. + } + + return nil, err + } + + return rc, nil + } + + // Try manifests endpoints for manifests types + switch desc.MediaType { + case images.MediaTypeDockerSchema2Manifest, images.MediaTypeDockerSchema2ManifestList, + images.MediaTypeDockerSchema1Manifest, + ocispec.MediaTypeImageManifest, ocispec.MediaTypeImageIndex: + + var firstErr error + for _, host := range r.hosts { + req := r.request(host, http.MethodGet, "manifests", desc.Digest.String()) + if err := req.addNamespace(r.refspec.Hostname()); err != nil { + return nil, err + } + + rc, err := r.open(ctx, req, desc.MediaType, offset) + if err != nil { + // Store the error for referencing later + if firstErr == nil { + firstErr = err + } + continue // try another host + } + + return rc, nil + } + + return nil, firstErr + } + + // Finally use blobs endpoints + var firstErr error + for _, host := range r.hosts { + req := r.request(host, http.MethodGet, "blobs", desc.Digest.String()) + if err := req.addNamespace(r.refspec.Hostname()); err != nil { + return nil, err + } + + rc, err := r.open(ctx, req, desc.MediaType, offset) + if err != nil { + // Store the error for referencing later + if firstErr == nil { + firstErr = err + } + continue // try another host + } + + return rc, nil + } + + if errdefs.IsNotFound(firstErr) { + firstErr = errors.Wrapf(errdefs.ErrNotFound, + "could not fetch content descriptor %v (%v) from remote", + desc.Digest, desc.MediaType) + } + + return nil, firstErr + + }) +} + +func (r dockerFetcher) open(ctx context.Context, req *request, mediatype string, offset int64) (_ io.ReadCloser, retErr error) { + req.header.Set("Accept", strings.Join([]string{mediatype, `*/*`}, ", ")) + + if offset > 0 { + // Note: "Accept-Ranges: bytes" cannot be trusted as some endpoints + // will return the header without supporting the range. The content + // range must always be checked. + req.header.Set("Range", fmt.Sprintf("bytes=%d-", offset)) + } + + resp, err := req.doWithRetries(ctx, nil) + if err != nil { + return nil, err + } + defer func() { + if retErr != nil { + resp.Body.Close() + } + }() + + if resp.StatusCode > 299 { + // TODO(stevvooe): When doing a offset specific request, we should + // really distinguish between a 206 and a 200. In the case of 200, we + // can discard the bytes, hiding the seek behavior from the + // implementation. + + if resp.StatusCode == http.StatusNotFound { + return nil, errors.Wrapf(errdefs.ErrNotFound, "content at %v not found", req.String()) + } + var registryErr Errors + if err := json.NewDecoder(resp.Body).Decode(®istryErr); err != nil || registryErr.Len() < 1 { + return nil, errors.Errorf("unexpected status code %v: %v", req.String(), resp.Status) + } + return nil, errors.Errorf("unexpected status code %v: %s - Server message: %s", req.String(), resp.Status, registryErr.Error()) + } + if offset > 0 { + cr := resp.Header.Get("content-range") + if cr != "" { + if !strings.HasPrefix(cr, fmt.Sprintf("bytes %d-", offset)) { + return nil, errors.Errorf("unhandled content range in response: %v", cr) + + } + } else { + // TODO: Should any cases where use of content range + // without the proper header be considered? + // 206 responses? + + // Discard up to offset + // Could use buffer pool here but this case should be rare + n, err := io.Copy(ioutil.Discard, io.LimitReader(resp.Body, offset)) + if err != nil { + return nil, errors.Wrap(err, "failed to discard to offset") + } + if n != offset { + return nil, errors.Errorf("unable to discard to offset") + } + + } + } + + return resp.Body, nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/handler.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/handler.go new file mode 100644 index 000000000..529cfbc27 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/handler.go @@ -0,0 +1,154 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "context" + "fmt" + "net/url" + "strings" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/labels" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/reference" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +var ( + // labelDistributionSource describes the source blob comes from. + labelDistributionSource = "containerd.io/distribution.source" +) + +// AppendDistributionSourceLabel updates the label of blob with distribution source. +func AppendDistributionSourceLabel(manager content.Manager, ref string) (images.HandlerFunc, error) { + refspec, err := reference.Parse(ref) + if err != nil { + return nil, err + } + + u, err := url.Parse("dummy://" + refspec.Locator) + if err != nil { + return nil, err + } + + source, repo := u.Hostname(), strings.TrimPrefix(u.Path, "/") + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + info, err := manager.Info(ctx, desc.Digest) + if err != nil { + return nil, err + } + + key := distributionSourceLabelKey(source) + + originLabel := "" + if info.Labels != nil { + originLabel = info.Labels[key] + } + value := appendDistributionSourceLabel(originLabel, repo) + + // The repo name has been limited under 256 and the distribution + // label might hit the limitation of label size, when blob data + // is used as the very, very common layer. + if err := labels.Validate(key, value); err != nil { + log.G(ctx).Warnf("skip to append distribution label: %s", err) + return nil, nil + } + + info = content.Info{ + Digest: desc.Digest, + Labels: map[string]string{ + key: value, + }, + } + _, err = manager.Update(ctx, info, fmt.Sprintf("labels.%s", key)) + return nil, err + }, nil +} + +func appendDistributionSourceLabel(originLabel, repo string) string { + repos := []string{} + if originLabel != "" { + repos = strings.Split(originLabel, ",") + } + repos = append(repos, repo) + + // use empty string to present duplicate items + for i := 1; i < len(repos); i++ { + tmp, j := repos[i], i-1 + for ; j >= 0 && repos[j] >= tmp; j-- { + if repos[j] == tmp { + tmp = "" + } + repos[j+1] = repos[j] + } + repos[j+1] = tmp + } + + i := 0 + for ; i < len(repos) && repos[i] == ""; i++ { + } + + return strings.Join(repos[i:], ",") +} + +func distributionSourceLabelKey(source string) string { + return fmt.Sprintf("%s.%s", labelDistributionSource, source) +} + +// selectRepositoryMountCandidate will select the repo which has longest +// common prefix components as the candidate. +func selectRepositoryMountCandidate(refspec reference.Spec, sources map[string]string) string { + u, err := url.Parse("dummy://" + refspec.Locator) + if err != nil { + // NOTE: basically, it won't be error here + return "" + } + + source, target := u.Hostname(), strings.TrimPrefix(u.Path, "/") + repoLabel, ok := sources[distributionSourceLabelKey(source)] + if !ok || repoLabel == "" { + return "" + } + + n, match := 0, "" + components := strings.Split(target, "/") + for _, repo := range strings.Split(repoLabel, ",") { + // the target repo is not a candidate + if repo == target { + continue + } + + if l := commonPrefixComponents(components, repo); l >= n { + n, match = l, repo + } + } + return match +} + +func commonPrefixComponents(components []string, target string) int { + targetComponents := strings.Split(target, "/") + + i := 0 + for ; i < len(components) && i < len(targetComponents); i++ { + if components[i] != targetComponents[i] { + break + } + } + return i +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/httpreadseeker.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/httpreadseeker.go new file mode 100644 index 000000000..58c866bcd --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/httpreadseeker.go @@ -0,0 +1,169 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "bytes" + "io" + "io/ioutil" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/log" + "github.com/pkg/errors" +) + +const maxRetry = 3 + +type httpReadSeeker struct { + size int64 + offset int64 + rc io.ReadCloser + open func(offset int64) (io.ReadCloser, error) + closed bool + + errsWithNoProgress int +} + +func newHTTPReadSeeker(size int64, open func(offset int64) (io.ReadCloser, error)) (io.ReadCloser, error) { + return &httpReadSeeker{ + size: size, + open: open, + }, nil +} + +func (hrs *httpReadSeeker) Read(p []byte) (n int, err error) { + if hrs.closed { + return 0, io.EOF + } + + rd, err := hrs.reader() + if err != nil { + return 0, err + } + + n, err = rd.Read(p) + hrs.offset += int64(n) + if n > 0 || err == nil { + hrs.errsWithNoProgress = 0 + } + if err == io.ErrUnexpectedEOF { + // connection closed unexpectedly. try reconnecting. + if n == 0 { + hrs.errsWithNoProgress++ + if hrs.errsWithNoProgress > maxRetry { + return // too many retries for this offset with no progress + } + } + if hrs.rc != nil { + if clsErr := hrs.rc.Close(); clsErr != nil { + log.L.WithError(clsErr).Errorf("httpReadSeeker: failed to close ReadCloser") + } + hrs.rc = nil + } + if _, err2 := hrs.reader(); err2 == nil { + return n, nil + } + } + return +} + +func (hrs *httpReadSeeker) Close() error { + if hrs.closed { + return nil + } + hrs.closed = true + if hrs.rc != nil { + return hrs.rc.Close() + } + + return nil +} + +func (hrs *httpReadSeeker) Seek(offset int64, whence int) (int64, error) { + if hrs.closed { + return 0, errors.Wrap(errdefs.ErrUnavailable, "Fetcher.Seek: closed") + } + + abs := hrs.offset + switch whence { + case io.SeekStart: + abs = offset + case io.SeekCurrent: + abs += offset + case io.SeekEnd: + if hrs.size == -1 { + return 0, errors.Wrap(errdefs.ErrUnavailable, "Fetcher.Seek: unknown size, cannot seek from end") + } + abs = hrs.size + offset + default: + return 0, errors.Wrap(errdefs.ErrInvalidArgument, "Fetcher.Seek: invalid whence") + } + + if abs < 0 { + return 0, errors.Wrapf(errdefs.ErrInvalidArgument, "Fetcher.Seek: negative offset") + } + + if abs != hrs.offset { + if hrs.rc != nil { + if err := hrs.rc.Close(); err != nil { + log.L.WithError(err).Errorf("Fetcher.Seek: failed to close ReadCloser") + } + + hrs.rc = nil + } + + hrs.offset = abs + } + + return hrs.offset, nil +} + +func (hrs *httpReadSeeker) reader() (io.Reader, error) { + if hrs.rc != nil { + return hrs.rc, nil + } + + if hrs.size == -1 || hrs.offset < hrs.size { + // only try to reopen the body request if we are seeking to a value + // less than the actual size. + if hrs.open == nil { + return nil, errors.Wrapf(errdefs.ErrNotImplemented, "cannot open") + } + + rc, err := hrs.open(hrs.offset) + if err != nil { + return nil, errors.Wrapf(err, "httpReadSeeker: failed open") + } + + if hrs.rc != nil { + if err := hrs.rc.Close(); err != nil { + log.L.WithError(err).Errorf("httpReadSeeker: failed to close ReadCloser") + } + } + hrs.rc = rc + } else { + // There is an edge case here where offset == size of the content. If + // we seek, we will probably get an error for content that cannot be + // sought (?). In that case, we should err on committing the content, + // as the length is already satisfied but we just return the empty + // reader instead. + + hrs.rc = ioutil.NopCloser(bytes.NewReader([]byte{})) + } + + return hrs.rc, nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/pusher.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/pusher.go new file mode 100644 index 000000000..97ed66a6a --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/pusher.go @@ -0,0 +1,445 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "context" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + "time" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/remotes" + remoteserrors "github.com/containerd/containerd/remotes/errors" + digest "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +type dockerPusher struct { + *dockerBase + object string + + // TODO: namespace tracker + tracker StatusTracker +} + +// Writer implements Ingester API of content store. This allows the client +// to receive ErrUnavailable when there is already an on-going upload. +// Note that the tracker MUST implement StatusTrackLocker interface to avoid +// race condition on StatusTracker. +func (p dockerPusher) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { + var wOpts content.WriterOpts + for _, opt := range opts { + if err := opt(&wOpts); err != nil { + return nil, err + } + } + if wOpts.Ref == "" { + return nil, errors.Wrap(errdefs.ErrInvalidArgument, "ref must not be empty") + } + return p.push(ctx, wOpts.Desc, wOpts.Ref, true) +} + +func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (content.Writer, error) { + return p.push(ctx, desc, remotes.MakeRefKey(ctx, desc), false) +} + +func (p dockerPusher) push(ctx context.Context, desc ocispec.Descriptor, ref string, unavailableOnFail bool) (content.Writer, error) { + if l, ok := p.tracker.(StatusTrackLocker); ok { + l.Lock(ref) + defer l.Unlock(ref) + } + ctx, err := ContextWithRepositoryScope(ctx, p.refspec, true) + if err != nil { + return nil, err + } + status, err := p.tracker.GetStatus(ref) + if err == nil { + if status.Committed && status.Offset == status.Total { + return nil, errors.Wrapf(errdefs.ErrAlreadyExists, "ref %v", ref) + } + if unavailableOnFail { + // Another push of this ref is happening elsewhere. The rest of function + // will continue only when `errdefs.IsNotFound(err) == true` (i.e. there + // is no actively-tracked ref already). + return nil, errors.Wrap(errdefs.ErrUnavailable, "push is on-going") + } + // TODO: Handle incomplete status + } else if !errdefs.IsNotFound(err) { + return nil, errors.Wrap(err, "failed to get status") + } + + hosts := p.filterHosts(HostCapabilityPush) + if len(hosts) == 0 { + return nil, errors.Wrap(errdefs.ErrNotFound, "no push hosts") + } + + var ( + isManifest bool + existCheck []string + host = hosts[0] + ) + + switch desc.MediaType { + case images.MediaTypeDockerSchema2Manifest, images.MediaTypeDockerSchema2ManifestList, + ocispec.MediaTypeImageManifest, ocispec.MediaTypeImageIndex: + isManifest = true + existCheck = getManifestPath(p.object, desc.Digest) + default: + existCheck = []string{"blobs", desc.Digest.String()} + } + + req := p.request(host, http.MethodHead, existCheck...) + req.header.Set("Accept", strings.Join([]string{desc.MediaType, `*/*`}, ", ")) + + log.G(ctx).WithField("url", req.String()).Debugf("checking and pushing to") + + resp, err := req.doWithRetries(ctx, nil) + if err != nil { + if !errors.Is(err, ErrInvalidAuthorization) { + return nil, err + } + log.G(ctx).WithError(err).Debugf("Unable to check existence, continuing with push") + } else { + if resp.StatusCode == http.StatusOK { + var exists bool + if isManifest && existCheck[1] != desc.Digest.String() { + dgstHeader := digest.Digest(resp.Header.Get("Docker-Content-Digest")) + if dgstHeader == desc.Digest { + exists = true + } + } else { + exists = true + } + + if exists { + p.tracker.SetStatus(ref, Status{ + Committed: true, + Status: content.Status{ + Ref: ref, + Total: desc.Size, + Offset: desc.Size, + // TODO: Set updated time? + }, + }) + resp.Body.Close() + return nil, errors.Wrapf(errdefs.ErrAlreadyExists, "content %v on remote", desc.Digest) + } + } else if resp.StatusCode != http.StatusNotFound { + err := remoteserrors.NewUnexpectedStatusErr(resp) + log.G(ctx).WithField("resp", resp).WithField("body", string(err.(remoteserrors.ErrUnexpectedStatus).Body)).Debug("unexpected response") + resp.Body.Close() + return nil, err + } + resp.Body.Close() + } + + if isManifest { + putPath := getManifestPath(p.object, desc.Digest) + req = p.request(host, http.MethodPut, putPath...) + req.header.Add("Content-Type", desc.MediaType) + } else { + // Start upload request + req = p.request(host, http.MethodPost, "blobs", "uploads/") + + var resp *http.Response + if fromRepo := selectRepositoryMountCandidate(p.refspec, desc.Annotations); fromRepo != "" { + preq := requestWithMountFrom(req, desc.Digest.String(), fromRepo) + pctx := ContextWithAppendPullRepositoryScope(ctx, fromRepo) + + // NOTE: the fromRepo might be private repo and + // auth service still can grant token without error. + // but the post request will fail because of 401. + // + // for the private repo, we should remove mount-from + // query and send the request again. + resp, err = preq.doWithRetries(pctx, nil) + if err != nil { + return nil, err + } + + if resp.StatusCode == http.StatusUnauthorized { + log.G(ctx).Debugf("failed to mount from repository %s", fromRepo) + + resp.Body.Close() + resp = nil + } + } + + if resp == nil { + resp, err = req.doWithRetries(ctx, nil) + if err != nil { + return nil, err + } + } + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusOK, http.StatusAccepted, http.StatusNoContent: + case http.StatusCreated: + p.tracker.SetStatus(ref, Status{ + Committed: true, + Status: content.Status{ + Ref: ref, + Total: desc.Size, + Offset: desc.Size, + }, + }) + return nil, errors.Wrapf(errdefs.ErrAlreadyExists, "content %v on remote", desc.Digest) + default: + err := remoteserrors.NewUnexpectedStatusErr(resp) + log.G(ctx).WithField("resp", resp).WithField("body", string(err.(remoteserrors.ErrUnexpectedStatus).Body)).Debug("unexpected response") + return nil, err + } + + var ( + location = resp.Header.Get("Location") + lurl *url.URL + lhost = host + ) + // Support paths without host in location + if strings.HasPrefix(location, "/") { + lurl, err = url.Parse(lhost.Scheme + "://" + lhost.Host + location) + if err != nil { + return nil, errors.Wrapf(err, "unable to parse location %v", location) + } + } else { + if !strings.Contains(location, "://") { + location = lhost.Scheme + "://" + location + } + lurl, err = url.Parse(location) + if err != nil { + return nil, errors.Wrapf(err, "unable to parse location %v", location) + } + + if lurl.Host != lhost.Host || lhost.Scheme != lurl.Scheme { + + lhost.Scheme = lurl.Scheme + lhost.Host = lurl.Host + log.G(ctx).WithField("host", lhost.Host).WithField("scheme", lhost.Scheme).Debug("upload changed destination") + + // Strip authorizer if change to host or scheme + lhost.Authorizer = nil + } + } + q := lurl.Query() + q.Add("digest", desc.Digest.String()) + + req = p.request(lhost, http.MethodPut) + req.header.Set("Content-Type", "application/octet-stream") + req.path = lurl.Path + "?" + q.Encode() + } + p.tracker.SetStatus(ref, Status{ + Status: content.Status{ + Ref: ref, + Total: desc.Size, + Expected: desc.Digest, + StartedAt: time.Now(), + }, + }) + + // TODO: Support chunked upload + + pr, pw := io.Pipe() + respC := make(chan response, 1) + body := ioutil.NopCloser(pr) + + req.body = func() (io.ReadCloser, error) { + if body == nil { + return nil, errors.New("cannot reuse body, request must be retried") + } + // Only use the body once since pipe cannot be seeked + ob := body + body = nil + return ob, nil + } + req.size = desc.Size + + go func() { + defer close(respC) + resp, err := req.doWithRetries(ctx, nil) + if err != nil { + respC <- response{err: err} + pr.CloseWithError(err) + return + } + + switch resp.StatusCode { + case http.StatusOK, http.StatusCreated, http.StatusNoContent: + default: + err := remoteserrors.NewUnexpectedStatusErr(resp) + log.G(ctx).WithField("resp", resp).WithField("body", string(err.(remoteserrors.ErrUnexpectedStatus).Body)).Debug("unexpected response") + pr.CloseWithError(err) + } + respC <- response{Response: resp} + }() + + return &pushWriter{ + base: p.dockerBase, + ref: ref, + pipe: pw, + responseC: respC, + isManifest: isManifest, + expected: desc.Digest, + tracker: p.tracker, + }, nil +} + +func getManifestPath(object string, dgst digest.Digest) []string { + if i := strings.IndexByte(object, '@'); i >= 0 { + if object[i+1:] != dgst.String() { + // use digest, not tag + object = "" + } else { + // strip @ for registry path to make tag + object = object[:i] + } + + } + + if object == "" { + return []string{"manifests", dgst.String()} + } + + return []string{"manifests", object} +} + +type response struct { + *http.Response + err error +} + +type pushWriter struct { + base *dockerBase + ref string + + pipe *io.PipeWriter + responseC <-chan response + isManifest bool + + expected digest.Digest + tracker StatusTracker +} + +func (pw *pushWriter) Write(p []byte) (n int, err error) { + status, err := pw.tracker.GetStatus(pw.ref) + if err != nil { + return n, err + } + n, err = pw.pipe.Write(p) + status.Offset += int64(n) + status.UpdatedAt = time.Now() + pw.tracker.SetStatus(pw.ref, status) + return +} + +func (pw *pushWriter) Close() error { + return pw.pipe.Close() +} + +func (pw *pushWriter) Status() (content.Status, error) { + status, err := pw.tracker.GetStatus(pw.ref) + if err != nil { + return content.Status{}, err + } + return status.Status, nil + +} + +func (pw *pushWriter) Digest() digest.Digest { + // TODO: Get rid of this function? + return pw.expected +} + +func (pw *pushWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error { + // Check whether read has already thrown an error + if _, err := pw.pipe.Write([]byte{}); err != nil && err != io.ErrClosedPipe { + return errors.Wrap(err, "pipe error before commit") + } + + if err := pw.pipe.Close(); err != nil { + return err + } + // TODO: timeout waiting for response + resp := <-pw.responseC + if resp.err != nil { + return resp.err + } + defer resp.Response.Body.Close() + + // 201 is specified return status, some registries return + // 200, 202 or 204. + switch resp.StatusCode { + case http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusAccepted: + default: + return remoteserrors.NewUnexpectedStatusErr(resp.Response) + } + + status, err := pw.tracker.GetStatus(pw.ref) + if err != nil { + return errors.Wrap(err, "failed to get status") + } + + if size > 0 && size != status.Offset { + return errors.Errorf("unexpected size %d, expected %d", status.Offset, size) + } + + if expected == "" { + expected = status.Expected + } + + actual, err := digest.Parse(resp.Header.Get("Docker-Content-Digest")) + if err != nil { + return errors.Wrap(err, "invalid content digest in response") + } + + if actual != expected { + return errors.Errorf("got digest %s, expected %s", actual, expected) + } + + status.Committed = true + status.UpdatedAt = time.Now() + pw.tracker.SetStatus(pw.ref, status) + + return nil +} + +func (pw *pushWriter) Truncate(size int64) error { + // TODO: if blob close request and start new request at offset + // TODO: always error on manifest + return errors.New("cannot truncate remote upload") +} + +func requestWithMountFrom(req *request, mount, from string) *request { + creq := *req + + sep := "?" + if strings.Contains(creq.path, sep) { + sep = "&" + } + + creq.path = creq.path + sep + "mount=" + mount + "&from=" + from + + return &creq +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/registry.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/registry.go new file mode 100644 index 000000000..1e77d4c86 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/registry.go @@ -0,0 +1,245 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "net" + "net/http" + + "github.com/pkg/errors" +) + +// HostCapabilities represent the capabilities of the registry +// host. This also represents the set of operations for which +// the registry host may be trusted to perform. +// +// For example pushing is a capability which should only be +// performed on an upstream source, not a mirror. +// Resolving (the process of converting a name into a digest) +// must be considered a trusted operation and only done by +// a host which is trusted (or more preferably by secure process +// which can prove the provenance of the mapping). A public +// mirror should never be trusted to do a resolve action. +// +// | Registry Type | Pull | Resolve | Push | +// |------------------|------|---------|------| +// | Public Registry | yes | yes | yes | +// | Private Registry | yes | yes | yes | +// | Public Mirror | yes | no | no | +// | Private Mirror | yes | yes | no | +type HostCapabilities uint8 + +const ( + // HostCapabilityPull represents the capability to fetch manifests + // and blobs by digest + HostCapabilityPull HostCapabilities = 1 << iota + + // HostCapabilityResolve represents the capability to fetch manifests + // by name + HostCapabilityResolve + + // HostCapabilityPush represents the capability to push blobs and + // manifests + HostCapabilityPush + + // Reserved for future capabilities (i.e. search, catalog, remove) +) + +// Has checks whether the capabilities list has the provide capability +func (c HostCapabilities) Has(t HostCapabilities) bool { + return c&t == t +} + +// RegistryHost represents a complete configuration for a registry +// host, representing the capabilities, authorizations, connection +// configuration, and location. +type RegistryHost struct { + Client *http.Client + Authorizer Authorizer + Host string + Scheme string + Path string + Capabilities HostCapabilities + Header http.Header +} + +func (h RegistryHost) isProxy(refhost string) bool { + if refhost != h.Host { + if refhost != "docker.io" || h.Host != "registry-1.docker.io" { + return true + } + } + return false +} + +// RegistryHosts fetches the registry hosts for a given namespace, +// provided by the host component of an distribution image reference. +type RegistryHosts func(string) ([]RegistryHost, error) + +// Registries joins multiple registry configuration functions, using the same +// order as provided within the arguments. When an empty registry configuration +// is returned with a nil error, the next function will be called. +// NOTE: This function will not join configurations, as soon as a non-empty +// configuration is returned from a configuration function, it will be returned +// to the caller. +func Registries(registries ...RegistryHosts) RegistryHosts { + return func(host string) ([]RegistryHost, error) { + for _, registry := range registries { + config, err := registry(host) + if err != nil { + return config, err + } + if len(config) > 0 { + return config, nil + } + } + return nil, nil + } +} + +type registryOpts struct { + authorizer Authorizer + plainHTTP func(string) (bool, error) + host func(string) (string, error) + client *http.Client +} + +// RegistryOpt defines a registry default option +type RegistryOpt func(*registryOpts) + +// WithPlainHTTP configures registries to use plaintext http scheme +// for the provided host match function. +func WithPlainHTTP(f func(string) (bool, error)) RegistryOpt { + return func(opts *registryOpts) { + opts.plainHTTP = f + } +} + +// WithAuthorizer configures the default authorizer for a registry +func WithAuthorizer(a Authorizer) RegistryOpt { + return func(opts *registryOpts) { + opts.authorizer = a + } +} + +// WithHostTranslator defines the default translator to use for registry hosts +func WithHostTranslator(h func(string) (string, error)) RegistryOpt { + return func(opts *registryOpts) { + opts.host = h + } +} + +// WithClient configures the default http client for a registry +func WithClient(c *http.Client) RegistryOpt { + return func(opts *registryOpts) { + opts.client = c + } +} + +// ConfigureDefaultRegistries is used to create a default configuration for +// registries. For more advanced configurations or per-domain setups, +// the RegistryHosts interface should be used directly. +// NOTE: This function will always return a non-empty value or error +func ConfigureDefaultRegistries(ropts ...RegistryOpt) RegistryHosts { + var opts registryOpts + for _, opt := range ropts { + opt(&opts) + } + + return func(host string) ([]RegistryHost, error) { + config := RegistryHost{ + Client: opts.client, + Authorizer: opts.authorizer, + Host: host, + Scheme: "https", + Path: "/v2", + Capabilities: HostCapabilityPull | HostCapabilityResolve | HostCapabilityPush, + } + + if config.Client == nil { + config.Client = http.DefaultClient + } + + if opts.plainHTTP != nil { + match, err := opts.plainHTTP(host) + if err != nil { + return nil, err + } + if match { + config.Scheme = "http" + } + } + + if opts.host != nil { + var err error + config.Host, err = opts.host(config.Host) + if err != nil { + return nil, err + } + } else if host == "docker.io" { + config.Host = "registry-1.docker.io" + } + + return []RegistryHost{config}, nil + } +} + +// MatchAllHosts is a host match function which is always true. +func MatchAllHosts(string) (bool, error) { + return true, nil +} + +// MatchLocalhost is a host match function which returns true for +// localhost. +// +// Note: this does not handle matching of ip addresses in octal, +// decimal or hex form. +func MatchLocalhost(host string) (bool, error) { + switch { + case host == "::1": + return true, nil + case host == "[::1]": + return true, nil + } + h, p, err := net.SplitHostPort(host) + + // addrError helps distinguish between errors of form + // "no colon in address" and "too many colons in address". + // The former is fine as the host string need not have a + // port. Latter needs to be handled. + addrError := &net.AddrError{ + Err: "missing port in address", + Addr: host, + } + if err != nil { + if err.Error() != addrError.Error() { + return false, err + } + // host string without any port specified + h = host + } else if len(p) == 0 { + return false, errors.New("invalid host name format") + } + + // use ipv4 dotted decimal for further checking + if h == "localhost" { + h = "127.0.0.1" + } + ip := net.ParseIP(h) + + return ip.IsLoopback(), nil +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/resolver.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/resolver.go new file mode 100644 index 000000000..1be9e1d05 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/resolver.go @@ -0,0 +1,667 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "context" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "path" + "strings" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/reference" + "github.com/containerd/containerd/remotes" + "github.com/containerd/containerd/remotes/docker/schema1" + "github.com/containerd/containerd/version" + digest "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "golang.org/x/net/context/ctxhttp" +) + +var ( + // ErrInvalidAuthorization is used when credentials are passed to a server but + // those credentials are rejected. + ErrInvalidAuthorization = errors.New("authorization failed") + + // MaxManifestSize represents the largest size accepted from a registry + // during resolution. Larger manifests may be accepted using a + // resolution method other than the registry. + // + // NOTE: The max supported layers by some runtimes is 128 and individual + // layers will not contribute more than 256 bytes, making a + // reasonable limit for a large image manifests of 32K bytes. + // 4M bytes represents a much larger upper bound for images which may + // contain large annotations or be non-images. A proper manifest + // design puts large metadata in subobjects, as is consistent the + // intent of the manifest design. + MaxManifestSize int64 = 4 * 1048 * 1048 +) + +// Authorizer is used to authorize HTTP requests based on 401 HTTP responses. +// An Authorizer is responsible for caching tokens or credentials used by +// requests. +type Authorizer interface { + // Authorize sets the appropriate `Authorization` header on the given + // request. + // + // If no authorization is found for the request, the request remains + // unmodified. It may also add an `Authorization` header as + // "bearer " + // "basic " + Authorize(context.Context, *http.Request) error + + // AddResponses adds a 401 response for the authorizer to consider when + // authorizing requests. The last response should be unauthorized and + // the previous requests are used to consider redirects and retries + // that may have led to the 401. + // + // If response is not handled, returns `ErrNotImplemented` + AddResponses(context.Context, []*http.Response) error +} + +// ResolverOptions are used to configured a new Docker register resolver +type ResolverOptions struct { + // Hosts returns registry host configurations for a namespace. + Hosts RegistryHosts + + // Headers are the HTTP request header fields sent by the resolver + Headers http.Header + + // Tracker is used to track uploads to the registry. This is used + // since the registry does not have upload tracking and the existing + // mechanism for getting blob upload status is expensive. + Tracker StatusTracker + + // Authorizer is used to authorize registry requests + // Deprecated: use Hosts + Authorizer Authorizer + + // Credentials provides username and secret given a host. + // If username is empty but a secret is given, that secret + // is interpreted as a long lived token. + // Deprecated: use Hosts + Credentials func(string) (string, string, error) + + // Host provides the hostname given a namespace. + // Deprecated: use Hosts + Host func(string) (string, error) + + // PlainHTTP specifies to use plain http and not https + // Deprecated: use Hosts + PlainHTTP bool + + // Client is the http client to used when making registry requests + // Deprecated: use Hosts + Client *http.Client +} + +// DefaultHost is the default host function. +func DefaultHost(ns string) (string, error) { + if ns == "docker.io" { + return "registry-1.docker.io", nil + } + return ns, nil +} + +type dockerResolver struct { + hosts RegistryHosts + header http.Header + resolveHeader http.Header + tracker StatusTracker +} + +// NewResolver returns a new resolver to a Docker registry +func NewResolver(options ResolverOptions) remotes.Resolver { + if options.Tracker == nil { + options.Tracker = NewInMemoryTracker() + } + + if options.Headers == nil { + options.Headers = make(http.Header) + } + if _, ok := options.Headers["User-Agent"]; !ok { + options.Headers.Set("User-Agent", "containerd/"+version.Version) + } + + resolveHeader := http.Header{} + if _, ok := options.Headers["Accept"]; !ok { + // set headers for all the types we support for resolution. + resolveHeader.Set("Accept", strings.Join([]string{ + images.MediaTypeDockerSchema2Manifest, + images.MediaTypeDockerSchema2ManifestList, + ocispec.MediaTypeImageManifest, + ocispec.MediaTypeImageIndex, "*/*"}, ", ")) + } else { + resolveHeader["Accept"] = options.Headers["Accept"] + delete(options.Headers, "Accept") + } + + if options.Hosts == nil { + opts := []RegistryOpt{} + if options.Host != nil { + opts = append(opts, WithHostTranslator(options.Host)) + } + + if options.Authorizer == nil { + options.Authorizer = NewDockerAuthorizer( + WithAuthClient(options.Client), + WithAuthHeader(options.Headers), + WithAuthCreds(options.Credentials)) + } + opts = append(opts, WithAuthorizer(options.Authorizer)) + + if options.Client != nil { + opts = append(opts, WithClient(options.Client)) + } + if options.PlainHTTP { + opts = append(opts, WithPlainHTTP(MatchAllHosts)) + } else { + opts = append(opts, WithPlainHTTP(MatchLocalhost)) + } + options.Hosts = ConfigureDefaultRegistries(opts...) + } + return &dockerResolver{ + hosts: options.Hosts, + header: options.Headers, + resolveHeader: resolveHeader, + tracker: options.Tracker, + } +} + +func getManifestMediaType(resp *http.Response) string { + // Strip encoding data (manifests should always be ascii JSON) + contentType := resp.Header.Get("Content-Type") + if sp := strings.IndexByte(contentType, ';'); sp != -1 { + contentType = contentType[0:sp] + } + + // As of Apr 30 2019 the registry.access.redhat.com registry does not specify + // the content type of any data but uses schema1 manifests. + if contentType == "text/plain" { + contentType = images.MediaTypeDockerSchema1Manifest + } + return contentType +} + +type countingReader struct { + reader io.Reader + bytesRead int64 +} + +func (r *countingReader) Read(p []byte) (int, error) { + n, err := r.reader.Read(p) + r.bytesRead += int64(n) + return n, err +} + +var _ remotes.Resolver = &dockerResolver{} + +func (r *dockerResolver) Resolve(ctx context.Context, ref string) (string, ocispec.Descriptor, error) { + base, err := r.resolveDockerBase(ref) + if err != nil { + return "", ocispec.Descriptor{}, err + } + refspec := base.refspec + if refspec.Object == "" { + return "", ocispec.Descriptor{}, reference.ErrObjectRequired + } + + var ( + firstErr error + paths [][]string + dgst = refspec.Digest() + caps = HostCapabilityPull + ) + + if dgst != "" { + if err := dgst.Validate(); err != nil { + // need to fail here, since we can't actually resolve the invalid + // digest. + return "", ocispec.Descriptor{}, err + } + + // turns out, we have a valid digest, make a url. + paths = append(paths, []string{"manifests", dgst.String()}) + + // fallback to blobs on not found. + paths = append(paths, []string{"blobs", dgst.String()}) + } else { + // Add + paths = append(paths, []string{"manifests", refspec.Object}) + caps |= HostCapabilityResolve + } + + hosts := base.filterHosts(caps) + if len(hosts) == 0 { + return "", ocispec.Descriptor{}, errors.Wrap(errdefs.ErrNotFound, "no resolve hosts") + } + + ctx, err = ContextWithRepositoryScope(ctx, refspec, false) + if err != nil { + return "", ocispec.Descriptor{}, err + } + + for _, u := range paths { + for _, host := range hosts { + ctx := log.WithLogger(ctx, log.G(ctx).WithField("host", host.Host)) + + req := base.request(host, http.MethodHead, u...) + if err := req.addNamespace(base.refspec.Hostname()); err != nil { + return "", ocispec.Descriptor{}, err + } + + for key, value := range r.resolveHeader { + req.header[key] = append(req.header[key], value...) + } + + log.G(ctx).Debug("resolving") + resp, err := req.doWithRetries(ctx, nil) + if err != nil { + if errors.Is(err, ErrInvalidAuthorization) { + err = errors.Wrapf(err, "pull access denied, repository does not exist or may require authorization") + } + // Store the error for referencing later + if firstErr == nil { + firstErr = err + } + log.G(ctx).WithError(err).Info("trying next host") + continue // try another host + } + resp.Body.Close() // don't care about body contents. + + if resp.StatusCode > 299 { + if resp.StatusCode == http.StatusNotFound { + log.G(ctx).Info("trying next host - response was http.StatusNotFound") + continue + } + if resp.StatusCode > 399 { + // Set firstErr when encountering the first non-404 status code. + if firstErr == nil { + firstErr = errors.Errorf("pulling from host %s failed with status code %v: %v", host.Host, u, resp.Status) + } + continue // try another host + } + return "", ocispec.Descriptor{}, errors.Errorf("pulling from host %s failed with unexpected status code %v: %v", host.Host, u, resp.Status) + } + size := resp.ContentLength + contentType := getManifestMediaType(resp) + + // if no digest was provided, then only a resolve + // trusted registry was contacted, in this case use + // the digest header (or content from GET) + if dgst == "" { + // this is the only point at which we trust the registry. we use the + // content headers to assemble a descriptor for the name. when this becomes + // more robust, we mostly get this information from a secure trust store. + dgstHeader := digest.Digest(resp.Header.Get("Docker-Content-Digest")) + + if dgstHeader != "" && size != -1 { + if err := dgstHeader.Validate(); err != nil { + return "", ocispec.Descriptor{}, errors.Wrapf(err, "%q in header not a valid digest", dgstHeader) + } + dgst = dgstHeader + } + } + if dgst == "" || size == -1 { + log.G(ctx).Debug("no Docker-Content-Digest header, fetching manifest instead") + + req = base.request(host, http.MethodGet, u...) + if err := req.addNamespace(base.refspec.Hostname()); err != nil { + return "", ocispec.Descriptor{}, err + } + + for key, value := range r.resolveHeader { + req.header[key] = append(req.header[key], value...) + } + + resp, err := req.doWithRetries(ctx, nil) + if err != nil { + return "", ocispec.Descriptor{}, err + } + defer resp.Body.Close() + + bodyReader := countingReader{reader: resp.Body} + + contentType = getManifestMediaType(resp) + if dgst == "" { + if contentType == images.MediaTypeDockerSchema1Manifest { + b, err := schema1.ReadStripSignature(&bodyReader) + if err != nil { + return "", ocispec.Descriptor{}, err + } + + dgst = digest.FromBytes(b) + } else { + dgst, err = digest.FromReader(&bodyReader) + if err != nil { + return "", ocispec.Descriptor{}, err + } + } + } else if _, err := io.Copy(ioutil.Discard, &bodyReader); err != nil { + return "", ocispec.Descriptor{}, err + } + size = bodyReader.bytesRead + } + // Prevent resolving to excessively large manifests + if size > MaxManifestSize { + if firstErr == nil { + firstErr = errors.Wrapf(errdefs.ErrNotFound, "rejecting %d byte manifest for %s", size, ref) + } + continue + } + + desc := ocispec.Descriptor{ + Digest: dgst, + MediaType: contentType, + Size: size, + } + + log.G(ctx).WithField("desc.digest", desc.Digest).Debug("resolved") + return ref, desc, nil + } + } + + // If above loop terminates without return, then there was an error. + // "firstErr" contains the first non-404 error. That is, "firstErr == nil" + // means that either no registries were given or each registry returned 404. + + if firstErr == nil { + firstErr = errors.Wrap(errdefs.ErrNotFound, ref) + } + + return "", ocispec.Descriptor{}, firstErr +} + +func (r *dockerResolver) Fetcher(ctx context.Context, ref string) (remotes.Fetcher, error) { + base, err := r.resolveDockerBase(ref) + if err != nil { + return nil, err + } + + return dockerFetcher{ + dockerBase: base, + }, nil +} + +func (r *dockerResolver) Pusher(ctx context.Context, ref string) (remotes.Pusher, error) { + base, err := r.resolveDockerBase(ref) + if err != nil { + return nil, err + } + + return dockerPusher{ + dockerBase: base, + object: base.refspec.Object, + tracker: r.tracker, + }, nil +} + +func (r *dockerResolver) resolveDockerBase(ref string) (*dockerBase, error) { + refspec, err := reference.Parse(ref) + if err != nil { + return nil, err + } + + return r.base(refspec) +} + +type dockerBase struct { + refspec reference.Spec + repository string + hosts []RegistryHost + header http.Header +} + +func (r *dockerResolver) base(refspec reference.Spec) (*dockerBase, error) { + host := refspec.Hostname() + hosts, err := r.hosts(host) + if err != nil { + return nil, err + } + return &dockerBase{ + refspec: refspec, + repository: strings.TrimPrefix(refspec.Locator, host+"/"), + hosts: hosts, + header: r.header, + }, nil +} + +func (r *dockerBase) filterHosts(caps HostCapabilities) (hosts []RegistryHost) { + for _, host := range r.hosts { + if host.Capabilities.Has(caps) { + hosts = append(hosts, host) + } + } + return +} + +func (r *dockerBase) request(host RegistryHost, method string, ps ...string) *request { + header := r.header.Clone() + if header == nil { + header = http.Header{} + } + + for key, value := range host.Header { + header[key] = append(header[key], value...) + } + parts := append([]string{"/", host.Path, r.repository}, ps...) + p := path.Join(parts...) + // Join strips trailing slash, re-add ending "/" if included + if len(parts) > 0 && strings.HasSuffix(parts[len(parts)-1], "/") { + p = p + "/" + } + return &request{ + method: method, + path: p, + header: header, + host: host, + } +} + +func (r *request) authorize(ctx context.Context, req *http.Request) error { + // Check if has header for host + if r.host.Authorizer != nil { + if err := r.host.Authorizer.Authorize(ctx, req); err != nil { + return err + } + } + + return nil +} + +func (r *request) addNamespace(ns string) (err error) { + if !r.host.isProxy(ns) { + return nil + } + var q url.Values + // Parse query + if i := strings.IndexByte(r.path, '?'); i > 0 { + r.path = r.path[:i+1] + q, err = url.ParseQuery(r.path[i+1:]) + if err != nil { + return + } + } else { + r.path = r.path + "?" + q = url.Values{} + } + q.Add("ns", ns) + + r.path = r.path + q.Encode() + + return +} + +type request struct { + method string + path string + header http.Header + host RegistryHost + body func() (io.ReadCloser, error) + size int64 +} + +func (r *request) do(ctx context.Context) (*http.Response, error) { + u := r.host.Scheme + "://" + r.host.Host + r.path + req, err := http.NewRequest(r.method, u, nil) + if err != nil { + return nil, err + } + req.Header = http.Header{} // headers need to be copied to avoid concurrent map access + for k, v := range r.header { + req.Header[k] = v + } + if r.body != nil { + body, err := r.body() + if err != nil { + return nil, err + } + req.Body = body + req.GetBody = r.body + if r.size > 0 { + req.ContentLength = r.size + } + } + + ctx = log.WithLogger(ctx, log.G(ctx).WithField("url", u)) + log.G(ctx).WithFields(requestFields(req)).Debug("do request") + if err := r.authorize(ctx, req); err != nil { + return nil, errors.Wrap(err, "failed to authorize") + } + + var client = &http.Client{} + if r.host.Client != nil { + *client = *r.host.Client + } + if client.CheckRedirect == nil { + client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + if len(via) >= 10 { + return errors.New("stopped after 10 redirects") + } + return errors.Wrap(r.authorize(ctx, req), "failed to authorize redirect") + } + } + + resp, err := ctxhttp.Do(ctx, client, req) + if err != nil { + return nil, errors.Wrap(err, "failed to do request") + } + log.G(ctx).WithFields(responseFields(resp)).Debug("fetch response received") + return resp, nil +} + +func (r *request) doWithRetries(ctx context.Context, responses []*http.Response) (*http.Response, error) { + resp, err := r.do(ctx) + if err != nil { + return nil, err + } + + responses = append(responses, resp) + retry, err := r.retryRequest(ctx, responses) + if err != nil { + resp.Body.Close() + return nil, err + } + if retry { + resp.Body.Close() + return r.doWithRetries(ctx, responses) + } + return resp, err +} + +func (r *request) retryRequest(ctx context.Context, responses []*http.Response) (bool, error) { + if len(responses) > 5 { + return false, nil + } + last := responses[len(responses)-1] + switch last.StatusCode { + case http.StatusUnauthorized: + log.G(ctx).WithField("header", last.Header.Get("WWW-Authenticate")).Debug("Unauthorized") + if r.host.Authorizer != nil { + if err := r.host.Authorizer.AddResponses(ctx, responses); err == nil { + return true, nil + } else if !errdefs.IsNotImplemented(err) { + return false, err + } + } + + return false, nil + case http.StatusMethodNotAllowed: + // Support registries which have not properly implemented the HEAD method for + // manifests endpoint + if r.method == http.MethodHead && strings.Contains(r.path, "/manifests/") { + r.method = http.MethodGet + return true, nil + } + case http.StatusRequestTimeout, http.StatusTooManyRequests: + return true, nil + } + + // TODO: Handle 50x errors accounting for attempt history + return false, nil +} + +func (r *request) String() string { + return r.host.Scheme + "://" + r.host.Host + r.path +} + +func requestFields(req *http.Request) logrus.Fields { + fields := map[string]interface{}{ + "request.method": req.Method, + } + for k, vals := range req.Header { + k = strings.ToLower(k) + if k == "authorization" { + continue + } + for i, v := range vals { + field := "request.header." + k + if i > 0 { + field = fmt.Sprintf("%s.%d", field, i) + } + fields[field] = v + } + } + + return logrus.Fields(fields) +} + +func responseFields(resp *http.Response) logrus.Fields { + fields := map[string]interface{}{ + "response.status": resp.Status, + } + for k, vals := range resp.Header { + k = strings.ToLower(k) + for i, v := range vals { + field := "response.header." + k + if i > 0 { + field = fmt.Sprintf("%s.%d", field, i) + } + fields[field] = v + } + } + + return logrus.Fields(fields) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go new file mode 100644 index 000000000..f15a9acf3 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go @@ -0,0 +1,606 @@ +/* + Copyright The containerd Authors. + + 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 schema1 + +import ( + "bytes" + "context" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "strconv" + "strings" + "sync" + "time" + + "golang.org/x/sync/errgroup" + + "github.com/containerd/containerd/archive/compression" + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/remotes" + digest "github.com/opencontainers/go-digest" + specs "github.com/opencontainers/image-spec/specs-go" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +const ( + manifestSizeLimit = 8e6 // 8MB + labelDockerSchema1EmptyLayer = "containerd.io/docker.schema1.empty-layer" +) + +type blobState struct { + diffID digest.Digest + empty bool +} + +// Converter converts schema1 manifests to schema2 on fetch +type Converter struct { + contentStore content.Store + fetcher remotes.Fetcher + + pulledManifest *manifest + + mu sync.Mutex + blobMap map[digest.Digest]blobState + layerBlobs map[digest.Digest]ocispec.Descriptor +} + +// NewConverter returns a new converter +func NewConverter(contentStore content.Store, fetcher remotes.Fetcher) *Converter { + return &Converter{ + contentStore: contentStore, + fetcher: fetcher, + blobMap: map[digest.Digest]blobState{}, + layerBlobs: map[digest.Digest]ocispec.Descriptor{}, + } +} + +// Handle fetching descriptors for a docker media type +func (c *Converter) Handle(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + switch desc.MediaType { + case images.MediaTypeDockerSchema1Manifest: + if err := c.fetchManifest(ctx, desc); err != nil { + return nil, err + } + + m := c.pulledManifest + if len(m.FSLayers) != len(m.History) { + return nil, errors.New("invalid schema 1 manifest, history and layer mismatch") + } + descs := make([]ocispec.Descriptor, 0, len(c.pulledManifest.FSLayers)) + + for i := range m.FSLayers { + if _, ok := c.blobMap[c.pulledManifest.FSLayers[i].BlobSum]; !ok { + empty, err := isEmptyLayer([]byte(m.History[i].V1Compatibility)) + if err != nil { + return nil, err + } + + // Do no attempt to download a known empty blob + if !empty { + descs = append([]ocispec.Descriptor{ + { + MediaType: images.MediaTypeDockerSchema2LayerGzip, + Digest: c.pulledManifest.FSLayers[i].BlobSum, + Size: -1, + }, + }, descs...) + } + c.blobMap[c.pulledManifest.FSLayers[i].BlobSum] = blobState{ + empty: empty, + } + } + } + return descs, nil + case images.MediaTypeDockerSchema2LayerGzip: + if c.pulledManifest == nil { + return nil, errors.New("manifest required for schema 1 blob pull") + } + return nil, c.fetchBlob(ctx, desc) + default: + return nil, fmt.Errorf("%v not support for schema 1 manifests", desc.MediaType) + } +} + +// ConvertOptions provides options on converting a docker schema1 manifest. +type ConvertOptions struct { + // ManifestMediaType specifies the media type of the manifest OCI descriptor. + ManifestMediaType string + + // ConfigMediaType specifies the media type of the manifest config OCI + // descriptor. + ConfigMediaType string +} + +// ConvertOpt allows configuring a convert operation. +type ConvertOpt func(context.Context, *ConvertOptions) error + +// UseDockerSchema2 is used to indicate that a schema1 manifest should be +// converted into the media types for a docker schema2 manifest. +func UseDockerSchema2() ConvertOpt { + return func(ctx context.Context, o *ConvertOptions) error { + o.ManifestMediaType = images.MediaTypeDockerSchema2Manifest + o.ConfigMediaType = images.MediaTypeDockerSchema2Config + return nil + } +} + +// Convert a docker manifest to an OCI descriptor +func (c *Converter) Convert(ctx context.Context, opts ...ConvertOpt) (ocispec.Descriptor, error) { + co := ConvertOptions{ + ManifestMediaType: ocispec.MediaTypeImageManifest, + ConfigMediaType: ocispec.MediaTypeImageConfig, + } + for _, opt := range opts { + if err := opt(ctx, &co); err != nil { + return ocispec.Descriptor{}, err + } + } + + history, diffIDs, err := c.schema1ManifestHistory() + if err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "schema 1 conversion failed") + } + + var img ocispec.Image + if err := json.Unmarshal([]byte(c.pulledManifest.History[0].V1Compatibility), &img); err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to unmarshal image from schema 1 history") + } + + img.History = history + img.RootFS = ocispec.RootFS{ + Type: "layers", + DiffIDs: diffIDs, + } + + b, err := json.MarshalIndent(img, "", " ") + if err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to marshal image") + } + + config := ocispec.Descriptor{ + MediaType: co.ConfigMediaType, + Digest: digest.Canonical.FromBytes(b), + Size: int64(len(b)), + } + + layers := make([]ocispec.Descriptor, len(diffIDs)) + for i, diffID := range diffIDs { + layers[i] = c.layerBlobs[diffID] + } + + manifest := ocispec.Manifest{ + Versioned: specs.Versioned{ + SchemaVersion: 2, + }, + Config: config, + Layers: layers, + } + + mb, err := json.MarshalIndent(manifest, "", " ") + if err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to marshal image") + } + + desc := ocispec.Descriptor{ + MediaType: co.ManifestMediaType, + Digest: digest.Canonical.FromBytes(mb), + Size: int64(len(mb)), + } + + labels := map[string]string{} + labels["containerd.io/gc.ref.content.0"] = manifest.Config.Digest.String() + for i, ch := range manifest.Layers { + labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i+1)] = ch.Digest.String() + } + + ref := remotes.MakeRefKey(ctx, desc) + if err := content.WriteBlob(ctx, c.contentStore, ref, bytes.NewReader(mb), desc, content.WithLabels(labels)); err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to write image manifest") + } + + ref = remotes.MakeRefKey(ctx, config) + if err := content.WriteBlob(ctx, c.contentStore, ref, bytes.NewReader(b), config); err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to write image config") + } + + return desc, nil +} + +// ReadStripSignature reads in a schema1 manifest and returns a byte array +// with the "signatures" field stripped +func ReadStripSignature(schema1Blob io.Reader) ([]byte, error) { + b, err := ioutil.ReadAll(io.LimitReader(schema1Blob, manifestSizeLimit)) // limit to 8MB + if err != nil { + return nil, err + } + + return stripSignature(b) +} + +func (c *Converter) fetchManifest(ctx context.Context, desc ocispec.Descriptor) error { + log.G(ctx).Debug("fetch schema 1") + + rc, err := c.fetcher.Fetch(ctx, desc) + if err != nil { + return err + } + + b, err := ReadStripSignature(rc) + rc.Close() + if err != nil { + return err + } + + var m manifest + if err := json.Unmarshal(b, &m); err != nil { + return err + } + if len(m.Manifests) != 0 || len(m.Layers) != 0 { + return errors.New("converter: expected schema1 document but found extra keys") + } + c.pulledManifest = &m + + return nil +} + +func (c *Converter) fetchBlob(ctx context.Context, desc ocispec.Descriptor) error { + log.G(ctx).Debug("fetch blob") + + var ( + ref = remotes.MakeRefKey(ctx, desc) + calc = newBlobStateCalculator() + compressMethod = compression.Gzip + ) + + // size may be unknown, set to zero for content ingest + ingestDesc := desc + if ingestDesc.Size == -1 { + ingestDesc.Size = 0 + } + + cw, err := content.OpenWriter(ctx, c.contentStore, content.WithRef(ref), content.WithDescriptor(ingestDesc)) + if err != nil { + if !errdefs.IsAlreadyExists(err) { + return err + } + + reuse, err := c.reuseLabelBlobState(ctx, desc) + if err != nil { + return err + } + + if reuse { + return nil + } + + ra, err := c.contentStore.ReaderAt(ctx, desc) + if err != nil { + return err + } + defer ra.Close() + + r, err := compression.DecompressStream(content.NewReader(ra)) + if err != nil { + return err + } + + compressMethod = r.GetCompression() + _, err = io.Copy(calc, r) + r.Close() + if err != nil { + return err + } + } else { + defer cw.Close() + + rc, err := c.fetcher.Fetch(ctx, desc) + if err != nil { + return err + } + defer rc.Close() + + eg, _ := errgroup.WithContext(ctx) + pr, pw := io.Pipe() + + eg.Go(func() error { + r, err := compression.DecompressStream(pr) + if err != nil { + return err + } + + compressMethod = r.GetCompression() + _, err = io.Copy(calc, r) + r.Close() + pr.CloseWithError(err) + return err + }) + + eg.Go(func() error { + defer pw.Close() + + return content.Copy(ctx, cw, io.TeeReader(rc, pw), ingestDesc.Size, ingestDesc.Digest) + }) + + if err := eg.Wait(); err != nil { + return err + } + } + + if desc.Size == -1 { + info, err := c.contentStore.Info(ctx, desc.Digest) + if err != nil { + return errors.Wrap(err, "failed to get blob info") + } + desc.Size = info.Size + } + + if compressMethod == compression.Uncompressed { + log.G(ctx).WithField("id", desc.Digest).Debugf("changed media type for uncompressed schema1 layer blob") + desc.MediaType = images.MediaTypeDockerSchema2Layer + } + + state := calc.State() + + cinfo := content.Info{ + Digest: desc.Digest, + Labels: map[string]string{ + "containerd.io/uncompressed": state.diffID.String(), + labelDockerSchema1EmptyLayer: strconv.FormatBool(state.empty), + }, + } + + if _, err := c.contentStore.Update(ctx, cinfo, "labels.containerd.io/uncompressed", fmt.Sprintf("labels.%s", labelDockerSchema1EmptyLayer)); err != nil { + return errors.Wrap(err, "failed to update uncompressed label") + } + + c.mu.Lock() + c.blobMap[desc.Digest] = state + c.layerBlobs[state.diffID] = desc + c.mu.Unlock() + + return nil +} + +func (c *Converter) reuseLabelBlobState(ctx context.Context, desc ocispec.Descriptor) (bool, error) { + cinfo, err := c.contentStore.Info(ctx, desc.Digest) + if err != nil { + return false, errors.Wrap(err, "failed to get blob info") + } + desc.Size = cinfo.Size + + diffID, ok := cinfo.Labels["containerd.io/uncompressed"] + if !ok { + return false, nil + } + + emptyVal, ok := cinfo.Labels[labelDockerSchema1EmptyLayer] + if !ok { + return false, nil + } + + isEmpty, err := strconv.ParseBool(emptyVal) + if err != nil { + log.G(ctx).WithField("id", desc.Digest).Warnf("failed to parse bool from label %s: %v", labelDockerSchema1EmptyLayer, isEmpty) + return false, nil + } + + bState := blobState{empty: isEmpty} + + if bState.diffID, err = digest.Parse(diffID); err != nil { + log.G(ctx).WithField("id", desc.Digest).Warnf("failed to parse digest from label containerd.io/uncompressed: %v", diffID) + return false, nil + } + + // NOTE: there is no need to read header to get compression method + // because there are only two kinds of methods. + if bState.diffID == desc.Digest { + desc.MediaType = images.MediaTypeDockerSchema2Layer + } else { + desc.MediaType = images.MediaTypeDockerSchema2LayerGzip + } + + c.mu.Lock() + c.blobMap[desc.Digest] = bState + c.layerBlobs[bState.diffID] = desc + c.mu.Unlock() + return true, nil +} + +func (c *Converter) schema1ManifestHistory() ([]ocispec.History, []digest.Digest, error) { + if c.pulledManifest == nil { + return nil, nil, errors.New("missing schema 1 manifest for conversion") + } + m := *c.pulledManifest + + if len(m.History) == 0 { + return nil, nil, errors.New("no history") + } + + history := make([]ocispec.History, len(m.History)) + diffIDs := []digest.Digest{} + for i := range m.History { + var h v1History + if err := json.Unmarshal([]byte(m.History[i].V1Compatibility), &h); err != nil { + return nil, nil, errors.Wrap(err, "failed to unmarshal history") + } + + blobSum := m.FSLayers[i].BlobSum + + state := c.blobMap[blobSum] + + history[len(history)-i-1] = ocispec.History{ + Author: h.Author, + Comment: h.Comment, + Created: &h.Created, + CreatedBy: strings.Join(h.ContainerConfig.Cmd, " "), + EmptyLayer: state.empty, + } + + if !state.empty { + diffIDs = append([]digest.Digest{state.diffID}, diffIDs...) + + } + } + + return history, diffIDs, nil +} + +type fsLayer struct { + BlobSum digest.Digest `json:"blobSum"` +} + +type history struct { + V1Compatibility string `json:"v1Compatibility"` +} + +type manifest struct { + FSLayers []fsLayer `json:"fsLayers"` + History []history `json:"history"` + Layers json.RawMessage `json:"layers,omitempty"` // OCI manifest + Manifests json.RawMessage `json:"manifests,omitempty"` // OCI index +} + +type v1History struct { + Author string `json:"author,omitempty"` + Created time.Time `json:"created"` + Comment string `json:"comment,omitempty"` + ThrowAway *bool `json:"throwaway,omitempty"` + Size *int `json:"Size,omitempty"` // used before ThrowAway field + ContainerConfig struct { + Cmd []string `json:"Cmd,omitempty"` + } `json:"container_config,omitempty"` +} + +// isEmptyLayer returns whether the v1 compatibility history describes an +// empty layer. A return value of true indicates the layer is empty, +// however false does not indicate non-empty. +func isEmptyLayer(compatHistory []byte) (bool, error) { + var h v1History + if err := json.Unmarshal(compatHistory, &h); err != nil { + return false, err + } + + if h.ThrowAway != nil { + return *h.ThrowAway, nil + } + if h.Size != nil { + return *h.Size == 0, nil + } + + // If no `Size` or `throwaway` field is given, then + // it cannot be determined whether the layer is empty + // from the history, return false + return false, nil +} + +type signature struct { + Signatures []jsParsedSignature `json:"signatures"` +} + +type jsParsedSignature struct { + Protected string `json:"protected"` +} + +type protectedBlock struct { + Length int `json:"formatLength"` + Tail string `json:"formatTail"` +} + +// joseBase64UrlDecode decodes the given string using the standard base64 url +// decoder but first adds the appropriate number of trailing '=' characters in +// accordance with the jose specification. +// http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-31#section-2 +func joseBase64UrlDecode(s string) ([]byte, error) { + switch len(s) % 4 { + case 0: + case 2: + s += "==" + case 3: + s += "=" + default: + return nil, errors.New("illegal base64url string") + } + return base64.URLEncoding.DecodeString(s) +} + +func stripSignature(b []byte) ([]byte, error) { + var sig signature + if err := json.Unmarshal(b, &sig); err != nil { + return nil, err + } + if len(sig.Signatures) == 0 { + return nil, errors.New("no signatures") + } + pb, err := joseBase64UrlDecode(sig.Signatures[0].Protected) + if err != nil { + return nil, errors.Wrapf(err, "could not decode %s", sig.Signatures[0].Protected) + } + + var protected protectedBlock + if err := json.Unmarshal(pb, &protected); err != nil { + return nil, err + } + + if protected.Length > len(b) { + return nil, errors.New("invalid protected length block") + } + + tail, err := joseBase64UrlDecode(protected.Tail) + if err != nil { + return nil, errors.Wrap(err, "invalid tail base 64 value") + } + + return append(b[:protected.Length], tail...), nil +} + +type blobStateCalculator struct { + empty bool + digester digest.Digester +} + +func newBlobStateCalculator() *blobStateCalculator { + return &blobStateCalculator{ + empty: true, + digester: digest.Canonical.Digester(), + } +} + +func (c *blobStateCalculator) Write(p []byte) (int, error) { + if c.empty { + for _, b := range p { + if b != 0x00 { + c.empty = false + break + } + } + } + return c.digester.Hash().Write(p) +} + +func (c *blobStateCalculator) State() blobState { + return blobState{ + empty: c.empty, + diffID: c.digester.Digest(), + } +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/scope.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/scope.go new file mode 100644 index 000000000..fe57f023d --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/scope.go @@ -0,0 +1,97 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "context" + "fmt" + "net/url" + "sort" + "strings" + + "github.com/containerd/containerd/reference" +) + +// RepositoryScope returns a repository scope string such as "repository:foo/bar:pull" +// for "host/foo/bar:baz". +// When push is true, both pull and push are added to the scope. +func RepositoryScope(refspec reference.Spec, push bool) (string, error) { + u, err := url.Parse("dummy://" + refspec.Locator) + if err != nil { + return "", err + } + s := "repository:" + strings.TrimPrefix(u.Path, "/") + ":pull" + if push { + s += ",push" + } + return s, nil +} + +// tokenScopesKey is used for the key for context.WithValue(). +// value: []string (e.g. {"registry:foo/bar:pull"}) +type tokenScopesKey struct{} + +// ContextWithRepositoryScope returns a context with tokenScopesKey{} and the repository scope value. +func ContextWithRepositoryScope(ctx context.Context, refspec reference.Spec, push bool) (context.Context, error) { + s, err := RepositoryScope(refspec, push) + if err != nil { + return nil, err + } + return WithScope(ctx, s), nil +} + +// WithScope appends a custom registry auth scope to the context. +func WithScope(ctx context.Context, scope string) context.Context { + var scopes []string + if v := ctx.Value(tokenScopesKey{}); v != nil { + scopes = v.([]string) + scopes = append(scopes, scope) + } else { + scopes = []string{scope} + } + return context.WithValue(ctx, tokenScopesKey{}, scopes) +} + +// ContextWithAppendPullRepositoryScope is used to append repository pull +// scope into existing scopes indexed by the tokenScopesKey{}. +func ContextWithAppendPullRepositoryScope(ctx context.Context, repo string) context.Context { + return WithScope(ctx, fmt.Sprintf("repository:%s:pull", repo)) +} + +// GetTokenScopes returns deduplicated and sorted scopes from ctx.Value(tokenScopesKey{}) and common scopes. +func GetTokenScopes(ctx context.Context, common []string) []string { + var scopes []string + if x := ctx.Value(tokenScopesKey{}); x != nil { + scopes = append(scopes, x.([]string)...) + } + + scopes = append(scopes, common...) + sort.Strings(scopes) + + l := 0 + for idx := 1; idx < len(scopes); idx++ { + // Note: this comparison is unaware of the scope grammar (https://docs.docker.com/registry/spec/auth/scope/) + // So, "repository:foo/bar:pull,push" != "repository:foo/bar:push,pull", although semantically they are equal. + if scopes[l] == scopes[idx] { + continue + } + + l++ + scopes[l] = scopes[idx] + } + return scopes[:l+1] +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/docker/status.go b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/status.go new file mode 100644 index 000000000..9751edac7 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/docker/status.go @@ -0,0 +1,87 @@ +/* + Copyright The containerd Authors. + + 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 docker + +import ( + "sync" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/errdefs" + "github.com/moby/locker" + "github.com/pkg/errors" +) + +// Status of a content operation +type Status struct { + content.Status + + Committed bool + + // UploadUUID is used by the Docker registry to reference blob uploads + UploadUUID string +} + +// StatusTracker to track status of operations +type StatusTracker interface { + GetStatus(string) (Status, error) + SetStatus(string, Status) +} + +// StatusTrackLocker to track status of operations with lock +type StatusTrackLocker interface { + StatusTracker + Lock(string) + Unlock(string) +} + +type memoryStatusTracker struct { + statuses map[string]Status + m sync.Mutex + locker *locker.Locker +} + +// NewInMemoryTracker returns a StatusTracker that tracks content status in-memory +func NewInMemoryTracker() StatusTrackLocker { + return &memoryStatusTracker{ + statuses: map[string]Status{}, + locker: locker.New(), + } +} + +func (t *memoryStatusTracker) GetStatus(ref string) (Status, error) { + t.m.Lock() + defer t.m.Unlock() + status, ok := t.statuses[ref] + if !ok { + return Status{}, errors.Wrapf(errdefs.ErrNotFound, "status for ref %v", ref) + } + return status, nil +} + +func (t *memoryStatusTracker) SetStatus(ref string, status Status) { + t.m.Lock() + t.statuses[ref] = status + t.m.Unlock() +} + +func (t *memoryStatusTracker) Lock(ref string) { + t.locker.Lock(ref) +} + +func (t *memoryStatusTracker) Unlock(ref string) { + t.locker.Unlock(ref) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/errors/errors.go b/integration-test/vendor/github.com/containerd/containerd/remotes/errors/errors.go new file mode 100644 index 000000000..519dbac10 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/errors/errors.go @@ -0,0 +1,56 @@ +/* + Copyright The containerd Authors. + + 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 errors + +import ( + "fmt" + "io" + "io/ioutil" + "net/http" +) + +var _ error = ErrUnexpectedStatus{} + +// ErrUnexpectedStatus is returned if a registry API request returned with unexpected HTTP status +type ErrUnexpectedStatus struct { + Status string + StatusCode int + Body []byte + RequestURL, RequestMethod string +} + +func (e ErrUnexpectedStatus) Error() string { + return fmt.Sprintf("unexpected status: %s", e.Status) +} + +// NewUnexpectedStatusErr creates an ErrUnexpectedStatus from HTTP response +func NewUnexpectedStatusErr(resp *http.Response) error { + var b []byte + if resp.Body != nil { + b, _ = ioutil.ReadAll(io.LimitReader(resp.Body, 64000)) // 64KB + } + err := ErrUnexpectedStatus{ + Body: b, + Status: resp.Status, + StatusCode: resp.StatusCode, + RequestMethod: resp.Request.Method, + } + if resp.Request.URL != nil { + err.RequestURL = resp.Request.URL.String() + } + return err +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/handlers.go b/integration-test/vendor/github.com/containerd/containerd/remotes/handlers.go new file mode 100644 index 000000000..8f79c608e --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/handlers.go @@ -0,0 +1,331 @@ +/* + Copyright The containerd Authors. + + 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 remotes + +import ( + "context" + "fmt" + "io" + "strings" + "sync" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/platforms" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "golang.org/x/sync/semaphore" +) + +type refKeyPrefix struct{} + +// WithMediaTypeKeyPrefix adds a custom key prefix for a media type which is used when storing +// data in the content store from the FetchHandler. +// +// Used in `MakeRefKey` to determine what the key prefix should be. +func WithMediaTypeKeyPrefix(ctx context.Context, mediaType, prefix string) context.Context { + var values map[string]string + if v := ctx.Value(refKeyPrefix{}); v != nil { + values = v.(map[string]string) + } else { + values = make(map[string]string) + } + + values[mediaType] = prefix + return context.WithValue(ctx, refKeyPrefix{}, values) +} + +// MakeRefKey returns a unique reference for the descriptor. This reference can be +// used to lookup ongoing processes related to the descriptor. This function +// may look to the context to namespace the reference appropriately. +func MakeRefKey(ctx context.Context, desc ocispec.Descriptor) string { + key := desc.Digest.String() + if desc.Annotations != nil { + if name, ok := desc.Annotations[ocispec.AnnotationRefName]; ok { + key = fmt.Sprintf("%s@%s", name, desc.Digest.String()) + } + } + + if v := ctx.Value(refKeyPrefix{}); v != nil { + values := v.(map[string]string) + if prefix := values[desc.MediaType]; prefix != "" { + return prefix + "-" + key + } + } + + switch mt := desc.MediaType; { + case mt == images.MediaTypeDockerSchema2Manifest || mt == ocispec.MediaTypeImageManifest: + return "manifest-" + key + case mt == images.MediaTypeDockerSchema2ManifestList || mt == ocispec.MediaTypeImageIndex: + return "index-" + key + case images.IsLayerType(mt): + return "layer-" + key + case images.IsKnownConfig(mt): + return "config-" + key + default: + log.G(ctx).Warnf("reference for unknown type: %s", mt) + return "unknown-" + key + } +} + +// FetchHandler returns a handler that will fetch all content into the ingester +// discovered in a call to Dispatch. Use with ChildrenHandler to do a full +// recursive fetch. +func FetchHandler(ingester content.Ingester, fetcher Fetcher) images.HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) { + ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{ + "digest": desc.Digest, + "mediatype": desc.MediaType, + "size": desc.Size, + })) + + switch desc.MediaType { + case images.MediaTypeDockerSchema1Manifest: + return nil, fmt.Errorf("%v not supported", desc.MediaType) + default: + err := fetch(ctx, ingester, fetcher, desc) + return nil, err + } + } +} + +func fetch(ctx context.Context, ingester content.Ingester, fetcher Fetcher, desc ocispec.Descriptor) error { + log.G(ctx).Debug("fetch") + + cw, err := content.OpenWriter(ctx, ingester, content.WithRef(MakeRefKey(ctx, desc)), content.WithDescriptor(desc)) + if err != nil { + if errdefs.IsAlreadyExists(err) { + return nil + } + return err + } + defer cw.Close() + + ws, err := cw.Status() + if err != nil { + return err + } + + if desc.Size == 0 { + // most likely a poorly configured registry/web front end which responded with no + // Content-Length header; unable (not to mention useless) to commit a 0-length entry + // into the content store. Error out here otherwise the error sent back is confusing + return errors.Wrapf(errdefs.ErrInvalidArgument, "unable to fetch descriptor (%s) which reports content size of zero", desc.Digest) + } + if ws.Offset == desc.Size { + // If writer is already complete, commit and return + err := cw.Commit(ctx, desc.Size, desc.Digest) + if err != nil && !errdefs.IsAlreadyExists(err) { + return errors.Wrapf(err, "failed commit on ref %q", ws.Ref) + } + return nil + } + + rc, err := fetcher.Fetch(ctx, desc) + if err != nil { + return err + } + defer rc.Close() + + return content.Copy(ctx, cw, rc, desc.Size, desc.Digest) +} + +// PushHandler returns a handler that will push all content from the provider +// using a writer from the pusher. +func PushHandler(pusher Pusher, provider content.Provider) images.HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{ + "digest": desc.Digest, + "mediatype": desc.MediaType, + "size": desc.Size, + })) + + err := push(ctx, provider, pusher, desc) + return nil, err + } +} + +func push(ctx context.Context, provider content.Provider, pusher Pusher, desc ocispec.Descriptor) error { + log.G(ctx).Debug("push") + + var ( + cw content.Writer + err error + ) + if cs, ok := pusher.(content.Ingester); ok { + cw, err = content.OpenWriter(ctx, cs, content.WithRef(MakeRefKey(ctx, desc)), content.WithDescriptor(desc)) + } else { + cw, err = pusher.Push(ctx, desc) + } + if err != nil { + if !errdefs.IsAlreadyExists(err) { + return err + } + + return nil + } + defer cw.Close() + + ra, err := provider.ReaderAt(ctx, desc) + if err != nil { + return err + } + defer ra.Close() + + rd := io.NewSectionReader(ra, 0, desc.Size) + return content.Copy(ctx, cw, rd, desc.Size, desc.Digest) +} + +// PushContent pushes content specified by the descriptor from the provider. +// +// Base handlers can be provided which will be called before any push specific +// handlers. +func PushContent(ctx context.Context, pusher Pusher, desc ocispec.Descriptor, store content.Store, limiter *semaphore.Weighted, platform platforms.MatchComparer, wrapper func(h images.Handler) images.Handler) error { + + var m sync.Mutex + manifestStack := []ocispec.Descriptor{} + + filterHandler := images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + switch desc.MediaType { + case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest, + images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + m.Lock() + manifestStack = append(manifestStack, desc) + m.Unlock() + return nil, images.ErrStopHandler + default: + return nil, nil + } + }) + + pushHandler := PushHandler(pusher, store) + + platformFilterhandler := images.FilterPlatforms(images.ChildrenHandler(store), platform) + + annotateHandler := annotateDistributionSourceHandler(platformFilterhandler, store) + + var handler images.Handler = images.Handlers( + annotateHandler, + filterHandler, + pushHandler, + ) + if wrapper != nil { + handler = wrapper(handler) + } + + if err := images.Dispatch(ctx, handler, limiter, desc); err != nil { + return err + } + + // Iterate in reverse order as seen, parent always uploaded after child + for i := len(manifestStack) - 1; i >= 0; i-- { + _, err := pushHandler(ctx, manifestStack[i]) + if err != nil { + // TODO(estesp): until we have a more complete method for index push, we need to report + // missing dependencies in an index/manifest list by sensing the "400 Bad Request" + // as a marker for this problem + if (manifestStack[i].MediaType == ocispec.MediaTypeImageIndex || + manifestStack[i].MediaType == images.MediaTypeDockerSchema2ManifestList) && + errors.Cause(err) != nil && strings.Contains(errors.Cause(err).Error(), "400 Bad Request") { + return errors.Wrap(err, "manifest list/index references to blobs and/or manifests are missing in your target registry") + } + return err + } + } + + return nil +} + +// FilterManifestByPlatformHandler allows Handler to handle non-target +// platform's manifest and configuration data. +func FilterManifestByPlatformHandler(f images.HandlerFunc, m platforms.Matcher) images.HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + children, err := f(ctx, desc) + if err != nil { + return nil, err + } + + // no platform information + if desc.Platform == nil || m == nil { + return children, nil + } + + var descs []ocispec.Descriptor + switch desc.MediaType { + case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: + if m.Match(*desc.Platform) { + descs = children + } else { + for _, child := range children { + if child.MediaType == images.MediaTypeDockerSchema2Config || + child.MediaType == ocispec.MediaTypeImageConfig { + + descs = append(descs, child) + } + } + } + default: + descs = children + } + return descs, nil + } +} + +// annotateDistributionSourceHandler add distribution source label into +// annotation of config or blob descriptor. +func annotateDistributionSourceHandler(f images.HandlerFunc, manager content.Manager) images.HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + children, err := f(ctx, desc) + if err != nil { + return nil, err + } + + // only add distribution source for the config or blob data descriptor + switch desc.MediaType { + case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest, + images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + default: + return children, nil + } + + for i := range children { + child := children[i] + + info, err := manager.Info(ctx, child.Digest) + if err != nil { + return nil, err + } + + for k, v := range info.Labels { + if !strings.HasPrefix(k, "containerd.io/distribution.source.") { + continue + } + + if child.Annotations == nil { + child.Annotations = map[string]string{} + } + child.Annotations[k] = v + } + + children[i] = child + } + return children, nil + } +} diff --git a/integration-test/vendor/github.com/containerd/containerd/remotes/resolver.go b/integration-test/vendor/github.com/containerd/containerd/remotes/resolver.go new file mode 100644 index 000000000..624b14f05 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/remotes/resolver.go @@ -0,0 +1,82 @@ +/* + Copyright The containerd Authors. + + 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 remotes + +import ( + "context" + "io" + + "github.com/containerd/containerd/content" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// Resolver provides remotes based on a locator. +type Resolver interface { + // Resolve attempts to resolve the reference into a name and descriptor. + // + // The argument `ref` should be a scheme-less URI representing the remote. + // Structurally, it has a host and path. The "host" can be used to directly + // reference a specific host or be matched against a specific handler. + // + // The returned name should be used to identify the referenced entity. + // Dependending on the remote namespace, this may be immutable or mutable. + // While the name may differ from ref, it should itself be a valid ref. + // + // If the resolution fails, an error will be returned. + Resolve(ctx context.Context, ref string) (name string, desc ocispec.Descriptor, err error) + + // Fetcher returns a new fetcher for the provided reference. + // All content fetched from the returned fetcher will be + // from the namespace referred to by ref. + Fetcher(ctx context.Context, ref string) (Fetcher, error) + + // Pusher returns a new pusher for the provided reference + // The returned Pusher should satisfy content.Ingester and concurrent attempts + // to push the same blob using the Ingester API should result in ErrUnavailable. + Pusher(ctx context.Context, ref string) (Pusher, error) +} + +// Fetcher fetches content +type Fetcher interface { + // Fetch the resource identified by the descriptor. + Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error) +} + +// Pusher pushes content +type Pusher interface { + // Push returns a content writer for the given resource identified + // by the descriptor. + Push(ctx context.Context, d ocispec.Descriptor) (content.Writer, error) +} + +// FetcherFunc allows package users to implement a Fetcher with just a +// function. +type FetcherFunc func(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error) + +// Fetch content +func (fn FetcherFunc) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error) { + return fn(ctx, desc) +} + +// PusherFunc allows package users to implement a Pusher with just a +// function. +type PusherFunc func(ctx context.Context, desc ocispec.Descriptor) (content.Writer, error) + +// Push content +func (fn PusherFunc) Push(ctx context.Context, desc ocispec.Descriptor) (content.Writer, error) { + return fn(ctx, desc) +} diff --git a/integration-test/vendor/github.com/containerd/containerd/version/version.go b/integration-test/vendor/github.com/containerd/containerd/version/version.go new file mode 100644 index 000000000..73857aef8 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/containerd/version/version.go @@ -0,0 +1,34 @@ +/* + Copyright The containerd Authors. + + 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 version + +import "runtime" + +var ( + // Package is filled at linking time + Package = "github.com/containerd/containerd" + + // Version holds the complete version number. Filled in at linking time. + Version = "1.5.10+unknown" + + // Revision is filled with the VCS (e.g. git) revision being used to build + // the program at linking time. + Revision = "" + + // GoVersion is Go tree's version. + GoVersion = runtime.Version() +) diff --git a/integration-test/vendor/github.com/containerd/continuity/AUTHORS b/integration-test/vendor/github.com/containerd/continuity/AUTHORS new file mode 100644 index 000000000..deef28c1d --- /dev/null +++ b/integration-test/vendor/github.com/containerd/continuity/AUTHORS @@ -0,0 +1,44 @@ +Aaron Lehmann +Akash Gupta +Akihiro Suda +Akihiro Suda +Akihiro Suda +Andrew Pennebaker +Brandon Philips +Brian Goff +Christopher Jones +Daniel, Dao Quang Minh +Darren Stahl +Derek McGowan +Derek McGowan +Edward Pilatowicz +Fu Wei +Hajime Tazaki +Ian Campbell +Ivan Markin +Jacob Blain Christen +Justin Cormack +Justin Cummins +Kasper Fabæch Brandt +Kir Kolyshkin +Michael Crosby +Michael Crosby +Michael Wan +Mike Brown +Niels de Vos +Phil Estes +Phil Estes +Phil Estes +Sam Whited +Samuel Karp +Sebastiaan van Stijn +Shengjing Zhu +Stephen J Day +Tibor Vass +Tobias Klauser +Tom Faulhaber +Tonis Tiigi +Trevor Porter +Wei Fu +Wilbert van de Ridder +Xiaodong Ye diff --git a/integration-test/vendor/github.com/containerd/continuity/LICENSE b/integration-test/vendor/github.com/containerd/continuity/LICENSE new file mode 100644 index 000000000..584149b6e --- /dev/null +++ b/integration-test/vendor/github.com/containerd/continuity/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://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 + + Copyright The containerd Authors + + 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 + + https://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. diff --git a/integration-test/vendor/github.com/containerd/continuity/pathdriver/path_driver.go b/integration-test/vendor/github.com/containerd/continuity/pathdriver/path_driver.go new file mode 100644 index 000000000..b0d5a6b56 --- /dev/null +++ b/integration-test/vendor/github.com/containerd/continuity/pathdriver/path_driver.go @@ -0,0 +1,101 @@ +/* + Copyright The containerd Authors. + + 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 pathdriver + +import ( + "path/filepath" +) + +// PathDriver provides all of the path manipulation functions in a common +// interface. The context should call these and never use the `filepath` +// package or any other package to manipulate paths. +type PathDriver interface { + Join(paths ...string) string + IsAbs(path string) bool + Rel(base, target string) (string, error) + Base(path string) string + Dir(path string) string + Clean(path string) string + Split(path string) (dir, file string) + Separator() byte + Abs(path string) (string, error) + Walk(string, filepath.WalkFunc) error + FromSlash(path string) string + ToSlash(path string) string + Match(pattern, name string) (matched bool, err error) +} + +// pathDriver is a simple default implementation calls the filepath package. +type pathDriver struct{} + +// LocalPathDriver is the exported pathDriver struct for convenience. +var LocalPathDriver PathDriver = &pathDriver{} + +func (*pathDriver) Join(paths ...string) string { + return filepath.Join(paths...) +} + +func (*pathDriver) IsAbs(path string) bool { + return filepath.IsAbs(path) +} + +func (*pathDriver) Rel(base, target string) (string, error) { + return filepath.Rel(base, target) +} + +func (*pathDriver) Base(path string) string { + return filepath.Base(path) +} + +func (*pathDriver) Dir(path string) string { + return filepath.Dir(path) +} + +func (*pathDriver) Clean(path string) string { + return filepath.Clean(path) +} + +func (*pathDriver) Split(path string) (dir, file string) { + return filepath.Split(path) +} + +func (*pathDriver) Separator() byte { + return filepath.Separator +} + +func (*pathDriver) Abs(path string) (string, error) { + return filepath.Abs(path) +} + +// Note that filepath.Walk calls os.Stat, so if the context wants to +// to call Driver.Stat() for Walk, they need to create a new struct that +// overrides this method. +func (*pathDriver) Walk(root string, walkFn filepath.WalkFunc) error { + return filepath.Walk(root, walkFn) +} + +func (*pathDriver) FromSlash(path string) string { + return filepath.FromSlash(path) +} + +func (*pathDriver) ToSlash(path string) string { + return filepath.ToSlash(path) +} + +func (*pathDriver) Match(pattern, name string) (bool, error) { + return filepath.Match(pattern, name) +} diff --git a/integration-test/vendor/github.com/davecgh/go-spew/LICENSE b/integration-test/vendor/github.com/davecgh/go-spew/LICENSE new file mode 100644 index 000000000..bc52e96f2 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2012-2016 Dave Collins + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/integration-test/vendor/github.com/davecgh/go-spew/spew/bypass.go b/integration-test/vendor/github.com/davecgh/go-spew/spew/bypass.go new file mode 100644 index 000000000..792994785 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -0,0 +1,145 @@ +// Copyright (c) 2015-2016 Dave Collins +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +// NOTE: Due to the following build constraints, this file will only be compiled +// when the code is not running on Google App Engine, compiled by GopherJS, and +// "-tags safe" is not added to the go build command line. The "disableunsafe" +// tag is deprecated and thus should not be used. +// Go versions prior to 1.4 are disabled because they use a different layout +// for interfaces which make the implementation of unsafeReflectValue more complex. +// +build !js,!appengine,!safe,!disableunsafe,go1.4 + +package spew + +import ( + "reflect" + "unsafe" +) + +const ( + // UnsafeDisabled is a build-time constant which specifies whether or + // not access to the unsafe package is available. + UnsafeDisabled = false + + // ptrSize is the size of a pointer on the current arch. + ptrSize = unsafe.Sizeof((*byte)(nil)) +) + +type flag uintptr + +var ( + // flagRO indicates whether the value field of a reflect.Value + // is read-only. + flagRO flag + + // flagAddr indicates whether the address of the reflect.Value's + // value may be taken. + flagAddr flag +) + +// flagKindMask holds the bits that make up the kind +// part of the flags field. In all the supported versions, +// it is in the lower 5 bits. +const flagKindMask = flag(0x1f) + +// Different versions of Go have used different +// bit layouts for the flags type. This table +// records the known combinations. +var okFlags = []struct { + ro, addr flag +}{{ + // From Go 1.4 to 1.5 + ro: 1 << 5, + addr: 1 << 7, +}, { + // Up to Go tip. + ro: 1<<5 | 1<<6, + addr: 1 << 8, +}} + +var flagValOffset = func() uintptr { + field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") + if !ok { + panic("reflect.Value has no flag field") + } + return field.Offset +}() + +// flagField returns a pointer to the flag field of a reflect.Value. +func flagField(v *reflect.Value) *flag { + return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) +} + +// unsafeReflectValue converts the passed reflect.Value into a one that bypasses +// the typical safety restrictions preventing access to unaddressable and +// unexported data. It works by digging the raw pointer to the underlying +// value out of the protected value and generating a new unprotected (unsafe) +// reflect.Value to it. +// +// This allows us to check for implementations of the Stringer and error +// interfaces to be used for pretty printing ordinarily unaddressable and +// inaccessible values such as unexported struct fields. +func unsafeReflectValue(v reflect.Value) reflect.Value { + if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { + return v + } + flagFieldPtr := flagField(&v) + *flagFieldPtr &^= flagRO + *flagFieldPtr |= flagAddr + return v +} + +// Sanity checks against future reflect package changes +// to the type or semantics of the Value.flag field. +func init() { + field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") + if !ok { + panic("reflect.Value has no flag field") + } + if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { + panic("reflect.Value flag field has changed kind") + } + type t0 int + var t struct { + A t0 + // t0 will have flagEmbedRO set. + t0 + // a will have flagStickyRO set + a t0 + } + vA := reflect.ValueOf(t).FieldByName("A") + va := reflect.ValueOf(t).FieldByName("a") + vt0 := reflect.ValueOf(t).FieldByName("t0") + + // Infer flagRO from the difference between the flags + // for the (otherwise identical) fields in t. + flagPublic := *flagField(&vA) + flagWithRO := *flagField(&va) | *flagField(&vt0) + flagRO = flagPublic ^ flagWithRO + + // Infer flagAddr from the difference between a value + // taken from a pointer and not. + vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") + flagNoPtr := *flagField(&vA) + flagPtr := *flagField(&vPtrA) + flagAddr = flagNoPtr ^ flagPtr + + // Check that the inferred flags tally with one of the known versions. + for _, f := range okFlags { + if flagRO == f.ro && flagAddr == f.addr { + return + } + } + panic("reflect.Value read-only flag has changed semantics") +} diff --git a/integration-test/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/integration-test/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go new file mode 100644 index 000000000..205c28d68 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -0,0 +1,38 @@ +// Copyright (c) 2015-2016 Dave Collins +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +// NOTE: Due to the following build constraints, this file will only be compiled +// when the code is running on Google App Engine, compiled by GopherJS, or +// "-tags safe" is added to the go build command line. The "disableunsafe" +// tag is deprecated and thus should not be used. +// +build js appengine safe disableunsafe !go1.4 + +package spew + +import "reflect" + +const ( + // UnsafeDisabled is a build-time constant which specifies whether or + // not access to the unsafe package is available. + UnsafeDisabled = true +) + +// unsafeReflectValue typically converts the passed reflect.Value into a one +// that bypasses the typical safety restrictions preventing access to +// unaddressable and unexported data. However, doing this relies on access to +// the unsafe package. This is a stub version which simply returns the passed +// reflect.Value when the unsafe package is not available. +func unsafeReflectValue(v reflect.Value) reflect.Value { + return v +} diff --git a/integration-test/vendor/github.com/davecgh/go-spew/spew/common.go b/integration-test/vendor/github.com/davecgh/go-spew/spew/common.go new file mode 100644 index 000000000..1be8ce945 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/spew/common.go @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "io" + "reflect" + "sort" + "strconv" +) + +// Some constants in the form of bytes to avoid string overhead. This mirrors +// the technique used in the fmt package. +var ( + panicBytes = []byte("(PANIC=") + plusBytes = []byte("+") + iBytes = []byte("i") + trueBytes = []byte("true") + falseBytes = []byte("false") + interfaceBytes = []byte("(interface {})") + commaNewlineBytes = []byte(",\n") + newlineBytes = []byte("\n") + openBraceBytes = []byte("{") + openBraceNewlineBytes = []byte("{\n") + closeBraceBytes = []byte("}") + asteriskBytes = []byte("*") + colonBytes = []byte(":") + colonSpaceBytes = []byte(": ") + openParenBytes = []byte("(") + closeParenBytes = []byte(")") + spaceBytes = []byte(" ") + pointerChainBytes = []byte("->") + nilAngleBytes = []byte("") + maxNewlineBytes = []byte("\n") + maxShortBytes = []byte("") + circularBytes = []byte("") + circularShortBytes = []byte("") + invalidAngleBytes = []byte("") + openBracketBytes = []byte("[") + closeBracketBytes = []byte("]") + percentBytes = []byte("%") + precisionBytes = []byte(".") + openAngleBytes = []byte("<") + closeAngleBytes = []byte(">") + openMapBytes = []byte("map[") + closeMapBytes = []byte("]") + lenEqualsBytes = []byte("len=") + capEqualsBytes = []byte("cap=") +) + +// hexDigits is used to map a decimal value to a hex digit. +var hexDigits = "0123456789abcdef" + +// catchPanic handles any panics that might occur during the handleMethods +// calls. +func catchPanic(w io.Writer, v reflect.Value) { + if err := recover(); err != nil { + w.Write(panicBytes) + fmt.Fprintf(w, "%v", err) + w.Write(closeParenBytes) + } +} + +// handleMethods attempts to call the Error and String methods on the underlying +// type the passed reflect.Value represents and outputes the result to Writer w. +// +// It handles panics in any called methods by catching and displaying the error +// as the formatted value. +func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { + // We need an interface to check if the type implements the error or + // Stringer interface. However, the reflect package won't give us an + // interface on certain things like unexported struct fields in order + // to enforce visibility rules. We use unsafe, when it's available, + // to bypass these restrictions since this package does not mutate the + // values. + if !v.CanInterface() { + if UnsafeDisabled { + return false + } + + v = unsafeReflectValue(v) + } + + // Choose whether or not to do error and Stringer interface lookups against + // the base type or a pointer to the base type depending on settings. + // Technically calling one of these methods with a pointer receiver can + // mutate the value, however, types which choose to satisify an error or + // Stringer interface with a pointer receiver should not be mutating their + // state inside these interface methods. + if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { + v = unsafeReflectValue(v) + } + if v.CanAddr() { + v = v.Addr() + } + + // Is it an error or Stringer? + switch iface := v.Interface().(type) { + case error: + defer catchPanic(w, v) + if cs.ContinueOnMethod { + w.Write(openParenBytes) + w.Write([]byte(iface.Error())) + w.Write(closeParenBytes) + w.Write(spaceBytes) + return false + } + + w.Write([]byte(iface.Error())) + return true + + case fmt.Stringer: + defer catchPanic(w, v) + if cs.ContinueOnMethod { + w.Write(openParenBytes) + w.Write([]byte(iface.String())) + w.Write(closeParenBytes) + w.Write(spaceBytes) + return false + } + w.Write([]byte(iface.String())) + return true + } + return false +} + +// printBool outputs a boolean value as true or false to Writer w. +func printBool(w io.Writer, val bool) { + if val { + w.Write(trueBytes) + } else { + w.Write(falseBytes) + } +} + +// printInt outputs a signed integer value to Writer w. +func printInt(w io.Writer, val int64, base int) { + w.Write([]byte(strconv.FormatInt(val, base))) +} + +// printUint outputs an unsigned integer value to Writer w. +func printUint(w io.Writer, val uint64, base int) { + w.Write([]byte(strconv.FormatUint(val, base))) +} + +// printFloat outputs a floating point value using the specified precision, +// which is expected to be 32 or 64bit, to Writer w. +func printFloat(w io.Writer, val float64, precision int) { + w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) +} + +// printComplex outputs a complex value using the specified float precision +// for the real and imaginary parts to Writer w. +func printComplex(w io.Writer, c complex128, floatPrecision int) { + r := real(c) + w.Write(openParenBytes) + w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) + i := imag(c) + if i >= 0 { + w.Write(plusBytes) + } + w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) + w.Write(iBytes) + w.Write(closeParenBytes) +} + +// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' +// prefix to Writer w. +func printHexPtr(w io.Writer, p uintptr) { + // Null pointer. + num := uint64(p) + if num == 0 { + w.Write(nilAngleBytes) + return + } + + // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix + buf := make([]byte, 18) + + // It's simpler to construct the hex string right to left. + base := uint64(16) + i := len(buf) - 1 + for num >= base { + buf[i] = hexDigits[num%base] + num /= base + i-- + } + buf[i] = hexDigits[num] + + // Add '0x' prefix. + i-- + buf[i] = 'x' + i-- + buf[i] = '0' + + // Strip unused leading bytes. + buf = buf[i:] + w.Write(buf) +} + +// valuesSorter implements sort.Interface to allow a slice of reflect.Value +// elements to be sorted. +type valuesSorter struct { + values []reflect.Value + strings []string // either nil or same len and values + cs *ConfigState +} + +// newValuesSorter initializes a valuesSorter instance, which holds a set of +// surrogate keys on which the data should be sorted. It uses flags in +// ConfigState to decide if and how to populate those surrogate keys. +func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { + vs := &valuesSorter{values: values, cs: cs} + if canSortSimply(vs.values[0].Kind()) { + return vs + } + if !cs.DisableMethods { + vs.strings = make([]string, len(values)) + for i := range vs.values { + b := bytes.Buffer{} + if !handleMethods(cs, &b, vs.values[i]) { + vs.strings = nil + break + } + vs.strings[i] = b.String() + } + } + if vs.strings == nil && cs.SpewKeys { + vs.strings = make([]string, len(values)) + for i := range vs.values { + vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) + } + } + return vs +} + +// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted +// directly, or whether it should be considered for sorting by surrogate keys +// (if the ConfigState allows it). +func canSortSimply(kind reflect.Kind) bool { + // This switch parallels valueSortLess, except for the default case. + switch kind { + case reflect.Bool: + return true + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + return true + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + return true + case reflect.Float32, reflect.Float64: + return true + case reflect.String: + return true + case reflect.Uintptr: + return true + case reflect.Array: + return true + } + return false +} + +// Len returns the number of values in the slice. It is part of the +// sort.Interface implementation. +func (s *valuesSorter) Len() int { + return len(s.values) +} + +// Swap swaps the values at the passed indices. It is part of the +// sort.Interface implementation. +func (s *valuesSorter) Swap(i, j int) { + s.values[i], s.values[j] = s.values[j], s.values[i] + if s.strings != nil { + s.strings[i], s.strings[j] = s.strings[j], s.strings[i] + } +} + +// valueSortLess returns whether the first value should sort before the second +// value. It is used by valueSorter.Less as part of the sort.Interface +// implementation. +func valueSortLess(a, b reflect.Value) bool { + switch a.Kind() { + case reflect.Bool: + return !a.Bool() && b.Bool() + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + return a.Int() < b.Int() + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + return a.Uint() < b.Uint() + case reflect.Float32, reflect.Float64: + return a.Float() < b.Float() + case reflect.String: + return a.String() < b.String() + case reflect.Uintptr: + return a.Uint() < b.Uint() + case reflect.Array: + // Compare the contents of both arrays. + l := a.Len() + for i := 0; i < l; i++ { + av := a.Index(i) + bv := b.Index(i) + if av.Interface() == bv.Interface() { + continue + } + return valueSortLess(av, bv) + } + } + return a.String() < b.String() +} + +// Less returns whether the value at index i should sort before the +// value at index j. It is part of the sort.Interface implementation. +func (s *valuesSorter) Less(i, j int) bool { + if s.strings == nil { + return valueSortLess(s.values[i], s.values[j]) + } + return s.strings[i] < s.strings[j] +} + +// sortValues is a sort function that handles both native types and any type that +// can be converted to error or Stringer. Other inputs are sorted according to +// their Value.String() value to ensure display stability. +func sortValues(values []reflect.Value, cs *ConfigState) { + if len(values) == 0 { + return + } + sort.Sort(newValuesSorter(values, cs)) +} diff --git a/integration-test/vendor/github.com/davecgh/go-spew/spew/config.go b/integration-test/vendor/github.com/davecgh/go-spew/spew/config.go new file mode 100644 index 000000000..2e3d22f31 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/spew/config.go @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "io" + "os" +) + +// ConfigState houses the configuration options used by spew to format and +// display values. There is a global instance, Config, that is used to control +// all top-level Formatter and Dump functionality. Each ConfigState instance +// provides methods equivalent to the top-level functions. +// +// The zero value for ConfigState provides no indentation. You would typically +// want to set it to a space or a tab. +// +// Alternatively, you can use NewDefaultConfig to get a ConfigState instance +// with default settings. See the documentation of NewDefaultConfig for default +// values. +type ConfigState struct { + // Indent specifies the string to use for each indentation level. The + // global config instance that all top-level functions use set this to a + // single space by default. If you would like more indentation, you might + // set this to a tab with "\t" or perhaps two spaces with " ". + Indent string + + // MaxDepth controls the maximum number of levels to descend into nested + // data structures. The default, 0, means there is no limit. + // + // NOTE: Circular data structures are properly detected, so it is not + // necessary to set this value unless you specifically want to limit deeply + // nested data structures. + MaxDepth int + + // DisableMethods specifies whether or not error and Stringer interfaces are + // invoked for types that implement them. + DisableMethods bool + + // DisablePointerMethods specifies whether or not to check for and invoke + // error and Stringer interfaces on types which only accept a pointer + // receiver when the current type is not a pointer. + // + // NOTE: This might be an unsafe action since calling one of these methods + // with a pointer receiver could technically mutate the value, however, + // in practice, types which choose to satisify an error or Stringer + // interface with a pointer receiver should not be mutating their state + // inside these interface methods. As a result, this option relies on + // access to the unsafe package, so it will not have any effect when + // running in environments without access to the unsafe package such as + // Google App Engine or with the "safe" build tag specified. + DisablePointerMethods bool + + // DisablePointerAddresses specifies whether to disable the printing of + // pointer addresses. This is useful when diffing data structures in tests. + DisablePointerAddresses bool + + // DisableCapacities specifies whether to disable the printing of capacities + // for arrays, slices, maps and channels. This is useful when diffing + // data structures in tests. + DisableCapacities bool + + // ContinueOnMethod specifies whether or not recursion should continue once + // a custom error or Stringer interface is invoked. The default, false, + // means it will print the results of invoking the custom error or Stringer + // interface and return immediately instead of continuing to recurse into + // the internals of the data type. + // + // NOTE: This flag does not have any effect if method invocation is disabled + // via the DisableMethods or DisablePointerMethods options. + ContinueOnMethod bool + + // SortKeys specifies map keys should be sorted before being printed. Use + // this to have a more deterministic, diffable output. Note that only + // native types (bool, int, uint, floats, uintptr and string) and types + // that support the error or Stringer interfaces (if methods are + // enabled) are supported, with other types sorted according to the + // reflect.Value.String() output which guarantees display stability. + SortKeys bool + + // SpewKeys specifies that, as a last resort attempt, map keys should + // be spewed to strings and sorted by those strings. This is only + // considered if SortKeys is true. + SpewKeys bool +} + +// Config is the active configuration of the top-level functions. +// The configuration can be changed by modifying the contents of spew.Config. +var Config = ConfigState{Indent: " "} + +// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the formatted string as a value that satisfies error. See NewFormatter +// for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { + return fmt.Errorf(format, c.convertArgs(a)...) +} + +// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprint(w, c.convertArgs(a)...) +} + +// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { + return fmt.Fprintf(w, format, c.convertArgs(a)...) +} + +// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it +// passed with a Formatter interface returned by c.NewFormatter. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprintln(w, c.convertArgs(a)...) +} + +// Print is a wrapper for fmt.Print that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Print(a ...interface{}) (n int, err error) { + return fmt.Print(c.convertArgs(a)...) +} + +// Printf is a wrapper for fmt.Printf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { + return fmt.Printf(format, c.convertArgs(a)...) +} + +// Println is a wrapper for fmt.Println that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Println(a ...interface{}) (n int, err error) { + return fmt.Println(c.convertArgs(a)...) +} + +// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprint(a ...interface{}) string { + return fmt.Sprint(c.convertArgs(a)...) +} + +// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprintf(format string, a ...interface{}) string { + return fmt.Sprintf(format, c.convertArgs(a)...) +} + +// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it +// were passed with a Formatter interface returned by c.NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprintln(a ...interface{}) string { + return fmt.Sprintln(c.convertArgs(a)...) +} + +/* +NewFormatter returns a custom formatter that satisfies the fmt.Formatter +interface. As a result, it integrates cleanly with standard fmt package +printing functions. The formatter is useful for inline printing of smaller data +types similar to the standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Typically this function shouldn't be called directly. It is much easier to make +use of the custom formatter by calling one of the convenience functions such as +c.Printf, c.Println, or c.Printf. +*/ +func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { + return newFormatter(c, v) +} + +// Fdump formats and displays the passed arguments to io.Writer w. It formats +// exactly the same as Dump. +func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { + fdump(c, w, a...) +} + +/* +Dump displays the passed parameters to standard out with newlines, customizable +indentation, and additional debug information such as complete types and all +pointer addresses used to indirect to the final value. It provides the +following features over the built-in printing facilities provided by the fmt +package: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output + +The configuration options are controlled by modifying the public members +of c. See ConfigState for options documentation. + +See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to +get the formatted result as a string. +*/ +func (c *ConfigState) Dump(a ...interface{}) { + fdump(c, os.Stdout, a...) +} + +// Sdump returns a string with the passed arguments formatted exactly the same +// as Dump. +func (c *ConfigState) Sdump(a ...interface{}) string { + var buf bytes.Buffer + fdump(c, &buf, a...) + return buf.String() +} + +// convertArgs accepts a slice of arguments and returns a slice of the same +// length with each argument converted to a spew Formatter interface using +// the ConfigState associated with s. +func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { + formatters = make([]interface{}, len(args)) + for index, arg := range args { + formatters[index] = newFormatter(c, arg) + } + return formatters +} + +// NewDefaultConfig returns a ConfigState with the following default settings. +// +// Indent: " " +// MaxDepth: 0 +// DisableMethods: false +// DisablePointerMethods: false +// ContinueOnMethod: false +// SortKeys: false +func NewDefaultConfig() *ConfigState { + return &ConfigState{Indent: " "} +} diff --git a/integration-test/vendor/github.com/davecgh/go-spew/spew/doc.go b/integration-test/vendor/github.com/davecgh/go-spew/spew/doc.go new file mode 100644 index 000000000..aacaac6f1 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/spew/doc.go @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* +Package spew implements a deep pretty printer for Go data structures to aid in +debugging. + +A quick overview of the additional features spew provides over the built-in +printing facilities for Go data types are as follows: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output (only when using + Dump style) + +There are two different approaches spew allows for dumping Go data structures: + + * Dump style which prints with newlines, customizable indentation, + and additional debug information such as types and all pointer addresses + used to indirect to the final value + * A custom Formatter interface that integrates cleanly with the standard fmt + package and replaces %v, %+v, %#v, and %#+v to provide inline printing + similar to the default %v while providing the additional functionality + outlined above and passing unsupported format verbs such as %x and %q + along to fmt + +Quick Start + +This section demonstrates how to quickly get started with spew. See the +sections below for further details on formatting and configuration options. + +To dump a variable with full newlines, indentation, type, and pointer +information use Dump, Fdump, or Sdump: + spew.Dump(myVar1, myVar2, ...) + spew.Fdump(someWriter, myVar1, myVar2, ...) + str := spew.Sdump(myVar1, myVar2, ...) + +Alternatively, if you would prefer to use format strings with a compacted inline +printing style, use the convenience wrappers Printf, Fprintf, etc with +%v (most compact), %+v (adds pointer addresses), %#v (adds types), or +%#+v (adds types and pointer addresses): + spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + +Configuration Options + +Configuration of spew is handled by fields in the ConfigState type. For +convenience, all of the top-level functions use a global state available +via the spew.Config global. + +It is also possible to create a ConfigState instance that provides methods +equivalent to the top-level functions. This allows concurrent configuration +options. See the ConfigState documentation for more details. + +The following configuration options are available: + * Indent + String to use for each indentation level for Dump functions. + It is a single space by default. A popular alternative is "\t". + + * MaxDepth + Maximum number of levels to descend into nested data structures. + There is no limit by default. + + * DisableMethods + Disables invocation of error and Stringer interface methods. + Method invocation is enabled by default. + + * DisablePointerMethods + Disables invocation of error and Stringer interface methods on types + which only accept pointer receivers from non-pointer variables. + Pointer method invocation is enabled by default. + + * DisablePointerAddresses + DisablePointerAddresses specifies whether to disable the printing of + pointer addresses. This is useful when diffing data structures in tests. + + * DisableCapacities + DisableCapacities specifies whether to disable the printing of + capacities for arrays, slices, maps and channels. This is useful when + diffing data structures in tests. + + * ContinueOnMethod + Enables recursion into types after invoking error and Stringer interface + methods. Recursion after method invocation is disabled by default. + + * SortKeys + Specifies map keys should be sorted before being printed. Use + this to have a more deterministic, diffable output. Note that + only native types (bool, int, uint, floats, uintptr and string) + and types which implement error or Stringer interfaces are + supported with other types sorted according to the + reflect.Value.String() output which guarantees display + stability. Natural map order is used by default. + + * SpewKeys + Specifies that, as a last resort attempt, map keys should be + spewed to strings and sorted by those strings. This is only + considered if SortKeys is true. + +Dump Usage + +Simply call spew.Dump with a list of variables you want to dump: + + spew.Dump(myVar1, myVar2, ...) + +You may also call spew.Fdump if you would prefer to output to an arbitrary +io.Writer. For example, to dump to standard error: + + spew.Fdump(os.Stderr, myVar1, myVar2, ...) + +A third option is to call spew.Sdump to get the formatted output as a string: + + str := spew.Sdump(myVar1, myVar2, ...) + +Sample Dump Output + +See the Dump example for details on the setup of the types and variables being +shown here. + + (main.Foo) { + unexportedField: (*main.Bar)(0xf84002e210)({ + flag: (main.Flag) flagTwo, + data: (uintptr) + }), + ExportedField: (map[interface {}]interface {}) (len=1) { + (string) (len=3) "one": (bool) true + } + } + +Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C +command as shown. + ([]uint8) (len=32 cap=32) { + 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | + 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| + 00000020 31 32 |12| + } + +Custom Formatter + +Spew provides a custom formatter that implements the fmt.Formatter interface +so that it integrates cleanly with standard fmt package printing functions. The +formatter is useful for inline printing of smaller data types similar to the +standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Custom Formatter Usage + +The simplest way to make use of the spew custom formatter is to call one of the +convenience functions such as spew.Printf, spew.Println, or spew.Printf. The +functions have syntax you are most likely already familiar with: + + spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + spew.Println(myVar, myVar2) + spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + +See the Index for the full list convenience functions. + +Sample Formatter Output + +Double pointer to a uint8: + %v: <**>5 + %+v: <**>(0xf8400420d0->0xf8400420c8)5 + %#v: (**uint8)5 + %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 + +Pointer to circular struct with a uint8 field and a pointer to itself: + %v: <*>{1 <*>} + %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} + %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} + %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} + +See the Printf example for details on the setup of variables being shown +here. + +Errors + +Since it is possible for custom Stringer/error interfaces to panic, spew +detects them and handles them internally by printing the panic information +inline with the output. Since spew is intended to provide deep pretty printing +capabilities on structures, it intentionally does not return any errors. +*/ +package spew diff --git a/integration-test/vendor/github.com/davecgh/go-spew/spew/dump.go b/integration-test/vendor/github.com/davecgh/go-spew/spew/dump.go new file mode 100644 index 000000000..f78d89fc1 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/spew/dump.go @@ -0,0 +1,509 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "encoding/hex" + "fmt" + "io" + "os" + "reflect" + "regexp" + "strconv" + "strings" +) + +var ( + // uint8Type is a reflect.Type representing a uint8. It is used to + // convert cgo types to uint8 slices for hexdumping. + uint8Type = reflect.TypeOf(uint8(0)) + + // cCharRE is a regular expression that matches a cgo char. + // It is used to detect character arrays to hexdump them. + cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) + + // cUnsignedCharRE is a regular expression that matches a cgo unsigned + // char. It is used to detect unsigned character arrays to hexdump + // them. + cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) + + // cUint8tCharRE is a regular expression that matches a cgo uint8_t. + // It is used to detect uint8_t arrays to hexdump them. + cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) +) + +// dumpState contains information about the state of a dump operation. +type dumpState struct { + w io.Writer + depth int + pointers map[uintptr]int + ignoreNextType bool + ignoreNextIndent bool + cs *ConfigState +} + +// indent performs indentation according to the depth level and cs.Indent +// option. +func (d *dumpState) indent() { + if d.ignoreNextIndent { + d.ignoreNextIndent = false + return + } + d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) +} + +// unpackValue returns values inside of non-nil interfaces when possible. +// This is useful for data types like structs, arrays, slices, and maps which +// can contain varying types packed inside an interface. +func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { + if v.Kind() == reflect.Interface && !v.IsNil() { + v = v.Elem() + } + return v +} + +// dumpPtr handles formatting of pointers by indirecting them as necessary. +func (d *dumpState) dumpPtr(v reflect.Value) { + // Remove pointers at or below the current depth from map used to detect + // circular refs. + for k, depth := range d.pointers { + if depth >= d.depth { + delete(d.pointers, k) + } + } + + // Keep list of all dereferenced pointers to show later. + pointerChain := make([]uintptr, 0) + + // Figure out how many levels of indirection there are by dereferencing + // pointers and unpacking interfaces down the chain while detecting circular + // references. + nilFound := false + cycleFound := false + indirects := 0 + ve := v + for ve.Kind() == reflect.Ptr { + if ve.IsNil() { + nilFound = true + break + } + indirects++ + addr := ve.Pointer() + pointerChain = append(pointerChain, addr) + if pd, ok := d.pointers[addr]; ok && pd < d.depth { + cycleFound = true + indirects-- + break + } + d.pointers[addr] = d.depth + + ve = ve.Elem() + if ve.Kind() == reflect.Interface { + if ve.IsNil() { + nilFound = true + break + } + ve = ve.Elem() + } + } + + // Display type information. + d.w.Write(openParenBytes) + d.w.Write(bytes.Repeat(asteriskBytes, indirects)) + d.w.Write([]byte(ve.Type().String())) + d.w.Write(closeParenBytes) + + // Display pointer information. + if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 { + d.w.Write(openParenBytes) + for i, addr := range pointerChain { + if i > 0 { + d.w.Write(pointerChainBytes) + } + printHexPtr(d.w, addr) + } + d.w.Write(closeParenBytes) + } + + // Display dereferenced value. + d.w.Write(openParenBytes) + switch { + case nilFound: + d.w.Write(nilAngleBytes) + + case cycleFound: + d.w.Write(circularBytes) + + default: + d.ignoreNextType = true + d.dump(ve) + } + d.w.Write(closeParenBytes) +} + +// dumpSlice handles formatting of arrays and slices. Byte (uint8 under +// reflection) arrays and slices are dumped in hexdump -C fashion. +func (d *dumpState) dumpSlice(v reflect.Value) { + // Determine whether this type should be hex dumped or not. Also, + // for types which should be hexdumped, try to use the underlying data + // first, then fall back to trying to convert them to a uint8 slice. + var buf []uint8 + doConvert := false + doHexDump := false + numEntries := v.Len() + if numEntries > 0 { + vt := v.Index(0).Type() + vts := vt.String() + switch { + // C types that need to be converted. + case cCharRE.MatchString(vts): + fallthrough + case cUnsignedCharRE.MatchString(vts): + fallthrough + case cUint8tCharRE.MatchString(vts): + doConvert = true + + // Try to use existing uint8 slices and fall back to converting + // and copying if that fails. + case vt.Kind() == reflect.Uint8: + // We need an addressable interface to convert the type + // to a byte slice. However, the reflect package won't + // give us an interface on certain things like + // unexported struct fields in order to enforce + // visibility rules. We use unsafe, when available, to + // bypass these restrictions since this package does not + // mutate the values. + vs := v + if !vs.CanInterface() || !vs.CanAddr() { + vs = unsafeReflectValue(vs) + } + if !UnsafeDisabled { + vs = vs.Slice(0, numEntries) + + // Use the existing uint8 slice if it can be + // type asserted. + iface := vs.Interface() + if slice, ok := iface.([]uint8); ok { + buf = slice + doHexDump = true + break + } + } + + // The underlying data needs to be converted if it can't + // be type asserted to a uint8 slice. + doConvert = true + } + + // Copy and convert the underlying type if needed. + if doConvert && vt.ConvertibleTo(uint8Type) { + // Convert and copy each element into a uint8 byte + // slice. + buf = make([]uint8, numEntries) + for i := 0; i < numEntries; i++ { + vv := v.Index(i) + buf[i] = uint8(vv.Convert(uint8Type).Uint()) + } + doHexDump = true + } + } + + // Hexdump the entire slice as needed. + if doHexDump { + indent := strings.Repeat(d.cs.Indent, d.depth) + str := indent + hex.Dump(buf) + str = strings.Replace(str, "\n", "\n"+indent, -1) + str = strings.TrimRight(str, d.cs.Indent) + d.w.Write([]byte(str)) + return + } + + // Recursively call dump for each item. + for i := 0; i < numEntries; i++ { + d.dump(d.unpackValue(v.Index(i))) + if i < (numEntries - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } +} + +// dump is the main workhorse for dumping a value. It uses the passed reflect +// value to figure out what kind of object we are dealing with and formats it +// appropriately. It is a recursive function, however circular data structures +// are detected and handled properly. +func (d *dumpState) dump(v reflect.Value) { + // Handle invalid reflect values immediately. + kind := v.Kind() + if kind == reflect.Invalid { + d.w.Write(invalidAngleBytes) + return + } + + // Handle pointers specially. + if kind == reflect.Ptr { + d.indent() + d.dumpPtr(v) + return + } + + // Print type information unless already handled elsewhere. + if !d.ignoreNextType { + d.indent() + d.w.Write(openParenBytes) + d.w.Write([]byte(v.Type().String())) + d.w.Write(closeParenBytes) + d.w.Write(spaceBytes) + } + d.ignoreNextType = false + + // Display length and capacity if the built-in len and cap functions + // work with the value's kind and the len/cap itself is non-zero. + valueLen, valueCap := 0, 0 + switch v.Kind() { + case reflect.Array, reflect.Slice, reflect.Chan: + valueLen, valueCap = v.Len(), v.Cap() + case reflect.Map, reflect.String: + valueLen = v.Len() + } + if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 { + d.w.Write(openParenBytes) + if valueLen != 0 { + d.w.Write(lenEqualsBytes) + printInt(d.w, int64(valueLen), 10) + } + if !d.cs.DisableCapacities && valueCap != 0 { + if valueLen != 0 { + d.w.Write(spaceBytes) + } + d.w.Write(capEqualsBytes) + printInt(d.w, int64(valueCap), 10) + } + d.w.Write(closeParenBytes) + d.w.Write(spaceBytes) + } + + // Call Stringer/error interfaces if they exist and the handle methods flag + // is enabled + if !d.cs.DisableMethods { + if (kind != reflect.Invalid) && (kind != reflect.Interface) { + if handled := handleMethods(d.cs, d.w, v); handled { + return + } + } + } + + switch kind { + case reflect.Invalid: + // Do nothing. We should never get here since invalid has already + // been handled above. + + case reflect.Bool: + printBool(d.w, v.Bool()) + + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + printInt(d.w, v.Int(), 10) + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + printUint(d.w, v.Uint(), 10) + + case reflect.Float32: + printFloat(d.w, v.Float(), 32) + + case reflect.Float64: + printFloat(d.w, v.Float(), 64) + + case reflect.Complex64: + printComplex(d.w, v.Complex(), 32) + + case reflect.Complex128: + printComplex(d.w, v.Complex(), 64) + + case reflect.Slice: + if v.IsNil() { + d.w.Write(nilAngleBytes) + break + } + fallthrough + + case reflect.Array: + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + d.dumpSlice(v) + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.String: + d.w.Write([]byte(strconv.Quote(v.String()))) + + case reflect.Interface: + // The only time we should get here is for nil interfaces due to + // unpackValue calls. + if v.IsNil() { + d.w.Write(nilAngleBytes) + } + + case reflect.Ptr: + // Do nothing. We should never get here since pointers have already + // been handled above. + + case reflect.Map: + // nil maps should be indicated as different than empty maps + if v.IsNil() { + d.w.Write(nilAngleBytes) + break + } + + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + numEntries := v.Len() + keys := v.MapKeys() + if d.cs.SortKeys { + sortValues(keys, d.cs) + } + for i, key := range keys { + d.dump(d.unpackValue(key)) + d.w.Write(colonSpaceBytes) + d.ignoreNextIndent = true + d.dump(d.unpackValue(v.MapIndex(key))) + if i < (numEntries - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.Struct: + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + vt := v.Type() + numFields := v.NumField() + for i := 0; i < numFields; i++ { + d.indent() + vtf := vt.Field(i) + d.w.Write([]byte(vtf.Name)) + d.w.Write(colonSpaceBytes) + d.ignoreNextIndent = true + d.dump(d.unpackValue(v.Field(i))) + if i < (numFields - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.Uintptr: + printHexPtr(d.w, uintptr(v.Uint())) + + case reflect.UnsafePointer, reflect.Chan, reflect.Func: + printHexPtr(d.w, v.Pointer()) + + // There were not any other types at the time this code was written, but + // fall back to letting the default fmt package handle it in case any new + // types are added. + default: + if v.CanInterface() { + fmt.Fprintf(d.w, "%v", v.Interface()) + } else { + fmt.Fprintf(d.w, "%v", v.String()) + } + } +} + +// fdump is a helper function to consolidate the logic from the various public +// methods which take varying writers and config states. +func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { + for _, arg := range a { + if arg == nil { + w.Write(interfaceBytes) + w.Write(spaceBytes) + w.Write(nilAngleBytes) + w.Write(newlineBytes) + continue + } + + d := dumpState{w: w, cs: cs} + d.pointers = make(map[uintptr]int) + d.dump(reflect.ValueOf(arg)) + d.w.Write(newlineBytes) + } +} + +// Fdump formats and displays the passed arguments to io.Writer w. It formats +// exactly the same as Dump. +func Fdump(w io.Writer, a ...interface{}) { + fdump(&Config, w, a...) +} + +// Sdump returns a string with the passed arguments formatted exactly the same +// as Dump. +func Sdump(a ...interface{}) string { + var buf bytes.Buffer + fdump(&Config, &buf, a...) + return buf.String() +} + +/* +Dump displays the passed parameters to standard out with newlines, customizable +indentation, and additional debug information such as complete types and all +pointer addresses used to indirect to the final value. It provides the +following features over the built-in printing facilities provided by the fmt +package: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output + +The configuration options are controlled by an exported package global, +spew.Config. See ConfigState for options documentation. + +See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to +get the formatted result as a string. +*/ +func Dump(a ...interface{}) { + fdump(&Config, os.Stdout, a...) +} diff --git a/integration-test/vendor/github.com/davecgh/go-spew/spew/format.go b/integration-test/vendor/github.com/davecgh/go-spew/spew/format.go new file mode 100644 index 000000000..b04edb7d7 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/spew/format.go @@ -0,0 +1,419 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "reflect" + "strconv" + "strings" +) + +// supportedFlags is a list of all the character flags supported by fmt package. +const supportedFlags = "0-+# " + +// formatState implements the fmt.Formatter interface and contains information +// about the state of a formatting operation. The NewFormatter function can +// be used to get a new Formatter which can be used directly as arguments +// in standard fmt package printing calls. +type formatState struct { + value interface{} + fs fmt.State + depth int + pointers map[uintptr]int + ignoreNextType bool + cs *ConfigState +} + +// buildDefaultFormat recreates the original format string without precision +// and width information to pass in to fmt.Sprintf in the case of an +// unrecognized type. Unless new types are added to the language, this +// function won't ever be called. +func (f *formatState) buildDefaultFormat() (format string) { + buf := bytes.NewBuffer(percentBytes) + + for _, flag := range supportedFlags { + if f.fs.Flag(int(flag)) { + buf.WriteRune(flag) + } + } + + buf.WriteRune('v') + + format = buf.String() + return format +} + +// constructOrigFormat recreates the original format string including precision +// and width information to pass along to the standard fmt package. This allows +// automatic deferral of all format strings this package doesn't support. +func (f *formatState) constructOrigFormat(verb rune) (format string) { + buf := bytes.NewBuffer(percentBytes) + + for _, flag := range supportedFlags { + if f.fs.Flag(int(flag)) { + buf.WriteRune(flag) + } + } + + if width, ok := f.fs.Width(); ok { + buf.WriteString(strconv.Itoa(width)) + } + + if precision, ok := f.fs.Precision(); ok { + buf.Write(precisionBytes) + buf.WriteString(strconv.Itoa(precision)) + } + + buf.WriteRune(verb) + + format = buf.String() + return format +} + +// unpackValue returns values inside of non-nil interfaces when possible and +// ensures that types for values which have been unpacked from an interface +// are displayed when the show types flag is also set. +// This is useful for data types like structs, arrays, slices, and maps which +// can contain varying types packed inside an interface. +func (f *formatState) unpackValue(v reflect.Value) reflect.Value { + if v.Kind() == reflect.Interface { + f.ignoreNextType = false + if !v.IsNil() { + v = v.Elem() + } + } + return v +} + +// formatPtr handles formatting of pointers by indirecting them as necessary. +func (f *formatState) formatPtr(v reflect.Value) { + // Display nil if top level pointer is nil. + showTypes := f.fs.Flag('#') + if v.IsNil() && (!showTypes || f.ignoreNextType) { + f.fs.Write(nilAngleBytes) + return + } + + // Remove pointers at or below the current depth from map used to detect + // circular refs. + for k, depth := range f.pointers { + if depth >= f.depth { + delete(f.pointers, k) + } + } + + // Keep list of all dereferenced pointers to possibly show later. + pointerChain := make([]uintptr, 0) + + // Figure out how many levels of indirection there are by derferencing + // pointers and unpacking interfaces down the chain while detecting circular + // references. + nilFound := false + cycleFound := false + indirects := 0 + ve := v + for ve.Kind() == reflect.Ptr { + if ve.IsNil() { + nilFound = true + break + } + indirects++ + addr := ve.Pointer() + pointerChain = append(pointerChain, addr) + if pd, ok := f.pointers[addr]; ok && pd < f.depth { + cycleFound = true + indirects-- + break + } + f.pointers[addr] = f.depth + + ve = ve.Elem() + if ve.Kind() == reflect.Interface { + if ve.IsNil() { + nilFound = true + break + } + ve = ve.Elem() + } + } + + // Display type or indirection level depending on flags. + if showTypes && !f.ignoreNextType { + f.fs.Write(openParenBytes) + f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) + f.fs.Write([]byte(ve.Type().String())) + f.fs.Write(closeParenBytes) + } else { + if nilFound || cycleFound { + indirects += strings.Count(ve.Type().String(), "*") + } + f.fs.Write(openAngleBytes) + f.fs.Write([]byte(strings.Repeat("*", indirects))) + f.fs.Write(closeAngleBytes) + } + + // Display pointer information depending on flags. + if f.fs.Flag('+') && (len(pointerChain) > 0) { + f.fs.Write(openParenBytes) + for i, addr := range pointerChain { + if i > 0 { + f.fs.Write(pointerChainBytes) + } + printHexPtr(f.fs, addr) + } + f.fs.Write(closeParenBytes) + } + + // Display dereferenced value. + switch { + case nilFound: + f.fs.Write(nilAngleBytes) + + case cycleFound: + f.fs.Write(circularShortBytes) + + default: + f.ignoreNextType = true + f.format(ve) + } +} + +// format is the main workhorse for providing the Formatter interface. It +// uses the passed reflect value to figure out what kind of object we are +// dealing with and formats it appropriately. It is a recursive function, +// however circular data structures are detected and handled properly. +func (f *formatState) format(v reflect.Value) { + // Handle invalid reflect values immediately. + kind := v.Kind() + if kind == reflect.Invalid { + f.fs.Write(invalidAngleBytes) + return + } + + // Handle pointers specially. + if kind == reflect.Ptr { + f.formatPtr(v) + return + } + + // Print type information unless already handled elsewhere. + if !f.ignoreNextType && f.fs.Flag('#') { + f.fs.Write(openParenBytes) + f.fs.Write([]byte(v.Type().String())) + f.fs.Write(closeParenBytes) + } + f.ignoreNextType = false + + // Call Stringer/error interfaces if they exist and the handle methods + // flag is enabled. + if !f.cs.DisableMethods { + if (kind != reflect.Invalid) && (kind != reflect.Interface) { + if handled := handleMethods(f.cs, f.fs, v); handled { + return + } + } + } + + switch kind { + case reflect.Invalid: + // Do nothing. We should never get here since invalid has already + // been handled above. + + case reflect.Bool: + printBool(f.fs, v.Bool()) + + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + printInt(f.fs, v.Int(), 10) + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + printUint(f.fs, v.Uint(), 10) + + case reflect.Float32: + printFloat(f.fs, v.Float(), 32) + + case reflect.Float64: + printFloat(f.fs, v.Float(), 64) + + case reflect.Complex64: + printComplex(f.fs, v.Complex(), 32) + + case reflect.Complex128: + printComplex(f.fs, v.Complex(), 64) + + case reflect.Slice: + if v.IsNil() { + f.fs.Write(nilAngleBytes) + break + } + fallthrough + + case reflect.Array: + f.fs.Write(openBracketBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + numEntries := v.Len() + for i := 0; i < numEntries; i++ { + if i > 0 { + f.fs.Write(spaceBytes) + } + f.ignoreNextType = true + f.format(f.unpackValue(v.Index(i))) + } + } + f.depth-- + f.fs.Write(closeBracketBytes) + + case reflect.String: + f.fs.Write([]byte(v.String())) + + case reflect.Interface: + // The only time we should get here is for nil interfaces due to + // unpackValue calls. + if v.IsNil() { + f.fs.Write(nilAngleBytes) + } + + case reflect.Ptr: + // Do nothing. We should never get here since pointers have already + // been handled above. + + case reflect.Map: + // nil maps should be indicated as different than empty maps + if v.IsNil() { + f.fs.Write(nilAngleBytes) + break + } + + f.fs.Write(openMapBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + keys := v.MapKeys() + if f.cs.SortKeys { + sortValues(keys, f.cs) + } + for i, key := range keys { + if i > 0 { + f.fs.Write(spaceBytes) + } + f.ignoreNextType = true + f.format(f.unpackValue(key)) + f.fs.Write(colonBytes) + f.ignoreNextType = true + f.format(f.unpackValue(v.MapIndex(key))) + } + } + f.depth-- + f.fs.Write(closeMapBytes) + + case reflect.Struct: + numFields := v.NumField() + f.fs.Write(openBraceBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + vt := v.Type() + for i := 0; i < numFields; i++ { + if i > 0 { + f.fs.Write(spaceBytes) + } + vtf := vt.Field(i) + if f.fs.Flag('+') || f.fs.Flag('#') { + f.fs.Write([]byte(vtf.Name)) + f.fs.Write(colonBytes) + } + f.format(f.unpackValue(v.Field(i))) + } + } + f.depth-- + f.fs.Write(closeBraceBytes) + + case reflect.Uintptr: + printHexPtr(f.fs, uintptr(v.Uint())) + + case reflect.UnsafePointer, reflect.Chan, reflect.Func: + printHexPtr(f.fs, v.Pointer()) + + // There were not any other types at the time this code was written, but + // fall back to letting the default fmt package handle it if any get added. + default: + format := f.buildDefaultFormat() + if v.CanInterface() { + fmt.Fprintf(f.fs, format, v.Interface()) + } else { + fmt.Fprintf(f.fs, format, v.String()) + } + } +} + +// Format satisfies the fmt.Formatter interface. See NewFormatter for usage +// details. +func (f *formatState) Format(fs fmt.State, verb rune) { + f.fs = fs + + // Use standard formatting for verbs that are not v. + if verb != 'v' { + format := f.constructOrigFormat(verb) + fmt.Fprintf(fs, format, f.value) + return + } + + if f.value == nil { + if fs.Flag('#') { + fs.Write(interfaceBytes) + } + fs.Write(nilAngleBytes) + return + } + + f.format(reflect.ValueOf(f.value)) +} + +// newFormatter is a helper function to consolidate the logic from the various +// public methods which take varying config states. +func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { + fs := &formatState{value: v, cs: cs} + fs.pointers = make(map[uintptr]int) + return fs +} + +/* +NewFormatter returns a custom formatter that satisfies the fmt.Formatter +interface. As a result, it integrates cleanly with standard fmt package +printing functions. The formatter is useful for inline printing of smaller data +types similar to the standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Typically this function shouldn't be called directly. It is much easier to make +use of the custom formatter by calling one of the convenience functions such as +Printf, Println, or Fprintf. +*/ +func NewFormatter(v interface{}) fmt.Formatter { + return newFormatter(&Config, v) +} diff --git a/integration-test/vendor/github.com/davecgh/go-spew/spew/spew.go b/integration-test/vendor/github.com/davecgh/go-spew/spew/spew.go new file mode 100644 index 000000000..32c0e3388 --- /dev/null +++ b/integration-test/vendor/github.com/davecgh/go-spew/spew/spew.go @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2013-2016 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "fmt" + "io" +) + +// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the formatted string as a value that satisfies error. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Errorf(format string, a ...interface{}) (err error) { + return fmt.Errorf(format, convertArgs(a)...) +} + +// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprint(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprint(w, convertArgs(a)...) +} + +// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { + return fmt.Fprintf(w, format, convertArgs(a)...) +} + +// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it +// passed with a default Formatter interface returned by NewFormatter. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprintln(w, convertArgs(a)...) +} + +// Print is a wrapper for fmt.Print that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) +func Print(a ...interface{}) (n int, err error) { + return fmt.Print(convertArgs(a)...) +} + +// Printf is a wrapper for fmt.Printf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Printf(format string, a ...interface{}) (n int, err error) { + return fmt.Printf(format, convertArgs(a)...) +} + +// Println is a wrapper for fmt.Println that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) +func Println(a ...interface{}) (n int, err error) { + return fmt.Println(convertArgs(a)...) +} + +// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprint(a ...interface{}) string { + return fmt.Sprint(convertArgs(a)...) +} + +// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprintf(format string, a ...interface{}) string { + return fmt.Sprintf(format, convertArgs(a)...) +} + +// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it +// were passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprintln(a ...interface{}) string { + return fmt.Sprintln(convertArgs(a)...) +} + +// convertArgs accepts a slice of arguments and returns a slice of the same +// length with each argument converted to a default spew Formatter interface. +func convertArgs(args []interface{}) (formatters []interface{}) { + formatters = make([]interface{}, len(args)) + for index, arg := range args { + formatters[index] = NewFormatter(arg) + } + return formatters +} diff --git a/integration-test/vendor/github.com/docker/cli/AUTHORS b/integration-test/vendor/github.com/docker/cli/AUTHORS new file mode 100644 index 000000000..8990f85b5 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/AUTHORS @@ -0,0 +1,771 @@ +# This file lists all individuals having contributed content to the repository. +# For how it is generated, see `scripts/docs/generate-authors.sh`. + +Aanand Prasad +Aaron L. Xu +Aaron Lehmann +Aaron.L.Xu +Abdur Rehman +Abhinandan Prativadi +Abin Shahab +Abreto FU +Ace Tang +Addam Hardy +Adolfo Ochagavía +Adrian Plata +Adrien Duermael +Adrien Folie +Ahmet Alp Balkan +Aidan Feldman +Aidan Hobson Sayers +AJ Bowen +Akhil Mohan +Akihiro Suda +Akim Demaille +Alan Thompson +Albert Callarisa +Albin Kerouanton +Aleksa Sarai +Aleksander Piotrowski +Alessandro Boch +Alex Mavrogiannis +Alex Mayer +Alexander Boyd +Alexander Larsson +Alexander Morozov +Alexander Ryabov +Alexandre González +Alfred Landrum +Alicia Lauerman +Allen Sun +Alvin Deng +Amen Belayneh +Amir Goldstein +Amit Krishnan +Amit Shukla +Amy Lindburg +Anca Iordache +Anda Xu +Andrea Luzzardi +Andreas Köhler +Andrew France +Andrew Hsu +Andrew Macpherson +Andrew McDonnell +Andrew Po +Andrey Petrov +Andrii Berehuliak +André Martins +Andy Goldstein +Andy Rothfusz +Anil Madhavapeddy +Ankush Agarwal +Anne Henmi +Anton Polonskiy +Antonio Murdaca +Antonis Kalipetis +Anusha Ragunathan +Ao Li +Arash Deshmeh +Arko Dasgupta +Arnaud Porterie +Arthur Peka +Ashwini Oruganti +Azat Khuyiyakhmetov +Bardia Keyoumarsi +Barnaby Gray +Bastiaan Bakker +BastianHofmann +Ben Bonnefoy +Ben Creasy +Ben Firshman +Benjamin Boudreau +Benoit Sigoure +Bhumika Bayani +Bill Wang +Bin Liu +Bingshen Wang +Boaz Shuster +Bogdan Anton +Boris Pruessmann +Bradley Cicenas +Brandon Mitchell +Brandon Philips +Brent Salisbury +Bret Fisher +Brian (bex) Exelbierd +Brian Goff +Brian Wieder +Bryan Bess +Bryan Boreham +Bryan Murphy +bryfry +Cameron Spear +Cao Weiwei +Carlo Mion +Carlos Alexandro Becker +Carlos de Paula +Ce Gao +Cedric Davies +Cezar Sa Espinola +Chad Faragher +Chao Wang +Charles Chan +Charles Law +Charles Smith +Charlie Drage +ChaYoung You +Chen Chuanliang +Chen Hanxiao +Chen Mingjie +Chen Qiu +Chris Gavin +Chris Gibson +Chris McKinnel +Chris Snow +Chris Weyl +Christian Persson +Christian Stefanescu +Christophe Robin +Christophe Vidal +Christopher Biscardi +Christopher Crone +Christopher Jones +Christy Norman +Chun Chen +Clinton Kitson +Coenraad Loubser +Colin Hebert +Collin Guarino +Colm Hally +Comical Derskeal <27731088+derskeal@users.noreply.github.com> +Corey Farrell +Corey Quon +Craig Wilhite +Cristian Staretu +Daehyeok Mun +Dafydd Crosby +Daisuke Ito +dalanlan +Damien Nadé +Dan Cotora +Daniel Artine +Daniel Cassidy +Daniel Dao +Daniel Farrell +Daniel Gasienica +Daniel Goosen +Daniel Helfand +Daniel Hiltgen +Daniel J Walsh +Daniel Nephin +Daniel Norberg +Daniel Watkins +Daniel Zhang +Daniil Nikolenko +Danny Berger +Darren Shepherd +Darren Stahl +Dattatraya Kumbhar +Dave Goodchild +Dave Henderson +Dave Tucker +David Beitey +David Calavera +David Cramer +David Dooling +David Gageot +David Lechner +David Scott +David Sheets +David Williamson +David Xia +David Young +Deng Guangxing +Denis Defreyne +Denis Gladkikh +Denis Ollier +Dennis Docter +Derek McGowan +Deshi Xiao +Dharmit Shah +Dhawal Yogesh Bhanushali +Dieter Reuter +Dima Stopel +Dimitry Andric +Ding Fei +Diogo Monica +Djordje Lukic +Dmitry Gusev +Dmitry Smirnov +Dmitry V. Krivenok +Dominik Braun +Don Kjer +Dong Chen +Doug Davis +Drew Erny +Ed Costello +Elango Sivanandam +Eli Uriegas +Eli Uriegas +Elias Faxö +Elliot Luo <956941328@qq.com> +Eric Curtin +Eric G. Noriega +Eric Rosenberg +Eric Sage +Eric-Olivier Lamey +Erica Windisch +Erik Hollensbe +Erik St. Martin +Essam A. Hassan +Ethan Haynes +Euan Kemp +Eugene Yakubovich +Evan Allrich +Evan Hazlett +Evan Krall +Evelyn Xu +Everett Toews +Fabio Falci +Fabrizio Soppelsa +Felix Hupfeld +Felix Rabe +Filip Jareš +Flavio Crisciani +Florian Klein +Forest Johnson +Foysal Iqbal +François Scala +Fred Lifton +Frederic Hemberger +Frederick F. Kautz IV +Frederik Nordahl Jul Sabroe +Frieder Bluemle +Gabriel Nicolas Avellaneda +Gaetan de Villele +Gang Qiao +Gary Schaetz +Genki Takiuchi +George MacRorie +George Xie +Gianluca Borello +Gildas Cuisinier +Goksu Toprak +Gou Rao +Grant Reaber +Greg Pflaum +Guilhem Lettron +Guillaume J. Charmes +Guillaume Le Floch +gwx296173 +Günther Jungbluth +Hakan Özler +Hao Zhang <21521210@zju.edu.cn> +Harald Albers +Harold Cooper +Harry Zhang +He Simei +Hector S +Helen Xie +Henning Sprang +Henry N +Hernan Garcia +Hongbin Lu +Hu Keping +Huayi Zhang +Hugo Gabriel Eyherabide +huqun +Huu Nguyen +Hyzhou Zhy +Ian Campbell +Ian Philpot +Ignacio Capurro +Ilya Dmitrichenko +Ilya Khlopotov +Ilya Sotkov +Ioan Eugen Stan +Isabel Jimenez +Ivan Grcic +Ivan Markin +Jacob Atzen +Jacob Tomlinson +Jaivish Kothari +Jake Lambert +Jake Sanders +James Nesbitt +James Turnbull +Jamie Hannaford +Jan Koprowski +Jan Pazdziora +Jan-Jaap Driessen +Jana Radhakrishnan +Jared Hocutt +Jasmine Hegman +Jason Heiss +Jason Plum +Jay Kamat +Jean Rouge +Jean-Christophe Sirot +Jean-Pierre Huynh +Jeff Lindsay +Jeff Nickoloff +Jeff Silberman +Jeremy Chambers +Jeremy Unruh +Jeremy Yallop +Jeroen Franse +Jesse Adametz +Jessica Frazelle +Jezeniel Zapanta +Jian Zhang +Jie Luo +Jilles Oldenbeuving +Jim Galasyn +Jimmy Leger +Jimmy Song +jimmyxian +Jintao Zhang +Joao Fernandes +Joe Abbey +Joe Doliner +Joe Gordon +Joel Handwell +Joey Geiger +Joffrey F +Johan Euphrosine +Johannes 'fish' Ziemke +John Feminella +John Harris +John Howard +John Laswell +John Maguire +John Mulhausen +John Starks +John Stephens +John Tims +John V. Martinez +John Willis +Jon Johnson +Jonatas Baldin +Jonathan Boulle +Jonathan Lee +Jonathan Lomas +Jonathan McCrohan +Jonh Wendell +Jordan Jennings +Jose J. Escobar <53836904+jescobar-docker@users.noreply.github.com> +Joseph Kern +Josh Bodah +Josh Chorlton +Josh Hawn +Josh Horwitz +Josh Soref +Julien Barbier +Julien Kassar +Julien Maitrehenry +Justas Brazauskas +Justin Cormack +Justin Simonelis +Justyn Temme +Jyrki Puttonen +Jérémie Drouet +Jérôme Petazzoni +Jörg Thalheim +Kai Blin +Kai Qiang Wu (Kennan) +Kara Alexandra +Kareem Khazem +Karthik Nayak +Kat Samperi +Kathryn Spiers +Katie McLaughlin +Ke Xu +Kei Ohmura +Keith Hudgins +Ken Cochrane +Ken ICHIKAWA +Kenfe-Mickaël Laventure +Kevin Burke +Kevin Feyrer +Kevin Kern +Kevin Kirsche +Kevin Meredith +Kevin Richardson +Kevin Woblick +khaled souf +Kim Eik +Kir Kolyshkin +Kotaro Yoshimatsu +Krasi Georgiev +Kris-Mikael Krister +Kun Zhang +Kunal Kushwaha +Lachlan Cooper +Lai Jiangshan +Lars Kellogg-Stedman +Laura Frank +Laurent Erignoux +Lee Gaines +Lei Jitang +Lennie +Leo Gallucci +Lewis Daly +Li Yi +Li Yi +Liang-Chi Hsieh +Lifubang +Lihua Tang +Lily Guo +Lin Lu +Linus Heckemann +Liping Xue +Liron Levin +liwenqi +lixiaobing10051267 +Lloyd Dewolf +Lorenzo Fontana +Louis Opter +Luca Favatella +Luca Marturana +Lucas Chan +Luka Hartwig +Lukas Heeren +Lukasz Zajaczkowski +Lydell Manganti +Lénaïc Huard +Ma Shimiao +Mabin +Maciej Kalisz +Madhav Puri +Madhu Venugopal +Madhur Batra +Malte Janduda +Manjunath A Kumatagi +Mansi Nahar +mapk0y +Marc Bihlmaier +Marco Mariani +Marco Vedovati +Marcus Martins +Marianna Tessel +Marius Ileana +Marius Sturm +Mark Oates +Marsh Macy +Martin Mosegaard Amdisen +Mary Anthony +Mason Fish +Mason Malone +Mateusz Major +Mathieu Champlon +Matt Gucci +Matt Robenolt +Matteo Orefice +Matthew Heon +Matthieu Hauglustaine +Mauro Porras P +Max Shytikov +Maxime Petazzoni +Mei ChunTao +Micah Zoltu +Michael A. Smith +Michael Bridgen +Michael Crosby +Michael Friis +Michael Irwin +Michael Käufl +Michael Prokop +Michael Scharf +Michael Spetsiotis +Michael Steinert +Michael West +Michal Minář +Michał Czeraszkiewicz +Miguel Angel Alvarez Cabrerizo +Mihai Borobocea +Mihuleacc Sergiu +Mike Brown +Mike Casas +Mike Danese +Mike Dillon +Mike Goelzer +Mike MacCana +mikelinjie <294893458@qq.com> +Mikhail Vasin +Milind Chawre +Mindaugas Rukas +Miroslav Gula +Misty Stanley-Jones +Mohammad Banikazemi +Mohammed Aaqib Ansari +Mohini Anne Dsouza +Moorthy RS +Morgan Bauer +Morten Hekkvang +Moysés Borges +Mrunal Patel +muicoder +Muthukumar R +Máximo Cuadros +Mårten Cassel +Nace Oroz +Nahum Shalman +Nalin Dahyabhai +Nao YONASHIRO +Nassim 'Nass' Eddequiouaq +Natalie Parker +Nate Brennand +Nathan Hsieh +Nathan LeClaire +Nathan McCauley +Neil Peterson +Nick Adcock +Nico Stapelbroek +Nicola Kabar +Nicolas Borboën +Nicolas De Loof +Nikhil Chawla +Nikolas Garofil +Nikolay Milovanov +Nir Soffer +Nishant Totla +NIWA Hideyuki +Noah Treuhaft +O.S. Tezer +Odin Ugedal +ohmystack +Olle Jonsson +Olli Janatuinen +Oscar Wieman +Otto Kekäläinen +Ovidio Mallo +Pascal Borreli +Patrick Böänziger +Patrick Hemmer +Patrick Lang +Paul +Paul Kehrer +Paul Lietar +Paul Mulders +Paul Weaver +Pavel Pospisil +Paweł Szczekutowicz +Peeyush Gupta +Per Lundberg +Peter Edge +Peter Hsu +Peter Jaffe +Peter Kehl +Peter Nagy +Peter Salvatore +Peter Waller +Phil Estes +Philip Alexander Etling +Philipp Gillé +Philipp Schmied +pidster +pixelistik +Pratik Karki +Prayag Verma +Preston Cowley +Pure White +Qiang Huang +Qinglan Peng +qudongfang +Raghavendra K T +Rahul Zoldyck +Ravi Shekhar Jethani +Ray Tsang +Reficul +Remy Suen +Renaud Gaubert +Ricardo N Feliciano +Rich Moyse +Richard Mathie +Richard Scothern +Rick Wieman +Ritesh H Shukla +Riyaz Faizullabhoy +Rob Gulewich +Robert Wallis +Robin Naundorf +Robin Speekenbrink +Rodolfo Ortiz +Rogelio Canedo +Rohan Verma +Roland Kammerer +Roman Dudin +Rory Hunter +Ross Boucher +Rubens Figueiredo +Rui Cao +Ryan Belgrave +Ryan Detzel +Ryan Stelly +Ryan Wilson-Perkin +Ryan Zhang +Sainath Grandhi +Sakeven Jiang +Sally O'Malley +Sam Neirinck +Samarth Shah +Sambuddha Basu +Sami Tabet +Samuel Cochran +Samuel Karp +Santhosh Manohar +Sargun Dhillon +Saswat Bhattacharya +Scott Brenner +Scott Collier +Sean Christopherson +Sean Rodman +Sebastiaan van Stijn +Sergey Tryuber +Serhat Gülçiçek +Sevki Hasirci +Shaun Kaasten +Sheng Yang +Shijiang Wei +Shishir Mahajan +Shoubhik Bose +Shukui Yang +Sian Lerk Lau +Sidhartha Mani +sidharthamani +Silvin Lubecki +Simei He +Simon Ferquel +Simon Heimberg +Sindhu S +Slava Semushin +Solomon Hykes +Song Gao +Spencer Brown +squeegels <1674195+squeegels@users.noreply.github.com> +Srini Brahmaroutu +Stefan S. +Stefan Scherer +Stefan Weil +Stephane Jeandeaux +Stephen Day +Stephen Rust +Steve Durrheimer +Steve Richards +Steven Burgess +Subhajit Ghosh +Sun Jianbo +Sune Keller +Sungwon Han +Sunny Gogoi +Sven Dowideit +Sylvain Baubeau +Sébastien HOUZÉ +T K Sourabh +TAGOMORI Satoshi +taiji-tech +Taylor Jones +Tejaswini Duggaraju +Tengfei Wang +Teppei Fukuda +Thatcher Peskens +Thibault Coupin +Thomas Gazagnaire +Thomas Krzero +Thomas Leonard +Thomas Léveil +Thomas Riccardi +Thomas Swift +Tianon Gravi +Tianyi Wang +Tibor Vass +Tim Dettrick +Tim Hockin +Tim Sampson +Tim Smith +Tim Waugh +Tim Wraight +timfeirg +Timothy Hobbs +Tobias Bradtke +Tobias Gesellchen +Todd Whiteman +Tom Denham +Tom Fotherby +Tom Klingenberg +Tom Milligan +Tom X. Tobin +Tomas Tomecek +Tomasz Kopczynski +Tomáš Hrčka +Tony Abboud +Tõnis Tiigi +Trapier Marshall +Travis Cline +Tristan Carel +Tycho Andersen +Tycho Andersen +uhayate +Ulrich Bareth +Ulysses Souza +Umesh Yadav +Valentin Lorentz +Venkateswara Reddy Bukkasamudram +Veres Lajos +Victor Vieux +Victoria Bialas +Viktor Stanchev +Vimal Raghubir +Vincent Batts +Vincent Bernat +Vincent Demeester +Vincent Woo +Vishnu Kannan +Vivek Goyal +Wang Jie +Wang Lei +Wang Long +Wang Ping +Wang Xing +Wang Yuexiao +Wang Yumu <37442693@qq.com> +Wataru Ishida +Wayne Song +Wen Cheng Ma +Wenzhi Liang +Wes Morgan +Wewang Xiaorenfine +William Henry +Xianglin Gao +Xiaodong Liu +Xiaodong Zhang +Xiaoxi He +Xinbo Weng +Xuecong Liao +Yan Feng +Yanqiang Miao +Yassine Tijani +Yi EungJun +Ying Li +Yong Tang +Yosef Fertel +Yu Peng +Yuan Sun +Yue Zhang +Yunxiang Huang +Zachary Romero +Zander Mackie +zebrilee +Zhang Kun +Zhang Wei +Zhang Wentao +ZhangHang +zhenghenghuo +Zhou Hao +Zhoulin Xie +Zhu Guihua +Álex González +Álvaro Lázaro +Átila Camurça Alves +徐俊杰 diff --git a/integration-test/vendor/github.com/docker/cli/LICENSE b/integration-test/vendor/github.com/docker/cli/LICENSE new file mode 100644 index 000000000..9c8e20ab8 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://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 + + Copyright 2013-2017 Docker, 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 + + https://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. diff --git a/integration-test/vendor/github.com/docker/cli/NOTICE b/integration-test/vendor/github.com/docker/cli/NOTICE new file mode 100644 index 000000000..58b19b6d1 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/NOTICE @@ -0,0 +1,19 @@ +Docker +Copyright 2012-2017 Docker, Inc. + +This product includes software developed at Docker, Inc. (https://www.docker.com). + +This product contains software (https://github.com/creack/pty) developed +by Keith Rarick, licensed under the MIT License. + +The following is courtesy of our legal counsel: + + +Use and transfer of Docker may be subject to certain restrictions by the +United States and other governments. +It is your responsibility to ensure that your use and/or transfer does not +violate applicable laws. + +For more information, please see https://www.bis.doc.gov + +See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/config.go b/integration-test/vendor/github.com/docker/cli/cli/config/config.go new file mode 100644 index 000000000..93275f3d9 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/config.go @@ -0,0 +1,163 @@ +package config + +import ( + "fmt" + "io" + "os" + "path/filepath" + "strings" + "sync" + + "github.com/docker/cli/cli/config/configfile" + "github.com/docker/cli/cli/config/credentials" + "github.com/docker/cli/cli/config/types" + "github.com/docker/docker/pkg/homedir" + "github.com/pkg/errors" +) + +const ( + // ConfigFileName is the name of config file + ConfigFileName = "config.json" + configFileDir = ".docker" + oldConfigfile = ".dockercfg" + contextsDir = "contexts" +) + +var ( + initConfigDir = new(sync.Once) + configDir string + homeDir string +) + +// resetHomeDir is used in testing to reset the "homeDir" package variable to +// force re-lookup of the home directory between tests. +func resetHomeDir() { + homeDir = "" +} + +func getHomeDir() string { + if homeDir == "" { + homeDir = homedir.Get() + } + return homeDir +} + +// resetConfigDir is used in testing to reset the "configDir" package variable +// and its sync.Once to force re-lookup between tests. +func resetConfigDir() { + configDir = "" + initConfigDir = new(sync.Once) +} + +func setConfigDir() { + if configDir != "" { + return + } + configDir = os.Getenv("DOCKER_CONFIG") + if configDir == "" { + configDir = filepath.Join(getHomeDir(), configFileDir) + } +} + +// Dir returns the directory the configuration file is stored in +func Dir() string { + initConfigDir.Do(setConfigDir) + return configDir +} + +// ContextStoreDir returns the directory the docker contexts are stored in +func ContextStoreDir() string { + return filepath.Join(Dir(), contextsDir) +} + +// SetDir sets the directory the configuration file is stored in +func SetDir(dir string) { + configDir = filepath.Clean(dir) +} + +// Path returns the path to a file relative to the config dir +func Path(p ...string) (string, error) { + path := filepath.Join(append([]string{Dir()}, p...)...) + if !strings.HasPrefix(path, Dir()+string(filepath.Separator)) { + return "", errors.Errorf("path %q is outside of root config directory %q", path, Dir()) + } + return path, nil +} + +// LegacyLoadFromReader is a convenience function that creates a ConfigFile object from +// a non-nested reader +func LegacyLoadFromReader(configData io.Reader) (*configfile.ConfigFile, error) { + configFile := configfile.ConfigFile{ + AuthConfigs: make(map[string]types.AuthConfig), + } + err := configFile.LegacyLoadFromReader(configData) + return &configFile, err +} + +// LoadFromReader is a convenience function that creates a ConfigFile object from +// a reader +func LoadFromReader(configData io.Reader) (*configfile.ConfigFile, error) { + configFile := configfile.ConfigFile{ + AuthConfigs: make(map[string]types.AuthConfig), + } + err := configFile.LoadFromReader(configData) + return &configFile, err +} + +// TODO remove this temporary hack, which is used to warn about the deprecated ~/.dockercfg file +var printLegacyFileWarning bool + +// Load reads the configuration files in the given directory, and sets up +// the auth config information and returns values. +// FIXME: use the internal golang config parser +func Load(configDir string) (*configfile.ConfigFile, error) { + printLegacyFileWarning = false + + if configDir == "" { + configDir = Dir() + } + + filename := filepath.Join(configDir, ConfigFileName) + configFile := configfile.New(filename) + + // Try happy path first - latest config file + if file, err := os.Open(filename); err == nil { + defer file.Close() + err = configFile.LoadFromReader(file) + if err != nil { + err = errors.Wrap(err, filename) + } + return configFile, err + } else if !os.IsNotExist(err) { + // if file is there but we can't stat it for any reason other + // than it doesn't exist then stop + return configFile, errors.Wrap(err, filename) + } + + // Can't find latest config file so check for the old one + filename = filepath.Join(getHomeDir(), oldConfigfile) + if file, err := os.Open(filename); err == nil { + printLegacyFileWarning = true + defer file.Close() + if err := configFile.LegacyLoadFromReader(file); err != nil { + return configFile, errors.Wrap(err, filename) + } + } + return configFile, nil +} + +// LoadDefaultConfigFile attempts to load the default config file and returns +// an initialized ConfigFile struct if none is found. +func LoadDefaultConfigFile(stderr io.Writer) *configfile.ConfigFile { + configFile, err := Load(Dir()) + if err != nil { + fmt.Fprintf(stderr, "WARNING: Error loading config file: %v\n", err) + } + if printLegacyFileWarning { + _, _ = fmt.Fprintln(stderr, "WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release") + } + if !configFile.ContainsAuth() { + configFile.CredentialsStore = credentials.DetectDefaultStore(configFile.CredentialsStore) + } + return configFile +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file.go b/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file.go new file mode 100644 index 000000000..dc9f39eb7 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file.go @@ -0,0 +1,415 @@ +package configfile + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + + "github.com/docker/cli/cli/config/credentials" + "github.com/docker/cli/cli/config/types" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" +) + +const ( + // This constant is only used for really old config files when the + // URL wasn't saved as part of the config file and it was just + // assumed to be this value. + defaultIndexServer = "https://index.docker.io/v1/" +) + +// ConfigFile ~/.docker/config.json file info +type ConfigFile struct { + AuthConfigs map[string]types.AuthConfig `json:"auths"` + HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"` + PsFormat string `json:"psFormat,omitempty"` + ImagesFormat string `json:"imagesFormat,omitempty"` + NetworksFormat string `json:"networksFormat,omitempty"` + PluginsFormat string `json:"pluginsFormat,omitempty"` + VolumesFormat string `json:"volumesFormat,omitempty"` + StatsFormat string `json:"statsFormat,omitempty"` + DetachKeys string `json:"detachKeys,omitempty"` + CredentialsStore string `json:"credsStore,omitempty"` + CredentialHelpers map[string]string `json:"credHelpers,omitempty"` + Filename string `json:"-"` // Note: for internal use only + ServiceInspectFormat string `json:"serviceInspectFormat,omitempty"` + ServicesFormat string `json:"servicesFormat,omitempty"` + TasksFormat string `json:"tasksFormat,omitempty"` + SecretFormat string `json:"secretFormat,omitempty"` + ConfigFormat string `json:"configFormat,omitempty"` + NodesFormat string `json:"nodesFormat,omitempty"` + PruneFilters []string `json:"pruneFilters,omitempty"` + Proxies map[string]ProxyConfig `json:"proxies,omitempty"` + Experimental string `json:"experimental,omitempty"` + StackOrchestrator string `json:"stackOrchestrator,omitempty"` + Kubernetes *KubernetesConfig `json:"kubernetes,omitempty"` + CurrentContext string `json:"currentContext,omitempty"` + CLIPluginsExtraDirs []string `json:"cliPluginsExtraDirs,omitempty"` + Plugins map[string]map[string]string `json:"plugins,omitempty"` + Aliases map[string]string `json:"aliases,omitempty"` +} + +// ProxyConfig contains proxy configuration settings +type ProxyConfig struct { + HTTPProxy string `json:"httpProxy,omitempty"` + HTTPSProxy string `json:"httpsProxy,omitempty"` + NoProxy string `json:"noProxy,omitempty"` + FTPProxy string `json:"ftpProxy,omitempty"` +} + +// KubernetesConfig contains Kubernetes orchestrator settings +type KubernetesConfig struct { + AllNamespaces string `json:"allNamespaces,omitempty"` +} + +// New initializes an empty configuration file for the given filename 'fn' +func New(fn string) *ConfigFile { + return &ConfigFile{ + AuthConfigs: make(map[string]types.AuthConfig), + HTTPHeaders: make(map[string]string), + Filename: fn, + Plugins: make(map[string]map[string]string), + Aliases: make(map[string]string), + } +} + +// LegacyLoadFromReader reads the non-nested configuration data given and sets up the +// auth config information with given directory and populates the receiver object +func (configFile *ConfigFile) LegacyLoadFromReader(configData io.Reader) error { + b, err := ioutil.ReadAll(configData) + if err != nil { + return err + } + + if err := json.Unmarshal(b, &configFile.AuthConfigs); err != nil { + arr := strings.Split(string(b), "\n") + if len(arr) < 2 { + return errors.Errorf("The Auth config file is empty") + } + authConfig := types.AuthConfig{} + origAuth := strings.Split(arr[0], " = ") + if len(origAuth) != 2 { + return errors.Errorf("Invalid Auth config file") + } + authConfig.Username, authConfig.Password, err = decodeAuth(origAuth[1]) + if err != nil { + return err + } + authConfig.ServerAddress = defaultIndexServer + configFile.AuthConfigs[defaultIndexServer] = authConfig + } else { + for k, authConfig := range configFile.AuthConfigs { + authConfig.Username, authConfig.Password, err = decodeAuth(authConfig.Auth) + if err != nil { + return err + } + authConfig.Auth = "" + authConfig.ServerAddress = k + configFile.AuthConfigs[k] = authConfig + } + } + return nil +} + +// LoadFromReader reads the configuration data given and sets up the auth config +// information with given directory and populates the receiver object +func (configFile *ConfigFile) LoadFromReader(configData io.Reader) error { + if err := json.NewDecoder(configData).Decode(&configFile); err != nil && !errors.Is(err, io.EOF) { + return err + } + var err error + for addr, ac := range configFile.AuthConfigs { + if ac.Auth != "" { + ac.Username, ac.Password, err = decodeAuth(ac.Auth) + if err != nil { + return err + } + } + ac.Auth = "" + ac.ServerAddress = addr + configFile.AuthConfigs[addr] = ac + } + return checkKubernetesConfiguration(configFile.Kubernetes) +} + +// ContainsAuth returns whether there is authentication configured +// in this file or not. +func (configFile *ConfigFile) ContainsAuth() bool { + return configFile.CredentialsStore != "" || + len(configFile.CredentialHelpers) > 0 || + len(configFile.AuthConfigs) > 0 +} + +// GetAuthConfigs returns the mapping of repo to auth configuration +func (configFile *ConfigFile) GetAuthConfigs() map[string]types.AuthConfig { + return configFile.AuthConfigs +} + +// SaveToWriter encodes and writes out all the authorization information to +// the given writer +func (configFile *ConfigFile) SaveToWriter(writer io.Writer) error { + // Encode sensitive data into a new/temp struct + tmpAuthConfigs := make(map[string]types.AuthConfig, len(configFile.AuthConfigs)) + for k, authConfig := range configFile.AuthConfigs { + authCopy := authConfig + // encode and save the authstring, while blanking out the original fields + authCopy.Auth = encodeAuth(&authCopy) + authCopy.Username = "" + authCopy.Password = "" + authCopy.ServerAddress = "" + tmpAuthConfigs[k] = authCopy + } + + saveAuthConfigs := configFile.AuthConfigs + configFile.AuthConfigs = tmpAuthConfigs + defer func() { configFile.AuthConfigs = saveAuthConfigs }() + + // User-Agent header is automatically set, and should not be stored in the configuration + for v := range configFile.HTTPHeaders { + if strings.EqualFold(v, "User-Agent") { + delete(configFile.HTTPHeaders, v) + } + } + + data, err := json.MarshalIndent(configFile, "", "\t") + if err != nil { + return err + } + _, err = writer.Write(data) + return err +} + +// Save encodes and writes out all the authorization information +func (configFile *ConfigFile) Save() (retErr error) { + if configFile.Filename == "" { + return errors.Errorf("Can't save config with empty filename") + } + + dir := filepath.Dir(configFile.Filename) + if err := os.MkdirAll(dir, 0700); err != nil { + return err + } + temp, err := ioutil.TempFile(dir, filepath.Base(configFile.Filename)) + if err != nil { + return err + } + defer func() { + temp.Close() + if retErr != nil { + if err := os.Remove(temp.Name()); err != nil { + logrus.WithError(err).WithField("file", temp.Name()).Debug("Error cleaning up temp file") + } + } + }() + + err = configFile.SaveToWriter(temp) + if err != nil { + return err + } + + if err := temp.Close(); err != nil { + return errors.Wrap(err, "error closing temp file") + } + + // Handle situation where the configfile is a symlink + cfgFile := configFile.Filename + if f, err := os.Readlink(cfgFile); err == nil { + cfgFile = f + } + + // Try copying the current config file (if any) ownership and permissions + copyFilePermissions(cfgFile, temp.Name()) + return os.Rename(temp.Name(), cfgFile) +} + +// ParseProxyConfig computes proxy configuration by retrieving the config for the provided host and +// then checking this against any environment variables provided to the container +func (configFile *ConfigFile) ParseProxyConfig(host string, runOpts map[string]*string) map[string]*string { + var cfgKey string + + if _, ok := configFile.Proxies[host]; !ok { + cfgKey = "default" + } else { + cfgKey = host + } + + config := configFile.Proxies[cfgKey] + permitted := map[string]*string{ + "HTTP_PROXY": &config.HTTPProxy, + "HTTPS_PROXY": &config.HTTPSProxy, + "NO_PROXY": &config.NoProxy, + "FTP_PROXY": &config.FTPProxy, + } + m := runOpts + if m == nil { + m = make(map[string]*string) + } + for k := range permitted { + if *permitted[k] == "" { + continue + } + if _, ok := m[k]; !ok { + m[k] = permitted[k] + } + if _, ok := m[strings.ToLower(k)]; !ok { + m[strings.ToLower(k)] = permitted[k] + } + } + return m +} + +// encodeAuth creates a base64 encoded string to containing authorization information +func encodeAuth(authConfig *types.AuthConfig) string { + if authConfig.Username == "" && authConfig.Password == "" { + return "" + } + + authStr := authConfig.Username + ":" + authConfig.Password + msg := []byte(authStr) + encoded := make([]byte, base64.StdEncoding.EncodedLen(len(msg))) + base64.StdEncoding.Encode(encoded, msg) + return string(encoded) +} + +// decodeAuth decodes a base64 encoded string and returns username and password +func decodeAuth(authStr string) (string, string, error) { + if authStr == "" { + return "", "", nil + } + + decLen := base64.StdEncoding.DecodedLen(len(authStr)) + decoded := make([]byte, decLen) + authByte := []byte(authStr) + n, err := base64.StdEncoding.Decode(decoded, authByte) + if err != nil { + return "", "", err + } + if n > decLen { + return "", "", errors.Errorf("Something went wrong decoding auth config") + } + arr := strings.SplitN(string(decoded), ":", 2) + if len(arr) != 2 { + return "", "", errors.Errorf("Invalid auth configuration file") + } + password := strings.Trim(arr[1], "\x00") + return arr[0], password, nil +} + +// GetCredentialsStore returns a new credentials store from the settings in the +// configuration file +func (configFile *ConfigFile) GetCredentialsStore(registryHostname string) credentials.Store { + if helper := getConfiguredCredentialStore(configFile, registryHostname); helper != "" { + return newNativeStore(configFile, helper) + } + return credentials.NewFileStore(configFile) +} + +// var for unit testing. +var newNativeStore = func(configFile *ConfigFile, helperSuffix string) credentials.Store { + return credentials.NewNativeStore(configFile, helperSuffix) +} + +// GetAuthConfig for a repository from the credential store +func (configFile *ConfigFile) GetAuthConfig(registryHostname string) (types.AuthConfig, error) { + return configFile.GetCredentialsStore(registryHostname).Get(registryHostname) +} + +// getConfiguredCredentialStore returns the credential helper configured for the +// given registry, the default credsStore, or the empty string if neither are +// configured. +func getConfiguredCredentialStore(c *ConfigFile, registryHostname string) string { + if c.CredentialHelpers != nil && registryHostname != "" { + if helper, exists := c.CredentialHelpers[registryHostname]; exists { + return helper + } + } + return c.CredentialsStore +} + +// GetAllCredentials returns all of the credentials stored in all of the +// configured credential stores. +func (configFile *ConfigFile) GetAllCredentials() (map[string]types.AuthConfig, error) { + auths := make(map[string]types.AuthConfig) + addAll := func(from map[string]types.AuthConfig) { + for reg, ac := range from { + auths[reg] = ac + } + } + + defaultStore := configFile.GetCredentialsStore("") + newAuths, err := defaultStore.GetAll() + if err != nil { + return nil, err + } + addAll(newAuths) + + // Auth configs from a registry-specific helper should override those from the default store. + for registryHostname := range configFile.CredentialHelpers { + newAuth, err := configFile.GetAuthConfig(registryHostname) + if err != nil { + return nil, err + } + auths[registryHostname] = newAuth + } + return auths, nil +} + +// GetFilename returns the file name that this config file is based on. +func (configFile *ConfigFile) GetFilename() string { + return configFile.Filename +} + +// PluginConfig retrieves the requested option for the given plugin. +func (configFile *ConfigFile) PluginConfig(pluginname, option string) (string, bool) { + if configFile.Plugins == nil { + return "", false + } + pluginConfig, ok := configFile.Plugins[pluginname] + if !ok { + return "", false + } + value, ok := pluginConfig[option] + return value, ok +} + +// SetPluginConfig sets the option to the given value for the given +// plugin. Passing a value of "" will remove the option. If removing +// the final config item for a given plugin then also cleans up the +// overall plugin entry. +func (configFile *ConfigFile) SetPluginConfig(pluginname, option, value string) { + if configFile.Plugins == nil { + configFile.Plugins = make(map[string]map[string]string) + } + pluginConfig, ok := configFile.Plugins[pluginname] + if !ok { + pluginConfig = make(map[string]string) + configFile.Plugins[pluginname] = pluginConfig + } + if value != "" { + pluginConfig[option] = value + } else { + delete(pluginConfig, option) + } + if len(pluginConfig) == 0 { + delete(configFile.Plugins, pluginname) + } +} + +func checkKubernetesConfiguration(kubeConfig *KubernetesConfig) error { + if kubeConfig == nil { + return nil + } + switch kubeConfig.AllNamespaces { + case "": + case "enabled": + case "disabled": + default: + return fmt.Errorf("invalid 'kubernetes.allNamespaces' value, should be 'enabled' or 'disabled': %s", kubeConfig.AllNamespaces) + } + return nil +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go b/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go new file mode 100644 index 000000000..3ca65c614 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go @@ -0,0 +1,35 @@ +// +build !windows + +package configfile + +import ( + "os" + "syscall" +) + +// copyFilePermissions copies file ownership and permissions from "src" to "dst", +// ignoring any error during the process. +func copyFilePermissions(src, dst string) { + var ( + mode os.FileMode = 0600 + uid, gid int + ) + + fi, err := os.Stat(src) + if err != nil { + return + } + if fi.Mode().IsRegular() { + mode = fi.Mode() + } + if err := os.Chmod(dst, mode); err != nil { + return + } + + uid = int(fi.Sys().(*syscall.Stat_t).Uid) + gid = int(fi.Sys().(*syscall.Stat_t).Gid) + + if uid > 0 && gid > 0 { + _ = os.Chown(dst, uid, gid) + } +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file_windows.go b/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file_windows.go new file mode 100644 index 000000000..42fffc39a --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/configfile/file_windows.go @@ -0,0 +1,5 @@ +package configfile + +func copyFilePermissions(src, dst string) { + // TODO implement for Windows +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/credentials/credentials.go b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/credentials.go new file mode 100644 index 000000000..28d58ec48 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/credentials.go @@ -0,0 +1,17 @@ +package credentials + +import ( + "github.com/docker/cli/cli/config/types" +) + +// Store is the interface that any credentials store must implement. +type Store interface { + // Erase removes credentials from the store for a given server. + Erase(serverAddress string) error + // Get retrieves credentials from the store for a given server. + Get(serverAddress string) (types.AuthConfig, error) + // GetAll retrieves all the credentials from the store. + GetAll() (map[string]types.AuthConfig, error) + // Store saves credentials in the store. + Store(authConfig types.AuthConfig) error +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store.go b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store.go new file mode 100644 index 000000000..402235bff --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store.go @@ -0,0 +1,21 @@ +package credentials + +import ( + exec "golang.org/x/sys/execabs" +) + +// DetectDefaultStore return the default credentials store for the platform if +// the store executable is available. +func DetectDefaultStore(store string) string { + platformDefault := defaultCredentialsStore() + + // user defined or no default for platform + if store != "" || platformDefault == "" { + return store + } + + if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err == nil { + return platformDefault + } + return "" +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_darwin.go b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_darwin.go new file mode 100644 index 000000000..5d42dec62 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_darwin.go @@ -0,0 +1,5 @@ +package credentials + +func defaultCredentialsStore() string { + return "osxkeychain" +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_linux.go b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_linux.go new file mode 100644 index 000000000..a9012c6d4 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_linux.go @@ -0,0 +1,13 @@ +package credentials + +import ( + "os/exec" +) + +func defaultCredentialsStore() string { + if _, err := exec.LookPath("pass"); err == nil { + return "pass" + } + + return "secretservice" +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go new file mode 100644 index 000000000..3028168ac --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_unsupported.go @@ -0,0 +1,7 @@ +// +build !windows,!darwin,!linux + +package credentials + +func defaultCredentialsStore() string { + return "" +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_windows.go b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_windows.go new file mode 100644 index 000000000..bb799ca61 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/default_store_windows.go @@ -0,0 +1,5 @@ +package credentials + +func defaultCredentialsStore() string { + return "wincred" +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/credentials/file_store.go b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/file_store.go new file mode 100644 index 000000000..e509820b7 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/file_store.go @@ -0,0 +1,81 @@ +package credentials + +import ( + "strings" + + "github.com/docker/cli/cli/config/types" +) + +type store interface { + Save() error + GetAuthConfigs() map[string]types.AuthConfig + GetFilename() string +} + +// fileStore implements a credentials store using +// the docker configuration file to keep the credentials in plain text. +type fileStore struct { + file store +} + +// NewFileStore creates a new file credentials store. +func NewFileStore(file store) Store { + return &fileStore{file: file} +} + +// Erase removes the given credentials from the file store. +func (c *fileStore) Erase(serverAddress string) error { + delete(c.file.GetAuthConfigs(), serverAddress) + return c.file.Save() +} + +// Get retrieves credentials for a specific server from the file store. +func (c *fileStore) Get(serverAddress string) (types.AuthConfig, error) { + authConfig, ok := c.file.GetAuthConfigs()[serverAddress] + if !ok { + // Maybe they have a legacy config file, we will iterate the keys converting + // them to the new format and testing + for r, ac := range c.file.GetAuthConfigs() { + if serverAddress == ConvertToHostname(r) { + return ac, nil + } + } + + authConfig = types.AuthConfig{} + } + return authConfig, nil +} + +func (c *fileStore) GetAll() (map[string]types.AuthConfig, error) { + return c.file.GetAuthConfigs(), nil +} + +// Store saves the given credentials in the file store. +func (c *fileStore) Store(authConfig types.AuthConfig) error { + c.file.GetAuthConfigs()[authConfig.ServerAddress] = authConfig + return c.file.Save() +} + +func (c *fileStore) GetFilename() string { + return c.file.GetFilename() +} + +func (c *fileStore) IsFileStore() bool { + return true +} + +// ConvertToHostname converts a registry url which has http|https prepended +// to just an hostname. +// Copied from github.com/docker/docker/registry.ConvertToHostname to reduce dependencies. +func ConvertToHostname(url string) string { + stripped := url + if strings.HasPrefix(url, "http://") { + stripped = strings.TrimPrefix(url, "http://") + } else if strings.HasPrefix(url, "https://") { + stripped = strings.TrimPrefix(url, "https://") + } + + nameParts := strings.SplitN(stripped, "/", 2) + + return nameParts[0] +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/credentials/native_store.go b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/native_store.go new file mode 100644 index 000000000..afe542cc3 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/credentials/native_store.go @@ -0,0 +1,143 @@ +package credentials + +import ( + "github.com/docker/cli/cli/config/types" + "github.com/docker/docker-credential-helpers/client" + "github.com/docker/docker-credential-helpers/credentials" +) + +const ( + remoteCredentialsPrefix = "docker-credential-" + tokenUsername = "" +) + +// nativeStore implements a credentials store +// using native keychain to keep credentials secure. +// It piggybacks into a file store to keep users' emails. +type nativeStore struct { + programFunc client.ProgramFunc + fileStore Store +} + +// NewNativeStore creates a new native store that +// uses a remote helper program to manage credentials. +func NewNativeStore(file store, helperSuffix string) Store { + name := remoteCredentialsPrefix + helperSuffix + return &nativeStore{ + programFunc: client.NewShellProgramFunc(name), + fileStore: NewFileStore(file), + } +} + +// Erase removes the given credentials from the native store. +func (c *nativeStore) Erase(serverAddress string) error { + if err := client.Erase(c.programFunc, serverAddress); err != nil { + return err + } + + // Fallback to plain text store to remove email + return c.fileStore.Erase(serverAddress) +} + +// Get retrieves credentials for a specific server from the native store. +func (c *nativeStore) Get(serverAddress string) (types.AuthConfig, error) { + // load user email if it exist or an empty auth config. + auth, _ := c.fileStore.Get(serverAddress) + + creds, err := c.getCredentialsFromStore(serverAddress) + if err != nil { + return auth, err + } + auth.Username = creds.Username + auth.IdentityToken = creds.IdentityToken + auth.Password = creds.Password + + return auth, nil +} + +// GetAll retrieves all the credentials from the native store. +func (c *nativeStore) GetAll() (map[string]types.AuthConfig, error) { + auths, err := c.listCredentialsInStore() + if err != nil { + return nil, err + } + + // Emails are only stored in the file store. + // This call can be safely eliminated when emails are removed. + fileConfigs, _ := c.fileStore.GetAll() + + authConfigs := make(map[string]types.AuthConfig) + for registry := range auths { + creds, err := c.getCredentialsFromStore(registry) + if err != nil { + return nil, err + } + ac := fileConfigs[registry] // might contain Email + ac.Username = creds.Username + ac.Password = creds.Password + ac.IdentityToken = creds.IdentityToken + authConfigs[registry] = ac + } + + return authConfigs, nil +} + +// Store saves the given credentials in the file store. +func (c *nativeStore) Store(authConfig types.AuthConfig) error { + if err := c.storeCredentialsInStore(authConfig); err != nil { + return err + } + authConfig.Username = "" + authConfig.Password = "" + authConfig.IdentityToken = "" + + // Fallback to old credential in plain text to save only the email + return c.fileStore.Store(authConfig) +} + +// storeCredentialsInStore executes the command to store the credentials in the native store. +func (c *nativeStore) storeCredentialsInStore(config types.AuthConfig) error { + creds := &credentials.Credentials{ + ServerURL: config.ServerAddress, + Username: config.Username, + Secret: config.Password, + } + + if config.IdentityToken != "" { + creds.Username = tokenUsername + creds.Secret = config.IdentityToken + } + + return client.Store(c.programFunc, creds) +} + +// getCredentialsFromStore executes the command to get the credentials from the native store. +func (c *nativeStore) getCredentialsFromStore(serverAddress string) (types.AuthConfig, error) { + var ret types.AuthConfig + + creds, err := client.Get(c.programFunc, serverAddress) + if err != nil { + if credentials.IsErrCredentialsNotFound(err) { + // do not return an error if the credentials are not + // in the keychain. Let docker ask for new credentials. + return ret, nil + } + return ret, err + } + + if creds.Username == tokenUsername { + ret.IdentityToken = creds.Secret + } else { + ret.Password = creds.Secret + ret.Username = creds.Username + } + + ret.ServerAddress = serverAddress + return ret, nil +} + +// listCredentialsInStore returns a listing of stored credentials as a map of +// URL -> username. +func (c *nativeStore) listCredentialsInStore() (map[string]string, error) { + return client.List(c.programFunc) +} diff --git a/integration-test/vendor/github.com/docker/cli/cli/config/types/authconfig.go b/integration-test/vendor/github.com/docker/cli/cli/config/types/authconfig.go new file mode 100644 index 000000000..056af6b84 --- /dev/null +++ b/integration-test/vendor/github.com/docker/cli/cli/config/types/authconfig.go @@ -0,0 +1,22 @@ +package types + +// AuthConfig contains authorization information for connecting to a Registry +type AuthConfig struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Auth string `json:"auth,omitempty"` + + // Email is an optional value associated with the username. + // This field is deprecated and will be removed in a later + // version of docker. + Email string `json:"email,omitempty"` + + ServerAddress string `json:"serveraddress,omitempty"` + + // IdentityToken is used to authenticate the user and get + // an access token for the registry. + IdentityToken string `json:"identitytoken,omitempty"` + + // RegistryToken is a bearer token to be sent to a registry + RegistryToken string `json:"registrytoken,omitempty"` +} diff --git a/integration-test/vendor/github.com/docker/distribution/LICENSE b/integration-test/vendor/github.com/docker/distribution/LICENSE new file mode 100644 index 000000000..e06d20818 --- /dev/null +++ b/integration-test/vendor/github.com/docker/distribution/LICENSE @@ -0,0 +1,202 @@ +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. + diff --git a/integration-test/vendor/github.com/docker/distribution/registry/client/auth/challenge/addr.go b/integration-test/vendor/github.com/docker/distribution/registry/client/auth/challenge/addr.go new file mode 100644 index 000000000..2c3ebe165 --- /dev/null +++ b/integration-test/vendor/github.com/docker/distribution/registry/client/auth/challenge/addr.go @@ -0,0 +1,27 @@ +package challenge + +import ( + "net/url" + "strings" +) + +// FROM: https://golang.org/src/net/http/http.go +// Given a string of the form "host", "host:port", or "[ipv6::address]:port", +// return true if the string includes a port. +func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") } + +// FROM: http://golang.org/src/net/http/transport.go +var portMap = map[string]string{ + "http": "80", + "https": "443", +} + +// canonicalAddr returns url.Host but always with a ":port" suffix +// FROM: http://golang.org/src/net/http/transport.go +func canonicalAddr(url *url.URL) string { + addr := url.Host + if !hasPort(addr) { + return addr + ":" + portMap[url.Scheme] + } + return addr +} diff --git a/integration-test/vendor/github.com/docker/distribution/registry/client/auth/challenge/authchallenge.go b/integration-test/vendor/github.com/docker/distribution/registry/client/auth/challenge/authchallenge.go new file mode 100644 index 000000000..6e3f1ccc4 --- /dev/null +++ b/integration-test/vendor/github.com/docker/distribution/registry/client/auth/challenge/authchallenge.go @@ -0,0 +1,237 @@ +package challenge + +import ( + "fmt" + "net/http" + "net/url" + "strings" + "sync" +) + +// Challenge carries information from a WWW-Authenticate response header. +// See RFC 2617. +type Challenge struct { + // Scheme is the auth-scheme according to RFC 2617 + Scheme string + + // Parameters are the auth-params according to RFC 2617 + Parameters map[string]string +} + +// Manager manages the challenges for endpoints. +// The challenges are pulled out of HTTP responses. Only +// responses which expect challenges should be added to +// the manager, since a non-unauthorized request will be +// viewed as not requiring challenges. +type Manager interface { + // GetChallenges returns the challenges for the given + // endpoint URL. + GetChallenges(endpoint url.URL) ([]Challenge, error) + + // AddResponse adds the response to the challenge + // manager. The challenges will be parsed out of + // the WWW-Authenicate headers and added to the + // URL which was produced the response. If the + // response was authorized, any challenges for the + // endpoint will be cleared. + AddResponse(resp *http.Response) error +} + +// NewSimpleManager returns an instance of +// Manger which only maps endpoints to challenges +// based on the responses which have been added the +// manager. The simple manager will make no attempt to +// perform requests on the endpoints or cache the responses +// to a backend. +func NewSimpleManager() Manager { + return &simpleManager{ + Challenges: make(map[string][]Challenge), + } +} + +type simpleManager struct { + sync.RWMutex + Challenges map[string][]Challenge +} + +func normalizeURL(endpoint *url.URL) { + endpoint.Host = strings.ToLower(endpoint.Host) + endpoint.Host = canonicalAddr(endpoint) +} + +func (m *simpleManager) GetChallenges(endpoint url.URL) ([]Challenge, error) { + normalizeURL(&endpoint) + + m.RLock() + defer m.RUnlock() + challenges := m.Challenges[endpoint.String()] + return challenges, nil +} + +func (m *simpleManager) AddResponse(resp *http.Response) error { + challenges := ResponseChallenges(resp) + if resp.Request == nil { + return fmt.Errorf("missing request reference") + } + urlCopy := url.URL{ + Path: resp.Request.URL.Path, + Host: resp.Request.URL.Host, + Scheme: resp.Request.URL.Scheme, + } + normalizeURL(&urlCopy) + + m.Lock() + defer m.Unlock() + m.Challenges[urlCopy.String()] = challenges + return nil +} + +// Octet types from RFC 2616. +type octetType byte + +var octetTypes [256]octetType + +const ( + isToken octetType = 1 << iota + isSpace +) + +func init() { + // OCTET = + // CHAR = + // CTL = + // CR = + // LF = + // SP = + // HT = + // <"> = + // CRLF = CR LF + // LWS = [CRLF] 1*( SP | HT ) + // TEXT = + // separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> + // | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT + // token = 1* + // qdtext = > + + for c := 0; c < 256; c++ { + var t octetType + isCtl := c <= 31 || c == 127 + isChar := 0 <= c && c <= 127 + isSeparator := strings.IndexRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) >= 0 + if strings.IndexRune(" \t\r\n", rune(c)) >= 0 { + t |= isSpace + } + if isChar && !isCtl && !isSeparator { + t |= isToken + } + octetTypes[c] = t + } +} + +// ResponseChallenges returns a list of authorization challenges +// for the given http Response. Challenges are only checked if +// the response status code was a 401. +func ResponseChallenges(resp *http.Response) []Challenge { + if resp.StatusCode == http.StatusUnauthorized { + // Parse the WWW-Authenticate Header and store the challenges + // on this endpoint object. + return parseAuthHeader(resp.Header) + } + + return nil +} + +func parseAuthHeader(header http.Header) []Challenge { + challenges := []Challenge{} + for _, h := range header[http.CanonicalHeaderKey("WWW-Authenticate")] { + v, p := parseValueAndParams(h) + if v != "" { + challenges = append(challenges, Challenge{Scheme: v, Parameters: p}) + } + } + return challenges +} + +func parseValueAndParams(header string) (value string, params map[string]string) { + params = make(map[string]string) + value, s := expectToken(header) + if value == "" { + return + } + value = strings.ToLower(value) + s = "," + skipSpace(s) + for strings.HasPrefix(s, ",") { + var pkey string + pkey, s = expectToken(skipSpace(s[1:])) + if pkey == "" { + return + } + if !strings.HasPrefix(s, "=") { + return + } + var pvalue string + pvalue, s = expectTokenOrQuoted(s[1:]) + if pvalue == "" { + return + } + pkey = strings.ToLower(pkey) + params[pkey] = pvalue + s = skipSpace(s) + } + return +} + +func skipSpace(s string) (rest string) { + i := 0 + for ; i < len(s); i++ { + if octetTypes[s[i]]&isSpace == 0 { + break + } + } + return s[i:] +} + +func expectToken(s string) (token, rest string) { + i := 0 + for ; i < len(s); i++ { + if octetTypes[s[i]]&isToken == 0 { + break + } + } + return s[:i], s[i:] +} + +func expectTokenOrQuoted(s string) (value string, rest string) { + if !strings.HasPrefix(s, "\"") { + return expectToken(s) + } + s = s[1:] + for i := 0; i < len(s); i++ { + switch s[i] { + case '"': + return s[:i], s[i+1:] + case '\\': + p := make([]byte, len(s)-1) + j := copy(p, s[:i]) + escape := true + for i = i + 1; i < len(s); i++ { + b := s[i] + switch { + case escape: + escape = false + p[j] = b + j++ + case b == '\\': + escape = true + case b == '"': + return string(p[:j]), s[i+1:] + default: + p[j] = b + j++ + } + } + return "", "" + } + } + return "", "" +} diff --git a/integration-test/vendor/github.com/docker/docker-credential-helpers/LICENSE b/integration-test/vendor/github.com/docker/docker-credential-helpers/LICENSE new file mode 100644 index 000000000..1ea555e2a --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker-credential-helpers/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2016 David Calavera + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/integration-test/vendor/github.com/docker/docker-credential-helpers/client/client.go b/integration-test/vendor/github.com/docker/docker-credential-helpers/client/client.go new file mode 100644 index 000000000..d1d0434cb --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker-credential-helpers/client/client.go @@ -0,0 +1,121 @@ +package client + +import ( + "bytes" + "encoding/json" + "fmt" + "strings" + + "github.com/docker/docker-credential-helpers/credentials" +) + +// isValidCredsMessage checks if 'msg' contains invalid credentials error message. +// It returns whether the logs are free of invalid credentials errors and the error if it isn't. +// error values can be errCredentialsMissingServerURL or errCredentialsMissingUsername. +func isValidCredsMessage(msg string) error { + if credentials.IsCredentialsMissingServerURLMessage(msg) { + return credentials.NewErrCredentialsMissingServerURL() + } + + if credentials.IsCredentialsMissingUsernameMessage(msg) { + return credentials.NewErrCredentialsMissingUsername() + } + + return nil +} + +// Store uses an external program to save credentials. +func Store(program ProgramFunc, creds *credentials.Credentials) error { + cmd := program("store") + + buffer := new(bytes.Buffer) + if err := json.NewEncoder(buffer).Encode(creds); err != nil { + return err + } + cmd.Input(buffer) + + out, err := cmd.Output() + if err != nil { + t := strings.TrimSpace(string(out)) + + if isValidErr := isValidCredsMessage(t); isValidErr != nil { + err = isValidErr + } + + return fmt.Errorf("error storing credentials - err: %v, out: `%s`", err, t) + } + + return nil +} + +// Get executes an external program to get the credentials from a native store. +func Get(program ProgramFunc, serverURL string) (*credentials.Credentials, error) { + cmd := program("get") + cmd.Input(strings.NewReader(serverURL)) + + out, err := cmd.Output() + if err != nil { + t := strings.TrimSpace(string(out)) + + if credentials.IsErrCredentialsNotFoundMessage(t) { + return nil, credentials.NewErrCredentialsNotFound() + } + + if isValidErr := isValidCredsMessage(t); isValidErr != nil { + err = isValidErr + } + + return nil, fmt.Errorf("error getting credentials - err: %v, out: `%s`", err, t) + } + + resp := &credentials.Credentials{ + ServerURL: serverURL, + } + + if err := json.NewDecoder(bytes.NewReader(out)).Decode(resp); err != nil { + return nil, err + } + + return resp, nil +} + +// Erase executes a program to remove the server credentials from the native store. +func Erase(program ProgramFunc, serverURL string) error { + cmd := program("erase") + cmd.Input(strings.NewReader(serverURL)) + out, err := cmd.Output() + if err != nil { + t := strings.TrimSpace(string(out)) + + if isValidErr := isValidCredsMessage(t); isValidErr != nil { + err = isValidErr + } + + return fmt.Errorf("error erasing credentials - err: %v, out: `%s`", err, t) + } + + return nil +} + +// List executes a program to list server credentials in the native store. +func List(program ProgramFunc) (map[string]string, error) { + cmd := program("list") + cmd.Input(strings.NewReader("unused")) + out, err := cmd.Output() + if err != nil { + t := strings.TrimSpace(string(out)) + + if isValidErr := isValidCredsMessage(t); isValidErr != nil { + err = isValidErr + } + + return nil, fmt.Errorf("error listing credentials - err: %v, out: `%s`", err, t) + } + + var resp map[string]string + if err = json.NewDecoder(bytes.NewReader(out)).Decode(&resp); err != nil { + return nil, err + } + + return resp, nil +} diff --git a/integration-test/vendor/github.com/docker/docker-credential-helpers/client/command.go b/integration-test/vendor/github.com/docker/docker-credential-helpers/client/command.go new file mode 100644 index 000000000..8da334306 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker-credential-helpers/client/command.go @@ -0,0 +1,56 @@ +package client + +import ( + "fmt" + "io" + "os" + "os/exec" +) + +// Program is an interface to execute external programs. +type Program interface { + Output() ([]byte, error) + Input(in io.Reader) +} + +// ProgramFunc is a type of function that initializes programs based on arguments. +type ProgramFunc func(args ...string) Program + +// NewShellProgramFunc creates programs that are executed in a Shell. +func NewShellProgramFunc(name string) ProgramFunc { + return NewShellProgramFuncWithEnv(name, nil) +} + +// NewShellProgramFuncWithEnv creates programs that are executed in a Shell with environment variables +func NewShellProgramFuncWithEnv(name string, env *map[string]string) ProgramFunc { + return func(args ...string) Program { + return &Shell{cmd: createProgramCmdRedirectErr(name, args, env)} + } +} + +func createProgramCmdRedirectErr(commandName string, args []string, env *map[string]string) *exec.Cmd { + programCmd := exec.Command(commandName, args...) + programCmd.Env = os.Environ() + if env != nil { + for k, v := range *env { + programCmd.Env = append(programCmd.Env, fmt.Sprintf("%s=%s", k, v)) + } + } + programCmd.Stderr = os.Stderr + return programCmd +} + +// Shell invokes shell commands to talk with a remote credentials helper. +type Shell struct { + cmd *exec.Cmd +} + +// Output returns responses from the remote credentials helper. +func (s *Shell) Output() ([]byte, error) { + return s.cmd.Output() +} + +// Input sets the input to send to a remote credentials helper. +func (s *Shell) Input(in io.Reader) { + s.cmd.Stdin = in +} diff --git a/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/credentials.go b/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/credentials.go new file mode 100644 index 000000000..da8b594e7 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/credentials.go @@ -0,0 +1,186 @@ +package credentials + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "io" + "os" + "strings" +) + +// Credentials holds the information shared between docker and the credentials store. +type Credentials struct { + ServerURL string + Username string + Secret string +} + +// isValid checks the integrity of Credentials object such that no credentials lack +// a server URL or a username. +// It returns whether the credentials are valid and the error if it isn't. +// error values can be errCredentialsMissingServerURL or errCredentialsMissingUsername +func (c *Credentials) isValid() (bool, error) { + if len(c.ServerURL) == 0 { + return false, NewErrCredentialsMissingServerURL() + } + + if len(c.Username) == 0 { + return false, NewErrCredentialsMissingUsername() + } + + return true, nil +} + +// CredsLabel holds the way Docker credentials should be labeled as such in credentials stores that allow labelling. +// That label allows to filter out non-Docker credentials too at lookup/search in macOS keychain, +// Windows credentials manager and Linux libsecret. Default value is "Docker Credentials" +var CredsLabel = "Docker Credentials" + +// SetCredsLabel is a simple setter for CredsLabel +func SetCredsLabel(label string) { + CredsLabel = label +} + +// Serve initializes the credentials helper and parses the action argument. +// This function is designed to be called from a command line interface. +// It uses os.Args[1] as the key for the action. +// It uses os.Stdin as input and os.Stdout as output. +// This function terminates the program with os.Exit(1) if there is an error. +func Serve(helper Helper) { + var err error + if len(os.Args) != 2 { + err = fmt.Errorf("Usage: %s ", os.Args[0]) + } + + if err == nil { + err = HandleCommand(helper, os.Args[1], os.Stdin, os.Stdout) + } + + if err != nil { + fmt.Fprintf(os.Stdout, "%v\n", err) + os.Exit(1) + } +} + +// HandleCommand uses a helper and a key to run a credential action. +func HandleCommand(helper Helper, key string, in io.Reader, out io.Writer) error { + switch key { + case "store": + return Store(helper, in) + case "get": + return Get(helper, in, out) + case "erase": + return Erase(helper, in) + case "list": + return List(helper, out) + case "version": + return PrintVersion(out) + } + return fmt.Errorf("Unknown credential action `%s`", key) +} + +// Store uses a helper and an input reader to save credentials. +// The reader must contain the JSON serialization of a Credentials struct. +func Store(helper Helper, reader io.Reader) error { + scanner := bufio.NewScanner(reader) + + buffer := new(bytes.Buffer) + for scanner.Scan() { + buffer.Write(scanner.Bytes()) + } + + if err := scanner.Err(); err != nil && err != io.EOF { + return err + } + + var creds Credentials + if err := json.NewDecoder(buffer).Decode(&creds); err != nil { + return err + } + + if ok, err := creds.isValid(); !ok { + return err + } + + return helper.Add(&creds) +} + +// Get retrieves the credentials for a given server url. +// The reader must contain the server URL to search. +// The writer is used to write the JSON serialization of the credentials. +func Get(helper Helper, reader io.Reader, writer io.Writer) error { + scanner := bufio.NewScanner(reader) + + buffer := new(bytes.Buffer) + for scanner.Scan() { + buffer.Write(scanner.Bytes()) + } + + if err := scanner.Err(); err != nil && err != io.EOF { + return err + } + + serverURL := strings.TrimSpace(buffer.String()) + if len(serverURL) == 0 { + return NewErrCredentialsMissingServerURL() + } + + username, secret, err := helper.Get(serverURL) + if err != nil { + return err + } + + resp := Credentials{ + ServerURL: serverURL, + Username: username, + Secret: secret, + } + + buffer.Reset() + if err := json.NewEncoder(buffer).Encode(resp); err != nil { + return err + } + + fmt.Fprint(writer, buffer.String()) + return nil +} + +// Erase removes credentials from the store. +// The reader must contain the server URL to remove. +func Erase(helper Helper, reader io.Reader) error { + scanner := bufio.NewScanner(reader) + + buffer := new(bytes.Buffer) + for scanner.Scan() { + buffer.Write(scanner.Bytes()) + } + + if err := scanner.Err(); err != nil && err != io.EOF { + return err + } + + serverURL := strings.TrimSpace(buffer.String()) + if len(serverURL) == 0 { + return NewErrCredentialsMissingServerURL() + } + + return helper.Delete(serverURL) +} + +//List returns all the serverURLs of keys in +//the OS store as a list of strings +func List(helper Helper, writer io.Writer) error { + accts, err := helper.List() + if err != nil { + return err + } + return json.NewEncoder(writer).Encode(accts) +} + +//PrintVersion outputs the current version. +func PrintVersion(writer io.Writer) error { + fmt.Fprintln(writer, Version) + return nil +} diff --git a/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/error.go b/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/error.go new file mode 100644 index 000000000..fe6a5aef4 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/error.go @@ -0,0 +1,102 @@ +package credentials + +const ( + // ErrCredentialsNotFound standardizes the not found error, so every helper returns + // the same message and docker can handle it properly. + errCredentialsNotFoundMessage = "credentials not found in native keychain" + + // ErrCredentialsMissingServerURL and ErrCredentialsMissingUsername standardize + // invalid credentials or credentials management operations + errCredentialsMissingServerURLMessage = "no credentials server URL" + errCredentialsMissingUsernameMessage = "no credentials username" +) + +// errCredentialsNotFound represents an error +// raised when credentials are not in the store. +type errCredentialsNotFound struct{} + +// Error returns the standard error message +// for when the credentials are not in the store. +func (errCredentialsNotFound) Error() string { + return errCredentialsNotFoundMessage +} + +// NewErrCredentialsNotFound creates a new error +// for when the credentials are not in the store. +func NewErrCredentialsNotFound() error { + return errCredentialsNotFound{} +} + +// IsErrCredentialsNotFound returns true if the error +// was caused by not having a set of credentials in a store. +func IsErrCredentialsNotFound(err error) bool { + _, ok := err.(errCredentialsNotFound) + return ok +} + +// IsErrCredentialsNotFoundMessage returns true if the error +// was caused by not having a set of credentials in a store. +// +// This function helps to check messages returned by an +// external program via its standard output. +func IsErrCredentialsNotFoundMessage(err string) bool { + return err == errCredentialsNotFoundMessage +} + +// errCredentialsMissingServerURL represents an error raised +// when the credentials object has no server URL or when no +// server URL is provided to a credentials operation requiring +// one. +type errCredentialsMissingServerURL struct{} + +func (errCredentialsMissingServerURL) Error() string { + return errCredentialsMissingServerURLMessage +} + +// errCredentialsMissingUsername represents an error raised +// when the credentials object has no username or when no +// username is provided to a credentials operation requiring +// one. +type errCredentialsMissingUsername struct{} + +func (errCredentialsMissingUsername) Error() string { + return errCredentialsMissingUsernameMessage +} + +// NewErrCredentialsMissingServerURL creates a new error for +// errCredentialsMissingServerURL. +func NewErrCredentialsMissingServerURL() error { + return errCredentialsMissingServerURL{} +} + +// NewErrCredentialsMissingUsername creates a new error for +// errCredentialsMissingUsername. +func NewErrCredentialsMissingUsername() error { + return errCredentialsMissingUsername{} +} + +// IsCredentialsMissingServerURL returns true if the error +// was an errCredentialsMissingServerURL. +func IsCredentialsMissingServerURL(err error) bool { + _, ok := err.(errCredentialsMissingServerURL) + return ok +} + +// IsCredentialsMissingServerURLMessage checks for an +// errCredentialsMissingServerURL in the error message. +func IsCredentialsMissingServerURLMessage(err string) bool { + return err == errCredentialsMissingServerURLMessage +} + +// IsCredentialsMissingUsername returns true if the error +// was an errCredentialsMissingUsername. +func IsCredentialsMissingUsername(err error) bool { + _, ok := err.(errCredentialsMissingUsername) + return ok +} + +// IsCredentialsMissingUsernameMessage checks for an +// errCredentialsMissingUsername in the error message. +func IsCredentialsMissingUsernameMessage(err string) bool { + return err == errCredentialsMissingUsernameMessage +} diff --git a/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/helper.go b/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/helper.go new file mode 100644 index 000000000..135acd254 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/helper.go @@ -0,0 +1,14 @@ +package credentials + +// Helper is the interface a credentials store helper must implement. +type Helper interface { + // Add appends credentials to the store. + Add(*Credentials) error + // Delete removes credentials from the store. + Delete(serverURL string) error + // Get retrieves credentials from the store. + // It returns username and secret as strings. + Get(serverURL string) (string, string, error) + // List returns the stored serverURLs and their associated usernames. + List() (map[string]string, error) +} diff --git a/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/version.go b/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/version.go new file mode 100644 index 000000000..c2cc3e2e0 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker-credential-helpers/credentials/version.go @@ -0,0 +1,4 @@ +package credentials + +// Version holds a string describing the current version +const Version = "0.6.3" diff --git a/integration-test/vendor/github.com/docker/docker/AUTHORS b/integration-test/vendor/github.com/docker/docker/AUTHORS new file mode 100644 index 000000000..c5f725bc1 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/AUTHORS @@ -0,0 +1,2080 @@ +# This file lists all individuals having contributed content to the repository. +# For how it is generated, see `hack/generate-authors.sh`. + +Aanand Prasad +Aaron Davidson +Aaron Feng +Aaron Huslage +Aaron L. Xu +Aaron Lehmann +Aaron Welch +Aaron.L.Xu +Abel Muiño +Abhijeet Kasurde +Abhinandan Prativadi +Abhinav Ajgaonkar +Abhishek Chanda +Abhishek Sharma +Abin Shahab +Adam Avilla +Adam Eijdenberg +Adam Kunk +Adam Miller +Adam Mills +Adam Pointer +Adam Singer +Adam Walz +Addam Hardy +Aditi Rajagopal +Aditya +Adnan Khan +Adolfo Ochagavía +Adria Casas +Adrian Moisey +Adrian Mouat +Adrian Oprea +Adrien Folie +Adrien Gallouët +Ahmed Kamal +Ahmet Alp Balkan +Aidan Feldman +Aidan Hobson Sayers +AJ Bowen +Ajey Charantimath +ajneu +Akash Gupta +Akihiro Matsushima +Akihiro Suda +Akim Demaille +Akira Koyasu +Akshay Karle +Al Tobey +alambike +Alan Scherger +Alan Thompson +Albert Callarisa +Albert Zhang +Alejandro González Hevia +Aleksa Sarai +Aleksandrs Fadins +Alena Prokharchyk +Alessandro Boch +Alessio Biancalana +Alex Chan +Alex Chen +Alex Coventry +Alex Crawford +Alex Ellis +Alex Gaynor +Alex Goodman +Alex Olshansky +Alex Samorukov +Alex Warhawk +Alexander Artemenko +Alexander Boyd +Alexander Larsson +Alexander Midlash +Alexander Morozov +Alexander Shopov +Alexandre Beslic +Alexandre Garnier +Alexandre González +Alexandre Jomin +Alexandru Sfirlogea +Alexei Margasov +Alexey Guskov +Alexey Kotlyarov +Alexey Shamrin +Alexis THOMAS +Alfred Landrum +Ali Dehghani +Alicia Lauerman +Alihan Demir +Allen Madsen +Allen Sun +almoehi +Alvaro Saurin +Alvin Deng +Alvin Richards +amangoel +Amen Belayneh +Amir Goldstein +Amit Bakshi +Amit Krishnan +Amit Shukla +Amr Gawish +Amy Lindburg +Anand Patil +AnandkumarPatel +Anatoly Borodin +Anchal Agrawal +Anda Xu +Anders Janmyr +Andre Dublin <81dublin@gmail.com> +Andre Granovsky +Andrea Luzzardi +Andrea Turli +Andreas Elvers +Andreas Köhler +Andreas Savvides +Andreas Tiefenthaler +Andrei Gherzan +Andrei Vagin +Andrew C. Bodine +Andrew Clay Shafer +Andrew Duckworth +Andrew France +Andrew Gerrand +Andrew Guenther +Andrew He +Andrew Hsu +Andrew Kuklewicz +Andrew Macgregor +Andrew Macpherson +Andrew Martin +Andrew McDonnell +Andrew Munsell +Andrew Pennebaker +Andrew Po +Andrew Weiss +Andrew Williams +Andrews Medina +Andrey Kolomentsev +Andrey Petrov +Andrey Stolbovsky +André Martins +andy +Andy Chambers +andy diller +Andy Goldstein +Andy Kipp +Andy Rothfusz +Andy Smith +Andy Wilson +Anes Hasicic +Anil Belur +Anil Madhavapeddy +Ankit Jain +Ankush Agarwal +Anonmily +Anran Qiao +Anshul Pundir +Anthon van der Neut +Anthony Baire +Anthony Bishopric +Anthony Dahanne +Anthony Sottile +Anton Löfgren +Anton Nikitin +Anton Polonskiy +Anton Tiurin +Antonio Murdaca +Antonis Kalipetis +Antony Messerli +Anuj Bahuguna +Anusha Ragunathan +apocas +Arash Deshmeh +ArikaChen +Arnaud Lefebvre +Arnaud Porterie +Arthur Barr +Arthur Gautier +Artur Meyster +Arun Gupta +Asad Saeeduddin +Asbjørn Enge +averagehuman +Avi Das +Avi Kivity +Avi Miller +Avi Vaid +ayoshitake +Azat Khuyiyakhmetov +Bardia Keyoumarsi +Barnaby Gray +Barry Allard +Bartłomiej Piotrowski +Bastiaan Bakker +bdevloed +Ben Bonnefoy +Ben Firshman +Ben Golub +Ben Gould +Ben Hall +Ben Sargent +Ben Severson +Ben Toews +Ben Wiklund +Benjamin Atkin +Benjamin Baker +Benjamin Boudreau +Benjamin Yolken +Benoit Chesneau +Bernerd Schaefer +Bernhard M. Wiedemann +Bert Goethals +Bevisy Zhang +Bharath Thiruveedula +Bhiraj Butala +Bhumika Bayani +Bilal Amarni +Bill Wang +Bily Zhang +Bin Liu +Bingshen Wang +Blake Geno +Boaz Shuster +bobby abbott +Boris Pruessmann +Boshi Lian +Bouke Haarsma +Boyd Hemphill +boynux +Bradley Cicenas +Bradley Wright +Brandon Liu +Brandon Philips +Brandon Rhodes +Brendan Dixon +Brent Salisbury +Brett Higgins +Brett Kochendorfer +Brett Randall +Brian (bex) Exelbierd +Brian Bland +Brian DeHamer +Brian Dorsey +Brian Flad +Brian Goff +Brian McCallister +Brian Olsen +Brian Schwind +Brian Shumate +Brian Torres-Gil +Brian Trump +Brice Jaglin +Briehan Lombaard +Brielle Broder +Bruno Bigras +Bruno Binet +Bruno Gazzera +Bruno Renié +Bruno Tavares +Bryan Bess +Bryan Boreham +Bryan Matsuo +Bryan Murphy +Burke Libbey +Byung Kang +Caleb Spare +Calen Pennington +Cameron Boehmer +Cameron Spear +Campbell Allen +Candid Dauth +Cao Weiwei +Carl Henrik Lunde +Carl Loa Odin +Carl X. Su +Carlo Mion +Carlos Alexandro Becker +Carlos Sanchez +Carol Fager-Higgins +Cary +Casey Bisson +Catalin Pirvu +Ce Gao +Cedric Davies +Cezar Sa Espinola +Chad Swenson +Chance Zibolski +Chander Govindarajan +Chanhun Jeong +Chao Wang +Charles Chan +Charles Hooper +Charles Law +Charles Lindsay +Charles Merriam +Charles Sarrazin +Charles Smith +Charlie Drage +Charlie Lewis +Chase Bolt +ChaYoung You +Chen Chao +Chen Chuanliang +Chen Hanxiao +Chen Min +Chen Mingjie +Chen Qiu +Cheng-mean Liu +Chengfei Shang +Chengguang Xu +chenyuzhu +Chetan Birajdar +Chewey +Chia-liang Kao +chli +Cholerae Hu +Chris Alfonso +Chris Armstrong +Chris Dias +Chris Dituri +Chris Fordham +Chris Gavin +Chris Gibson +Chris Khoo +Chris McKinnel +Chris McKinnel +Chris Seto +Chris Snow +Chris St. Pierre +Chris Stivers +Chris Swan +Chris Telfer +Chris Wahl +Chris Weyl +Chris White +Christian Berendt +Christian Brauner +Christian Böhme +Christian Muehlhaeuser +Christian Persson +Christian Rotzoll +Christian Simon +Christian Stefanescu +Christophe Mehay +Christophe Troestler +Christophe Vidal +Christopher Biscardi +Christopher Crone +Christopher Currie +Christopher Jones +Christopher Latham +Christopher Rigor +Christy Perez +Chun Chen +Ciro S. Costa +Clayton Coleman +Clinton Kitson +Cody Roseborough +Coenraad Loubser +Colin Dunklau +Colin Hebert +Colin Panisset +Colin Rice +Colin Walters +Collin Guarino +Colm Hally +companycy +Corbin Coleman +Corey Farrell +Cory Forsyth +cressie176 +CrimsonGlory +Cristian Staretu +cristiano balducci +Cruceru Calin-Cristian +CUI Wei +Cyprian Gracz +Cyril F +Daan van Berkel +Daehyeok Mun +Dafydd Crosby +dalanlan +Damian Smyth +Damien Nadé +Damien Nozay +Damjan Georgievski +Dan Anolik +Dan Buch +Dan Cotora +Dan Feldman +Dan Griffin +Dan Hirsch +Dan Keder +Dan Levy +Dan McPherson +Dan Stine +Dan Williams +Dani Hodovic +Dani Louca +Daniel Antlinger +Daniel Dao +Daniel Exner +Daniel Farrell +Daniel Garcia +Daniel Gasienica +Daniel Grunwell +Daniel Hiltgen +Daniel J Walsh +Daniel Menet +Daniel Mizyrycki +Daniel Nephin +Daniel Norberg +Daniel Nordberg +Daniel Robinson +Daniel S +Daniel Von Fange +Daniel Watkins +Daniel X Moore +Daniel YC Lin +Daniel Zhang +Danny Berger +Danny Yates +Danyal Khaliq +Darren Coxall +Darren Shepherd +Darren Stahl +Dattatraya Kumbhar +Davanum Srinivas +Dave Barboza +Dave Goodchild +Dave Henderson +Dave MacDonald +Dave Tucker +David Anderson +David Calavera +David Chung +David Corking +David Cramer +David Currie +David Davis +David Dooling +David Gageot +David Gebler +David Glasser +David Lawrence +David Lechner +David M. Karr +David Mackey +David Mat +David Mcanulty +David McKay +David P Hilton +David Pelaez +David R. Jenni +David Röthlisberger +David Sheets +David Sissitka +David Trott +David Wang <00107082@163.com> +David Williamson +David Xia +David Young +Davide Ceretti +Dawn Chen +dbdd +dcylabs +Debayan De +Deborah Gertrude Digges +deed02392 +Deep Debroy +Deng Guangxing +Deni Bertovic +Denis Defreyne +Denis Gladkikh +Denis Ollier +Dennis Chen +Dennis Chen +Dennis Docter +Derek +Derek +Derek Ch +Derek McGowan +Deric Crago +Deshi Xiao +devmeyster +Devvyn Murphy +Dharmit Shah +Dhawal Yogesh Bhanushali +Diego Romero +Diego Siqueira +Dieter Reuter +Dillon Dixon +Dima Stopel +Dimitri John Ledkov +Dimitris Mandalidis +Dimitris Rozakis +Dimitry Andric +Dinesh Subhraveti +Ding Fei +Diogo Monica +DiuDiugirl +Djibril Koné +dkumor +Dmitri Logvinenko +Dmitri Shuralyov +Dmitry Demeshchuk +Dmitry Gusev +Dmitry Kononenko +Dmitry Sharshakov +Dmitry Shyshkin +Dmitry Smirnov +Dmitry V. Krivenok +Dmitry Vorobev +Dolph Mathews +Dominik Dingel +Dominik Finkbeiner +Dominik Honnef +Don Kirkby +Don Kjer +Don Spaulding +Donald Huang +Dong Chen +Donghwa Kim +Donovan Jones +Doron Podoleanu +Doug Davis +Doug MacEachern +Doug Tangren +Douglas Curtis +Dr Nic Williams +dragon788 +Dražen Lučanin +Drew Erny +Drew Hubl +Dustin Sallings +Ed Costello +Edmund Wagner +Eiichi Tsukata +Eike Herzbach +Eivin Giske Skaaren +Eivind Uggedal +Elan Ruusamäe +Elango Sivanandam +Elena Morozova +Eli Uriegas +Elias Faxö +Elias Probst +Elijah Zupancic +eluck +Elvir Kuric +Emil Davtyan +Emil Hernvall +Emily Maier +Emily Rose +Emir Ozer +Enguerran +Eohyung Lee +epeterso +Eric Barch +Eric Curtin +Eric G. Noriega +Eric Hanchrow +Eric Lee +Eric Myhre +Eric Paris +Eric Rafaloff +Eric Rosenberg +Eric Sage +Eric Soderstrom +Eric Yang +Eric-Olivier Lamey +Erica Windisch +Erik Bray +Erik Dubbelboer +Erik Hollensbe +Erik Inge Bolsø +Erik Kristensen +Erik St. Martin +Erik Weathers +Erno Hopearuoho +Erwin van der Koogh +Ethan Bell +Euan Kemp +Eugen Krizo +Eugene Yakubovich +Evan Allrich +Evan Carmi +Evan Hazlett +Evan Krall +Evan Phoenix +Evan Wies +Evelyn Xu +Everett Toews +Evgeny Shmarnev +Evgeny Vereshchagin +Ewa Czechowska +Eystein Måløy Stenberg +ezbercih +Ezra Silvera +Fabian Kramm +Fabian Lauer +Fabian Raetz +Fabiano Rosas +Fabio Falci +Fabio Kung +Fabio Rapposelli +Fabio Rehm +Fabrizio Regini +Fabrizio Soppelsa +Faiz Khan +falmp +Fangming Fang +Fangyuan Gao <21551127@zju.edu.cn> +fanjiyun +Fareed Dudhia +Fathi Boudra +Federico Gimenez +Felipe Oliveira +Felix Abecassis +Felix Geisendörfer +Felix Hupfeld +Felix Rabe +Felix Ruess +Felix Schindler +Feng Yan +Fengtu Wang +Ferenc Szabo +Fernando +Fero Volar +Ferran Rodenas +Filipe Brandenburger +Filipe Oliveira +Flavio Castelli +Flavio Crisciani +Florian +Florian Klein +Florian Maier +Florian Noeding +Florian Weingarten +Florin Asavoaie +Florin Patan +fonglh +Foysal Iqbal +Francesc Campoy +Francesco Mari +Francis Chuang +Francisco Carriedo +Francisco Souza +Frank Groeneveld +Frank Herrmann +Frank Macreery +Frank Rosquin +Fred Lifton +Frederick F. Kautz IV +Frederik Loeffert +Frederik Nordahl Jul Sabroe +Freek Kalter +Frieder Bluemle +Fu JinLin +Félix Baylac-Jacqué +Félix Cantournet +Gabe Rosenhouse +Gabor Nagy +Gabriel Linder +Gabriel Monroy +Gabriel Nicolas Avellaneda +Gaetan de Villele +Galen Sampson +Gang Qiao +Gareth Rushgrove +Garrett Barboza +Gary Schaetz +Gaurav +gautam, prasanna +Gaël PORTAY +Genki Takiuchi +GennadySpb +Geoffrey Bachelet +Geon Kim +George Kontridze +George MacRorie +George Xie +Georgi Hristozov +Gereon Frey +German DZ +Gert van Valkenhoef +Gerwim Feiken +Ghislain Bourgeois +Giampaolo Mancini +Gianluca Borello +Gildas Cuisinier +Giovan Isa Musthofa +gissehel +Giuseppe Mazzotta +Gleb Fotengauer-Malinovskiy +Gleb M Borisov +Glyn Normington +GoBella +Goffert van Gool +Gopikannan Venugopalsamy +Gosuke Miyashita +Gou Rao +Govinda Fichtner +Grant Millar +Grant Reaber +Graydon Hoare +Greg Fausak +Greg Pflaum +Greg Stephens +Greg Thornton +Grzegorz Jaśkiewicz +Guilhem Lettron +Guilherme Salgado +Guillaume Dufour +Guillaume J. Charmes +guoxiuyan +Guri +Gurjeet Singh +Guruprasad +Gustav Sinder +gwx296173 +Günter Zöchbauer +haikuoliu +Hakan Özler +Hamish Hutchings +Hans Kristian Flaatten +Hans Rødtang +Hao Shu Wei +Hao Zhang <21521210@zju.edu.cn> +Harald Albers +Harley Laue +Harold Cooper +Harrison Turton +Harry Zhang +Harshal Patil +Harshal Patil +He Simei +He Xiaoxi +He Xin +heartlock <21521209@zju.edu.cn> +Hector Castro +Helen Xie +Henning Sprang +Hiroshi Hatake +Hiroyuki Sasagawa +Hobofan +Hollie Teal +Hong Xu +Hongbin Lu +hsinko <21551195@zju.edu.cn> +Hu Keping +Hu Tao +Huanzhong Zhang +Huayi Zhang +Hugo Duncan +Hugo Marisco <0x6875676f@gmail.com> +Hunter Blanks +huqun +Huu Nguyen +hyeongkyu.lee +Hyzhou Zhy +Iago López Galeiras +Ian Babrou +Ian Bishop +Ian Bull +Ian Calvert +Ian Campbell +Ian Chen +Ian Lee +Ian Main +Ian Philpot +Ian Truslove +Iavael +Icaro Seara +Ignacio Capurro +Igor Dolzhikov +Igor Karpovich +Iliana Weller +Ilkka Laukkanen +Ilya Dmitrichenko +Ilya Gusev +Ilya Khlopotov +imre Fitos +inglesp +Ingo Gottwald +Innovimax +Isaac Dupree +Isabel Jimenez +Isao Jonas +Iskander Sharipov +Ivan Babrou +Ivan Fraixedes +Ivan Grcic +Ivan Markin +J Bruni +J. Nunn +Jack Danger Canty +Jack Laxson +Jacob Atzen +Jacob Edelman +Jacob Tomlinson +Jacob Vallejo +Jacob Wen +Jaivish Kothari +Jake Champlin +Jake Moshenko +Jake Sanders +jakedt +James Allen +James Carey +James Carr +James DeFelice +James Harrison Fisher +James Kyburz +James Kyle +James Lal +James Mills +James Nesbitt +James Nugent +James Turnbull +James Watkins-Harvey +Jamie Hannaford +Jamshid Afshar +Jan Keromnes +Jan Koprowski +Jan Pazdziora +Jan Toebes +Jan-Gerd Tenberge +Jan-Jaap Driessen +Jana Radhakrishnan +Jannick Fahlbusch +Januar Wayong +Jared Biel +Jared Hocutt +Jaroslaw Zabiello +jaseg +Jasmine Hegman +Jason Divock +Jason Giedymin +Jason Green +Jason Hall +Jason Heiss +Jason Livesay +Jason McVetta +Jason Plum +Jason Shepherd +Jason Smith +Jason Sommer +Jason Stangroome +jaxgeller +Jay +Jay +Jay Kamat +Jean Rouge +Jean-Baptiste Barth +Jean-Baptiste Dalido +Jean-Christophe Berthon +Jean-Paul Calderone +Jean-Pierre Huynh +Jean-Tiare Le Bigot +Jeeva S. Chelladhurai +Jeff Anderson +Jeff Hajewski +Jeff Johnston +Jeff Lindsay +Jeff Mickey +Jeff Minard +Jeff Nickoloff +Jeff Silberman +Jeff Welch +Jeffrey Bolle +Jeffrey Morgan +Jeffrey van Gogh +Jenny Gebske +Jeremy Chambers +Jeremy Grosser +Jeremy Price +Jeremy Qian +Jeremy Unruh +Jeremy Yallop +Jeroen Franse +Jeroen Jacobs +Jesse Dearing +Jesse Dubay +Jessica Frazelle +Jezeniel Zapanta +Jhon Honce +Ji.Zhilong +Jian Liao +Jian Zhang +Jiang Jinyang +Jie Luo +Jihyun Hwang +Jilles Oldenbeuving +Jim Alateras +Jim Galasyn +Jim Minter +Jim Perrin +Jimmy Cuadra +Jimmy Puckett +Jimmy Song +Jinsoo Park +Jintao Zhang +Jiri Appl +Jiri Popelka +Jiuyue Ma +Jiří Župka +Joao Fernandes +Joao Trindade +Joe Beda +Joe Doliner +Joe Ferguson +Joe Gordon +Joe Shaw +Joe Van Dyk +Joel Friedly +Joel Handwell +Joel Hansson +Joel Wurtz +Joey Geiger +Joey Geiger +Joey Gibson +Joffrey F +Johan Euphrosine +Johan Rydberg +Johanan Lieberman +Johannes 'fish' Ziemke +John Costa +John Feminella +John Gardiner Myers +John Gossman +John Harris +John Howard (VM) +John Laswell +John Maguire +John Mulhausen +John OBrien III +John Starks +John Stephens +John Tims +John V. Martinez +John Warwick +John Willis +Jon Johnson +Jon Surrell +Jon Wedaman +Jonas Pfenniger +Jonathan A. Schweder +Jonathan A. Sternberg +Jonathan Boulle +Jonathan Camp +Jonathan Choy +Jonathan Dowland +Jonathan Lebon +Jonathan Lomas +Jonathan McCrohan +Jonathan Mueller +Jonathan Pares +Jonathan Rudenberg +Jonathan Stoppani +Jonh Wendell +Joni Sar +Joost Cassee +Jordan Arentsen +Jordan Jennings +Jordan Sissel +Jorge Marin +Jorit Kleine-Möllhoff +Jose Diaz-Gonzalez +Joseph Anthony Pasquale Holsten +Joseph Hager +Joseph Kern +Joseph Rothrock +Josh +Josh Bodah +Josh Bonczkowski +Josh Chorlton +Josh Eveleth +Josh Hawn +Josh Horwitz +Josh Poimboeuf +Josh Soref +Josh Wilson +Josiah Kiehl +José Tomás Albornoz +Joyce Jang +JP +Julian Taylor +Julien Barbier +Julien Bisconti +Julien Bordellier +Julien Dubois +Julien Kassar +Julien Maitrehenry +Julien Pervillé +Julio Montes +Jun-Ru Chang +Jussi Nummelin +Justas Brazauskas +Justin Cormack +Justin Force +Justin Menga +Justin Plock +Justin Simonelis +Justin Terry +Justyn Temme +Jyrki Puttonen +Jérôme Petazzoni +Jörg Thalheim +K. Heller +Kai Blin +Kai Qiang Wu (Kennan) +Kamil Domański +Kamjar Gerami +Kanstantsin Shautsou +Kara Alexandra +Karan Lyons +Kareem Khazem +kargakis +Karl Grzeszczak +Karol Duleba +Karthik Karanth +Karthik Nayak +Kasper Fabæch Brandt +Kate Heddleston +Katie McLaughlin +Kato Kazuyoshi +Katrina Owen +Kawsar Saiyeed +Kay Yan +kayrus +Kazuhiro Sera +Ke Li +Ke Xu +Kei Ohmura +Keith Hudgins +Keli Hu +Ken Cochrane +Ken Herner +Ken ICHIKAWA +Ken Reese +Kenfe-Mickaël Laventure +Kenjiro Nakayama +Kent Johnson +Kevin "qwazerty" Houdebert +Kevin Burke +Kevin Clark +Kevin Feyrer +Kevin J. Lynagh +Kevin Jing Qiu +Kevin Kern +Kevin Menard +Kevin Meredith +Kevin P. Kucharczyk +Kevin Richardson +Kevin Shi +Kevin Wallace +Kevin Yap +Keyvan Fatehi +kies +Kim BKC Carlbacker +Kim Eik +Kimbro Staken +Kir Kolyshkin +Kiran Gangadharan +Kirill SIbirev +knappe +Kohei Tsuruta +Koichi Shiraishi +Konrad Kleine +Konstantin Gribov +Konstantin L +Konstantin Pelykh +Krasi Georgiev +Krasimir Georgiev +Kris-Mikael Krister +Kristian Haugene +Kristina Zabunova +Krystian Wojcicki +Kun Zhang +Kunal Kushwaha +Kunal Tyagi +Kyle Conroy +Kyle Linden +Kyle Wuolle +kyu +Lachlan Coote +Lai Jiangshan +Lajos Papp +Lakshan Perera +Lalatendu Mohanty +Lance Chen +Lance Kinley +Lars Butler +Lars Kellogg-Stedman +Lars R. Damerow +Lars-Magnus Skog +Laszlo Meszaros +Laura Frank +Laurent Erignoux +Laurie Voss +Leandro Siqueira +Lee Chao <932819864@qq.com> +Lee, Meng-Han +leeplay +Lei Gong +Lei Jitang +Len Weincier +Lennie +Leo Gallucci +Leszek Kowalski +Levi Blackstone +Levi Gross +Lewis Daly +Lewis Marshall +Lewis Peckover +Li Yi +Liam Macgillavry +Liana Lo +Liang Mingqiang +Liang-Chi Hsieh +Liao Qingwei +Lifubang +Lihua Tang +Lily Guo +limsy +Lin Lu +LingFaKe +Linus Heckemann +Liran Tal +Liron Levin +Liu Bo +Liu Hua +liwenqi +lixiaobing10051267 +Liz Zhang +LIZAO LI +Lizzie Dixon <_@lizzie.io> +Lloyd Dewolf +Lokesh Mandvekar +longliqiang88 <394564827@qq.com> +Lorenz Leutgeb +Lorenzo Fontana +Lotus Fenn +Louis Opter +Luca Favatella +Luca Marturana +Luca Orlandi +Luca-Bogdan Grigorescu +Lucas Chan +Lucas Chi +Lucas Molas +Luciano Mores +Luis Martínez de Bartolomé Izquierdo +Luiz Svoboda +Lukas Waslowski +lukaspustina +Lukasz Zajaczkowski +Luke Marsden +Lyn +Lynda O'Leary +Lénaïc Huard +Ma Müller +Ma Shimiao +Mabin +Madhan Raj Mookkandy +Madhav Puri +Madhu Venugopal +Mageee +Mahesh Tiyyagura +malnick +Malte Janduda +Manfred Touron +Manfred Zabarauskas +Manjunath A Kumatagi +Mansi Nahar +Manuel Meurer +Manuel Rüger +Manuel Woelker +mapk0y +Marc Abramowitz +Marc Kuo +Marc Tamsky +Marcel Edmund Franke +Marcelo Horacio Fortino +Marcelo Salazar +Marco Hennings +Marcus Cobden +Marcus Farkas +Marcus Linke +Marcus Martins +Marcus Ramberg +Marek Goldmann +Marian Marinov +Marianna Tessel +Mario Loriedo +Marius Gundersen +Marius Sturm +Marius Voila +Mark Allen +Mark Jeromin +Mark McGranaghan +Mark McKinstry +Mark Milstein +Mark Oates +Mark Parker +Mark West +Markan Patel +Marko Mikulicic +Marko Tibold +Markus Fix +Markus Kortlang +Martijn Dwars +Martijn van Oosterhout +Martin Honermeyer +Martin Kelly +Martin Mosegaard Amdisen +Martin Muzatko +Martin Redmond +Mary Anthony +Masahito Zembutsu +Masato Ohba +Masayuki Morita +Mason Malone +Mateusz Sulima +Mathias Monnerville +Mathieu Champlon +Mathieu Le Marec - Pasquet +Mathieu Parent +Matt Apperson +Matt Bachmann +Matt Bentley +Matt Haggard +Matt Hoyle +Matt McCormick +Matt Moore +Matt Richardson +Matt Rickard +Matt Robenolt +Matt Schurenko +Matt Williams +Matthew Heon +Matthew Lapworth +Matthew Mayer +Matthew Mosesohn +Matthew Mueller +Matthew Riley +Matthias Klumpp +Matthias Kühnle +Matthias Rampke +Matthieu Hauglustaine +Mattias Jernberg +Mauricio Garavaglia +mauriyouth +Max Shytikov +Maxim Fedchyshyn +Maxim Ivanov +Maxim Kulkin +Maxim Treskin +Maxime Petazzoni +Maximiliano Maccanti +Maxwell +Meaglith Ma +meejah +Megan Kostick +Mehul Kar +Mei ChunTao +Mengdi Gao +Mert Yazıcıoğlu +mgniu +Micah Zoltu +Michael A. Smith +Michael Bridgen +Michael Brown +Michael Chiang +Michael Crosby +Michael Currie +Michael Friis +Michael Gorsuch +Michael Grauer +Michael Holzheu +Michael Hudson-Doyle +Michael Huettermann +Michael Irwin +Michael Käufl +Michael Neale +Michael Nussbaum +Michael Prokop +Michael Scharf +Michael Spetsiotis +Michael Stapelberg +Michael Steinert +Michael Thies +Michael West +Michal Fojtik +Michal Gebauer +Michal Jemala +Michal Minář +Michal Wieczorek +Michaël Pailloncy +Michał Czeraszkiewicz +Michał Gryko +Michiel de Jong +Mickaël Fortunato +Mickaël Remars +Miguel Angel Fernández +Miguel Morales +Mihai Borobocea +Mihuleacc Sergiu +Mike Brown +Mike Casas +Mike Chelen +Mike Danese +Mike Dillon +Mike Dougherty +Mike Estes +Mike Gaffney +Mike Goelzer +Mike Leone +Mike Lundy +Mike MacCana +Mike Naberezny +Mike Snitzer +mikelinjie <294893458@qq.com> +Mikhail Sobolev +Miklos Szegedi +Milind Chawre +Miloslav Trmač +mingqing +Mingzhen Feng +Misty Stanley-Jones +Mitch Capper +Mizuki Urushida +mlarcher +Mohammad Banikazemi +Mohammad Nasirifar +Mohammed Aaqib Ansari +Mohit Soni +Moorthy RS +Morgan Bauer +Morgante Pell +Morgy93 +Morten Siebuhr +Morton Fox +Moysés Borges +mrfly +Mrunal Patel +Muayyad Alsadi +Mustafa Akın +Muthukumar R +Máximo Cuadros +Médi-Rémi Hashim +Nace Oroz +Nahum Shalman +Nakul Pathak +Nalin Dahyabhai +Nan Monnand Deng +Naoki Orii +Natalie Parker +Natanael Copa +Natasha Jarus +Nate Brennand +Nate Eagleson +Nate Jones +Nathan Hsieh +Nathan Kleyn +Nathan LeClaire +Nathan McCauley +Nathan Williams +Naveed Jamil +Neal McBurnett +Neil Horman +Neil Peterson +Nelson Chen +Neyazul Haque +Nghia Tran +Niall O'Higgins +Nicholas E. Rabenau +Nick DeCoursin +Nick Irvine +Nick Neisen +Nick Parker +Nick Payne +Nick Russo +Nick Stenning +Nick Stinemates +NickrenREN +Nicola Kabar +Nicolas Borboën +Nicolas De Loof +Nicolas Dudebout +Nicolas Goy +Nicolas Kaiser +Nicolas Sterchele +Nicolas V Castet +Nicolás Hock Isaza +Nigel Poulton +Nik Nyby +Nikhil Chawla +NikolaMandic +Nikolas Garofil +Nikolay Milovanov +Nirmal Mehta +Nishant Totla +NIWA Hideyuki +Noah Meyerhans +Noah Treuhaft +NobodyOnSE +noducks +Nolan Darilek +Noriki Nakamura +nponeccop +Nuutti Kotivuori +nzwsch +O.S. Tezer +objectified +Oguz Bilgic +Oh Jinkyun +Ohad Schneider +ohmystack +Ole Reifschneider +Oliver Neal +Oliver Reason +Olivier Gambier +Olle Jonsson +Olli Janatuinen +Omri Shiv +Oriol Francès +Oskar Niburski +Otto Kekäläinen +Ouyang Liduo +Ovidio Mallo +Panagiotis Moustafellos +Paolo G. Giarrusso +Pascal +Pascal Borreli +Pascal Hartig +Patrick Böänziger +Patrick Devine +Patrick Hemmer +Patrick Stapleton +Patrik Cyvoct +pattichen +Paul +paul +Paul Annesley +Paul Bellamy +Paul Bowsher +Paul Furtado +Paul Hammond +Paul Jimenez +Paul Kehrer +Paul Lietar +Paul Liljenberg +Paul Morie +Paul Nasrat +Paul Weaver +Paulo Ribeiro +Pavel Lobashov +Pavel Pletenev +Pavel Pospisil +Pavel Sutyrin +Pavel Tikhomirov +Pavlos Ratis +Pavol Vargovcik +Pawel Konczalski +Peeyush Gupta +Peggy Li +Pei Su +Peng Tao +Penghan Wang +Per Weijnitz +perhapszzy@sina.com +Peter Bourgon +Peter Braden +Peter Bücker +Peter Choi +Peter Dave Hello +Peter Edge +Peter Ericson +Peter Esbensen +Peter Jaffe +Peter Kang +Peter Malmgren +Peter Salvatore +Peter Volpe +Peter Waller +Petr Švihlík +Phil +Phil Estes +Phil Spitler +Philip Alexander Etling +Philip Monroe +Philipp Gillé +Philipp Wahala +Philipp Weissensteiner +Phillip Alexander +phineas +pidster +Piergiuliano Bossi +Pierre +Pierre Carrier +Pierre Dal-Pra +Pierre Wacrenier +Pierre-Alain RIVIERE +Piotr Bogdan +pixelistik +Porjo +Poul Kjeldager Sørensen +Pradeep Chhetri +Pradip Dhara +Prasanna Gautam +Pratik Karki +Prayag Verma +Priya Wadhwa +Projjol Banerji +Przemek Hejman +Pure White +pysqz +Qiang Huang +Qinglan Peng +qudongfang +Quentin Brossard +Quentin Perez +Quentin Tayssier +r0n22 +Radostin Stoyanov +Rafal Jeczalik +Rafe Colton +Raghavendra K T +Raghuram Devarakonda +Raja Sami +Rajat Pandit +Rajdeep Dua +Ralf Sippl +Ralle +Ralph Bean +Ramkumar Ramachandra +Ramon Brooker +Ramon van Alteren +RaviTeja Pothana +Ray Tsang +ReadmeCritic +Recursive Madman +Reficul +Regan McCooey +Remi Rampin +Remy Suen +Renato Riccieri Santos Zannon +Renaud Gaubert +Rhys Hiltner +Ri Xu +Ricardo N Feliciano +Rich Moyse +Rich Seymour +Richard +Richard Burnison +Richard Harvey +Richard Mathie +Richard Metzler +Richard Scothern +Richo Healey +Rick Bradley +Rick van de Loo +Rick Wieman +Rik Nijessen +Riku Voipio +Riley Guerin +Ritesh H Shukla +Riyaz Faizullabhoy +Rob Vesse +Robert Bachmann +Robert Bittle +Robert Obryk +Robert Schneider +Robert Stern +Robert Terhaar +Robert Wallis +Roberto G. Hashioka +Roberto Muñoz Fernández +Robin Naundorf +Robin Schneider +Robin Speekenbrink +robpc +Rodolfo Carvalho +Rodrigo Vaz +Roel Van Nyen +Roger Peppe +Rohit Jnagal +Rohit Kadam +Rohit Kapur +Rojin George +Roland Huß +Roland Kammerer +Roland Moriz +Roma Sokolov +Roman Dudin +Roman Strashkin +Ron Smits +Ron Williams +Rong Gao +Rong Zhang +Rongxiang Song +root +root +root +root +Rory Hunter +Rory McCune +Ross Boucher +Rovanion Luckey +Royce Remer +Rozhnov Alexandr +Rudolph Gottesheim +Rui Cao +Rui Lopes +Runshen Zhu +Russ Magee +Ryan Abrams +Ryan Anderson +Ryan Aslett +Ryan Belgrave +Ryan Detzel +Ryan Fowler +Ryan Liu +Ryan McLaughlin +Ryan O'Donnell +Ryan Seto +Ryan Simmen +Ryan Stelly +Ryan Thomas +Ryan Trauntvein +Ryan Wallner +Ryan Zhang +ryancooper7 +RyanDeng +Ryo Nakao +Rémy Greinhofer +s. rannou +s00318865 +Sabin Basyal +Sachin Joshi +Sagar Hani +Sainath Grandhi +Sakeven Jiang +Salahuddin Khan +Sally O'Malley +Sam Abed +Sam Alba +Sam Bailey +Sam J Sharpe +Sam Neirinck +Sam Reis +Sam Rijs +Sambuddha Basu +Sami Wagiaalla +Samuel Andaya +Samuel Dion-Girardeau +Samuel Karp +Samuel PHAN +Sandeep Bansal +Sankar சங்கர் +Sanket Saurav +Santhosh Manohar +sapphiredev +Sargun Dhillon +Sascha Andres +Sascha Grunert +Satnam Singh +Satoshi Amemiya +Satoshi Tagomori +Scott Bessler +Scott Collier +Scott Johnston +Scott Stamp +Scott Walls +sdreyesg +Sean Christopherson +Sean Cronin +Sean Lee +Sean McIntyre +Sean OMeara +Sean P. Kane +Sean Rodman +Sebastiaan van Steenis +Sebastiaan van Stijn +Senthil Kumar Selvaraj +Senthil Kumaran +SeongJae Park +Seongyeol Lim +Serge Hallyn +Sergey Alekseev +Sergey Evstifeev +Sergii Kabashniuk +Sergio Lopez +Serhat Gülçiçek +SeungUkLee +Sevki Hasirci +Shane Canon +Shane da Silva +Shaun Kaasten +shaunol +Shawn Landden +Shawn Siefkas +shawnhe +Shayne Wang +Shekhar Gulati +Sheng Yang +Shengbo Song +Shev Yan +Shih-Yuan Lee +Shijiang Wei +Shijun Qin +Shishir Mahajan +Shoubhik Bose +Shourya Sarcar +shuai-z +Shukui Yang +Shuwei Hao +Sian Lerk Lau +Sidhartha Mani +sidharthamani +Silas Sewell +Silvan Jegen +Simão Reis +Simei He +Simon Eskildsen +Simon Ferquel +Simon Leinen +Simon Menke +Simon Taranto +Simon Vikstrom +Sindhu S +Sjoerd Langkemper +Solganik Alexander +Solomon Hykes +Song Gao +Soshi Katsuta +Soulou +Spencer Brown +Spencer Smith +Sridatta Thatipamala +Sridhar Ratnakumar +Srini Brahmaroutu +Srinivasan Srivatsan +Stanislav Bondarenko +Steeve Morin +Stefan Berger +Stefan J. Wernli +Stefan Praszalowicz +Stefan S. +Stefan Scherer +Stefan Staudenmeyer +Stefan Weil +Stephan Spindler +Stephen Crosby +Stephen Day +Stephen Drake +Stephen Rust +Steve Desmond +Steve Dougherty +Steve Durrheimer +Steve Francia +Steve Koch +Steven Burgess +Steven Erenst +Steven Hartland +Steven Iveson +Steven Merrill +Steven Richards +Steven Taylor +Subhajit Ghosh +Sujith Haridasan +Sun Gengze <690388648@qq.com> +Sun Jianbo +Sunny Gogoi +Suryakumar Sudar +Sven Dowideit +Swapnil Daingade +Sylvain Baubeau +Sylvain Bellemare +Sébastien +Sébastien HOUZÉ +Sébastien Luttringer +Sébastien Stormacq +Tabakhase +Tadej Janež +TAGOMORI Satoshi +tang0th +Tangi Colin +Tatsuki Sugiura +Tatsushi Inagaki +Taylan Isikdemir +Taylor Jones +Ted M. Young +Tehmasp Chaudhri +Tejaswini Duggaraju +Tejesh Mehta +terryding77 <550147740@qq.com> +tgic +Thatcher Peskens +theadactyl +Thell 'Bo' Fowler +Thermionix +Thijs Terlouw +Thomas Bikeev +Thomas Frössman +Thomas Gazagnaire +Thomas Grainger +Thomas Hansen +Thomas Leonard +Thomas Léveil +Thomas Orozco +Thomas Riccardi +Thomas Schroeter +Thomas Sjögren +Thomas Swift +Thomas Tanaka +Thomas Texier +Ti Zhou +Tianon Gravi +Tianyi Wang +Tibor Vass +Tiffany Jernigan +Tiffany Low +Tim Bart +Tim Bosse +Tim Dettrick +Tim Düsterhus +Tim Hockin +Tim Potter +Tim Ruffles +Tim Smith +Tim Terhorst +Tim Wang +Tim Waugh +Tim Wraight +Tim Zju <21651152@zju.edu.cn> +timfeirg +Timothy Hobbs +tjwebb123 +tobe +Tobias Bieniek +Tobias Bradtke +Tobias Gesellchen +Tobias Klauser +Tobias Munk +Tobias Schmidt +Tobias Schwab +Todd Crane +Todd Lunter +Todd Whiteman +Toli Kuznets +Tom Barlow +Tom Booth +Tom Denham +Tom Fotherby +Tom Howe +Tom Hulihan +Tom Maaswinkel +Tom Sweeney +Tom Wilkie +Tom X. Tobin +Tomas Tomecek +Tomasz Kopczynski +Tomasz Lipinski +Tomasz Nurkiewicz +Tommaso Visconti +Tomáš Hrčka +Tonny Xu +Tony Abboud +Tony Daws +Tony Miller +toogley +Torstein Husebø +Tõnis Tiigi +tpng +tracylihui <793912329@qq.com> +Trapier Marshall +Travis Cline +Travis Thieman +Trent Ogren +Trevor +Trevor Pounds +Trevor Sullivan +Trishna Guha +Tristan Carel +Troy Denton +Tycho Andersen +Tyler Brock +Tyler Brown +Tzu-Jung Lee +uhayate +Ulysse Carion +Umesh Yadav +Utz Bacher +vagrant +Vaidas Jablonskis +vanderliang +Veres Lajos +Victor Algaze +Victor Coisne +Victor Costan +Victor I. Wood +Victor Lyuboslavsky +Victor Marmol +Victor Palma +Victor Vieux +Victoria Bialas +Vijaya Kumar K +Viktor Stanchev +Viktor Vojnovski +VinayRaghavanKS +Vincent Batts +Vincent Bernat +Vincent Demeester +Vincent Giersch +Vincent Mayers +Vincent Woo +Vinod Kulkarni +Vishal Doshi +Vishnu Kannan +Vitaly Ostrosablin +Vitor Monteiro +Vivek Agarwal +Vivek Dasgupta +Vivek Goyal +Vladimir Bulyga +Vladimir Kirillov +Vladimir Pouzanov +Vladimir Rutsky +Vladimir Varankin +VladimirAus +Vlastimil Zeman +Vojtech Vitek (V-Teq) +waitingkuo +Walter Leibbrandt +Walter Stanish +Wang Chao +Wang Guoliang +Wang Jie +Wang Long +Wang Ping +Wang Xing +Wang Yuexiao +Ward Vandewege +WarheadsSE +Wassim Dhif +Wayne Chang +Wayne Song +Weerasak Chongnguluam +Wei Fu +Wei Wu +Wei-Ting Kuo +weipeng +weiyan +Weiyang Zhu +Wen Cheng Ma +Wendel Fleming +Wenjun Tang +Wenkai Yin +Wentao Zhang +Wenxuan Zhao +Wenyu You <21551128@zju.edu.cn> +Wenzhi Liang +Wes Morgan +Wewang Xiaorenfine +Will Dietz +Will Rouesnel +Will Weaver +willhf +William Delanoue +William Henry +William Hubbs +William Martin +William Riancho +William Thurston +WiseTrem +Wolfgang Powisch +Wonjun Kim +xamyzhao +Xian Chaobo +Xianglin Gao +Xianlu Bird +Xiao YongBiao +XiaoBing Jiang +Xiaodong Zhang +Xiaoxi He +Xiaoxu Chen +Xiaoyu Zhang +xichengliudui <1693291525@qq.com> +xiekeyang +Ximo Guanter Gonzálbez +Xinbo Weng +Xinzi Zhou +Xiuming Chen +Xuecong Liao +xuzhaokui +Yadnyawalkya Tale +Yahya +YAMADA Tsuyoshi +Yamasaki Masahide +Yan Feng +Yang Bai +Yang Pengfei +yangchenliang +Yanqiang Miao +Yao Zaiyong +Yassine Tijani +Yasunori Mahata +Yazhong Liu +Yestin Sun +Yi EungJun +Yibai Zhang +Yihang Ho +Ying Li +Yohei Ueda +Yong Tang +Yongxin Li +Yongzhi Pan +Yosef Fertel +You-Sheng Yang (楊有勝) +Youcef YEKHLEF +Yu Changchun +Yu Chengxia +Yu Peng +Yu-Ju Hong +Yuan Sun +Yuanhong Peng +Yue Zhang +Yuhao Fang +Yuichiro Kaneko +Yunxiang Huang +Yurii Rashkovskii +Yusuf Tarık Günaydın +Yves Junqueira +Zac Dover +Zach Borboa +Zachary Jaffee +Zain Memon +Zaiste! +Zane DeGraffenried +Zefan Li +Zen Lin(Zhinan Lin) +Zhang Kun +Zhang Wei +Zhang Wentao +ZhangHang +zhangxianwei +Zhenan Ye <21551168@zju.edu.cn> +zhenghenghuo +Zhenhai Gao +Zhenkun Bi +Zhou Hao +Zhoulin Xie +Zhu Guihua +Zhu Kunjia +Zhuoyun Wei +Zilin Du +zimbatm +Ziming Dong +ZJUshuaizhou <21551191@zju.edu.cn> +zmarouf +Zoltan Tombol +Zou Yu +zqh +Zuhayr Elahi +Zunayed Ali +Álex González +Álvaro Lázaro +Átila Camurça Alves +尹吉峰 +徐俊杰 +慕陶 +搏通 +黄艳红00139573 diff --git a/integration-test/vendor/github.com/docker/docker/LICENSE b/integration-test/vendor/github.com/docker/docker/LICENSE new file mode 100644 index 000000000..6d8d58fb6 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://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 + + Copyright 2013-2018 Docker, 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 + + https://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. diff --git a/integration-test/vendor/github.com/docker/docker/NOTICE b/integration-test/vendor/github.com/docker/docker/NOTICE new file mode 100644 index 000000000..58b19b6d1 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/NOTICE @@ -0,0 +1,19 @@ +Docker +Copyright 2012-2017 Docker, Inc. + +This product includes software developed at Docker, Inc. (https://www.docker.com). + +This product contains software (https://github.com/creack/pty) developed +by Keith Rarick, licensed under the MIT License. + +The following is courtesy of our legal counsel: + + +Use and transfer of Docker may be subject to certain restrictions by the +United States and other governments. +It is your responsibility to ensure that your use and/or transfer does not +violate applicable laws. + +For more information, please see https://www.bis.doc.gov + +See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. diff --git a/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go new file mode 100644 index 000000000..47ecd0c09 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go @@ -0,0 +1,109 @@ +package homedir // import "github.com/docker/docker/pkg/homedir" + +import ( + "errors" + "os" + "path/filepath" + "strings" + + "github.com/docker/docker/pkg/idtools" +) + +// GetStatic returns the home directory for the current user without calling +// os/user.Current(). This is useful for static-linked binary on glibc-based +// system, because a call to os/user.Current() in a static binary leads to +// segfault due to a glibc issue that won't be fixed in a short term. +// (#29344, golang/go#13470, https://sourceware.org/bugzilla/show_bug.cgi?id=19341) +func GetStatic() (string, error) { + uid := os.Getuid() + usr, err := idtools.LookupUID(uid) + if err != nil { + return "", err + } + return usr.Home, nil +} + +// GetRuntimeDir returns XDG_RUNTIME_DIR. +// XDG_RUNTIME_DIR is typically configured via pam_systemd. +// GetRuntimeDir returns non-nil error if XDG_RUNTIME_DIR is not set. +// +// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html +func GetRuntimeDir() (string, error) { + if xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR"); xdgRuntimeDir != "" { + return xdgRuntimeDir, nil + } + return "", errors.New("could not get XDG_RUNTIME_DIR") +} + +// StickRuntimeDirContents sets the sticky bit on files that are under +// XDG_RUNTIME_DIR, so that the files won't be periodically removed by the system. +// +// StickyRuntimeDir returns slice of sticked files. +// StickyRuntimeDir returns nil error if XDG_RUNTIME_DIR is not set. +// +// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html +func StickRuntimeDirContents(files []string) ([]string, error) { + runtimeDir, err := GetRuntimeDir() + if err != nil { + // ignore error if runtimeDir is empty + return nil, nil + } + runtimeDir, err = filepath.Abs(runtimeDir) + if err != nil { + return nil, err + } + var sticked []string + for _, f := range files { + f, err = filepath.Abs(f) + if err != nil { + return sticked, err + } + if strings.HasPrefix(f, runtimeDir+"/") { + if err = stick(f); err != nil { + return sticked, err + } + sticked = append(sticked, f) + } + } + return sticked, nil +} + +func stick(f string) error { + st, err := os.Stat(f) + if err != nil { + return err + } + m := st.Mode() + m |= os.ModeSticky + return os.Chmod(f, m) +} + +// GetDataHome returns XDG_DATA_HOME. +// GetDataHome returns $HOME/.local/share and nil error if XDG_DATA_HOME is not set. +// +// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html +func GetDataHome() (string, error) { + if xdgDataHome := os.Getenv("XDG_DATA_HOME"); xdgDataHome != "" { + return xdgDataHome, nil + } + home := os.Getenv("HOME") + if home == "" { + return "", errors.New("could not get either XDG_DATA_HOME or HOME") + } + return filepath.Join(home, ".local", "share"), nil +} + +// GetConfigHome returns XDG_CONFIG_HOME. +// GetConfigHome returns $HOME/.config and nil error if XDG_CONFIG_HOME is not set. +// +// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html +func GetConfigHome() (string, error) { + if xdgConfigHome := os.Getenv("XDG_CONFIG_HOME"); xdgConfigHome != "" { + return xdgConfigHome, nil + } + home := os.Getenv("HOME") + if home == "" { + return "", errors.New("could not get either XDG_CONFIG_HOME or HOME") + } + return filepath.Join(home, ".config"), nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go b/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go new file mode 100644 index 000000000..f0a363ded --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go @@ -0,0 +1,33 @@ +// +build !linux + +package homedir // import "github.com/docker/docker/pkg/homedir" + +import ( + "errors" +) + +// GetStatic is not needed for non-linux systems. +// (Precisely, it is needed only for glibc-based linux systems.) +func GetStatic() (string, error) { + return "", errors.New("homedir.GetStatic() is not supported on this system") +} + +// GetRuntimeDir is unsupported on non-linux system. +func GetRuntimeDir() (string, error) { + return "", errors.New("homedir.GetRuntimeDir() is not supported on this system") +} + +// StickRuntimeDirContents is unsupported on non-linux system. +func StickRuntimeDirContents(files []string) ([]string, error) { + return nil, errors.New("homedir.StickRuntimeDirContents() is not supported on this system") +} + +// GetDataHome is unsupported on non-linux system. +func GetDataHome() (string, error) { + return "", errors.New("homedir.GetDataHome() is not supported on this system") +} + +// GetConfigHome is unsupported on non-linux system. +func GetConfigHome() (string, error) { + return "", errors.New("homedir.GetConfigHome() is not supported on this system") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go new file mode 100644 index 000000000..d85e12448 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go @@ -0,0 +1,34 @@ +// +build !windows + +package homedir // import "github.com/docker/docker/pkg/homedir" + +import ( + "os" + + "github.com/opencontainers/runc/libcontainer/user" +) + +// Key returns the env var name for the user's home dir based on +// the platform being run on +func Key() string { + return "HOME" +} + +// Get returns the home directory of the current user with the help of +// environment variables depending on the target operating system. +// Returned path should be used with "path/filepath" to form new paths. +func Get() string { + home := os.Getenv(Key()) + if home == "" { + if u, err := user.CurrentUser(); err == nil { + return u.Home + } + } + return home +} + +// GetShortcutString returns the string that is shortcut to user's home directory +// in the native shell of the platform running on. +func GetShortcutString() string { + return "~" +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go new file mode 100644 index 000000000..2f81813b2 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go @@ -0,0 +1,24 @@ +package homedir // import "github.com/docker/docker/pkg/homedir" + +import ( + "os" +) + +// Key returns the env var name for the user's home dir based on +// the platform being run on +func Key() string { + return "USERPROFILE" +} + +// Get returns the home directory of the current user with the help of +// environment variables depending on the target operating system. +// Returned path should be used with "path/filepath" to form new paths. +func Get() string { + return os.Getenv(Key()) +} + +// GetShortcutString returns the string that is shortcut to user's home directory +// in the native shell of the platform running on. +func GetShortcutString() string { + return "%USERPROFILE%" // be careful while using in format functions +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools.go b/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools.go new file mode 100644 index 000000000..b3af7a422 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools.go @@ -0,0 +1,264 @@ +package idtools // import "github.com/docker/docker/pkg/idtools" + +import ( + "bufio" + "fmt" + "os" + "strconv" + "strings" +) + +// IDMap contains a single entry for user namespace range remapping. An array +// of IDMap entries represents the structure that will be provided to the Linux +// kernel for creating a user namespace. +type IDMap struct { + ContainerID int `json:"container_id"` + HostID int `json:"host_id"` + Size int `json:"size"` +} + +type subIDRange struct { + Start int + Length int +} + +type ranges []subIDRange + +func (e ranges) Len() int { return len(e) } +func (e ranges) Swap(i, j int) { e[i], e[j] = e[j], e[i] } +func (e ranges) Less(i, j int) bool { return e[i].Start < e[j].Start } + +const ( + subuidFileName = "/etc/subuid" + subgidFileName = "/etc/subgid" +) + +// MkdirAllAndChown creates a directory (include any along the path) and then modifies +// ownership to the requested uid/gid. If the directory already exists, this +// function will still change ownership to the requested uid/gid pair. +func MkdirAllAndChown(path string, mode os.FileMode, owner Identity) error { + return mkdirAs(path, mode, owner, true, true) +} + +// MkdirAndChown creates a directory and then modifies ownership to the requested uid/gid. +// If the directory already exists, this function still changes ownership. +// Note that unlike os.Mkdir(), this function does not return IsExist error +// in case path already exists. +func MkdirAndChown(path string, mode os.FileMode, owner Identity) error { + return mkdirAs(path, mode, owner, false, true) +} + +// MkdirAllAndChownNew creates a directory (include any along the path) and then modifies +// ownership ONLY of newly created directories to the requested uid/gid. If the +// directories along the path exist, no change of ownership will be performed +func MkdirAllAndChownNew(path string, mode os.FileMode, owner Identity) error { + return mkdirAs(path, mode, owner, true, false) +} + +// GetRootUIDGID retrieves the remapped root uid/gid pair from the set of maps. +// If the maps are empty, then the root uid/gid will default to "real" 0/0 +func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error) { + uid, err := toHost(0, uidMap) + if err != nil { + return -1, -1, err + } + gid, err := toHost(0, gidMap) + if err != nil { + return -1, -1, err + } + return uid, gid, nil +} + +// toContainer takes an id mapping, and uses it to translate a +// host ID to the remapped ID. If no map is provided, then the translation +// assumes a 1-to-1 mapping and returns the passed in id +func toContainer(hostID int, idMap []IDMap) (int, error) { + if idMap == nil { + return hostID, nil + } + for _, m := range idMap { + if (hostID >= m.HostID) && (hostID <= (m.HostID + m.Size - 1)) { + contID := m.ContainerID + (hostID - m.HostID) + return contID, nil + } + } + return -1, fmt.Errorf("Host ID %d cannot be mapped to a container ID", hostID) +} + +// toHost takes an id mapping and a remapped ID, and translates the +// ID to the mapped host ID. If no map is provided, then the translation +// assumes a 1-to-1 mapping and returns the passed in id # +func toHost(contID int, idMap []IDMap) (int, error) { + if idMap == nil { + return contID, nil + } + for _, m := range idMap { + if (contID >= m.ContainerID) && (contID <= (m.ContainerID + m.Size - 1)) { + hostID := m.HostID + (contID - m.ContainerID) + return hostID, nil + } + } + return -1, fmt.Errorf("Container ID %d cannot be mapped to a host ID", contID) +} + +// Identity is either a UID and GID pair or a SID (but not both) +type Identity struct { + UID int + GID int + SID string +} + +// IdentityMapping contains a mappings of UIDs and GIDs +type IdentityMapping struct { + uids []IDMap + gids []IDMap +} + +// NewIdentityMapping takes a requested user and group name and +// using the data from /etc/sub{uid,gid} ranges, creates the +// proper uid and gid remapping ranges for that user/group pair +func NewIdentityMapping(username, groupname string) (*IdentityMapping, error) { + subuidRanges, err := parseSubuid(username) + if err != nil { + return nil, err + } + subgidRanges, err := parseSubgid(groupname) + if err != nil { + return nil, err + } + if len(subuidRanges) == 0 { + return nil, fmt.Errorf("No subuid ranges found for user %q", username) + } + if len(subgidRanges) == 0 { + return nil, fmt.Errorf("No subgid ranges found for group %q", groupname) + } + + return &IdentityMapping{ + uids: createIDMap(subuidRanges), + gids: createIDMap(subgidRanges), + }, nil +} + +// NewIDMappingsFromMaps creates a new mapping from two slices +// Deprecated: this is a temporary shim while transitioning to IDMapping +func NewIDMappingsFromMaps(uids []IDMap, gids []IDMap) *IdentityMapping { + return &IdentityMapping{uids: uids, gids: gids} +} + +// RootPair returns a uid and gid pair for the root user. The error is ignored +// because a root user always exists, and the defaults are correct when the uid +// and gid maps are empty. +func (i *IdentityMapping) RootPair() Identity { + uid, gid, _ := GetRootUIDGID(i.uids, i.gids) + return Identity{UID: uid, GID: gid} +} + +// ToHost returns the host UID and GID for the container uid, gid. +// Remapping is only performed if the ids aren't already the remapped root ids +func (i *IdentityMapping) ToHost(pair Identity) (Identity, error) { + var err error + target := i.RootPair() + + if pair.UID != target.UID { + target.UID, err = toHost(pair.UID, i.uids) + if err != nil { + return target, err + } + } + + if pair.GID != target.GID { + target.GID, err = toHost(pair.GID, i.gids) + } + return target, err +} + +// ToContainer returns the container UID and GID for the host uid and gid +func (i *IdentityMapping) ToContainer(pair Identity) (int, int, error) { + uid, err := toContainer(pair.UID, i.uids) + if err != nil { + return -1, -1, err + } + gid, err := toContainer(pair.GID, i.gids) + return uid, gid, err +} + +// Empty returns true if there are no id mappings +func (i *IdentityMapping) Empty() bool { + return len(i.uids) == 0 && len(i.gids) == 0 +} + +// UIDs return the UID mapping +// TODO: remove this once everything has been refactored to use pairs +func (i *IdentityMapping) UIDs() []IDMap { + return i.uids +} + +// GIDs return the UID mapping +// TODO: remove this once everything has been refactored to use pairs +func (i *IdentityMapping) GIDs() []IDMap { + return i.gids +} + +func createIDMap(subidRanges ranges) []IDMap { + idMap := []IDMap{} + + containerID := 0 + for _, idrange := range subidRanges { + idMap = append(idMap, IDMap{ + ContainerID: containerID, + HostID: idrange.Start, + Size: idrange.Length, + }) + containerID = containerID + idrange.Length + } + return idMap +} + +func parseSubuid(username string) (ranges, error) { + return parseSubidFile(subuidFileName, username) +} + +func parseSubgid(username string) (ranges, error) { + return parseSubidFile(subgidFileName, username) +} + +// parseSubidFile will read the appropriate file (/etc/subuid or /etc/subgid) +// and return all found ranges for a specified username. If the special value +// "ALL" is supplied for username, then all ranges in the file will be returned +func parseSubidFile(path, username string) (ranges, error) { + var rangeList ranges + + subidFile, err := os.Open(path) + if err != nil { + return rangeList, err + } + defer subidFile.Close() + + s := bufio.NewScanner(subidFile) + for s.Scan() { + if err := s.Err(); err != nil { + return rangeList, err + } + + text := strings.TrimSpace(s.Text()) + if text == "" || strings.HasPrefix(text, "#") { + continue + } + parts := strings.Split(text, ":") + if len(parts) != 3 { + return rangeList, fmt.Errorf("Cannot parse subuid/gid information: Format not correct for %s file", path) + } + if parts[0] == username || username == "ALL" { + startid, err := strconv.Atoi(parts[1]) + if err != nil { + return rangeList, fmt.Errorf("String to int conversion failed during subuid/gid parsing of %s: %v", path, err) + } + length, err := strconv.Atoi(parts[2]) + if err != nil { + return rangeList, fmt.Errorf("String to int conversion failed during subuid/gid parsing of %s: %v", path, err) + } + rangeList = append(rangeList, subIDRange{startid, length}) + } + } + return rangeList, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go new file mode 100644 index 000000000..fb239743a --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go @@ -0,0 +1,231 @@ +// +build !windows + +package idtools // import "github.com/docker/docker/pkg/idtools" + +import ( + "bytes" + "fmt" + "io" + "os" + "path/filepath" + "strings" + "sync" + "syscall" + + "github.com/docker/docker/pkg/system" + "github.com/opencontainers/runc/libcontainer/user" +) + +var ( + entOnce sync.Once + getentCmd string +) + +func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error { + // make an array containing the original path asked for, plus (for mkAll == true) + // all path components leading up to the complete path that don't exist before we MkdirAll + // so that we can chown all of them properly at the end. If chownExisting is false, we won't + // chown the full directory path if it exists + + var paths []string + + stat, err := system.Stat(path) + if err == nil { + if !stat.IsDir() { + return &os.PathError{Op: "mkdir", Path: path, Err: syscall.ENOTDIR} + } + if !chownExisting { + return nil + } + + // short-circuit--we were called with an existing directory and chown was requested + return lazyChown(path, owner.UID, owner.GID, stat) + } + + if os.IsNotExist(err) { + paths = []string{path} + } + + if mkAll { + // walk back to "/" looking for directories which do not exist + // and add them to the paths array for chown after creation + dirPath := path + for { + dirPath = filepath.Dir(dirPath) + if dirPath == "/" { + break + } + if _, err := os.Stat(dirPath); err != nil && os.IsNotExist(err) { + paths = append(paths, dirPath) + } + } + if err := system.MkdirAll(path, mode, ""); err != nil { + return err + } + } else { + if err := os.Mkdir(path, mode); err != nil && !os.IsExist(err) { + return err + } + } + // even if it existed, we will chown the requested path + any subpaths that + // didn't exist when we called MkdirAll + for _, pathComponent := range paths { + if err := lazyChown(pathComponent, owner.UID, owner.GID, nil); err != nil { + return err + } + } + return nil +} + +// CanAccess takes a valid (existing) directory and a uid, gid pair and determines +// if that uid, gid pair has access (execute bit) to the directory +func CanAccess(path string, pair Identity) bool { + statInfo, err := system.Stat(path) + if err != nil { + return false + } + fileMode := os.FileMode(statInfo.Mode()) + permBits := fileMode.Perm() + return accessible(statInfo.UID() == uint32(pair.UID), + statInfo.GID() == uint32(pair.GID), permBits) +} + +func accessible(isOwner, isGroup bool, perms os.FileMode) bool { + if isOwner && (perms&0100 == 0100) { + return true + } + if isGroup && (perms&0010 == 0010) { + return true + } + if perms&0001 == 0001 { + return true + } + return false +} + +// LookupUser uses traditional local system files lookup (from libcontainer/user) on a username, +// followed by a call to `getent` for supporting host configured non-files passwd and group dbs +func LookupUser(username string) (user.User, error) { + // first try a local system files lookup using existing capabilities + usr, err := user.LookupUser(username) + if err == nil { + return usr, nil + } + // local files lookup failed; attempt to call `getent` to query configured passwd dbs + usr, err = getentUser(fmt.Sprintf("%s %s", "passwd", username)) + if err != nil { + return user.User{}, err + } + return usr, nil +} + +// LookupUID uses traditional local system files lookup (from libcontainer/user) on a uid, +// followed by a call to `getent` for supporting host configured non-files passwd and group dbs +func LookupUID(uid int) (user.User, error) { + // first try a local system files lookup using existing capabilities + usr, err := user.LookupUid(uid) + if err == nil { + return usr, nil + } + // local files lookup failed; attempt to call `getent` to query configured passwd dbs + return getentUser(fmt.Sprintf("%s %d", "passwd", uid)) +} + +func getentUser(args string) (user.User, error) { + reader, err := callGetent(args) + if err != nil { + return user.User{}, err + } + users, err := user.ParsePasswd(reader) + if err != nil { + return user.User{}, err + } + if len(users) == 0 { + return user.User{}, fmt.Errorf("getent failed to find passwd entry for %q", strings.Split(args, " ")[1]) + } + return users[0], nil +} + +// LookupGroup uses traditional local system files lookup (from libcontainer/user) on a group name, +// followed by a call to `getent` for supporting host configured non-files passwd and group dbs +func LookupGroup(groupname string) (user.Group, error) { + // first try a local system files lookup using existing capabilities + group, err := user.LookupGroup(groupname) + if err == nil { + return group, nil + } + // local files lookup failed; attempt to call `getent` to query configured group dbs + return getentGroup(fmt.Sprintf("%s %s", "group", groupname)) +} + +// LookupGID uses traditional local system files lookup (from libcontainer/user) on a group ID, +// followed by a call to `getent` for supporting host configured non-files passwd and group dbs +func LookupGID(gid int) (user.Group, error) { + // first try a local system files lookup using existing capabilities + group, err := user.LookupGid(gid) + if err == nil { + return group, nil + } + // local files lookup failed; attempt to call `getent` to query configured group dbs + return getentGroup(fmt.Sprintf("%s %d", "group", gid)) +} + +func getentGroup(args string) (user.Group, error) { + reader, err := callGetent(args) + if err != nil { + return user.Group{}, err + } + groups, err := user.ParseGroup(reader) + if err != nil { + return user.Group{}, err + } + if len(groups) == 0 { + return user.Group{}, fmt.Errorf("getent failed to find groups entry for %q", strings.Split(args, " ")[1]) + } + return groups[0], nil +} + +func callGetent(args string) (io.Reader, error) { + entOnce.Do(func() { getentCmd, _ = resolveBinary("getent") }) + // if no `getent` command on host, can't do anything else + if getentCmd == "" { + return nil, fmt.Errorf("") + } + out, err := execCmd(getentCmd, args) + if err != nil { + exitCode, errC := system.GetExitCode(err) + if errC != nil { + return nil, err + } + switch exitCode { + case 1: + return nil, fmt.Errorf("getent reported invalid parameters/database unknown") + case 2: + terms := strings.Split(args, " ") + return nil, fmt.Errorf("getent unable to find entry %q in %s database", terms[1], terms[0]) + case 3: + return nil, fmt.Errorf("getent database doesn't support enumeration") + default: + return nil, err + } + + } + return bytes.NewReader(out), nil +} + +// lazyChown performs a chown only if the uid/gid don't match what's requested +// Normally a Chown is a no-op if uid/gid match, but in some cases this can still cause an error, e.g. if the +// dir is on an NFS share, so don't call chown unless we absolutely must. +func lazyChown(p string, uid, gid int, stat *system.StatT) error { + if stat == nil { + var err error + stat, err = system.Stat(p) + if err != nil { + return err + } + } + if stat.UID() == uint32(uid) && stat.GID() == uint32(gid) { + return nil + } + return os.Chown(p, uid, gid) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools_windows.go new file mode 100644 index 000000000..4ae38a1b1 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/idtools/idtools_windows.go @@ -0,0 +1,25 @@ +package idtools // import "github.com/docker/docker/pkg/idtools" + +import ( + "os" + + "github.com/docker/docker/pkg/system" +) + +// This is currently a wrapper around MkdirAll, however, since currently +// permissions aren't set through this path, the identity isn't utilized. +// Ownership is handled elsewhere, but in the future could be support here +// too. +func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error { + if err := system.MkdirAll(path, mode, ""); err != nil { + return err + } + return nil +} + +// CanAccess takes a valid (existing) directory and a uid, gid pair and determines +// if that uid, gid pair has access (execute bit) to the directory +// Windows does not require/support this function, so always return true +func CanAccess(path string, identity Identity) bool { + return true +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_linux.go new file mode 100644 index 000000000..6272c5a40 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_linux.go @@ -0,0 +1,164 @@ +package idtools // import "github.com/docker/docker/pkg/idtools" + +import ( + "fmt" + "regexp" + "sort" + "strconv" + "strings" + "sync" +) + +// add a user and/or group to Linux /etc/passwd, /etc/group using standard +// Linux distribution commands: +// adduser --system --shell /bin/false --disabled-login --disabled-password --no-create-home --group +// useradd -r -s /bin/false + +var ( + once sync.Once + userCommand string + + cmdTemplates = map[string]string{ + "adduser": "--system --shell /bin/false --no-create-home --disabled-login --disabled-password --group %s", + "useradd": "-r -s /bin/false %s", + "usermod": "-%s %d-%d %s", + } + + idOutRegexp = regexp.MustCompile(`uid=([0-9]+).*gid=([0-9]+)`) + // default length for a UID/GID subordinate range + defaultRangeLen = 65536 + defaultRangeStart = 100000 + userMod = "usermod" +) + +// AddNamespaceRangesUser takes a username and uses the standard system +// utility to create a system user/group pair used to hold the +// /etc/sub{uid,gid} ranges which will be used for user namespace +// mapping ranges in containers. +func AddNamespaceRangesUser(name string) (int, int, error) { + if err := addUser(name); err != nil { + return -1, -1, fmt.Errorf("Error adding user %q: %v", name, err) + } + + // Query the system for the created uid and gid pair + out, err := execCmd("id", name) + if err != nil { + return -1, -1, fmt.Errorf("Error trying to find uid/gid for new user %q: %v", name, err) + } + matches := idOutRegexp.FindStringSubmatch(strings.TrimSpace(string(out))) + if len(matches) != 3 { + return -1, -1, fmt.Errorf("Can't find uid, gid from `id` output: %q", string(out)) + } + uid, err := strconv.Atoi(matches[1]) + if err != nil { + return -1, -1, fmt.Errorf("Can't convert found uid (%s) to int: %v", matches[1], err) + } + gid, err := strconv.Atoi(matches[2]) + if err != nil { + return -1, -1, fmt.Errorf("Can't convert found gid (%s) to int: %v", matches[2], err) + } + + // Now we need to create the subuid/subgid ranges for our new user/group (system users + // do not get auto-created ranges in subuid/subgid) + + if err := createSubordinateRanges(name); err != nil { + return -1, -1, fmt.Errorf("Couldn't create subordinate ID ranges: %v", err) + } + return uid, gid, nil +} + +func addUser(userName string) error { + once.Do(func() { + // set up which commands are used for adding users/groups dependent on distro + if _, err := resolveBinary("adduser"); err == nil { + userCommand = "adduser" + } else if _, err := resolveBinary("useradd"); err == nil { + userCommand = "useradd" + } + }) + if userCommand == "" { + return fmt.Errorf("Cannot add user; no useradd/adduser binary found") + } + args := fmt.Sprintf(cmdTemplates[userCommand], userName) + out, err := execCmd(userCommand, args) + if err != nil { + return fmt.Errorf("Failed to add user with error: %v; output: %q", err, string(out)) + } + return nil +} + +func createSubordinateRanges(name string) error { + + // first, we should verify that ranges weren't automatically created + // by the distro tooling + ranges, err := parseSubuid(name) + if err != nil { + return fmt.Errorf("Error while looking for subuid ranges for user %q: %v", name, err) + } + if len(ranges) == 0 { + // no UID ranges; let's create one + startID, err := findNextUIDRange() + if err != nil { + return fmt.Errorf("Can't find available subuid range: %v", err) + } + out, err := execCmd(userMod, fmt.Sprintf(cmdTemplates[userMod], "v", startID, startID+defaultRangeLen-1, name)) + if err != nil { + return fmt.Errorf("Unable to add subuid range to user: %q; output: %s, err: %v", name, out, err) + } + } + + ranges, err = parseSubgid(name) + if err != nil { + return fmt.Errorf("Error while looking for subgid ranges for user %q: %v", name, err) + } + if len(ranges) == 0 { + // no GID ranges; let's create one + startID, err := findNextGIDRange() + if err != nil { + return fmt.Errorf("Can't find available subgid range: %v", err) + } + out, err := execCmd(userMod, fmt.Sprintf(cmdTemplates[userMod], "w", startID, startID+defaultRangeLen-1, name)) + if err != nil { + return fmt.Errorf("Unable to add subgid range to user: %q; output: %s, err: %v", name, out, err) + } + } + return nil +} + +func findNextUIDRange() (int, error) { + ranges, err := parseSubuid("ALL") + if err != nil { + return -1, fmt.Errorf("Couldn't parse all ranges in /etc/subuid file: %v", err) + } + sort.Sort(ranges) + return findNextRangeStart(ranges) +} + +func findNextGIDRange() (int, error) { + ranges, err := parseSubgid("ALL") + if err != nil { + return -1, fmt.Errorf("Couldn't parse all ranges in /etc/subgid file: %v", err) + } + sort.Sort(ranges) + return findNextRangeStart(ranges) +} + +func findNextRangeStart(rangeList ranges) (int, error) { + startID := defaultRangeStart + for _, arange := range rangeList { + if wouldOverlap(arange, startID) { + startID = arange.Start + arange.Length + } + } + return startID, nil +} + +func wouldOverlap(arange subIDRange, ID int) bool { + low := ID + high := ID + defaultRangeLen + if (low >= arange.Start && low <= arange.Start+arange.Length) || + (high <= arange.Start+arange.Length && high >= arange.Start) { + return true + } + return false +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go b/integration-test/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go new file mode 100644 index 000000000..e7c4d6311 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go @@ -0,0 +1,12 @@ +// +build !linux + +package idtools // import "github.com/docker/docker/pkg/idtools" + +import "fmt" + +// AddNamespaceRangesUser takes a name and finds an unused uid, gid pair +// and calls the appropriate helper function to add the group and then +// the user to the group in /etc/group and /etc/passwd respectively. +func AddNamespaceRangesUser(name string) (int, int, error) { + return -1, -1, fmt.Errorf("No support for adding users or groups on this OS") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/idtools/utils_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/idtools/utils_unix.go new file mode 100644 index 000000000..903ac4501 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/idtools/utils_unix.go @@ -0,0 +1,32 @@ +// +build !windows + +package idtools // import "github.com/docker/docker/pkg/idtools" + +import ( + "fmt" + "os/exec" + "path/filepath" + "strings" +) + +func resolveBinary(binname string) (string, error) { + binaryPath, err := exec.LookPath(binname) + if err != nil { + return "", err + } + resolvedPath, err := filepath.EvalSymlinks(binaryPath) + if err != nil { + return "", err + } + //only return no error if the final resolved binary basename + //matches what was searched for + if filepath.Base(resolvedPath) == binname { + return resolvedPath, nil + } + return "", fmt.Errorf("Binary %q does not resolve to a binary of that name in $PATH (%q)", binname, resolvedPath) +} + +func execCmd(cmd, args string) ([]byte, error) { + execCmd := exec.Command(cmd, strings.Split(args, " ")...) + return execCmd.CombinedOutput() +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/flags.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/flags.go new file mode 100644 index 000000000..ffd473311 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/flags.go @@ -0,0 +1,137 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +import ( + "fmt" + "strings" +) + +var flags = map[string]struct { + clear bool + flag int +}{ + "defaults": {false, 0}, + "ro": {false, RDONLY}, + "rw": {true, RDONLY}, + "suid": {true, NOSUID}, + "nosuid": {false, NOSUID}, + "dev": {true, NODEV}, + "nodev": {false, NODEV}, + "exec": {true, NOEXEC}, + "noexec": {false, NOEXEC}, + "sync": {false, SYNCHRONOUS}, + "async": {true, SYNCHRONOUS}, + "dirsync": {false, DIRSYNC}, + "remount": {false, REMOUNT}, + "mand": {false, MANDLOCK}, + "nomand": {true, MANDLOCK}, + "atime": {true, NOATIME}, + "noatime": {false, NOATIME}, + "diratime": {true, NODIRATIME}, + "nodiratime": {false, NODIRATIME}, + "bind": {false, BIND}, + "rbind": {false, RBIND}, + "unbindable": {false, UNBINDABLE}, + "runbindable": {false, RUNBINDABLE}, + "private": {false, PRIVATE}, + "rprivate": {false, RPRIVATE}, + "shared": {false, SHARED}, + "rshared": {false, RSHARED}, + "slave": {false, SLAVE}, + "rslave": {false, RSLAVE}, + "relatime": {false, RELATIME}, + "norelatime": {true, RELATIME}, + "strictatime": {false, STRICTATIME}, + "nostrictatime": {true, STRICTATIME}, +} + +var validFlags = map[string]bool{ + "": true, + "size": true, + "mode": true, + "uid": true, + "gid": true, + "nr_inodes": true, + "nr_blocks": true, + "mpol": true, +} + +var propagationFlags = map[string]bool{ + "bind": true, + "rbind": true, + "unbindable": true, + "runbindable": true, + "private": true, + "rprivate": true, + "shared": true, + "rshared": true, + "slave": true, + "rslave": true, +} + +// MergeTmpfsOptions merge mount options to make sure there is no duplicate. +func MergeTmpfsOptions(options []string) ([]string, error) { + // We use collisions maps to remove duplicates. + // For flag, the key is the flag value (the key for propagation flag is -1) + // For data=value, the key is the data + flagCollisions := map[int]bool{} + dataCollisions := map[string]bool{} + + var newOptions []string + // We process in reverse order + for i := len(options) - 1; i >= 0; i-- { + option := options[i] + if option == "defaults" { + continue + } + if f, ok := flags[option]; ok && f.flag != 0 { + // There is only one propagation mode + key := f.flag + if propagationFlags[option] { + key = -1 + } + // Check to see if there is collision for flag + if !flagCollisions[key] { + // We prepend the option and add to collision map + newOptions = append([]string{option}, newOptions...) + flagCollisions[key] = true + } + continue + } + opt := strings.SplitN(option, "=", 2) + if len(opt) != 2 || !validFlags[opt[0]] { + return nil, fmt.Errorf("Invalid tmpfs option %q", opt) + } + if !dataCollisions[opt[0]] { + // We prepend the option and add to collision map + newOptions = append([]string{option}, newOptions...) + dataCollisions[opt[0]] = true + } + } + + return newOptions, nil +} + +// Parse fstab type mount options into mount() flags +// and device specific data +func parseOptions(options string) (int, string) { + var ( + flag int + data []string + ) + + for _, o := range strings.Split(options, ",") { + // If the option does not exist in the flags table or the flag + // is not supported on the platform, + // then it is a data value for a specific fs type + if f, exists := flags[o]; exists && f.flag != 0 { + if f.clear { + flag &= ^f.flag + } else { + flag |= f.flag + } + } else { + data = append(data, o) + } + } + return flag, strings.Join(data, ",") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_freebsd.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_freebsd.go new file mode 100644 index 000000000..ef35ef905 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_freebsd.go @@ -0,0 +1,49 @@ +// +build freebsd,cgo + +package mount // import "github.com/docker/docker/pkg/mount" + +/* +#include +*/ +import "C" + +const ( + // RDONLY will mount the filesystem as read-only. + RDONLY = C.MNT_RDONLY + + // NOSUID will not allow set-user-identifier or set-group-identifier bits to + // take effect. + NOSUID = C.MNT_NOSUID + + // NOEXEC will not allow execution of any binaries on the mounted file system. + NOEXEC = C.MNT_NOEXEC + + // SYNCHRONOUS will allow any I/O to the file system to be done synchronously. + SYNCHRONOUS = C.MNT_SYNCHRONOUS + + // NOATIME will not update the file access time when reading from a file. + NOATIME = C.MNT_NOATIME +) + +// These flags are unsupported. +const ( + BIND = 0 + DIRSYNC = 0 + MANDLOCK = 0 + NODEV = 0 + NODIRATIME = 0 + UNBINDABLE = 0 + RUNBINDABLE = 0 + PRIVATE = 0 + RPRIVATE = 0 + SHARED = 0 + RSHARED = 0 + SLAVE = 0 + RSLAVE = 0 + RBIND = 0 + RELATIVE = 0 + RELATIME = 0 + REMOUNT = 0 + STRICTATIME = 0 + mntDetach = 0 +) diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_linux.go new file mode 100644 index 000000000..a1b199a31 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_linux.go @@ -0,0 +1,87 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +import ( + "golang.org/x/sys/unix" +) + +const ( + // RDONLY will mount the file system read-only. + RDONLY = unix.MS_RDONLY + + // NOSUID will not allow set-user-identifier or set-group-identifier bits to + // take effect. + NOSUID = unix.MS_NOSUID + + // NODEV will not interpret character or block special devices on the file + // system. + NODEV = unix.MS_NODEV + + // NOEXEC will not allow execution of any binaries on the mounted file system. + NOEXEC = unix.MS_NOEXEC + + // SYNCHRONOUS will allow I/O to the file system to be done synchronously. + SYNCHRONOUS = unix.MS_SYNCHRONOUS + + // DIRSYNC will force all directory updates within the file system to be done + // synchronously. This affects the following system calls: create, link, + // unlink, symlink, mkdir, rmdir, mknod and rename. + DIRSYNC = unix.MS_DIRSYNC + + // REMOUNT will attempt to remount an already-mounted file system. This is + // commonly used to change the mount flags for a file system, especially to + // make a readonly file system writeable. It does not change device or mount + // point. + REMOUNT = unix.MS_REMOUNT + + // MANDLOCK will force mandatory locks on a filesystem. + MANDLOCK = unix.MS_MANDLOCK + + // NOATIME will not update the file access time when reading from a file. + NOATIME = unix.MS_NOATIME + + // NODIRATIME will not update the directory access time. + NODIRATIME = unix.MS_NODIRATIME + + // BIND remounts a subtree somewhere else. + BIND = unix.MS_BIND + + // RBIND remounts a subtree and all possible submounts somewhere else. + RBIND = unix.MS_BIND | unix.MS_REC + + // UNBINDABLE creates a mount which cannot be cloned through a bind operation. + UNBINDABLE = unix.MS_UNBINDABLE + + // RUNBINDABLE marks the entire mount tree as UNBINDABLE. + RUNBINDABLE = unix.MS_UNBINDABLE | unix.MS_REC + + // PRIVATE creates a mount which carries no propagation abilities. + PRIVATE = unix.MS_PRIVATE + + // RPRIVATE marks the entire mount tree as PRIVATE. + RPRIVATE = unix.MS_PRIVATE | unix.MS_REC + + // SLAVE creates a mount which receives propagation from its master, but not + // vice versa. + SLAVE = unix.MS_SLAVE + + // RSLAVE marks the entire mount tree as SLAVE. + RSLAVE = unix.MS_SLAVE | unix.MS_REC + + // SHARED creates a mount which provides the ability to create mirrors of + // that mount such that mounts and unmounts within any of the mirrors + // propagate to the other mirrors. + SHARED = unix.MS_SHARED + + // RSHARED marks the entire mount tree as SHARED. + RSHARED = unix.MS_SHARED | unix.MS_REC + + // RELATIME updates inode access times relative to modify or change time. + RELATIME = unix.MS_RELATIME + + // STRICTATIME allows to explicitly request full atime updates. This makes + // it possible for the kernel to default to relatime or noatime but still + // allow userspace to override it. + STRICTATIME = unix.MS_STRICTATIME + + mntDetach = unix.MNT_DETACH +) diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_unsupported.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_unsupported.go new file mode 100644 index 000000000..cc6c47590 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/flags_unsupported.go @@ -0,0 +1,31 @@ +// +build !linux,!freebsd freebsd,!cgo + +package mount // import "github.com/docker/docker/pkg/mount" + +// These flags are unsupported. +const ( + BIND = 0 + DIRSYNC = 0 + MANDLOCK = 0 + NOATIME = 0 + NODEV = 0 + NODIRATIME = 0 + NOEXEC = 0 + NOSUID = 0 + UNBINDABLE = 0 + RUNBINDABLE = 0 + PRIVATE = 0 + RPRIVATE = 0 + SHARED = 0 + RSHARED = 0 + SLAVE = 0 + RSLAVE = 0 + RBIND = 0 + RELATIME = 0 + RELATIVE = 0 + REMOUNT = 0 + STRICTATIME = 0 + SYNCHRONOUS = 0 + RDONLY = 0 + mntDetach = 0 +) diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mount.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mount.go new file mode 100644 index 000000000..be0631c63 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mount.go @@ -0,0 +1,159 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +import ( + "sort" + "strconv" + "strings" + + "github.com/sirupsen/logrus" +) + +// mountError records an error from mount or unmount operation +type mountError struct { + op string + source, target string + flags uintptr + data string + err error +} + +func (e *mountError) Error() string { + out := e.op + " " + + if e.source != "" { + out += e.source + ":" + e.target + } else { + out += e.target + } + + if e.flags != uintptr(0) { + out += ", flags: 0x" + strconv.FormatUint(uint64(e.flags), 16) + } + if e.data != "" { + out += ", data: " + e.data + } + + out += ": " + e.err.Error() + return out +} + +// Cause returns the underlying cause of the error +func (e *mountError) Cause() error { + return e.err +} + +// FilterFunc is a type defining a callback function +// to filter out unwanted entries. It takes a pointer +// to an Info struct (not fully populated, currently +// only Mountpoint is filled in), and returns two booleans: +// - skip: true if the entry should be skipped +// - stop: true if parsing should be stopped after the entry +type FilterFunc func(*Info) (skip, stop bool) + +// PrefixFilter discards all entries whose mount points +// do not start with a prefix specified +func PrefixFilter(prefix string) FilterFunc { + return func(m *Info) (bool, bool) { + skip := !strings.HasPrefix(m.Mountpoint, prefix) + return skip, false + } +} + +// SingleEntryFilter looks for a specific entry +func SingleEntryFilter(mp string) FilterFunc { + return func(m *Info) (bool, bool) { + if m.Mountpoint == mp { + return false, true // don't skip, stop now + } + return true, false // skip, keep going + } +} + +// ParentsFilter returns all entries whose mount points +// can be parents of a path specified, discarding others. +// For example, given `/var/lib/docker/something`, entries +// like `/var/lib/docker`, `/var` and `/` are returned. +func ParentsFilter(path string) FilterFunc { + return func(m *Info) (bool, bool) { + skip := !strings.HasPrefix(path, m.Mountpoint) + return skip, false + } +} + +// GetMounts retrieves a list of mounts for the current running process, +// with an optional filter applied (use nil for no filter). +func GetMounts(f FilterFunc) ([]*Info, error) { + return parseMountTable(f) +} + +// Mounted determines if a specified mountpoint has been mounted. +// On Linux it looks at /proc/self/mountinfo. +func Mounted(mountpoint string) (bool, error) { + entries, err := GetMounts(SingleEntryFilter(mountpoint)) + if err != nil { + return false, err + } + + return len(entries) > 0, nil +} + +// Mount will mount filesystem according to the specified configuration, on the +// condition that the target path is *not* already mounted. Options must be +// specified like the mount or fstab unix commands: "opt1=val1,opt2=val2". See +// flags.go for supported option flags. +func Mount(device, target, mType, options string) error { + flag, data := parseOptions(options) + if flag&REMOUNT != REMOUNT { + if mounted, err := Mounted(target); err != nil || mounted { + return err + } + } + return mount(device, target, mType, uintptr(flag), data) +} + +// ForceMount will mount a filesystem according to the specified configuration, +// *regardless* if the target path is not already mounted. Options must be +// specified like the mount or fstab unix commands: "opt1=val1,opt2=val2". See +// flags.go for supported option flags. +func ForceMount(device, target, mType, options string) error { + flag, data := parseOptions(options) + return mount(device, target, mType, uintptr(flag), data) +} + +// Unmount lazily unmounts a filesystem on supported platforms, otherwise +// does a normal unmount. +func Unmount(target string) error { + return unmount(target, mntDetach) +} + +// RecursiveUnmount unmounts the target and all mounts underneath, starting with +// the deepsest mount first. +func RecursiveUnmount(target string) error { + mounts, err := parseMountTable(PrefixFilter(target)) + if err != nil { + return err + } + + // Make the deepest mount be first + sort.Slice(mounts, func(i, j int) bool { + return len(mounts[i].Mountpoint) > len(mounts[j].Mountpoint) + }) + + for i, m := range mounts { + logrus.Debugf("Trying to unmount %s", m.Mountpoint) + err = unmount(m.Mountpoint, mntDetach) + if err != nil { + if i == len(mounts)-1 { // last mount + if mounted, e := Mounted(m.Mountpoint); e != nil || mounted { + return err + } + } else { + // This is some submount, we can ignore this error for now, the final unmount will fail if this is a real problem + logrus.WithError(err).Warnf("Failed to unmount submount %s", m.Mountpoint) + } + } + + logrus.Debugf("Unmounted %s", m.Mountpoint) + } + return nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_freebsd.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_freebsd.go new file mode 100644 index 000000000..09ad36060 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_freebsd.go @@ -0,0 +1,59 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +/* +#include +#include +#include +#include +#include +#include +*/ +import "C" + +import ( + "strings" + "syscall" + "unsafe" +) + +func allocateIOVecs(options []string) []C.struct_iovec { + out := make([]C.struct_iovec, len(options)) + for i, option := range options { + out[i].iov_base = unsafe.Pointer(C.CString(option)) + out[i].iov_len = C.size_t(len(option) + 1) + } + return out +} + +func mount(device, target, mType string, flag uintptr, data string) error { + isNullFS := false + + xs := strings.Split(data, ",") + for _, x := range xs { + if x == "bind" { + isNullFS = true + } + } + + options := []string{"fspath", target} + if isNullFS { + options = append(options, "fstype", "nullfs", "target", device) + } else { + options = append(options, "fstype", mType, "from", device) + } + rawOptions := allocateIOVecs(options) + for _, rawOption := range rawOptions { + defer C.free(rawOption.iov_base) + } + + if errno := C.nmount(&rawOptions[0], C.uint(len(options)), C.int(flag)); errno != 0 { + return &mountError{ + op: "mount", + source: device, + target: target, + flags: flag, + err: syscall.Errno(errno), + } + } + return nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_linux.go new file mode 100644 index 000000000..a0a1ad236 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_linux.go @@ -0,0 +1,73 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +import ( + "golang.org/x/sys/unix" +) + +const ( + // ptypes is the set propagation types. + ptypes = unix.MS_SHARED | unix.MS_PRIVATE | unix.MS_SLAVE | unix.MS_UNBINDABLE + + // pflags is the full set valid flags for a change propagation call. + pflags = ptypes | unix.MS_REC | unix.MS_SILENT + + // broflags is the combination of bind and read only + broflags = unix.MS_BIND | unix.MS_RDONLY +) + +// isremount returns true if either device name or flags identify a remount request, false otherwise. +func isremount(device string, flags uintptr) bool { + switch { + // We treat device "" and "none" as a remount request to provide compatibility with + // requests that don't explicitly set MS_REMOUNT such as those manipulating bind mounts. + case flags&unix.MS_REMOUNT != 0, device == "", device == "none": + return true + default: + return false + } +} + +func mount(device, target, mType string, flags uintptr, data string) error { + oflags := flags &^ ptypes + if !isremount(device, flags) || data != "" { + // Initial call applying all non-propagation flags for mount + // or remount with changed data + if err := unix.Mount(device, target, mType, oflags, data); err != nil { + return &mountError{ + op: "mount", + source: device, + target: target, + flags: oflags, + data: data, + err: err, + } + } + } + + if flags&ptypes != 0 { + // Change the propagation type. + if err := unix.Mount("", target, "", flags&pflags, ""); err != nil { + return &mountError{ + op: "remount", + target: target, + flags: flags & pflags, + err: err, + } + } + } + + if oflags&broflags == broflags { + // Remount the bind to apply read only. + if err := unix.Mount("", target, "", oflags|unix.MS_REMOUNT, ""); err != nil { + return &mountError{ + op: "remount-ro", + target: target, + flags: oflags | unix.MS_REMOUNT, + err: err, + } + + } + } + + return nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_unsupported.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_unsupported.go new file mode 100644 index 000000000..c3e5aec27 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mounter_unsupported.go @@ -0,0 +1,7 @@ +// +build !linux,!freebsd freebsd,!cgo + +package mount // import "github.com/docker/docker/pkg/mount" + +func mount(device, target, mType string, flag uintptr, data string) error { + panic("Not implemented") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo.go new file mode 100644 index 000000000..ecd03fc02 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo.go @@ -0,0 +1,40 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +// Info reveals information about a particular mounted filesystem. This +// struct is populated from the content in the /proc//mountinfo file. +type Info struct { + // ID is a unique identifier of the mount (may be reused after umount). + ID int + + // Parent indicates the ID of the mount parent (or of self for the top of the + // mount tree). + Parent int + + // Major indicates one half of the device ID which identifies the device class. + Major int + + // Minor indicates one half of the device ID which identifies a specific + // instance of device. + Minor int + + // Root of the mount within the filesystem. + Root string + + // Mountpoint indicates the mount point relative to the process's root. + Mountpoint string + + // Opts represents mount-specific options. + Opts string + + // Optional represents optional fields. + Optional string + + // Fstype indicates the type of filesystem, such as EXT3. + Fstype string + + // Source indicates filesystem specific information or "none". + Source string + + // VfsOpts represents per super block options. + VfsOpts string +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go new file mode 100644 index 000000000..36c89dc1a --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go @@ -0,0 +1,55 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +/* +#include +#include +#include +*/ +import "C" + +import ( + "fmt" + "reflect" + "unsafe" +) + +// Parse /proc/self/mountinfo because comparing Dev and ino does not work from +// bind mounts. +func parseMountTable(filter FilterFunc) ([]*Info, error) { + var rawEntries *C.struct_statfs + + count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT)) + if count == 0 { + return nil, fmt.Errorf("Failed to call getmntinfo") + } + + var entries []C.struct_statfs + header := (*reflect.SliceHeader)(unsafe.Pointer(&entries)) + header.Cap = count + header.Len = count + header.Data = uintptr(unsafe.Pointer(rawEntries)) + + var out []*Info + for _, entry := range entries { + var mountinfo Info + var skip, stop bool + mountinfo.Mountpoint = C.GoString(&entry.f_mntonname[0]) + + if filter != nil { + // filter out entries we're not interested in + skip, stop = filter(p) + if skip { + continue + } + } + + mountinfo.Source = C.GoString(&entry.f_mntfromname[0]) + mountinfo.Fstype = C.GoString(&entry.f_fstypename[0]) + + out = append(out, &mountinfo) + if stop { + break + } + } + return out, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_linux.go new file mode 100644 index 000000000..fe6e3ddba --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_linux.go @@ -0,0 +1,144 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +import ( + "bufio" + "fmt" + "io" + "os" + "strconv" + "strings" + + "github.com/pkg/errors" +) + +func parseInfoFile(r io.Reader, filter FilterFunc) ([]*Info, error) { + s := bufio.NewScanner(r) + out := []*Info{} + var err error + for s.Scan() { + if err = s.Err(); err != nil { + return nil, err + } + /* + See http://man7.org/linux/man-pages/man5/proc.5.html + + 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue + (1)(2)(3) (4) (5) (6) (7) (8) (9) (10) (11) + + (1) mount ID: unique identifier of the mount (may be reused after umount) + (2) parent ID: ID of parent (or of self for the top of the mount tree) + (3) major:minor: value of st_dev for files on filesystem + (4) root: root of the mount within the filesystem + (5) mount point: mount point relative to the process's root + (6) mount options: per mount options + (7) optional fields: zero or more fields of the form "tag[:value]" + (8) separator: marks the end of the optional fields + (9) filesystem type: name of filesystem of the form "type[.subtype]" + (10) mount source: filesystem specific information or "none" + (11) super options: per super block options + */ + + text := s.Text() + fields := strings.Split(text, " ") + numFields := len(fields) + if numFields < 10 { + // should be at least 10 fields + return nil, fmt.Errorf("Parsing '%s' failed: not enough fields (%d)", text, numFields) + } + + p := &Info{} + // ignore any numbers parsing errors, as there should not be any + p.ID, _ = strconv.Atoi(fields[0]) + p.Parent, _ = strconv.Atoi(fields[1]) + mm := strings.Split(fields[2], ":") + if len(mm) != 2 { + return nil, fmt.Errorf("Parsing '%s' failed: unexpected minor:major pair %s", text, mm) + } + p.Major, _ = strconv.Atoi(mm[0]) + p.Minor, _ = strconv.Atoi(mm[1]) + + p.Root, err = strconv.Unquote(`"` + fields[3] + `"`) + if err != nil { + return nil, errors.Wrapf(err, "Parsing '%s' failed: unable to unquote root field", fields[3]) + } + + p.Mountpoint, err = strconv.Unquote(`"` + fields[4] + `"`) + if err != nil { + return nil, errors.Wrapf(err, "Parsing '%s' failed: unable to unquote mount point field", fields[4]) + } + p.Opts = fields[5] + + var skip, stop bool + if filter != nil { + // filter out entries we're not interested in + skip, stop = filter(p) + if skip { + continue + } + } + + // one or more optional fields, when a separator (-) + i := 6 + for ; i < numFields && fields[i] != "-"; i++ { + switch i { + case 6: + p.Optional = fields[6] + default: + /* NOTE there might be more optional fields before the such as + fields[7]...fields[N] (where N < sepIndex), although + as of Linux kernel 4.15 the only known ones are + mount propagation flags in fields[6]. The correct + behavior is to ignore any unknown optional fields. + */ + break + } + } + if i == numFields { + return nil, fmt.Errorf("Parsing '%s' failed: missing separator ('-')", text) + } + + // There should be 3 fields after the separator... + if i+4 > numFields { + return nil, fmt.Errorf("Parsing '%s' failed: not enough fields after a separator", text) + } + // ... but in Linux <= 3.9 mounting a cifs with spaces in a share name + // (like "//serv/My Documents") _may_ end up having a space in the last field + // of mountinfo (like "unc=//serv/My Documents"). Since kernel 3.10-rc1, cifs + // option unc= is ignored, so a space should not appear. In here we ignore + // those "extra" fields caused by extra spaces. + p.Fstype = fields[i+1] + p.Source = fields[i+2] + p.VfsOpts = fields[i+3] + + out = append(out, p) + if stop { + break + } + } + return out, nil +} + +// Parse /proc/self/mountinfo because comparing Dev and ino does not work from +// bind mounts +func parseMountTable(filter FilterFunc) ([]*Info, error) { + f, err := os.Open("/proc/self/mountinfo") + if err != nil { + return nil, err + } + defer f.Close() + + return parseInfoFile(f, filter) +} + +// PidMountInfo collects the mounts for a specific process ID. If the process +// ID is unknown, it is better to use `GetMounts` which will inspect +// "/proc/self/mountinfo" instead. +func PidMountInfo(pid int) ([]*Info, error) { + f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid)) + if err != nil { + return nil, err + } + defer f.Close() + + return parseInfoFile(f, nil) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_unsupported.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_unsupported.go new file mode 100644 index 000000000..fd16d3ed6 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_unsupported.go @@ -0,0 +1,12 @@ +// +build !windows,!linux,!freebsd freebsd,!cgo + +package mount // import "github.com/docker/docker/pkg/mount" + +import ( + "fmt" + "runtime" +) + +func parseMountTable(f FilterFunc) ([]*Info, error) { + return nil, fmt.Errorf("mount.parseMountTable is not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_windows.go new file mode 100644 index 000000000..27e0f6976 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/mountinfo_windows.go @@ -0,0 +1,6 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +func parseMountTable(f FilterFunc) ([]*Info, error) { + // Do NOT return an error! + return nil, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/sharedsubtree_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/sharedsubtree_linux.go new file mode 100644 index 000000000..db3882874 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/sharedsubtree_linux.go @@ -0,0 +1,71 @@ +package mount // import "github.com/docker/docker/pkg/mount" + +// MakeShared ensures a mounted filesystem has the SHARED mount option enabled. +// See the supported options in flags.go for further reference. +func MakeShared(mountPoint string) error { + return ensureMountedAs(mountPoint, SHARED) +} + +// MakeRShared ensures a mounted filesystem has the RSHARED mount option enabled. +// See the supported options in flags.go for further reference. +func MakeRShared(mountPoint string) error { + return ensureMountedAs(mountPoint, RSHARED) +} + +// MakePrivate ensures a mounted filesystem has the PRIVATE mount option enabled. +// See the supported options in flags.go for further reference. +func MakePrivate(mountPoint string) error { + return ensureMountedAs(mountPoint, PRIVATE) +} + +// MakeRPrivate ensures a mounted filesystem has the RPRIVATE mount option +// enabled. See the supported options in flags.go for further reference. +func MakeRPrivate(mountPoint string) error { + return ensureMountedAs(mountPoint, RPRIVATE) +} + +// MakeSlave ensures a mounted filesystem has the SLAVE mount option enabled. +// See the supported options in flags.go for further reference. +func MakeSlave(mountPoint string) error { + return ensureMountedAs(mountPoint, SLAVE) +} + +// MakeRSlave ensures a mounted filesystem has the RSLAVE mount option enabled. +// See the supported options in flags.go for further reference. +func MakeRSlave(mountPoint string) error { + return ensureMountedAs(mountPoint, RSLAVE) +} + +// MakeUnbindable ensures a mounted filesystem has the UNBINDABLE mount option +// enabled. See the supported options in flags.go for further reference. +func MakeUnbindable(mountPoint string) error { + return ensureMountedAs(mountPoint, UNBINDABLE) +} + +// MakeRUnbindable ensures a mounted filesystem has the RUNBINDABLE mount +// option enabled. See the supported options in flags.go for further reference. +func MakeRUnbindable(mountPoint string) error { + return ensureMountedAs(mountPoint, RUNBINDABLE) +} + +// MakeMount ensures that the file or directory given is a mount point, +// bind mounting it to itself it case it is not. +func MakeMount(mnt string) error { + mounted, err := Mounted(mnt) + if err != nil { + return err + } + if mounted { + return nil + } + + return mount(mnt, mnt, "none", uintptr(BIND), "") +} + +func ensureMountedAs(mnt string, flags int) error { + if err := MakeMount(mnt); err != nil { + return err + } + + return mount("", mnt, "none", uintptr(flags), "") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/unmount_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/unmount_unix.go new file mode 100644 index 000000000..4be427685 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/unmount_unix.go @@ -0,0 +1,22 @@ +// +build !windows + +package mount // import "github.com/docker/docker/pkg/mount" + +import "golang.org/x/sys/unix" + +func unmount(target string, flags int) error { + err := unix.Unmount(target, flags) + if err == nil || err == unix.EINVAL { + // Ignore "not mounted" error here. Note the same error + // can be returned if flags are invalid, so this code + // assumes that the flags value is always correct. + return nil + } + + return &mountError{ + op: "umount", + target: target, + flags: uintptr(flags), + err: err, + } +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/mount/unmount_unsupported.go b/integration-test/vendor/github.com/docker/docker/pkg/mount/unmount_unsupported.go new file mode 100644 index 000000000..a88ad3577 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/mount/unmount_unsupported.go @@ -0,0 +1,7 @@ +// +build windows + +package mount // import "github.com/docker/docker/pkg/mount" + +func unmount(target string, flag int) error { + panic("Not implemented") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/args_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/args_windows.go new file mode 100644 index 000000000..b7c9487a0 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/args_windows.go @@ -0,0 +1,16 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "strings" + + "golang.org/x/sys/windows" +) + +// EscapeArgs makes a Windows-style escaped command line from a set of arguments +func EscapeArgs(args []string) string { + escapedArgs := make([]string, len(args)) + for i, a := range args { + escapedArgs[i] = windows.EscapeArg(a) + } + return strings.Join(escapedArgs, " ") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes.go b/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes.go new file mode 100644 index 000000000..c26a4e24b --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes.go @@ -0,0 +1,31 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "os" + "time" +) + +// Chtimes changes the access time and modified time of a file at the given path +func Chtimes(name string, atime time.Time, mtime time.Time) error { + unixMinTime := time.Unix(0, 0) + unixMaxTime := maxTime + + // If the modified time is prior to the Unix Epoch, or after the + // end of Unix Time, os.Chtimes has undefined behavior + // default to Unix Epoch in this case, just in case + + if atime.Before(unixMinTime) || atime.After(unixMaxTime) { + atime = unixMinTime + } + + if mtime.Before(unixMinTime) || mtime.After(unixMaxTime) { + mtime = unixMinTime + } + + if err := os.Chtimes(name, atime, mtime); err != nil { + return err + } + + // Take platform specific action for setting create time. + return setCTime(name, mtime) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes_unix.go new file mode 100644 index 000000000..259138a45 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes_unix.go @@ -0,0 +1,14 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +import ( + "time" +) + +//setCTime will set the create time on a file. On Unix, the create +//time is updated as a side effect of setting the modified time, so +//no action is required. +func setCTime(path string, ctime time.Time) error { + return nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes_windows.go new file mode 100644 index 000000000..d3a115ff4 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/chtimes_windows.go @@ -0,0 +1,26 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "time" + + "golang.org/x/sys/windows" +) + +//setCTime will set the create time on a file. On Windows, this requires +//calling SetFileTime and explicitly including the create time. +func setCTime(path string, ctime time.Time) error { + ctimespec := windows.NsecToTimespec(ctime.UnixNano()) + pathp, e := windows.UTF16PtrFromString(path) + if e != nil { + return e + } + h, e := windows.CreateFile(pathp, + windows.FILE_WRITE_ATTRIBUTES, windows.FILE_SHARE_WRITE, nil, + windows.OPEN_EXISTING, windows.FILE_FLAG_BACKUP_SEMANTICS, 0) + if e != nil { + return e + } + defer windows.Close(h) + c := windows.NsecToFiletime(windows.TimespecToNsec(ctimespec)) + return windows.SetFileTime(h, &c, nil, nil) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/errors.go b/integration-test/vendor/github.com/docker/docker/pkg/system/errors.go new file mode 100644 index 000000000..2573d7162 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/errors.go @@ -0,0 +1,13 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "errors" +) + +var ( + // ErrNotSupportedPlatform means the platform is not supported. + ErrNotSupportedPlatform = errors.New("platform and architecture is not supported") + + // ErrNotSupportedOperatingSystem means the operating system is not supported. + ErrNotSupportedOperatingSystem = errors.New("operating system is not supported") +) diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/exitcode.go b/integration-test/vendor/github.com/docker/docker/pkg/system/exitcode.go new file mode 100644 index 000000000..4ba8fe35b --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/exitcode.go @@ -0,0 +1,19 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "fmt" + "os/exec" + "syscall" +) + +// GetExitCode returns the ExitStatus of the specified error if its type is +// exec.ExitError, returns 0 and an error otherwise. +func GetExitCode(err error) (int, error) { + exitCode := 0 + if exiterr, ok := err.(*exec.ExitError); ok { + if procExit, ok := exiterr.Sys().(syscall.WaitStatus); ok { + return procExit.ExitStatus(), nil + } + } + return exitCode, fmt.Errorf("failed to get exit code") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/filesys.go b/integration-test/vendor/github.com/docker/docker/pkg/system/filesys.go new file mode 100644 index 000000000..adeb16305 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/filesys.go @@ -0,0 +1,67 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +import ( + "io/ioutil" + "os" + "path/filepath" +) + +// MkdirAllWithACL is a wrapper for MkdirAll on unix systems. +func MkdirAllWithACL(path string, perm os.FileMode, sddl string) error { + return MkdirAll(path, perm, sddl) +} + +// MkdirAll creates a directory named path along with any necessary parents, +// with permission specified by attribute perm for all dir created. +func MkdirAll(path string, perm os.FileMode, sddl string) error { + return os.MkdirAll(path, perm) +} + +// IsAbs is a platform-specific wrapper for filepath.IsAbs. +func IsAbs(path string) bool { + return filepath.IsAbs(path) +} + +// The functions below here are wrappers for the equivalents in the os and ioutils packages. +// They are passthrough on Unix platforms, and only relevant on Windows. + +// CreateSequential creates the named file with mode 0666 (before umask), truncating +// it if it already exists. If successful, methods on the returned +// File can be used for I/O; the associated file descriptor has mode +// O_RDWR. +// If there is an error, it will be of type *PathError. +func CreateSequential(name string) (*os.File, error) { + return os.Create(name) +} + +// OpenSequential opens the named file for reading. If successful, methods on +// the returned file can be used for reading; the associated file +// descriptor has mode O_RDONLY. +// If there is an error, it will be of type *PathError. +func OpenSequential(name string) (*os.File, error) { + return os.Open(name) +} + +// OpenFileSequential is the generalized open call; most users will use Open +// or Create instead. It opens the named file with specified flag +// (O_RDONLY etc.) and perm, (0666 etc.) if applicable. If successful, +// methods on the returned File can be used for I/O. +// If there is an error, it will be of type *PathError. +func OpenFileSequential(name string, flag int, perm os.FileMode) (*os.File, error) { + return os.OpenFile(name, flag, perm) +} + +// TempFileSequential creates a new temporary file in the directory dir +// with a name beginning with prefix, opens the file for reading +// and writing, and returns the resulting *os.File. +// If dir is the empty string, TempFile uses the default directory +// for temporary files (see os.TempDir). +// Multiple programs calling TempFile simultaneously +// will not choose the same file. The caller can use f.Name() +// to find the pathname of the file. It is the caller's responsibility +// to remove the file when no longer needed. +func TempFileSequential(dir, prefix string) (f *os.File, err error) { + return ioutil.TempFile(dir, prefix) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/filesys_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/filesys_windows.go new file mode 100644 index 000000000..3049ff38a --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/filesys_windows.go @@ -0,0 +1,294 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "os" + "path/filepath" + "regexp" + "strconv" + "strings" + "sync" + "syscall" + "time" + "unsafe" + + winio "github.com/Microsoft/go-winio" + "golang.org/x/sys/windows" +) + +const ( + // SddlAdministratorsLocalSystem is local administrators plus NT AUTHORITY\System + SddlAdministratorsLocalSystem = "D:P(A;OICI;GA;;;BA)(A;OICI;GA;;;SY)" +) + +// MkdirAllWithACL is a wrapper for MkdirAll that creates a directory +// with an appropriate SDDL defined ACL. +func MkdirAllWithACL(path string, perm os.FileMode, sddl string) error { + return mkdirall(path, true, sddl) +} + +// MkdirAll implementation that is volume path aware for Windows. +func MkdirAll(path string, _ os.FileMode, sddl string) error { + return mkdirall(path, false, sddl) +} + +// mkdirall is a custom version of os.MkdirAll modified for use on Windows +// so that it is both volume path aware, and can create a directory with +// a DACL. +func mkdirall(path string, applyACL bool, sddl string) error { + if re := regexp.MustCompile(`^\\\\\?\\Volume{[a-z0-9-]+}$`); re.MatchString(path) { + return nil + } + + // The rest of this method is largely copied from os.MkdirAll and should be kept + // as-is to ensure compatibility. + + // Fast path: if we can tell whether path is a directory or file, stop with success or error. + dir, err := os.Stat(path) + if err == nil { + if dir.IsDir() { + return nil + } + return &os.PathError{ + Op: "mkdir", + Path: path, + Err: syscall.ENOTDIR, + } + } + + // Slow path: make sure parent exists and then call Mkdir for path. + i := len(path) + for i > 0 && os.IsPathSeparator(path[i-1]) { // Skip trailing path separator. + i-- + } + + j := i + for j > 0 && !os.IsPathSeparator(path[j-1]) { // Scan backward over element. + j-- + } + + if j > 1 { + // Create parent + err = mkdirall(path[0:j-1], false, sddl) + if err != nil { + return err + } + } + + // Parent now exists; invoke os.Mkdir or mkdirWithACL and use its result. + if applyACL { + err = mkdirWithACL(path, sddl) + } else { + err = os.Mkdir(path, 0) + } + + if err != nil { + // Handle arguments like "foo/." by + // double-checking that directory doesn't exist. + dir, err1 := os.Lstat(path) + if err1 == nil && dir.IsDir() { + return nil + } + return err + } + return nil +} + +// mkdirWithACL creates a new directory. If there is an error, it will be of +// type *PathError. . +// +// This is a modified and combined version of os.Mkdir and windows.Mkdir +// in golang to cater for creating a directory am ACL permitting full +// access, with inheritance, to any subfolder/file for Built-in Administrators +// and Local System. +func mkdirWithACL(name string, sddl string) error { + sa := windows.SecurityAttributes{Length: 0} + sd, err := winio.SddlToSecurityDescriptor(sddl) + if err != nil { + return &os.PathError{Op: "mkdir", Path: name, Err: err} + } + sa.Length = uint32(unsafe.Sizeof(sa)) + sa.InheritHandle = 1 + sa.SecurityDescriptor = uintptr(unsafe.Pointer(&sd[0])) + + namep, err := windows.UTF16PtrFromString(name) + if err != nil { + return &os.PathError{Op: "mkdir", Path: name, Err: err} + } + + e := windows.CreateDirectory(namep, &sa) + if e != nil { + return &os.PathError{Op: "mkdir", Path: name, Err: e} + } + return nil +} + +// IsAbs is a platform-specific wrapper for filepath.IsAbs. On Windows, +// golang filepath.IsAbs does not consider a path \windows\system32 as absolute +// as it doesn't start with a drive-letter/colon combination. However, in +// docker we need to verify things such as WORKDIR /windows/system32 in +// a Dockerfile (which gets translated to \windows\system32 when being processed +// by the daemon. This SHOULD be treated as absolute from a docker processing +// perspective. +func IsAbs(path string) bool { + if !filepath.IsAbs(path) { + if !strings.HasPrefix(path, string(os.PathSeparator)) { + return false + } + } + return true +} + +// The origin of the functions below here are the golang OS and windows packages, +// slightly modified to only cope with files, not directories due to the +// specific use case. +// +// The alteration is to allow a file on Windows to be opened with +// FILE_FLAG_SEQUENTIAL_SCAN (particular for docker load), to avoid eating +// the standby list, particularly when accessing large files such as layer.tar. + +// CreateSequential creates the named file with mode 0666 (before umask), truncating +// it if it already exists. If successful, methods on the returned +// File can be used for I/O; the associated file descriptor has mode +// O_RDWR. +// If there is an error, it will be of type *PathError. +func CreateSequential(name string) (*os.File, error) { + return OpenFileSequential(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0) +} + +// OpenSequential opens the named file for reading. If successful, methods on +// the returned file can be used for reading; the associated file +// descriptor has mode O_RDONLY. +// If there is an error, it will be of type *PathError. +func OpenSequential(name string) (*os.File, error) { + return OpenFileSequential(name, os.O_RDONLY, 0) +} + +// OpenFileSequential is the generalized open call; most users will use Open +// or Create instead. +// If there is an error, it will be of type *PathError. +func OpenFileSequential(name string, flag int, _ os.FileMode) (*os.File, error) { + if name == "" { + return nil, &os.PathError{Op: "open", Path: name, Err: syscall.ENOENT} + } + r, errf := windowsOpenFileSequential(name, flag, 0) + if errf == nil { + return r, nil + } + return nil, &os.PathError{Op: "open", Path: name, Err: errf} +} + +func windowsOpenFileSequential(name string, flag int, _ os.FileMode) (file *os.File, err error) { + r, e := windowsOpenSequential(name, flag|windows.O_CLOEXEC, 0) + if e != nil { + return nil, e + } + return os.NewFile(uintptr(r), name), nil +} + +func makeInheritSa() *windows.SecurityAttributes { + var sa windows.SecurityAttributes + sa.Length = uint32(unsafe.Sizeof(sa)) + sa.InheritHandle = 1 + return &sa +} + +func windowsOpenSequential(path string, mode int, _ uint32) (fd windows.Handle, err error) { + if len(path) == 0 { + return windows.InvalidHandle, windows.ERROR_FILE_NOT_FOUND + } + pathp, err := windows.UTF16PtrFromString(path) + if err != nil { + return windows.InvalidHandle, err + } + var access uint32 + switch mode & (windows.O_RDONLY | windows.O_WRONLY | windows.O_RDWR) { + case windows.O_RDONLY: + access = windows.GENERIC_READ + case windows.O_WRONLY: + access = windows.GENERIC_WRITE + case windows.O_RDWR: + access = windows.GENERIC_READ | windows.GENERIC_WRITE + } + if mode&windows.O_CREAT != 0 { + access |= windows.GENERIC_WRITE + } + if mode&windows.O_APPEND != 0 { + access &^= windows.GENERIC_WRITE + access |= windows.FILE_APPEND_DATA + } + sharemode := uint32(windows.FILE_SHARE_READ | windows.FILE_SHARE_WRITE) + var sa *windows.SecurityAttributes + if mode&windows.O_CLOEXEC == 0 { + sa = makeInheritSa() + } + var createmode uint32 + switch { + case mode&(windows.O_CREAT|windows.O_EXCL) == (windows.O_CREAT | windows.O_EXCL): + createmode = windows.CREATE_NEW + case mode&(windows.O_CREAT|windows.O_TRUNC) == (windows.O_CREAT | windows.O_TRUNC): + createmode = windows.CREATE_ALWAYS + case mode&windows.O_CREAT == windows.O_CREAT: + createmode = windows.OPEN_ALWAYS + case mode&windows.O_TRUNC == windows.O_TRUNC: + createmode = windows.TRUNCATE_EXISTING + default: + createmode = windows.OPEN_EXISTING + } + // Use FILE_FLAG_SEQUENTIAL_SCAN rather than FILE_ATTRIBUTE_NORMAL as implemented in golang. + //https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx + const fileFlagSequentialScan = 0x08000000 // FILE_FLAG_SEQUENTIAL_SCAN + h, e := windows.CreateFile(pathp, access, sharemode, sa, createmode, fileFlagSequentialScan, 0) + return h, e +} + +// Helpers for TempFileSequential +var rand uint32 +var randmu sync.Mutex + +func reseed() uint32 { + return uint32(time.Now().UnixNano() + int64(os.Getpid())) +} +func nextSuffix() string { + randmu.Lock() + r := rand + if r == 0 { + r = reseed() + } + r = r*1664525 + 1013904223 // constants from Numerical Recipes + rand = r + randmu.Unlock() + return strconv.Itoa(int(1e9 + r%1e9))[1:] +} + +// TempFileSequential is a copy of ioutil.TempFile, modified to use sequential +// file access. Below is the original comment from golang: +// TempFile creates a new temporary file in the directory dir +// with a name beginning with prefix, opens the file for reading +// and writing, and returns the resulting *os.File. +// If dir is the empty string, TempFile uses the default directory +// for temporary files (see os.TempDir). +// Multiple programs calling TempFile simultaneously +// will not choose the same file. The caller can use f.Name() +// to find the pathname of the file. It is the caller's responsibility +// to remove the file when no longer needed. +func TempFileSequential(dir, prefix string) (f *os.File, err error) { + if dir == "" { + dir = os.TempDir() + } + + nconflict := 0 + for i := 0; i < 10000; i++ { + name := filepath.Join(dir, prefix+nextSuffix()) + f, err = OpenFileSequential(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600) + if os.IsExist(err) { + if nconflict++; nconflict > 10 { + randmu.Lock() + rand = reseed() + randmu.Unlock() + } + continue + } + break + } + return +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/init.go b/integration-test/vendor/github.com/docker/docker/pkg/system/init.go new file mode 100644 index 000000000..a17597aab --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/init.go @@ -0,0 +1,22 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "syscall" + "time" + "unsafe" +) + +// Used by chtimes +var maxTime time.Time + +func init() { + // chtimes initialization + if unsafe.Sizeof(syscall.Timespec{}.Nsec) == 8 { + // This is a 64 bit timespec + // os.Chtimes limits time to the following + maxTime = time.Unix(0, 1<<63-1) + } else { + // This is a 32 bit timespec + maxTime = time.Unix(1<<31-1, 0) + } +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/init_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/system/init_unix.go new file mode 100644 index 000000000..c2bb0f4cc --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/init_unix.go @@ -0,0 +1,12 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +// InitLCOW does nothing since LCOW is a windows only feature +func InitLCOW(experimental bool) { +} + +// ContainerdRuntimeSupported returns true if the use of ContainerD runtime is supported. +func ContainerdRuntimeSupported(_ bool, _ string) bool { + return true +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/init_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/init_windows.go new file mode 100644 index 000000000..f303aa906 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/init_windows.go @@ -0,0 +1,41 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "os" + + "github.com/Microsoft/hcsshim/osversion" + "github.com/sirupsen/logrus" +) + +var ( + // lcowSupported determines if Linux Containers on Windows are supported. + lcowSupported = false + + // containerdRuntimeSupported determines if ContainerD should be the runtime. + // As of March 2019, this is an experimental feature. + containerdRuntimeSupported = false +) + +// InitLCOW sets whether LCOW is supported or not. Requires RS5+ +func InitLCOW(experimental bool) { + v := GetOSVersion() + if experimental && v.Build >= osversion.RS5 { + lcowSupported = true + } +} + +// InitContainerdRuntime sets whether to use ContainerD for runtime +// on Windows. This is an experimental feature still in development, and +// also requires an environment variable to be set (so as not to turn the +// feature on from simply experimental which would also mean LCOW. +func InitContainerdRuntime(experimental bool, cdPath string) { + if experimental && len(cdPath) > 0 && len(os.Getenv("DOCKER_WINDOWS_CONTAINERD_RUNTIME")) > 0 { + logrus.Warnf("Using ContainerD runtime. This feature is experimental") + containerdRuntimeSupported = true + } +} + +// ContainerdRuntimeSupported returns true if the use of ContainerD runtime is supported. +func ContainerdRuntimeSupported() bool { + return containerdRuntimeSupported +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/lcow.go b/integration-test/vendor/github.com/docker/docker/pkg/system/lcow.go new file mode 100644 index 000000000..5be3e2182 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/lcow.go @@ -0,0 +1,32 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "runtime" + "strings" + + specs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +// IsOSSupported determines if an operating system is supported by the host +func IsOSSupported(os string) bool { + if strings.EqualFold(runtime.GOOS, os) { + return true + } + if LCOWSupported() && strings.EqualFold(os, "linux") { + return true + } + return false +} + +// ValidatePlatform determines if a platform structure is valid. +// TODO This is a temporary windows-only function, should be replaced by +// comparison of worker capabilities +func ValidatePlatform(platform specs.Platform) error { + if runtime.GOOS == "windows" { + if !(platform.OS == runtime.GOOS || (LCOWSupported() && platform.OS == "linux")) { + return errors.Errorf("unsupported os %s", platform.OS) + } + } + return nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/lcow_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/system/lcow_unix.go new file mode 100644 index 000000000..26397fb8a --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/lcow_unix.go @@ -0,0 +1,8 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +// LCOWSupported returns true if Linux containers on Windows are supported. +func LCOWSupported() bool { + return false +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/lcow_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/lcow_windows.go new file mode 100644 index 000000000..f0139df8f --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/lcow_windows.go @@ -0,0 +1,6 @@ +package system // import "github.com/docker/docker/pkg/system" + +// LCOWSupported returns true if Linux containers on Windows are supported. +func LCOWSupported() bool { + return lcowSupported +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/lstat_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/system/lstat_unix.go new file mode 100644 index 000000000..de5a1c0fb --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/lstat_unix.go @@ -0,0 +1,20 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +import ( + "os" + "syscall" +) + +// Lstat takes a path to a file and returns +// a system.StatT type pertaining to that file. +// +// Throws an error if the file does not exist +func Lstat(path string) (*StatT, error) { + s := &syscall.Stat_t{} + if err := syscall.Lstat(path, s); err != nil { + return nil, &os.PathError{Op: "Lstat", Path: path, Err: err} + } + return fromStatT(s) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/lstat_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/lstat_windows.go new file mode 100644 index 000000000..359c791d9 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/lstat_windows.go @@ -0,0 +1,14 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "os" + +// Lstat calls os.Lstat to get a fileinfo interface back. +// This is then copied into our own locally defined structure. +func Lstat(path string) (*StatT, error) { + fi, err := os.Lstat(path) + if err != nil { + return nil, err + } + + return fromStatT(&fi) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo.go b/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo.go new file mode 100644 index 000000000..6667eb84d --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo.go @@ -0,0 +1,17 @@ +package system // import "github.com/docker/docker/pkg/system" + +// MemInfo contains memory statistics of the host system. +type MemInfo struct { + // Total usable RAM (i.e. physical RAM minus a few reserved bits and the + // kernel binary code). + MemTotal int64 + + // Amount of free memory. + MemFree int64 + + // Total amount of swap space available. + SwapTotal int64 + + // Amount of swap space that is currently unused. + SwapFree int64 +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_linux.go new file mode 100644 index 000000000..d79e8b076 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_linux.go @@ -0,0 +1,65 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "bufio" + "io" + "os" + "strconv" + "strings" + + "github.com/docker/go-units" +) + +// ReadMemInfo retrieves memory statistics of the host system and returns a +// MemInfo type. +func ReadMemInfo() (*MemInfo, error) { + file, err := os.Open("/proc/meminfo") + if err != nil { + return nil, err + } + defer file.Close() + return parseMemInfo(file) +} + +// parseMemInfo parses the /proc/meminfo file into +// a MemInfo object given an io.Reader to the file. +// Throws error if there are problems reading from the file +func parseMemInfo(reader io.Reader) (*MemInfo, error) { + meminfo := &MemInfo{} + scanner := bufio.NewScanner(reader) + for scanner.Scan() { + // Expected format: ["MemTotal:", "1234", "kB"] + parts := strings.Fields(scanner.Text()) + + // Sanity checks: Skip malformed entries. + if len(parts) < 3 || parts[2] != "kB" { + continue + } + + // Convert to bytes. + size, err := strconv.Atoi(parts[1]) + if err != nil { + continue + } + bytes := int64(size) * units.KiB + + switch parts[0] { + case "MemTotal:": + meminfo.MemTotal = bytes + case "MemFree:": + meminfo.MemFree = bytes + case "SwapTotal:": + meminfo.SwapTotal = bytes + case "SwapFree:": + meminfo.SwapFree = bytes + } + + } + + // Handle errors that may have occurred during the reading of the file. + if err := scanner.Err(); err != nil { + return nil, err + } + + return meminfo, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_unsupported.go b/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_unsupported.go new file mode 100644 index 000000000..56f449426 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_unsupported.go @@ -0,0 +1,8 @@ +// +build !linux,!windows + +package system // import "github.com/docker/docker/pkg/system" + +// ReadMemInfo is not supported on platforms other than linux and windows. +func ReadMemInfo() (*MemInfo, error) { + return nil, ErrNotSupportedPlatform +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_windows.go new file mode 100644 index 000000000..6ed93f2fe --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/meminfo_windows.go @@ -0,0 +1,45 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "unsafe" + + "golang.org/x/sys/windows" +) + +var ( + modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + + procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx") +) + +// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx +// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx +type memorystatusex struct { + dwLength uint32 + dwMemoryLoad uint32 + ullTotalPhys uint64 + ullAvailPhys uint64 + ullTotalPageFile uint64 + ullAvailPageFile uint64 + ullTotalVirtual uint64 + ullAvailVirtual uint64 + ullAvailExtendedVirtual uint64 +} + +// ReadMemInfo retrieves memory statistics of the host system and returns a +// MemInfo type. +func ReadMemInfo() (*MemInfo, error) { + msi := &memorystatusex{ + dwLength: 64, + } + r1, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(msi))) + if r1 == 0 { + return &MemInfo{}, nil + } + return &MemInfo{ + MemTotal: int64(msi.ullTotalPhys), + MemFree: int64(msi.ullAvailPhys), + SwapTotal: int64(msi.ullTotalPageFile), + SwapFree: int64(msi.ullAvailPageFile), + }, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/mknod.go b/integration-test/vendor/github.com/docker/docker/pkg/system/mknod.go new file mode 100644 index 000000000..b132482e0 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/mknod.go @@ -0,0 +1,22 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +import ( + "golang.org/x/sys/unix" +) + +// Mknod creates a filesystem node (file, device special file or named pipe) named path +// with attributes specified by mode and dev. +func Mknod(path string, mode uint32, dev int) error { + return unix.Mknod(path, mode, dev) +} + +// Mkdev is used to build the value of linux devices (in /dev/) which specifies major +// and minor number of the newly created device special file. +// Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes. +// They are, from low to high: the lower 8 bits of the minor, then 12 bits of the major, +// then the top 12 bits of the minor. +func Mkdev(major int64, minor int64) uint32 { + return uint32(unix.Mkdev(uint32(major), uint32(minor))) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/mknod_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/mknod_windows.go new file mode 100644 index 000000000..ec89d7a15 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/mknod_windows.go @@ -0,0 +1,11 @@ +package system // import "github.com/docker/docker/pkg/system" + +// Mknod is not implemented on Windows. +func Mknod(path string, mode uint32, dev int) error { + return ErrNotSupportedPlatform +} + +// Mkdev is not implemented on Windows. +func Mkdev(major int64, minor int64) uint32 { + panic("Mkdev not implemented on Windows.") +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/path.go b/integration-test/vendor/github.com/docker/docker/pkg/system/path.go new file mode 100644 index 000000000..a3d957afa --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/path.go @@ -0,0 +1,60 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "fmt" + "path/filepath" + "runtime" + "strings" + + "github.com/containerd/continuity/pathdriver" +) + +const defaultUnixPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +// DefaultPathEnv is unix style list of directories to search for +// executables. Each directory is separated from the next by a colon +// ':' character . +func DefaultPathEnv(os string) string { + if runtime.GOOS == "windows" { + if os != runtime.GOOS { + return defaultUnixPathEnv + } + // Deliberately empty on Windows containers on Windows as the default path will be set by + // the container. Docker has no context of what the default path should be. + return "" + } + return defaultUnixPathEnv + +} + +// CheckSystemDriveAndRemoveDriveLetter verifies that a path, if it includes a drive letter, +// is the system drive. +// On Linux: this is a no-op. +// On Windows: this does the following> +// CheckSystemDriveAndRemoveDriveLetter verifies and manipulates a Windows path. +// This is used, for example, when validating a user provided path in docker cp. +// If a drive letter is supplied, it must be the system drive. The drive letter +// is always removed. Also, it translates it to OS semantics (IOW / to \). We +// need the path in this syntax so that it can ultimately be concatenated with +// a Windows long-path which doesn't support drive-letters. Examples: +// C: --> Fail +// C:\ --> \ +// a --> a +// /a --> \a +// d:\ --> Fail +func CheckSystemDriveAndRemoveDriveLetter(path string, driver pathdriver.PathDriver) (string, error) { + if runtime.GOOS != "windows" || LCOWSupported() { + return path, nil + } + + if len(path) == 2 && string(path[1]) == ":" { + return "", fmt.Errorf("No relative path specified in %q", path) + } + if !driver.IsAbs(path) || len(path) < 2 { + return filepath.FromSlash(path), nil + } + if string(path[1]) == ":" && !strings.EqualFold(string(path[0]), "c") { + return "", fmt.Errorf("The specified path is not on the system drive (C:)") + } + return filepath.FromSlash(path[2:]), nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/path_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/system/path_unix.go new file mode 100644 index 000000000..b0b93196a --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/path_unix.go @@ -0,0 +1,10 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +// GetLongPathName converts Windows short pathnames to full pathnames. +// For example C:\Users\ADMIN~1 --> C:\Users\Administrator. +// It is a no-op on non-Windows platforms +func GetLongPathName(path string) (string, error) { + return path, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/path_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/path_windows.go new file mode 100644 index 000000000..188f2c295 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/path_windows.go @@ -0,0 +1,24 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "syscall" + +// GetLongPathName converts Windows short pathnames to full pathnames. +// For example C:\Users\ADMIN~1 --> C:\Users\Administrator. +// It is a no-op on non-Windows platforms +func GetLongPathName(path string) (string, error) { + // See https://groups.google.com/forum/#!topic/golang-dev/1tufzkruoTg + p := syscall.StringToUTF16(path) + b := p // GetLongPathName says we can reuse buffer + n, err := syscall.GetLongPathName(&p[0], &b[0], uint32(len(b))) + if err != nil { + return "", err + } + if n > uint32(len(b)) { + b = make([]uint16, n) + _, err = syscall.GetLongPathName(&p[0], &b[0], uint32(len(b))) + if err != nil { + return "", err + } + } + return syscall.UTF16ToString(b), nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/process_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/system/process_unix.go new file mode 100644 index 000000000..0195a891b --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/process_unix.go @@ -0,0 +1,24 @@ +// +build linux freebsd darwin + +package system // import "github.com/docker/docker/pkg/system" + +import ( + "syscall" + + "golang.org/x/sys/unix" +) + +// IsProcessAlive returns true if process with a given pid is running. +func IsProcessAlive(pid int) bool { + err := unix.Kill(pid, syscall.Signal(0)) + if err == nil || err == unix.EPERM { + return true + } + + return false +} + +// KillProcess force-stops a process. +func KillProcess(pid int) { + unix.Kill(pid, unix.SIGKILL) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/process_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/process_windows.go new file mode 100644 index 000000000..4e70c97b1 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/process_windows.go @@ -0,0 +1,18 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "os" + +// IsProcessAlive returns true if process with a given pid is running. +func IsProcessAlive(pid int) bool { + _, err := os.FindProcess(pid) + + return err == nil +} + +// KillProcess force-stops a process. +func KillProcess(pid int) { + p, err := os.FindProcess(pid) + if err == nil { + p.Kill() + } +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/rm.go b/integration-test/vendor/github.com/docker/docker/pkg/system/rm.go new file mode 100644 index 000000000..b31099180 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/rm.go @@ -0,0 +1,80 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "os" + "syscall" + "time" + + "github.com/docker/docker/pkg/mount" + "github.com/pkg/errors" +) + +// EnsureRemoveAll wraps `os.RemoveAll` to check for specific errors that can +// often be remedied. +// Only use `EnsureRemoveAll` if you really want to make every effort to remove +// a directory. +// +// Because of the way `os.Remove` (and by extension `os.RemoveAll`) works, there +// can be a race between reading directory entries and then actually attempting +// to remove everything in the directory. +// These types of errors do not need to be returned since it's ok for the dir to +// be gone we can just retry the remove operation. +// +// This should not return a `os.ErrNotExist` kind of error under any circumstances +func EnsureRemoveAll(dir string) error { + notExistErr := make(map[string]bool) + + // track retries + exitOnErr := make(map[string]int) + maxRetry := 50 + + // Attempt to unmount anything beneath this dir first + mount.RecursiveUnmount(dir) + + for { + err := os.RemoveAll(dir) + if err == nil { + return nil + } + + pe, ok := err.(*os.PathError) + if !ok { + return err + } + + if os.IsNotExist(err) { + if notExistErr[pe.Path] { + return err + } + notExistErr[pe.Path] = true + + // There is a race where some subdir can be removed but after the parent + // dir entries have been read. + // So the path could be from `os.Remove(subdir)` + // If the reported non-existent path is not the passed in `dir` we + // should just retry, but otherwise return with no error. + if pe.Path == dir { + return nil + } + continue + } + + if pe.Err != syscall.EBUSY { + return err + } + + if mounted, _ := mount.Mounted(pe.Path); mounted { + if e := mount.Unmount(pe.Path); e != nil { + if mounted, _ := mount.Mounted(pe.Path); mounted { + return errors.Wrapf(e, "error while removing %s", dir) + } + } + } + + if exitOnErr[pe.Path] == maxRetry { + return err + } + exitOnErr[pe.Path]++ + time.Sleep(100 * time.Millisecond) + } +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/stat_darwin.go b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_darwin.go new file mode 100644 index 000000000..c1c0ee9f3 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_darwin.go @@ -0,0 +1,13 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "syscall" + +// fromStatT converts a syscall.Stat_t type to a system.Stat_t type +func fromStatT(s *syscall.Stat_t) (*StatT, error) { + return &StatT{size: s.Size, + mode: uint32(s.Mode), + uid: s.Uid, + gid: s.Gid, + rdev: uint64(s.Rdev), + mtim: s.Mtimespec}, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/stat_freebsd.go b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_freebsd.go new file mode 100644 index 000000000..c1c0ee9f3 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_freebsd.go @@ -0,0 +1,13 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "syscall" + +// fromStatT converts a syscall.Stat_t type to a system.Stat_t type +func fromStatT(s *syscall.Stat_t) (*StatT, error) { + return &StatT{size: s.Size, + mode: uint32(s.Mode), + uid: s.Uid, + gid: s.Gid, + rdev: uint64(s.Rdev), + mtim: s.Mtimespec}, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/stat_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_linux.go new file mode 100644 index 000000000..17d5d131a --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_linux.go @@ -0,0 +1,20 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "syscall" + +// fromStatT converts a syscall.Stat_t type to a system.Stat_t type +func fromStatT(s *syscall.Stat_t) (*StatT, error) { + return &StatT{size: s.Size, + mode: s.Mode, + uid: s.Uid, + gid: s.Gid, + // the type is 32bit on mips + rdev: uint64(s.Rdev), // nolint: unconvert + mtim: s.Mtim}, nil +} + +// FromStatT converts a syscall.Stat_t type to a system.Stat_t type +// This is exposed on Linux as pkg/archive/changes uses it. +func FromStatT(s *syscall.Stat_t) (*StatT, error) { + return fromStatT(s) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go new file mode 100644 index 000000000..756b92d1e --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go @@ -0,0 +1,13 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "syscall" + +// fromStatT converts a syscall.Stat_t type to a system.Stat_t type +func fromStatT(s *syscall.Stat_t) (*StatT, error) { + return &StatT{size: s.Size, + mode: uint32(s.Mode), + uid: s.Uid, + gid: s.Gid, + rdev: uint64(s.Rdev), + mtim: s.Mtim}, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/stat_solaris.go b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_solaris.go new file mode 100644 index 000000000..756b92d1e --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_solaris.go @@ -0,0 +1,13 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "syscall" + +// fromStatT converts a syscall.Stat_t type to a system.Stat_t type +func fromStatT(s *syscall.Stat_t) (*StatT, error) { + return &StatT{size: s.Size, + mode: uint32(s.Mode), + uid: s.Uid, + gid: s.Gid, + rdev: uint64(s.Rdev), + mtim: s.Mtim}, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/stat_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_unix.go new file mode 100644 index 000000000..86bb6dd55 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_unix.go @@ -0,0 +1,66 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +import ( + "os" + "syscall" +) + +// StatT type contains status of a file. It contains metadata +// like permission, owner, group, size, etc about a file. +type StatT struct { + mode uint32 + uid uint32 + gid uint32 + rdev uint64 + size int64 + mtim syscall.Timespec +} + +// Mode returns file's permission mode. +func (s StatT) Mode() uint32 { + return s.mode +} + +// UID returns file's user id of owner. +func (s StatT) UID() uint32 { + return s.uid +} + +// GID returns file's group id of owner. +func (s StatT) GID() uint32 { + return s.gid +} + +// Rdev returns file's device ID (if it's special file). +func (s StatT) Rdev() uint64 { + return s.rdev +} + +// Size returns file's size. +func (s StatT) Size() int64 { + return s.size +} + +// Mtim returns file's last modification time. +func (s StatT) Mtim() syscall.Timespec { + return s.mtim +} + +// IsDir reports whether s describes a directory. +func (s StatT) IsDir() bool { + return s.mode&syscall.S_IFDIR != 0 +} + +// Stat takes a path to a file and returns +// a system.StatT type pertaining to that file. +// +// Throws an error if the file does not exist +func Stat(path string) (*StatT, error) { + s := &syscall.Stat_t{} + if err := syscall.Stat(path, s); err != nil { + return nil, &os.PathError{Op: "Stat", Path: path, Err: err} + } + return fromStatT(s) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/stat_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_windows.go new file mode 100644 index 000000000..b2456cb88 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/stat_windows.go @@ -0,0 +1,49 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "os" + "time" +) + +// StatT type contains status of a file. It contains metadata +// like permission, size, etc about a file. +type StatT struct { + mode os.FileMode + size int64 + mtim time.Time +} + +// Size returns file's size. +func (s StatT) Size() int64 { + return s.size +} + +// Mode returns file's permission mode. +func (s StatT) Mode() os.FileMode { + return os.FileMode(s.mode) +} + +// Mtim returns file's last modification time. +func (s StatT) Mtim() time.Time { + return time.Time(s.mtim) +} + +// Stat takes a path to a file and returns +// a system.StatT type pertaining to that file. +// +// Throws an error if the file does not exist +func Stat(path string) (*StatT, error) { + fi, err := os.Stat(path) + if err != nil { + return nil, err + } + return fromStatT(&fi) +} + +// fromStatT converts a os.FileInfo type to a system.StatT type +func fromStatT(fi *os.FileInfo) (*StatT, error) { + return &StatT{ + size: (*fi).Size(), + mode: (*fi).Mode(), + mtim: (*fi).ModTime()}, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/syscall_unix.go b/integration-test/vendor/github.com/docker/docker/pkg/system/syscall_unix.go new file mode 100644 index 000000000..919a412a7 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/syscall_unix.go @@ -0,0 +1,17 @@ +// +build linux freebsd + +package system // import "github.com/docker/docker/pkg/system" + +import "golang.org/x/sys/unix" + +// Unmount is a platform-specific helper function to call +// the unmount syscall. +func Unmount(dest string) error { + return unix.Unmount(dest, 0) +} + +// CommandLineToArgv should not be used on Unix. +// It simply returns commandLine in the only element in the returned array. +func CommandLineToArgv(commandLine string) ([]string, error) { + return []string{commandLine}, nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/syscall_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/syscall_windows.go new file mode 100644 index 000000000..4ae92fa6c --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/syscall_windows.go @@ -0,0 +1,193 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "fmt" + "syscall" + "unsafe" + + "github.com/sirupsen/logrus" + "golang.org/x/sys/windows" +) + +const ( + OWNER_SECURITY_INFORMATION = 0x00000001 + GROUP_SECURITY_INFORMATION = 0x00000002 + DACL_SECURITY_INFORMATION = 0x00000004 + SACL_SECURITY_INFORMATION = 0x00000008 + LABEL_SECURITY_INFORMATION = 0x00000010 + ATTRIBUTE_SECURITY_INFORMATION = 0x00000020 + SCOPE_SECURITY_INFORMATION = 0x00000040 + PROCESS_TRUST_LABEL_SECURITY_INFORMATION = 0x00000080 + ACCESS_FILTER_SECURITY_INFORMATION = 0x00000100 + BACKUP_SECURITY_INFORMATION = 0x00010000 + PROTECTED_DACL_SECURITY_INFORMATION = 0x80000000 + PROTECTED_SACL_SECURITY_INFORMATION = 0x40000000 + UNPROTECTED_DACL_SECURITY_INFORMATION = 0x20000000 + UNPROTECTED_SACL_SECURITY_INFORMATION = 0x10000000 +) + +const ( + SE_UNKNOWN_OBJECT_TYPE = iota + SE_FILE_OBJECT + SE_SERVICE + SE_PRINTER + SE_REGISTRY_KEY + SE_LMSHARE + SE_KERNEL_OBJECT + SE_WINDOW_OBJECT + SE_DS_OBJECT + SE_DS_OBJECT_ALL + SE_PROVIDER_DEFINED_OBJECT + SE_WMIGUID_OBJECT + SE_REGISTRY_WOW64_32KEY +) + +const ( + SeTakeOwnershipPrivilege = "SeTakeOwnershipPrivilege" +) + +const ( + ContainerAdministratorSidString = "S-1-5-93-2-1" + ContainerUserSidString = "S-1-5-93-2-2" +) + +var ( + ntuserApiset = windows.NewLazyDLL("ext-ms-win-ntuser-window-l1-1-0") + modadvapi32 = windows.NewLazySystemDLL("advapi32.dll") + procGetVersionExW = modkernel32.NewProc("GetVersionExW") + procGetProductInfo = modkernel32.NewProc("GetProductInfo") + procSetNamedSecurityInfo = modadvapi32.NewProc("SetNamedSecurityInfoW") + procGetSecurityDescriptorDacl = modadvapi32.NewProc("GetSecurityDescriptorDacl") +) + +// OSVersion is a wrapper for Windows version information +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx +type OSVersion struct { + Version uint32 + MajorVersion uint8 + MinorVersion uint8 + Build uint16 +} + +// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833(v=vs.85).aspx +type osVersionInfoEx struct { + OSVersionInfoSize uint32 + MajorVersion uint32 + MinorVersion uint32 + BuildNumber uint32 + PlatformID uint32 + CSDVersion [128]uint16 + ServicePackMajor uint16 + ServicePackMinor uint16 + SuiteMask uint16 + ProductType byte + Reserve byte +} + +// GetOSVersion gets the operating system version on Windows. Note that +// docker.exe must be manifested to get the correct version information. +func GetOSVersion() OSVersion { + var err error + osv := OSVersion{} + osv.Version, err = windows.GetVersion() + if err != nil { + // GetVersion never fails. + panic(err) + } + osv.MajorVersion = uint8(osv.Version & 0xFF) + osv.MinorVersion = uint8(osv.Version >> 8 & 0xFF) + osv.Build = uint16(osv.Version >> 16) + return osv +} + +func (osv OSVersion) ToString() string { + return fmt.Sprintf("%d.%d.%d", osv.MajorVersion, osv.MinorVersion, osv.Build) +} + +// IsWindowsClient returns true if the SKU is client +// @engine maintainers - this function should not be removed or modified as it +// is used to enforce licensing restrictions on Windows. +func IsWindowsClient() bool { + osviex := &osVersionInfoEx{OSVersionInfoSize: 284} + r1, _, err := procGetVersionExW.Call(uintptr(unsafe.Pointer(osviex))) + if r1 == 0 { + logrus.Warnf("GetVersionExW failed - assuming server SKU: %v", err) + return false + } + const verNTWorkstation = 0x00000001 + return osviex.ProductType == verNTWorkstation +} + +// IsIoTCore returns true if the currently running image is based off of +// Windows 10 IoT Core. +// @engine maintainers - this function should not be removed or modified as it +// is used to enforce licensing restrictions on Windows. +func IsIoTCore() bool { + var returnedProductType uint32 + r1, _, err := procGetProductInfo.Call(6, 1, 0, 0, uintptr(unsafe.Pointer(&returnedProductType))) + if r1 == 0 { + logrus.Warnf("GetProductInfo failed - assuming this is not IoT: %v", err) + return false + } + const productIoTUAP = 0x0000007B + const productIoTUAPCommercial = 0x00000083 + return returnedProductType == productIoTUAP || returnedProductType == productIoTUAPCommercial +} + +// Unmount is a platform-specific helper function to call +// the unmount syscall. Not supported on Windows +func Unmount(dest string) error { + return nil +} + +// CommandLineToArgv wraps the Windows syscall to turn a commandline into an argument array. +func CommandLineToArgv(commandLine string) ([]string, error) { + var argc int32 + + argsPtr, err := windows.UTF16PtrFromString(commandLine) + if err != nil { + return nil, err + } + + argv, err := windows.CommandLineToArgv(argsPtr, &argc) + if err != nil { + return nil, err + } + defer windows.LocalFree(windows.Handle(uintptr(unsafe.Pointer(argv)))) + + newArgs := make([]string, argc) + for i, v := range (*argv)[:argc] { + newArgs[i] = string(windows.UTF16ToString((*v)[:])) + } + + return newArgs, nil +} + +// HasWin32KSupport determines whether containers that depend on win32k can +// run on this machine. Win32k is the driver used to implement windowing. +func HasWin32KSupport() bool { + // For now, check for ntuser API support on the host. In the future, a host + // may support win32k in containers even if the host does not support ntuser + // APIs. + return ntuserApiset.Load() == nil +} + +func SetNamedSecurityInfo(objectName *uint16, objectType uint32, securityInformation uint32, sidOwner *windows.SID, sidGroup *windows.SID, dacl *byte, sacl *byte) (result error) { + r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfo.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(sidOwner)), uintptr(unsafe.Pointer(sidGroup)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) + if r0 != 0 { + result = syscall.Errno(r0) + } + return +} + +func GetSecurityDescriptorDacl(securityDescriptor *byte, daclPresent *uint32, dacl **byte, daclDefaulted *uint32) (result error) { + r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(securityDescriptor)), uintptr(unsafe.Pointer(daclPresent)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclDefaulted)), 0, 0) + if r1 == 0 { + if e1 != 0 { + result = syscall.Errno(e1) + } else { + result = syscall.EINVAL + } + } + return +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/umask.go b/integration-test/vendor/github.com/docker/docker/pkg/system/umask.go new file mode 100644 index 000000000..9912a2bab --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/umask.go @@ -0,0 +1,13 @@ +// +build !windows + +package system // import "github.com/docker/docker/pkg/system" + +import ( + "golang.org/x/sys/unix" +) + +// Umask sets current process's file mode creation mask to newmask +// and returns oldmask. +func Umask(newmask int) (oldmask int, err error) { + return unix.Umask(newmask), nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/umask_windows.go b/integration-test/vendor/github.com/docker/docker/pkg/system/umask_windows.go new file mode 100644 index 000000000..fc62388c3 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/umask_windows.go @@ -0,0 +1,7 @@ +package system // import "github.com/docker/docker/pkg/system" + +// Umask is not supported on the windows platform. +func Umask(newmask int) (oldmask int, err error) { + // should not be called on cli code path + return 0, ErrNotSupportedPlatform +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_freebsd.go b/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_freebsd.go new file mode 100644 index 000000000..ed1b9fad5 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_freebsd.go @@ -0,0 +1,24 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/unix" +) + +// LUtimesNano is used to change access and modification time of the specified path. +// It's used for symbol link file because unix.UtimesNano doesn't support a NOFOLLOW flag atm. +func LUtimesNano(path string, ts []syscall.Timespec) error { + var _path *byte + _path, err := unix.BytePtrFromString(path) + if err != nil { + return err + } + + if _, _, err := unix.Syscall(unix.SYS_LUTIMES, uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), 0); err != 0 && err != unix.ENOSYS { + return err + } + + return nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_linux.go new file mode 100644 index 000000000..0afe85458 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_linux.go @@ -0,0 +1,25 @@ +package system // import "github.com/docker/docker/pkg/system" + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/unix" +) + +// LUtimesNano is used to change access and modification time of the specified path. +// It's used for symbol link file because unix.UtimesNano doesn't support a NOFOLLOW flag atm. +func LUtimesNano(path string, ts []syscall.Timespec) error { + atFdCwd := unix.AT_FDCWD + + var _path *byte + _path, err := unix.BytePtrFromString(path) + if err != nil { + return err + } + if _, _, err := unix.Syscall6(unix.SYS_UTIMENSAT, uintptr(atFdCwd), uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), unix.AT_SYMLINK_NOFOLLOW, 0, 0); err != 0 && err != unix.ENOSYS { + return err + } + + return nil +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go b/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go new file mode 100644 index 000000000..095e072e1 --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go @@ -0,0 +1,10 @@ +// +build !linux,!freebsd + +package system // import "github.com/docker/docker/pkg/system" + +import "syscall" + +// LUtimesNano is only supported on linux and freebsd. +func LUtimesNano(path string, ts []syscall.Timespec) error { + return ErrNotSupportedPlatform +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/xattrs_linux.go b/integration-test/vendor/github.com/docker/docker/pkg/system/xattrs_linux.go new file mode 100644 index 000000000..d4f1a57fb --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/xattrs_linux.go @@ -0,0 +1,38 @@ +package system // import "github.com/docker/docker/pkg/system" + +import "golang.org/x/sys/unix" + +// Lgetxattr retrieves the value of the extended attribute identified by attr +// and associated with the given path in the file system. +// It will returns a nil slice and nil error if the xattr is not set. +func Lgetxattr(path string, attr string) ([]byte, error) { + // Start with a 128 length byte array + dest := make([]byte, 128) + sz, errno := unix.Lgetxattr(path, attr, dest) + + switch { + case errno == unix.ENODATA: + return nil, nil + case errno == unix.ERANGE: + // 128 byte array might just not be good enough. A dummy buffer is used + // to get the real size of the xattrs on disk + sz, errno = unix.Lgetxattr(path, attr, []byte{}) + if errno != nil { + return nil, errno + } + dest = make([]byte, sz) + sz, errno = unix.Lgetxattr(path, attr, dest) + if errno != nil { + return nil, errno + } + case errno != nil: + return nil, errno + } + return dest[:sz], nil +} + +// Lsetxattr sets the value of the extended attribute identified by attr +// and associated with the given path in the file system. +func Lsetxattr(path string, attr string, data []byte, flags int) error { + return unix.Lsetxattr(path, attr, data, flags) +} diff --git a/integration-test/vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go b/integration-test/vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go new file mode 100644 index 000000000..d780a90cd --- /dev/null +++ b/integration-test/vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go @@ -0,0 +1,13 @@ +// +build !linux + +package system // import "github.com/docker/docker/pkg/system" + +// Lgetxattr is not supported on platforms other than linux. +func Lgetxattr(path string, attr string) ([]byte, error) { + return nil, ErrNotSupportedPlatform +} + +// Lsetxattr is not supported on platforms other than linux. +func Lsetxattr(path string, attr string, data []byte, flags int) error { + return ErrNotSupportedPlatform +} diff --git a/integration-test/vendor/github.com/docker/go-units/CONTRIBUTING.md b/integration-test/vendor/github.com/docker/go-units/CONTRIBUTING.md new file mode 100644 index 000000000..9ea86d784 --- /dev/null +++ b/integration-test/vendor/github.com/docker/go-units/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# Contributing to go-units + +Want to hack on go-units? Awesome! Here are instructions to get you started. + +go-units is a part of the [Docker](https://www.docker.com) project, and follows +the same rules and principles. If you're already familiar with the way +Docker does things, you'll feel right at home. + +Otherwise, go read Docker's +[contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), +[issue triaging](https://github.com/docker/docker/blob/master/project/ISSUE-TRIAGE.md), +[review process](https://github.com/docker/docker/blob/master/project/REVIEWING.md) and +[branches and tags](https://github.com/docker/docker/blob/master/project/BRANCHES-AND-TAGS.md). + +### Sign your work + +The sign-off is a simple line at the end of the explanation for the patch. Your +signature certifies that you wrote the patch or otherwise have the right to pass +it on as an open-source patch. The rules are pretty simple: if you can certify +the below (from [developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. diff --git a/integration-test/vendor/github.com/docker/go-units/LICENSE b/integration-test/vendor/github.com/docker/go-units/LICENSE new file mode 100644 index 000000000..b55b37bc3 --- /dev/null +++ b/integration-test/vendor/github.com/docker/go-units/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://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 + + Copyright 2015 Docker, 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 + + https://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. diff --git a/integration-test/vendor/github.com/docker/go-units/MAINTAINERS b/integration-test/vendor/github.com/docker/go-units/MAINTAINERS new file mode 100644 index 000000000..4aac7c741 --- /dev/null +++ b/integration-test/vendor/github.com/docker/go-units/MAINTAINERS @@ -0,0 +1,46 @@ +# go-units maintainers file +# +# This file describes who runs the docker/go-units project and how. +# This is a living document - if you see something out of date or missing, speak up! +# +# It is structured to be consumable by both humans and programs. +# To extract its contents programmatically, use any TOML-compliant parser. +# +# This file is compiled into the MAINTAINERS file in docker/opensource. +# +[Org] + [Org."Core maintainers"] + people = [ + "akihirosuda", + "dnephin", + "thajeztah", + "vdemeester", + ] + +[people] + +# A reference list of all people associated with the project. +# All other sections should refer to people by their canonical key +# in the people section. + + # ADD YOURSELF HERE IN ALPHABETICAL ORDER + + [people.akihirosuda] + Name = "Akihiro Suda" + Email = "akihiro.suda.cz@hco.ntt.co.jp" + GitHub = "AkihiroSuda" + + [people.dnephin] + Name = "Daniel Nephin" + Email = "dnephin@gmail.com" + GitHub = "dnephin" + + [people.thajeztah] + Name = "Sebastiaan van Stijn" + Email = "github@gone.nl" + GitHub = "thaJeztah" + + [people.vdemeester] + Name = "Vincent Demeester" + Email = "vincent@sbr.pm" + GitHub = "vdemeester" \ No newline at end of file diff --git a/integration-test/vendor/github.com/docker/go-units/README.md b/integration-test/vendor/github.com/docker/go-units/README.md new file mode 100644 index 000000000..4f70a4e13 --- /dev/null +++ b/integration-test/vendor/github.com/docker/go-units/README.md @@ -0,0 +1,16 @@ +[![GoDoc](https://godoc.org/github.com/docker/go-units?status.svg)](https://godoc.org/github.com/docker/go-units) + +# Introduction + +go-units is a library to transform human friendly measurements into machine friendly values. + +## Usage + +See the [docs in godoc](https://godoc.org/github.com/docker/go-units) for examples and documentation. + +## Copyright and license + +Copyright © 2015 Docker, Inc. + +go-units is licensed under the Apache License, Version 2.0. +See [LICENSE](LICENSE) for the full text of the license. diff --git a/integration-test/vendor/github.com/docker/go-units/circle.yml b/integration-test/vendor/github.com/docker/go-units/circle.yml new file mode 100644 index 000000000..af9d60552 --- /dev/null +++ b/integration-test/vendor/github.com/docker/go-units/circle.yml @@ -0,0 +1,11 @@ +dependencies: + post: + # install golint + - go get golang.org/x/lint/golint + +test: + pre: + # run analysis before tests + - go vet ./... + - test -z "$(golint ./... | tee /dev/stderr)" + - test -z "$(gofmt -s -l . | tee /dev/stderr)" diff --git a/integration-test/vendor/github.com/docker/go-units/duration.go b/integration-test/vendor/github.com/docker/go-units/duration.go new file mode 100644 index 000000000..48dd8744d --- /dev/null +++ b/integration-test/vendor/github.com/docker/go-units/duration.go @@ -0,0 +1,35 @@ +// Package units provides helper function to parse and print size and time units +// in human-readable format. +package units + +import ( + "fmt" + "time" +) + +// HumanDuration returns a human-readable approximation of a duration +// (eg. "About a minute", "4 hours ago", etc.). +func HumanDuration(d time.Duration) string { + if seconds := int(d.Seconds()); seconds < 1 { + return "Less than a second" + } else if seconds == 1 { + return "1 second" + } else if seconds < 60 { + return fmt.Sprintf("%d seconds", seconds) + } else if minutes := int(d.Minutes()); minutes == 1 { + return "About a minute" + } else if minutes < 60 { + return fmt.Sprintf("%d minutes", minutes) + } else if hours := int(d.Hours() + 0.5); hours == 1 { + return "About an hour" + } else if hours < 48 { + return fmt.Sprintf("%d hours", hours) + } else if hours < 24*7*2 { + return fmt.Sprintf("%d days", hours/24) + } else if hours < 24*30*2 { + return fmt.Sprintf("%d weeks", hours/24/7) + } else if hours < 24*365*2 { + return fmt.Sprintf("%d months", hours/24/30) + } + return fmt.Sprintf("%d years", int(d.Hours())/24/365) +} diff --git a/integration-test/vendor/github.com/docker/go-units/size.go b/integration-test/vendor/github.com/docker/go-units/size.go new file mode 100644 index 000000000..85f6ab071 --- /dev/null +++ b/integration-test/vendor/github.com/docker/go-units/size.go @@ -0,0 +1,108 @@ +package units + +import ( + "fmt" + "regexp" + "strconv" + "strings" +) + +// See: http://en.wikipedia.org/wiki/Binary_prefix +const ( + // Decimal + + KB = 1000 + MB = 1000 * KB + GB = 1000 * MB + TB = 1000 * GB + PB = 1000 * TB + + // Binary + + KiB = 1024 + MiB = 1024 * KiB + GiB = 1024 * MiB + TiB = 1024 * GiB + PiB = 1024 * TiB +) + +type unitMap map[string]int64 + +var ( + decimalMap = unitMap{"k": KB, "m": MB, "g": GB, "t": TB, "p": PB} + binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB} + sizeRegex = regexp.MustCompile(`^(\d+(\.\d+)*) ?([kKmMgGtTpP])?[iI]?[bB]?$`) +) + +var decimapAbbrs = []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} +var binaryAbbrs = []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} + +func getSizeAndUnit(size float64, base float64, _map []string) (float64, string) { + i := 0 + unitsLimit := len(_map) - 1 + for size >= base && i < unitsLimit { + size = size / base + i++ + } + return size, _map[i] +} + +// CustomSize returns a human-readable approximation of a size +// using custom format. +func CustomSize(format string, size float64, base float64, _map []string) string { + size, unit := getSizeAndUnit(size, base, _map) + return fmt.Sprintf(format, size, unit) +} + +// HumanSizeWithPrecision allows the size to be in any precision, +// instead of 4 digit precision used in units.HumanSize. +func HumanSizeWithPrecision(size float64, precision int) string { + size, unit := getSizeAndUnit(size, 1000.0, decimapAbbrs) + return fmt.Sprintf("%.*g%s", precision, size, unit) +} + +// HumanSize returns a human-readable approximation of a size +// capped at 4 valid numbers (eg. "2.746 MB", "796 KB"). +func HumanSize(size float64) string { + return HumanSizeWithPrecision(size, 4) +} + +// BytesSize returns a human-readable size in bytes, kibibytes, +// mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB"). +func BytesSize(size float64) string { + return CustomSize("%.4g%s", size, 1024.0, binaryAbbrs) +} + +// FromHumanSize returns an integer from a human-readable specification of a +// size using SI standard (eg. "44kB", "17MB"). +func FromHumanSize(size string) (int64, error) { + return parseSize(size, decimalMap) +} + +// RAMInBytes parses a human-readable string representing an amount of RAM +// in bytes, kibibytes, mebibytes, gibibytes, or tebibytes and +// returns the number of bytes, or -1 if the string is unparseable. +// Units are case-insensitive, and the 'b' suffix is optional. +func RAMInBytes(size string) (int64, error) { + return parseSize(size, binaryMap) +} + +// Parses the human-readable size string into the amount it represents. +func parseSize(sizeStr string, uMap unitMap) (int64, error) { + matches := sizeRegex.FindStringSubmatch(sizeStr) + if len(matches) != 4 { + return -1, fmt.Errorf("invalid size: '%s'", sizeStr) + } + + size, err := strconv.ParseFloat(matches[1], 64) + if err != nil { + return -1, err + } + + unitPrefix := strings.ToLower(matches[3]) + if mul, ok := uMap[unitPrefix]; ok { + size *= float64(mul) + } + + return int64(size), nil +} diff --git a/integration-test/vendor/github.com/docker/go-units/ulimit.go b/integration-test/vendor/github.com/docker/go-units/ulimit.go new file mode 100644 index 000000000..fca0400cc --- /dev/null +++ b/integration-test/vendor/github.com/docker/go-units/ulimit.go @@ -0,0 +1,123 @@ +package units + +import ( + "fmt" + "strconv" + "strings" +) + +// Ulimit is a human friendly version of Rlimit. +type Ulimit struct { + Name string + Hard int64 + Soft int64 +} + +// Rlimit specifies the resource limits, such as max open files. +type Rlimit struct { + Type int `json:"type,omitempty"` + Hard uint64 `json:"hard,omitempty"` + Soft uint64 `json:"soft,omitempty"` +} + +const ( + // magic numbers for making the syscall + // some of these are defined in the syscall package, but not all. + // Also since Windows client doesn't get access to the syscall package, need to + // define these here + rlimitAs = 9 + rlimitCore = 4 + rlimitCPU = 0 + rlimitData = 2 + rlimitFsize = 1 + rlimitLocks = 10 + rlimitMemlock = 8 + rlimitMsgqueue = 12 + rlimitNice = 13 + rlimitNofile = 7 + rlimitNproc = 6 + rlimitRss = 5 + rlimitRtprio = 14 + rlimitRttime = 15 + rlimitSigpending = 11 + rlimitStack = 3 +) + +var ulimitNameMapping = map[string]int{ + //"as": rlimitAs, // Disabled since this doesn't seem usable with the way Docker inits a container. + "core": rlimitCore, + "cpu": rlimitCPU, + "data": rlimitData, + "fsize": rlimitFsize, + "locks": rlimitLocks, + "memlock": rlimitMemlock, + "msgqueue": rlimitMsgqueue, + "nice": rlimitNice, + "nofile": rlimitNofile, + "nproc": rlimitNproc, + "rss": rlimitRss, + "rtprio": rlimitRtprio, + "rttime": rlimitRttime, + "sigpending": rlimitSigpending, + "stack": rlimitStack, +} + +// ParseUlimit parses and returns a Ulimit from the specified string. +func ParseUlimit(val string) (*Ulimit, error) { + parts := strings.SplitN(val, "=", 2) + if len(parts) != 2 { + return nil, fmt.Errorf("invalid ulimit argument: %s", val) + } + + if _, exists := ulimitNameMapping[parts[0]]; !exists { + return nil, fmt.Errorf("invalid ulimit type: %s", parts[0]) + } + + var ( + soft int64 + hard = &soft // default to soft in case no hard was set + temp int64 + err error + ) + switch limitVals := strings.Split(parts[1], ":"); len(limitVals) { + case 2: + temp, err = strconv.ParseInt(limitVals[1], 10, 64) + if err != nil { + return nil, err + } + hard = &temp + fallthrough + case 1: + soft, err = strconv.ParseInt(limitVals[0], 10, 64) + if err != nil { + return nil, err + } + default: + return nil, fmt.Errorf("too many limit value arguments - %s, can only have up to two, `soft[:hard]`", parts[1]) + } + + if *hard != -1 { + if soft == -1 { + return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: soft: -1 (unlimited), hard: %d", *hard) + } + if soft > *hard { + return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: %d > %d", soft, *hard) + } + } + + return &Ulimit{Name: parts[0], Soft: soft, Hard: *hard}, nil +} + +// GetRlimit returns the RLimit corresponding to Ulimit. +func (u *Ulimit) GetRlimit() (*Rlimit, error) { + t, exists := ulimitNameMapping[u.Name] + if !exists { + return nil, fmt.Errorf("invalid ulimit name %s", u.Name) + } + + return &Rlimit{Type: t, Soft: uint64(u.Soft), Hard: uint64(u.Hard)}, nil +} + +func (u *Ulimit) String() string { + return fmt.Sprintf("%s=%d:%d", u.Name, u.Soft, u.Hard) +} diff --git a/integration-test/vendor/github.com/evanphx/json-patch/LICENSE b/integration-test/vendor/github.com/evanphx/json-patch/LICENSE new file mode 100644 index 000000000..df76d7d77 --- /dev/null +++ b/integration-test/vendor/github.com/evanphx/json-patch/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2014, Evan Phoenix +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of the Evan Phoenix nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/integration-test/vendor/github.com/evanphx/json-patch/README.md b/integration-test/vendor/github.com/evanphx/json-patch/README.md new file mode 100644 index 000000000..28e351693 --- /dev/null +++ b/integration-test/vendor/github.com/evanphx/json-patch/README.md @@ -0,0 +1,317 @@ +# JSON-Patch +`jsonpatch` is a library which provides functionality for both applying +[RFC6902 JSON patches](http://tools.ietf.org/html/rfc6902) against documents, as +well as for calculating & applying [RFC7396 JSON merge patches](https://tools.ietf.org/html/rfc7396). + +[![GoDoc](https://godoc.org/github.com/evanphx/json-patch?status.svg)](http://godoc.org/github.com/evanphx/json-patch) +[![Build Status](https://travis-ci.org/evanphx/json-patch.svg?branch=master)](https://travis-ci.org/evanphx/json-patch) +[![Report Card](https://goreportcard.com/badge/github.com/evanphx/json-patch)](https://goreportcard.com/report/github.com/evanphx/json-patch) + +# Get It! + +**Latest and greatest**: +```bash +go get -u github.com/evanphx/json-patch/v5 +``` + +**Stable Versions**: +* Version 5: `go get -u gopkg.in/evanphx/json-patch.v5` +* Version 4: `go get -u gopkg.in/evanphx/json-patch.v4` + +(previous versions below `v3` are unavailable) + +# Use It! +* [Create and apply a merge patch](#create-and-apply-a-merge-patch) +* [Create and apply a JSON Patch](#create-and-apply-a-json-patch) +* [Comparing JSON documents](#comparing-json-documents) +* [Combine merge patches](#combine-merge-patches) + + +# Configuration + +* There is a global configuration variable `jsonpatch.SupportNegativeIndices`. + This defaults to `true` and enables the non-standard practice of allowing + negative indices to mean indices starting at the end of an array. This + functionality can be disabled by setting `jsonpatch.SupportNegativeIndices = + false`. + +* There is a global configuration variable `jsonpatch.AccumulatedCopySizeLimit`, + which limits the total size increase in bytes caused by "copy" operations in a + patch. It defaults to 0, which means there is no limit. + +These global variables control the behavior of `jsonpatch.Apply`. + +An alternative to `jsonpatch.Apply` is `jsonpatch.ApplyWithOptions` whose behavior +is controlled by an `options` parameter of type `*jsonpatch.ApplyOptions`. + +Structure `jsonpatch.ApplyOptions` includes the configuration options above +and adds two new options: `AllowMissingPathOnRemove` and `EnsurePathExistsOnAdd`. + +When `AllowMissingPathOnRemove` is set to `true`, `jsonpatch.ApplyWithOptions` will ignore +`remove` operations whose `path` points to a non-existent location in the JSON document. +`AllowMissingPathOnRemove` defaults to `false` which will lead to `jsonpatch.ApplyWithOptions` +returning an error when hitting a missing `path` on `remove`. + +When `EnsurePathExistsOnAdd` is set to `true`, `jsonpatch.ApplyWithOptions` will make sure +that `add` operations produce all the `path` elements that are missing from the target object. + +Use `jsonpatch.NewApplyOptions` to create an instance of `jsonpatch.ApplyOptions` +whose values are populated from the global configuration variables. + +## Create and apply a merge patch +Given both an original JSON document and a modified JSON document, you can create +a [Merge Patch](https://tools.ietf.org/html/rfc7396) document. + +It can describe the changes needed to convert from the original to the +modified JSON document. + +Once you have a merge patch, you can apply it to other JSON documents using the +`jsonpatch.MergePatch(document, patch)` function. + +```go +package main + +import ( + "fmt" + + jsonpatch "github.com/evanphx/json-patch" +) + +func main() { + // Let's create a merge patch from these two documents... + original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) + target := []byte(`{"name": "Jane", "age": 24}`) + + patch, err := jsonpatch.CreateMergePatch(original, target) + if err != nil { + panic(err) + } + + // Now lets apply the patch against a different JSON document... + + alternative := []byte(`{"name": "Tina", "age": 28, "height": 3.75}`) + modifiedAlternative, err := jsonpatch.MergePatch(alternative, patch) + + fmt.Printf("patch document: %s\n", patch) + fmt.Printf("updated alternative doc: %s\n", modifiedAlternative) +} +``` + +When ran, you get the following output: + +```bash +$ go run main.go +patch document: {"height":null,"name":"Jane"} +updated alternative doc: {"age":28,"name":"Jane"} +``` + +## Create and apply a JSON Patch +You can create patch objects using `DecodePatch([]byte)`, which can then +be applied against JSON documents. + +The following is an example of creating a patch from two operations, and +applying it against a JSON document. + +```go +package main + +import ( + "fmt" + + jsonpatch "github.com/evanphx/json-patch" +) + +func main() { + original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) + patchJSON := []byte(`[ + {"op": "replace", "path": "/name", "value": "Jane"}, + {"op": "remove", "path": "/height"} + ]`) + + patch, err := jsonpatch.DecodePatch(patchJSON) + if err != nil { + panic(err) + } + + modified, err := patch.Apply(original) + if err != nil { + panic(err) + } + + fmt.Printf("Original document: %s\n", original) + fmt.Printf("Modified document: %s\n", modified) +} +``` + +When ran, you get the following output: + +```bash +$ go run main.go +Original document: {"name": "John", "age": 24, "height": 3.21} +Modified document: {"age":24,"name":"Jane"} +``` + +## Comparing JSON documents +Due to potential whitespace and ordering differences, one cannot simply compare +JSON strings or byte-arrays directly. + +As such, you can instead use `jsonpatch.Equal(document1, document2)` to +determine if two JSON documents are _structurally_ equal. This ignores +whitespace differences, and key-value ordering. + +```go +package main + +import ( + "fmt" + + jsonpatch "github.com/evanphx/json-patch" +) + +func main() { + original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) + similar := []byte(` + { + "age": 24, + "height": 3.21, + "name": "John" + } + `) + different := []byte(`{"name": "Jane", "age": 20, "height": 3.37}`) + + if jsonpatch.Equal(original, similar) { + fmt.Println(`"original" is structurally equal to "similar"`) + } + + if !jsonpatch.Equal(original, different) { + fmt.Println(`"original" is _not_ structurally equal to "different"`) + } +} +``` + +When ran, you get the following output: +```bash +$ go run main.go +"original" is structurally equal to "similar" +"original" is _not_ structurally equal to "different" +``` + +## Combine merge patches +Given two JSON merge patch documents, it is possible to combine them into a +single merge patch which can describe both set of changes. + +The resulting merge patch can be used such that applying it results in a +document structurally similar as merging each merge patch to the document +in succession. + +```go +package main + +import ( + "fmt" + + jsonpatch "github.com/evanphx/json-patch" +) + +func main() { + original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) + + nameAndHeight := []byte(`{"height":null,"name":"Jane"}`) + ageAndEyes := []byte(`{"age":4.23,"eyes":"blue"}`) + + // Let's combine these merge patch documents... + combinedPatch, err := jsonpatch.MergeMergePatches(nameAndHeight, ageAndEyes) + if err != nil { + panic(err) + } + + // Apply each patch individual against the original document + withoutCombinedPatch, err := jsonpatch.MergePatch(original, nameAndHeight) + if err != nil { + panic(err) + } + + withoutCombinedPatch, err = jsonpatch.MergePatch(withoutCombinedPatch, ageAndEyes) + if err != nil { + panic(err) + } + + // Apply the combined patch against the original document + + withCombinedPatch, err := jsonpatch.MergePatch(original, combinedPatch) + if err != nil { + panic(err) + } + + // Do both result in the same thing? They should! + if jsonpatch.Equal(withCombinedPatch, withoutCombinedPatch) { + fmt.Println("Both JSON documents are structurally the same!") + } + + fmt.Printf("combined merge patch: %s", combinedPatch) +} +``` + +When ran, you get the following output: +```bash +$ go run main.go +Both JSON documents are structurally the same! +combined merge patch: {"age":4.23,"eyes":"blue","height":null,"name":"Jane"} +``` + +# CLI for comparing JSON documents +You can install the commandline program `json-patch`. + +This program can take multiple JSON patch documents as arguments, +and fed a JSON document from `stdin`. It will apply the patch(es) against +the document and output the modified doc. + +**patch.1.json** +```json +[ + {"op": "replace", "path": "/name", "value": "Jane"}, + {"op": "remove", "path": "/height"} +] +``` + +**patch.2.json** +```json +[ + {"op": "add", "path": "/address", "value": "123 Main St"}, + {"op": "replace", "path": "/age", "value": "21"} +] +``` + +**document.json** +```json +{ + "name": "John", + "age": 24, + "height": 3.21 +} +``` + +You can then run: + +```bash +$ go install github.com/evanphx/json-patch/cmd/json-patch +$ cat document.json | json-patch -p patch.1.json -p patch.2.json +{"address":"123 Main St","age":"21","name":"Jane"} +``` + +# Help It! +Contributions are welcomed! Leave [an issue](https://github.com/evanphx/json-patch/issues) +or [create a PR](https://github.com/evanphx/json-patch/compare). + + +Before creating a pull request, we'd ask that you make sure tests are passing +and that you have added new tests when applicable. + +Contributors can run tests using: + +```bash +go test -cover ./... +``` + +Builds for pull requests are tested automatically +using [TravisCI](https://travis-ci.org/evanphx/json-patch). diff --git a/integration-test/vendor/github.com/evanphx/json-patch/errors.go b/integration-test/vendor/github.com/evanphx/json-patch/errors.go new file mode 100644 index 000000000..75304b443 --- /dev/null +++ b/integration-test/vendor/github.com/evanphx/json-patch/errors.go @@ -0,0 +1,38 @@ +package jsonpatch + +import "fmt" + +// AccumulatedCopySizeError is an error type returned when the accumulated size +// increase caused by copy operations in a patch operation has exceeded the +// limit. +type AccumulatedCopySizeError struct { + limit int64 + accumulated int64 +} + +// NewAccumulatedCopySizeError returns an AccumulatedCopySizeError. +func NewAccumulatedCopySizeError(l, a int64) *AccumulatedCopySizeError { + return &AccumulatedCopySizeError{limit: l, accumulated: a} +} + +// Error implements the error interface. +func (a *AccumulatedCopySizeError) Error() string { + return fmt.Sprintf("Unable to complete the copy, the accumulated size increase of copy is %d, exceeding the limit %d", a.accumulated, a.limit) +} + +// ArraySizeError is an error type returned when the array size has exceeded +// the limit. +type ArraySizeError struct { + limit int + size int +} + +// NewArraySizeError returns an ArraySizeError. +func NewArraySizeError(l, s int) *ArraySizeError { + return &ArraySizeError{limit: l, size: s} +} + +// Error implements the error interface. +func (a *ArraySizeError) Error() string { + return fmt.Sprintf("Unable to create array of size %d, limit is %d", a.size, a.limit) +} diff --git a/integration-test/vendor/github.com/evanphx/json-patch/merge.go b/integration-test/vendor/github.com/evanphx/json-patch/merge.go new file mode 100644 index 000000000..ad88d4018 --- /dev/null +++ b/integration-test/vendor/github.com/evanphx/json-patch/merge.go @@ -0,0 +1,389 @@ +package jsonpatch + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" +) + +func merge(cur, patch *lazyNode, mergeMerge bool) *lazyNode { + curDoc, err := cur.intoDoc() + + if err != nil { + pruneNulls(patch) + return patch + } + + patchDoc, err := patch.intoDoc() + + if err != nil { + return patch + } + + mergeDocs(curDoc, patchDoc, mergeMerge) + + return cur +} + +func mergeDocs(doc, patch *partialDoc, mergeMerge bool) { + for k, v := range *patch { + if v == nil { + if mergeMerge { + (*doc)[k] = nil + } else { + delete(*doc, k) + } + } else { + cur, ok := (*doc)[k] + + if !ok || cur == nil { + if !mergeMerge { + pruneNulls(v) + } + + (*doc)[k] = v + } else { + (*doc)[k] = merge(cur, v, mergeMerge) + } + } + } +} + +func pruneNulls(n *lazyNode) { + sub, err := n.intoDoc() + + if err == nil { + pruneDocNulls(sub) + } else { + ary, err := n.intoAry() + + if err == nil { + pruneAryNulls(ary) + } + } +} + +func pruneDocNulls(doc *partialDoc) *partialDoc { + for k, v := range *doc { + if v == nil { + delete(*doc, k) + } else { + pruneNulls(v) + } + } + + return doc +} + +func pruneAryNulls(ary *partialArray) *partialArray { + newAry := []*lazyNode{} + + for _, v := range *ary { + if v != nil { + pruneNulls(v) + } + newAry = append(newAry, v) + } + + *ary = newAry + + return ary +} + +var ErrBadJSONDoc = fmt.Errorf("Invalid JSON Document") +var ErrBadJSONPatch = fmt.Errorf("Invalid JSON Patch") +var errBadMergeTypes = fmt.Errorf("Mismatched JSON Documents") + +// MergeMergePatches merges two merge patches together, such that +// applying this resulting merged merge patch to a document yields the same +// as merging each merge patch to the document in succession. +func MergeMergePatches(patch1Data, patch2Data []byte) ([]byte, error) { + return doMergePatch(patch1Data, patch2Data, true) +} + +// MergePatch merges the patchData into the docData. +func MergePatch(docData, patchData []byte) ([]byte, error) { + return doMergePatch(docData, patchData, false) +} + +func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { + doc := &partialDoc{} + + docErr := json.Unmarshal(docData, doc) + + patch := &partialDoc{} + + patchErr := json.Unmarshal(patchData, patch) + + if _, ok := docErr.(*json.SyntaxError); ok { + return nil, ErrBadJSONDoc + } + + if _, ok := patchErr.(*json.SyntaxError); ok { + return nil, ErrBadJSONPatch + } + + if docErr == nil && *doc == nil { + return nil, ErrBadJSONDoc + } + + if patchErr == nil && *patch == nil { + return nil, ErrBadJSONPatch + } + + if docErr != nil || patchErr != nil { + // Not an error, just not a doc, so we turn straight into the patch + if patchErr == nil { + if mergeMerge { + doc = patch + } else { + doc = pruneDocNulls(patch) + } + } else { + patchAry := &partialArray{} + patchErr = json.Unmarshal(patchData, patchAry) + + if patchErr != nil { + return nil, ErrBadJSONPatch + } + + pruneAryNulls(patchAry) + + out, patchErr := json.Marshal(patchAry) + + if patchErr != nil { + return nil, ErrBadJSONPatch + } + + return out, nil + } + } else { + mergeDocs(doc, patch, mergeMerge) + } + + return json.Marshal(doc) +} + +// resemblesJSONArray indicates whether the byte-slice "appears" to be +// a JSON array or not. +// False-positives are possible, as this function does not check the internal +// structure of the array. It only checks that the outer syntax is present and +// correct. +func resemblesJSONArray(input []byte) bool { + input = bytes.TrimSpace(input) + + hasPrefix := bytes.HasPrefix(input, []byte("[")) + hasSuffix := bytes.HasSuffix(input, []byte("]")) + + return hasPrefix && hasSuffix +} + +// CreateMergePatch will return a merge patch document capable of converting +// the original document(s) to the modified document(s). +// The parameters can be bytes of either two JSON Documents, or two arrays of +// JSON documents. +// The merge patch returned follows the specification defined at http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch-07 +func CreateMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { + originalResemblesArray := resemblesJSONArray(originalJSON) + modifiedResemblesArray := resemblesJSONArray(modifiedJSON) + + // Do both byte-slices seem like JSON arrays? + if originalResemblesArray && modifiedResemblesArray { + return createArrayMergePatch(originalJSON, modifiedJSON) + } + + // Are both byte-slices are not arrays? Then they are likely JSON objects... + if !originalResemblesArray && !modifiedResemblesArray { + return createObjectMergePatch(originalJSON, modifiedJSON) + } + + // None of the above? Then return an error because of mismatched types. + return nil, errBadMergeTypes +} + +// createObjectMergePatch will return a merge-patch document capable of +// converting the original document to the modified document. +func createObjectMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { + originalDoc := map[string]interface{}{} + modifiedDoc := map[string]interface{}{} + + err := json.Unmarshal(originalJSON, &originalDoc) + if err != nil { + return nil, ErrBadJSONDoc + } + + err = json.Unmarshal(modifiedJSON, &modifiedDoc) + if err != nil { + return nil, ErrBadJSONDoc + } + + dest, err := getDiff(originalDoc, modifiedDoc) + if err != nil { + return nil, err + } + + return json.Marshal(dest) +} + +// createArrayMergePatch will return an array of merge-patch documents capable +// of converting the original document to the modified document for each +// pair of JSON documents provided in the arrays. +// Arrays of mismatched sizes will result in an error. +func createArrayMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { + originalDocs := []json.RawMessage{} + modifiedDocs := []json.RawMessage{} + + err := json.Unmarshal(originalJSON, &originalDocs) + if err != nil { + return nil, ErrBadJSONDoc + } + + err = json.Unmarshal(modifiedJSON, &modifiedDocs) + if err != nil { + return nil, ErrBadJSONDoc + } + + total := len(originalDocs) + if len(modifiedDocs) != total { + return nil, ErrBadJSONDoc + } + + result := []json.RawMessage{} + for i := 0; i < len(originalDocs); i++ { + original := originalDocs[i] + modified := modifiedDocs[i] + + patch, err := createObjectMergePatch(original, modified) + if err != nil { + return nil, err + } + + result = append(result, json.RawMessage(patch)) + } + + return json.Marshal(result) +} + +// Returns true if the array matches (must be json types). +// As is idiomatic for go, an empty array is not the same as a nil array. +func matchesArray(a, b []interface{}) bool { + if len(a) != len(b) { + return false + } + if (a == nil && b != nil) || (a != nil && b == nil) { + return false + } + for i := range a { + if !matchesValue(a[i], b[i]) { + return false + } + } + return true +} + +// Returns true if the values matches (must be json types) +// The types of the values must match, otherwise it will always return false +// If two map[string]interface{} are given, all elements must match. +func matchesValue(av, bv interface{}) bool { + if reflect.TypeOf(av) != reflect.TypeOf(bv) { + return false + } + switch at := av.(type) { + case string: + bt := bv.(string) + if bt == at { + return true + } + case float64: + bt := bv.(float64) + if bt == at { + return true + } + case bool: + bt := bv.(bool) + if bt == at { + return true + } + case nil: + // Both nil, fine. + return true + case map[string]interface{}: + bt := bv.(map[string]interface{}) + if len(bt) != len(at) { + return false + } + for key := range bt { + av, aOK := at[key] + bv, bOK := bt[key] + if aOK != bOK { + return false + } + if !matchesValue(av, bv) { + return false + } + } + return true + case []interface{}: + bt := bv.([]interface{}) + return matchesArray(at, bt) + } + return false +} + +// getDiff returns the (recursive) difference between a and b as a map[string]interface{}. +func getDiff(a, b map[string]interface{}) (map[string]interface{}, error) { + into := map[string]interface{}{} + for key, bv := range b { + av, ok := a[key] + // value was added + if !ok { + into[key] = bv + continue + } + // If types have changed, replace completely + if reflect.TypeOf(av) != reflect.TypeOf(bv) { + into[key] = bv + continue + } + // Types are the same, compare values + switch at := av.(type) { + case map[string]interface{}: + bt := bv.(map[string]interface{}) + dst := make(map[string]interface{}, len(bt)) + dst, err := getDiff(at, bt) + if err != nil { + return nil, err + } + if len(dst) > 0 { + into[key] = dst + } + case string, float64, bool: + if !matchesValue(av, bv) { + into[key] = bv + } + case []interface{}: + bt := bv.([]interface{}) + if !matchesArray(at, bt) { + into[key] = bv + } + case nil: + switch bv.(type) { + case nil: + // Both nil, fine. + default: + into[key] = bv + } + default: + panic(fmt.Sprintf("Unknown type:%T in key %s", av, key)) + } + } + // Now add all deleted values as nil + for key := range a { + _, found := b[key] + if !found { + into[key] = nil + } + } + return into, nil +} diff --git a/integration-test/vendor/github.com/evanphx/json-patch/patch.go b/integration-test/vendor/github.com/evanphx/json-patch/patch.go new file mode 100644 index 000000000..182985490 --- /dev/null +++ b/integration-test/vendor/github.com/evanphx/json-patch/patch.go @@ -0,0 +1,788 @@ +package jsonpatch + +import ( + "bytes" + "encoding/json" + "fmt" + "strconv" + "strings" + + "github.com/pkg/errors" +) + +const ( + eRaw = iota + eDoc + eAry +) + +var ( + // SupportNegativeIndices decides whether to support non-standard practice of + // allowing negative indices to mean indices starting at the end of an array. + // Default to true. + SupportNegativeIndices bool = true + // AccumulatedCopySizeLimit limits the total size increase in bytes caused by + // "copy" operations in a patch. + AccumulatedCopySizeLimit int64 = 0 +) + +var ( + ErrTestFailed = errors.New("test failed") + ErrMissing = errors.New("missing value") + ErrUnknownType = errors.New("unknown object type") + ErrInvalid = errors.New("invalid state detected") + ErrInvalidIndex = errors.New("invalid index referenced") +) + +type lazyNode struct { + raw *json.RawMessage + doc partialDoc + ary partialArray + which int +} + +// Operation is a single JSON-Patch step, such as a single 'add' operation. +type Operation map[string]*json.RawMessage + +// Patch is an ordered collection of Operations. +type Patch []Operation + +type partialDoc map[string]*lazyNode +type partialArray []*lazyNode + +type container interface { + get(key string) (*lazyNode, error) + set(key string, val *lazyNode) error + add(key string, val *lazyNode) error + remove(key string) error +} + +func newLazyNode(raw *json.RawMessage) *lazyNode { + return &lazyNode{raw: raw, doc: nil, ary: nil, which: eRaw} +} + +func (n *lazyNode) MarshalJSON() ([]byte, error) { + switch n.which { + case eRaw: + return json.Marshal(n.raw) + case eDoc: + return json.Marshal(n.doc) + case eAry: + return json.Marshal(n.ary) + default: + return nil, ErrUnknownType + } +} + +func (n *lazyNode) UnmarshalJSON(data []byte) error { + dest := make(json.RawMessage, len(data)) + copy(dest, data) + n.raw = &dest + n.which = eRaw + return nil +} + +func deepCopy(src *lazyNode) (*lazyNode, int, error) { + if src == nil { + return nil, 0, nil + } + a, err := src.MarshalJSON() + if err != nil { + return nil, 0, err + } + sz := len(a) + ra := make(json.RawMessage, sz) + copy(ra, a) + return newLazyNode(&ra), sz, nil +} + +func (n *lazyNode) intoDoc() (*partialDoc, error) { + if n.which == eDoc { + return &n.doc, nil + } + + if n.raw == nil { + return nil, ErrInvalid + } + + err := json.Unmarshal(*n.raw, &n.doc) + + if err != nil { + return nil, err + } + + n.which = eDoc + return &n.doc, nil +} + +func (n *lazyNode) intoAry() (*partialArray, error) { + if n.which == eAry { + return &n.ary, nil + } + + if n.raw == nil { + return nil, ErrInvalid + } + + err := json.Unmarshal(*n.raw, &n.ary) + + if err != nil { + return nil, err + } + + n.which = eAry + return &n.ary, nil +} + +func (n *lazyNode) compact() []byte { + buf := &bytes.Buffer{} + + if n.raw == nil { + return nil + } + + err := json.Compact(buf, *n.raw) + + if err != nil { + return *n.raw + } + + return buf.Bytes() +} + +func (n *lazyNode) tryDoc() bool { + if n.raw == nil { + return false + } + + err := json.Unmarshal(*n.raw, &n.doc) + + if err != nil { + return false + } + + n.which = eDoc + return true +} + +func (n *lazyNode) tryAry() bool { + if n.raw == nil { + return false + } + + err := json.Unmarshal(*n.raw, &n.ary) + + if err != nil { + return false + } + + n.which = eAry + return true +} + +func (n *lazyNode) equal(o *lazyNode) bool { + if n.which == eRaw { + if !n.tryDoc() && !n.tryAry() { + if o.which != eRaw { + return false + } + + return bytes.Equal(n.compact(), o.compact()) + } + } + + if n.which == eDoc { + if o.which == eRaw { + if !o.tryDoc() { + return false + } + } + + if o.which != eDoc { + return false + } + + if len(n.doc) != len(o.doc) { + return false + } + + for k, v := range n.doc { + ov, ok := o.doc[k] + + if !ok { + return false + } + + if (v == nil) != (ov == nil) { + return false + } + + if v == nil && ov == nil { + continue + } + + if !v.equal(ov) { + return false + } + } + + return true + } + + if o.which != eAry && !o.tryAry() { + return false + } + + if len(n.ary) != len(o.ary) { + return false + } + + for idx, val := range n.ary { + if !val.equal(o.ary[idx]) { + return false + } + } + + return true +} + +// Kind reads the "op" field of the Operation. +func (o Operation) Kind() string { + if obj, ok := o["op"]; ok && obj != nil { + var op string + + err := json.Unmarshal(*obj, &op) + + if err != nil { + return "unknown" + } + + return op + } + + return "unknown" +} + +// Path reads the "path" field of the Operation. +func (o Operation) Path() (string, error) { + if obj, ok := o["path"]; ok && obj != nil { + var op string + + err := json.Unmarshal(*obj, &op) + + if err != nil { + return "unknown", err + } + + return op, nil + } + + return "unknown", errors.Wrapf(ErrMissing, "operation missing path field") +} + +// From reads the "from" field of the Operation. +func (o Operation) From() (string, error) { + if obj, ok := o["from"]; ok && obj != nil { + var op string + + err := json.Unmarshal(*obj, &op) + + if err != nil { + return "unknown", err + } + + return op, nil + } + + return "unknown", errors.Wrapf(ErrMissing, "operation, missing from field") +} + +func (o Operation) value() *lazyNode { + if obj, ok := o["value"]; ok { + return newLazyNode(obj) + } + + return nil +} + +// ValueInterface decodes the operation value into an interface. +func (o Operation) ValueInterface() (interface{}, error) { + if obj, ok := o["value"]; ok && obj != nil { + var v interface{} + + err := json.Unmarshal(*obj, &v) + + if err != nil { + return nil, err + } + + return v, nil + } + + return nil, errors.Wrapf(ErrMissing, "operation, missing value field") +} + +func isArray(buf []byte) bool { +Loop: + for _, c := range buf { + switch c { + case ' ': + case '\n': + case '\t': + continue + case '[': + return true + default: + break Loop + } + } + + return false +} + +func findObject(pd *container, path string) (container, string) { + doc := *pd + + split := strings.Split(path, "/") + + if len(split) < 2 { + return nil, "" + } + + parts := split[1 : len(split)-1] + + key := split[len(split)-1] + + var err error + + for _, part := range parts { + + next, ok := doc.get(decodePatchKey(part)) + + if next == nil || ok != nil { + return nil, "" + } + + if isArray(*next.raw) { + doc, err = next.intoAry() + + if err != nil { + return nil, "" + } + } else { + doc, err = next.intoDoc() + + if err != nil { + return nil, "" + } + } + } + + return doc, decodePatchKey(key) +} + +func (d *partialDoc) set(key string, val *lazyNode) error { + (*d)[key] = val + return nil +} + +func (d *partialDoc) add(key string, val *lazyNode) error { + (*d)[key] = val + return nil +} + +func (d *partialDoc) get(key string) (*lazyNode, error) { + return (*d)[key], nil +} + +func (d *partialDoc) remove(key string) error { + _, ok := (*d)[key] + if !ok { + return errors.Wrapf(ErrMissing, "Unable to remove nonexistent key: %s", key) + } + + delete(*d, key) + return nil +} + +// set should only be used to implement the "replace" operation, so "key" must +// be an already existing index in "d". +func (d *partialArray) set(key string, val *lazyNode) error { + idx, err := strconv.Atoi(key) + if err != nil { + return err + } + (*d)[idx] = val + return nil +} + +func (d *partialArray) add(key string, val *lazyNode) error { + if key == "-" { + *d = append(*d, val) + return nil + } + + idx, err := strconv.Atoi(key) + if err != nil { + return errors.Wrapf(err, "value was not a proper array index: '%s'", key) + } + + sz := len(*d) + 1 + + ary := make([]*lazyNode, sz) + + cur := *d + + if idx >= len(ary) { + return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + } + + if idx < 0 { + if !SupportNegativeIndices { + return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + } + if idx < -len(ary) { + return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + } + idx += len(ary) + } + + copy(ary[0:idx], cur[0:idx]) + ary[idx] = val + copy(ary[idx+1:], cur[idx:]) + + *d = ary + return nil +} + +func (d *partialArray) get(key string) (*lazyNode, error) { + idx, err := strconv.Atoi(key) + + if err != nil { + return nil, err + } + + if idx >= len(*d) { + return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + } + + return (*d)[idx], nil +} + +func (d *partialArray) remove(key string) error { + idx, err := strconv.Atoi(key) + if err != nil { + return err + } + + cur := *d + + if idx >= len(cur) { + return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + } + + if idx < 0 { + if !SupportNegativeIndices { + return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + } + if idx < -len(cur) { + return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + } + idx += len(cur) + } + + ary := make([]*lazyNode, len(cur)-1) + + copy(ary[0:idx], cur[0:idx]) + copy(ary[idx:], cur[idx+1:]) + + *d = ary + return nil + +} + +func (p Patch) add(doc *container, op Operation) error { + path, err := op.Path() + if err != nil { + return errors.Wrapf(ErrMissing, "add operation failed to decode path") + } + + con, key := findObject(doc, path) + + if con == nil { + return errors.Wrapf(ErrMissing, "add operation does not apply: doc is missing path: \"%s\"", path) + } + + err = con.add(key, op.value()) + if err != nil { + return errors.Wrapf(err, "error in add for path: '%s'", path) + } + + return nil +} + +func (p Patch) remove(doc *container, op Operation) error { + path, err := op.Path() + if err != nil { + return errors.Wrapf(ErrMissing, "remove operation failed to decode path") + } + + con, key := findObject(doc, path) + + if con == nil { + return errors.Wrapf(ErrMissing, "remove operation does not apply: doc is missing path: \"%s\"", path) + } + + err = con.remove(key) + if err != nil { + return errors.Wrapf(err, "error in remove for path: '%s'", path) + } + + return nil +} + +func (p Patch) replace(doc *container, op Operation) error { + path, err := op.Path() + if err != nil { + return errors.Wrapf(err, "replace operation failed to decode path") + } + + con, key := findObject(doc, path) + + if con == nil { + return errors.Wrapf(ErrMissing, "replace operation does not apply: doc is missing path: %s", path) + } + + _, ok := con.get(key) + if ok != nil { + return errors.Wrapf(ErrMissing, "replace operation does not apply: doc is missing key: %s", path) + } + + err = con.set(key, op.value()) + if err != nil { + return errors.Wrapf(err, "error in remove for path: '%s'", path) + } + + return nil +} + +func (p Patch) move(doc *container, op Operation) error { + from, err := op.From() + if err != nil { + return errors.Wrapf(err, "move operation failed to decode from") + } + + con, key := findObject(doc, from) + + if con == nil { + return errors.Wrapf(ErrMissing, "move operation does not apply: doc is missing from path: %s", from) + } + + val, err := con.get(key) + if err != nil { + return errors.Wrapf(err, "error in move for path: '%s'", key) + } + + err = con.remove(key) + if err != nil { + return errors.Wrapf(err, "error in move for path: '%s'", key) + } + + path, err := op.Path() + if err != nil { + return errors.Wrapf(err, "move operation failed to decode path") + } + + con, key = findObject(doc, path) + + if con == nil { + return errors.Wrapf(ErrMissing, "move operation does not apply: doc is missing destination path: %s", path) + } + + err = con.add(key, val) + if err != nil { + return errors.Wrapf(err, "error in move for path: '%s'", path) + } + + return nil +} + +func (p Patch) test(doc *container, op Operation) error { + path, err := op.Path() + if err != nil { + return errors.Wrapf(err, "test operation failed to decode path") + } + + con, key := findObject(doc, path) + + if con == nil { + return errors.Wrapf(ErrMissing, "test operation does not apply: is missing path: %s", path) + } + + val, err := con.get(key) + if err != nil { + return errors.Wrapf(err, "error in test for path: '%s'", path) + } + + if val == nil { + if op.value().raw == nil { + return nil + } + return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + } else if op.value() == nil { + return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + } + + if val.equal(op.value()) { + return nil + } + + return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) +} + +func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64) error { + from, err := op.From() + if err != nil { + return errors.Wrapf(err, "copy operation failed to decode from") + } + + con, key := findObject(doc, from) + + if con == nil { + return errors.Wrapf(ErrMissing, "copy operation does not apply: doc is missing from path: %s", from) + } + + val, err := con.get(key) + if err != nil { + return errors.Wrapf(err, "error in copy for from: '%s'", from) + } + + path, err := op.Path() + if err != nil { + return errors.Wrapf(ErrMissing, "copy operation failed to decode path") + } + + con, key = findObject(doc, path) + + if con == nil { + return errors.Wrapf(ErrMissing, "copy operation does not apply: doc is missing destination path: %s", path) + } + + valCopy, sz, err := deepCopy(val) + if err != nil { + return errors.Wrapf(err, "error while performing deep copy") + } + + (*accumulatedCopySize) += int64(sz) + if AccumulatedCopySizeLimit > 0 && *accumulatedCopySize > AccumulatedCopySizeLimit { + return NewAccumulatedCopySizeError(AccumulatedCopySizeLimit, *accumulatedCopySize) + } + + err = con.add(key, valCopy) + if err != nil { + return errors.Wrapf(err, "error while adding value during copy") + } + + return nil +} + +// Equal indicates if 2 JSON documents have the same structural equality. +func Equal(a, b []byte) bool { + ra := make(json.RawMessage, len(a)) + copy(ra, a) + la := newLazyNode(&ra) + + rb := make(json.RawMessage, len(b)) + copy(rb, b) + lb := newLazyNode(&rb) + + return la.equal(lb) +} + +// DecodePatch decodes the passed JSON document as an RFC 6902 patch. +func DecodePatch(buf []byte) (Patch, error) { + var p Patch + + err := json.Unmarshal(buf, &p) + + if err != nil { + return nil, err + } + + return p, nil +} + +// Apply mutates a JSON document according to the patch, and returns the new +// document. +func (p Patch) Apply(doc []byte) ([]byte, error) { + return p.ApplyIndent(doc, "") +} + +// ApplyIndent mutates a JSON document according to the patch, and returns the new +// document indented. +func (p Patch) ApplyIndent(doc []byte, indent string) ([]byte, error) { + if len(doc) == 0 { + return doc, nil + } + + var pd container + if doc[0] == '[' { + pd = &partialArray{} + } else { + pd = &partialDoc{} + } + + err := json.Unmarshal(doc, pd) + + if err != nil { + return nil, err + } + + err = nil + + var accumulatedCopySize int64 + + for _, op := range p { + switch op.Kind() { + case "add": + err = p.add(&pd, op) + case "remove": + err = p.remove(&pd, op) + case "replace": + err = p.replace(&pd, op) + case "move": + err = p.move(&pd, op) + case "test": + err = p.test(&pd, op) + case "copy": + err = p.copy(&pd, op, &accumulatedCopySize) + default: + err = fmt.Errorf("Unexpected kind: %s", op.Kind()) + } + + if err != nil { + return nil, err + } + } + + if indent != "" { + return json.MarshalIndent(pd, "", indent) + } + + return json.Marshal(pd) +} + +// From http://tools.ietf.org/html/rfc6901#section-4 : +// +// Evaluation of each reference token begins by decoding any escaped +// character sequence. This is performed by first transforming any +// occurrence of the sequence '~1' to '/', and then transforming any +// occurrence of the sequence '~0' to '~'. + +var ( + rfc6901Decoder = strings.NewReplacer("~1", "/", "~0", "~") +) + +func decodePatchKey(k string) string { + return rfc6901Decoder.Replace(k) +} diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/.editorconfig b/integration-test/vendor/github.com/fsnotify/fsnotify/.editorconfig new file mode 100644 index 000000000..fad895851 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*.go] +indent_style = tab +indent_size = 4 +insert_final_newline = true + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/.gitattributes b/integration-test/vendor/github.com/fsnotify/fsnotify/.gitattributes new file mode 100644 index 000000000..32f1001be --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/.gitattributes @@ -0,0 +1 @@ +go.sum linguist-generated diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/.gitignore b/integration-test/vendor/github.com/fsnotify/fsnotify/.gitignore new file mode 100644 index 000000000..4cd0cbaf4 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/.gitignore @@ -0,0 +1,6 @@ +# Setup a Global .gitignore for OS and editor generated files: +# https://help.github.com/articles/ignoring-files +# git config --global core.excludesfile ~/.gitignore_global + +.vagrant +*.sublime-project diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/.travis.yml b/integration-test/vendor/github.com/fsnotify/fsnotify/.travis.yml new file mode 100644 index 000000000..a9c30165c --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/.travis.yml @@ -0,0 +1,36 @@ +sudo: false +language: go + +go: + - "stable" + - "1.11.x" + - "1.10.x" + - "1.9.x" + +matrix: + include: + - go: "stable" + env: GOLINT=true + allow_failures: + - go: tip + fast_finish: true + + +before_install: + - if [ ! -z "${GOLINT}" ]; then go get -u golang.org/x/lint/golint; fi + +script: + - go test --race ./... + +after_script: + - test -z "$(gofmt -s -l -w . | tee /dev/stderr)" + - if [ ! -z "${GOLINT}" ]; then echo running golint; golint --set_exit_status ./...; else echo skipping golint; fi + - go vet ./... + +os: + - linux + - osx + - windows + +notifications: + email: false diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/AUTHORS b/integration-test/vendor/github.com/fsnotify/fsnotify/AUTHORS new file mode 100644 index 000000000..5ab5d41c5 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/AUTHORS @@ -0,0 +1,52 @@ +# Names should be added to this file as +# Name or Organization +# The email address is not required for organizations. + +# You can update this list using the following command: +# +# $ git shortlog -se | awk '{print $2 " " $3 " " $4}' + +# Please keep the list sorted. + +Aaron L +Adrien Bustany +Amit Krishnan +Anmol Sethi +Bjørn Erik Pedersen +Bruno Bigras +Caleb Spare +Case Nelson +Chris Howey +Christoffer Buchholz +Daniel Wagner-Hall +Dave Cheney +Evan Phoenix +Francisco Souza +Hari haran +John C Barstow +Kelvin Fo +Ken-ichirou MATSUZAWA +Matt Layher +Nathan Youngman +Nickolai Zeldovich +Patrick +Paul Hammond +Pawel Knap +Pieter Droogendijk +Pursuit92 +Riku Voipio +Rob Figueiredo +Rodrigo Chiossi +Slawek Ligus +Soge Zhang +Tiffany Jernigan +Tilak Sharma +Tom Payne +Travis Cline +Tudor Golubenco +Vahe Khachikyan +Yukang +bronze1man +debrando +henrikedwards +铁哥 diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md b/integration-test/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md new file mode 100644 index 000000000..be4d7ea2c --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md @@ -0,0 +1,317 @@ +# Changelog + +## v1.4.7 / 2018-01-09 + +* BSD/macOS: Fix possible deadlock on closing the watcher on kqueue (thanks @nhooyr and @glycerine) +* Tests: Fix missing verb on format string (thanks @rchiossi) +* Linux: Fix deadlock in Remove (thanks @aarondl) +* Linux: Watch.Add improvements (avoid race, fix consistency, reduce garbage) (thanks @twpayne) +* Docs: Moved FAQ into the README (thanks @vahe) +* Linux: Properly handle inotify's IN_Q_OVERFLOW event (thanks @zeldovich) +* Docs: replace references to OS X with macOS + +## v1.4.2 / 2016-10-10 + +* Linux: use InotifyInit1 with IN_CLOEXEC to stop leaking a file descriptor to a child process when using fork/exec [#178](https://github.com/fsnotify/fsnotify/pull/178) (thanks @pattyshack) + +## v1.4.1 / 2016-10-04 + +* Fix flaky inotify stress test on Linux [#177](https://github.com/fsnotify/fsnotify/pull/177) (thanks @pattyshack) + +## v1.4.0 / 2016-10-01 + +* add a String() method to Event.Op [#165](https://github.com/fsnotify/fsnotify/pull/165) (thanks @oozie) + +## v1.3.1 / 2016-06-28 + +* Windows: fix for double backslash when watching the root of a drive [#151](https://github.com/fsnotify/fsnotify/issues/151) (thanks @brunoqc) + +## v1.3.0 / 2016-04-19 + +* Support linux/arm64 by [patching](https://go-review.googlesource.com/#/c/21971/) x/sys/unix and switching to to it from syscall (thanks @suihkulokki) [#135](https://github.com/fsnotify/fsnotify/pull/135) + +## v1.2.10 / 2016-03-02 + +* Fix golint errors in windows.go [#121](https://github.com/fsnotify/fsnotify/pull/121) (thanks @tiffanyfj) + +## v1.2.9 / 2016-01-13 + +kqueue: Fix logic for CREATE after REMOVE [#111](https://github.com/fsnotify/fsnotify/pull/111) (thanks @bep) + +## v1.2.8 / 2015-12-17 + +* kqueue: fix race condition in Close [#105](https://github.com/fsnotify/fsnotify/pull/105) (thanks @djui for reporting the issue and @ppknap for writing a failing test) +* inotify: fix race in test +* enable race detection for continuous integration (Linux, Mac, Windows) + +## v1.2.5 / 2015-10-17 + +* inotify: use epoll_create1 for arm64 support (requires Linux 2.6.27 or later) [#100](https://github.com/fsnotify/fsnotify/pull/100) (thanks @suihkulokki) +* inotify: fix path leaks [#73](https://github.com/fsnotify/fsnotify/pull/73) (thanks @chamaken) +* kqueue: watch for rename events on subdirectories [#83](https://github.com/fsnotify/fsnotify/pull/83) (thanks @guotie) +* kqueue: avoid infinite loops from symlinks cycles [#101](https://github.com/fsnotify/fsnotify/pull/101) (thanks @illicitonion) + +## v1.2.1 / 2015-10-14 + +* kqueue: don't watch named pipes [#98](https://github.com/fsnotify/fsnotify/pull/98) (thanks @evanphx) + +## v1.2.0 / 2015-02-08 + +* inotify: use epoll to wake up readEvents [#66](https://github.com/fsnotify/fsnotify/pull/66) (thanks @PieterD) +* inotify: closing watcher should now always shut down goroutine [#63](https://github.com/fsnotify/fsnotify/pull/63) (thanks @PieterD) +* kqueue: close kqueue after removing watches, fixes [#59](https://github.com/fsnotify/fsnotify/issues/59) + +## v1.1.1 / 2015-02-05 + +* inotify: Retry read on EINTR [#61](https://github.com/fsnotify/fsnotify/issues/61) (thanks @PieterD) + +## v1.1.0 / 2014-12-12 + +* kqueue: rework internals [#43](https://github.com/fsnotify/fsnotify/pull/43) + * add low-level functions + * only need to store flags on directories + * less mutexes [#13](https://github.com/fsnotify/fsnotify/issues/13) + * done can be an unbuffered channel + * remove calls to os.NewSyscallError +* More efficient string concatenation for Event.String() [#52](https://github.com/fsnotify/fsnotify/pull/52) (thanks @mdlayher) +* kqueue: fix regression in rework causing subdirectories to be watched [#48](https://github.com/fsnotify/fsnotify/issues/48) +* kqueue: cleanup internal watch before sending remove event [#51](https://github.com/fsnotify/fsnotify/issues/51) + +## v1.0.4 / 2014-09-07 + +* kqueue: add dragonfly to the build tags. +* Rename source code files, rearrange code so exported APIs are at the top. +* Add done channel to example code. [#37](https://github.com/fsnotify/fsnotify/pull/37) (thanks @chenyukang) + +## v1.0.3 / 2014-08-19 + +* [Fix] Windows MOVED_TO now translates to Create like on BSD and Linux. [#36](https://github.com/fsnotify/fsnotify/issues/36) + +## v1.0.2 / 2014-08-17 + +* [Fix] Missing create events on macOS. [#14](https://github.com/fsnotify/fsnotify/issues/14) (thanks @zhsso) +* [Fix] Make ./path and path equivalent. (thanks @zhsso) + +## v1.0.0 / 2014-08-15 + +* [API] Remove AddWatch on Windows, use Add. +* Improve documentation for exported identifiers. [#30](https://github.com/fsnotify/fsnotify/issues/30) +* Minor updates based on feedback from golint. + +## dev / 2014-07-09 + +* Moved to [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify). +* Use os.NewSyscallError instead of returning errno (thanks @hariharan-uno) + +## dev / 2014-07-04 + +* kqueue: fix incorrect mutex used in Close() +* Update example to demonstrate usage of Op. + +## dev / 2014-06-28 + +* [API] Don't set the Write Op for attribute notifications [#4](https://github.com/fsnotify/fsnotify/issues/4) +* Fix for String() method on Event (thanks Alex Brainman) +* Don't build on Plan 9 or Solaris (thanks @4ad) + +## dev / 2014-06-21 + +* Events channel of type Event rather than *Event. +* [internal] use syscall constants directly for inotify and kqueue. +* [internal] kqueue: rename events to kevents and fileEvent to event. + +## dev / 2014-06-19 + +* Go 1.3+ required on Windows (uses syscall.ERROR_MORE_DATA internally). +* [internal] remove cookie from Event struct (unused). +* [internal] Event struct has the same definition across every OS. +* [internal] remove internal watch and removeWatch methods. + +## dev / 2014-06-12 + +* [API] Renamed Watch() to Add() and RemoveWatch() to Remove(). +* [API] Pluralized channel names: Events and Errors. +* [API] Renamed FileEvent struct to Event. +* [API] Op constants replace methods like IsCreate(). + +## dev / 2014-06-12 + +* Fix data race on kevent buffer (thanks @tilaks) [#98](https://github.com/howeyc/fsnotify/pull/98) + +## dev / 2014-05-23 + +* [API] Remove current implementation of WatchFlags. + * current implementation doesn't take advantage of OS for efficiency + * provides little benefit over filtering events as they are received, but has extra bookkeeping and mutexes + * no tests for the current implementation + * not fully implemented on Windows [#93](https://github.com/howeyc/fsnotify/issues/93#issuecomment-39285195) + +## v0.9.3 / 2014-12-31 + +* kqueue: cleanup internal watch before sending remove event [#51](https://github.com/fsnotify/fsnotify/issues/51) + +## v0.9.2 / 2014-08-17 + +* [Backport] Fix missing create events on macOS. [#14](https://github.com/fsnotify/fsnotify/issues/14) (thanks @zhsso) + +## v0.9.1 / 2014-06-12 + +* Fix data race on kevent buffer (thanks @tilaks) [#98](https://github.com/howeyc/fsnotify/pull/98) + +## v0.9.0 / 2014-01-17 + +* IsAttrib() for events that only concern a file's metadata [#79][] (thanks @abustany) +* [Fix] kqueue: fix deadlock [#77][] (thanks @cespare) +* [NOTICE] Development has moved to `code.google.com/p/go.exp/fsnotify` in preparation for inclusion in the Go standard library. + +## v0.8.12 / 2013-11-13 + +* [API] Remove FD_SET and friends from Linux adapter + +## v0.8.11 / 2013-11-02 + +* [Doc] Add Changelog [#72][] (thanks @nathany) +* [Doc] Spotlight and double modify events on macOS [#62][] (reported by @paulhammond) + +## v0.8.10 / 2013-10-19 + +* [Fix] kqueue: remove file watches when parent directory is removed [#71][] (reported by @mdwhatcott) +* [Fix] kqueue: race between Close and readEvents [#70][] (reported by @bernerdschaefer) +* [Doc] specify OS-specific limits in README (thanks @debrando) + +## v0.8.9 / 2013-09-08 + +* [Doc] Contributing (thanks @nathany) +* [Doc] update package path in example code [#63][] (thanks @paulhammond) +* [Doc] GoCI badge in README (Linux only) [#60][] +* [Doc] Cross-platform testing with Vagrant [#59][] (thanks @nathany) + +## v0.8.8 / 2013-06-17 + +* [Fix] Windows: handle `ERROR_MORE_DATA` on Windows [#49][] (thanks @jbowtie) + +## v0.8.7 / 2013-06-03 + +* [API] Make syscall flags internal +* [Fix] inotify: ignore event changes +* [Fix] race in symlink test [#45][] (reported by @srid) +* [Fix] tests on Windows +* lower case error messages + +## v0.8.6 / 2013-05-23 + +* kqueue: Use EVT_ONLY flag on Darwin +* [Doc] Update README with full example + +## v0.8.5 / 2013-05-09 + +* [Fix] inotify: allow monitoring of "broken" symlinks (thanks @tsg) + +## v0.8.4 / 2013-04-07 + +* [Fix] kqueue: watch all file events [#40][] (thanks @ChrisBuchholz) + +## v0.8.3 / 2013-03-13 + +* [Fix] inoitfy/kqueue memory leak [#36][] (reported by @nbkolchin) +* [Fix] kqueue: use fsnFlags for watching a directory [#33][] (reported by @nbkolchin) + +## v0.8.2 / 2013-02-07 + +* [Doc] add Authors +* [Fix] fix data races for map access [#29][] (thanks @fsouza) + +## v0.8.1 / 2013-01-09 + +* [Fix] Windows path separators +* [Doc] BSD License + +## v0.8.0 / 2012-11-09 + +* kqueue: directory watching improvements (thanks @vmirage) +* inotify: add `IN_MOVED_TO` [#25][] (requested by @cpisto) +* [Fix] kqueue: deleting watched directory [#24][] (reported by @jakerr) + +## v0.7.4 / 2012-10-09 + +* [Fix] inotify: fixes from https://codereview.appspot.com/5418045/ (ugorji) +* [Fix] kqueue: preserve watch flags when watching for delete [#21][] (reported by @robfig) +* [Fix] kqueue: watch the directory even if it isn't a new watch (thanks @robfig) +* [Fix] kqueue: modify after recreation of file + +## v0.7.3 / 2012-09-27 + +* [Fix] kqueue: watch with an existing folder inside the watched folder (thanks @vmirage) +* [Fix] kqueue: no longer get duplicate CREATE events + +## v0.7.2 / 2012-09-01 + +* kqueue: events for created directories + +## v0.7.1 / 2012-07-14 + +* [Fix] for renaming files + +## v0.7.0 / 2012-07-02 + +* [Feature] FSNotify flags +* [Fix] inotify: Added file name back to event path + +## v0.6.0 / 2012-06-06 + +* kqueue: watch files after directory created (thanks @tmc) + +## v0.5.1 / 2012-05-22 + +* [Fix] inotify: remove all watches before Close() + +## v0.5.0 / 2012-05-03 + +* [API] kqueue: return errors during watch instead of sending over channel +* kqueue: match symlink behavior on Linux +* inotify: add `DELETE_SELF` (requested by @taralx) +* [Fix] kqueue: handle EINTR (reported by @robfig) +* [Doc] Godoc example [#1][] (thanks @davecheney) + +## v0.4.0 / 2012-03-30 + +* Go 1 released: build with go tool +* [Feature] Windows support using winfsnotify +* Windows does not have attribute change notifications +* Roll attribute notifications into IsModify + +## v0.3.0 / 2012-02-19 + +* kqueue: add files when watch directory + +## v0.2.0 / 2011-12-30 + +* update to latest Go weekly code + +## v0.1.0 / 2011-10-19 + +* kqueue: add watch on file creation to match inotify +* kqueue: create file event +* inotify: ignore `IN_IGNORED` events +* event String() +* linux: common FileEvent functions +* initial commit + +[#79]: https://github.com/howeyc/fsnotify/pull/79 +[#77]: https://github.com/howeyc/fsnotify/pull/77 +[#72]: https://github.com/howeyc/fsnotify/issues/72 +[#71]: https://github.com/howeyc/fsnotify/issues/71 +[#70]: https://github.com/howeyc/fsnotify/issues/70 +[#63]: https://github.com/howeyc/fsnotify/issues/63 +[#62]: https://github.com/howeyc/fsnotify/issues/62 +[#60]: https://github.com/howeyc/fsnotify/issues/60 +[#59]: https://github.com/howeyc/fsnotify/issues/59 +[#49]: https://github.com/howeyc/fsnotify/issues/49 +[#45]: https://github.com/howeyc/fsnotify/issues/45 +[#40]: https://github.com/howeyc/fsnotify/issues/40 +[#36]: https://github.com/howeyc/fsnotify/issues/36 +[#33]: https://github.com/howeyc/fsnotify/issues/33 +[#29]: https://github.com/howeyc/fsnotify/issues/29 +[#25]: https://github.com/howeyc/fsnotify/issues/25 +[#24]: https://github.com/howeyc/fsnotify/issues/24 +[#21]: https://github.com/howeyc/fsnotify/issues/21 diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md b/integration-test/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md new file mode 100644 index 000000000..828a60b24 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md @@ -0,0 +1,77 @@ +# Contributing + +## Issues + +* Request features and report bugs using the [GitHub Issue Tracker](https://github.com/fsnotify/fsnotify/issues). +* Please indicate the platform you are using fsnotify on. +* A code example to reproduce the problem is appreciated. + +## Pull Requests + +### Contributor License Agreement + +fsnotify is derived from code in the [golang.org/x/exp](https://godoc.org/golang.org/x/exp) package and it may be included [in the standard library](https://github.com/fsnotify/fsnotify/issues/1) in the future. Therefore fsnotify carries the same [LICENSE](https://github.com/fsnotify/fsnotify/blob/master/LICENSE) as Go. Contributors retain their copyright, so you need to fill out a short form before we can accept your contribution: [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual). + +Please indicate that you have signed the CLA in your pull request. + +### How fsnotify is Developed + +* Development is done on feature branches. +* Tests are run on BSD, Linux, macOS and Windows. +* Pull requests are reviewed and [applied to master][am] using [hub][]. + * Maintainers may modify or squash commits rather than asking contributors to. +* To issue a new release, the maintainers will: + * Update the CHANGELOG + * Tag a version, which will become available through gopkg.in. + +### How to Fork + +For smooth sailing, always use the original import path. Installing with `go get` makes this easy. + +1. Install from GitHub (`go get -u github.com/fsnotify/fsnotify`) +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Ensure everything works and the tests pass (see below) +4. Commit your changes (`git commit -am 'Add some feature'`) + +Contribute upstream: + +1. Fork fsnotify on GitHub +2. Add your remote (`git remote add fork git@github.com:mycompany/repo.git`) +3. Push to the branch (`git push fork my-new-feature`) +4. Create a new Pull Request on GitHub + +This workflow is [thoroughly explained by Katrina Owen](https://splice.com/blog/contributing-open-source-git-repositories-go/). + +### Testing + +fsnotify uses build tags to compile different code on Linux, BSD, macOS, and Windows. + +Before doing a pull request, please do your best to test your changes on multiple platforms, and list which platforms you were able/unable to test on. + +To aid in cross-platform testing there is a Vagrantfile for Linux and BSD. + +* Install [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) +* Setup [Vagrant Gopher](https://github.com/nathany/vagrant-gopher) in your `src` folder. +* Run `vagrant up` from the project folder. You can also setup just one box with `vagrant up linux` or `vagrant up bsd` (note: the BSD box doesn't support Windows hosts at this time, and NFS may prompt for your host OS password) +* Once setup, you can run the test suite on a given OS with a single command `vagrant ssh linux -c 'cd fsnotify/fsnotify; go test'`. +* When you're done, you will want to halt or destroy the Vagrant boxes. + +Notice: fsnotify file system events won't trigger in shared folders. The tests get around this limitation by using the /tmp directory. + +Right now there is no equivalent solution for Windows and macOS, but there are Windows VMs [freely available from Microsoft](http://www.modern.ie/en-us/virtualization-tools#downloads). + +### Maintainers + +Help maintaining fsnotify is welcome. To be a maintainer: + +* Submit a pull request and sign the CLA as above. +* You must be able to run the test suite on Mac, Windows, Linux and BSD. + +To keep master clean, the fsnotify project uses the "apply mail" workflow outlined in Nathaniel Talbott's post ["Merge pull request" Considered Harmful][am]. This requires installing [hub][]. + +All code changes should be internal pull requests. + +Releases are tagged using [Semantic Versioning](http://semver.org/). + +[hub]: https://github.com/github/hub +[am]: http://blog.spreedly.com/2014/06/24/merge-pull-request-considered-harmful/#.VGa5yZPF_Zs diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/LICENSE b/integration-test/vendor/github.com/fsnotify/fsnotify/LICENSE new file mode 100644 index 000000000..e180c8fb0 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2012 The Go Authors. All rights reserved. +Copyright (c) 2012-2019 fsnotify Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/README.md b/integration-test/vendor/github.com/fsnotify/fsnotify/README.md new file mode 100644 index 000000000..b2629e522 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/README.md @@ -0,0 +1,130 @@ +# File system notifications for Go + +[![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify) + +fsnotify utilizes [golang.org/x/sys](https://godoc.org/golang.org/x/sys) rather than `syscall` from the standard library. Ensure you have the latest version installed by running: + +```console +go get -u golang.org/x/sys/... +``` + +Cross platform: Windows, Linux, BSD and macOS. + +| Adapter | OS | Status | +| --------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| inotify | Linux 2.6.27 or later, Android\* | Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify) | +| kqueue | BSD, macOS, iOS\* | Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify) | +| ReadDirectoryChangesW | Windows | Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify) | +| FSEvents | macOS | [Planned](https://github.com/fsnotify/fsnotify/issues/11) | +| FEN | Solaris 11 | [In Progress](https://github.com/fsnotify/fsnotify/issues/12) | +| fanotify | Linux 2.6.37+ | [Planned](https://github.com/fsnotify/fsnotify/issues/114) | +| USN Journals | Windows | [Maybe](https://github.com/fsnotify/fsnotify/issues/53) | +| Polling | *All* | [Maybe](https://github.com/fsnotify/fsnotify/issues/9) | + +\* Android and iOS are untested. + +Please see [the documentation](https://godoc.org/github.com/fsnotify/fsnotify) and consult the [FAQ](#faq) for usage information. + +## API stability + +fsnotify is a fork of [howeyc/fsnotify](https://godoc.org/github.com/howeyc/fsnotify) with a new API as of v1.0. The API is based on [this design document](http://goo.gl/MrYxyA). + +All [releases](https://github.com/fsnotify/fsnotify/releases) are tagged based on [Semantic Versioning](http://semver.org/). Further API changes are [planned](https://github.com/fsnotify/fsnotify/milestones), and will be tagged with a new major revision number. + +Go 1.6 supports dependencies located in the `vendor/` folder. Unless you are creating a library, it is recommended that you copy fsnotify into `vendor/github.com/fsnotify/fsnotify` within your project, and likewise for `golang.org/x/sys`. + +## Usage + +```go +package main + +import ( + "log" + + "github.com/fsnotify/fsnotify" +) + +func main() { + watcher, err := fsnotify.NewWatcher() + if err != nil { + log.Fatal(err) + } + defer watcher.Close() + + done := make(chan bool) + go func() { + for { + select { + case event, ok := <-watcher.Events: + if !ok { + return + } + log.Println("event:", event) + if event.Op&fsnotify.Write == fsnotify.Write { + log.Println("modified file:", event.Name) + } + case err, ok := <-watcher.Errors: + if !ok { + return + } + log.Println("error:", err) + } + } + }() + + err = watcher.Add("/tmp/foo") + if err != nil { + log.Fatal(err) + } + <-done +} +``` + +## Contributing + +Please refer to [CONTRIBUTING][] before opening an issue or pull request. + +## Example + +See [example_test.go](https://github.com/fsnotify/fsnotify/blob/master/example_test.go). + +## FAQ + +**When a file is moved to another directory is it still being watched?** + +No (it shouldn't be, unless you are watching where it was moved to). + +**When I watch a directory, are all subdirectories watched as well?** + +No, you must add watches for any directory you want to watch (a recursive watcher is on the roadmap [#18][]). + +**Do I have to watch the Error and Event channels in a separate goroutine?** + +As of now, yes. Looking into making this single-thread friendly (see [howeyc #7][#7]) + +**Why am I receiving multiple events for the same file on OS X?** + +Spotlight indexing on OS X can result in multiple events (see [howeyc #62][#62]). A temporary workaround is to add your folder(s) to the *Spotlight Privacy settings* until we have a native FSEvents implementation (see [#11][]). + +**How many files can be watched at once?** + +There are OS-specific limits as to how many watches can be created: +* Linux: /proc/sys/fs/inotify/max_user_watches contains the limit, reaching this limit results in a "no space left on device" error. +* BSD / OSX: sysctl variables "kern.maxfiles" and "kern.maxfilesperproc", reaching these limits results in a "too many open files" error. + +**Why don't notifications work with NFS filesystems or filesystem in userspace (FUSE)?** + +fsnotify requires support from underlying OS to work. The current NFS protocol does not provide network level support for file notifications. + +[#62]: https://github.com/howeyc/fsnotify/issues/62 +[#18]: https://github.com/fsnotify/fsnotify/issues/18 +[#11]: https://github.com/fsnotify/fsnotify/issues/11 +[#7]: https://github.com/howeyc/fsnotify/issues/7 + +[contributing]: https://github.com/fsnotify/fsnotify/blob/master/CONTRIBUTING.md + +## Related Projects + +* [notify](https://github.com/rjeczalik/notify) +* [fsevents](https://github.com/fsnotify/fsevents) + diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/fen.go b/integration-test/vendor/github.com/fsnotify/fsnotify/fen.go new file mode 100644 index 000000000..ced39cb88 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/fen.go @@ -0,0 +1,37 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build solaris + +package fsnotify + +import ( + "errors" +) + +// Watcher watches a set of files, delivering events to a channel. +type Watcher struct { + Events chan Event + Errors chan error +} + +// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. +func NewWatcher() (*Watcher, error) { + return nil, errors.New("FEN based watcher not yet supported for fsnotify\n") +} + +// Close removes all watches and closes the events channel. +func (w *Watcher) Close() error { + return nil +} + +// Add starts watching the named file or directory (non-recursively). +func (w *Watcher) Add(name string) error { + return nil +} + +// Remove stops watching the the named file or directory (non-recursively). +func (w *Watcher) Remove(name string) error { + return nil +} diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/fsnotify.go b/integration-test/vendor/github.com/fsnotify/fsnotify/fsnotify.go new file mode 100644 index 000000000..89cab046d --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/fsnotify.go @@ -0,0 +1,68 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !plan9 + +// Package fsnotify provides a platform-independent interface for file system notifications. +package fsnotify + +import ( + "bytes" + "errors" + "fmt" +) + +// Event represents a single file system notification. +type Event struct { + Name string // Relative path to the file or directory. + Op Op // File operation that triggered the event. +} + +// Op describes a set of file operations. +type Op uint32 + +// These are the generalized file operations that can trigger a notification. +const ( + Create Op = 1 << iota + Write + Remove + Rename + Chmod +) + +func (op Op) String() string { + // Use a buffer for efficient string concatenation + var buffer bytes.Buffer + + if op&Create == Create { + buffer.WriteString("|CREATE") + } + if op&Remove == Remove { + buffer.WriteString("|REMOVE") + } + if op&Write == Write { + buffer.WriteString("|WRITE") + } + if op&Rename == Rename { + buffer.WriteString("|RENAME") + } + if op&Chmod == Chmod { + buffer.WriteString("|CHMOD") + } + if buffer.Len() == 0 { + return "" + } + return buffer.String()[1:] // Strip leading pipe +} + +// String returns a string representation of the event in the form +// "file: REMOVE|WRITE|..." +func (e Event) String() string { + return fmt.Sprintf("%q: %s", e.Name, e.Op.String()) +} + +// Common errors that can be reported by a watcher +var ( + ErrEventOverflow = errors.New("fsnotify queue overflow") +) diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/inotify.go b/integration-test/vendor/github.com/fsnotify/fsnotify/inotify.go new file mode 100644 index 000000000..d9fd1b88a --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/inotify.go @@ -0,0 +1,337 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux + +package fsnotify + +import ( + "errors" + "fmt" + "io" + "os" + "path/filepath" + "strings" + "sync" + "unsafe" + + "golang.org/x/sys/unix" +) + +// Watcher watches a set of files, delivering events to a channel. +type Watcher struct { + Events chan Event + Errors chan error + mu sync.Mutex // Map access + fd int + poller *fdPoller + watches map[string]*watch // Map of inotify watches (key: path) + paths map[int]string // Map of watched paths (key: watch descriptor) + done chan struct{} // Channel for sending a "quit message" to the reader goroutine + doneResp chan struct{} // Channel to respond to Close +} + +// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. +func NewWatcher() (*Watcher, error) { + // Create inotify fd + fd, errno := unix.InotifyInit1(unix.IN_CLOEXEC) + if fd == -1 { + return nil, errno + } + // Create epoll + poller, err := newFdPoller(fd) + if err != nil { + unix.Close(fd) + return nil, err + } + w := &Watcher{ + fd: fd, + poller: poller, + watches: make(map[string]*watch), + paths: make(map[int]string), + Events: make(chan Event), + Errors: make(chan error), + done: make(chan struct{}), + doneResp: make(chan struct{}), + } + + go w.readEvents() + return w, nil +} + +func (w *Watcher) isClosed() bool { + select { + case <-w.done: + return true + default: + return false + } +} + +// Close removes all watches and closes the events channel. +func (w *Watcher) Close() error { + if w.isClosed() { + return nil + } + + // Send 'close' signal to goroutine, and set the Watcher to closed. + close(w.done) + + // Wake up goroutine + w.poller.wake() + + // Wait for goroutine to close + <-w.doneResp + + return nil +} + +// Add starts watching the named file or directory (non-recursively). +func (w *Watcher) Add(name string) error { + name = filepath.Clean(name) + if w.isClosed() { + return errors.New("inotify instance already closed") + } + + const agnosticEvents = unix.IN_MOVED_TO | unix.IN_MOVED_FROM | + unix.IN_CREATE | unix.IN_ATTRIB | unix.IN_MODIFY | + unix.IN_MOVE_SELF | unix.IN_DELETE | unix.IN_DELETE_SELF + + var flags uint32 = agnosticEvents + + w.mu.Lock() + defer w.mu.Unlock() + watchEntry := w.watches[name] + if watchEntry != nil { + flags |= watchEntry.flags | unix.IN_MASK_ADD + } + wd, errno := unix.InotifyAddWatch(w.fd, name, flags) + if wd == -1 { + return errno + } + + if watchEntry == nil { + w.watches[name] = &watch{wd: uint32(wd), flags: flags} + w.paths[wd] = name + } else { + watchEntry.wd = uint32(wd) + watchEntry.flags = flags + } + + return nil +} + +// Remove stops watching the named file or directory (non-recursively). +func (w *Watcher) Remove(name string) error { + name = filepath.Clean(name) + + // Fetch the watch. + w.mu.Lock() + defer w.mu.Unlock() + watch, ok := w.watches[name] + + // Remove it from inotify. + if !ok { + return fmt.Errorf("can't remove non-existent inotify watch for: %s", name) + } + + // We successfully removed the watch if InotifyRmWatch doesn't return an + // error, we need to clean up our internal state to ensure it matches + // inotify's kernel state. + delete(w.paths, int(watch.wd)) + delete(w.watches, name) + + // inotify_rm_watch will return EINVAL if the file has been deleted; + // the inotify will already have been removed. + // watches and pathes are deleted in ignoreLinux() implicitly and asynchronously + // by calling inotify_rm_watch() below. e.g. readEvents() goroutine receives IN_IGNORE + // so that EINVAL means that the wd is being rm_watch()ed or its file removed + // by another thread and we have not received IN_IGNORE event. + success, errno := unix.InotifyRmWatch(w.fd, watch.wd) + if success == -1 { + // TODO: Perhaps it's not helpful to return an error here in every case. + // the only two possible errors are: + // EBADF, which happens when w.fd is not a valid file descriptor of any kind. + // EINVAL, which is when fd is not an inotify descriptor or wd is not a valid watch descriptor. + // Watch descriptors are invalidated when they are removed explicitly or implicitly; + // explicitly by inotify_rm_watch, implicitly when the file they are watching is deleted. + return errno + } + + return nil +} + +type watch struct { + wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall) + flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags) +} + +// readEvents reads from the inotify file descriptor, converts the +// received events into Event objects and sends them via the Events channel +func (w *Watcher) readEvents() { + var ( + buf [unix.SizeofInotifyEvent * 4096]byte // Buffer for a maximum of 4096 raw events + n int // Number of bytes read with read() + errno error // Syscall errno + ok bool // For poller.wait + ) + + defer close(w.doneResp) + defer close(w.Errors) + defer close(w.Events) + defer unix.Close(w.fd) + defer w.poller.close() + + for { + // See if we have been closed. + if w.isClosed() { + return + } + + ok, errno = w.poller.wait() + if errno != nil { + select { + case w.Errors <- errno: + case <-w.done: + return + } + continue + } + + if !ok { + continue + } + + n, errno = unix.Read(w.fd, buf[:]) + // If a signal interrupted execution, see if we've been asked to close, and try again. + // http://man7.org/linux/man-pages/man7/signal.7.html : + // "Before Linux 3.8, reads from an inotify(7) file descriptor were not restartable" + if errno == unix.EINTR { + continue + } + + // unix.Read might have been woken up by Close. If so, we're done. + if w.isClosed() { + return + } + + if n < unix.SizeofInotifyEvent { + var err error + if n == 0 { + // If EOF is received. This should really never happen. + err = io.EOF + } else if n < 0 { + // If an error occurred while reading. + err = errno + } else { + // Read was too short. + err = errors.New("notify: short read in readEvents()") + } + select { + case w.Errors <- err: + case <-w.done: + return + } + continue + } + + var offset uint32 + // We don't know how many events we just read into the buffer + // While the offset points to at least one whole event... + for offset <= uint32(n-unix.SizeofInotifyEvent) { + // Point "raw" to the event in the buffer + raw := (*unix.InotifyEvent)(unsafe.Pointer(&buf[offset])) + + mask := uint32(raw.Mask) + nameLen := uint32(raw.Len) + + if mask&unix.IN_Q_OVERFLOW != 0 { + select { + case w.Errors <- ErrEventOverflow: + case <-w.done: + return + } + } + + // If the event happened to the watched directory or the watched file, the kernel + // doesn't append the filename to the event, but we would like to always fill the + // the "Name" field with a valid filename. We retrieve the path of the watch from + // the "paths" map. + w.mu.Lock() + name, ok := w.paths[int(raw.Wd)] + // IN_DELETE_SELF occurs when the file/directory being watched is removed. + // This is a sign to clean up the maps, otherwise we are no longer in sync + // with the inotify kernel state which has already deleted the watch + // automatically. + if ok && mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF { + delete(w.paths, int(raw.Wd)) + delete(w.watches, name) + } + w.mu.Unlock() + + if nameLen > 0 { + // Point "bytes" at the first byte of the filename + bytes := (*[unix.PathMax]byte)(unsafe.Pointer(&buf[offset+unix.SizeofInotifyEvent])) + // The filename is padded with NULL bytes. TrimRight() gets rid of those. + name += "/" + strings.TrimRight(string(bytes[0:nameLen]), "\000") + } + + event := newEvent(name, mask) + + // Send the events that are not ignored on the events channel + if !event.ignoreLinux(mask) { + select { + case w.Events <- event: + case <-w.done: + return + } + } + + // Move to the next event in the buffer + offset += unix.SizeofInotifyEvent + nameLen + } + } +} + +// Certain types of events can be "ignored" and not sent over the Events +// channel. Such as events marked ignore by the kernel, or MODIFY events +// against files that do not exist. +func (e *Event) ignoreLinux(mask uint32) bool { + // Ignore anything the inotify API says to ignore + if mask&unix.IN_IGNORED == unix.IN_IGNORED { + return true + } + + // If the event is not a DELETE or RENAME, the file must exist. + // Otherwise the event is ignored. + // *Note*: this was put in place because it was seen that a MODIFY + // event was sent after the DELETE. This ignores that MODIFY and + // assumes a DELETE will come or has come if the file doesn't exist. + if !(e.Op&Remove == Remove || e.Op&Rename == Rename) { + _, statErr := os.Lstat(e.Name) + return os.IsNotExist(statErr) + } + return false +} + +// newEvent returns an platform-independent Event based on an inotify mask. +func newEvent(name string, mask uint32) Event { + e := Event{Name: name} + if mask&unix.IN_CREATE == unix.IN_CREATE || mask&unix.IN_MOVED_TO == unix.IN_MOVED_TO { + e.Op |= Create + } + if mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF || mask&unix.IN_DELETE == unix.IN_DELETE { + e.Op |= Remove + } + if mask&unix.IN_MODIFY == unix.IN_MODIFY { + e.Op |= Write + } + if mask&unix.IN_MOVE_SELF == unix.IN_MOVE_SELF || mask&unix.IN_MOVED_FROM == unix.IN_MOVED_FROM { + e.Op |= Rename + } + if mask&unix.IN_ATTRIB == unix.IN_ATTRIB { + e.Op |= Chmod + } + return e +} diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/inotify_poller.go b/integration-test/vendor/github.com/fsnotify/fsnotify/inotify_poller.go new file mode 100644 index 000000000..b33f2b4d4 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/inotify_poller.go @@ -0,0 +1,187 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux + +package fsnotify + +import ( + "errors" + + "golang.org/x/sys/unix" +) + +type fdPoller struct { + fd int // File descriptor (as returned by the inotify_init() syscall) + epfd int // Epoll file descriptor + pipe [2]int // Pipe for waking up +} + +func emptyPoller(fd int) *fdPoller { + poller := new(fdPoller) + poller.fd = fd + poller.epfd = -1 + poller.pipe[0] = -1 + poller.pipe[1] = -1 + return poller +} + +// Create a new inotify poller. +// This creates an inotify handler, and an epoll handler. +func newFdPoller(fd int) (*fdPoller, error) { + var errno error + poller := emptyPoller(fd) + defer func() { + if errno != nil { + poller.close() + } + }() + poller.fd = fd + + // Create epoll fd + poller.epfd, errno = unix.EpollCreate1(unix.EPOLL_CLOEXEC) + if poller.epfd == -1 { + return nil, errno + } + // Create pipe; pipe[0] is the read end, pipe[1] the write end. + errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK|unix.O_CLOEXEC) + if errno != nil { + return nil, errno + } + + // Register inotify fd with epoll + event := unix.EpollEvent{ + Fd: int32(poller.fd), + Events: unix.EPOLLIN, + } + errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.fd, &event) + if errno != nil { + return nil, errno + } + + // Register pipe fd with epoll + event = unix.EpollEvent{ + Fd: int32(poller.pipe[0]), + Events: unix.EPOLLIN, + } + errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.pipe[0], &event) + if errno != nil { + return nil, errno + } + + return poller, nil +} + +// Wait using epoll. +// Returns true if something is ready to be read, +// false if there is not. +func (poller *fdPoller) wait() (bool, error) { + // 3 possible events per fd, and 2 fds, makes a maximum of 6 events. + // I don't know whether epoll_wait returns the number of events returned, + // or the total number of events ready. + // I decided to catch both by making the buffer one larger than the maximum. + events := make([]unix.EpollEvent, 7) + for { + n, errno := unix.EpollWait(poller.epfd, events, -1) + if n == -1 { + if errno == unix.EINTR { + continue + } + return false, errno + } + if n == 0 { + // If there are no events, try again. + continue + } + if n > 6 { + // This should never happen. More events were returned than should be possible. + return false, errors.New("epoll_wait returned more events than I know what to do with") + } + ready := events[:n] + epollhup := false + epollerr := false + epollin := false + for _, event := range ready { + if event.Fd == int32(poller.fd) { + if event.Events&unix.EPOLLHUP != 0 { + // This should not happen, but if it does, treat it as a wakeup. + epollhup = true + } + if event.Events&unix.EPOLLERR != 0 { + // If an error is waiting on the file descriptor, we should pretend + // something is ready to read, and let unix.Read pick up the error. + epollerr = true + } + if event.Events&unix.EPOLLIN != 0 { + // There is data to read. + epollin = true + } + } + if event.Fd == int32(poller.pipe[0]) { + if event.Events&unix.EPOLLHUP != 0 { + // Write pipe descriptor was closed, by us. This means we're closing down the + // watcher, and we should wake up. + } + if event.Events&unix.EPOLLERR != 0 { + // If an error is waiting on the pipe file descriptor. + // This is an absolute mystery, and should never ever happen. + return false, errors.New("Error on the pipe descriptor.") + } + if event.Events&unix.EPOLLIN != 0 { + // This is a regular wakeup, so we have to clear the buffer. + err := poller.clearWake() + if err != nil { + return false, err + } + } + } + } + + if epollhup || epollerr || epollin { + return true, nil + } + return false, nil + } +} + +// Close the write end of the poller. +func (poller *fdPoller) wake() error { + buf := make([]byte, 1) + n, errno := unix.Write(poller.pipe[1], buf) + if n == -1 { + if errno == unix.EAGAIN { + // Buffer is full, poller will wake. + return nil + } + return errno + } + return nil +} + +func (poller *fdPoller) clearWake() error { + // You have to be woken up a LOT in order to get to 100! + buf := make([]byte, 100) + n, errno := unix.Read(poller.pipe[0], buf) + if n == -1 { + if errno == unix.EAGAIN { + // Buffer is empty, someone else cleared our wake. + return nil + } + return errno + } + return nil +} + +// Close all poller file descriptors, but not the one passed to it. +func (poller *fdPoller) close() { + if poller.pipe[1] != -1 { + unix.Close(poller.pipe[1]) + } + if poller.pipe[0] != -1 { + unix.Close(poller.pipe[0]) + } + if poller.epfd != -1 { + unix.Close(poller.epfd) + } +} diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/kqueue.go b/integration-test/vendor/github.com/fsnotify/fsnotify/kqueue.go new file mode 100644 index 000000000..86e76a3d6 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/kqueue.go @@ -0,0 +1,521 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build freebsd openbsd netbsd dragonfly darwin + +package fsnotify + +import ( + "errors" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "sync" + "time" + + "golang.org/x/sys/unix" +) + +// Watcher watches a set of files, delivering events to a channel. +type Watcher struct { + Events chan Event + Errors chan error + done chan struct{} // Channel for sending a "quit message" to the reader goroutine + + kq int // File descriptor (as returned by the kqueue() syscall). + + mu sync.Mutex // Protects access to watcher data + watches map[string]int // Map of watched file descriptors (key: path). + externalWatches map[string]bool // Map of watches added by user of the library. + dirFlags map[string]uint32 // Map of watched directories to fflags used in kqueue. + paths map[int]pathInfo // Map file descriptors to path names for processing kqueue events. + fileExists map[string]bool // Keep track of if we know this file exists (to stop duplicate create events). + isClosed bool // Set to true when Close() is first called +} + +type pathInfo struct { + name string + isDir bool +} + +// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. +func NewWatcher() (*Watcher, error) { + kq, err := kqueue() + if err != nil { + return nil, err + } + + w := &Watcher{ + kq: kq, + watches: make(map[string]int), + dirFlags: make(map[string]uint32), + paths: make(map[int]pathInfo), + fileExists: make(map[string]bool), + externalWatches: make(map[string]bool), + Events: make(chan Event), + Errors: make(chan error), + done: make(chan struct{}), + } + + go w.readEvents() + return w, nil +} + +// Close removes all watches and closes the events channel. +func (w *Watcher) Close() error { + w.mu.Lock() + if w.isClosed { + w.mu.Unlock() + return nil + } + w.isClosed = true + + // copy paths to remove while locked + var pathsToRemove = make([]string, 0, len(w.watches)) + for name := range w.watches { + pathsToRemove = append(pathsToRemove, name) + } + w.mu.Unlock() + // unlock before calling Remove, which also locks + + for _, name := range pathsToRemove { + w.Remove(name) + } + + // send a "quit" message to the reader goroutine + close(w.done) + + return nil +} + +// Add starts watching the named file or directory (non-recursively). +func (w *Watcher) Add(name string) error { + w.mu.Lock() + w.externalWatches[name] = true + w.mu.Unlock() + _, err := w.addWatch(name, noteAllEvents) + return err +} + +// Remove stops watching the the named file or directory (non-recursively). +func (w *Watcher) Remove(name string) error { + name = filepath.Clean(name) + w.mu.Lock() + watchfd, ok := w.watches[name] + w.mu.Unlock() + if !ok { + return fmt.Errorf("can't remove non-existent kevent watch for: %s", name) + } + + const registerRemove = unix.EV_DELETE + if err := register(w.kq, []int{watchfd}, registerRemove, 0); err != nil { + return err + } + + unix.Close(watchfd) + + w.mu.Lock() + isDir := w.paths[watchfd].isDir + delete(w.watches, name) + delete(w.paths, watchfd) + delete(w.dirFlags, name) + w.mu.Unlock() + + // Find all watched paths that are in this directory that are not external. + if isDir { + var pathsToRemove []string + w.mu.Lock() + for _, path := range w.paths { + wdir, _ := filepath.Split(path.name) + if filepath.Clean(wdir) == name { + if !w.externalWatches[path.name] { + pathsToRemove = append(pathsToRemove, path.name) + } + } + } + w.mu.Unlock() + for _, name := range pathsToRemove { + // Since these are internal, not much sense in propagating error + // to the user, as that will just confuse them with an error about + // a path they did not explicitly watch themselves. + w.Remove(name) + } + } + + return nil +} + +// Watch all events (except NOTE_EXTEND, NOTE_LINK, NOTE_REVOKE) +const noteAllEvents = unix.NOTE_DELETE | unix.NOTE_WRITE | unix.NOTE_ATTRIB | unix.NOTE_RENAME + +// keventWaitTime to block on each read from kevent +var keventWaitTime = durationToTimespec(100 * time.Millisecond) + +// addWatch adds name to the watched file set. +// The flags are interpreted as described in kevent(2). +// Returns the real path to the file which was added, if any, which may be different from the one passed in the case of symlinks. +func (w *Watcher) addWatch(name string, flags uint32) (string, error) { + var isDir bool + // Make ./name and name equivalent + name = filepath.Clean(name) + + w.mu.Lock() + if w.isClosed { + w.mu.Unlock() + return "", errors.New("kevent instance already closed") + } + watchfd, alreadyWatching := w.watches[name] + // We already have a watch, but we can still override flags. + if alreadyWatching { + isDir = w.paths[watchfd].isDir + } + w.mu.Unlock() + + if !alreadyWatching { + fi, err := os.Lstat(name) + if err != nil { + return "", err + } + + // Don't watch sockets. + if fi.Mode()&os.ModeSocket == os.ModeSocket { + return "", nil + } + + // Don't watch named pipes. + if fi.Mode()&os.ModeNamedPipe == os.ModeNamedPipe { + return "", nil + } + + // Follow Symlinks + // Unfortunately, Linux can add bogus symlinks to watch list without + // issue, and Windows can't do symlinks period (AFAIK). To maintain + // consistency, we will act like everything is fine. There will simply + // be no file events for broken symlinks. + // Hence the returns of nil on errors. + if fi.Mode()&os.ModeSymlink == os.ModeSymlink { + name, err = filepath.EvalSymlinks(name) + if err != nil { + return "", nil + } + + w.mu.Lock() + _, alreadyWatching = w.watches[name] + w.mu.Unlock() + + if alreadyWatching { + return name, nil + } + + fi, err = os.Lstat(name) + if err != nil { + return "", nil + } + } + + watchfd, err = unix.Open(name, openMode, 0700) + if watchfd == -1 { + return "", err + } + + isDir = fi.IsDir() + } + + const registerAdd = unix.EV_ADD | unix.EV_CLEAR | unix.EV_ENABLE + if err := register(w.kq, []int{watchfd}, registerAdd, flags); err != nil { + unix.Close(watchfd) + return "", err + } + + if !alreadyWatching { + w.mu.Lock() + w.watches[name] = watchfd + w.paths[watchfd] = pathInfo{name: name, isDir: isDir} + w.mu.Unlock() + } + + if isDir { + // Watch the directory if it has not been watched before, + // or if it was watched before, but perhaps only a NOTE_DELETE (watchDirectoryFiles) + w.mu.Lock() + + watchDir := (flags&unix.NOTE_WRITE) == unix.NOTE_WRITE && + (!alreadyWatching || (w.dirFlags[name]&unix.NOTE_WRITE) != unix.NOTE_WRITE) + // Store flags so this watch can be updated later + w.dirFlags[name] = flags + w.mu.Unlock() + + if watchDir { + if err := w.watchDirectoryFiles(name); err != nil { + return "", err + } + } + } + return name, nil +} + +// readEvents reads from kqueue and converts the received kevents into +// Event values that it sends down the Events channel. +func (w *Watcher) readEvents() { + eventBuffer := make([]unix.Kevent_t, 10) + +loop: + for { + // See if there is a message on the "done" channel + select { + case <-w.done: + break loop + default: + } + + // Get new events + kevents, err := read(w.kq, eventBuffer, &keventWaitTime) + // EINTR is okay, the syscall was interrupted before timeout expired. + if err != nil && err != unix.EINTR { + select { + case w.Errors <- err: + case <-w.done: + break loop + } + continue + } + + // Flush the events we received to the Events channel + for len(kevents) > 0 { + kevent := &kevents[0] + watchfd := int(kevent.Ident) + mask := uint32(kevent.Fflags) + w.mu.Lock() + path := w.paths[watchfd] + w.mu.Unlock() + event := newEvent(path.name, mask) + + if path.isDir && !(event.Op&Remove == Remove) { + // Double check to make sure the directory exists. This can happen when + // we do a rm -fr on a recursively watched folders and we receive a + // modification event first but the folder has been deleted and later + // receive the delete event + if _, err := os.Lstat(event.Name); os.IsNotExist(err) { + // mark is as delete event + event.Op |= Remove + } + } + + if event.Op&Rename == Rename || event.Op&Remove == Remove { + w.Remove(event.Name) + w.mu.Lock() + delete(w.fileExists, event.Name) + w.mu.Unlock() + } + + if path.isDir && event.Op&Write == Write && !(event.Op&Remove == Remove) { + w.sendDirectoryChangeEvents(event.Name) + } else { + // Send the event on the Events channel. + select { + case w.Events <- event: + case <-w.done: + break loop + } + } + + if event.Op&Remove == Remove { + // Look for a file that may have overwritten this. + // For example, mv f1 f2 will delete f2, then create f2. + if path.isDir { + fileDir := filepath.Clean(event.Name) + w.mu.Lock() + _, found := w.watches[fileDir] + w.mu.Unlock() + if found { + // make sure the directory exists before we watch for changes. When we + // do a recursive watch and perform rm -fr, the parent directory might + // have gone missing, ignore the missing directory and let the + // upcoming delete event remove the watch from the parent directory. + if _, err := os.Lstat(fileDir); err == nil { + w.sendDirectoryChangeEvents(fileDir) + } + } + } else { + filePath := filepath.Clean(event.Name) + if fileInfo, err := os.Lstat(filePath); err == nil { + w.sendFileCreatedEventIfNew(filePath, fileInfo) + } + } + } + + // Move to next event + kevents = kevents[1:] + } + } + + // cleanup + err := unix.Close(w.kq) + if err != nil { + // only way the previous loop breaks is if w.done was closed so we need to async send to w.Errors. + select { + case w.Errors <- err: + default: + } + } + close(w.Events) + close(w.Errors) +} + +// newEvent returns an platform-independent Event based on kqueue Fflags. +func newEvent(name string, mask uint32) Event { + e := Event{Name: name} + if mask&unix.NOTE_DELETE == unix.NOTE_DELETE { + e.Op |= Remove + } + if mask&unix.NOTE_WRITE == unix.NOTE_WRITE { + e.Op |= Write + } + if mask&unix.NOTE_RENAME == unix.NOTE_RENAME { + e.Op |= Rename + } + if mask&unix.NOTE_ATTRIB == unix.NOTE_ATTRIB { + e.Op |= Chmod + } + return e +} + +func newCreateEvent(name string) Event { + return Event{Name: name, Op: Create} +} + +// watchDirectoryFiles to mimic inotify when adding a watch on a directory +func (w *Watcher) watchDirectoryFiles(dirPath string) error { + // Get all files + files, err := ioutil.ReadDir(dirPath) + if err != nil { + return err + } + + for _, fileInfo := range files { + filePath := filepath.Join(dirPath, fileInfo.Name()) + filePath, err = w.internalWatch(filePath, fileInfo) + if err != nil { + return err + } + + w.mu.Lock() + w.fileExists[filePath] = true + w.mu.Unlock() + } + + return nil +} + +// sendDirectoryEvents searches the directory for newly created files +// and sends them over the event channel. This functionality is to have +// the BSD version of fsnotify match Linux inotify which provides a +// create event for files created in a watched directory. +func (w *Watcher) sendDirectoryChangeEvents(dirPath string) { + // Get all files + files, err := ioutil.ReadDir(dirPath) + if err != nil { + select { + case w.Errors <- err: + case <-w.done: + return + } + } + + // Search for new files + for _, fileInfo := range files { + filePath := filepath.Join(dirPath, fileInfo.Name()) + err := w.sendFileCreatedEventIfNew(filePath, fileInfo) + + if err != nil { + return + } + } +} + +// sendFileCreatedEvent sends a create event if the file isn't already being tracked. +func (w *Watcher) sendFileCreatedEventIfNew(filePath string, fileInfo os.FileInfo) (err error) { + w.mu.Lock() + _, doesExist := w.fileExists[filePath] + w.mu.Unlock() + if !doesExist { + // Send create event + select { + case w.Events <- newCreateEvent(filePath): + case <-w.done: + return + } + } + + // like watchDirectoryFiles (but without doing another ReadDir) + filePath, err = w.internalWatch(filePath, fileInfo) + if err != nil { + return err + } + + w.mu.Lock() + w.fileExists[filePath] = true + w.mu.Unlock() + + return nil +} + +func (w *Watcher) internalWatch(name string, fileInfo os.FileInfo) (string, error) { + if fileInfo.IsDir() { + // mimic Linux providing delete events for subdirectories + // but preserve the flags used if currently watching subdirectory + w.mu.Lock() + flags := w.dirFlags[name] + w.mu.Unlock() + + flags |= unix.NOTE_DELETE | unix.NOTE_RENAME + return w.addWatch(name, flags) + } + + // watch file to mimic Linux inotify + return w.addWatch(name, noteAllEvents) +} + +// kqueue creates a new kernel event queue and returns a descriptor. +func kqueue() (kq int, err error) { + kq, err = unix.Kqueue() + if kq == -1 { + return kq, err + } + return kq, nil +} + +// register events with the queue +func register(kq int, fds []int, flags int, fflags uint32) error { + changes := make([]unix.Kevent_t, len(fds)) + + for i, fd := range fds { + // SetKevent converts int to the platform-specific types: + unix.SetKevent(&changes[i], fd, unix.EVFILT_VNODE, flags) + changes[i].Fflags = fflags + } + + // register the events + success, err := unix.Kevent(kq, changes, nil, nil) + if success == -1 { + return err + } + return nil +} + +// read retrieves pending events, or waits until an event occurs. +// A timeout of nil blocks indefinitely, while 0 polls the queue. +func read(kq int, events []unix.Kevent_t, timeout *unix.Timespec) ([]unix.Kevent_t, error) { + n, err := unix.Kevent(kq, nil, events, timeout) + if err != nil { + return nil, err + } + return events[0:n], nil +} + +// durationToTimespec prepares a timeout value +func durationToTimespec(d time.Duration) unix.Timespec { + return unix.NsecToTimespec(d.Nanoseconds()) +} diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go b/integration-test/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go new file mode 100644 index 000000000..2306c4620 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go @@ -0,0 +1,11 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build freebsd openbsd netbsd dragonfly + +package fsnotify + +import "golang.org/x/sys/unix" + +const openMode = unix.O_NONBLOCK | unix.O_RDONLY | unix.O_CLOEXEC diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go b/integration-test/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go new file mode 100644 index 000000000..870c4d6d1 --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin + +package fsnotify + +import "golang.org/x/sys/unix" + +// note: this constant is not defined on BSD +const openMode = unix.O_EVTONLY | unix.O_CLOEXEC diff --git a/integration-test/vendor/github.com/fsnotify/fsnotify/windows.go b/integration-test/vendor/github.com/fsnotify/fsnotify/windows.go new file mode 100644 index 000000000..09436f31d --- /dev/null +++ b/integration-test/vendor/github.com/fsnotify/fsnotify/windows.go @@ -0,0 +1,561 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build windows + +package fsnotify + +import ( + "errors" + "fmt" + "os" + "path/filepath" + "runtime" + "sync" + "syscall" + "unsafe" +) + +// Watcher watches a set of files, delivering events to a channel. +type Watcher struct { + Events chan Event + Errors chan error + isClosed bool // Set to true when Close() is first called + mu sync.Mutex // Map access + port syscall.Handle // Handle to completion port + watches watchMap // Map of watches (key: i-number) + input chan *input // Inputs to the reader are sent on this channel + quit chan chan<- error +} + +// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. +func NewWatcher() (*Watcher, error) { + port, e := syscall.CreateIoCompletionPort(syscall.InvalidHandle, 0, 0, 0) + if e != nil { + return nil, os.NewSyscallError("CreateIoCompletionPort", e) + } + w := &Watcher{ + port: port, + watches: make(watchMap), + input: make(chan *input, 1), + Events: make(chan Event, 50), + Errors: make(chan error), + quit: make(chan chan<- error, 1), + } + go w.readEvents() + return w, nil +} + +// Close removes all watches and closes the events channel. +func (w *Watcher) Close() error { + if w.isClosed { + return nil + } + w.isClosed = true + + // Send "quit" message to the reader goroutine + ch := make(chan error) + w.quit <- ch + if err := w.wakeupReader(); err != nil { + return err + } + return <-ch +} + +// Add starts watching the named file or directory (non-recursively). +func (w *Watcher) Add(name string) error { + if w.isClosed { + return errors.New("watcher already closed") + } + in := &input{ + op: opAddWatch, + path: filepath.Clean(name), + flags: sysFSALLEVENTS, + reply: make(chan error), + } + w.input <- in + if err := w.wakeupReader(); err != nil { + return err + } + return <-in.reply +} + +// Remove stops watching the the named file or directory (non-recursively). +func (w *Watcher) Remove(name string) error { + in := &input{ + op: opRemoveWatch, + path: filepath.Clean(name), + reply: make(chan error), + } + w.input <- in + if err := w.wakeupReader(); err != nil { + return err + } + return <-in.reply +} + +const ( + // Options for AddWatch + sysFSONESHOT = 0x80000000 + sysFSONLYDIR = 0x1000000 + + // Events + sysFSACCESS = 0x1 + sysFSALLEVENTS = 0xfff + sysFSATTRIB = 0x4 + sysFSCLOSE = 0x18 + sysFSCREATE = 0x100 + sysFSDELETE = 0x200 + sysFSDELETESELF = 0x400 + sysFSMODIFY = 0x2 + sysFSMOVE = 0xc0 + sysFSMOVEDFROM = 0x40 + sysFSMOVEDTO = 0x80 + sysFSMOVESELF = 0x800 + + // Special events + sysFSIGNORED = 0x8000 + sysFSQOVERFLOW = 0x4000 +) + +func newEvent(name string, mask uint32) Event { + e := Event{Name: name} + if mask&sysFSCREATE == sysFSCREATE || mask&sysFSMOVEDTO == sysFSMOVEDTO { + e.Op |= Create + } + if mask&sysFSDELETE == sysFSDELETE || mask&sysFSDELETESELF == sysFSDELETESELF { + e.Op |= Remove + } + if mask&sysFSMODIFY == sysFSMODIFY { + e.Op |= Write + } + if mask&sysFSMOVE == sysFSMOVE || mask&sysFSMOVESELF == sysFSMOVESELF || mask&sysFSMOVEDFROM == sysFSMOVEDFROM { + e.Op |= Rename + } + if mask&sysFSATTRIB == sysFSATTRIB { + e.Op |= Chmod + } + return e +} + +const ( + opAddWatch = iota + opRemoveWatch +) + +const ( + provisional uint64 = 1 << (32 + iota) +) + +type input struct { + op int + path string + flags uint32 + reply chan error +} + +type inode struct { + handle syscall.Handle + volume uint32 + index uint64 +} + +type watch struct { + ov syscall.Overlapped + ino *inode // i-number + path string // Directory path + mask uint64 // Directory itself is being watched with these notify flags + names map[string]uint64 // Map of names being watched and their notify flags + rename string // Remembers the old name while renaming a file + buf [4096]byte +} + +type indexMap map[uint64]*watch +type watchMap map[uint32]indexMap + +func (w *Watcher) wakeupReader() error { + e := syscall.PostQueuedCompletionStatus(w.port, 0, 0, nil) + if e != nil { + return os.NewSyscallError("PostQueuedCompletionStatus", e) + } + return nil +} + +func getDir(pathname string) (dir string, err error) { + attr, e := syscall.GetFileAttributes(syscall.StringToUTF16Ptr(pathname)) + if e != nil { + return "", os.NewSyscallError("GetFileAttributes", e) + } + if attr&syscall.FILE_ATTRIBUTE_DIRECTORY != 0 { + dir = pathname + } else { + dir, _ = filepath.Split(pathname) + dir = filepath.Clean(dir) + } + return +} + +func getIno(path string) (ino *inode, err error) { + h, e := syscall.CreateFile(syscall.StringToUTF16Ptr(path), + syscall.FILE_LIST_DIRECTORY, + syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE, + nil, syscall.OPEN_EXISTING, + syscall.FILE_FLAG_BACKUP_SEMANTICS|syscall.FILE_FLAG_OVERLAPPED, 0) + if e != nil { + return nil, os.NewSyscallError("CreateFile", e) + } + var fi syscall.ByHandleFileInformation + if e = syscall.GetFileInformationByHandle(h, &fi); e != nil { + syscall.CloseHandle(h) + return nil, os.NewSyscallError("GetFileInformationByHandle", e) + } + ino = &inode{ + handle: h, + volume: fi.VolumeSerialNumber, + index: uint64(fi.FileIndexHigh)<<32 | uint64(fi.FileIndexLow), + } + return ino, nil +} + +// Must run within the I/O thread. +func (m watchMap) get(ino *inode) *watch { + if i := m[ino.volume]; i != nil { + return i[ino.index] + } + return nil +} + +// Must run within the I/O thread. +func (m watchMap) set(ino *inode, watch *watch) { + i := m[ino.volume] + if i == nil { + i = make(indexMap) + m[ino.volume] = i + } + i[ino.index] = watch +} + +// Must run within the I/O thread. +func (w *Watcher) addWatch(pathname string, flags uint64) error { + dir, err := getDir(pathname) + if err != nil { + return err + } + if flags&sysFSONLYDIR != 0 && pathname != dir { + return nil + } + ino, err := getIno(dir) + if err != nil { + return err + } + w.mu.Lock() + watchEntry := w.watches.get(ino) + w.mu.Unlock() + if watchEntry == nil { + if _, e := syscall.CreateIoCompletionPort(ino.handle, w.port, 0, 0); e != nil { + syscall.CloseHandle(ino.handle) + return os.NewSyscallError("CreateIoCompletionPort", e) + } + watchEntry = &watch{ + ino: ino, + path: dir, + names: make(map[string]uint64), + } + w.mu.Lock() + w.watches.set(ino, watchEntry) + w.mu.Unlock() + flags |= provisional + } else { + syscall.CloseHandle(ino.handle) + } + if pathname == dir { + watchEntry.mask |= flags + } else { + watchEntry.names[filepath.Base(pathname)] |= flags + } + if err = w.startRead(watchEntry); err != nil { + return err + } + if pathname == dir { + watchEntry.mask &= ^provisional + } else { + watchEntry.names[filepath.Base(pathname)] &= ^provisional + } + return nil +} + +// Must run within the I/O thread. +func (w *Watcher) remWatch(pathname string) error { + dir, err := getDir(pathname) + if err != nil { + return err + } + ino, err := getIno(dir) + if err != nil { + return err + } + w.mu.Lock() + watch := w.watches.get(ino) + w.mu.Unlock() + if watch == nil { + return fmt.Errorf("can't remove non-existent watch for: %s", pathname) + } + if pathname == dir { + w.sendEvent(watch.path, watch.mask&sysFSIGNORED) + watch.mask = 0 + } else { + name := filepath.Base(pathname) + w.sendEvent(filepath.Join(watch.path, name), watch.names[name]&sysFSIGNORED) + delete(watch.names, name) + } + return w.startRead(watch) +} + +// Must run within the I/O thread. +func (w *Watcher) deleteWatch(watch *watch) { + for name, mask := range watch.names { + if mask&provisional == 0 { + w.sendEvent(filepath.Join(watch.path, name), mask&sysFSIGNORED) + } + delete(watch.names, name) + } + if watch.mask != 0 { + if watch.mask&provisional == 0 { + w.sendEvent(watch.path, watch.mask&sysFSIGNORED) + } + watch.mask = 0 + } +} + +// Must run within the I/O thread. +func (w *Watcher) startRead(watch *watch) error { + if e := syscall.CancelIo(watch.ino.handle); e != nil { + w.Errors <- os.NewSyscallError("CancelIo", e) + w.deleteWatch(watch) + } + mask := toWindowsFlags(watch.mask) + for _, m := range watch.names { + mask |= toWindowsFlags(m) + } + if mask == 0 { + if e := syscall.CloseHandle(watch.ino.handle); e != nil { + w.Errors <- os.NewSyscallError("CloseHandle", e) + } + w.mu.Lock() + delete(w.watches[watch.ino.volume], watch.ino.index) + w.mu.Unlock() + return nil + } + e := syscall.ReadDirectoryChanges(watch.ino.handle, &watch.buf[0], + uint32(unsafe.Sizeof(watch.buf)), false, mask, nil, &watch.ov, 0) + if e != nil { + err := os.NewSyscallError("ReadDirectoryChanges", e) + if e == syscall.ERROR_ACCESS_DENIED && watch.mask&provisional == 0 { + // Watched directory was probably removed + if w.sendEvent(watch.path, watch.mask&sysFSDELETESELF) { + if watch.mask&sysFSONESHOT != 0 { + watch.mask = 0 + } + } + err = nil + } + w.deleteWatch(watch) + w.startRead(watch) + return err + } + return nil +} + +// readEvents reads from the I/O completion port, converts the +// received events into Event objects and sends them via the Events channel. +// Entry point to the I/O thread. +func (w *Watcher) readEvents() { + var ( + n, key uint32 + ov *syscall.Overlapped + ) + runtime.LockOSThread() + + for { + e := syscall.GetQueuedCompletionStatus(w.port, &n, &key, &ov, syscall.INFINITE) + watch := (*watch)(unsafe.Pointer(ov)) + + if watch == nil { + select { + case ch := <-w.quit: + w.mu.Lock() + var indexes []indexMap + for _, index := range w.watches { + indexes = append(indexes, index) + } + w.mu.Unlock() + for _, index := range indexes { + for _, watch := range index { + w.deleteWatch(watch) + w.startRead(watch) + } + } + var err error + if e := syscall.CloseHandle(w.port); e != nil { + err = os.NewSyscallError("CloseHandle", e) + } + close(w.Events) + close(w.Errors) + ch <- err + return + case in := <-w.input: + switch in.op { + case opAddWatch: + in.reply <- w.addWatch(in.path, uint64(in.flags)) + case opRemoveWatch: + in.reply <- w.remWatch(in.path) + } + default: + } + continue + } + + switch e { + case syscall.ERROR_MORE_DATA: + if watch == nil { + w.Errors <- errors.New("ERROR_MORE_DATA has unexpectedly null lpOverlapped buffer") + } else { + // The i/o succeeded but the buffer is full. + // In theory we should be building up a full packet. + // In practice we can get away with just carrying on. + n = uint32(unsafe.Sizeof(watch.buf)) + } + case syscall.ERROR_ACCESS_DENIED: + // Watched directory was probably removed + w.sendEvent(watch.path, watch.mask&sysFSDELETESELF) + w.deleteWatch(watch) + w.startRead(watch) + continue + case syscall.ERROR_OPERATION_ABORTED: + // CancelIo was called on this handle + continue + default: + w.Errors <- os.NewSyscallError("GetQueuedCompletionPort", e) + continue + case nil: + } + + var offset uint32 + for { + if n == 0 { + w.Events <- newEvent("", sysFSQOVERFLOW) + w.Errors <- errors.New("short read in readEvents()") + break + } + + // Point "raw" to the event in the buffer + raw := (*syscall.FileNotifyInformation)(unsafe.Pointer(&watch.buf[offset])) + buf := (*[syscall.MAX_PATH]uint16)(unsafe.Pointer(&raw.FileName)) + name := syscall.UTF16ToString(buf[:raw.FileNameLength/2]) + fullname := filepath.Join(watch.path, name) + + var mask uint64 + switch raw.Action { + case syscall.FILE_ACTION_REMOVED: + mask = sysFSDELETESELF + case syscall.FILE_ACTION_MODIFIED: + mask = sysFSMODIFY + case syscall.FILE_ACTION_RENAMED_OLD_NAME: + watch.rename = name + case syscall.FILE_ACTION_RENAMED_NEW_NAME: + if watch.names[watch.rename] != 0 { + watch.names[name] |= watch.names[watch.rename] + delete(watch.names, watch.rename) + mask = sysFSMOVESELF + } + } + + sendNameEvent := func() { + if w.sendEvent(fullname, watch.names[name]&mask) { + if watch.names[name]&sysFSONESHOT != 0 { + delete(watch.names, name) + } + } + } + if raw.Action != syscall.FILE_ACTION_RENAMED_NEW_NAME { + sendNameEvent() + } + if raw.Action == syscall.FILE_ACTION_REMOVED { + w.sendEvent(fullname, watch.names[name]&sysFSIGNORED) + delete(watch.names, name) + } + if w.sendEvent(fullname, watch.mask&toFSnotifyFlags(raw.Action)) { + if watch.mask&sysFSONESHOT != 0 { + watch.mask = 0 + } + } + if raw.Action == syscall.FILE_ACTION_RENAMED_NEW_NAME { + fullname = filepath.Join(watch.path, watch.rename) + sendNameEvent() + } + + // Move to the next event in the buffer + if raw.NextEntryOffset == 0 { + break + } + offset += raw.NextEntryOffset + + // Error! + if offset >= n { + w.Errors <- errors.New("Windows system assumed buffer larger than it is, events have likely been missed.") + break + } + } + + if err := w.startRead(watch); err != nil { + w.Errors <- err + } + } +} + +func (w *Watcher) sendEvent(name string, mask uint64) bool { + if mask == 0 { + return false + } + event := newEvent(name, uint32(mask)) + select { + case ch := <-w.quit: + w.quit <- ch + case w.Events <- event: + } + return true +} + +func toWindowsFlags(mask uint64) uint32 { + var m uint32 + if mask&sysFSACCESS != 0 { + m |= syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS + } + if mask&sysFSMODIFY != 0 { + m |= syscall.FILE_NOTIFY_CHANGE_LAST_WRITE + } + if mask&sysFSATTRIB != 0 { + m |= syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES + } + if mask&(sysFSMOVE|sysFSCREATE|sysFSDELETE) != 0 { + m |= syscall.FILE_NOTIFY_CHANGE_FILE_NAME | syscall.FILE_NOTIFY_CHANGE_DIR_NAME + } + return m +} + +func toFSnotifyFlags(action uint32) uint64 { + switch action { + case syscall.FILE_ACTION_ADDED: + return sysFSCREATE + case syscall.FILE_ACTION_REMOVED: + return sysFSDELETE + case syscall.FILE_ACTION_MODIFIED: + return sysFSMODIFY + case syscall.FILE_ACTION_RENAMED_OLD_NAME: + return sysFSMOVEDFROM + case syscall.FILE_ACTION_RENAMED_NEW_NAME: + return sysFSMOVEDTO + } + return 0 +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/cache.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/cache.go new file mode 100644 index 000000000..2e481e99d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/cache.go @@ -0,0 +1,265 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package cache + +import ( + "errors" + "fmt" + "io" + "io/ioutil" + "os" + "sync" + + "github.com/go-logr/logr" + "github.com/mandelsoft/vfs/pkg/memoryfs" + "github.com/mandelsoft/vfs/pkg/osfs" + "github.com/mandelsoft/vfs/pkg/projectionfs" + "github.com/mandelsoft/vfs/pkg/vfs" + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" + + "github.com/gardener/component-cli/ociclient/metrics" +) + +type layeredCache struct { + log logr.Logger + mux sync.RWMutex + + baseFs *FileSystem + overlayFs *FileSystem +} + +// NewCache creates a new cache with the given options. +// It uses by default a tmp fs +func NewCache(log logr.Logger, options ...Option) (*layeredCache, error) { + opts := &Options{} + opts = opts.ApplyOptions(options) + opts.ApplyDefaults() + + if err := initBasePath(opts); err != nil { + return nil, err + } + + base, err := projectionfs.New(osfs.New(), opts.BasePath) + if err != nil { + return nil, err + } + baseCFs, err := NewCacheFilesystem(log.WithName("baseCacheFS"), base, opts.BaseGCConfig) + if err != nil { + return nil, fmt.Errorf("unable to create base layer: %w", err) + } + var overlayCFs *FileSystem + if opts.InMemoryOverlay { + overlayCFs, err = NewCacheFilesystem(log.WithName("inMemoryCacheFS"), memoryfs.New(), opts.InMemoryGCConfig) + if err != nil { + return nil, fmt.Errorf("unable to create base layer: %w", err) + } + } + + //initialize metrics + baseCFs.WithMetrics( + metrics.CachedItems.WithLabelValues(opts.UID), + metrics.CacheDiskUsage.WithLabelValues(opts.UID), + metrics.CacheHitsDisk.WithLabelValues(opts.UID)) + if opts.InMemoryOverlay { + overlayCFs.WithMetrics(nil, + metrics.CacheMemoryUsage.WithLabelValues(opts.UID), + metrics.CacheHitsMemory.WithLabelValues(opts.UID)) + } + + return &layeredCache{ + log: log, + mux: sync.RWMutex{}, + baseFs: baseCFs, + overlayFs: overlayCFs, + }, nil +} + +func initBasePath(opts *Options) error { + if len(opts.BasePath) == 0 { + path, err := ioutil.TempDir(os.TempDir(), "ocicache") + if err != nil { + return err + } + opts.BasePath = path + } + info, err := os.Stat(opts.BasePath) + if err != nil { + if !os.IsNotExist(err) { + return err + } + if err := os.MkdirAll(opts.BasePath, os.ModePerm); err != nil { + return err + } + return nil + } + + if !info.IsDir() { + return errors.New("path has to be a directory") + } + return nil +} + +// Close implements the io.Closer interface that cleanups all resource used by the cache. +func (lc *layeredCache) Close() error { + if err := lc.baseFs.Close(); err != nil { + return err + } + if lc.overlayFs != nil { + if err := lc.overlayFs.Close(); err != nil { + return err + } + } + return nil +} + +func (lc *layeredCache) Get(desc ocispecv1.Descriptor) (io.ReadCloser, error) { + _, file, err := lc.get(Path(desc), desc) + if err != nil { + return nil, err + } + return file, nil +} + +func (lc *layeredCache) Add(desc ocispecv1.Descriptor, reader io.ReadCloser) error { + path := Path(desc) + lc.mux.Lock() + defer lc.mux.Unlock() + defer reader.Close() + + file, err := lc.baseFs.Create(path, desc.Size) + if err != nil { + return err + } + defer file.Close() + + _, err = io.Copy(file, reader) + return err +} + +func (lc *layeredCache) Info() (Info, error) { + return Info{ + Size: lc.baseFs.Size, + CurrentSize: lc.baseFs.CurrentSize(), + ItemsCount: int64(lc.baseFs.index.Len()), + }, nil +} + +func (lc *layeredCache) Prune() error { + return lc.baseFs.DeleteAll() +} + +func (lc *layeredCache) get(dgst string, desc ocispecv1.Descriptor) (os.FileInfo, vfs.File, error) { + lc.mux.RLock() + defer lc.mux.RUnlock() + + // first search in the overlayFs layer + if info, file, err := lc.getFromOverlay(dgst, desc); err == nil { + return info, file, nil + } + + info, err := lc.baseFs.Stat(dgst) + if err != nil { + if os.IsNotExist(err) { + return nil, nil, ErrNotFound + } + return nil, nil, err + } + verified, err := verifyBlob(lc.baseFs.FileSystem, info, dgst, desc) + if err != nil { + return nil, nil, fmt.Errorf("unable to verify blob: %w", err) + } + if !verified { + // remove invalid blob from cache + if err := lc.baseFs.Remove(dgst); err != nil { + lc.log.V(7).Info("unable to remove invalid blob", "digest", dgst, "err", err.Error()) + } + return info, nil, ErrNotFound + } + file, err := lc.baseFs.OpenFile(dgst, os.O_RDONLY, os.ModePerm) + if err != nil { + return nil, nil, err + } + + // copy file to in memory cache + if lc.overlayFs != nil { + overlayFile, err := lc.overlayFs.Create(dgst, info.Size()) + if err != nil { + // do not return an error here as we are only unable to write to better cache + lc.log.V(5).Info(err.Error()) + return info, file, nil + } + defer overlayFile.Close() + if _, err := io.Copy(overlayFile, file); err != nil { + // do not return an error here as we are only unable to write to better cache + lc.log.V(5).Info(err.Error()) + + // The file handle is at the end as the data was copied by io.Copy. + // Therefore the file handle is reset so that the caller can also read the data. + if _, err := file.Seek(0, io.SeekStart); err != nil { + return nil, nil, fmt.Errorf("unable to reset the file handle: %w", err) + } + return info, file, nil + } + + // The file handle is at the end as the data was copied by io.Copy. + // Therefore the file handle is reset so that the caller can also read the data. + if _, err := file.Seek(0, io.SeekStart); err != nil { + return nil, nil, fmt.Errorf("unable to reset the file handle: %w", err) + } + } + return info, file, nil +} + +func (lc *layeredCache) getFromOverlay(dgst string, desc ocispecv1.Descriptor) (os.FileInfo, vfs.File, error) { + if lc.overlayFs == nil { + return nil, nil, ErrNotFound + } + info, err := lc.overlayFs.Stat(dgst) + if err != nil { + lc.log.V(7).Info("not found in overlay cache", "digest", dgst, "err", err.Error()) + return nil, nil, ErrNotFound + } + + verified, err := verifyBlob(lc.overlayFs.FileSystem, info, dgst, desc) + if err != nil { + return nil, nil, fmt.Errorf("unable to verify blob: %w", err) + } + if !verified { + // remove invalid blob from cache + if err := lc.overlayFs.Remove(dgst); err != nil { + lc.log.V(7).Info("unable to remove invalid blob", "digest", dgst, "err", err.Error()) + } + return info, nil, ErrNotFound + } + file, err := lc.overlayFs.OpenFile(dgst, os.O_RDONLY, os.ModePerm) + if err != nil { + return nil, nil, err + } + return info, file, err +} + +// verifyBlob validates the digest of a blob +func verifyBlob(fs vfs.FileSystem, info os.FileInfo, dgst string, desc ocispecv1.Descriptor) (bool, error) { + if info.Size() != desc.Size { + // do a simple check by checking the blob size + return false, nil + } + + file, err := fs.OpenFile(dgst, os.O_RDONLY, os.ModePerm) + if err != nil { + return false, err + } + defer file.Close() + + verifier := desc.Digest.Verifier() + if _, err := io.Copy(verifier, file); err != nil { + return false, err + } + return verifier.Verified(), nil +} + +func Path(desc ocispecv1.Descriptor) string { + return desc.Digest.Encoded() +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/filesystem.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/filesystem.go new file mode 100644 index 000000000..c6bf78f08 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/filesystem.go @@ -0,0 +1,489 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package cache + +import ( + "fmt" + "io" + "math" + "os" + "sort" + "sync" + "time" + + "github.com/go-logr/logr" + "github.com/mandelsoft/vfs/pkg/vfs" + "github.com/prometheus/client_golang/prometheus" + "k8s.io/apimachinery/pkg/api/resource" +) + +// GCHighThreshold defines the default percent of disk usage which triggers files garbage collection. +const GCHighThreshold float64 = 0.85 + +// GCLowThreshold defines the default percent of disk usage to which files garbage collection attempts to free. +const GCLowThreshold float64 = 0.80 + +// ResetInterval defines the default interval when the hit reset should run. +const ResetInterval time.Duration = 1 * time.Hour + +// PreservedHitsProportion defines the default percent of hits that should be preserved. +const PreservedHitsProportion = 0.5 + +// GarbageCollectionConfiguration contains all options for the cache garbage collection. +type GarbageCollectionConfiguration struct { + // Size is the size of the filesystem. + // If the value is 0 there is no limit and no garbage collection will happen. + // See the kubernetes quantity docs for detailed description of the format + // https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go + Size string + // GCHighThreshold defines the percent of disk usage which triggers files garbage collection. + GCHighThreshold float64 + // GCLowThreshold defines the percent of disk usage to which files garbage collection attempts to free. + GCLowThreshold float64 + // ResetInterval defines the interval when the hit reset should run. + ResetInterval time.Duration + // PreservedHitsProportion defines the percent of hits that should be preserved. + PreservedHitsProportion float64 +} + +// FileSystem is a internal representation of FileSystem with a optional max size +// and a garbage collection. +type FileSystem struct { + log logr.Logger + mux sync.Mutex + + // Configuration + vfs.FileSystem + // Size is the size of the filesystem in bytes. + // If the value is 0 there is no limit and no garbage collection will happen. + Size int64 + // GCHighThreshold defines the percent of disk usage which triggers files garbage collection. + GCHighThreshold float64 + // GCLowThreshold defines the percent of disk usage to which files garbage collection attempts to free. + GCLowThreshold float64 + // ResetInterval defines the interval when the hit reset should run. + ResetInterval time.Duration + // PreservedHitsProportion defines the percent of hits that should be preserved. + PreservedHitsProportion float64 + + index Index + // currentSize is the current size of the filesystem. + currentSize int64 + resetStopChan chan struct{} + + // optional metrics + itemsCountMetric prometheus.Gauge + diskUsageMetric prometheus.Gauge + hitsCountMetric prometheus.Counter +} + +// ApplyOptions parses and applies the options to the filesystem. +// It also applies defaults +func (o GarbageCollectionConfiguration) ApplyOptions(fs *FileSystem) error { + if len(o.Size) == 0 { + // no garbage collection configured ignore all other values + return nil + } + quantity, err := resource.ParseQuantity(o.Size) + if err != nil { + return fmt.Errorf("unable to parse size %q: %w", o.Size, err) + } + sizeInBytes, ok := quantity.AsInt64() + if ok { + fs.Size = sizeInBytes + } + + if o.GCHighThreshold == 0 { + o.GCHighThreshold = GCHighThreshold + } + fs.GCHighThreshold = o.GCHighThreshold + + if o.GCLowThreshold == 0 { + o.GCLowThreshold = GCLowThreshold + } + fs.GCLowThreshold = o.GCLowThreshold + + if o.ResetInterval == 0 { + o.ResetInterval = ResetInterval + } + fs.ResetInterval = o.ResetInterval + + if o.PreservedHitsProportion == 0 { + o.PreservedHitsProportion = PreservedHitsProportion + } + fs.PreservedHitsProportion = o.PreservedHitsProportion + + return nil +} + +// Merge merges 2 gc configurations whereas the defined values are overwritten. +func (o GarbageCollectionConfiguration) Merge(cfg *GarbageCollectionConfiguration) { + if len(o.Size) != 0 { + cfg.Size = o.Size + } + if o.GCHighThreshold != 0 { + cfg.GCHighThreshold = o.GCHighThreshold + } + if o.GCLowThreshold != 0 { + cfg.GCLowThreshold = o.GCLowThreshold + } + if o.ResetInterval != 0 { + cfg.ResetInterval = o.ResetInterval + } + if o.PreservedHitsProportion != 0 { + cfg.PreservedHitsProportion = o.PreservedHitsProportion + } +} + +// NewCacheFilesystem creates a new FileSystem cache. +// It acts as a replacement for a vfs filesystem that restricts the size of the filesystem. +// The garbage collection is triggered when a file is created. +// When the filesystem is not used anymore fs.Close() should be called to gracefully free resources. +func NewCacheFilesystem(log logr.Logger, fs vfs.FileSystem, gcOpts GarbageCollectionConfiguration) (*FileSystem, error) { + cFs := &FileSystem{ + log: log, + FileSystem: fs, + index: NewIndex(), + } + if err := gcOpts.ApplyOptions(cFs); err != nil { + return nil, err + } + + // load all cached files from the filesystem + files, err := vfs.ReadDir(fs, "/") + if err != nil { + return nil, fmt.Errorf("unable to read current cached files: %w", err) + } + for _, file := range files { + cFs.currentSize = cFs.currentSize + file.Size() + cFs.index.Add(file.Name(), file.Size(), file.ModTime()) + } + + if cFs.Size != 0 { + // start hit reset counter + cFs.StartResetInterval() + } + + return cFs, nil +} + +// WithMetrics adds prometheus metrics to the filesystem +// that are set by the filesystem. +func (fs *FileSystem) WithMetrics(itemsCount, usage prometheus.Gauge, hits prometheus.Counter) { + fs.diskUsageMetric = usage + fs.hitsCountMetric = hits + fs.itemsCountMetric = itemsCount + + if fs.diskUsageMetric != nil { + fs.diskUsageMetric.Set(float64(fs.CurrentSize())) + } + if fs.itemsCountMetric != nil { + fs.itemsCountMetric.Set(float64(fs.index.Len())) + } +} + +// Close implements the io.Closer interface. +// It should be called when the cache is not used anymore. +func (fs *FileSystem) Close() error { + if fs.resetStopChan == nil { + return nil + } + fs.resetStopChan <- struct{}{} + return nil +} + +var _ io.Closer = &FileSystem{} + +// StartResetInterval starts the reset counter for the cache hits. +func (fs *FileSystem) StartResetInterval() { + interval := time.NewTicker(ResetInterval) + fs.resetStopChan = make(chan struct{}) + go func() { + for { + select { + case <-interval.C: + fs.index.Reset() + case <-fs.resetStopChan: + interval.Stop() + return + } + } + }() +} + +func (fs *FileSystem) Create(path string, size int64) (vfs.File, error) { + fs.mux.Lock() + defer fs.mux.Unlock() + file, err := fs.FileSystem.Create(path) + if err != nil { + return nil, err + } + fs.setCurrentSize(fs.currentSize + size) + fs.index.Add(path, size, time.Now()) + if fs.itemsCountMetric != nil { + fs.itemsCountMetric.Inc() + } + go fs.RunGarbageCollection() + return file, err +} + +func (fs *FileSystem) OpenFile(name string, flags int, perm os.FileMode) (vfs.File, error) { + fs.index.Hit(name) + if fs.hitsCountMetric != nil { + fs.hitsCountMetric.Inc() + } + return fs.FileSystem.OpenFile(name, flags, perm) +} + +func (fs *FileSystem) Remove(name string) error { + if err := fs.FileSystem.Remove(name); err != nil { + return err + } + entry := fs.index.Get(name) + fs.setCurrentSize(fs.currentSize - entry.Size) + fs.index.Remove(name) + if fs.itemsCountMetric != nil { + fs.itemsCountMetric.Dec() + } + return nil +} + +// DeleteAll removes all files in the filesystem +func (fs *FileSystem) DeleteAll() error { + fs.mux.Lock() + defer fs.mux.Unlock() + files, err := vfs.ReadDir(fs.FileSystem, "/") + if err != nil { + return fmt.Errorf("unable to read current cached files: %w", err) + } + for _, file := range files { + if err := fs.Remove(file.Name()); err != nil { + return err + } + } + return nil +} + +// CurrentSize returns the current size of the filesystem +func (fs *FileSystem) CurrentSize() int64 { + return fs.currentSize +} + +// setCurrentSize sets the current size of the filesystem +func (fs *FileSystem) setCurrentSize(size int64) { + fs.currentSize = size + if fs.diskUsageMetric != nil { + fs.diskUsageMetric.Set(float64(size)) + } +} + +// usage returns the current disk usage of the filesystem +func (fs *FileSystem) usage() float64 { + return float64(fs.currentSize) / float64(fs.Size) +} + +// RunGarbageCollection runs the garbage collection of the filesystem. +// The gc only deletes items when the max size reached a certain threshold. +// If that threshold is reached the files are deleted with the following priority: +// - least hits +// - oldest +// - random +func (fs *FileSystem) RunGarbageCollection() { + // do not run gc if the size is infinite + if fs.Size == 0 { + return + } + // first check if we reached the threshold to start garbage collection + if usage := fs.usage(); usage < GCHighThreshold { + fs.log.V(10).Info(fmt.Sprintf("run gc with %v%% usage", usage)) + return + } + + // while the index is read and copied no write should happen + fs.mux.Lock() + index := fs.index.DeepCopy() + fs.mux.Unlock() + + // while the garbage collection is running read operations are blocked + // todo: improve to only block read operations on really deleted objects + fs.mux.Lock() + defer fs.mux.Unlock() + + // sort all files according to their deletion priority + items := index.PriorityList() + for fs.usage() > GCLowThreshold { + if len(items) == 0 { + return + } + item := items[0] + if err := fs.Remove(item.Name); err != nil { + fs.log.Error(err, "unable to delete file", "file", item.Name) + } + // remove currently garbage collected item + items = items[1:] + } +} + +type Index struct { + mut sync.RWMutex + entries map[string]IndexEntry +} + +// NewIndex creates a new index structure +func NewIndex() Index { + return Index{ + mut: sync.RWMutex{}, + entries: map[string]IndexEntry{}, + } +} + +type IndexEntry struct { + // Name is the name if the file. + Name string + // Size is the size of the file in bytes. + Size int64 + // Is the number of hits since the last gc + Hits int64 + // CreatedAt is the time when the file ha been created. + CreatedAt time.Time + // HitsSinceLastReset is the number hits since the last reset interval + HitsSinceLastReset int64 +} + +// Add adds a entry to the index. +func (i *Index) Add(name string, size int64, createdAt time.Time) { + i.entries[name] = IndexEntry{ + Name: name, + Size: size, + Hits: 0, + CreatedAt: createdAt, + HitsSinceLastReset: 0, + } +} + +// Len returns the number of items that are currently in the index. +func (i *Index) Len() int { + return len(i.entries) +} + +// Get return the index entry with the given name. +func (i *Index) Get(name string) IndexEntry { + i.mut.RLock() + defer i.mut.RUnlock() + return i.entries[name] +} + +// Remove removes the entry from the index. +func (i *Index) Remove(name string) { + i.mut.Lock() + defer i.mut.Unlock() + delete(i.entries, name) +} + +// Hit increases the hit count for the file. +func (i *Index) Hit(name string) { + i.mut.Lock() + defer i.mut.Unlock() + entry, ok := i.entries[name] + if !ok { + return + } + entry.Hits++ + entry.HitsSinceLastReset++ + i.entries[name] = entry +} + +// Reset resets the hit counter for all entries. +// The reset preserves 20% if the old hits. +func (i *Index) Reset() { + for name := range i.entries { + entry := i.Get(name) + + oldHits := entry.Hits - entry.HitsSinceLastReset + preservedHits := int64(float64(oldHits) * PreservedHitsProportion) + entry.Hits = preservedHits + entry.HitsSinceLastReset + + entry.HitsSinceLastReset = 0 + i.entries[name] = entry + } +} + +// DeepCopy creates a deep copy of the current index. +func (i *Index) DeepCopy() *Index { + index := &Index{ + entries: make(map[string]IndexEntry, len(i.entries)), + } + for key, value := range i.entries { + index.entries[key] = value + } + return index +} + +// PriorityList returns a entries of all entries +// sorted by their gc priority. +// The entry with the lowest priority is the first item. +func (i *Index) PriorityList() []IndexEntry { + p := priorityList{ + entries: make([]IndexEntry, 0), + } + for _, i := range i.entries { + entry := i + if entry.Hits > p.maxHits { + p.maxHits = entry.Hits + } + if p.minHits == 0 || entry.Hits < p.minHits { + p.minHits = entry.Hits + } + if p.newest.Before(entry.CreatedAt) { + p.newest = entry.CreatedAt + } + if p.oldest.IsZero() || entry.CreatedAt.Before(p.oldest) { + p.oldest = entry.CreatedAt + } + p.entries = append(p.entries, entry) + } + sort.Sort(p) + return p.entries +} + +// priorityList is a helper type that implements the sort.Sort function. +// the entries are sorted by their priority. +// The priority is calculated using the entries hits and creation date. +type priorityList struct { + minHits, maxHits int64 + oldest, newest time.Time + entries []IndexEntry +} + +var _ sort.Interface = priorityList{} + +func (i priorityList) Len() int { return len(i.entries) } + +func (i priorityList) Less(a, b int) bool { + eA, eB := i.entries[a], i.entries[b] + + // calculate the entries hits value + // based on the min and max values + priorityA := CalculatePriority(eA, i.minHits, i.maxHits, i.oldest, i.newest) + priorityB := CalculatePriority(eB, i.minHits, i.maxHits, i.oldest, i.newest) + return priorityA < priorityB +} + +// CalculatePriority calculates the gc priority of a index entry. +// A lower priority means that is more likely to be deleted. +func CalculatePriority(entry IndexEntry, minHits, maxHits int64, oldest, newest time.Time) float64 { + hitsVal := float64(entry.Hits-minHits) / float64(maxHits-minHits) + if math.IsNaN(hitsVal) { + hitsVal = 0 + } + dateVal := float64(entry.CreatedAt.UnixNano()-oldest.UnixNano()) / float64(newest.UnixNano()-oldest.UnixNano()) + if math.IsNaN(dateVal) { + dateVal = 0 + } + + return (hitsVal * 0.6) + (dateVal * 0.4) +} + +func (i priorityList) Swap(a, b int) { i.entries[a], i.entries[b] = i.entries[b], i.entries[a] } diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/inmemory.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/inmemory.go new file mode 100644 index 000000000..a72749934 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/inmemory.go @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package cache + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" +) + +type inmemoryCache struct { + store map[string][]byte +} + +// NewInMemoryCache creates a new in memory cache. +func NewInMemoryCache() *inmemoryCache { + return &inmemoryCache{ + store: make(map[string][]byte), + } +} + +func (fs *inmemoryCache) Close() error { + return nil +} + +func (fs *inmemoryCache) Get(desc ocispecv1.Descriptor) (io.ReadCloser, error) { + data, ok := fs.store[desc.Digest.String()] + if !ok { + return nil, ErrNotFound + } + return ioutil.NopCloser(bytes.NewBuffer(data)), nil +} + +func (fs *inmemoryCache) Add(desc ocispecv1.Descriptor, reader io.ReadCloser) error { + if _, ok := fs.store[desc.Digest.String()]; ok { + // already cached + return nil + } + var buf bytes.Buffer + if _, err := io.Copy(&buf, reader); err != nil { + return fmt.Errorf("unable to read data: %w", err) + } + fs.store[desc.Digest.String()] = buf.Bytes() + return nil +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/types.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/types.go new file mode 100644 index 000000000..04952386e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/cache/types.go @@ -0,0 +1,175 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package cache + +import ( + "errors" + "io" + + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" + + "github.com/google/uuid" +) + +var ( + // ErrNotFound is a error that indicates that the file is not cached + ErrNotFound = errors.New("not cached") +) + +// CacheDirEnvName is the name of the environment variable that configures cache directory. +const CacheDirEnvName = "OCI_CACHE_DIR" + +// Cache is the interface for a oci cache +type Cache interface { + io.Closer + Get(desc ocispecv1.Descriptor) (io.ReadCloser, error) + Add(desc ocispecv1.Descriptor, reader io.ReadCloser) error +} + +// Info contains additional information about the cache +type Info struct { + // Size is the max size of the filesystem in bytes. + // If the value is 0 there is no limit and no garbage collection will happen. + // +optional + Size int64 `json:"size"` + // CurrentSize is the current size of the cache + CurrentSize int64 `json:"currentSize"` + // ItemsCount is the number of items that are currently managed by the cache. + ItemsCount int64 `json:"items"` +} + +// InfoInterface describes an interface that can be optionally exposed by a cache to give additional information. +type InfoInterface interface { + Info() (Info, error) +} + +// PruneInterface describes an interface that can be optionally exposed by a cache to manually prune the cache. +type PruneInterface interface { + Prune() error +} + +// InjectCache is a interface to inject a cache. +type InjectCache interface { + InjectCache(c Cache) error +} + +// InjectCacheInto injects a cache if the given object implements the InjectCache interface. +func InjectCacheInto(obj interface{}, cache Cache) error { + if cache == nil { + return nil + } + if injector, ok := obj.(InjectCache); ok { + return injector.InjectCache(cache) + } + return nil +} + +// Options contains all oci cache options to configure the oci cache. +type Options struct { + // InMemoryOverlay specifies if a overlayFs InMemory cache should be used + InMemoryOverlay bool + + // InMemoryGCConfig defines the garbage collection configuration for the in memory cache. + InMemoryGCConfig GarbageCollectionConfiguration + + // BasePath specifies the Base path for the os filepath. + // Will be defaulted to a temp filepath if not specified + BasePath string + + // BaseGCConfig defines the garbage collection configuration for the in base cache. + BaseGCConfig GarbageCollectionConfiguration + + // UID is the identity of a cache, if not specified a UID will be generated + UID string +} + +// Option is the interface to specify different cache options +type Option interface { + ApplyOption(options *Options) +} + +// ApplyOptions applies the given entries options on these options, +// and then returns itself (for convenient chaining). +func (o *Options) ApplyOptions(opts []Option) *Options { + for _, opt := range opts { + opt.ApplyOption(o) + } + return o +} + +// ApplyDefaults sets defaults for the options. +func (o *Options) ApplyDefaults() { + if o.InMemoryOverlay && len(o.InMemoryGCConfig.Size) == 0 { + o.InMemoryGCConfig.Size = "200Mi" + } + + if len(o.UID) == 0 { + o.UID = uuid.New().String() + } +} + +// WithInMemoryOverlay is the options to specify the usage of a in memory overlayFs +type WithInMemoryOverlay bool + +func (w WithInMemoryOverlay) ApplyOption(options *Options) { + options.InMemoryOverlay = bool(w) +} + +// WithBasePath is the options to specify a base path +type WithBasePath string + +func (p WithBasePath) ApplyOption(options *Options) { + options.BasePath = string(p) +} + +// WithInMemoryOverlaySize sets the max size of the overly file system. +// See the kubernetes quantity docs for detailed description of the format +// https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go +type WithInMemoryOverlaySize string + +func (p WithInMemoryOverlaySize) ApplyOption(options *Options) { + options.InMemoryGCConfig.Size = string(p) +} + +// WithBaseSize sets the max size of the base file system. +// See the kubernetes quantity docs for detailed description of the format +// https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go +type WithBaseSize string + +func (p WithBaseSize) ApplyOption(options *Options) { + options.BaseGCConfig.Size = string(p) +} + +// WithGCConfig overwrites the garbage collection settings for all caches. +type WithGCConfig GarbageCollectionConfiguration + +func (p WithGCConfig) ApplyOption(options *Options) { + cfg := GarbageCollectionConfiguration(p) + cfg.Merge(&options.BaseGCConfig) + cfg.Merge(&options.InMemoryGCConfig) +} + +// WithBaseGCConfig overwrites the base garbage collection settings. +type WithBaseGCConfig GarbageCollectionConfiguration + +func (p WithBaseGCConfig) ApplyOption(options *Options) { + cfg := GarbageCollectionConfiguration(p) + cfg.Merge(&options.BaseGCConfig) +} + +// WithBaseGCConfig overwrites the in memory garbage collection settings. +type WithInMemoryGCConfig GarbageCollectionConfiguration + +func (p WithInMemoryGCConfig) ApplyOption(options *Options) { + cfg := GarbageCollectionConfiguration(p) + cfg.Merge(&options.InMemoryGCConfig) +} + +// WithUID is the option to give a cache an identity +type WithUID string + +func (p WithUID) ApplyOption(options *Options) { + options.UID = string(p) +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/client.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/client.go new file mode 100644 index 000000000..e9f62d0a8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/client.go @@ -0,0 +1,803 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package ociclient + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "path" + "strings" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/images" + containerdlog "github.com/containerd/containerd/log" + "github.com/containerd/containerd/remotes" + "github.com/containerd/containerd/remotes/docker" + "github.com/go-logr/logr" + "github.com/google/go-containerregistry/pkg/name" + "github.com/google/go-containerregistry/pkg/v1/remote/transport" + distributionspecv1 "github.com/opencontainers/distribution-spec/specs-go/v1" + "github.com/opencontainers/go-digest" + "github.com/opencontainers/image-spec/specs-go" + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/sirupsen/logrus" + "k8s.io/apimachinery/pkg/util/sets" + + "github.com/gardener/component-cli/ociclient/cache" + "github.com/gardener/component-cli/ociclient/credentials" + "github.com/gardener/component-cli/ociclient/oci" + "github.com/gardener/component-cli/pkg/utils" +) + +type client struct { + log logr.Logger + cache cache.Cache + keychain credentials.Keyring + httpClient *http.Client + transport http.RoundTripper + allowPlainHttp bool + getHostConfig docker.RegistryHosts + + knownMediaTypes sets.String +} + +// NewClient creates a new OCI Client. +func NewClient(log logr.Logger, opts ...Option) (*client, error) { + options := &Options{} + options.ApplyOptions(opts) + + if options.Keyring == nil { + keyring, err := credentials.NewBuilder(log.WithName("ociKeyring")). + FromConfigFiles(options.Paths...). + Build() + if err != nil { + return nil, err + } + options.Keyring = keyring + } + + if options.Cache == nil { + cacheOpts := make([]cache.Option, 0) + if options.CacheConfig != nil { + if len(options.CacheConfig.BasePath) != 0 { + cacheOpts = append(cacheOpts, cache.WithBasePath(options.CacheConfig.BasePath)) + } + cacheOpts = append(cacheOpts, cache.WithInMemoryOverlay(options.CacheConfig.InMemoryOverlay)) + } + c, err := cache.NewCache(log, cacheOpts...) + if err != nil { + return nil, err + } + options.Cache = c + } + + if options.HTTPClient == nil { + options.HTTPClient = http.DefaultClient + } + trp := options.HTTPClient.Transport + if trp == nil { + trp = http.DefaultTransport + } + + cLogger := logrus.New() + cLogger.SetLevel(logrus.FatalLevel) + if log.V(10).Enabled() { + cLogger.SetLevel(logrus.TraceLevel) + } else if log.V(7).Enabled() { + cLogger.SetLevel(logrus.InfoLevel) + } else if log.V(2).Enabled() { + cLogger.SetLevel(logrus.ErrorLevel) + } + containerdlog.L = logrus.NewEntry(cLogger) + + return &client{ + log: log, + keychain: options.Keyring, + allowPlainHttp: options.AllowPlainHttp, + httpClient: options.HTTPClient, + transport: trp, + cache: options.Cache, + getHostConfig: docker.ConfigureDefaultRegistries( + docker.WithPlainHTTP(func(_ string) (bool, error) { + return options.AllowPlainHttp, nil + }), + ), + knownMediaTypes: DefaultKnownMediaTypes.Union(options.CustomMediaTypes), + }, nil +} + +func (c *client) InjectCache(cache cache.Cache) error { + c.cache = cache + return nil +} + +func (c *client) Resolve(ctx context.Context, ref string) (name string, desc ocispecv1.Descriptor, err error) { + refspec, err := oci.ParseRef(ref) + if err != nil { + return "", ocispecv1.Descriptor{}, fmt.Errorf("unable to parse ref: %w", err) + } + ref = refspec.String() + + resolver, err := c.getResolverForRef(ctx, ref, transport.PullScope) + if err != nil { + return "", ocispecv1.Descriptor{}, err + } + return resolver.Resolve(ctx, ref) +} + +func (c *client) GetOCIArtifact(ctx context.Context, ref string) (*oci.Artifact, error) { + refspec, err := oci.ParseRef(ref) + if err != nil { + return nil, fmt.Errorf("unable to parse ref: %w", err) + } + ref = refspec.String() + + resolver, err := c.getResolverForRef(ctx, ref, transport.PullScope) + if err != nil { + return nil, err + } + _, desc, err := resolver.Resolve(ctx, ref) + if err != nil { + return nil, err + } + + if desc.MediaType == MediaTypeDockerV2Schema1Manifest || desc.MediaType == MediaTypeDockerV2Schema1SignedManifest { + c.log.V(7).Info("found v1 manifest -> convert to v2") + convertedManifestDesc, err := ConvertV1ManifestToV2(ctx, c, c.cache, ref, desc) + if err != nil { + return nil, fmt.Errorf("unable to convert v1 manifest to v2: %w", err) + } + desc = convertedManifestDesc + } + + data := bytes.NewBuffer([]byte{}) + if err := c.Fetch(ctx, ref, desc, data); err != nil { + return nil, err + } + + if desc.MediaType == ocispecv1.MediaTypeImageIndex || desc.MediaType == images.MediaTypeDockerSchema2ManifestList { + var index ocispecv1.Index + if err := json.Unmarshal(data.Bytes(), &index); err != nil { + return nil, err + } + + i := oci.Index{ + Manifests: []*oci.Manifest{}, + Annotations: index.Annotations, + } + + indexArtifact, err := oci.NewIndexArtifact(&i) + if err != nil { + return nil, err + } + + for _, mdesc := range index.Manifests { + data := bytes.NewBuffer([]byte{}) + if err := c.Fetch(ctx, ref, mdesc, data); err != nil { + return nil, err + } + + var manifest ocispecv1.Manifest + if err := json.Unmarshal(data.Bytes(), &manifest); err != nil { + return nil, err + } + + m := oci.Manifest{ + Descriptor: mdesc, + Data: &manifest, + } + + indexArtifact.GetIndex().Manifests = append(indexArtifact.GetIndex().Manifests, &m) + } + + return indexArtifact, nil + } else if desc.MediaType == ocispecv1.MediaTypeImageManifest || desc.MediaType == images.MediaTypeDockerSchema2Manifest { + var manifest ocispecv1.Manifest + if err := json.Unmarshal(data.Bytes(), &manifest); err != nil { + return nil, err + } + + m := oci.Manifest{ + Descriptor: desc, + Data: &manifest, + } + + manifestArtifact, err := oci.NewManifestArtifact(&m) + if err != nil { + return nil, err + } + + return manifestArtifact, nil + } + + return nil, fmt.Errorf("unable to handle mediatype: %s", desc.MediaType) +} + +func (c *client) PushOCIArtifact(ctx context.Context, ref string, artifact *oci.Artifact, options ...PushOption) error { + refspec, err := oci.ParseRef(ref) + if err != nil { + return fmt.Errorf("unable to parse ref: %w", err) + } + ref = refspec.String() + + opts := &PushOptions{} + opts.Store = c.cache + opts.ApplyOptions(options) + + tempCache := c.cache + if tempCache == nil { + tempCache = cache.NewInMemoryCache() + } + + resolver, err := c.getResolverForRef(ctx, ref, transport.PushScope) + if err != nil { + return err + } + pusher, err := resolver.Pusher(ctx, ref) + if err != nil { + return err + } + + if artifact.IsManifest() { + _, err := c.pushManifest(ctx, artifact.GetManifest().Data, pusher, tempCache, opts) + return err + } else if artifact.IsIndex() { + return c.pushImageIndex(ctx, artifact.GetIndex(), pusher, tempCache, opts) + } else { + // execution of this code should never happen + // the oci artifact should always be of type manifest or index + marshaledArtifact, err := artifact.MarshalJSON() + if err != nil { + c.log.Error(err, "unable to marshal oci artifact") + } + panic(fmt.Errorf("invalid oci artifact: %s", utils.SafeConvert(marshaledArtifact))) + } +} + +func (c *client) PushBlob(ctx context.Context, ref string, desc ocispecv1.Descriptor, options ...PushOption) error { + refspec, err := oci.ParseRef(ref) + if err != nil { + return fmt.Errorf("unable to parse ref: %w", err) + } + ref = refspec.String() + + opts := &PushOptions{} + opts.Store = c.cache + opts.ApplyOptions(options) + + resolver, err := c.getResolverForRef(ctx, ref, transport.PushScope) + if err != nil { + return err + } + pusher, err := resolver.Pusher(ctx, ref) + if err != nil { + return err + } + + if err := c.pushContent(ctx, opts.Store, pusher, desc); err != nil { + return err + } + + return nil +} + +func (c *client) pushManifest(ctx context.Context, manifest *ocispecv1.Manifest, pusher remotes.Pusher, cache cache.Cache, opts *PushOptions) (ocispecv1.Descriptor, error) { + // add dummy config if it is not set + if manifest.Config.Size == 0 { + dummyConfig := []byte("{}") + dummyDesc := ocispecv1.Descriptor{ + MediaType: "application/json", + Digest: digest.FromBytes(dummyConfig), + Size: int64(len(dummyConfig)), + } + if err := cache.Add(dummyDesc, ioutil.NopCloser(bytes.NewBuffer(dummyConfig))); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to add dummy config to cache: %w", err) + } + if err := c.pushContent(ctx, cache, pusher, dummyDesc); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to push dummy config: %w", err) + } + } else { + if err := c.pushContent(ctx, opts.Store, pusher, manifest.Config); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to push config: %w", err) + } + } + + // last upload all layers + for _, layer := range manifest.Layers { + if err := c.pushContent(ctx, opts.Store, pusher, layer); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to push layer: %w", err) + } + } + + manifestDesc, err := CreateDescriptorFromManifest(manifest) + if err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to create manifest descriptor: %w", err) + } + + manifestBytes, err := json.Marshal(manifest) + if err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to marshal manifest: %w", err) + } + + if err := cache.Add(manifestDesc, ioutil.NopCloser(bytes.NewBuffer(manifestBytes))); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to add manifest to cache: %w", err) + } + + if err := c.pushContent(ctx, cache, pusher, manifestDesc); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to push manifest: %w", err) + } + + return manifestDesc, nil +} + +func (c *client) pushImageIndex(ctx context.Context, indexArtifact *oci.Index, pusher remotes.Pusher, cache cache.Cache, opts *PushOptions) error { + manifestDescs := []ocispecv1.Descriptor{} + for _, manifest := range indexArtifact.Manifests { + mdesc, err := c.pushManifest(ctx, manifest.Data, pusher, cache, opts) + if err != nil { + return fmt.Errorf("unable to upload manifest: %w", err) + } + mdesc.Platform = manifest.Descriptor.Platform + mdesc.Annotations = manifest.Descriptor.Annotations + manifestDescs = append(manifestDescs, mdesc) + } + + index := ocispecv1.Index{ + Versioned: specs.Versioned{ + SchemaVersion: 2, + }, + Manifests: manifestDescs, + Annotations: indexArtifact.Annotations, + } + + idesc, err := createDescriptorFromIndex(cache, &index) + if err != nil { + return fmt.Errorf("unable to create image index descriptor: %w", err) + } + + if err := c.pushContent(ctx, cache, pusher, idesc); err != nil { + return fmt.Errorf("unable to push image index: %w", err) + } + + return nil +} + +func (c *client) GetManifest(ctx context.Context, ref string) (*ocispecv1.Manifest, error) { + ociArtifact, err := c.GetOCIArtifact(ctx, ref) + if err != nil { + return nil, err + } + + if !ociArtifact.IsManifest() { + return nil, fmt.Errorf("oci artifact is not a manifest: %+v", ociArtifact) + } + + return ociArtifact.GetManifest().Data, nil +} + +func (c *client) Fetch(ctx context.Context, ref string, desc ocispecv1.Descriptor, writer io.Writer) error { + refspec, err := oci.ParseRef(ref) + if err != nil { + return fmt.Errorf("unable to parse ref: %w", err) + } + ref = refspec.String() + + reader, err := c.getFetchReader(ctx, ref, desc) + if err != nil { + return err + } + defer func() { + if err := reader.Close(); err != nil { + c.log.Error(err, "failed closing reader", "ref", ref) + } + }() + + if _, err := io.Copy(writer, reader); err != nil { + return err + } + return nil +} + +func (c *client) getFetchReader(ctx context.Context, ref string, desc ocispecv1.Descriptor) (io.ReadCloser, error) { + if c.cache != nil { + reader, err := c.cache.Get(desc) + if err != nil && err != cache.ErrNotFound { + return nil, err + } + if err == nil { + return reader, nil + } + } + + resolver, err := c.getResolverForRef(ctx, ref, transport.PullScope) + if err != nil { + return nil, err + } + fetcher, err := resolver.Fetcher(ctx, ref) + if err != nil { + return nil, err + } + reader, err := fetcher.Fetch(ctx, desc) + if err != nil { + return nil, err + } + // try to cache + if c.cache != nil { + if err := c.cache.Add(desc, reader); err != nil { + // do not throw an error as cache is just an optimization + c.log.V(2).Info("unable to cache descriptor", "ref", ref, "error", err.Error()) + if err = reader.Close(); err != nil { + c.log.V(2).Info("unable to close reader", "ref", ref, "error", err.Error()) + } + return fetcher.Fetch(ctx, desc) + } + return c.cache.Get(desc) + } + + return reader, err +} + +func (c *client) PushManifest(ctx context.Context, ref string, manifest *ocispecv1.Manifest, options ...PushOption) error { + m := oci.Manifest{ + Data: manifest, + } + + a, err := oci.NewManifestArtifact(&m) + if err != nil { + return fmt.Errorf("unable to create oci artifact: %w", err) + } + + return c.PushOCIArtifact(ctx, ref, a, options...) +} + +func (c *client) getHttpClient() *http.Client { + return &http.Client{ + Transport: c.httpClient.Transport, + CheckRedirect: c.httpClient.CheckRedirect, + Jar: c.httpClient.Jar, + Timeout: c.httpClient.Timeout, + } +} + +// getRefParserOptions returns the options for reference parsing +func (c *client) getRefParserOptions(ref string) ([]name.Option, error) { + hosts, err := c.getHostConfig(ref) + if err != nil { + return nil, fmt.Errorf("unable to find registry host: %w", err) + } + if len(hosts) == 0 { + return nil, fmt.Errorf("no host configuration found: %w", err) + } + + hostConfig := hosts[0] + var options []name.Option + if hostConfig.Scheme == "http" { + options = []name.Option{ + name.Insecure, + } + } + return options, nil +} + +// getTransportForRef returns the authenticated transport for a reference. +func (c *client) getTransportForRef(ctx context.Context, ref string, scopes ...string) (http.RoundTripper, error) { + parseOptions, err := c.getRefParserOptions(ref) + if err != nil { + return nil, fmt.Errorf("unable to get ref parser options: %w", err) + } + + repo, err := name.ParseReference(ref, parseOptions...) + if err != nil { + return nil, fmt.Errorf("unable to parse ref: %w", err) + } + + auth, err := c.keychain.ResolveWithContext(ctx, repo.Context()) + if err != nil { + return nil, fmt.Errorf("unable to get authentication: %w", err) + } + + for i, scope := range scopes { + scopes[i] = repo.Scope(scope) + } + trp, err := transport.NewWithContext(ctx, repo.Context().Registry, auth, c.transport, scopes) + if err != nil { + return nil, fmt.Errorf("unable to create transport: %w", err) + } + return trp, nil +} + +// getResolverForRef returns the authenticated resolver for a reference. +func (c *client) getResolverForRef(ctx context.Context, ref string, scopes ...string) (remotes.Resolver, error) { + trp, err := c.getTransportForRef(ctx, ref, scopes...) + if err != nil { + return nil, fmt.Errorf("unable to create transport: %w", err) + } + httpClient := c.getHttpClient() + httpClient.Transport = trp + return docker.NewResolver(docker.ResolverOptions{ + Client: httpClient, + }), nil +} + +// ListTags lists all tags for a given ref. +// Implements the distribution spec defined in https://github.com/opencontainers/distribution-spec/blob/main/spec.md#api. +func (c *client) ListTags(ctx context.Context, ref string) ([]string, error) { + refspec, err := oci.ParseRef(ref) + if err != nil { + return nil, fmt.Errorf("unable to parse ref: %w", err) + } + hosts, err := c.getHostConfig(refspec.Host) + if err != nil { + return nil, fmt.Errorf("unable to find registry host: %w", err) + } + if len(hosts) == 0 { + return nil, fmt.Errorf("no host configuration found: %w", err) + } + hostConfig := hosts[0] + + trp, err := c.getTransportForRef(ctx, ref, transport.PullScope) + if err != nil { + return nil, fmt.Errorf("unable to create transport: %w", err) + } + httpClient := c.getHttpClient() + httpClient.Transport = trp + + u := &url.URL{ + Scheme: hostConfig.Scheme, + Host: hostConfig.Host, + Path: path.Join(hostConfig.Path, refspec.Repository, "tags", "list"), + // ECR returns an error if n > 1000: + // https://github.com/google/go-containerregistry/issues/681 + RawQuery: "n=1000", + } + + var tags []string + err = doRequestWithPaging(ctx, u, func(ctx context.Context, u *url.URL) (*http.Response, error) { + resp, err := c.doRequest(ctx, httpClient, u) + if err != nil { + return nil, err + } + + var data bytes.Buffer + if _, err := io.Copy(&data, resp.Body); err != nil { + return nil, fmt.Errorf("unable to read response body: %w", err) + } + if err := resp.Body.Close(); err != nil { + return nil, fmt.Errorf("unbale to close body reader: %w", err) + } + + tagList := &distributionspecv1.TagList{} + if err := json.Unmarshal(data.Bytes(), tagList); err != nil { + return nil, fmt.Errorf("unable to decode tagList list: %w", err) + } + tags = append(tags, tagList.Tags...) + return resp, nil + }) + if err != nil { + return nil, err + } + return tags, nil +} + +// ListRepositories lists all repositories for the given registry host. +func (c *client) ListRepositories(ctx context.Context, ref string) ([]string, error) { + parseOptions, err := c.getRefParserOptions(ref) + if err != nil { + return nil, fmt.Errorf("unable to get ref parser options: %w", err) + } + + repo, err := name.ParseReference(ref, parseOptions...) + if err != nil { + return nil, fmt.Errorf("unable to parse ref: %w", err) + } + + auth, err := c.keychain.ResolveWithContext(ctx, repo.Context()) + if err != nil { + return nil, fmt.Errorf("unable to get authentication: %w", err) + } + + trp, err := transport.New(repo.Context().Registry, auth, c.transport, []string{"registry:catalog:*"}) + if err != nil { + return nil, fmt.Errorf("unable to create transport: %w", err) + } + httpClient := c.getHttpClient() + httpClient.Transport = trp + + hosts, err := c.getHostConfig(repo.Context().RegistryStr()) + if err != nil { + return nil, fmt.Errorf("unable to find registry host: %w", err) + } + if len(hosts) == 0 { + return nil, fmt.Errorf("no host configuration found: %w", err) + } + hostConfig := hosts[0] + + u := &url.URL{ + Scheme: hostConfig.Scheme, + Host: hostConfig.Host, + Path: path.Join(hostConfig.Path, "_catalog"), + // ECR returns an error if n > 1000: + // https://github.com/google/go-containerregistry/issues/681 + RawQuery: "n=1000", + } + + // parse registry to also support more specific credentials e.g. for gcr with gcr.io/my-project + refspec, err := oci.ParseRef(ref) + if err != nil { + return nil, fmt.Errorf("unable to parse ref: %w", err) + } + repositories := make([]string, 0) + err = doRequestWithPaging(ctx, u, func(ctx context.Context, u *url.URL) (*http.Response, error) { + resp, err := c.doRequest(ctx, httpClient, u) + if err != nil { + return nil, err + } + + var data bytes.Buffer + if _, err := io.Copy(&data, resp.Body); err != nil { + return nil, fmt.Errorf("unable to read response body: %w", err) + } + if err := resp.Body.Close(); err != nil { + return nil, fmt.Errorf("unbale to close body reader: %w", err) + } + + repositoryList := &distributionspecv1.RepositoryList{} + if err := json.Unmarshal(data.Bytes(), repositoryList); err != nil { + return nil, fmt.Errorf("unable to decode repository list: %w", err) + } + + // the registry by default returns all repositories + // lets filter the results if a repository path is provided + if len(refspec.Repository) != 0 { + name := refspec.Name() + prefix := refspec.Repository + for _, repo := range repositoryList.Repositories { + if strings.HasPrefix(repo, prefix) || strings.HasPrefix(repo, name) { + r := refspec.DeepCopy() + r.Repository = repo + repositories = append(repositories, r.Name()) + } + } + return resp, nil + } + repositories = append(repositories, repositoryList.Repositories...) + return resp, nil + }) + if err != nil { + return nil, err + } + return repositories, nil +} + +// doRequest does a authenticated request to the given oci registry +func (c *client) doRequest(ctx context.Context, httpClient *http.Client, url *url.URL) (*http.Response, error) { + req := &http.Request{ + Method: http.MethodGet, + URL: url, + Header: make(http.Header), + } + resp, err := httpClient.Do(req.WithContext(ctx)) + if err != nil { + return nil, fmt.Errorf("unable to get %q: %w", url.String(), err) + } + + if resp.StatusCode != 200 { + var data bytes.Buffer + if _, err := io.Copy(&data, resp.Body); err != nil { + return nil, fmt.Errorf("unable to read response body: %w", err) + } + if err := resp.Body.Close(); err != nil { + return nil, fmt.Errorf("unbale to close body reader: %w", err) + } + // read error response + errRes := &distributionspecv1.ErrorResponse{} + if err := json.Unmarshal(data.Bytes(), errRes); err != nil { + return nil, fmt.Errorf("unable to decode error response: %w", err) + } + errMsg := "" + for _, err := range errRes.Detail() { + errMsg = errMsg + fmt.Sprintf("; Code: %q, Message: %q, Detail: %q", err.Code, err.Message, err.Detail) + } + return nil, fmt.Errorf("error during list call to registry with status code %d: %v", resp.StatusCode, errMsg) + } + return resp, nil +} + +type pagingFunc func(ctx context.Context, url *url.URL) (*http.Response, error) + +// doRequestWithPaging implements the oci spec paging for repositories and tags. +func doRequestWithPaging(ctx context.Context, u *url.URL, pFunc pagingFunc) error { + nextUrl := u + for { + resp, err := pFunc(ctx, nextUrl) + if err != nil { + return err + } + + // parse next url + link := resp.Header.Get("Link") + if len(link) == 0 { + return nil + } + splitLink := strings.Split(link, ";") + next := strings.NewReplacer(">", "", "<", "").Replace(splitLink[0]) + nextUrl, err = url.Parse(next) + if err != nil { + return fmt.Errorf("unable to parse next url %q: %w", next, err) + } + } +} + +func CreateDescriptorFromManifest(manifest *ocispecv1.Manifest) (ocispecv1.Descriptor, error) { + if manifest.SchemaVersion == 0 { + manifest.SchemaVersion = 2 + } + manifestBytes, err := json.Marshal(manifest) + if err != nil { + return ocispecv1.Descriptor{}, err + } + manifestDescriptor := ocispecv1.Descriptor{ + MediaType: ocispecv1.MediaTypeImageManifest, + Digest: digest.FromBytes(manifestBytes), + Size: int64(len(manifestBytes)), + } + + return manifestDescriptor, nil +} + +func createDescriptorFromIndex(cache cache.Cache, index *ocispecv1.Index) (ocispecv1.Descriptor, error) { + indexBytes, err := json.Marshal(index) + if err != nil { + return ocispecv1.Descriptor{}, err + } + indexDescriptor := ocispecv1.Descriptor{ + MediaType: ocispecv1.MediaTypeImageIndex, + Digest: digest.FromBytes(indexBytes), + Size: int64(len(indexBytes)), + } + + manifestBuf := bytes.NewBuffer(indexBytes) + if err := cache.Add(indexDescriptor, ioutil.NopCloser(manifestBuf)); err != nil { + return ocispecv1.Descriptor{}, err + } + return indexDescriptor, nil +} + +func (c *client) pushContent(ctx context.Context, store Store, pusher remotes.Pusher, desc ocispecv1.Descriptor) error { + if store == nil { + return errors.New("a store is needed to upload content but no store has been defined") + } + r, err := store.Get(desc) + if err != nil { + return err + } + defer r.Close() + + writer, err := pusher.Push(AddKnownMediaTypesToCtx(ctx, []string{desc.MediaType}), desc) + if err != nil { + if errdefs.IsAlreadyExists(err) { + return nil + } + return err + } + defer writer.Close() + return content.Copy(ctx, writer, r, desc.Size, desc.Digest) +} + +// AddKnownMediaTypesToCtx adds a list of known media types to the context +func AddKnownMediaTypesToCtx(ctx context.Context, mediaTypes []string) context.Context { + for _, mediaType := range mediaTypes { + ctx = remotes.WithMediaTypeKeyPrefix(ctx, mediaType, "custom") + } + return ctx +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/constants.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/constants.go new file mode 100644 index 000000000..f13b6b99b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/constants.go @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package ociclient + +import "k8s.io/apimachinery/pkg/util/sets" + +// MediaTypeTarGzip is the media type for a gzipped tar +const MediaTypeTarGzip = "application/tar+gzip" + +// MediaTypeTar is the media type for a tar +const MediaTypeTar = "application/tar" + +// DefaultKnownMediaTypes contain also known media types of the oci client +var DefaultKnownMediaTypes = sets.NewString( + MediaTypeTarGzip, + MediaTypeTar, +) diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/copy.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/copy.go new file mode 100644 index 000000000..a29a71c65 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/copy.go @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package ociclient + +import ( + "context" + "fmt" + "io" + + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" +) + +// Copy copies a oci artifact from one location to a target ref. +// The artifact is copied without any modification. +// This function does directly stream the blobs from the upstream it does not use any cache. +func Copy(ctx context.Context, client Client, from, to string) error { + artifact, err := client.GetOCIArtifact(ctx, from) + if err != nil { + return fmt.Errorf("unable to get source oci artifact %q: %w", from, err) + } + + store := GenericStore(func(ctx context.Context, desc ocispecv1.Descriptor, writer io.Writer) error { + return client.Fetch(ctx, from, desc, writer) + }) + + return client.PushOCIArtifact(ctx, to, artifact, WithStore(store)) +} + +// GenericStore is a helper struct to implement a custom oci blob store. +type GenericStore func(ctx context.Context, desc ocispecv1.Descriptor, writer io.Writer) error + +func (s GenericStore) Get(desc ocispecv1.Descriptor) (io.ReadCloser, error) { + ctx := context.Background() + reader, writer := io.Pipe() + go func() { + defer writer.Close() + defer ctx.Done() + if err := s(ctx, desc, writer); err != nil { + _ = reader.CloseWithError(err) + } + }() + return reader, nil +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/builder.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/builder.go new file mode 100644 index 000000000..6510d2f87 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/builder.go @@ -0,0 +1,175 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package credentials + +import ( + "bytes" + "fmt" + "path/filepath" + + "github.com/docker/cli/cli/config" + dockerconfig "github.com/docker/cli/cli/config" + "github.com/docker/cli/cli/config/configfile" + "github.com/docker/cli/cli/config/credentials" + "github.com/go-logr/logr" + "github.com/mandelsoft/vfs/pkg/osfs" + "github.com/mandelsoft/vfs/pkg/vfs" + corev1 "k8s.io/api/core/v1" +) + +// KeyringBuilder is a builder to create and fill a keyring from different sources +type KeyringBuilder struct { + log logr.Logger + fs vfs.FileSystem + pullSecrets []corev1.Secret + configFiles []string + + disableDefaultConfig bool +} + +// NewBuilder creates a new keyring builder +func NewBuilder(log logr.Logger) *KeyringBuilder { + return &KeyringBuilder{ + log: log, + } +} + +// applyDefaults sets the builder defaults for undefined options +func (b *KeyringBuilder) applyDefaults() { + if b.fs == nil { + b.fs = osfs.New() + } + + if !b.disableDefaultConfig { + // add docker default config to config files + defaultDockerConfigFile := filepath.Join(config.Dir(), config.ConfigFileName) + + // only add default if the file exists + if _, err := b.fs.Stat(defaultDockerConfigFile); err == nil { + b.configFiles = append(b.configFiles, defaultDockerConfigFile) + } + } +} + +// DisableDefaultConfig disables the read from the default docker config on the system +func (b *KeyringBuilder) DisableDefaultConfig() *KeyringBuilder { + b.disableDefaultConfig = true + return b +} + +// WithFS defines the filesystem that should be used to read data +func (b *KeyringBuilder) WithFS(fs vfs.FileSystem) *KeyringBuilder { + b.fs = fs + return b +} + +// FromPullSecrets adds k8s secrets resources that contain pull secrets. +func (b *KeyringBuilder) FromPullSecrets(secrets ...corev1.Secret) *KeyringBuilder { + b.pullSecrets = secrets + return b +} + +// FromConfigFiles adds file paths to docker config definitions +func (b *KeyringBuilder) FromConfigFiles(files ...string) *KeyringBuilder { + b.configFiles = files + return b +} + +// Build creates a new oci registry keyring from the configured secrets. +func (b *KeyringBuilder) Build() (*GeneralOciKeyring, error) { + b.applyDefaults() + store := New() + for _, secret := range b.pullSecrets { + if secret.Type != corev1.SecretTypeDockerConfigJson { + continue + } + dockerConfigBytes, ok := secret.Data[corev1.DockerConfigJsonKey] + if !ok { + continue + } + + dockerConfig, err := dockerconfig.LoadFromReader(bytes.NewBuffer(dockerConfigBytes)) + if err != nil { + return nil, err + } + + // currently only support the default credential store. + credStore := dockerConfig.GetCredentialsStore("") + if err := store.Add(credStore); err != nil { + return nil, err + } + } + + // get default native credential store + defaultStore := credentials.DetectDefaultStore("") + for _, configFile := range b.configFiles { + if len(configFile) == 0 { + continue + } + dockerConfigBytes, err := vfs.ReadFile(b.fs, configFile) + if err != nil { + return nil, err + } + + dockerConfig, err := dockerconfig.LoadFromReader(bytes.NewBuffer(dockerConfigBytes)) + if err != nil { + return nil, err + } + + for address, dockerAuth := range dockerConfig.AuthConfigs { + auth := FromAuthConfig(dockerAuth) + // if the auth is empty use the default store to get the authentication + if !IsEmptyAuthConfig(auth) || len(defaultStore) == 0 { + if err := store.AddAuthConfig(address, auth); err != nil { + return nil, fmt.Errorf("unable to add auth for %q to store: %w", address, err) + } + b.log.V(10).Info(fmt.Sprintf("added authentication for %q from %q", address, configFile)) + } else { + err := store.AddAuthConfigGetter(address, CredentialHelperAuthConfigGetter(b.log, dockerConfig, address, defaultStore)) + if err != nil { + return nil, err + } + b.log.V(10).Info(fmt.Sprintf("added authentication for %q from %q with the default native credential store", address, configFile)) + } + } + + // add native store for external program authentication + for address, helper := range dockerConfig.CredentialHelpers { + err := store.AddAuthConfigGetter(address, CredentialHelperAuthConfigGetter(b.log, dockerConfig, address, helper)) + b.log.V(10).Info(fmt.Sprintf("added authentication for %q with credential helper %s", address, helper)) + if err != nil { + return nil, err + } + } + } + + return store, nil +} + +// CredentialHelperAuthConfigGetter describes a default getter method for a authentication method +func CredentialHelperAuthConfigGetter(log logr.Logger, dockerConfig *configfile.ConfigFile, address, helper string) AuthConfigGetter { + nativeStore := credentials.NewNativeStore(dockerConfig, helper) + return func(_ string) (Auth, error) { + log.V(8).Info(fmt.Sprintf("use oci cred helper %q to get %q", helper, address)) + auth, err := nativeStore.Get(address) + if err != nil { + msg := fmt.Sprintf("unable to get oci authentication information from external credentials helper %q for %q: %s", helper, address, err.Error()) + log.V(4).Info(msg) + } + return FromAuthConfig(auth, "credential-helper", helper), err + } +} + +// CreateOCIRegistryKeyringFromFilesystem creates a new OCI registry keyring from a given file system. +// DEPRECATED: Use the Configbuilder +func CreateOCIRegistryKeyringFromFilesystem(pullSecrets []corev1.Secret, configFiles []string, fs vfs.FileSystem) (*GeneralOciKeyring, error) { + return NewBuilder(logr.Discard()).WithFS(fs).FromConfigFiles(configFiles...).FromPullSecrets(pullSecrets...).Build() +} + +// CreateOCIRegistryKeyring creates a new OCI registry keyring. +// DEPRECATED: Use the Configbuilder +func CreateOCIRegistryKeyring(pullSecrets []corev1.Secret, configFiles []string) (*GeneralOciKeyring, error) { + return NewBuilder(logr.Discard()).WithFS(osfs.New()).FromConfigFiles(configFiles...).FromPullSecrets(pullSecrets...).Build() +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/keyring.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/keyring.go new file mode 100644 index 000000000..c152751e0 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/keyring.go @@ -0,0 +1,380 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package credentials + +import ( + "context" + "net/url" + "path" + "strings" + + dockerreference "github.com/containerd/containerd/reference/docker" + dockercreds "github.com/docker/cli/cli/config/credentials" + dockerconfigtypes "github.com/docker/cli/cli/config/types" + "github.com/google/go-containerregistry/pkg/authn" + + "github.com/gardener/component-cli/pkg/logcontext" +) + +// to find a suitable secret for images on Docker Hub, we need its two domains to do matching +const ( + dockerHubDomain = "docker.io" + dockerHubLegacyDomain = "index.docker.io" +) + +// UsedUserLogKey describes the key that is injected into the logging context values. +const UsedUserLogKey = "ociUser" + +// Auth describes a interface of the dockerconfigtypes.Auth struct +type Auth interface { + GetUsername() string + GetPassword() string + GetAuth() string + + // GetIdentityToken is used to authenticate the user and get + // an access token for the registry. + GetIdentityToken() string + + // GetRegistryToken is a bearer token to be sent to a registry + GetRegistryToken() string +} + +// Informer describes a interface that returns optional metadata. +// The Auth interface can be enhanced using metadata +type Informer interface { + Info() map[string]string +} + +// AuthConfig implements the Auth using the docker authconfig type. +// It also implements the Informer interface for additional information +type AuthConfig struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Auth string `json:"auth,omitempty"` + + // Email is an optional value associated with the username. + // This field is deprecated and will be removed in a later + // version of docker. + Email string `json:"email,omitempty"` + + ServerAddress string `json:"serveraddress,omitempty"` + + // IdentityToken is used to authenticate the user and get + // an access token for the registry. + IdentityToken string `json:"identitytoken,omitempty"` + + // RegistryToken is a bearer token to be sent to a registry + RegistryToken string `json:"registrytoken,omitempty"` + + Metadata map[string]string `json:"metadata,omitempty"` +} + +// FromAuthConfig creates a Auth object using the docker authConfig type +func FromAuthConfig(cfg dockerconfigtypes.AuthConfig, keysAndValues ...string) AuthConfig { + metadata := make(map[string]string) + var prevKey string + for _, v := range keysAndValues { + if len(prevKey) == 0 { + prevKey = v + continue + } + metadata[prevKey] = v + prevKey = "" + } + + return AuthConfig{ + Username: cfg.Username, + Password: cfg.Password, + Auth: cfg.Auth, + IdentityToken: cfg.IdentityToken, + RegistryToken: cfg.RegistryToken, + Metadata: metadata, + } +} + +func (a AuthConfig) GetUsername() string { + return a.Username +} + +func (a AuthConfig) GetPassword() string { + return a.Password +} + +func (a AuthConfig) GetAuth() string { + return a.Auth +} + +func (a AuthConfig) GetIdentityToken() string { + return a.IdentityToken +} + +func (a AuthConfig) GetRegistryToken() string { + return a.RegistryToken +} + +func (a AuthConfig) Info() map[string]string { + return a.Metadata +} + +// Keyring enhances the google go-lib auth keyring with a contextified resolver +type Keyring interface { + authn.Keychain + // ResolveWithContext looks up the most appropriate credential for the specified target. + ResolveWithContext(context.Context, authn.Resource) (authn.Authenticator, error) +} + +// OCIKeyring is the interface that implements are keyring to retrieve credentials for a given +// server. +type OCIKeyring interface { + authn.Keychain + // ResolveWithContext looks up the most appropriate credential for the specified target. + ResolveWithContext(context.Context, authn.Resource) (authn.Authenticator, error) + // Get retrieves credentials from the keyring for a given resource url. + Get(resourceURl string) Auth + // GetCredentials returns the username and password for a hostname if defined. + GetCredentials(hostname string) (username, password string, err error) +} + +// AuthConfigGetter is a function that returns a auth config for a given host name +type AuthConfigGetter func(address string) (Auth, error) + +// DefaultAuthConfigGetter describes a default getter method for a authentication method +func DefaultAuthConfigGetter(config Auth) AuthConfigGetter { + return func(_ string) (Auth, error) { + return config, nil + } +} + +// GeneralOciKeyring is general implementation of a oci keyring that can be extended with other credentials. +type GeneralOciKeyring struct { + // index is an additional index structure that also contains multi + index *IndexNode + store map[string][]AuthConfigGetter +} + +type IndexNode struct { + Segment string + Addresses []string + Children []*IndexNode +} + +func (n *IndexNode) Set(path string, addresses ...string) { + splitPath := strings.Split(path, "/") + if len(splitPath) == 0 || (len(splitPath) == 1 && len(splitPath[0]) == 0) { + n.Addresses = append(n.Addresses, addresses...) + return + } + child := n.FindSegment(splitPath[0]) + if child == nil { + child = &IndexNode{ + Segment: splitPath[0], + } + n.Children = append(n.Children, child) + } + child.Set(strings.Join(splitPath[1:], "/"), addresses...) +} + +func (n *IndexNode) FindSegment(segment string) *IndexNode { + for _, child := range n.Children { + if child.Segment == segment { + return child + } + } + return nil +} + +func (n *IndexNode) Find(path string) ([]string, bool) { + splitPath := strings.Split(path, "/") + if len(splitPath) == 0 || (len(splitPath) == 1 && len(splitPath[0]) == 0) { + return n.Addresses, true + } + child := n.FindSegment(splitPath[0]) + if child == nil { + // returns the current address if no more specific auth config is defined + return n.Addresses, true + } + return child.Find(strings.Join(splitPath[1:], "/")) +} + +// New creates a new empty general oci keyring. +func New() *GeneralOciKeyring { + return &GeneralOciKeyring{ + index: &IndexNode{}, + store: make(map[string][]AuthConfigGetter), + } +} + +var _ OCIKeyring = &GeneralOciKeyring{} + +// Size returns the size of the keyring +func (o GeneralOciKeyring) Size() int { + return len(o.store) +} + +func (o GeneralOciKeyring) Get(resourceURl string) Auth { + ref, err := dockerreference.ParseDockerRef(resourceURl) + if err == nil { + // if the name is not conical try to treat it like a host name + resourceURl = ref.Name() + } + if auth := o.get(resourceURl); auth != nil { + return auth + } + + // fallback to legacy docker domain if applicable + // this is how containerd translates the old domain for DockerHub to the new one, taken from containerd/reference/docker/reference.go:674 + if ref != nil && dockerreference.Domain(ref) == dockerHubDomain { + dockerreference.Path(ref) + return o.get(path.Join(dockerHubLegacyDomain, dockerreference.Path(ref))) + } + return nil +} + +func (o GeneralOciKeyring) get(url string) Auth { + addresses, ok := o.index.Find(url) + if !ok { + return nil + } + for _, address := range addresses { + authGetters, ok := o.store[address] + if !ok { + continue + } + for _, authGetter := range authGetters { + auth, err := authGetter(url) + if err != nil { + // todo: add logger + continue + } + if IsEmptyAuthConfig(auth) { + // try another config if the current one is emtpy + continue + } + return auth + } + + } + return nil +} + +// GetCredentials returns the username and password for a given hostname. +// It implements the Credentials func for a docker resolver +func (o *GeneralOciKeyring) GetCredentials(hostname string) (username, password string, err error) { + auth := o.get(hostname) + if auth == nil { + // fallback to legacy docker domain if applicable + // this is how containerd translates the old domain for DockerHub to the new one, taken from containerd/reference/docker/reference.go:674 + if hostname == dockerHubDomain { + return o.GetCredentials(dockerHubLegacyDomain) + } + // try authentication with no username and password. + // this is needed by some registries like ghcr that require a auth token flow even for public images. + return "", "", nil + + // todo: add log for the error if now authentication can be found + //return "", "", fmt.Errorf("authentication for %s cannot be found", hostname) + } + + return auth.GetUsername(), auth.GetPassword(), nil +} + +// AddAuthConfig adds a auth config for a address +func (o *GeneralOciKeyring) AddAuthConfig(address string, auth Auth) error { + return o.AddAuthConfigGetter(address, DefaultAuthConfigGetter(auth)) +} + +// AddAuthConfigGetter adds a auth config for a address +func (o *GeneralOciKeyring) AddAuthConfigGetter(address string, getter AuthConfigGetter) error { + // normalize host name + var err error + address, err = normalizeHost(address) + if err != nil { + return err + } + o.store[address] = append(o.store[address], getter) + o.index.Set(address, address) + return nil +} + +// Add adds all addresses of a docker credential store. +func (o *GeneralOciKeyring) Add(store dockercreds.Store) error { + auths, err := store.GetAll() + if err != nil { + return err + } + for address, auth := range auths { + if err := o.AddAuthConfig(address, FromAuthConfig(auth)); err != nil { + return err + } + } + return nil +} + +// Resolve implements the google container registry auth interface. +func (o *GeneralOciKeyring) Resolve(resource authn.Resource) (authn.Authenticator, error) { + return o.ResolveWithContext(context.TODO(), resource) +} + +// ResolveWithContext implements the google container registry auth interface. +func (o *GeneralOciKeyring) ResolveWithContext(ctx context.Context, resource authn.Resource) (authn.Authenticator, error) { + authconfig := o.Get(resource.String()) + if authconfig == nil { + logcontext.AddContextValue(ctx, UsedUserLogKey, "anonymous") + return authn.FromConfig(authn.AuthConfig{}), nil + } + + if ctxVal := logcontext.FromContext(ctx); ctxVal != nil { + (*ctxVal)[UsedUserLogKey] = authconfig.GetUsername() + if informer, ok := authconfig.(Informer); ok { + ctxVal := logcontext.FromContext(ctx) + for key, val := range informer.Info() { + (*ctxVal)[key] = val + } + } + } + + return authn.FromConfig(authn.AuthConfig{ + Username: authconfig.GetUsername(), + Password: authconfig.GetPassword(), + Auth: authconfig.GetAuth(), + IdentityToken: authconfig.GetIdentityToken(), + RegistryToken: authconfig.GetRegistryToken(), + }), nil +} + +func normalizeHost(u string) (string, error) { + if !strings.Contains(u, "://") { + u = "dummy://" + u + } + host, err := url.Parse(u) + if err != nil { + return "", err + } + return path.Join(host.Host, host.Path), nil +} + +// Merge merges all authentication options from keyring 1 and 2. +// Keyring 2 overwrites authentication from keyring 1 on clashes. +func Merge(k1, k2 *GeneralOciKeyring) error { + for address, getters := range k2.store { + for _, getter := range getters { + if err := k1.AddAuthConfigGetter(address, getter); err != nil { + return err + } + } + } + return nil +} + +// IsEmptyAuthConfig validates if the resulting auth config contains credentails +func IsEmptyAuthConfig(auth Auth) bool { + if len(auth.GetAuth()) != 0 { + return false + } + if len(auth.GetUsername()) != 0 { + return false + } + return true +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/secretserver/README.md b/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/secretserver/README.md new file mode 100644 index 000000000..7dfd3a779 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/secretserver/README.md @@ -0,0 +1,10 @@ +# SecretServer + +The secret server auth implements the retrieval of secrets using the gardener secrets server defined in https://github.com/gardener/cc-utils/blob/master/ccc/secrets_server.py#L29 . + +### Contract + +1. Get Secret Server endpoint from env var `SECRETS_SERVER_ENDPOINT` +2. Get secret key and cipher from the env var `SECRET_KEY` and `SECRET_CIPHER_ALGORITHM` + - The secret key is base64 encoded +3. Decrypt complete config json using the given secret key and cipher diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/secretserver/secret_server.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/secretserver/secret_server.go new file mode 100644 index 000000000..a797adb6a --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/credentials/secretserver/secret_server.go @@ -0,0 +1,325 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package secretserver + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "os" + "path/filepath" + + dockerconfigtypes "github.com/docker/cli/cli/config/types" + "github.com/go-logr/logr" + "github.com/mandelsoft/vfs/pkg/osfs" + "github.com/mandelsoft/vfs/pkg/vfs" + + "github.com/gardener/component-cli/ociclient/credentials" +) + +// ContainerRegistryConfigType is the cc secret server container registry config type +const ContainerRegistryConfigType = "container_registry" + +// EndpointEnvVarName is the name of the envvar that contains the endpoint of the secret server. +const EndpointEnvVarName = "SECRETS_SERVER_ENDPOINT" + +// ConcourseConfigEnvVarName is the name of the envvar that contains the name of concourse config. +const ConcourseConfigEnvVarName = "SECRETS_SERVER_CONCOURSE_CFG_NAME" + +// SecretKeyEnvVarName is the name of the envar that contains the decryption key. +const SecretKeyEnvVarName = "SECRET_KEY" + +// CipherEnvVarName is the name of the envvar that contains the decryption cipher algorithm. +const CipherEnvVarName = "SECRET_CIPHER_ALGORITHM" + +type Privilege string + +const ( + ReadOnly Privilege = "readonly" + ReadWrite Privilege = "readwrite" +) + +// SecretServerConfig is the struct that describes the secret server concourse config +type SecretServerConfig struct { + ContainerRegistry map[string]*ContainerRegistryCredentials `json:"container_registry"` +} + +// ContainerRegistryCredentials describes the container registry credentials struct as given by the cc secrets server. +type ContainerRegistryCredentials struct { + Username string `json:"username"` + Password string `json:"password"` + Privileges Privilege `json:"privileges"` + Host string `json:"host,omitempty"` + ImageReferencePrefixes []string `json:"image_reference_prefixes,omitempty"` +} + +// KeyringBuilder is a builder that creates a keyring from a concourse config file. +type KeyringBuilder struct { + log logr.Logger + fs vfs.FileSystem + path string + minPrivileges Privilege + forRef string +} + +// New creates a new keyring builder. +func New() *KeyringBuilder { + return &KeyringBuilder{ + log: logr.Discard(), + } +} + +// WithLog configures a optional logger +func (kb *KeyringBuilder) WithLog(log logr.Logger) *KeyringBuilder { + kb.log = log + return kb +} + +// WithFS configures the builder to use a different filesystem +func (kb *KeyringBuilder) WithFS(fs vfs.FileSystem) *KeyringBuilder { + kb.fs = fs + return kb +} + +// FromPath configures local concourse config file. +func (kb *KeyringBuilder) FromPath(path string) *KeyringBuilder { + kb.path = path + return kb +} + +// For configures the builder to only include the config that one reference. +func (kb *KeyringBuilder) For(ref string) *KeyringBuilder { + kb.forRef = ref + return kb +} + +// WithMinPrivileges configures the builder to only include credentials with a minimal config +func (kb *KeyringBuilder) WithMinPrivileges(priv Privilege) *KeyringBuilder { + kb.minPrivileges = priv + return kb +} + +// Build creates a oci keyring based on the given configuration. +// It returns nil if now credentials can be found. +func (kb *KeyringBuilder) Build() (*credentials.GeneralOciKeyring, error) { + keyring := credentials.New() + if err := kb.Apply(keyring); err != nil { + return nil, err + } + if keyring.Size() == 0 { + return nil, nil + } + return keyring, nil +} + +// Apply applies the found configuration to the given keyring. +func (kb *KeyringBuilder) Apply(keyring *credentials.GeneralOciKeyring) error { + // set defaults + if kb.fs == nil { + kb.fs = osfs.New() + } + if len(kb.minPrivileges) == 0 { + kb.minPrivileges = ReadOnly + } + + // read from local path + if len(kb.path) != 0 { + file, err := kb.fs.Open(kb.path) + if err != nil { + return fmt.Errorf("unable to load config from %q: %w", kb.path, err) + } + defer file.Close() + config := &SecretServerConfig{} + if err := json.NewDecoder(file).Decode(config); err != nil { + return fmt.Errorf("unable to decode config") + } + return newKeyring(keyring, config, kb.minPrivileges, kb.forRef) + } + + srv, err := NewSecretServer() + if err != nil { + if errors.Is(err, NoSecretFoundError) { + kb.log.V(3).Info(err.Error()) + return nil + } + kb.log.Error(err, "unable to init secret server") + return nil + } + config, err := srv.Get() + if err != nil { + return err + } + return newKeyring(keyring, config, kb.minPrivileges, kb.forRef) +} + +type SecretServer struct { + endpoint string + configName string + + cipherAlgorithm string + key []byte +} + +var NoSecretFoundError = errors.New("no secret server configuration found") + +const unencyptedEndpoint = "concourse-secrets/concourse_cfg" + +// NewSecretServer creates a new secret server instance using given env vars. +func NewSecretServer() (*SecretServer, error) { + keyBase64, cipher := os.Getenv(SecretKeyEnvVarName), os.Getenv(CipherEnvVarName) + secSrvEndpoint, ccConfig := os.Getenv(EndpointEnvVarName), os.Getenv(ConcourseConfigEnvVarName) + + key, err := base64.StdEncoding.DecodeString(keyBase64) + if err != nil { + return nil, fmt.Errorf("unable to decode base64 encoded key %q: %w", keyBase64, err) + } + + if len(keyBase64) == 0 { + ccConfig = unencyptedEndpoint + } + + if len(secSrvEndpoint) == 0 { + return nil, NoSecretFoundError + } + + return &SecretServer{ + endpoint: secSrvEndpoint, + configName: ccConfig, + cipherAlgorithm: cipher, + key: key, + }, nil +} + +// Get returns the secret configuration from the server. +func (ss *SecretServer) Get() (*SecretServerConfig, error) { + reader, err := ss.read() + if err != nil { + return nil, err + } + defer reader.Close() + config := &SecretServerConfig{} + if err := json.NewDecoder(reader).Decode(config); err != nil { + return nil, fmt.Errorf("unable to decode config: %w", err) + } + return config, err +} + +func (ss *SecretServer) read() (io.ReadCloser, error) { + reader, err := getConfigFromSecretServer(ss.endpoint, ss.configName) + if err != nil { + return nil, err + } + + if ss.configName == unencyptedEndpoint { + return reader, err + } + + switch ss.cipherAlgorithm { + case "AES.ECB": + var srcBuf bytes.Buffer + if _, err := io.Copy(&srcBuf, reader); err != nil { + return nil, fmt.Errorf("unable to read body from secret server: %w", err) + } + if err := reader.Close(); err != nil { + return nil, err + } + block, err := aes.NewCipher(ss.key) + if err != nil { + return nil, fmt.Errorf("unable to create cipher for %q; %w", ss.cipherAlgorithm, err) + } + dst := make([]byte, srcBuf.Len()) + if err := ECBDecrypt(block, dst, srcBuf.Bytes()); err != nil { + return nil, err + } + //_ = os.WriteFile("/tmp/cc.json", dst, os.ModePerm) + //fmt.Println(string(dst)) + //var d map[string]json.RawMessage + //if err := json.Unmarshal(dst, &d); err != nil { + // panic(err) + //} + //fmt.Println(string(d["container_registry"])) + + return ioutil.NopCloser(bytes.NewBuffer(dst)), nil + default: + return nil, fmt.Errorf("unknown block %q", ss.cipherAlgorithm) + } +} + +func getConfigFromSecretServer(endpoint, configName string) (io.ReadCloser, error) { + u, err := url.Parse(endpoint) + if err != nil { + return nil, fmt.Errorf("unable to parse secret server url %q: %w", endpoint, err) + } + u.Path = filepath.Join(u.Path, configName) + + res, err := http.Get(u.String()) + if err != nil { + return nil, fmt.Errorf("unable to get config from secret server %q: %w", u.String(), err) + } + return res.Body, nil +} + +// newKeyring creates a new oci keyring from a config given by the reader +// if ref is defined only the credentials that match the ref are put into the keyring. +func newKeyring(keyring *credentials.GeneralOciKeyring, config *SecretServerConfig, minPriv Privilege, ref string) error { + for key, cred := range config.ContainerRegistry { + if minPriv == ReadWrite { + // if no privileges are set we assume that they default to readonly. + if cred.Privileges == ReadOnly || len(cred.Privileges) == 0 { + continue + } + } + + if len(cred.Host) != 0 { + host, err := url.Parse(cred.Host) + if err != nil { + return fmt.Errorf("unable to parse url %q in config %q: %w", cred.Host, key, err) + } + err = keyring.AddAuthConfig(host.Host, credentials.FromAuthConfig(dockerconfigtypes.AuthConfig{ + Username: cred.Username, + Password: cred.Password, + }, "cc-config-name", key)) + if err != nil { + return fmt.Errorf("unable to add auth config: %w", err) + } + } + for _, prefix := range cred.ImageReferencePrefixes { + err := keyring.AddAuthConfig(prefix, credentials.FromAuthConfig(dockerconfigtypes.AuthConfig{ + Username: cred.Username, + Password: cred.Password, + }, "cc-config-name", key)) + if err != nil { + return fmt.Errorf("unable to add auth config: %w", err) + } + } + } + + return nil +} + +// ECBDecrypt decrypts ecb data. +func ECBDecrypt(block cipher.Block, dst, src []byte) error { + blockSize := block.BlockSize() + if len(src)%blockSize != 0 { + return fmt.Errorf("crypto/cipher: input not full blocks (blocksize: %d; src: %d)", blockSize, len(src)) + } + if len(dst) < len(src) { + return errors.New("crypto/cipher: output smaller than input") + } + for len(src) > 0 { + block.Decrypt(dst, src[:blockSize]) + src = src[blockSize:] + dst = dst[blockSize:] + } + return nil +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/doc.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/doc.go new file mode 100644 index 000000000..92b25cabd --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mockgen -destination=./mock/client_mock.go github.com/gardener/component-cli/ociclient Client + +package ociclient diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/manifest_v1_conversion.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/manifest_v1_conversion.go new file mode 100644 index 000000000..6c3b1656c --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/manifest_v1_conversion.go @@ -0,0 +1,266 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package ociclient + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "strings" + "time" + + "github.com/containerd/containerd/archive/compression" + "github.com/containerd/containerd/images" + "github.com/opencontainers/go-digest" + "github.com/opencontainers/image-spec/specs-go" + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" + + "github.com/gardener/component-cli/ociclient/cache" + "github.com/gardener/component-cli/pkg/utils" +) + +// ************************************************************************************* +// Docker Manifest v2 Schema 1 Support +// see also: +// - https://docs.docker.com/registry/spec/manifest-v2-1/ +// - https://github.com/moby/moby/blob/master/image/v1/imagev1.go +// - https://github.com/containerd/containerd/blob/main/remotes/docker/schema1/converter.go +// ************************************************************************************* + +const ( + MediaTypeDockerV2Schema1Manifest = "application/vnd.docker.distribution.manifest.v1+json" + MediaTypeDockerV2Schema1SignedManifest = images.MediaTypeDockerSchema1Manifest + MediaTypeImageLayerZstd = "application/vnd.oci.image.layer.v1.tar+zstd" +) + +// FSLayer represents 1 item in a schema 1 "fsLayers" list +type FSLayer struct { + BlobSum digest.Digest `json:"blobSum"` +} + +// History represents 1 item in a schema 1 "history" list +type History struct { + V1Compatibility string `json:"v1Compatibility"` +} + +// V1Manifest describes a Docker v2 Schema 1 manifest +type V1Manifest struct { + FSLayers []FSLayer `json:"fsLayers"` + History []History `json:"history"` +} + +// V1History is the unmarshalled v1Compatibility property of a history item +type V1History struct { + Author string `json:"author,omitempty"` + Created time.Time `json:"created"` + Comment string `json:"comment,omitempty"` + ThrowAway *bool `json:"throwaway,omitempty"` + Size *int `json:"Size,omitempty"` + ContainerConfig struct { + Cmd []string `json:"Cmd,omitempty"` + } `json:"container_config,omitempty"` +} + +// ConvertV1ManifestToV2 converts a Docker v2 Schema 1 manifest to Docker v2 Schema 2. +// The converted manifest is stored in the cache. The descriptor of the cached manifest is returned. +func ConvertV1ManifestToV2(ctx context.Context, client Client, cache cache.Cache, ref string, v1ManifestDesc ocispecv1.Descriptor) (ocispecv1.Descriptor, error) { + buf := bytes.NewBuffer([]byte{}) + if err := client.Fetch(ctx, ref, v1ManifestDesc, buf); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to fetch v1 manifest blob: %w", err) + } + + var v1Manifest V1Manifest + if err := json.Unmarshal(buf.Bytes(), &v1Manifest); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to unmarshal v1 manifest: %w", err) + } + + layers, diffIDs, history, err := ParseV1Manifest(ctx, client, ref, &v1Manifest) + if err != nil { + return ocispecv1.Descriptor{}, err + } + + v2ConfigDesc, v2ConfigBytes, err := CreateV2Config(&v1Manifest, diffIDs, history) + if err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to create v2 config: %w", err) + } + + v2ManifestDesc, v2ManifestBytes, err := CreateV2Manifest(v2ConfigDesc, layers) + if err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to create v2 manifest: %w", err) + } + + err = cache.Add(v2ConfigDesc, io.NopCloser(bytes.NewReader(v2ConfigBytes))) + if err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to write config blob to cache: %w", err) + } + + err = cache.Add(v2ManifestDesc, io.NopCloser(bytes.NewReader(v2ManifestBytes))) + if err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to write manifest blob to cache: %w", err) + } + + return v2ManifestDesc, nil +} + +// ParseV1Manifest returns the data necessary to build a v2 manifest from a v1 manifest +func ParseV1Manifest(ctx context.Context, client Client, ref string, v1Manifest *V1Manifest) (layers []ocispecv1.Descriptor, diffIDs []digest.Digest, history []ocispecv1.History, err error) { + layers = []ocispecv1.Descriptor{} + diffIDs = []digest.Digest{} + history = []ocispecv1.History{} + + // layers in v1 are reversed compared to v2 --> iterate backwards + for i := len(v1Manifest.FSLayers) - 1; i >= 0; i-- { + var h V1History + if err := json.Unmarshal([]byte(v1Manifest.History[i].V1Compatibility), &h); err != nil { + return nil, nil, nil, fmt.Errorf("unable to unmarshal v1 history: %w", err) + } + + emptyLayer := isEmptyLayer(&h) + + hs := ocispecv1.History{ + Author: h.Author, + Comment: h.Comment, + Created: &h.Created, + CreatedBy: strings.Join(h.ContainerConfig.Cmd, " "), + EmptyLayer: emptyLayer, + } + history = append(history, hs) + + if !emptyLayer { + fslayer := v1Manifest.FSLayers[i] + layerDesc := ocispecv1.Descriptor{ + Digest: fslayer.BlobSum, + Size: -1, + } + + buf := bytes.NewBuffer([]byte{}) + if err := client.Fetch(ctx, ref, layerDesc, buf); err != nil { + return nil, nil, nil, fmt.Errorf("unable to fetch layer blob: %w", err) + } + data := buf.Bytes() + + decompressedReader, err := compression.DecompressStream(bytes.NewReader(data)) + if err != nil { + return nil, nil, nil, fmt.Errorf("unable to decompress layer blob: %w", err) + } + + decompressedData, err := ioutil.ReadAll(decompressedReader) + if err != nil { + return nil, nil, nil, fmt.Errorf("unable to read decompressed layer blob: %w", err) + } + + var mediatype string + switch decompressedReader.GetCompression() { + case compression.Uncompressed: + mediatype = ocispecv1.MediaTypeImageLayer + case compression.Gzip: + mediatype = ocispecv1.MediaTypeImageLayerGzip + case compression.Zstd: + mediatype = MediaTypeImageLayerZstd + } + + des := ocispecv1.Descriptor{ + Digest: fslayer.BlobSum, + MediaType: mediatype, + Size: int64(len(data)), + } + + layers = append(layers, des) + diffIDs = append(diffIDs, digest.FromBytes(decompressedData)) + } + } + + return +} + +// CreateV2Manifest creates a v2 manifest +func CreateV2Manifest(configDesc ocispecv1.Descriptor, layers []ocispecv1.Descriptor) (ocispecv1.Descriptor, []byte, error) { + v2Manifest := ocispecv1.Manifest{ + Versioned: specs.Versioned{ + SchemaVersion: 2, + }, + Config: configDesc, + Layers: layers, + } + + marshaledV2Manifest, err := json.Marshal(v2Manifest) + if err != nil { + return ocispecv1.Descriptor{}, nil, fmt.Errorf("unable to marshal manifest: %w", err) + } + + v2ManifestDesc := ocispecv1.Descriptor{ + MediaType: ocispecv1.MediaTypeImageManifest, + Digest: digest.FromBytes(marshaledV2Manifest), + Size: int64(len(marshaledV2Manifest)), + } + + return v2ManifestDesc, marshaledV2Manifest, nil +} + +// CreateV2Config creates a v2 config +func CreateV2Config(v1Manifest *V1Manifest, diffIDs []digest.Digest, history []ocispecv1.History) (ocispecv1.Descriptor, []byte, error) { + var config map[string]*json.RawMessage + if err := json.Unmarshal([]byte(v1Manifest.History[0].V1Compatibility), &config); err != nil { + return ocispecv1.Descriptor{}, nil, fmt.Errorf("unable to unmarshal config from v1 history: %w", err) + } + + delete(config, "id") + delete(config, "parent") + delete(config, "Size") + delete(config, "parent_id") + delete(config, "layer_id") + delete(config, "throwaway") + + rootfs := ocispecv1.RootFS{ + Type: "layers", + DiffIDs: diffIDs, + } + + rootfsRaw, err := utils.RawJSON(rootfs) + if err != nil { + return ocispecv1.Descriptor{}, nil, fmt.Errorf("unable to convert rootfs to JSON: %w", err) + } + config["rootfs"] = rootfsRaw + + historyRaw, err := utils.RawJSON(history) + if err != nil { + return ocispecv1.Descriptor{}, nil, fmt.Errorf("unable to convert history to JSON: %w", err) + } + config["history"] = historyRaw + + marshaledConfig, err := json.Marshal(config) + if err != nil { + return ocispecv1.Descriptor{}, nil, fmt.Errorf("unable to marshal config: %w", err) + } + + configDesc := ocispecv1.Descriptor{ + MediaType: ocispecv1.MediaTypeImageConfig, + Digest: digest.FromBytes(marshaledConfig), + Size: int64(len(marshaledConfig)), + } + + return configDesc, marshaledConfig, nil +} + +// isEmptyLayer returns whether the v1 compatibility history describes an empty layer. +// A return value of true indicates the layer is empty, however false does not indicate non-empty. +func isEmptyLayer(h *V1History) bool { + // There doesn't seem to be a spec that describes whether the throwAway and size fields must exist or not. + // At least in the Docker implementation, throwAway is optional (https://github.com/moby/moby/blob/master/distribution/pull_v2.go#L524). + // For size we can only assume the same. + // The whole logic could be interpreted as: "If clients which pushed the content made the effort to indicate + // that a layer is empty, we can safely throw it away. For all other cases we copy every layer." + if h.ThrowAway != nil { + return *h.ThrowAway + } + if h.Size != nil { + return *h.Size == 0 + } + + return false +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/metrics/metrics.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/metrics/metrics.go new file mode 100644 index 000000000..e678bcbc6 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/metrics/metrics.go @@ -0,0 +1,78 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package metrics + +import "github.com/prometheus/client_golang/prometheus" + +const ( + ociClientNamespaceName = "ociclient" + cacheSubsystemName = "cache" +) + +var ( + // CacheMemoryUsage discloses memory used by caches + CacheMemoryUsage = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: ociClientNamespaceName, + Subsystem: cacheSubsystemName, + Name: "memory_usage_bytes", + Help: "Bytes in memory currently used by cache instance.", + }, + []string{"id"}, + ) + + // CacheDiskUsage discloses disk used by caches + CacheDiskUsage = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: ociClientNamespaceName, + Subsystem: cacheSubsystemName, + Name: "disk_usage_bytes", + Help: "Bytes on disk currently used by cache instance.", + }, + []string{"id"}, + ) + + // CachedItems discloses the number of items stored by caches + CachedItems = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: ociClientNamespaceName, + Subsystem: cacheSubsystemName, + Name: "items_total", + Help: "Total number of items currently cached by instance.", + }, + []string{"id"}, + ) + + // CacheHitsDisk discloses the number of hits for items cached on disk + CacheHitsDisk = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Namespace: ociClientNamespaceName, + Subsystem: cacheSubsystemName, + Name: "disk_hits_total", + Help: "Total number of hits for items cached on disk by an instance.", + }, + []string{"id"}, + ) + + // CacheHitsMemory discloses the number of hits for items cached in memory + CacheHitsMemory = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Namespace: ociClientNamespaceName, + Subsystem: cacheSubsystemName, + Name: "memory_hits_total", + Help: "Total number of hits for items cached in memory by an instance.", + }, + []string{"id"}, + ) +) + +// RegisterCacheMetrics allows to register ociclient cache metrics with a given prometheus registerer +func RegisterCacheMetrics(reg prometheus.Registerer) { + reg.MustRegister(CacheHitsDisk) + reg.MustRegister(CacheHitsMemory) + reg.MustRegister(CachedItems) + reg.MustRegister(CacheDiskUsage) + reg.MustRegister(CacheMemoryUsage) +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/oci/artifact.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/oci/artifact.go new file mode 100644 index 000000000..109491e1d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/oci/artifact.go @@ -0,0 +1,101 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package oci + +import ( + "encoding/json" + "errors" + + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" +) + +// Artifact represents an OCI artifact/repository. +// It can either be a single manifest or an index (manifest list). +type Artifact struct { + manifest *Manifest + index *Index +} + +// Manifest represents am OCI image manifest +type Manifest struct { + Descriptor ocispecv1.Descriptor + Data *ocispecv1.Manifest +} + +// Index represents an OCI image index +type Index struct { + Manifests []*Manifest + Annotations map[string]string +} + +// NewManifestArtifact creates a new OCI artifact of type manifest +func NewManifestArtifact(m *Manifest) (*Artifact, error) { + a := Artifact{} + return &a, a.SetManifest(m) +} + +// NewIndexArtifact creates a new OCI artifact of type index +func NewIndexArtifact(i *Index) (*Artifact, error) { + a := Artifact{} + return &a, a.SetIndex(i) +} + +// GetManifest returns the manifest property +func (a *Artifact) GetManifest() *Manifest { + return a.manifest +} + +// GetManifest returns the index property +func (a *Artifact) GetIndex() *Index { + return a.index +} + +// SetManifest sets the manifest property. +// If the OCI artifact is of type index, an error is returned. +func (a *Artifact) SetManifest(m *Manifest) error { + if m == nil { + return errors.New("manifest must not be nil") + } + + if a.IsIndex() { + return errors.New("unable to set manifest on index artifact") + } + + a.manifest = m + return nil +} + +// SetIndex sets the index property. +// If the OCI artifact is of type manifest, an error is returned. +func (a *Artifact) SetIndex(i *Index) error { + if i == nil { + return errors.New("index must not be nil") + } + + if a.IsManifest() { + return errors.New("unable to set index on manifest artifact") + } + + a.index = i + return nil +} + +func (a *Artifact) IsManifest() bool { + return a.manifest != nil +} + +func (a *Artifact) IsIndex() bool { + return a.index != nil +} + +func (a *Artifact) MarshalJSON() ([]byte, error) { + return json.Marshal(struct { + Manifest *Manifest `json:"manifest"` + Index *Index `json:"index"` + }{ + Manifest: a.manifest, + Index: a.index, + }) +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/oci/ref.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/oci/ref.go new file mode 100644 index 000000000..16ec6d4a4 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/oci/ref.go @@ -0,0 +1,98 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package oci + +import ( + "fmt" + "path" + "strings" + + dockerreference "github.com/containerd/containerd/reference/docker" + "github.com/opencontainers/go-digest" +) + +// to find a suitable secret for images on Docker Hub, we need its two domains to do matching +const ( + dockerHubDomain = "docker.io" + dockerHubLegacyDomain = "index.docker.io" +) + +// ParseRef parses a oci reference into a internal representation. +func ParseRef(ref string) (RefSpec, error) { + if strings.Contains(ref, "://") { + // remove protocol if exists + i := strings.Index(ref, "://") + 3 + ref = ref[i:] + } + + parsedRef, err := dockerreference.ParseDockerRef(ref) + if err != nil { + return RefSpec{}, err + } + + spec := RefSpec{ + Host: dockerreference.Domain(parsedRef), + Repository: dockerreference.Path(parsedRef), + } + + switch r := parsedRef.(type) { + case dockerreference.Tagged: + tag := r.Tag() + spec.Tag = &tag + case dockerreference.Digested: + d := r.Digest() + spec.Digest = &d + } + + // fallback to legacy docker domain if applicable + // this is how containerd translates the old domain for DockerHub to the new one, taken from containerd/reference/docker/reference.go:674 + if spec.Host == dockerHubDomain { + spec.Host = dockerHubLegacyDomain + } + return spec, nil +} + +// RefSpec is a go internal representation of a oci reference. +type RefSpec struct { + // Host is the hostname of a oci ref. + Host string + // Repository is the part of a reference without its hostname + Repository string + // +optional + Tag *string + // +optional + Digest *digest.Digest +} + +func (r *RefSpec) Name() string { + return path.Join(r.Host, r.Repository) +} + +func (r RefSpec) String() string { + if r.Tag != nil { + return fmt.Sprintf("%s:%s", r.Name(), *r.Tag) + } + if r.Digest != nil { + return fmt.Sprintf("%s@%s", r.Name(), r.Digest.String()) + } + return "" +} + +func (r RefSpec) DeepCopy() RefSpec { + refspec := RefSpec{ + Host: r.Host, + Repository: r.Repository, + } + if r.Tag != nil { + tag := *r.Tag + refspec.Tag = &tag + } + if r.Digest != nil { + dig := r.Digest.String() + d := digest.FromString(dig) + refspec.Digest = &d + } + return refspec +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/options/options.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/options/options.go new file mode 100644 index 000000000..8f410b8aa --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/options/options.go @@ -0,0 +1,99 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package options + +import ( + "crypto/tls" + "fmt" + "net/http" + + cdoci "github.com/gardener/component-spec/bindings-go/oci" + "github.com/go-logr/logr" + "github.com/mandelsoft/vfs/pkg/vfs" + "github.com/spf13/pflag" + + "github.com/gardener/component-cli/ociclient" + "github.com/gardener/component-cli/ociclient/cache" + "github.com/gardener/component-cli/ociclient/credentials" + "github.com/gardener/component-cli/ociclient/credentials/secretserver" +) + +// Options defines a set of options to create a oci client +type Options struct { + // AllowPlainHttp allows the fallback to http if the oci registry does not support https + AllowPlainHttp bool + // SkipTLSVerify specifies if the server's certificate should be checked for validity. + SkipTLSVerify bool + // CacheDir defines the oci cache directory + CacheDir string + // RegistryConfigPath defines a path to the dockerconfig.json with the oci registry authentication. + RegistryConfigPath string + // ConcourseConfigPath is the path to the local concourse config file. + ConcourseConfigPath string +} + +func (o *Options) AddFlags(fs *pflag.FlagSet) { + if fs == nil { + fs = pflag.CommandLine + } + + fs.BoolVar(&o.AllowPlainHttp, "allow-plain-http", false, "allows the fallback to http if the oci registry does not support https") + fs.BoolVar(&o.SkipTLSVerify, "insecure-skip-tls-verify", false, "If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure") + fs.StringVar(&o.RegistryConfigPath, "registry-config", "", "path to the dockerconfig.json with the oci registry authentication information") + fs.StringVar(&o.ConcourseConfigPath, "cc-config", "", "path to the local concourse config file") +} + +// Build builds a new oci client based on the given options +func (o *Options) Build(log logr.Logger, fs vfs.FileSystem) (ociclient.ExtendedClient, cache.Cache, error) { + cache, err := cache.NewCache(log, cache.WithBasePath(o.CacheDir)) + if err != nil { + return nil, nil, err + } + + ociOpts := []ociclient.Option{ + ociclient.WithCache(cache), + ociclient.WithKnownMediaType(cdoci.ComponentDescriptorConfigMimeType), + ociclient.WithKnownMediaType(cdoci.ComponentDescriptorTarMimeType), + ociclient.WithKnownMediaType(cdoci.ComponentDescriptorJSONMimeType), + ociclient.AllowPlainHttp(o.AllowPlainHttp), + } + + if o.SkipTLSVerify { + httpClient := http.Client{ + Transport: http.DefaultTransport, + } + httpClient.Transport.(*http.Transport).TLSClientConfig = &tls.Config{ + InsecureSkipVerify: true, + } + ociOpts = append(ociOpts, ociclient.WithHTTPClient(httpClient)) + } + + keyring, err := credentials.NewBuilder(log).WithFS(fs).FromConfigFiles(o.RegistryConfigPath).Build() + if err != nil { + return nil, nil, fmt.Errorf("unable to create keyring for registry at %q: %w", o.RegistryConfigPath, err) + } + ociOpts = append(ociOpts, ociclient.WithKeyring(keyring)) + + secretServerKeyring, err := secretserver.New(). + WithLog(log.WithName("secretserver")). + WithFS(fs). + FromPath(o.ConcourseConfigPath). + WithMinPrivileges(secretserver.ReadWrite). + Build() + if err != nil { + return nil, nil, fmt.Errorf("unable to get credentials from secret server: %s", err.Error()) + } + if secretServerKeyring != nil { + if err := credentials.Merge(keyring, secretServerKeyring); err != nil { + return nil, nil, err + } + } + + ociClient, err := ociclient.NewClient(log, ociOpts...) + if err != nil { + return nil, nil, fmt.Errorf("unable to build oci client: %w", err) + } + return ociClient, cache, nil +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/types.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/types.go new file mode 100644 index 000000000..8134ccd35 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/types.go @@ -0,0 +1,212 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package ociclient + +import ( + "context" + "io" + "net/http" + + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" + "k8s.io/apimachinery/pkg/util/sets" + + "github.com/gardener/component-cli/ociclient/cache" + "github.com/gardener/component-cli/ociclient/credentials" + "github.com/gardener/component-cli/ociclient/oci" +) + +type Client interface { + Resolver + // GetManifest returns the ocispec Manifest for a reference + GetManifest(ctx context.Context, ref string) (*ocispecv1.Manifest, error) + + // Fetch fetches the blob for the given ocispec Descriptor. + Fetch(ctx context.Context, ref string, desc ocispecv1.Descriptor, writer io.Writer) error + + // PushManifest uploads the given Manifest to the given reference. + PushManifest(ctx context.Context, ref string, manifest *ocispecv1.Manifest, opts ...PushOption) error + + // GetOCIArtifact returns an OCIArtifact for a reference. + GetOCIArtifact(ctx context.Context, ref string) (*oci.Artifact, error) + + // PushOCIArtifact uploads the given OCIArtifact to the given ref. + PushOCIArtifact(ctx context.Context, ref string, artifact *oci.Artifact, opts ...PushOption) error + + // PushBlob uploads the blob for the given ocispec Descriptor to the given ref + PushBlob(ctx context.Context, ref string, desc ocispecv1.Descriptor, opts ...PushOption) error +} + +// ExtendedClient defines an oci client with extended functionality that may not work with all registries. +type ExtendedClient interface { + Client + // ListTags returns a list of all tags of the given ref. + ListTags(ctx context.Context, ref string) ([]string, error) + // ListRepositories lists all repositories for the given registry host. + ListRepositories(ctx context.Context, registryHost string) ([]string, error) +} + +// Resolver provides remotes based on a locator. +type Resolver interface { + // Resolve attempts to resolve the reference into a name and descriptor. + // + // The argument `ref` should be a scheme-less URI representing the remote. + // Structurally, it has a host and path. The "host" can be used to directly + // reference a specific host or be matched against a specific handler. + // + // The returned name should be used to identify the referenced entity. + // Depending on the remote namespace, this may be immutable or mutable. + // While the name may differ from ref, it should itself be a valid ref. + // + // If the resolution fails, an error will be returned. + Resolve(ctx context.Context, ref string) (name string, desc ocispecv1.Descriptor, err error) +} + +// Store describes a store that returns a io reader for a descriptor +type Store interface { + Get(desc ocispecv1.Descriptor) (io.ReadCloser, error) +} + +// PushOption is the interface to specify different cache options +type PushOption interface { + ApplyPushOption(options *PushOptions) +} + +// PushOptions contains all oci push options. +type PushOptions struct { + // Store is the oci cache to be used by the client + Store Store +} + +// ApplyOptions applies the given list options on these options, +// and then returns itself (for convenient chaining). +func (o *PushOptions) ApplyOptions(opts []PushOption) *PushOptions { + for _, opt := range opts { + if opt != nil { + opt.ApplyPushOption(o) + } + } + return o +} + +// WithStore configures a store for the oci push. +func WithStore(store Store) WithStoreOption { + return WithStoreOption{ + Store: store, + } +} + +// WithStoreOption configures a cache for the oci client +type WithStoreOption struct { + Store +} + +func (c WithStoreOption) ApplyPushOption(options *PushOptions) { + options.Store = c.Store +} + +// Options contains all client options to configure the oci client. +type Options struct { + // Paths configures local paths to search for docker configuration files + Paths []string + + // AllowPlainHttp allows the fallback to http if https is not supported by the registry. + AllowPlainHttp bool + + // Keyring sets the used keyring. + // A default keyring will be created if not given. + Keyring credentials.OCIKeyring + + // CacheConfig contains the cache configuration. + // Tis configuration will automatically create a new cache based on that configuration. + // This cache can be overwritten with the Cache property. + CacheConfig *cache.Options + + // Cache is the oci cache to be used by the client + Cache cache.Cache + + // CustomMediaTypes defines the custom known media types + CustomMediaTypes sets.String + + HTTPClient *http.Client +} + +// Option is the interface to specify different cache options +type Option interface { + ApplyOption(options *Options) +} + +// ApplyOptions applies the given list options on these options, +// and then returns itself (for convenient chaining). +func (o *Options) ApplyOptions(opts []Option) *Options { + for _, opt := range opts { + if opt != nil { + opt.ApplyOption(o) + } + } + return o +} + +// WithCache configures a cache for the oci client +func WithCache(c cache.Cache) WithCacheOption { + return WithCacheOption{ + Cache: c, + } +} + +// WithCacheOption configures a cache for the oci client +type WithCacheOption struct { + cache.Cache +} + +func (c WithCacheOption) ApplyOption(options *Options) { + options.Cache = c.Cache +} + +func (c WithCacheOption) ApplyPushOption(options *PushOptions) { + options.Store = c.Cache +} + +// WithKeyring return a option that configures the resolver to use the given oci keyring +func WithKeyring(ring credentials.OCIKeyring) Option { + return WithKeyringOption{ + OCIKeyring: ring, + } +} + +// WithKeyringOption configures the resolver to use the given oci keyring +type WithKeyringOption struct { + credentials.OCIKeyring +} + +func (c WithKeyringOption) ApplyOption(options *Options) { + options.Keyring = c.OCIKeyring +} + +// WithKnownMediaType adds a known media types to the client +type WithKnownMediaType string + +func (c WithKnownMediaType) ApplyOption(options *Options) { + if options.CustomMediaTypes == nil { + options.CustomMediaTypes = sets.NewString(string(c)) + return + } + + options.CustomMediaTypes.Insert(string(c)) +} + +// AllowPlainHttp sets the allow plain http flag. +type AllowPlainHttp bool + +func (c AllowPlainHttp) ApplyOption(options *Options) { + options.AllowPlainHttp = bool(c) +} + +// WithHTTPClient configures the http client. +type WithHTTPClient http.Client + +func (c WithHTTPClient) ApplyOption(options *Options) { + client := http.Client(c) + options.HTTPClient = &client +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/ociclient/utils.go b/integration-test/vendor/github.com/gardener/component-cli/ociclient/utils.go new file mode 100644 index 000000000..33cfa6ef7 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/ociclient/utils.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package ociclient + +import ( + "fmt" + "strings" + + "github.com/opencontainers/go-digest" + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" +) + +// GetLayerByName returns the layer with a given name. +// The name should be specified by the annotation title. +func GetLayerByName(layers []ocispecv1.Descriptor, name string) *ocispecv1.Descriptor { + for _, desc := range layers { + if title, ok := desc.Annotations[ocispecv1.AnnotationTitle]; ok { + if title == name { + return &desc + } + } + } + return nil +} + +// GetLayerByMediaType returns the layers with a given mediatype. +func GetLayerByMediaType(layers []ocispecv1.Descriptor, mediaType string) []ocispecv1.Descriptor { + descs := make([]ocispecv1.Descriptor, 0) + for _, desc := range layers { + if desc.MediaType == mediaType { + descs = append(descs, desc) + } + } + return descs +} + +// GetLayerByDigest returns the layers with a given digest. +func GetLayerByDigest(layers []ocispecv1.Descriptor, digest string) []ocispecv1.Descriptor { + descs := make([]ocispecv1.Descriptor, 0) + for _, desc := range layers { + if desc.Digest.String() == digest { + descs = append(descs, desc) + } + } + return descs +} + +// ParseImageRef parses a valid image ref into its repository and version +func ParseImageRef(ref string) (repository, version string, err error) { + // check if the ref contains a digest + if strings.Contains(ref, "@") { + splitRef := strings.Split(ref, "@") + if len(splitRef) != 2 { + return "", "", fmt.Errorf("invalid image reference %q, expected only 1 char of '@'", ref) + } + return splitRef[0], splitRef[1], nil + } + splitRef := strings.Split(ref, ":") + if len(splitRef) > 3 { + return "", "", fmt.Errorf("invalid image reference %q, expected maximum 3 chars of ':'", ref) + } + + repository = strings.Join(splitRef[:(len(splitRef)-1)], ":") + version = splitRef[len(splitRef)-1] + err = nil + return +} + +// TagIsDigest checks if a tag is a digest. +func TagIsDigest(tag string) bool { + _, err := digest.Parse(tag) + return err == nil +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/pkg/commands/constants/constants.go b/integration-test/vendor/github.com/gardener/component-cli/pkg/commands/constants/constants.go new file mode 100644 index 000000000..5cbedce4f --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/pkg/commands/constants/constants.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package constants + +import ( + "fmt" + "os" + "path/filepath" +) + +// CliHomeEnvName is the name of the environment variable that configures the component cli home directory. +const CliHomeEnvName = "COMPONENT_CLI_HOME" + +// ComponentDescriptorPathEnvName is the name of the environment variable that contains the absolute file path to output the final descriptor to. +const ComponentDescriptorPathEnvName = "COMPONENT_DESCRIPTOR_PATH" + +// BaseDefinitionPathEnvName is the name of the environment variable that contains the absolute file path to the base component descriptor +const BaseDefinitionPathEnvName = "BASE_DEFINITION_PATH" + +// ComponentArchivePathEnvName is the name of the environment variable that contains the file path to the component archive to be used. +const ComponentArchivePathEnvName = "COMPONENT_ARCHIVE_PATH" + +// ComponentRepositoryRepositoryBaseUrlEnvName is the name of the environment variable that hold the base url of the current component repository +const ComponentRepositoryRepositoryBaseUrlEnvName = "COMPONENT_REPOSITORY_BASE_URL" + +// ComponentRepositoryCacheDirEnvVar is the name of the environment variable that points to the local component descriptor cache. +const ComponentRepositoryCacheDirEnvVar = "COMPONENT_REPOSITORY_CACHE_DIR" + +// CliHomeDir returns the home directoy of the components cli. +// It returns the COMPONENT_CLI_HOME if its defined otherwise +// the default "$HOME/.component-cli" is returned. +func CliHomeDir() (string, error) { + lsHome := os.Getenv(CliHomeEnvName) + if len(lsHome) != 0 { + return lsHome, nil + } + homeDir, err := os.UserHomeDir() + if err != nil { + return "", fmt.Errorf("unable to determine the component home directory: %w", err) + } + return filepath.Join(homeDir, ".component-cli"), nil +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/pkg/logcontext/log.go b/integration-test/vendor/github.com/gardener/component-cli/pkg/logcontext/log.go new file mode 100644 index 000000000..2b928ab6c --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/pkg/logcontext/log.go @@ -0,0 +1,96 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package logcontext + +import ( + "context" + + "github.com/go-logr/logr" +) + +// logContextKey is the unique key for storing additional logging contexts +type logContextKey struct{} + +// ContextValues describes the context values. +type ContextValues map[string]interface{} + +func NewContext(parent context.Context) (context.Context, *ContextValues) { + vals := &ContextValues{} + return context.WithValue(parent, logContextKey{}, vals), vals +} + +// FromContext returns the context values of a ctx. +// If nothing is defined nil is returned. +func FromContext(ctx context.Context) *ContextValues { + c, ok := ctx.Value(logContextKey{}).(*ContextValues) + if !ok { + return nil + } + return c +} + +// AddContextValue adds a key value pair to the logging context. +// If none is defined it will be added. +func AddContextValue(ctx context.Context, key string, value interface{}) context.Context { + logCtx := FromContext(ctx) + if logCtx == nil { + ctx, logCtx = NewContext(ctx) + } + (*logCtx)[key] = value + return ctx +} + +// ctxLogger defines a logger that injects the provided context values +// and delegates the actual logging to a delegate. +type ctxLogger struct { + l logr.Logger + ctx *ContextValues +} + +// New creates a new context logger that delegates the actual requests to the delegate +// but injects the context log values. +func New(ctx context.Context, delegate logr.Logger) logr.Logger { + val := FromContext(ctx) + return newWithContextValues(val, delegate) +} + +func newWithContextValues(ctx *ContextValues, del logr.Logger) *ctxLogger { + return &ctxLogger{ + l: del, + ctx: ctx, + } +} + +func (c ctxLogger) Enabled() bool { + return c.l.Enabled() +} + +func (c ctxLogger) Info(msg string, keysAndValues ...interface{}) { + c.l.Info(msg, keysAndValues...) +} + +func (c ctxLogger) Error(err error, msg string, keysAndValues ...interface{}) { + // append log context values + if c.ctx == nil { + c.l.Info(msg, keysAndValues...) + return + } + for key, val := range *c.ctx { + keysAndValues = append(keysAndValues, key, val) + } + c.l.Error(err, msg, keysAndValues...) +} + +func (c ctxLogger) V(level int) logr.Logger { + return newWithContextValues(c.ctx, c.l.V(level)) +} + +func (c ctxLogger) WithValues(keysAndValues ...interface{}) logr.Logger { + return newWithContextValues(c.ctx, c.l.WithValues(keysAndValues...)) +} + +func (c ctxLogger) WithName(name string) logr.Logger { + return newWithContextValues(c.ctx, c.l.WithName(name)) +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/pkg/utils/ctf.go b/integration-test/vendor/github.com/gardener/component-cli/pkg/utils/ctf.go new file mode 100644 index 000000000..e060de9e1 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/pkg/utils/ctf.go @@ -0,0 +1,15 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "fmt" + "strings" +) + +// CTFComponentArchiveFilename returns the name of the componant archive file in the ctf. +func CTFComponentArchiveFilename(name, version string) string { + return fmt.Sprintf("%s-%s.tar", strings.ReplaceAll(name, "/", "_"), version) +} diff --git a/integration-test/vendor/github.com/gardener/component-cli/pkg/utils/utils.go b/integration-test/vendor/github.com/gardener/component-cli/pkg/utils/utils.go new file mode 100644 index 000000000..cf08e168e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-cli/pkg/utils/utils.go @@ -0,0 +1,263 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "archive/tar" + "bytes" + "compress/gzip" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "math/rand" + "net/http" + "net/url" + "os" + "path" + "path/filepath" + "strings" + "time" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/mandelsoft/vfs/pkg/vfs" + "github.com/spf13/cobra" + "sigs.k8s.io/yaml" + + "github.com/gardener/component-cli/ociclient/cache" + "github.com/gardener/component-cli/ociclient/oci" + "github.com/gardener/component-cli/pkg/commands/constants" +) + +// PrintPrettyYaml prints the given objects as yaml if enabled. +func PrintPrettyYaml(obj interface{}, enabled bool) { + if !enabled { + return + } + data, err := yaml.Marshal(obj) + if err != nil { + fmt.Printf("unable to serialize object as yaml: %s", err.Error()) + return + } + fmt.Println(string(data)) +} + +// GetFileType returns the mimetype of a file. +func GetFileType(fs vfs.FileSystem, path string) (string, error) { + file, err := fs.Open(path) + if err != nil { + return "", err + } + defer file.Close() + // see http://golang.org/pkg/net/http/#DetectContentType for the 512 bytes + buf := make([]byte, 512) + _, err = file.Read(buf) + if err != nil { + return "", err + } + return http.DetectContentType(buf), nil +} + +// CacheDir returns the cache dir for the current cli command +func CacheDir() (string, error) { + defaultCacheDir := os.Getenv(cache.CacheDirEnvName) + if len(defaultCacheDir) != 0 { + return defaultCacheDir, nil + } + + cliHomeDir, err := constants.CliHomeDir() + if err != nil { + return "", err + } + cacheDir := filepath.Join(cliHomeDir, "components") + if err := os.MkdirAll(cacheDir, os.ModePerm); err != nil { + return "", fmt.Errorf("unable to create cache directory %s: %w", cacheDir, err) + } + + return cacheDir, nil +} + +// CleanMarkdownUsageFunc removes markdown tags from the long usage of the command. +// With this func it is possible to generate the markdown docs but still have readable commandline help func. +// Note: currently only "
" tags are removed
+func CleanMarkdownUsageFunc(cmd *cobra.Command) {
+	defaultHelpFunc := cmd.HelpFunc()
+	cmd.SetHelpFunc(func(cmd *cobra.Command, s []string) {
+		cmd.Long = strings.ReplaceAll(cmd.Long, "
", "")
+		cmd.Long = strings.ReplaceAll(cmd.Long, "
", "") + defaultHelpFunc(cmd, s) + }) +} + +// RawJSON converts an arbitrary value to json.RawMessage +func RawJSON(value interface{}) (*json.RawMessage, error) { + jsonval, err := json.Marshal(value) + if err != nil { + return nil, err + } + return (*json.RawMessage)(&jsonval), nil +} + +// Gzip applies gzip compression to an arbitrary byte slice +func Gzip(data []byte, compressionLevel int) ([]byte, error) { + buf := bytes.NewBuffer([]byte{}) + gzipWriter, err := gzip.NewWriterLevel(buf, compressionLevel) + if err != nil { + return nil, fmt.Errorf("unable to create gzip writer: %w", err) + } + defer gzipWriter.Close() + + if _, err = gzipWriter.Write(data); err != nil { + return nil, fmt.Errorf("unable to write to stream: %w", err) + } + + if err = gzipWriter.Close(); err != nil { + return nil, fmt.Errorf("unable to close writer: %w", err) + } + + return buf.Bytes(), nil +} + +var chars = []rune("abcdefghijklmnopqrstuvwxyz1234567890") + +// RandomString creates a new random string with the given length. +func RandomString(n int) string { + b := make([]rune, n) + for i := range b { + b[i] = chars[rand.Intn(len(chars))] + } + return string(b) +} + +// SafeConvert converts a byte slice to string. +// If the byte slice is nil, an empty string is returned. +func SafeConvert(bytes []byte) string { + if bytes == nil { + return "" + } + + return string(bytes) +} + +const ( + BYTE = 1.0 << (10 * iota) + KIBIBYTE + MEBIBYTE + GIBIBYTE +) + +// BytesString converts bytes into a human readable string. +// This function is inspired by https://www.reddit.com/r/golang/comments/8micn7/review_bytes_to_human_readable_format/ +func BytesString(bytes uint64, accuracy int) string { + unit := "" + value := float32(bytes) + + switch { + case bytes >= GIBIBYTE: + unit = "GiB" + value = value / GIBIBYTE + case bytes >= MEBIBYTE: + unit = "MiB" + value = value / MEBIBYTE + case bytes >= KIBIBYTE: + unit = "KiB" + value = value / KIBIBYTE + case bytes >= BYTE: + unit = "bytes" + case bytes == 0: + return "0" + } + + stringValue := strings.TrimSuffix( + fmt.Sprintf("%.2f", value), "."+strings.Repeat("0", accuracy), + ) + + return fmt.Sprintf("%s %s", stringValue, unit) +} + +// WriteFileToTARArchive writes a new file with name=filename and content=inputReader to outputWriter +func WriteFileToTARArchive(filename string, inputReader io.Reader, outputWriter *tar.Writer) error { + if filename == "" { + return errors.New("filename must not be empty") + } + + if inputReader == nil { + return errors.New("inputReader must not be nil") + } + + if outputWriter == nil { + return errors.New("outputWriter must not be nil") + } + + tempfile, err := ioutil.TempFile("", "") + if err != nil { + return fmt.Errorf("unable to create tempfile: %w", err) + } + defer tempfile.Close() + + fsize, err := io.Copy(tempfile, inputReader) + if err != nil { + return fmt.Errorf("unable to copy content to tempfile: %w", err) + } + + if _, err := tempfile.Seek(0, io.SeekStart); err != nil { + return fmt.Errorf("unable to seek to beginning of tempfile: %w", err) + } + + header := tar.Header{ + Name: filename, + Size: int64(fsize), + Mode: 0600, + ModTime: time.Now(), + } + + if err := outputWriter.WriteHeader(&header); err != nil { + return fmt.Errorf("unable to write tar header: %w", err) + } + + if _, err := io.Copy(outputWriter, tempfile); err != nil { + return fmt.Errorf("unable to write file to tar archive: %w", err) + } + + return nil +} + +// TargetOCIArtifactRef calculates the target reference for +func TargetOCIArtifactRef(targetRepo, ref string, keepOrigHost bool) (string, error) { + if !strings.Contains(targetRepo, "://") { + // add dummy protocol to correctly parse the url + targetRepo = "http://" + targetRepo + } + t, err := url.Parse(targetRepo) + if err != nil { + return "", err + } + parsedRef, err := oci.ParseRef(ref) + if err != nil { + return "", err + } + + if !keepOrigHost { + parsedRef.Host = t.Host + parsedRef.Repository = path.Join(t.Path, parsedRef.Repository) + return parsedRef.String(), nil + } + replacedRef := strings.NewReplacer(".", "_", ":", "_").Replace(parsedRef.Name()) + parsedRef.Repository = path.Join(t.Path, replacedRef) + parsedRef.Host = t.Host + return parsedRef.String(), nil +} + +// CalculateBlobUploadRef calculates the OCI reference where blobs for a component should be uploaded +func CalculateBlobUploadRef(repoCtx cdv2.OCIRegistryRepository, componentName string, componentVersion string) string { + uploadTag := componentVersion + if strings.Contains(componentVersion, ":") { + // if componentVersion is a digest, use "latest" tag for upload ref + uploadTag = "latest" + } + + return fmt.Sprintf("%s/component-descriptors/%s:%s", repoCtx.BaseURL, componentName, uploadTag) +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/metadata.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/metadata.go new file mode 100644 index 000000000..2f48eacf1 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/metadata.go @@ -0,0 +1,21 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 apis + +// Metadata defines the metadata of the component descriptor. +type Metadata struct { + // Version is the schema version of the component descriptor. + Version string `json:"schemaVersion"` +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/accesstypes.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/accesstypes.go new file mode 100644 index 000000000..cd34d0bec --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/accesstypes.go @@ -0,0 +1,221 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +// KnownAccessTypes contains all known access serializer +var KnownAccessTypes = KnownTypes{ + OCIRegistryType: DefaultJSONTypedObjectCodec, + OCIBlobType: DefaultJSONTypedObjectCodec, + RelativeOciReferenceType: DefaultJSONTypedObjectCodec, + GitHubAccessType: DefaultJSONTypedObjectCodec, + WebType: DefaultJSONTypedObjectCodec, + LocalFilesystemBlobType: DefaultJSONTypedObjectCodec, +} + +// OCIRegistryType is the access type of a oci registry. +const OCIRegistryType = "ociRegistry" + +// OCIRegistryAccess describes the access for a oci registry. +type OCIRegistryAccess struct { + ObjectType `json:",inline"` + + // ImageReference is the actual reference to the oci image repository and tag. + ImageReference string `json:"imageReference"` +} + +// NewOCIRegistryAccess creates a new OCIRegistryAccess accessor +func NewOCIRegistryAccess(ref string) *OCIRegistryAccess { + return &OCIRegistryAccess{ + ObjectType: ObjectType{ + Type: OCIRegistryType, + }, + ImageReference: ref, + } +} + +func (a *OCIRegistryAccess) GetType() string { + return OCIRegistryType +} + +// RelativeOciReferenceType is the access type of a relative oci reference. +const RelativeOciReferenceType = "relativeOciReference" + +// RelativeOciAccess describes the access for a relative oci reference. +type RelativeOciAccess struct { + ObjectType `json:",inline"` + + // Reference is the relative reference to the oci image repository and tag. + Reference string `json:"reference"` +} + +// NewRelativeOciAccess creates a new RelativeOciAccess accessor +func NewRelativeOciAccess(ref string) *RelativeOciAccess { + return &RelativeOciAccess{ + ObjectType: ObjectType{ + Type: RelativeOciReferenceType, + }, + Reference: ref, + } +} + +func (_ *RelativeOciAccess) GetType() string { + return RelativeOciReferenceType +} + +// OCIBlobType is the access type of a oci blob in a manifest. +const OCIBlobType = "ociBlob" + +// OCIBlobAccess describes the access for a oci registry. +type OCIBlobAccess struct { + ObjectType `json:",inline"` + + // Reference is the oci reference to the manifest + Reference string `json:"ref"` + + // MediaType is the media type of the object this schema refers to. + MediaType string `json:"mediaType,omitempty"` + + // Digest is the digest of the targeted content. + Digest string `json:"digest"` + + // Size specifies the size in bytes of the blob. + Size int64 `json:"size"` +} + +// NewOCIBlobAccess creates a new OCIBlob accessor +func NewOCIBlobAccess(ref, mediaType, digest string, size int64) *OCIBlobAccess { + return &OCIBlobAccess{ + ObjectType: ObjectType{ + Type: OCIBlobType, + }, + Reference: ref, + MediaType: mediaType, + Digest: digest, + Size: size, + } +} + +func (_ *OCIBlobAccess) GetType() string { + return OCIBlobType +} + +// LocalOCIBlobType is the access type of a oci blob in the current component descriptor manifest. +const LocalOCIBlobType = "localOciBlob" + +// NewLocalOCIBlobAccess creates a new LocalOCIBlob accessor +func NewLocalOCIBlobAccess(digest string) *LocalOCIBlobAccess { + return &LocalOCIBlobAccess{ + ObjectType: ObjectType{ + Type: LocalOCIBlobType, + }, + Digest: digest, + } +} + +// LocalOCIBlobAccess describes the access for a blob that is stored in the component descriptors oci manifest. +type LocalOCIBlobAccess struct { + ObjectType `json:",inline"` + // Digest is the digest of the targeted content. + Digest string `json:"digest"` +} + +func (_ *LocalOCIBlobAccess) GetType() string { + return LocalOCIBlobType +} + +// LocalFilesystemBlobType is the access type of a blob in a local filesystem. +const LocalFilesystemBlobType = "localFilesystemBlob" + +// NewLocalFilesystemBlobAccess creates a new localFilesystemBlob accessor. +func NewLocalFilesystemBlobAccess(path string, mediaType string) *LocalFilesystemBlobAccess { + return &LocalFilesystemBlobAccess{ + ObjectType: ObjectType{ + Type: LocalFilesystemBlobType, + }, + Filename: path, + MediaType: mediaType, + } +} + +// LocalFilesystemBlobAccess describes the access for a blob on the filesystem. +type LocalFilesystemBlobAccess struct { + ObjectType `json:",inline"` + // Filename is the name of the blob in the local filesystem. + // The blob is expected to be at /blobs/ + Filename string `json:"filename"` + // MediaType is the media type of the object this filename refers to. + MediaType string `json:"mediaType,omitempty"` +} + +func (_ *LocalFilesystemBlobAccess) GetType() string { + return LocalFilesystemBlobType +} + +// WebType is the type of a web component +const WebType = "web" + +// Web describes a web resource access that can be fetched via http GET request. +type Web struct { + ObjectType `json:",inline"` + + // URL is the http get accessible url resource. + URL string `json:"url"` +} + +// NewWebAccess creates a new Web accessor +func NewWebAccess(url string) *Web { + return &Web{ + ObjectType: ObjectType{ + Type: OCIBlobType, + }, + URL: url, + } +} + +func (_ *Web) GetType() string { + return WebType +} + +// GitHubAccessType is the type of a git object. +const GitHubAccessType = "github" + +// GitHubAccess describes a github repository resource access. +type GitHubAccess struct { + ObjectType `json:",inline"` + + // RepoURL is the url pointing to the remote repository. + RepoURL string `json:"repoUrl"` + // Ref describes the git reference. + Ref string `json:"ref"` + // Commit describes the git commit of the referenced repository. + // +optional + Commit string `json:"commit,omitempty"` +} + +// NewGitHubAccess creates a new Web accessor +func NewGitHubAccess(url, ref, commit string) *GitHubAccess { + return &GitHubAccess{ + ObjectType: ObjectType{ + Type: GitHubAccessType, + }, + RepoURL: url, + Ref: ref, + Commit: commit, + } +} + +func (a GitHubAccess) GetType() string { + return GitHubAccessType +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/codecs.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/codecs.go new file mode 100644 index 000000000..57f198e30 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/codecs.go @@ -0,0 +1,203 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +import ( + "encoding/json" + "fmt" +) + +// KnownTypeValidationFunc defines a function that can validate types. +type KnownTypeValidationFunc func(ttype string) error + +// KnownTypes defines a set of known types. +type KnownTypes map[string]TypedObjectCodec + +// Register adds a codec for a specific type to the list of known types. +// It returns if the operation has overwritten an already registered type. +func (kt *KnownTypes) Register(ttype string, codec TypedObjectCodec) (overwritten bool) { + if _, ok := (*kt)[ttype]; ok { + overwritten = true + } + (*kt)[ttype] = codec + return +} + +// TypedObjectCodec describes a known component type and how it is decoded and encoded +type TypedObjectCodec interface { + TypedObjectDecoder + TypedObjectEncoder +} + +// TypedObjectCodecWrapper is a simple struct that implements the TypedObjectCodec interface +type TypedObjectCodecWrapper struct { + TypedObjectDecoder + TypedObjectEncoder +} + +// TypedObjectDecoder defines a decoder for a typed object. +type TypedObjectDecoder interface { + Decode(data []byte, into TypedObjectAccessor) error +} + +// TypedObjectEncoder defines a encoder for a typed object. +type TypedObjectEncoder interface { + Encode(accessor TypedObjectAccessor) ([]byte, error) +} + +// TypedObjectDecoderFunc is a simple function that implements the TypedObjectDecoder interface. +type TypedObjectDecoderFunc func(data []byte, obj TypedObjectAccessor) error + +// Decode is the Decode implementation of the TypedObjectDecoder interface. +func (e TypedObjectDecoderFunc) Decode(data []byte, obj TypedObjectAccessor) error { + return e(data, obj) +} + +// TypedObjectEncoderFunc is a simple function that implements the TypedObjectEncoder interface. +type TypedObjectEncoderFunc func(accessor TypedObjectAccessor) ([]byte, error) + +// Encode is the Encode implementation of the TypedObjectEncoder interface. +func (e TypedObjectEncoderFunc) Encode(accessor TypedObjectAccessor) ([]byte, error) { + return e(accessor) +} + +// DefaultJSONTypedObjectCodec implements TypedObjectCodec interface with the json decoder and json encoder. +var DefaultJSONTypedObjectCodec = TypedObjectCodecWrapper{ + TypedObjectDecoder: DefaultJSONTypedObjectDecoder{}, + TypedObjectEncoder: DefaultJSONTypedObjectEncoder{}, +} + +// DefaultJSONTypedObjectDecoder is a simple decoder that implements the TypedObjectDecoder interface. +// It simply decodes the access using the json marshaller. +type DefaultJSONTypedObjectDecoder struct{} + +var _ TypedObjectDecoder = DefaultJSONTypedObjectDecoder{} + +// Decode is the Decode implementation of the TypedObjectDecoder interface. +func (e DefaultJSONTypedObjectDecoder) Decode(data []byte, obj TypedObjectAccessor) error { + return json.Unmarshal(data, obj) +} + +// DefaultJSONTypedObjectEncoder is a simple decoder that implements the TypedObjectDecoder interface. +// It encodes the access type using the default json marshaller. +type DefaultJSONTypedObjectEncoder struct{} + +var _ TypedObjectEncoder = DefaultJSONTypedObjectEncoder{} + +// Encode is the Encode implementation of the TypedObjectEncoder interface. +func (e DefaultJSONTypedObjectEncoder) Encode(obj TypedObjectAccessor) ([]byte, error) { + obj.SetType(obj.GetType()) // hardcode the correct type if the type was not correctly constructed. + return json.Marshal(obj) +} + +type codec struct { + knownTypes KnownTypes + defaultCodec TypedObjectCodec + validationFunc KnownTypeValidationFunc +} + +// NewDefaultCodec creates a new default typed object codec. +func NewDefaultCodec() TypedObjectCodec { + return &codec{ + defaultCodec: DefaultJSONTypedObjectCodec, + knownTypes: KnownAccessTypes, + } +} + +// NewCodec creates a new typed object codec. +func NewCodec(knownTypes KnownTypes, defaultCodec TypedObjectCodec, validationFunc KnownTypeValidationFunc) TypedObjectCodec { + if knownTypes == nil { + knownTypes = KnownAccessTypes + } + + if defaultCodec == nil { + defaultCodec = DefaultJSONTypedObjectCodec + } + + return &codec{ + defaultCodec: defaultCodec, + knownTypes: knownTypes, + validationFunc: validationFunc, + } +} + +// Decode unmarshals a unstructured typed object into a TypedObjectAccessor. +// The given known types are used to decode the data into a specific. +// The given defaultCodec is used if no matching type is known. +// An error is returned when the type is unknown and the default codec is nil. +func (c *codec) Decode(data []byte, into TypedObjectAccessor) error { + accessType := &ObjectType{} + if err := json.Unmarshal(data, accessType); err != nil { + return err + } + + if c.validationFunc != nil { + if err := c.validationFunc(accessType.GetType()); err != nil { + return err + } + } + + codec, ok := c.knownTypes[accessType.GetType()] + if !ok { + codec = c.defaultCodec + } + + return codec.Decode(data, into) +} + +// Encode marshals a typed object into a unstructured typed object. +// The given known types are used to decode the data into a specific. +// The given defaultCodec is used if no matching type is known. +// An error is returned when the type is unknown and the default codec is nil. +func (c *codec) Encode(acc TypedObjectAccessor) ([]byte, error) { + if c.validationFunc != nil { + if err := c.validationFunc(acc.GetType()); err != nil { + return nil, err + } + } + + codec, ok := c.knownTypes[acc.GetType()] + if !ok { + codec = c.defaultCodec + } + + return codec.Encode(acc) +} + +// ToUnstructuredTypedObject converts a typed object to a unstructured object. +func ToUnstructuredTypedObject(codec TypedObjectCodec, obj TypedObjectAccessor) (*UnstructuredTypedObject, error) { + data, err := codec.Encode(obj) + if err != nil { + return nil, err + } + + uObj := &UnstructuredTypedObject{} + if err := json.Unmarshal(data, uObj); err != nil { + return nil, err + } + return uObj, nil +} + +// FromUnstructuredObject converts a unstructured object into a typed object. +func FromUnstructuredObject(codec TypedObjectCodec, uObj *UnstructuredTypedObject, obj TypedObjectAccessor) error { + data, err := uObj.GetRaw() + if err != nil { + return fmt.Errorf("unable to get data from unstructured object: %w", err) + } + if err := codec.Decode(data, obj); err != nil { + return fmt.Errorf("unable to decode object %q into %q: %w", uObj.GetType(), obj.GetType(), err) + } + return err +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/componentdescriptor.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/componentdescriptor.go new file mode 100644 index 000000000..c388a7c22 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/componentdescriptor.go @@ -0,0 +1,429 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +import ( + "encoding/json" + "errors" +) + +const SchemaVersion = "v2" + +var ( + NotFound = errors.New("NotFound") +) + +// Metadata defines the metadata of the component descriptor. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type Metadata struct { + // Version is the schema version of the component descriptor. + Version string `json:"schemaVersion"` +} + +// ProviderType describes the provider type of component in the origin's context. +// Defines whether the component is created by a third party or internally. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type ProviderType string + +const ( + // InternalProvider defines a internal provider type + // which describes a internally maintained component in the origin's context. + InternalProvider ProviderType = "internal" + // ExternalProvider defines a external provider type + // which describes a component maintained by a third party vendor in the origin's context. + ExternalProvider ProviderType = "external" +) + +// ResourceRelation describes the type of a resource. +// Defines whether the component is created by a third party or internally. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type ResourceRelation string + +const ( + // LocalRelation defines a internal relation + // which describes a internally maintained resource in the origin's context. + LocalRelation ResourceRelation = "local" + // ExternalRelation defines a external relation + // which describes a resource maintained by a third party vendor in the origin's context. + ExternalRelation ResourceRelation = "external" +) + +// ComponentDescriptor defines a versioned component with a source and dependencies. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type ComponentDescriptor struct { + // Metadata specifies the schema version of the component. + Metadata Metadata `json:"meta"` + // Spec contains the specification of the component. + ComponentSpec `json:"component"` +} + +// ComponentSpec defines a virtual component with +// a repository context, source and dependencies. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type ComponentSpec struct { + ObjectMeta `json:",inline"` + // RepositoryContexts defines the previous repositories of the component + RepositoryContexts []*UnstructuredTypedObject `json:"repositoryContexts"` + // Provider defines the provider type of a component. + // It can be external or internal. + Provider ProviderType `json:"provider"` + // Sources defines sources that produced the component + Sources []Source `json:"sources"` + // ComponentReferences references component dependencies that can be resolved in the current context. + ComponentReferences []ComponentReference `json:"componentReferences"` + // Resources defines all resources that are created by the component and by a third party. + Resources []Resource `json:"resources"` +} + +// ObjectMeta defines a object that is uniquely identified by its name and version. +// +k8s:deepcopy-gen=true +type ObjectMeta struct { + // Name is the context unique name of the object. + Name string `json:"name"` + // Version is the semver version of the object. + Version string `json:"version"` + // Labels defines an optional set of additional labels + // describing the object. + // +optional + Labels Labels `json:"labels,omitempty"` +} + +// GetName returns the name of the object. +func (o ObjectMeta) GetName() string { + return o.Name +} + +// SetName sets the name of the object. +func (o *ObjectMeta) SetName(name string) { + o.Name = name +} + +// GetVersion returns the version of the object. +func (o ObjectMeta) GetVersion() string { + return o.Version +} + +// SetVersion sets the version of the object. +func (o *ObjectMeta) SetVersion(version string) { + o.Version = version +} + +// GetLabels returns the label of the object. +func (o ObjectMeta) GetLabels() Labels { + return o.Labels +} + +// SetLabels sets the labels of the object. +func (o *ObjectMeta) SetLabels(labels []Label) { + o.Labels = labels +} + +const ( + SystemIdentityName = "name" + SystemIdentityVersion = "version" +) + +// Identity describes the identity of an object. +// Only ascii characters are allowed +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type Identity map[string]string + +// Digest returns the object digest of an identity +func (i Identity) Digest() []byte { + data, _ := json.Marshal(i) + return data +} + +// Match implements the selector interface. +func (i Identity) Match(obj map[string]string) (bool, error) { + for k, v := range i { + if obj[k] != v { + return false, nil + } + } + return true, nil +} + +// IdentityObjectMeta defines a object that is uniquely identified by its identity. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type IdentityObjectMeta struct { + // Name is the context unique name of the object. + Name string `json:"name"` + // Version is the semver version of the object. + Version string `json:"version"` + // Type describes the type of the object. + Type string `json:"type"` + // ExtraIdentity is the identity of an object. + // An additional label with key "name" ist not allowed + ExtraIdentity Identity `json:"extraIdentity,omitempty"` + // Labels defines an optional set of additional labels + // describing the object. + // +optional + Labels Labels `json:"labels,omitempty"` +} + +// GetName returns the name of the object. +func (o IdentityObjectMeta) GetName() string { + return o.Name +} + +// SetName sets the name of the object. +func (o *IdentityObjectMeta) SetName(name string) { + o.Name = name +} + +// GetVersion returns the version of the object. +func (o IdentityObjectMeta) GetVersion() string { + return o.Version +} + +// SetVersion sets the version of the object. +func (o *IdentityObjectMeta) SetVersion(version string) { + o.Version = version +} + +// GetType returns the type of the object. +func (o IdentityObjectMeta) GetType() string { + return o.Type +} + +// SetType sets the type of the object. +func (o *IdentityObjectMeta) SetType(ttype string) { + o.Type = ttype +} + +// GetLabels returns the label of the object. +func (o IdentityObjectMeta) GetLabels() Labels { + return o.Labels +} + +// SetLabels sets the labels of the object. +func (o *IdentityObjectMeta) SetLabels(labels []Label) { + o.Labels = labels +} + +// SetExtraIdentity sets the identity of the object. +func (o *IdentityObjectMeta) SetExtraIdentity(identity Identity) { + o.ExtraIdentity = identity +} + +// GetIdentity returns the identity of the object. +func (o *IdentityObjectMeta) GetIdentity() Identity { + identity := map[string]string{} + for k, v := range o.ExtraIdentity { + identity[k] = v + } + identity[SystemIdentityName] = o.Name + return identity +} + +// GetIdentityDigest returns the digest of the object's identity. +func (o *IdentityObjectMeta) GetIdentityDigest() []byte { + return o.GetIdentity().Digest() +} + +// ObjectType describes the type of a object +// +k8s:deepcopy-gen=true +type ObjectType struct { + // Type describes the type of the object. + Type string `json:"type"` +} + +// GetType returns the type of the object. +func (t ObjectType) GetType() string { + return t.Type +} + +// SetType sets the type of the object. +func (t *ObjectType) SetType(ttype string) { + t.Type = ttype +} + +// Label is a label that can be set on objects. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type Label struct { + // Name is the unique name of the label. + Name string `json:"name"` + // Value is the json/yaml data of the label + Value json.RawMessage `json:"value"` +} + +// Labels describe a list of labels +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type Labels []Label + +// Get returns the label witht the given name +func (l Labels) Get(name string) ([]byte, bool) { + for _, label := range l { + if label.Name == name { + return label.Value, true + } + } + return nil, false +} + +// NameAccessor describes a accessor for a named object. +type NameAccessor interface { + // GetName returns the name of the object. + GetName() string + // SetName sets the name of the object. + SetName(name string) +} + +// VersionAccessor describes a accessor for a versioned object. +type VersionAccessor interface { + // GetVersion returns the version of the object. + GetVersion() string + // SetVersion sets the version of the object. + SetVersion(version string) +} + +// LabelsAccessor describes a accessor for a labeled object. +type LabelsAccessor interface { + // GetLabels returns the labels of the object. + GetLabels() Labels + // SetLabels sets the labels of the object. + SetLabels(labels []Label) +} + +// ObjectMetaAccessor describes a accessor for named and versioned object. +type ObjectMetaAccessor interface { + NameAccessor + VersionAccessor + LabelsAccessor +} + +// TypedObjectAccessor defines the accessor for a typed component with additional data. +type TypedObjectAccessor interface { + // GetType returns the type of the access object. + GetType() string + // SetType sets the type of the access object. + SetType(ttype string) +} + +// Repository is a specific type that indicated a typed repository object. +type Repository TypedObjectAccessor + +// Source is the definition of a component's source. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type Source struct { + IdentityObjectMeta `json:",inline"` + Access *UnstructuredTypedObject `json:"access"` +} + +// SourceRef defines a reference to a source +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type SourceRef struct { + // IdentitySelector defines the identity that is used to match a source. + IdentitySelector map[string]string `json:"identitySelector,omitempty"` + // Labels defines an optional set of additional labels + // describing the object. + // +optional + Labels Labels `json:"labels,omitempty"` +} + +// Resource describes a resource dependency of a component. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type Resource struct { + IdentityObjectMeta `json:",inline"` + + // Relation describes the relation of the resource to the component. + // Can be a local or external resource + Relation ResourceRelation `json:"relation,omitempty"` + + // SourceRef defines a list of source names. + // These names reference the sources defines in `component.sources`. + SourceRef []SourceRef `json:"srcRef,omitempty"` + + // Access describes the type specific method to + // access the defined resource. + Access *UnstructuredTypedObject `json:"access"` +} + +// ComponentReference describes the reference to another component in the registry. +// +k8s:deepcopy-gen=true +// +k8s:openapi-gen=true +type ComponentReference struct { + // Name is the context unique name of the object. + Name string `json:"name"` + // ComponentName describes the remote name of the referenced object + ComponentName string `json:"componentName"` + // Version is the semver version of the object. + Version string `json:"version"` + // ExtraIdentity is the identity of an object. + // An additional label with key "name" ist not allowed + ExtraIdentity Identity `json:"extraIdentity,omitempty"` + // Labels defines an optional set of additional labels + // describing the object. + // +optional + Labels Labels `json:"labels,omitempty"` +} + +// GetName returns the name of the object. +func (o ComponentReference) GetName() string { + return o.Name +} + +// SetName sets the name of the object. +func (o *ComponentReference) SetName(name string) { + o.Name = name +} + +// GetVersion returns the version of the object. +func (o ComponentReference) GetVersion() string { + return o.Version +} + +// SetVersion sets the version of the object. +func (o *ComponentReference) SetVersion(version string) { + o.Version = version +} + +// GetLabels returns the label of the object. +func (o ComponentReference) GetLabels() Labels { + return o.Labels +} + +// SetLabels sets the labels of the object. +func (o *ComponentReference) SetLabels(labels []Label) { + o.Labels = labels +} + +// GetIdentity returns the identity of the object. +func (o *ComponentReference) GetIdentity() Identity { + identity := map[string]string{} + for k, v := range o.ExtraIdentity { + identity[k] = v + } + identity[SystemIdentityName] = o.Name + return identity +} + +// GetIdentityDigest returns the digest of the object's identity. +func (o *ComponentReference) GetIdentityDigest() []byte { + return o.GetIdentity().Digest() +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/default.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/default.go new file mode 100644 index 000000000..407df9b96 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/default.go @@ -0,0 +1,68 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +// DefaultComponent applies defaults to a component +func DefaultComponent(component *ComponentDescriptor) error { + if component.RepositoryContexts == nil { + component.RepositoryContexts = make([]*UnstructuredTypedObject, 0) + } + if component.Sources == nil { + component.Sources = make([]Source, 0) + } + if component.ComponentReferences == nil { + component.ComponentReferences = make([]ComponentReference, 0) + } + if component.Resources == nil { + component.Resources = make([]Resource, 0) + } + + DefaultResources(component) + return nil +} + +// DefaultList defaults a list of components. +func DefaultList(list *ComponentDescriptorList) error { + for i, comp := range list.Components { + if len(comp.Metadata.Version) == 0 { + list.Components[i].Metadata.Version = list.Metadata.Version + } + } + return nil +} + +// DefaultResources defaults a list of resources. +// The version of the component is defaulted for local resources that do not contain a version. +// adds the version as identity if the resource identity would clash otherwise. +func DefaultResources(component *ComponentDescriptor) { + resourceIDs := map[string]struct{}{} + for i, res := range component.Resources { + if res.Relation == LocalRelation && len(res.Version) == 0 { + component.Resources[i].Version = component.GetVersion() + } + + id := string(res.GetIdentityDigest()) + if _, ok := resourceIDs[id]; ok { + identity := res.ExtraIdentity + identity[SystemIdentityVersion] = res.GetVersion() + + if id != string(identity.Digest()) { + res.SetExtraIdentity(identity) + id = string(res.GetIdentityDigest()) + } + } + resourceIDs[id] = struct{}{} + } +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/helper.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/helper.go new file mode 100644 index 000000000..8d037e0f8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/helper.go @@ -0,0 +1,294 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +import ( + "bytes" + "fmt" + + "github.com/gardener/component-spec/bindings-go/utils/selector" +) + +type IdentitySelector = selector.Interface + +// ResourceSelectorFunc defines a function to filter a resource. +type ResourceSelectorFunc = func(obj Resource) (bool, error) + +// MatchResourceSelectorFuncs applies all resource selector against the given resource object. +func MatchResourceSelectorFuncs(obj Resource, resourceSelectors ...ResourceSelectorFunc) (bool, error) { + for _, sel := range resourceSelectors { + ok, err := sel(obj) + if err != nil { + return false, err + } + if !ok { + return false, nil + } + } + return true, nil +} + +// NewTypeResourceSelector creates a new resource selector that +// selects a resource based on its type. +func NewTypeResourceSelector(ttype string) ResourceSelectorFunc { + return func(obj Resource) (bool, error) { + return obj.GetType() == ttype, nil + } +} + +// NewVersionResourceSelector creates a new resource selector that +// selects a resource based on its version. +func NewVersionResourceSelector(version string) ResourceSelectorFunc { + return func(obj Resource) (bool, error) { + return obj.GetVersion() == version, nil + } +} + +// NewRelationResourceSelector creates a new resource selector that +// selects a resource based on its relation type. +func NewRelationResourceSelector(relation ResourceRelation) ResourceSelectorFunc { + return func(obj Resource) (bool, error) { + return obj.Relation == relation, nil + } +} + +// NewNameSelector creates a new selector that matches a resource name. +func NewNameSelector(name string) selector.Interface { + return selector.DefaultSelector{ + SystemIdentityName: name, + } +} + +// GetEffectiveRepositoryContext returns the current active repository context. +func (c ComponentDescriptor) GetEffectiveRepositoryContext() *UnstructuredTypedObject { + if len(c.RepositoryContexts) == 0 { + return nil + } + return c.RepositoryContexts[len(c.RepositoryContexts)-1] +} + +// InjectRepositoryContext appends the given repository context to components descriptor repository history. +// The context is not appended if the effective repository context already matches the current context. +func InjectRepositoryContext(cd *ComponentDescriptor, repoCtx TypedObjectAccessor) error { + effective := cd.GetEffectiveRepositoryContext() + uRepoCtx, err := NewUnstructured(repoCtx) + if err != nil { + return err + } + if !UnstructuredTypesEqual(effective, &uRepoCtx) { + cd.RepositoryContexts = append(cd.RepositoryContexts, &uRepoCtx) + } + return nil +} + +// GetComponentReferences returns all component references that matches the given selectors. +func (c ComponentDescriptor) GetComponentReferences(selectors ...IdentitySelector) ([]ComponentReference, error) { + refs := make([]ComponentReference, 0) + for _, ref := range c.ComponentReferences { + ok, err := selector.MatchSelectors(ref.GetIdentity(), selectors...) + if err != nil { + return nil, fmt.Errorf("unable to match selector for resource %s: %w", ref.Name, err) + } + if ok { + refs = append(refs, ref) + } + } + if len(refs) == 0 { + return refs, NotFound + } + return refs, nil +} + +// GetResourceByIdentity returns resource that match the given identity. +func (c ComponentDescriptor) GetResourceByIdentity(id Identity) (Resource, error) { + for _, res := range c.Resources { + if bytes.Equal(res.GetIdentityDigest(), id.Digest()) { + return res, nil + } + } + return Resource{}, NotFound +} + +// GetComponentReferencesByName returns all component references with a given name. +func (c ComponentDescriptor) GetComponentReferencesByName(name string) ([]ComponentReference, error) { + return c.GetComponentReferences(NewNameSelector(name)) +} + +// GetResourceByJSONScheme returns resources that match the given selectors. +func (c ComponentDescriptor) GetResourceByJSONScheme(src interface{}) ([]Resource, error) { + sel, err := selector.NewJSONSchemaSelectorFromGoStruct(src) + if err != nil { + return nil, err + } + return c.GetResourcesBySelector(sel) +} + +// GetResourceByDefaultSelector returns resources that match the given selectors. +func (c ComponentDescriptor) GetResourceByDefaultSelector(sel interface{}) ([]Resource, error) { + identitySelector, err := selector.ParseDefaultSelector(sel) + if err != nil { + return nil, fmt.Errorf("unable to parse selector: %w", err) + } + return c.GetResourcesBySelector(identitySelector) +} + +// GetResourceByRegexSelector returns resources that match the given selectors. +func (c ComponentDescriptor) GetResourceByRegexSelector(sel interface{}) ([]Resource, error) { + identitySelector, err := selector.ParseRegexSelector(sel) + if err != nil { + return nil, fmt.Errorf("unable to parse selector: %w", err) + } + return c.GetResourcesBySelector(identitySelector) +} + +// GetResourcesBySelector returns resources that match the given selector. +func (c ComponentDescriptor) GetResourcesBySelector(selectors ...IdentitySelector) ([]Resource, error) { + resources := make([]Resource, 0) + for _, res := range c.Resources { + ok, err := selector.MatchSelectors(res.GetIdentity(), selectors...) + if err != nil { + return nil, fmt.Errorf("unable to match selector for resource %s: %w", res.Name, err) + } + if ok { + resources = append(resources, res) + } + } + if len(resources) == 0 { + return resources, NotFound + } + return resources, nil +} + +// GetResourcesBySelector returns resources that match the given selector. +func (c ComponentDescriptor) getResourceBySelectors(selectors []IdentitySelector, resourceSelectors []ResourceSelectorFunc) ([]Resource, error) { + resources := make([]Resource, 0) + for _, res := range c.Resources { + ok, err := selector.MatchSelectors(res.GetIdentity(), selectors...) + if err != nil { + return nil, fmt.Errorf("unable to match selector for resource %s: %w", res.Name, err) + } + if !ok { + continue + } + ok, err = MatchResourceSelectorFuncs(res, resourceSelectors...) + if err != nil { + return nil, fmt.Errorf("unable to match selector for resource %s: %w", res.Name, err) + } + if !ok { + continue + } + resources = append(resources, res) + } + if len(resources) == 0 { + return resources, NotFound + } + return resources, nil +} + +// GetExternalResources returns a external resource with the given type, name and version. +func (c ComponentDescriptor) GetExternalResources(rtype, name, version string) ([]Resource, error) { + return c.getResourceBySelectors( + []selector.Interface{NewNameSelector(name)}, + []ResourceSelectorFunc{ + NewTypeResourceSelector(rtype), + NewVersionResourceSelector(version), + NewRelationResourceSelector(ExternalRelation), + }) +} + +// GetExternalResource returns a external resource with the given type, name and version. +// If multiple resources match, the first one is returned. +func (c ComponentDescriptor) GetExternalResource(rtype, name, version string) (Resource, error) { + resources, err := c.GetExternalResources(rtype, name, version) + if err != nil { + return Resource{}, err + } + // at least one resource must be defined, otherwise the getResourceBySelectors functions returns a NotFound err. + return resources[0], nil +} + +// GetLocalResources returns all local resources with the given type, name and version. +func (c ComponentDescriptor) GetLocalResources(rtype, name, version string) ([]Resource, error) { + return c.getResourceBySelectors( + []selector.Interface{NewNameSelector(name)}, + []ResourceSelectorFunc{ + NewTypeResourceSelector(rtype), + NewVersionResourceSelector(version), + NewRelationResourceSelector(LocalRelation), + }) +} + +// GetLocalResource returns a local resource with the given type, name and version. +// If multiple resources match, the first one is returned. +func (c ComponentDescriptor) GetLocalResource(rtype, name, version string) (Resource, error) { + resources, err := c.GetLocalResources(rtype, name, version) + if err != nil { + return Resource{}, err + } + // at least one resource must be defined, otherwise the getResourceBySelectors functions returns a NotFound err. + return resources[0], nil +} + +// GetResourcesByType returns all resources that match the given type and selectors. +func (c ComponentDescriptor) GetResourcesByType(rtype string, selectors ...IdentitySelector) ([]Resource, error) { + return c.getResourceBySelectors( + selectors, + []ResourceSelectorFunc{ + NewTypeResourceSelector(rtype), + }) +} + +// GetResourcesByName returns all local and external resources with a name. +func (c ComponentDescriptor) GetResourcesByName(name string, selectors ...IdentitySelector) ([]Resource, error) { + return c.getResourceBySelectors( + append(selectors, NewNameSelector(name)), + nil) +} + +// GetResourceIndex returns the index of a given resource. +// If the index is not found -1 is returned. +func (c ComponentDescriptor) GetResourceIndex(res Resource) int { + id := res.GetIdentityDigest() + for i, cur := range c.Resources { + if bytes.Equal(cur.GetIdentityDigest(), id) { + return i + } + } + return -1 +} + +// GetComponentReferenceIndex returns the index of a given component reference. +// If the index is not found -1 is returned. +func (c ComponentDescriptor) GetComponentReferenceIndex(ref ComponentReference) int { + id := ref.GetIdentityDigest() + for i, cur := range c.ComponentReferences { + if bytes.Equal(cur.GetIdentityDigest(), id) { + return i + } + } + return -1 +} + +// GetSourceIndex returns the index of a given source. +// If the index is not found -1 is returned. +func (c ComponentDescriptor) GetSourceIndex(src Source) int { + id := src.GetIdentityDigest() + for i, cur := range c.Sources { + if bytes.Equal(cur.GetIdentityDigest(), id) { + return i + } + } + return -1 +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme/bindata.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme/bindata.go new file mode 100644 index 000000000..7cb2fbd93 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme/bindata.go @@ -0,0 +1,254 @@ +// Code generated for package jsonscheme by go-bindata DO NOT EDIT. (@generated) +// sources: +// ../../../../language-independent/component-descriptor-v2-schema.yaml +package jsonscheme + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +func bindataRead(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +// Name return file name +func (fi bindataFileInfo) Name() string { + return fi.name +} + +// Size return file size +func (fi bindataFileInfo) Size() int64 { + return fi.size +} + +// Mode return file mode +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} + +// Mode return file modify time +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} + +// IsDir return file whether a directory +func (fi bindataFileInfo) IsDir() bool { + return fi.mode&os.ModeDir != 0 +} + +// Sys return file is sys mode +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _LanguageIndependentComponentDescriptorV2SchemaYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5a\xed\x6f\xdb\x36\x13\xff\xae\xbf\xe2\xd0\x04\xa0\xd3\x44\x76\x9a\xe7\x29\x1e\xd4\x5f\x82\x3c\x2d\x36\x14\x1b\x1a\x20\xed\xf6\x61\x89\x57\xd0\xd2\xd9\x66\x26\x91\x1e\x49\xb9\x51\x5f\xfe\xf7\x81\xa4\xa8\x17\xdb\x52\x94\x38\x4d\xb7\x62\x9f\x22\x92\x77\xbf\x3b\x1e\xef\x8d\x8c\xf7\x59\x3c\x06\xb2\xd0\x7a\xa9\xc6\xa3\xd1\x9c\xca\x18\x39\xca\x61\x94\x88\x2c\x1e\xa9\x68\x81\x29\x55\xa3\x48\xa4\x4b\xc1\x91\xeb\x30\x46\x15\x49\xb6\xd4\x42\x86\xab\x13\x12\xec\x3b\x8a\x1a\xc2\xb5\x12\x3c\x74\xb3\x43\x21\xe7\xa3\x58\xd2\x99\x0e\x8f\xff\x57\x60\xed\x91\xc0\x43\x30\xc1\xc7\x40\x7e\x2c\x24\xc2\x4b\x2f\x03\x5e\x95\x32\x60\x75\x02\x8e\xcf\xb0\xcd\x18\x67\x86\x4b\x8d\x03\x80\x14\x35\x35\x7f\x01\x74\xbe\xc4\x31\x10\x31\xbd\xc6\x48\x13\x3b\xd5\x14\x51\x6a\x0f\x95\xf6\x96\x3f\xa6\x9a\x3a\x06\x89\x7f\x66\x4c\x62\xec\x10\x01\x42\x20\x4e\xee\xaf\x28\x15\x13\xdc\x51\x2d\xa5\x58\xa2\xd4\x0c\x95\xa7\x6b\x10\xf9\xc9\x52\x25\xa5\x25\xe3\x73\x12\x04\x00\x09\x9d\x62\xd2\xaa\xef\x16\xf1\x9c\xa6\x48\xaa\xe1\x8a\x26\x19\x5a\xa4\x72\x37\x6f\x68\x8a\x0d\x44\x2f\xce\x4c\xa5\xf4\xe6\x67\xe4\x73\xbd\x18\xc3\xc9\xf3\xe7\x4e\x7b\xaa\x35\x4a\x63\x90\xdf\x2f\x69\xf8\xf1\x38\x7c\x31\xbc\x0a\x27\x87\x97\xc3\x89\x19\x4e\x3e\x9d\x1c\xfd\xf7\xcb\xe8\x32\x74\x4b\xa3\xf7\xc3\xc9\xd3\x7d\x2b\x90\xc5\xc8\x35\xd3\xf9\x99\xd6\x92\x4d\x33\x8d\x3f\x61\xee\xe4\xa6\x8c\x97\x42\x5a\x44\x4c\x06\x97\xe1\xfb\xc3\xe2\xfb\xa9\x9f\x3c\x38\x75\xd0\x12\x13\x7a\x83\xf1\x5b\x4c\x57\x28\x1d\xe6\x1e\x68\xfa\x07\x72\x98\x49\x91\x82\xb2\x0b\xc6\x8f\x80\xf2\x18\x68\x7c\x9d\x29\x8d\x31\x68\x01\x34\x49\xc4\x07\xa0\x1c\x84\x3d\x66\x9a\x40\x82\x34\x66\x7c\x0e\x64\x45\x8e\x20\xa5\xd7\x42\x86\x82\x27\xf9\x91\x65\xb5\xe3\x61\xca\x78\x31\xeb\x65\x2d\x98\x82\x14\x29\x57\xa0\x17\x08\x33\x61\x50\x0d\x88\xb3\xa5\x02\x2a\xd1\x88\x82\x15\x4d\x58\xdc\xd4\x57\x79\x85\x9f\x0d\x4f\x86\xff\xa9\x7f\x87\x33\x21\x0e\xa7\x54\x16\x73\xab\x3a\xc1\x6a\x1b\xc5\xb3\xe1\x89\xff\x2a\xc9\x6a\xf4\xe5\x67\x83\xad\x6e\xec\xd5\xe4\x74\x70\xfc\xf9\xf2\x59\xf8\x62\x72\x15\x3f\x3d\x18\x9c\x8e\xaf\x86\xf5\x89\x83\xd3\xed\x53\xe1\x60\x70\x3a\xae\x26\x3f\x5f\xc5\xf6\x8c\xce\xc2\xdf\xc2\xc9\xe5\x71\xf8\xc2\x7f\x7b\xc8\x9e\xc4\x07\x5e\xe2\xe1\xa0\xbe\x70\x68\x41\x1a\x33\x96\xb2\xc5\xcf\x5a\xc3\xa5\x88\xc3\xdc\x44\x80\x1a\xc3\x27\xd8\x97\x38\x1b\x03\xd9\x1b\xd5\x92\xc4\x68\x9b\xdf\x12\xf8\xe2\xfc\x6e\x29\x14\xd3\x42\xe6\x2f\x05\xd7\x78\xa3\xef\x12\x99\x53\xaa\xf0\x17\x99\xd4\x82\xd3\xf0\xb5\x65\x88\x82\xba\x35\x37\xd4\x26\xbb\x49\x00\x90\x67\xe9\x18\x2e\x89\x88\xd8\x05\xce\x99\xd2\x32\x27\x13\xb3\x1d\x1a\x45\xa8\x54\xcf\x6c\x68\x14\xb2\x54\x30\x13\xb2\x60\x45\x05\x03\x33\xc2\x1b\x8d\xdc\xa4\x32\x75\xd0\xba\x7d\xb7\xd9\x00\x60\xce\xf4\x22\x9b\x9e\x75\xcb\x6e\x05\x28\x87\xe6\x2c\x9a\xe6\x94\x38\x6b\xb3\xe6\x9d\xec\xe4\x14\x24\x93\x62\xa1\x10\x74\x0b\xbb\xf1\xa4\x6e\x8a\x48\xa4\x29\xd3\x5d\xc9\x9e\x0b\x8e\xbb\xd8\x65\xc7\x7d\xbf\x11\x1c\x9d\x63\x28\x91\xc9\x08\x5f\x95\x41\x71\x07\x75\x4c\xfd\x29\x07\x2b\x57\xe0\xca\xb1\x41\x28\x07\xce\x85\x5a\x14\xe7\x65\x91\xea\x50\xbc\x7f\xf8\x16\x2c\x78\xa3\x25\x7d\x5d\x10\x8c\xef\x88\xe3\x41\x56\xb7\x54\xed\x4e\xd4\x46\x25\xb8\x57\x14\xcf\x99\x2e\x5d\xd3\x76\x07\x6a\x83\x95\x4a\x49\xf3\x8a\x93\x69\x4c\x6b\x44\x2d\x9a\x59\x2c\xcf\x54\xcf\x0c\x76\xcc\xf3\xf3\x59\x1d\x22\xdc\x0e\xe2\xf8\xc8\xed\x84\xf5\x24\xd0\x83\xdc\x74\x89\x9e\xd8\xf8\xa7\x8c\x2e\x7c\xbc\xdd\x9a\xb8\xa8\x89\x4d\x94\xc8\x23\xb4\x0d\x00\x0c\xaa\xb6\x34\x11\x11\x4d\x0e\x0a\x7f\x6f\x0b\x22\xef\x09\x6f\x31\xc1\x48\x0b\x79\x5f\xc7\xf9\x0a\xa7\x55\xef\xeb\x2e\xfc\x2e\xef\x6b\x97\x12\xa9\x6f\x73\xd9\x68\x29\xeb\x4d\x67\x77\xf3\xbb\xa5\x13\x6d\xdd\xe7\x56\x11\x5d\xc9\x01\xf6\x80\x46\x3a\xa3\x49\x92\x8f\x2b\x49\xa1\x2d\x5c\x1f\x46\xa0\x96\x18\x31\x9a\x80\x44\x43\x1f\x59\x21\xdf\x5d\x3e\xf9\x3a\x8e\x26\xd1\x85\xc9\xbb\x32\x5b\xdd\xb1\x67\xf0\x00\xaa\xf7\xe5\xa5\xf0\x23\xd8\xb3\xfc\x36\x58\x2b\x94\xa3\xa2\x0b\xcf\x94\x86\x94\xea\x68\x51\x73\x60\xb5\x51\x7a\x36\xdb\x87\x84\xea\xd2\x49\xed\x54\x3d\x79\xfd\xb3\x2b\xd2\x83\x96\x1e\x97\x6c\x1f\xc8\x9d\x1c\x58\xd5\x34\xb9\x43\xe8\x5d\xfc\xac\x0b\x90\x23\x20\xa6\xe3\x94\x9c\x26\xdf\xbc\x14\xf6\x2c\x84\x2d\x64\x22\x62\xff\x4f\xc4\x46\x1d\x6c\xa1\xb6\xbb\xff\x81\x25\xa8\x72\xa5\x31\xbd\x2b\xe7\x79\x53\x58\x00\x20\x22\xf6\x3a\xa5\xf3\x9d\x9a\x4e\x3b\x64\x06\xa5\x2c\x40\x0f\xd2\x8d\x36\x6f\x2b\xc5\xf1\x35\xc4\x74\xb5\xd2\x0d\xc3\xf6\xdc\x58\x63\x5b\x21\x90\x84\xe6\x3e\x50\x76\xdb\x0b\x90\x42\x1d\x02\x93\x6d\xd7\x85\x66\xd2\x3c\x33\xca\x37\x6b\xb3\x5e\x20\xa4\x94\xb3\x19\x2a\x4d\xba\x85\xa6\x18\x33\xfa\xae\xa1\x5c\x13\xfe\x9d\xc1\x32\x44\x2e\x31\x8b\x99\x45\x77\x56\x71\x19\xd5\xf9\xae\xd3\x40\x81\x16\xb7\x48\x8c\xd9\x1c\x95\xee\x12\xe7\x28\xbc\x28\x4d\xe5\x1c\x35\xc6\x10\x99\x3b\x34\xbf\x6d\x43\x8a\x7d\xec\xdc\x8b\x59\x07\xc6\x61\x9a\x6b\x54\x5e\xc6\xd4\x18\x7b\x1d\x97\x67\xe9\xd4\x1c\x68\x00\xd0\x1a\x49\x3b\xc4\xc0\x8c\x25\x58\x15\xb0\x5d\x3d\x66\x8b\x86\x95\xf7\x78\x51\x6d\x76\xf1\xeb\x75\x73\x80\x5e\x50\x0d\x4c\xd9\xbd\x1b\xf3\x33\x6e\xd7\x9e\x98\x45\xf5\x04\x62\x26\x6d\x77\x9b\xb7\x9e\x87\xb7\xdb\xf9\x3d\x62\xeb\x91\x0c\x76\xbe\x1e\x67\xdd\xce\xd9\x74\x4c\x1b\xef\xf0\x81\xe9\x45\x61\x9a\x28\x93\x12\xb9\x86\x6d\x0f\xc1\x5d\x56\xf2\x69\xf5\xa2\x68\x55\x76\x79\xbf\xad\xb7\xd2\xdb\x8c\xf8\xfd\x34\x2d\x8f\x7b\x8d\xf6\x67\xf4\xf8\x0d\x44\x5b\x23\x50\xab\xc4\xd6\x8b\xaa\x3b\xef\x0e\x31\x96\xf9\x17\xb2\x1d\xab\xb1\x51\xa6\x34\x55\xd6\xf1\x1a\x16\x00\xcc\x91\xa3\x64\xd1\x37\x7c\xc9\x2a\x34\x70\x8f\x59\xc5\xe0\xdf\x60\xfc\xfb\x06\x63\x75\x5e\x6e\xfe\xdb\xc6\x62\xc3\x7f\x9b\x6f\x2c\xbd\x9f\x56\xee\xfc\x96\xb2\xe9\x5b\x1b\xff\x6c\x50\xb5\xc5\xa5\x14\x2b\x16\x57\xe6\x0e\x81\x34\x2e\xd7\xcd\xf7\x99\xb2\x65\x56\x0d\xfc\x06\xc7\x6d\xfe\xda\xff\x79\xe6\xe1\x9d\x69\xd3\x14\x0f\xe3\x1b\x1b\xb8\x1e\xc0\x9b\xb7\xb7\x07\x33\x5e\xdc\x47\x1f\xf5\x6e\x5a\x1c\xe0\x03\x5d\xcd\xd7\x1e\xfd\x6b\xff\xb7\x58\xf7\xa2\x87\x11\xb8\x09\x5c\x9d\xf7\x7d\x77\xb6\xf1\x50\xdd\x7a\x25\xae\x3f\x67\x91\x3e\x0c\xeb\x5d\x5d\x2f\xa6\xb5\xe2\x63\xb3\xc9\x76\x93\xc2\xa7\x2f\x41\x10\xac\xa5\x96\x7a\xde\x08\x81\xa4\xe8\x7e\x78\x50\x8f\x6d\x12\x34\x23\xb7\xfa\x81\xc3\x56\x85\x3c\xc4\x5a\x4a\xeb\x3e\x20\x12\xfc\x15\x00\x00\xff\xff\xe5\xaa\x66\x7c\xef\x21\x00\x00") + +func LanguageIndependentComponentDescriptorV2SchemaYamlBytes() ([]byte, error) { + return bindataRead( + _LanguageIndependentComponentDescriptorV2SchemaYaml, + "../../../../language-independent/component-descriptor-v2-schema.yaml", + ) +} + +func LanguageIndependentComponentDescriptorV2SchemaYaml() (*asset, error) { + bytes, err := LanguageIndependentComponentDescriptorV2SchemaYamlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "../../../../language-independent/component-descriptor-v2-schema.yaml", size: 8687, mode: os.FileMode(420), modTime: time.Unix(1610727054, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "../../../../language-independent/component-descriptor-v2-schema.yaml": LanguageIndependentComponentDescriptorV2SchemaYaml, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} + +var _bintree = &bintree{nil, map[string]*bintree{ + "..": &bintree{nil, map[string]*bintree{ + "..": &bintree{nil, map[string]*bintree{ + "..": &bintree{nil, map[string]*bintree{ + "..": &bintree{nil, map[string]*bintree{ + "language-independent": &bintree{nil, map[string]*bintree{ + "component-descriptor-v2-schema.yaml": &bintree{LanguageIndependentComponentDescriptorV2SchemaYaml, map[string]*bintree{}}, + }}, + }}, + }}, + }}, + }}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme/jsonscheme.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme/jsonscheme.go new file mode 100644 index 000000000..ee0af3736 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme/jsonscheme.go @@ -0,0 +1,68 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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. + +//go:generate go-bindata -pkg jsonscheme ../../../../language-independent/component-descriptor-v2-schema.yaml + +package jsonscheme + +import ( + "errors" + "fmt" + + "github.com/ghodss/yaml" + "github.com/xeipuuv/gojsonschema" +) + +var Schema *gojsonschema.Schema + +func init() { + dataBytes, err := LanguageIndependentComponentDescriptorV2SchemaYamlBytes() + if err != nil { + panic(err) + } + + data, err := yaml.YAMLToJSON(dataBytes) + if err != nil { + panic(err) + } + + Schema, err = gojsonschema.NewSchema(gojsonschema.NewBytesLoader(data)) + if err != nil { + panic(err) + } +} + +// Validate validates the given data against the component descriptor v2 jsonscheme. +func Validate(src []byte) error { + data, err := yaml.YAMLToJSON(src) + if err != nil { + return err + } + documentLoader := gojsonschema.NewBytesLoader(data) + res, err := Schema.Validate(documentLoader) + if err != nil { + return err + } + + if !res.Valid() { + errs := res.Errors() + errMsg := errs[0].String() + for i := 1; i < len(errs); i++ { + errMsg = fmt.Sprintf("%s;%s", errMsg, errs[i].String()) + } + return errors.New(errMsg) + } + + return nil +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/list.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/list.go new file mode 100644 index 000000000..411b81140 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/list.go @@ -0,0 +1,51 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +import ( + "errors" +) + +// ComponentDescriptorList describes the v2 component descriptor containing +// components and their versions. +type ComponentDescriptorList struct { + Metadata Metadata `json:"meta"` + + // Components contain all resolvable components with their dependencies + Components []ComponentDescriptor `json:"components"` +} + +// GetComponent return the component with a given name and version. +// It returns an error if no component with the name and version is defined. +func (c *ComponentDescriptorList) GetComponent(name, version string) (ComponentDescriptor, error) { + for _, comp := range c.Components { + if comp.GetName() == name && comp.GetVersion() == version { + return comp, nil + } + } + return ComponentDescriptor{}, errors.New("NotFound") +} + +// GetComponentByName returns all components that match the given name. +func (c *ComponentDescriptorList) GetComponentByName(name string) []ComponentDescriptor { + comps := make([]ComponentDescriptor, 0) + for _, comp := range c.Components { + if comp.GetName() == name { + obj := comp + comps = append(comps, obj) + } + } + return comps +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/repositorytypes.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/repositorytypes.go new file mode 100644 index 000000000..53f7dcab1 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/repositorytypes.go @@ -0,0 +1,52 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +// ComponentNameMapping describes the method that is used to map the "Component Name", "Component Version"-tuples +// to OCI Image References. +type ComponentNameMapping string + +const ( + OCIRegistryURLPathMapping ComponentNameMapping = "urlPath" + OCIRegistryDigestMapping ComponentNameMapping = "sha256-digest" +) + +// OCIRegistryRepository describes a component repository backed by a oci registry. +type OCIRegistryRepository struct { + ObjectType `json:",inline"` + // BaseURL is the base url of the repository to resolve components. + BaseURL string `json:"baseUrl"` + // ComponentNameMapping describes the method that is used to map the "Component Name", "Component Version"-tuples + // to OCI Image References. + ComponentNameMapping ComponentNameMapping `json:"componentNameMapping"` +} + +// NewOCIRegistryRepository creates a new OCIRegistryRepository accessor +func NewOCIRegistryRepository(baseURL string, mapping ComponentNameMapping) *OCIRegistryRepository { + if len(mapping) == 0 { + mapping = OCIRegistryURLPathMapping + } + return &OCIRegistryRepository{ + ObjectType: ObjectType{ + Type: OCIRegistryType, + }, + BaseURL: baseURL, + ComponentNameMapping: mapping, + } +} + +func (a *OCIRegistryRepository) GetType() string { + return OCIRegistryType +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/resources.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/resources.go new file mode 100644 index 000000000..25a8f9d33 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/resources.go @@ -0,0 +1,21 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +// OCIImageType is the type of an oci image component. +const OCIImageType = "ociImage" + +// GitType is the type a git repository resource. +const GitType = "git" diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/unstructured.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/unstructured.go new file mode 100644 index 000000000..b1b078b5b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/unstructured.go @@ -0,0 +1,166 @@ +// Copyright 2021 Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 v2 + +import ( + "bytes" + "encoding/json" +) + +// UnstructuredTypesEqual compares two unstructured object. +func UnstructuredTypesEqual(a, b *UnstructuredTypedObject) bool { + if a == nil && b == nil { + return true + } + if a == nil || b == nil { + return false + } + if a.GetType() != b.GetType() { + return false + } + rawA, err := a.GetRaw() + if err != nil { + return false + } + rawB, err := b.GetRaw() + if err != nil { + return false + } + return bytes.Equal(rawA, rawB) +} + +// TypedObjectEqual compares two typed objects using the unstructured type. +func TypedObjectEqual(a, b TypedObjectAccessor) bool { + if a.GetType() != b.GetType() { + return false + } + uA, err := NewUnstructured(a) + if err != nil { + return false + } + uB, err := NewUnstructured(b) + if err != nil { + return false + } + return UnstructuredTypesEqual(&uA, &uB) +} + +// NewUnstructured creates a new unstructured object from a typed object using the default codec. +func NewUnstructured(obj TypedObjectAccessor) (UnstructuredTypedObject, error) { + uObj, err := ToUnstructuredTypedObject(NewDefaultCodec(), obj) + if err != nil { + return UnstructuredTypedObject{}, nil + } + return *uObj, nil +} + +// NewEmptyUnstructured creates a new typed object without additional data. +func NewEmptyUnstructured(ttype string) *UnstructuredTypedObject { + return NewUnstructuredType(ttype, nil) +} + +// NewUnstructuredType creates a new unstructured typed object. +func NewUnstructuredType(ttype string, data map[string]interface{}) *UnstructuredTypedObject { + unstr := &UnstructuredTypedObject{} + unstr.Object = data + unstr.SetType(ttype) + return unstr +} + +// UnstructuredTypedObject describes a generic typed object. +// +k8s:openapi-gen=true +type UnstructuredTypedObject struct { + ObjectType `json:",inline"` + Raw []byte `json:"-"` + Object map[string]interface{} `json:"object"` +} + +func (u *UnstructuredTypedObject) SetType(ttype string) { + u.ObjectType.SetType(ttype) + if u.Object == nil { + u.Object = make(map[string]interface{}) + } + u.Object["type"] = ttype +} + +// DeepCopyInto is deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (u *UnstructuredTypedObject) DeepCopyInto(out *UnstructuredTypedObject) { + *out = *u + raw := make([]byte, len(u.Raw)) + copy(raw, u.Raw) + _ = out.setRaw(raw) +} + +// DeepCopy is deepcopy function, copying the receiver, creating a new UnstructuredTypedObject. +func (u *UnstructuredTypedObject) DeepCopy() *UnstructuredTypedObject { + if u == nil { + return nil + } + out := new(UnstructuredTypedObject) + u.DeepCopyInto(out) + return out +} + +// DecodeInto decodes a unstructured typed object into a TypedObjectAccessor using the default codec +func (u *UnstructuredTypedObject) DecodeInto(into TypedObjectAccessor) error { + return FromUnstructuredObject(NewDefaultCodec(), u, into) +} + +func (u UnstructuredTypedObject) GetRaw() ([]byte, error) { + data, err := json.Marshal(u.Object) + if err != nil { + return nil, err + } + if !bytes.Equal(data, u.Raw) { + u.Raw = data + } + return u.Raw, nil +} + +func (u *UnstructuredTypedObject) setRaw(data []byte) error { + obj := map[string]interface{}{} + if err := json.Unmarshal(data, &obj); err != nil { + return err + } + u.Raw = data + u.Object = obj + return nil +} + +// UnmarshalJSON implements a custom json unmarshal method for a unstructured typed object. +func (u *UnstructuredTypedObject) UnmarshalJSON(data []byte) error { + typedObj := ObjectType{} + if err := json.Unmarshal(data, &typedObj); err != nil { + return err + } + + obj := UnstructuredTypedObject{ + ObjectType: typedObj, + } + if err := obj.setRaw(data); err != nil { + return err + } + *u = obj + return nil +} + +// MarshalJSON implements a custom json unmarshal method for a unstructured type. +func (u *UnstructuredTypedObject) MarshalJSON() ([]byte, error) { + data, err := json.Marshal(u.Object) + if err != nil { + return nil, err + } + return data, nil +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/validation/validate_list.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/validation/validate_list.go new file mode 100644 index 000000000..1c397b82d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/validation/validate_list.go @@ -0,0 +1,48 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 validation + +import ( + "k8s.io/apimachinery/pkg/util/validation/field" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" +) + +// Validate validates a parsed v2 component descriptor +func ValidateList(list *v2.ComponentDescriptorList) error { + if err := validateList(list); err != nil { + return err.ToAggregate() + } + return nil +} + +func validateList(list *v2.ComponentDescriptorList) field.ErrorList { + if list == nil { + return nil + } + allErrs := field.ErrorList{} + + if len(list.Metadata.Version) == 0 { + allErrs = append(allErrs, field.Required(field.NewPath("meta").Child("schemaVersion"), "must specify a version")) + } + + compsPath := field.NewPath("components") + for i, comp := range list.Components { + compPath := compsPath.Index(i) + allErrs = append(allErrs, validate(compPath, &comp)...) + } + + return allErrs +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/validation/validation.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/validation/validation.go new file mode 100644 index 000000000..25631a20c --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/validation/validation.go @@ -0,0 +1,255 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 validation + +import ( + "regexp" + "unicode" + + "k8s.io/apimachinery/pkg/util/validation/field" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" +) + +// Validate validates a parsed v2 component descriptor +func Validate(component *v2.ComponentDescriptor) error { + if err := validate(nil, component); err != nil { + return err.ToAggregate() + } + return nil +} + +func validate(fldPath *field.Path, component *v2.ComponentDescriptor) field.ErrorList { + if component == nil { + return nil + } + allErrs := field.ErrorList{} + + if len(component.Metadata.Version) == 0 { + metaPath := field.NewPath("meta").Child("schemaVersion") + if fldPath != nil { + metaPath = fldPath.Child("meta").Child("schemaVersion") + } + allErrs = append(allErrs, field.Required(metaPath, "must specify a version")) + } + + compPath := field.NewPath("component") + if fldPath != nil { + compPath = fldPath.Child("component") + } + + if err := validateProvider(compPath.Child("provider"), component.Provider); err != nil { + allErrs = append(allErrs, err) + } + + allErrs = append(allErrs, ValidateObjectMeta(compPath, component)...) + + srcPath := compPath.Child("sources") + allErrs = append(allErrs, ValidateSources(srcPath, component.Sources)...) + + refPath := compPath.Child("componentReferences") + allErrs = append(allErrs, ValidateComponentReferences(refPath, component.ComponentReferences)...) + + resourcePath := compPath.Child("resources") + allErrs = append(allErrs, ValidateResources(resourcePath, component.Resources, component.GetVersion())...) + + return allErrs +} + +// ValidateObjectMeta validate the metadata of an object. +func ValidateObjectMeta(fldPath *field.Path, om v2.ObjectMetaAccessor) field.ErrorList { + allErrs := field.ErrorList{} + if len(om.GetName()) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "must specify a name")) + } + if len(om.GetVersion()) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("version"), "must specify a version")) + } + if len(om.GetLabels()) != 0 { + allErrs = append(allErrs, ValidateLabels(fldPath.Child("labels"), om.GetLabels())...) + } + return allErrs +} + +// ValidateIdentity validates the identity of object. +func ValidateIdentity(fldPath *field.Path, id v2.Identity) field.ErrorList { + allErrs := field.ErrorList{} + + for key := range id { + if key == v2.SystemIdentityName { + allErrs = append(allErrs, field.Forbidden(fldPath.Key(v2.SystemIdentityName), "name is a reserved system identity label")) + } + + if !IsASCII(key) { + allErrs = append(allErrs, field.Forbidden(fldPath.Key(key), "key contains non-ascii characters")) + } + if !identityKeyValidationRegexp.Match([]byte(key)) { + allErrs = append(allErrs, field.Invalid(fldPath.Key(key), key, identityKeyValidationErrMsg)) + } + } + return allErrs +} + +// ValidateSources validates a list of sources. +// It makes sure that no duplicate sources are present. +func ValidateSources(fldPath *field.Path, sources []v2.Source) field.ErrorList { + allErrs := field.ErrorList{} + sourceIDs := make(map[string]struct{}) + for i, src := range sources { + srcPath := fldPath.Index(i) + allErrs = append(allErrs, ValidateSource(srcPath, src)...) + + id := string(src.GetIdentityDigest()) + if _, ok := sourceIDs[id]; ok { + allErrs = append(allErrs, field.Duplicate(srcPath, "duplicate source")) + continue + } + sourceIDs[id] = struct{}{} + } + return allErrs +} + +// ValidateSource validates the a component's source object. +func ValidateSource(fldPath *field.Path, src v2.Source) field.ErrorList { + allErrs := field.ErrorList{} + if len(src.GetName()) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "must specify a name")) + } + if len(src.GetType()) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("type"), "must specify a type")) + } + allErrs = append(allErrs, ValidateIdentity(fldPath.Child("extraIdentity"), src.ExtraIdentity)...) + return allErrs +} + +// ValidateResource validates a components resource +func ValidateResource(fldPath *field.Path, res v2.Resource) field.ErrorList { + allErrs := field.ErrorList{} + allErrs = append(allErrs, ValidateObjectMeta(fldPath, &res)...) + + if !identityKeyValidationRegexp.Match([]byte(res.Name)) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), res.Name, identityKeyValidationErrMsg)) + } + + if len(res.GetType()) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("type"), "must specify a type")) + } + if res.Access == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("access"), "must specify a access")) + } + allErrs = append(allErrs, ValidateIdentity(fldPath.Child("extraIdentity"), res.ExtraIdentity)...) + + return allErrs +} + +func validateProvider(fldPath *field.Path, provider v2.ProviderType) *field.Error { + if len(provider) == 0 { + return field.Required(fldPath, "provider must be set and one of (internal, external)") + } + if provider != v2.InternalProvider && provider != v2.ExternalProvider { + return field.Invalid(fldPath, "unknown provider type", "provider must be one of (internal, external)") + } + return nil +} + +// ValidateLabels validates a list of labels. +func ValidateLabels(fldPath *field.Path, labels []v2.Label) field.ErrorList { + allErrs := field.ErrorList{} + labelNames := make(map[string]struct{}) + for i, label := range labels { + labelPath := fldPath.Index(i) + if len(label.Name) == 0 { + allErrs = append(allErrs, field.Required(labelPath.Child("name"), "must specify a name")) + continue + } + + if _, ok := labelNames[label.Name]; ok { + allErrs = append(allErrs, field.Duplicate(labelPath, "duplicate label name")) + continue + } + labelNames[label.Name] = struct{}{} + } + return allErrs +} + +// ValidateComponentReference validates a component reference. +func ValidateComponentReference(fldPath *field.Path, cr v2.ComponentReference) field.ErrorList { + allErrs := field.ErrorList{} + if len(cr.ComponentName) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("componentName"), "must specify a component name")) + } + allErrs = append(allErrs, ValidateObjectMeta(fldPath, &cr)...) + return allErrs +} + +// ValidateComponentReferences validates a list of component references. +// It makes sure that no duplicate sources are present. +func ValidateComponentReferences(fldPath *field.Path, refs []v2.ComponentReference) field.ErrorList { + allErrs := field.ErrorList{} + refIDs := make(map[string]struct{}) + for i, ref := range refs { + refPath := fldPath.Index(i) + allErrs = append(allErrs, ValidateComponentReference(refPath, ref)...) + + id := string(ref.GetIdentityDigest()) + if _, ok := refIDs[id]; ok { + allErrs = append(allErrs, field.Duplicate(refPath, "duplicate component reference name")) + continue + } + refIDs[id] = struct{}{} + } + return allErrs +} + +// ValidateResources validates a list of resources. +// It makes sure that no duplicate sources are present. +func ValidateResources(fldPath *field.Path, resources []v2.Resource, componentVersion string) field.ErrorList { + allErrs := field.ErrorList{} + resourceIDs := make(map[string]struct{}) + for i, res := range resources { + localPath := fldPath.Index(i) + allErrs = append(allErrs, ValidateResource(localPath, res)...) + + // only validate the component version if it is defined + if res.Relation == v2.LocalRelation && len(componentVersion) != 0 { + if res.GetVersion() != componentVersion { + allErrs = append(allErrs, field.Invalid(localPath.Child("version"), "invalid version", + "version of local resources must match the component version")) + } + } + + id := string(res.GetIdentityDigest()) + if _, ok := resourceIDs[id]; ok { + allErrs = append(allErrs, field.Duplicate(localPath, "duplicated resource")) + continue + } + resourceIDs[id] = struct{}{} + } + return allErrs +} + +const identityKeyValidationErrMsg string = "a identity label or name must consist of lower case alphanumeric characters, '-', '_' or '+', and must start and end with an alphanumeric character" + +var identityKeyValidationRegexp = regexp.MustCompile("^[a-z0-9]([-_+a-z0-9]*[a-z0-9])?$") + +// IsAscii checks whether a string only contains ascii characters +func IsASCII(s string) bool { + for i := 0; i < len(s); i++ { + if s[i] > unicode.MaxASCII { + return false + } + } + return true +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/zz_generated_deepcopy.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/zz_generated_deepcopy.go new file mode 100644 index 000000000..f2ae76d31 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/apis/v2/zz_generated_deepcopy.go @@ -0,0 +1,339 @@ +// +build !ignore_autogenerated + +/* +Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v2 + +import ( + json "encoding/json" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptor) DeepCopyInto(out *ComponentDescriptor) { + *out = *in + out.Metadata = in.Metadata + in.ComponentSpec.DeepCopyInto(&out.ComponentSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptor. +func (in *ComponentDescriptor) DeepCopy() *ComponentDescriptor { + if in == nil { + return nil + } + out := new(ComponentDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentReference) DeepCopyInto(out *ComponentReference) { + *out = *in + if in.ExtraIdentity != nil { + in, out := &in.ExtraIdentity, &out.ExtraIdentity + *out = make(Identity, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(Labels, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentReference. +func (in *ComponentReference) DeepCopy() *ComponentReference { + if in == nil { + return nil + } + out := new(ComponentReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentSpec) DeepCopyInto(out *ComponentSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.RepositoryContexts != nil { + in, out := &in.RepositoryContexts, &out.RepositoryContexts + *out = make([]*UnstructuredTypedObject, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = (*in).DeepCopy() + } + } + } + if in.Sources != nil { + in, out := &in.Sources, &out.Sources + *out = make([]Source, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ComponentReferences != nil { + in, out := &in.ComponentReferences, &out.ComponentReferences + *out = make([]ComponentReference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]Resource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentSpec. +func (in *ComponentSpec) DeepCopy() *ComponentSpec { + if in == nil { + return nil + } + out := new(ComponentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in Identity) DeepCopyInto(out *Identity) { + { + in := &in + *out = make(Identity, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Identity. +func (in Identity) DeepCopy() Identity { + if in == nil { + return nil + } + out := new(Identity) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IdentityObjectMeta) DeepCopyInto(out *IdentityObjectMeta) { + *out = *in + if in.ExtraIdentity != nil { + in, out := &in.ExtraIdentity, &out.ExtraIdentity + *out = make(Identity, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(Labels, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IdentityObjectMeta. +func (in *IdentityObjectMeta) DeepCopy() *IdentityObjectMeta { + if in == nil { + return nil + } + out := new(IdentityObjectMeta) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Label) DeepCopyInto(out *Label) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Label. +func (in *Label) DeepCopy() *Label { + if in == nil { + return nil + } + out := new(Label) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in Labels) DeepCopyInto(out *Labels) { + { + in := &in + *out = make(Labels, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Labels. +func (in Labels) DeepCopy() Labels { + if in == nil { + return nil + } + out := new(Labels) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Metadata) DeepCopyInto(out *Metadata) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metadata. +func (in *Metadata) DeepCopy() *Metadata { + if in == nil { + return nil + } + out := new(Metadata) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta) { + *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(Labels, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMeta. +func (in *ObjectMeta) DeepCopy() *ObjectMeta { + if in == nil { + return nil + } + out := new(ObjectMeta) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectType) DeepCopyInto(out *ObjectType) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectType. +func (in *ObjectType) DeepCopy() *ObjectType { + if in == nil { + return nil + } + out := new(ObjectType) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Resource) DeepCopyInto(out *Resource) { + *out = *in + in.IdentityObjectMeta.DeepCopyInto(&out.IdentityObjectMeta) + if in.SourceRef != nil { + in, out := &in.SourceRef, &out.SourceRef + *out = make([]SourceRef, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Access != nil { + in, out := &in.Access, &out.Access + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource. +func (in *Resource) DeepCopy() *Resource { + if in == nil { + return nil + } + out := new(Resource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Source) DeepCopyInto(out *Source) { + *out = *in + in.IdentityObjectMeta.DeepCopyInto(&out.IdentityObjectMeta) + if in.Access != nil { + in, out := &in.Access, &out.Access + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Source. +func (in *Source) DeepCopy() *Source { + if in == nil { + return nil + } + out := new(Source) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SourceRef) DeepCopyInto(out *SourceRef) { + *out = *in + if in.IdentitySelector != nil { + in, out := &in.IdentitySelector, &out.IdentitySelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(Labels, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceRef. +func (in *SourceRef) DeepCopy() *SourceRef { + if in == nil { + return nil + } + out := new(SourceRef) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/codec/codec.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/codec/codec.go new file mode 100644 index 000000000..ff6cbd93e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/codec/codec.go @@ -0,0 +1,171 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 codec + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + + "sigs.k8s.io/yaml" + + "github.com/gardener/component-spec/bindings-go/apis" + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme" + "github.com/gardener/component-spec/bindings-go/apis/v2/validation" +) + +// Decode decodes a component into the given object. +// The obj is expected to be of type v2.ComponentDescriptor or v2.ComponentDescriptorList. +func Decode(data []byte, obj interface{}, opts ...DecodeOption) error { + objType := reflect.TypeOf(obj) + if objType.Kind() != reflect.Ptr { + return fmt.Errorf("object is expected to be of type pointer but is of type %T", obj) + } + + o := &DecodeOptions{} + o.ApplyOptions(opts) + + raw := make(map[string]json.RawMessage) + if err := yaml.Unmarshal(data, &raw); err != nil { + return err + } + + var metadata apis.Metadata + if err := yaml.Unmarshal(raw["meta"], &metadata); err != nil { + return err + } + + // handle v2 + if metadata.Version == v2.SchemaVersion && objType.Elem() == reflect.TypeOf(v2.ComponentDescriptor{}) { + if !o.DisableValidation { + if err := jsonscheme.Validate(data); err != nil { + return err + } + } + + if o.StrictMode { + if err := yaml.UnmarshalStrict(data, obj); err != nil { + return err + } + } else { + if err := yaml.Unmarshal(data, obj); err != nil { + return err + } + } + + comp := obj.(*v2.ComponentDescriptor) + if err := v2.DefaultComponent(comp); err != nil { + return err + } + + if o.DisableValidation { + return nil + } + return validation.Validate(comp) + } + + if metadata.Version == v2.SchemaVersion && objType.Elem() == reflect.TypeOf(v2.ComponentDescriptorList{}) { + if o.StrictMode { + if err := yaml.UnmarshalStrict(data, obj); err != nil { + return err + } + } else { + if err := yaml.Unmarshal(data, obj); err != nil { + return err + } + } + list := obj.(*v2.ComponentDescriptorList) + if err := v2.DefaultList(list); err != nil { + return err + } + if o.DisableValidation { + return nil + } + return validation.ValidateList(list) + } + + // todo: implement conversion + return errors.New("invalid version") +} + +// Encode encodes a component or component list into the given object. +// The obj is expected to be of type v2.ComponentDescriptor or v2.ComponentDescriptorList. +func Encode(obj interface{}) ([]byte, error) { + objType := reflect.TypeOf(obj) + if objType.Kind() != reflect.Ptr { + return nil, fmt.Errorf("object is expected to be of type pointer but is of type %T", obj) + } + + if objType.Elem() == reflect.TypeOf(v2.ComponentDescriptor{}) { + comp := obj.(*v2.ComponentDescriptor) + comp.Metadata.Version = v2.SchemaVersion + if err := v2.DefaultComponent(comp); err != nil { + return nil, err + } + return json.Marshal(comp) + } + + if objType.Elem() == reflect.TypeOf(v2.ComponentDescriptorList{}) { + list := obj.(*v2.ComponentDescriptorList) + list.Metadata.Version = v2.SchemaVersion + if err := v2.DefaultList(list); err != nil { + return nil, err + } + return json.Marshal(list) + } + + // todo: implement conversion + return nil, errors.New("invalid version") +} + +// DecodeOptions defines decode options for the codec. +type DecodeOptions struct { + DisableValidation bool + StrictMode bool +} + +// ApplyOptions applies the given list options on these options, +// and then returns itself (for convenient chaining). +func (o *DecodeOptions) ApplyOptions(opts []DecodeOption) *DecodeOptions { + for _, opt := range opts { + if opt != nil { + opt.ApplyOption(o) + } + } + return o +} + +// DecodeOption is the interface to specify different cache options +type DecodeOption interface { + ApplyOption(options *DecodeOptions) +} + +// StrictMode enables or disables strict mode parsing. +type StrictMode bool + +// ApplyOption applies the configured strict mode. +func (s StrictMode) ApplyOption(options *DecodeOptions) { + options.StrictMode = bool(s) +} + +// DisableValidation enables or disables validation of the component descriptor. +type DisableValidation bool + +// ApplyOption applies the validation disable option. +func (v DisableValidation) ApplyOption(options *DecodeOptions) { + options.DisableValidation = bool(v) +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/componentarchive.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/componentarchive.go new file mode 100644 index 000000000..a4a70ce58 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/componentarchive.go @@ -0,0 +1,531 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 ctf + +import ( + "archive/tar" + "bytes" + "compress/gzip" + "context" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "time" + + "github.com/mandelsoft/vfs/pkg/memoryfs" + "github.com/mandelsoft/vfs/pkg/osfs" + "github.com/mandelsoft/vfs/pkg/projectionfs" + "github.com/mandelsoft/vfs/pkg/vfs" + "github.com/opencontainers/go-digest" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/codec" +) + +// NewComponentArchive returns a new component descriptor with a filesystem +func NewComponentArchive(cd *v2.ComponentDescriptor, fs vfs.FileSystem) *ComponentArchive { + return &ComponentArchive{ + ComponentDescriptor: cd, + fs: fs, + BlobResolver: &ComponentArchiveBlobResolver{ + fs: fs, + }, + } +} + +// ComponentArchiveFromPath creates a component archive from a path +func ComponentArchiveFromPath(path string) (*ComponentArchive, error) { + fs, err := projectionfs.New(osfs.New(), path) + if err != nil { + return nil, fmt.Errorf("unable to create projected filesystem from path %s: %w", path, err) + } + + return NewComponentArchiveFromFilesystem(fs) +} + +// ComponentArchiveFromCompressedCTF creates a new component archive from a zipped CTF tar. +func ComponentArchiveFromCompressedCTF(path string) (*ComponentArchive, error) { + // we expect that the path point to a targz + file, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("unable to open tar archive from %s: %w", path, err) + } + defer file.Close() + reader, err := gzip.NewReader(file) + if err != nil { + return nil, fmt.Errorf("unable to open gzip reader for %s: %w", path, err) + } + return NewComponentArchiveFromTarReader(reader) +} + +// ComponentArchiveFromCTF creates a new componet archive from a CTF tar file. +func ComponentArchiveFromCTF(path string) (*ComponentArchive, error) { + // we expect that the path point to a tar + file, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("unable to open tar archive from %s: %w", path, err) + } + defer file.Close() + return NewComponentArchiveFromTarReader(file) +} + +// NewComponentArchiveFromTarReader creates a new manifest builder from a input reader. +// todo: make the fs configurable to also use a temporary filesystem +func NewComponentArchiveFromTarReader(in io.Reader) (*ComponentArchive, error) { + // the archive is untared to a memory fs that the builder can work + // as it would be a default filesystem. + fs := memoryfs.New() + if err := ExtractTarToFs(fs, in); err != nil { + return nil, fmt.Errorf("unable to extract tar: %w", err) + } + + return NewComponentArchiveFromFilesystem(fs) +} + +// NewComponentArchiveFromFilesystem creates a new component archive from a filesystem. +func NewComponentArchiveFromFilesystem(fs vfs.FileSystem, decodeOpts ...codec.DecodeOption) (*ComponentArchive, error) { + data, err := vfs.ReadFile(fs, filepath.Join("/", ComponentDescriptorFileName)) + if err != nil { + return nil, fmt.Errorf("unable to read the component descriptor from %s: %w", ComponentDescriptorFileName, err) + } + cd := &v2.ComponentDescriptor{} + if err := codec.Decode(data, cd, decodeOpts...); err != nil { + return nil, fmt.Errorf("unable to parse component descriptor read from %s: %w", ComponentDescriptorFileName, err) + } + + return &ComponentArchive{ + ComponentDescriptor: cd, + fs: fs, + BlobResolver: &ComponentArchiveBlobResolver{ + fs: fs, + }, + }, nil +} + +// ComponentArchive is the go representation for a CTF component artefact +type ComponentArchive struct { + ComponentDescriptor *v2.ComponentDescriptor + fs vfs.FileSystem + BlobResolver +} + +// Digest returns the digest of the component archive. +// The digest is computed serializing the included component descriptor into json and compute sha hash. +func (ca *ComponentArchive) Digest() (string, error) { + data, err := codec.Encode(ca.ComponentDescriptor) + if err != nil { + return "", err + } + return digest.FromBytes(data).String(), nil +} + +// AddResource adds a blob resource to the current archive. +// If the specified resource already exists it will be overwritten. +func (ca *ComponentArchive) AddResource(res *v2.Resource, info BlobInfo, reader io.Reader) error { + if res == nil { + return errors.New("a resource has to be defined") + } + id := ca.ComponentDescriptor.GetResourceIndex(*res) + if err := ca.ensureBlobsPath(); err != nil { + return err + } + + blobpath := BlobPath(info.Digest) + if _, err := ca.fs.Stat(blobpath); err != nil { + if !os.IsNotExist(err) { + return fmt.Errorf("unable to get file info for %s", blobpath) + } + file, err := ca.fs.OpenFile(blobpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) + if err != nil { + return fmt.Errorf("unable to open file %s: %w", blobpath, err) + } + if _, err := io.Copy(file, reader); err != nil { + return fmt.Errorf("unable to write blob to file: %w", err) + } + if err := file.Close(); err != nil { + return fmt.Errorf("unable to close file: %w", err) + } + } + + localFsAccess := v2.NewLocalFilesystemBlobAccess(info.Digest, info.MediaType) + unstructuredType, err := v2.NewUnstructured(localFsAccess) + if err != nil { + return fmt.Errorf("unable to convert local filesystem type to untructured type: %w", err) + } + res.Access = &unstructuredType + + if id == -1 { + ca.ComponentDescriptor.Resources = append(ca.ComponentDescriptor.Resources, *res) + } else { + ca.ComponentDescriptor.Resources[id] = *res + } + return nil +} + +// AddSource adds a blob source to the current archive. +// If the specified source already exists it will be overwritten. +func (ca *ComponentArchive) AddSource(src *v2.Source, info BlobInfo, reader io.Reader) error { + if src == nil { + return errors.New("a source has to be defined") + } + id := ca.ComponentDescriptor.GetSourceIndex(*src) + if err := ca.ensureBlobsPath(); err != nil { + return err + } + + blobpath := BlobPath(info.Digest) + if _, err := ca.fs.Stat(blobpath); err != nil { + if !os.IsNotExist(err) { + return fmt.Errorf("unable to get file info for %s", blobpath) + } + file, err := ca.fs.OpenFile(blobpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) + if err != nil { + return fmt.Errorf("unable to open file %s: %w", blobpath, err) + } + if _, err := io.Copy(file, reader); err != nil { + return fmt.Errorf("unable to write blob to file: %w", err) + } + if err := file.Close(); err != nil { + return fmt.Errorf("unable to close file: %w", err) + } + } + + localFsAccess := v2.NewLocalFilesystemBlobAccess(info.Digest, info.MediaType) + unstructuredType, err := v2.NewUnstructured(localFsAccess) + if err != nil { + return fmt.Errorf("unable to convert local filesystem type to untructured type: %w", err) + } + src.Access = &unstructuredType + + if id == -1 { + ca.ComponentDescriptor.Sources = append(ca.ComponentDescriptor.Sources, *src) + } else { + ca.ComponentDescriptor.Sources[id] = *src + } + return nil +} + +// AddResourceFromResolver adds a blob resource to the current archive. +// If the specified resource already exists it will be overwritten. +func (ca *ComponentArchive) AddResourceFromResolver(ctx context.Context, res *v2.Resource, resolver BlobResolver) error { + if res == nil { + return errors.New("a resource has to be defined") + } + id := ca.ComponentDescriptor.GetResourceIndex(*res) + if err := ca.ensureBlobsPath(); err != nil { + return err + } + + info, err := resolver.Info(ctx, *res) + if err != nil { + return fmt.Errorf("unable to get blob info from resolver: %w", err) + } + + blobpath := BlobPath(info.Digest) + if _, err := ca.fs.Stat(blobpath); err != nil { + if !os.IsNotExist(err) { + return fmt.Errorf("unable to get file info for %s", blobpath) + } + file, err := ca.fs.OpenFile(blobpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) + if err != nil { + return fmt.Errorf("unable to open file %s: %w", blobpath, err) + } + if _, err := resolver.Resolve(ctx, *res, file); err != nil { + return fmt.Errorf("unable to write blob to file: %w", err) + } + if err := file.Close(); err != nil { + return fmt.Errorf("unable to close file: %w", err) + } + } + + localFsAccess := v2.NewLocalFilesystemBlobAccess(info.Digest, info.MediaType) + unstructuredType, err := v2.NewUnstructured(localFsAccess) + if err != nil { + return fmt.Errorf("unable to convert local filesystem type to untructured type: %w", err) + } + res.Access = &unstructuredType + + if id == -1 { + ca.ComponentDescriptor.Resources = append(ca.ComponentDescriptor.Resources, *res) + } else { + ca.ComponentDescriptor.Resources[id] = *res + } + return nil +} + +// ensureBlobsPath ensures that the blob directory exists +func (ca *ComponentArchive) ensureBlobsPath() error { + if _, err := ca.fs.Stat(BlobsDirectoryName); err != nil { + if !os.IsNotExist(err) { + return fmt.Errorf("unable to get file info for blob directory: %w", err) + } + return ca.fs.Mkdir(BlobsDirectoryName, os.ModePerm) + } + return nil +} + +// WriteTarGzip tars the current components descriptor and its artifacts. +func (ca *ComponentArchive) WriteTarGzip(writer io.Writer) error { + gw := gzip.NewWriter(writer) + if err := ca.WriteTar(gw); err != nil { + return err + } + return gw.Close() +} + +// WriteTar tars the current components descriptor and its artifacts. +func (ca *ComponentArchive) WriteTar(writer io.Writer) error { + tw := tar.NewWriter(writer) + + // write component descriptor + cdBytes, err := codec.Encode(ca.ComponentDescriptor) + if err != nil { + return fmt.Errorf("unable to encode component descriptor: %w", err) + } + cdHeader := &tar.Header{ + Name: ComponentDescriptorFileName, + Size: int64(len(cdBytes)), + Mode: 0644, + ModTime: time.Now(), + } + + if err := tw.WriteHeader(cdHeader); err != nil { + return fmt.Errorf("unable to write component descriptor header: %w", err) + } + if _, err := io.Copy(tw, bytes.NewBuffer(cdBytes)); err != nil { + return fmt.Errorf("unable to write component descriptor content: %w", err) + } + + // add all blobs + err = tw.WriteHeader(&tar.Header{ + Typeflag: tar.TypeDir, + Name: BlobsDirectoryName, + Mode: 0644, + ModTime: time.Now(), + }) + if err != nil { + return fmt.Errorf("unable to write blob directory: %w", err) + } + + blobs, err := vfs.ReadDir(ca.fs, BlobsDirectoryName) + if err != nil { + if os.IsNotExist(err) { + return nil + } + return fmt.Errorf("unable to read blob directory: %w", err) + } + for _, blobInfo := range blobs { + blobpath := BlobPath(blobInfo.Name()) + header := &tar.Header{ + Name: blobpath, + Size: blobInfo.Size(), + Mode: 0644, + ModTime: time.Now(), + } + if err := tw.WriteHeader(header); err != nil { + return fmt.Errorf("unable to write blob header: %w", err) + } + + blob, err := ca.fs.Open(blobpath) + if err != nil { + return fmt.Errorf("unable to open blob: %w", err) + } + if _, err := io.Copy(tw, blob); err != nil { + return fmt.Errorf("unable to write blob content: %w", err) + } + if err := blob.Close(); err != nil { + return fmt.Errorf("unable to close blob %s: %w", blobpath, err) + } + } + + return tw.Close() +} + +// WriteToFilesystem writes the current component archive to a filesystem +func (ca *ComponentArchive) WriteToFilesystem(fs vfs.FileSystem, path string) error { + // create the directory structure with the blob directory + if err := fs.MkdirAll(filepath.Join(path, BlobsDirectoryName), os.ModePerm); err != nil { + return fmt.Errorf("unable to create output directory %q: %s", path, err.Error()) + } + // copy component-descriptor + cdBytes, err := codec.Encode(ca.ComponentDescriptor) + if err != nil { + return fmt.Errorf("unable to encode component descriptor: %w", err) + } + if err := vfs.WriteFile(fs, filepath.Join(path, ComponentDescriptorFileName), cdBytes, os.ModePerm); err != nil { + return fmt.Errorf("unable to copy component descritptor to %q: %w", filepath.Join(path, ComponentDescriptorFileName), err) + } + + // copy all blobs + blobInfos, err := vfs.ReadDir(ca.fs, BlobsDirectoryName) + if err != nil { + if os.IsNotExist(err) { + return nil + } + return fmt.Errorf("unable to read blobs: %w", err) + } + for _, blobInfo := range blobInfos { + if blobInfo.IsDir() { + continue + } + inpath := BlobPath(blobInfo.Name()) + outpath := filepath.Join(path, BlobsDirectoryName, blobInfo.Name()) + blob, err := ca.fs.Open(inpath) + if err != nil { + return fmt.Errorf("unable to open input blob %q: %w", inpath, err) + } + out, err := fs.OpenFile(outpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) + if err != nil { + return fmt.Errorf("unable to open output blob %q: %w", outpath, err) + } + if _, err := io.Copy(out, blob); err != nil { + return fmt.Errorf("unable to copy blob from %q to %q: %w", inpath, outpath, err) + } + if err := out.Close(); err != nil { + return fmt.Errorf("unable to close output blob %s: %w", outpath, err) + } + if err := blob.Close(); err != nil { + return fmt.Errorf("unable to close input blob %s: %w", outpath, err) + } + } + + return nil +} + +// ComponentArchiveBlobResolver implements the BlobResolver interface for +// "LocalFilesystemBlob" access types. +type ComponentArchiveBlobResolver struct { + fs vfs.FileSystem +} + +// NewComponentArchiveBlobResolver creates new ComponentArchive blob that can resolve local filesystem references. +// The filesystem is expected to have its root at the component archives root +// so that artifacts can be resolve in "/blobs". +func NewComponentArchiveBlobResolver(fs vfs.FileSystem) *ComponentArchiveBlobResolver { + return &ComponentArchiveBlobResolver{ + fs: fs, + } +} + +func (ca *ComponentArchiveBlobResolver) CanResolve(res v2.Resource) bool { + return res.Access != nil && res.Access.GetType() == v2.LocalFilesystemBlobType +} + +func (ca *ComponentArchiveBlobResolver) Info(ctx context.Context, res v2.Resource) (*BlobInfo, error) { + info, file, err := ca.resolve(ctx, res) + if err != nil { + return nil, err + } + if file != nil { + if err := file.Close(); err != nil { + return nil, err + } + } + return info, nil +} + +// Resolve fetches the blob for a given resource and writes it to the given tar. +func (ca *ComponentArchiveBlobResolver) Resolve(ctx context.Context, res v2.Resource, writer io.Writer) (*BlobInfo, error) { + info, file, err := ca.resolve(ctx, res) + if err != nil { + return nil, err + } + if _, err := io.Copy(writer, file); err != nil { + return nil, err + } + if err := file.Close(); err != nil { + return nil, err + } + return info, nil +} + +func (ca *ComponentArchiveBlobResolver) resolve(_ context.Context, res v2.Resource) (*BlobInfo, vfs.File, error) { + if res.Access == nil || res.Access.GetType() != v2.LocalFilesystemBlobType { + return nil, nil, UnsupportedResolveType + } + localFSAccess := &v2.LocalFilesystemBlobAccess{} + if err := res.Access.DecodeInto(localFSAccess); err != nil { + return nil, nil, fmt.Errorf("unable to decode access to type '%s': %w", res.Access.GetType(), err) + } + blobpath := BlobPath(localFSAccess.Filename) + mediaType := res.GetType() + if len(localFSAccess.MediaType) != 0 { + mediaType = localFSAccess.MediaType + } + + info, err := ca.fs.Stat(blobpath) + if err != nil { + return nil, nil, fmt.Errorf("unable to get fileinfo for %s: %w", blobpath, err) + } + if info.IsDir() { + return nil, nil, fmt.Errorf("directories are not allowed as blobs %s", blobpath) + } + file, err := ca.fs.Open(blobpath) + if err != nil { + return nil, nil, fmt.Errorf("unable to open blob from %s", blobpath) + } + + dig, err := digest.FromReader(file) + if err != nil { + return nil, nil, fmt.Errorf("unable to generate dig from %s: %w", localFSAccess.Filename, err) + } + if _, err := file.Seek(0, io.SeekStart); err != nil { + return nil, nil, fmt.Errorf("unable to reset file reader: %w", err) + } + return &BlobInfo{ + MediaType: mediaType, + Digest: dig.String(), + Size: info.Size(), + }, file, nil +} + +// BlobPath returns the path to the blob for a given name. +func BlobPath(name string) string { + return filepath.Join(BlobsDirectoryName, name) +} + +// ExtractTarToFs writes a tar stream to a filesystem. +func ExtractTarToFs(fs vfs.FileSystem, in io.Reader) error { + tr := tar.NewReader(in) + for { + header, err := tr.Next() + if err != nil { + if err == io.EOF { + return nil + } + return err + } + + switch header.Typeflag { + case tar.TypeDir: + if err := fs.MkdirAll(header.Name, os.FileMode(header.Mode)); err != nil { + return fmt.Errorf("unable to create directory %s: %w", header.Name, err) + } + case tar.TypeReg: + file, err := fs.OpenFile(header.Name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode)) + if err != nil { + return fmt.Errorf("unable to open file %s: %w", header.Name, err) + } + if _, err := io.Copy(file, tr); err != nil { + return fmt.Errorf("unable to copy tar file to filesystem: %w", err) + } + if err := file.Close(); err != nil { + return fmt.Errorf("unable to close file %s: %w", header.Name, err) + } + } + } +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/ctf.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/ctf.go new file mode 100644 index 000000000..9c6ffe638 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/ctf.go @@ -0,0 +1,322 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 ctf + +import ( + "archive/tar" + "context" + "errors" + "fmt" + "io" + "os" + + "github.com/mandelsoft/vfs/pkg/projectionfs" + "github.com/mandelsoft/vfs/pkg/vfs" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" +) + +// ComponentDescriptorFileName is the name of the component-descriptor file. +const ComponentDescriptorFileName = "component-descriptor.yaml" + +// ArtefactDescriptorFileName is the name of the artefact-descriptor file. +const ArtefactDescriptorFileName = "artefact-descriptor.yaml" + +// ManifestFileName is the name of the manifest json file. +const ManifestFileName = "manifest.json" + +// BlobsDirectoryName is the name of the blob directory in the tar. +const BlobsDirectoryName = "blobs" + +var UnsupportedResolveType = errors.New("UnsupportedResolveType") + +var NotFoundError = errors.New("ComponentDescriptorNotFound") + +var BlobResolverNotDefinedError = errors.New("BlobResolverNotDefined") + +// ComponentResolver describes a general interface to resolve a component descriptor +type ComponentResolver interface { + Resolve(ctx context.Context, repoCtx v2.Repository, name, version string) (*v2.ComponentDescriptor, error) + ResolveWithBlobResolver(ctx context.Context, repoCtx v2.Repository, name, version string) (*v2.ComponentDescriptor, BlobResolver, error) +} + +// BlobResolver defines a resolver that can fetch +// blobs in a specific context defined in a component descriptor. +type BlobResolver interface { + Info(ctx context.Context, res v2.Resource) (*BlobInfo, error) + Resolve(ctx context.Context, res v2.Resource, writer io.Writer) (*BlobInfo, error) +} + +// TypedBlobResolver defines a blob resolver +// that is able to resolves a set of access types. +type TypedBlobResolver interface { + BlobResolver + // CanResolve returns whether the resolver is able to resolve the + // resource. + CanResolve(resource v2.Resource) bool +} + +// BlobInfo describes a blob. +type BlobInfo struct { + // MediaType is the media type of the object this schema refers to. + MediaType string `json:"mediaType,omitempty"` + + // Digest is the digest of the targeted content. + Digest string `json:"digest"` + + // Size specifies the size in bytes of the blob. + Size int64 `json:"size"` +} + +// ArchiveFormat describes the format of a component archive. +// A archive can currently be defined in a filesystem, as tar or as gzipped tar. +type ArchiveFormat string + +const ( + ArchiveFormatFilesystem ArchiveFormat = "fs" + ArchiveFormatTar ArchiveFormat = "tar" + ArchiveFormatTarGzip ArchiveFormat = "tgz" +) + +type CTF struct { + fs vfs.FileSystem + ctfPath string + tempDir string + tempFs vfs.FileSystem +} + +// NewCTF reads a CTF archive from a file. +// The use should call "Close" to remove all temporary files +func NewCTF(fs vfs.FileSystem, ctfPath string) (*CTF, error) { + tempDir, err := vfs.TempDir(fs, "", "ctf-") + if err != nil { + return nil, err + } + tempFs, err := projectionfs.New(fs, tempDir) + if err != nil { + return nil, fmt.Errorf("unable to create fs for temporary directory %q: %w", tempDir, err) + } + + ctf := &CTF{ + fs: fs, + ctfPath: ctfPath, + tempDir: tempDir, + tempFs: tempFs, + } + if err := ctf.extract(); err != nil { + return nil, fmt.Errorf("unable to read ctf: %w", err) + } + return ctf, nil +} + +type WalkFunc = func(ca *ComponentArchive) error + +// Walk traverses through all component archives that are included in the ctf. +func (ctf *CTF) Walk(walkFunc WalkFunc) error { + err := vfs.Walk(ctf.tempFs, "/", func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + + file, err := ctf.tempFs.Open(path) + if err != nil { + return fmt.Errorf("unable to read component archive file %q: %w", path, err) + } + ca, err := NewComponentArchiveFromTarReader(file) + if err != nil { + return err + } + + return walkFunc(ca) + }) + return err +} + +// AddComponentArchive adds or updates a component archive in the ctf archive. +func (ctf *CTF) AddComponentArchive(ca *ComponentArchive, format ArchiveFormat) error { + filename, err := ca.Digest() + if err != nil { + return err + } + return ctf.AddComponentArchiveWithName(filename, ca, format) +} + +// AddComponentArchiveWithName adds or updates a component archive in the ctf archive. +// The archive is added to the ctf with the given name +func (ctf *CTF) AddComponentArchiveWithName(filename string, ca *ComponentArchive, format ArchiveFormat) error { + file, err := ctf.tempFs.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) + if err != nil { + return err + } + switch format { + case ArchiveFormatTar: + if err := ca.WriteTar(file); err != nil { + _ = file.Close() + return fmt.Errorf("unable to write component archive to %q: %w", filename, err) + } + case ArchiveFormatTarGzip: + if err := ca.WriteTarGzip(file); err != nil { + _ = file.Close() + return fmt.Errorf("unable to write component archive to %q: %w", filename, err) + } + default: + return fmt.Errorf("unsupported archive format %q", format) + } + + return file.Close() +} + +// extract untars the given ctf archive to the tmp directory. +func (ctf *CTF) extract() error { + file, err := ctf.fs.Open(ctf.ctfPath) + if err != nil { + return err + } + defer file.Close() + return ExtractTarToFs(ctf.tempFs, file) +} + +// Write writes the current changes back to the original ctf. +func (ctf *CTF) Write() error { + file, err := ctf.fs.OpenFile(ctf.ctfPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) + if err != nil { + return err + } + defer file.Close() + tw := tar.NewWriter(file) + defer tw.Close() + + err = vfs.Walk(ctf.tempFs, "/", func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + header, err := tar.FileInfoHeader(info, "") + if err != nil { + return err + } + if err := tw.WriteHeader(header); err != nil { + return fmt.Errorf("unable to write header for %q: %w", path, err) + } + + blob, err := ctf.tempFs.Open(path) + if err != nil { + return fmt.Errorf("unable to open blob %q: %w", path, err) + } + defer blob.Close() + if _, err := io.Copy(tw, blob); err != nil { + return fmt.Errorf("unable to write blob %q: %w", path, err) + } + return nil + }) + return err +} + +// Close closes the CTF that deletes all temporary files +func (ctf *CTF) Close() error { + return ctf.fs.RemoveAll(ctf.tempDir) +} + +// AggregatedBlobResolver combines multiple blob resolver. +// Is automatically picks the right resolver based on the resolvers type information. +// If multiple resolvers match, the first matching resolver is used. +type AggregatedBlobResolver struct { + resolver []TypedBlobResolver +} + +var _ BlobResolver = &AggregatedBlobResolver{} + +// NewAggregatedBlobResolver creates a new aggregated resolver. +// Note that only typed resolvers can be added. +// An error is thrown if a resolver does not implement the supported types. +func NewAggregatedBlobResolver(resolvers ...BlobResolver) (*AggregatedBlobResolver, error) { + agg := &AggregatedBlobResolver{ + resolver: make([]TypedBlobResolver, 0), + } + if err := agg.Add(resolvers...); err != nil { + return nil, err + } + return agg, nil +} + +// Add adds multiple resolvers to the aggregator. +// Only typed resolvers can be added. +// An error is thrown if a resolver does not implement the supported types function. +func (a *AggregatedBlobResolver) Add(resolvers ...BlobResolver) error { + for i, resolver := range resolvers { + typedResolver, ok := resolver.(TypedBlobResolver) + if !ok { + return fmt.Errorf("resolver %d does not implement supported types interface", i) + } + a.resolver = append(a.resolver, typedResolver) + } + return nil +} + +func (a *AggregatedBlobResolver) Info(ctx context.Context, res v2.Resource) (*BlobInfo, error) { + resolver, err := a.getResolver(res) + if err != nil { + return nil, err + } + return resolver.Info(ctx, res) +} + +func (a *AggregatedBlobResolver) Resolve(ctx context.Context, res v2.Resource, writer io.Writer) (*BlobInfo, error) { + resolver, err := a.getResolver(res) + if err != nil { + return nil, err + } + return resolver.Resolve(ctx, res, writer) +} + +func (a *AggregatedBlobResolver) getResolver(res v2.Resource) (BlobResolver, error) { + if res.Access == nil { + return nil, fmt.Errorf("no access is defined") + } + + for _, resolver := range a.resolver { + if resolver.CanResolve(res) { + return resolver, nil + } + } + return nil, UnsupportedResolveType +} + +// AggregateBlobResolvers aggregates two resolvers to one by using aggregated blob resolver. +func AggregateBlobResolvers(a, b BlobResolver) (BlobResolver, error) { + aggregated, ok := a.(*AggregatedBlobResolver) + if ok { + if err := aggregated.Add(b); err != nil { + return nil, fmt.Errorf("unable to add second resolver to aggreagted first resolver: %w", err) + } + return aggregated, nil + } + + aggregated, ok = b.(*AggregatedBlobResolver) + if ok { + if err := aggregated.Add(a); err != nil { + return nil, fmt.Errorf("unable to add first resolver to aggreagted second resolver: %w", err) + } + return aggregated, nil + } + + // create a new aggregated resolver if neither a nor b are aggregations + return NewAggregatedBlobResolver(a, b) +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/listresolver.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/listresolver.go new file mode 100644 index 000000000..dd130fc75 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/ctf/listresolver.go @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package ctf + +import ( + "context" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" +) + +// ListResolver describes a ComponentResolver using a list of Component Descriptors +type ListResolver struct { + List *cdv2.ComponentDescriptorList + blobResolver *AggregatedBlobResolver +} + +// NewListResolver creates a new list resolver. +func NewListResolver(list *cdv2.ComponentDescriptorList, resolvers ...BlobResolver) (*ListResolver, error) { + lr := &ListResolver{ + List: list, + } + if len(resolvers) != 0 { + blobResolver, err := NewAggregatedBlobResolver(resolvers...) + if err != nil { + return nil, err + } + lr.blobResolver = blobResolver + } + return lr, nil +} + +var _ ComponentResolver = &ListResolver{} + +func (l ListResolver) Resolve(_ context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, error) { + for _, comp := range l.List.Components { + if !cdv2.TypedObjectEqual(repoCtx, comp.GetEffectiveRepositoryContext()) { + continue + } + if comp.Name == name && comp.Version == version { + return comp.DeepCopy(), nil + } + } + + return nil, NotFoundError +} + +func (l ListResolver) ResolveWithBlobResolver(ctx context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, BlobResolver, error) { + cd, err := l.Resolve(ctx, repoCtx, name, version) + if err != nil { + return nil, nil, err + } + if l.blobResolver == nil { + return nil, nil, BlobResolverNotDefinedError + } + return cd, l.blobResolver, err +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/constants.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/constants.go new file mode 100644 index 000000000..f647c51f5 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/constants.go @@ -0,0 +1,42 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 oci + +// ComponentDescriptorTarMimeType is the old mimetype for component-descriptor-blobs +// that are stored as tar. +const ComponentDescriptorTarMimeType = "application/vnd.gardener.cloud.cnudie.component-descriptor.v2+yaml+tar" + +// LegacyComponentDescriptorTarMimeType is the legacy mimetype for component-descriptor-blobs +// that are stored as tar. +const LegacyComponentDescriptorTarMimeType = "application/vnd.oci.gardener.cloud.cnudie.component-descriptor.config.v2+yaml+tar" + +// ComponentDescriptorJSONMimeType is the mimetype for component-descriptor-blobs +// that are stored as JSON. +const ComponentDescriptorJSONMimeType = "application/vnd.gardener.cloud.cnudie.component-descriptor.v2+json" + +// ComponentDescriptorNamespace is the subpath for all component descriptor artifacts in an oci registry.‚ +const ComponentDescriptorNamespace = "component-descriptors" + +// ComponentDescriptorMimeType are the mimetypes for component-descriptor-blobs. +var ComponentDescriptorMimeType = []string{ + ComponentDescriptorTarMimeType, + ComponentDescriptorJSONMimeType, +} + +// ComponentDescriptorConfigMimeType is the mimetype for component-descriptor-oci-cfg-blobs. +const ComponentDescriptorConfigMimeType = "application/vnd.gardener.cloud.cnudie.component.config.v1+json" + +// ComponentDescriptorLegacyConfigMimeType is the mimetype for the legacy component-descriptor-oci-cfg-blobs +const ComponentDescriptorLegacyConfigMimeType = "application/vnd.oci.gardener.cloud.cnudie.component-descriptor-metadata.config.v2+json" diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/manifest.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/manifest.go new file mode 100644 index 000000000..f04cc44ab --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/manifest.go @@ -0,0 +1,191 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 oci + +import ( + "archive/tar" + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "time" + + "github.com/opencontainers/go-digest" + imagespec "github.com/opencontainers/image-spec/specs-go" + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/codec" + "github.com/gardener/component-spec/bindings-go/ctf" +) + +// BlobStore defines a interface that is used to store oci descriptors. +type BlobStore interface { + Add(desc ocispecv1.Descriptor, reader io.ReadCloser) error +} + +// ManifestBuilder converts a component descriptor with local defined blobs +// into a oci component descriptor with blobs as layers of the component descriptor. +type ManifestBuilder struct { + store BlobStore + archive *ctf.ComponentArchive + componentDescriptorStorageType string +} + +// NewManifestBuilder creates a new oci manifest builder for a component descriptor +func NewManifestBuilder(store BlobStore, archive *ctf.ComponentArchive) *ManifestBuilder { + return &ManifestBuilder{ + store: store, + archive: archive, + } +} + +func (b *ManifestBuilder) StorageType(storageType string) *ManifestBuilder { + b.componentDescriptorStorageType = storageType + return b +} + +// Build creates a ocispec Manifest from a component descriptor. +func (b *ManifestBuilder) Build(ctx context.Context) (*ocispecv1.Manifest, error) { + // default storage type + if len(b.componentDescriptorStorageType) == 0 { + b.componentDescriptorStorageType = ComponentDescriptorTarMimeType + } + + // get additional local artifacts + additionalBlobDescs, err := b.addLocalBlobs(ctx) + if err != nil { + return nil, err + } + + componentDescriptorDesc, err := b.addComponentDescriptorDesc() + if err != nil { + return nil, err + } + + componentDescriptorLayerOCIRef := ConvertDescriptorToOCIBlobRef(componentDescriptorDesc) + componentConfig := ComponentDescriptorConfig{ + ComponentDescriptorLayer: &componentDescriptorLayerOCIRef, + } + + componentConfigBytes, err := json.Marshal(componentConfig) + if err != nil { + return nil, fmt.Errorf("unable to marshal component config: %w", err) + } + + componentConfigDesc := ocispecv1.Descriptor{ + MediaType: ComponentDescriptorConfigMimeType, + Digest: digest.FromBytes(componentConfigBytes), + Size: int64(len(componentConfigBytes)), + } + if err := b.store.Add(componentConfigDesc, ioutil.NopCloser(bytes.NewBuffer(componentConfigBytes))); err != nil { + return nil, fmt.Errorf("unable to add component config layer to internal store: %w", err) + } + + manifest := &ocispecv1.Manifest{ + Versioned: imagespec.Versioned{SchemaVersion: 2}, + Config: componentConfigDesc, + Layers: append([]ocispecv1.Descriptor{componentDescriptorDesc}, additionalBlobDescs...), + } + + return manifest, nil +} + +// todo: add support for old tar based components +func (b *ManifestBuilder) addComponentDescriptorDesc() (ocispecv1.Descriptor, error) { + data, err := codec.Encode(b.archive.ComponentDescriptor) + if err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to encode component descriptor: %w", err) + } + + if b.componentDescriptorStorageType == ComponentDescriptorJSONMimeType { + componentDescriptorDesc := ocispecv1.Descriptor{ + MediaType: ComponentDescriptorJSONMimeType, + Digest: digest.FromBytes(data), + Size: int64(len(data)), + } + if err := b.store.Add(componentDescriptorDesc, ioutil.NopCloser(bytes.NewBuffer(data))); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to add component descriptor layer to internal store: %w", err) + } + return componentDescriptorDesc, nil + } else if b.componentDescriptorStorageType == ComponentDescriptorTarMimeType { + // create tar with component descriptor + var buf bytes.Buffer + tw := tar.NewWriter(&buf) + if err := tw.WriteHeader(&tar.Header{ + Typeflag: tar.TypeReg, + Name: ctf.ComponentDescriptorFileName, + Size: int64(len(data)), + ModTime: time.Now(), + }); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to add component descriptor header: %w", err) + } + if _, err := io.Copy(tw, bytes.NewBuffer(data)); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to write component-descriptor to tar: %w", err) + } + if err := tw.Close(); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to close tar writer: %w", err) + } + + componentDescriptorDesc := ocispecv1.Descriptor{ + MediaType: ComponentDescriptorTarMimeType, + Digest: digest.FromBytes(buf.Bytes()), + Size: int64(buf.Len()), + } + if err := b.store.Add(componentDescriptorDesc, ioutil.NopCloser(&buf)); err != nil { + return ocispecv1.Descriptor{}, fmt.Errorf("unable to add component descriptor layer to internal store: %w", err) + } + return componentDescriptorDesc, nil + } + + return ocispecv1.Descriptor{}, fmt.Errorf("unsupported storage type %q", b.componentDescriptorStorageType) +} + +// addLocalBlobs adds all local resources to the blob store and updates the component descriptors access method. +func (b *ManifestBuilder) addLocalBlobs(ctx context.Context) ([]ocispecv1.Descriptor, error) { + blobDescriptors := make([]ocispecv1.Descriptor, 0) + + for i, res := range b.archive.ComponentDescriptor.Resources { + var blob bytes.Buffer + info, err := b.archive.Resolve(ctx, res, &blob) + if err != nil { + if err == ctf.UnsupportedResolveType { + continue + } + return nil, fmt.Errorf("unable to get blob for resource %s: %w", res.GetName(), err) + } + + desc := ocispecv1.Descriptor{ + MediaType: info.MediaType, + Digest: digest.Digest(info.Digest), + Size: info.Size, + } + if err := b.store.Add(desc, ioutil.NopCloser(&blob)); err != nil { + return nil, fmt.Errorf("unable to store blob: %w", err) + } + + ociBlobAccess := v2.NewLocalOCIBlobAccess(desc.Digest.String()) + unstructuredType, err := v2.NewUnstructured(ociBlobAccess) + if err != nil { + return nil, fmt.Errorf("unable to convert ociBlob to untructured type: %w", err) + } + res.Access = &unstructuredType + b.archive.ComponentDescriptor.Resources[i] = res + blobDescriptors = append(blobDescriptors, desc) + } + return blobDescriptors, nil +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/resolve.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/resolve.go new file mode 100644 index 000000000..d518e2dfc --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/resolve.go @@ -0,0 +1,394 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 oci + +import ( + "archive/tar" + "bytes" + "context" + "crypto/sha256" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "io" + "net/url" + "path" + "strings" + + "github.com/mandelsoft/vfs/pkg/memoryfs" + "github.com/opencontainers/go-digest" + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/codec" + "github.com/gardener/component-spec/bindings-go/ctf" + "github.com/go-logr/logr" +) + +// Client defines a readonly oci artifact client to fetch manifests and blobs. +type Client interface { + // GetManifest returns the ocispec Manifest for a reference + GetManifest(ctx context.Context, ref string) (*ocispecv1.Manifest, error) + + // Fetch fetches the blob for the given ocispec Descriptor. + Fetch(ctx context.Context, ref string, desc ocispecv1.Descriptor, writer io.Writer) error +} + +// OCIRef generates the oci reference from the repository context and a component name and version. +func OCIRef(repoCtx v2.OCIRegistryRepository, name, version string) (string, error) { + baseUrl := repoCtx.BaseURL + if !strings.Contains(baseUrl, "://") { + // add dummy protocol to correctly parse the the url + baseUrl = "http://" + baseUrl + } + u, err := url.Parse(baseUrl) + if err != nil { + return "", err + } + + switch repoCtx.ComponentNameMapping { + case v2.OCIRegistryURLPathMapping, "": + ref := path.Join(u.Host, u.Path, ComponentDescriptorNamespace, name) + return fmt.Sprintf("%s:%s", ref, version), nil + case v2.OCIRegistryDigestMapping: + h := sha256.New() + _, _ = h.Write([]byte(name)) + ref := path.Join(u.Host, u.Path, hex.EncodeToString(h.Sum(nil))) + return fmt.Sprintf("%s:%s", ref, version), nil + default: + return "", fmt.Errorf("unknown component name mapping method %s", repoCtx.ComponentNameMapping) + } +} + +// ItemNotCached defines an error that defines that an item was not cached. +var ItemNotCached = errors.New("ITEM_NOT_CACHED") + +// Cache describes a interface to cache component descriptors. +// The cache expects that a component descriptor identified by repoCtx, name and version is immutable. +// Currently only the raw component descriptor can be cached. +// The blob resolver might be added in the future. +type Cache interface { + // Get reads a component descriptor from the cache. + // Use the ItemNotCached error to identicate that an error does not have occurred. + Get(ctx context.Context, repoCtx v2.OCIRegistryRepository, name, version string) (*v2.ComponentDescriptor, error) + // Store stores a component descriptor in the cache. + Store(ctx context.Context, descriptor *v2.ComponentDescriptor) error +} + +// Resolver is a generic resolve to resolve a component descriptor from a oci registry. +// This resolver implements the ctf.ComponentResolver interface. +type Resolver struct { + log logr.Logger + client Client + cache Cache + decodeOpts []codec.DecodeOption +} + +// NewResolver creates a new resolver. +func NewResolver(client Client, decodeOpts ...codec.DecodeOption) *Resolver { + return &Resolver{ + log: logr.Discard(), + client: client, + decodeOpts: decodeOpts, + } +} + +// WithCache sets the oci client context of the resolver +func (r *Resolver) WithCache(cache Cache) *Resolver { + r.cache = cache + return r +} + +// WithLog sets the logger for the resolver. +func (r *Resolver) WithLog(log logr.Logger) *Resolver { + r.log = log.WithName("componentResolver") + return r +} + +// Resolve resolves a component descriptor by name and version within the configured context. +func (r *Resolver) Resolve(ctx context.Context, repoCtx v2.Repository, name, version string) (*v2.ComponentDescriptor, error) { + cd, _, err := r.resolve(ctx, repoCtx, name, version, false) + return cd, err +} + +// ResolveWithBlobResolver resolves a component descriptor by name and version within the configured context. +// And it also returns a blob resolver to access the local artifacts. +func (r *Resolver) ResolveWithBlobResolver(ctx context.Context, repoCtx v2.Repository, name, version string) (*v2.ComponentDescriptor, ctf.BlobResolver, error) { + return r.resolve(ctx, repoCtx, name, version, true) +} + +// resolve resolves a component descriptor by name and version within the configured context. +// If withBlobResolver is false the returned blobresolver is always nil +func (r *Resolver) resolve(ctx context.Context, repoCtx v2.Repository, name, version string, withBlobResolver bool) (*v2.ComponentDescriptor, ctf.BlobResolver, error) { + var repo v2.OCIRegistryRepository + switch r := repoCtx.(type) { + case *v2.UnstructuredTypedObject: + if err := r.DecodeInto(&repo); err != nil { + return nil, nil, err + } + case *v2.OCIRegistryRepository: + repo = *r + default: + return nil, nil, fmt.Errorf("unknown repository context type %s", repoCtx.GetType()) + } + + // setup logger + log := logr.FromContext(ctx) + if log == nil { + log = r.log + } + log = log.WithValues("repoCtxType", repoCtx.GetType(), "baseUrl", repo.BaseURL, "name", name, "version", version) + + if r.cache != nil { + cd, err := r.cache.Get(ctx, repo, name, version) + if err != nil { + if errors.Is(err, ctf.NotFoundError) { + log.V(5).Info(err.Error()) + } else { + log.Error(err, "unable to get component descriptor") + } + } else { + if withBlobResolver { + manifest, ref , err := r.fetchManifest(ctx, repo, name, version) + if err != nil { + return nil, nil, err + } + return cd, NewBlobResolver(r.client, ref, manifest, cd), nil + } + return cd, nil, nil + } + } + + manifest, ref , err := r.fetchManifest(ctx, repo, name, version) + if err != nil { + return nil, nil, err + } + + componentConfig, err := r.getComponentConfig(ctx, ref, manifest) + if err != nil { + return nil, nil, err + } + + componentDescriptorLayer := GetLayerWithDigest(manifest.Layers, componentConfig.ComponentDescriptorLayer.Digest) + if componentDescriptorLayer == nil { + return nil, nil, fmt.Errorf("no component descriptor layer defined") + } + + var componentDescriptorLayerBytes bytes.Buffer + if err := r.client.Fetch(ctx, ref, *componentDescriptorLayer, &componentDescriptorLayerBytes); err != nil { + return nil, nil, fmt.Errorf("unable to fetch component descriptor layer: %w", err) + } + + componentDescriptorBytes := componentDescriptorLayerBytes.Bytes() + switch componentDescriptorLayer.MediaType { + case ComponentDescriptorTarMimeType, LegacyComponentDescriptorTarMimeType: + componentDescriptorBytes, err = ReadComponentDescriptorFromTar(&componentDescriptorLayerBytes) + if err != nil { + return nil, nil, fmt.Errorf("unable to read component descriptor from tar: %w", err) + } + case ComponentDescriptorJSONMimeType: + default: + return nil, nil, fmt.Errorf("unsupported media type %q", componentDescriptorLayer.MediaType) + } + + cd := &v2.ComponentDescriptor{} + if err := codec.Decode(componentDescriptorBytes, cd, r.decodeOpts...); err != nil { + return nil, nil, fmt.Errorf("unable to decode component descriptor: %w", err) + } + if err := v2.InjectRepositoryContext(cd, &repo); err != nil { + return nil, nil, err + } + + if r.cache != nil { + if err := r.cache.Store(ctx, cd.DeepCopy()); err != nil { + log.Error(err, "unable to store component descriptor") + } + } + + if withBlobResolver { + return cd, NewBlobResolver(r.client, ref, manifest, cd), nil + } + return cd, nil, nil +} + +// fetchManifest fetches the oci manifest. +// The manifest and the oci ref is returned. +func (r *Resolver) fetchManifest(ctx context.Context, repoCtx v2.OCIRegistryRepository, name, version string) (*ocispecv1.Manifest, string, error) { + if repoCtx.Type != v2.OCIRegistryType { + return nil, "", fmt.Errorf("unsupported type %s expected %s", repoCtx.Type, v2.OCIRegistryType) + } + ref, err := OCIRef(repoCtx, name, version) + if err != nil { + return nil, "", fmt.Errorf("unable to generate oci reference: %w", err) + } + + manifest, err := r.client.GetManifest(ctx, ref) + if err != nil { + return nil, "", fmt.Errorf("unable to fetch manifest from ref %s: %w", ref, err) + } + return manifest, ref, nil +} + +// ToComponentArchive creates a tar archive in the CTF (Cnudie Transport Format) from the given component descriptor. +func (r *Resolver) ToComponentArchive(ctx context.Context, repoCtx v2.Repository, name, version string, writer io.Writer) error { + cd, blobresolver, err := r.ResolveWithBlobResolver(ctx, repoCtx, name, version) + if err != nil { + return err + } + + ca := ctf.NewComponentArchive(cd, memoryfs.New()) + for _, res := range cd.Resources { + if err := ca.AddResourceFromResolver(ctx, &res, blobresolver); err != nil { + return fmt.Errorf("unable to add resource %s to archive: %w", res.GetName(), err) + } + } + return ca.WriteTar(writer) +} + +func (r *Resolver) getComponentConfig(ctx context.Context, ref string, manifest *ocispecv1.Manifest) (*ComponentDescriptorConfig, error) { + if manifest.Config.MediaType != ComponentDescriptorConfigMimeType && + manifest.Config.MediaType != ComponentDescriptorLegacyConfigMimeType { + return nil, fmt.Errorf("unknown component config type '%s' expected '%s'", manifest.Config.MediaType, ComponentDescriptorConfigMimeType) + } + + var data bytes.Buffer + if err := r.client.Fetch(ctx, ref, manifest.Config, &data); err != nil { + return nil, fmt.Errorf("unable to resolve component config: %w", err) + } + + componentConfig := &ComponentDescriptorConfig{} + if err := json.Unmarshal(data.Bytes(), componentConfig); err != nil { + return nil, fmt.Errorf("unable to decode manifest config into component config: %w", err) + } + + return componentConfig, nil +} + +// blobResolver implements the BlobResolver interface +// and is returned when a component descriptor is resolved. +type blobResolver struct { + client Client + ref string + manifest *ocispecv1.Manifest + cd *v2.ComponentDescriptor +} + +// NewBlobResolver creates a new resolver for oci and local oci blobs. +func NewBlobResolver(client Client, ref string, manifest *ocispecv1.Manifest, cd *v2.ComponentDescriptor) ctf.BlobResolver { + return &blobResolver{ + client: client, + ref: ref, + manifest: manifest, + cd: cd, + } +} + +func (b *blobResolver) CanResolve(res v2.Resource) bool { + return res.Access != nil && res.Access.GetType() == v2.LocalOCIBlobType || res.Access.GetType() == v2.OCIBlobType +} + +func (b *blobResolver) Info(ctx context.Context, res v2.Resource) (*ctf.BlobInfo, error) { + return b.resolve(ctx, res, nil) +} + +func (b *blobResolver) Resolve(ctx context.Context, res v2.Resource, writer io.Writer) (*ctf.BlobInfo, error) { + return b.resolve(ctx, res, writer) +} + +func (b *blobResolver) resolve(ctx context.Context, res v2.Resource, writer io.Writer) (*ctf.BlobInfo, error) { + switch res.Access.GetType() { + case v2.LocalOCIBlobType: + localOCIAccess := &v2.LocalOCIBlobAccess{} + if err := res.Access.DecodeInto(localOCIAccess); err != nil { + return nil, err + } + + blobLayer := GetLayerWithDigest(b.manifest.Layers, localOCIAccess.Digest) + if blobLayer == nil { + return nil, fmt.Errorf("oci blob layer with digest %s not found in component descriptor manifest", localOCIAccess.Digest) + } + + if writer != nil { + if err := b.client.Fetch(ctx, b.ref, *blobLayer, writer); err != nil { + return nil, err + } + } + + return &ctf.BlobInfo{ + MediaType: blobLayer.MediaType, + Digest: localOCIAccess.Digest, + Size: blobLayer.Size, + }, nil + case v2.OCIBlobType: + ociBlobAccess := &v2.OCIBlobAccess{} + if err := res.Access.DecodeInto(ociBlobAccess); err != nil { + return nil, err + } + + if writer != nil { + if err := b.client.Fetch(ctx, b.ref, ocispecv1.Descriptor{ + MediaType: ociBlobAccess.MediaType, + Digest: digest.Digest(ociBlobAccess.Digest), + Size: ociBlobAccess.Size, + }, writer); err != nil { + return nil, err + } + } + return &ctf.BlobInfo{ + MediaType: ociBlobAccess.MediaType, + Digest: ociBlobAccess.Digest, + Size: ociBlobAccess.Size, + }, nil + default: + return nil, fmt.Errorf("unable to resolve access of type %s", res.Access.GetType()) + } +} + +// GetLayerWithDigest returns the layer that matches the given digest. +// It returns nil if no layer matches the digest. +func GetLayerWithDigest(layers []ocispecv1.Descriptor, digest string) *ocispecv1.Descriptor { + for _, layer := range layers { + if layer.Digest.String() == digest { + return &layer + } + } + return nil +} + +// ReadComponentDescriptorFromTar reads the component descriptor from a tar. +// The component is expected to be inside the tar at "/component-descriptor.yaml" +func ReadComponentDescriptorFromTar(r io.Reader) ([]byte, error) { + tr := tar.NewReader(r) + for { + header, err := tr.Next() + if err != nil { + if err == io.EOF { + return nil, errors.New("no component descriptor found in tar") + } + return nil, fmt.Errorf("unable to read tar: %w", err) + } + + if strings.TrimLeft(header.Name, "/") != ctf.ComponentDescriptorFileName { + continue + } + + var data bytes.Buffer + if _, err := io.Copy(&data, tr); err != nil { + return nil, fmt.Errorf("erro while reading component descriptor file from tar: %w", err) + } + return data.Bytes(), err + } +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/types.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/types.go new file mode 100644 index 000000000..9144ea527 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/oci/types.go @@ -0,0 +1,44 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 oci + +import ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" + +// OciBlobRef is a single OCI registry layer reference as used in OCI Image Manifests. +type OciBlobRef struct { + // MediaType is the media type of the object this schema refers to. + MediaType string `json:"mediaType,omitempty"` + + // Digest is the digest of the targeted content. + Digest string `json:"digest"` + + // Size specifies the size in bytes of the blob. + Size int64 `json:"size"` +} + +// ConvertDescriptorToOCIBlobRef converts a ocispec descriptor to a component descriptor oci blob ref. +func ConvertDescriptorToOCIBlobRef(desc ocispecv1.Descriptor) OciBlobRef { + return OciBlobRef{ + MediaType: desc.MediaType, + Digest: desc.Digest.String(), + Size: desc.Size, + } +} + +// ComponentDescriptorConfig is a Component-Descriptor OCI configuration that is used to store the reference to the +// (pseudo-)layer used to store the Component-Descriptor in. +type ComponentDescriptorConfig struct { + ComponentDescriptorLayer *OciBlobRef `json:"componentDescriptorLayer,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/component-spec/bindings-go/utils/selector/selector.go b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/utils/selector/selector.go new file mode 100644 index 000000000..93f104eb4 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/component-spec/bindings-go/utils/selector/selector.go @@ -0,0 +1,239 @@ +// Copyright 2020 Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. +// +// 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 selector + +import ( + "encoding/json" + "fmt" + "regexp" + + "github.com/ghodss/yaml" + "github.com/xeipuuv/gojsonschema" +) + +// Interface defines a selector interface that +// matches a map of string to string. +type Interface interface { + Match(obj map[string]string) (bool, error) +} + +// SelectorFunc describes a function that can be used as selector interface. +type SelectorFunc func(obj map[string]string) (bool, error) + +func (s SelectorFunc) Match(obj map[string]string) (bool, error) { + return s(obj) +} + +// MatchSelectors checks whether all selectors matches the given obj. +func MatchSelectors(obj map[string]string, selectors ...Interface) (bool, error) { + for _, sel := range selectors { + ok, err:= sel.Match(obj) + if err != nil { + return false, err + } + if !ok { + return false, nil + } + } + return true, nil +} + +// DefaultSelector defines the selector for the identity of an object. +// The default selector is a map of identity key to selector +// All keys are validated against the given selector. +// +// Valid selectors are +// - raw string value: identity value is compared to the selector value +// - array of strings: or-operator identity value must be one of the defined strings in the array +type DefaultSelector map[string]interface{} + +var _ Interface = DefaultSelector{} + +// ParseDefaultSelector creates a Identity selector from a +// - json encoded selector +// - map[string]Selector +// +// A selector can be +// - a string: the value is directly matched +// - a array of strings: one selector in the array must match +func ParseDefaultSelector(value interface{}) (DefaultSelector, error) { + switch v := value.(type) { + case map[string]interface{}: + return v, nil + case string: + selector := DefaultSelector{} + if err := json.Unmarshal([]byte(v), &selector); err != nil { + return nil, err + } + return selector, nil + default: + return nil, fmt.Errorf("unknown type %T", value) + } +} + +func (is DefaultSelector) Match(obj map[string]string) (bool, error) { + for key, selector := range is { + value, ok := obj[key] + if !ok { + return false, nil + } + ok, err := matchValue(selector, value) + if err != nil { + return false, fmt.Errorf("error while trying to match '%s': %w", key, err) + } + if !ok { + return false, nil + } + } + return true, nil +} + +func matchValue(selector interface{}, val string) (bool, error) { + switch s := selector.(type) { + case string: + return s == val, nil + case []interface{}: + for _, orVal := range s { + v, ok := orVal.(string) + if !ok { + return false, fmt.Errorf("invalid selector type '%T'", val) + } + if val == v { + return true, nil + } + } + return false, nil + default: + return false, fmt.Errorf("unknown selector type '%T' only string or a list of strings is supported", val) + } +} + +// RegexSelector defines the selector for the identity of an object. +// The regex selector is a map of identity key to selector +// All keys are validated against the given selector. +// +// Valid selectors are +// - raw string value: identity value is compared to the selector value +// - array of strings: or-operator identity value must be one of the defined strings in the array +type RegexSelector map[string]interface{} + +var _ Interface = RegexSelector{} + +// ParseRegexSelector creates a Identity selector from a +// - json encoded selector +// - map[string]Selector +// +// A selector can be +// - a string: the value is directly matched +// - a array of strings: one selector in the array must match +func ParseRegexSelector(value interface{}) (RegexSelector, error) { + switch v := value.(type) { + case map[string]interface{}: + return v, nil + case string: + selector := RegexSelector{} + if err := json.Unmarshal([]byte(v), &selector); err != nil { + return nil, err + } + return selector, nil + default: + return nil, fmt.Errorf("unknown type %T", value) + } +} + +func (is RegexSelector) Match(obj map[string]string) (bool, error) { + for key, selector := range is { + value, ok := obj[key] + if !ok { + return false, nil + } + ok, err := matchValueByRegex(selector, value) + if err != nil { + return false, fmt.Errorf("error while trying to match '%s': %w", key, err) + } + if !ok { + return false, nil + } + } + return true, nil +} + +func matchValueByRegex(selector interface{}, val string) (bool, error) { + switch s := selector.(type) { + case string: + return regexp.MatchString(s, val) + case []interface{}: + for _, orVal := range s { + v, ok := orVal.(string) + if !ok { + return false, fmt.Errorf("invalid selector type '%T'", val) + } + if val == v { + return true, nil + } + } + return false, nil + default: + return false, fmt.Errorf("unknown selector type '%T' only string or a list of strings is supported", val) + } +} + +// JSONSchemaSelector uses a jsonschema to match a specific object. +type JSONSchemaSelector struct { + Scheme *gojsonschema.Schema +} + +// NewJSONSchemaSelector creates a new jsonschema selector from a gojsonschema +func NewJSONSchemaSelector(scheme *gojsonschema.Schema) JSONSchemaSelector { + return JSONSchemaSelector{Scheme: scheme} +} + +// NewJSONSchemaSelectorFromBytes creates a new jsonschema selector from a gojsonschema +func NewJSONSchemaSelectorFromBytes(src []byte) (JSONSchemaSelector, error) { + data, err := yaml.YAMLToJSON(src) + if err != nil { + return JSONSchemaSelector{}, err + } + scheme, err := gojsonschema.NewSchema(gojsonschema.NewBytesLoader(data)) + if err != nil { + return JSONSchemaSelector{}, err + } + return JSONSchemaSelector{Scheme: scheme}, nil +} + +// NewJSONSchemaSelectorFromString creates a new jsonschema selector from a gojsonschema +func NewJSONSchemaSelectorFromString(src string) (JSONSchemaSelector, error) { + return NewJSONSchemaSelectorFromBytes([]byte(src)) +} + +// NewJSONSchemaSelectorFromString creates a new jsonschema selector from a gojsonschema +func NewJSONSchemaSelectorFromGoStruct(src interface{}) (JSONSchemaSelector, error) { + scheme, err := gojsonschema.NewSchema(gojsonschema.NewGoLoader(src)) + if err != nil { + return JSONSchemaSelector{}, err + } + return NewJSONSchemaSelector(scheme), nil +} + +var _ Interface = JSONSchemaSelector{} + +func (J JSONSchemaSelector) Match(obj map[string]string) (bool, error) { + documentLoader := gojsonschema.NewGoLoader(obj) + res, err := J.Scheme.Validate(documentLoader) + if err != nil { + return false, err + } + return res.Valid(), nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/doc.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/doc.go new file mode 100644 index 000000000..f6398ac38 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/doc.go @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=landscaper-service.gardener.cloud + +package core diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/register.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/register.go new file mode 100644 index 000000000..29cba44d8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/register.go @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the name of the Landscaper Service API group. +const GroupName = "landscaper-service.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder is a new Schema Builder which registers our API. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + // AddToScheme is a reference to the Schema Builder's AddToScheme function. + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes( + SchemeGroupVersion, + &LandscaperDeployment{}, + &LandscaperDeploymentList{}, + &Instance{}, + &InstanceList{}, + &ServiceTargetConfig{}, + &ServiceTargetConfigList{}) + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_instance.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_instance.go new file mode 100644 index 000000000..d435ba986 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_instance.go @@ -0,0 +1,87 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstanceList contains a list of Instance +type InstanceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Instance `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// The Instance is created for each LandscaperDeployment. +// The landscaper service controller selects a suitable/available SeedConfig and creates +// an Installation. +type Instance struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec contains the specification for the Instance. + Spec InstanceSpec `json:"spec"` + + // Status contains the status for the Instance. + // +optional + Status InstanceStatus `json:"status"` +} + +// InstanceSpec contains the specification for an Instance. +type InstanceSpec struct { + // TenantId is the unique identifier of the owning tenant. + TenantId string `json:"tenantId"` + + // ID is the id of this instance + ID string `json:"id"` + + // LandscaperConfiguration contains the configuration for the landscaper service deployment + LandscaperConfiguration LandscaperConfiguration `json:"landscaperConfiguration"` + + // ServiceTargetConfigRef specifies the target cluster for which the installation is created. + ServiceTargetConfigRef ObjectReference `json:"serviceTargetConfigRef"` +} + +// InstanceStatus contains the status for an Instance. +type InstanceStatus struct { + // ObservedGeneration is the most recent generation observed for this Instance. + // It corresponds to the Instance generation, which is updated on mutation by the landscaper service controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration"` + + // LastError describes the last error that occurred. + // +optional + LastError *Error `json:"lastError,omitempty"` + + // LandscaperServiceComponent define the landscaper server component that is used for this instance. + // +optional + LandscaperServiceComponent *LandscaperServiceComponent `json:"landscaperServiceComponent"` + + // ContextRef references the landscaper context for this Instance. + // +optional + ContextRef *ObjectReference `json:"contextRef,omitempty"` + + // TargetRef references the Target for this Instance. + // +optional + TargetRef *ObjectReference `json:"targetRef"` + + // InstallationRef references the Installation for this Instance. + // +optional + InstallationRef *ObjectReference `json:"installationRef"` + + // ClusterEndpointRef contains the URL at which the landscaper cluster is accessible. + // +optional + ClusterEndpoint string `json:"clusterEndpoint,omitempty"` + + // ClusterKubeconfigRef contains the Kubeconfig which can be used for accessing the landscaper cluster. + // +optional + ClusterKubeconfig string `json:"clusterKubeconfig,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_landscaperdeployment.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_landscaperdeployment.go new file mode 100644 index 000000000..09cb97877 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_landscaperdeployment.go @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// LandscaperDeploymentList contains a list of LandscaperDeployment +type LandscaperDeploymentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LandscaperDeployment `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// The LandscaperDeployment is created to define a deployment of the landscaper. +type LandscaperDeployment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec contains the specification for the LandscaperDeployment + Spec LandscaperDeploymentSpec `json:"spec"` + + // Status contains the status of the LandscaperDeployment. + // +optional + Status LandscaperDeploymentStatus `json:"status"` +} + +// LandscaperDeploymentSpec contains the specification for a LandscaperDeployment. +type LandscaperDeploymentSpec struct { + // TenantId is the unique identifier of the owning tenant. + TenantId string `json:"tenantId"` + + // Purpose contains the purpose of this LandscaperDeployment. + Purpose string `json:"purpose"` + + // LandscaperConfiguration contains the configuration for the landscaper service deployment + LandscaperConfiguration LandscaperConfiguration `json:"landscaperConfiguration"` + + // Region selects the region this LandscaperDeployment should be installed on. + // +optional + Region string `json:"region,omitempty"` +} + +// LandscaperDeploymentStatus contains the status of a LandscaperDeployment. +type LandscaperDeploymentStatus struct { + // ObservedGeneration is the most recent generation observed for this LandscaperDeployment. + // It corresponds to the LandscaperDeployment generation, which is updated on mutation by the landscaper service controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration"` + + // LastError describes the last error that occurred. + // +optional + LastError *Error `json:"lastError,omitempty"` + + // InstanceRef references the instance that is created for this LandscaperDeployment. + // +optional + InstanceRef *ObjectReference `json:"instanceRef"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_servicetargetconfig.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_servicetargetconfig.go new file mode 100644 index 000000000..e67f99d66 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/type_servicetargetconfig.go @@ -0,0 +1,60 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ServiceTargetConfigList contains a list of ServiceTargetConfig +type ServiceTargetConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ServiceTargetConfig `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// The ServiceTargetConfig is created to define the configuration for a Kubernetes cluster, that can host Landscaper Service deployments. +type ServiceTargetConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec contains the specification for the ServiceTargetConfig + Spec ServiceTargetConfigSpec `json:"spec"` + + // Status contains the status of the ServiceTargetConfig. + // +optional + Status ServiceTargetConfigStatus `json:"status"` +} + +// ServiceTargetConfigSpec contains the specification for a ServiceTargetConfig. +type ServiceTargetConfigSpec struct { + // ProviderType specifies the type of the underlying infrastructure provide. + ProviderType string `json:"providerType"` + + // The Priority of this ServiceTargetConfig. + // SeedConfigs with a higher priority number will be preferred over lower numbers + // when scheduling new landscaper service installations. + Priority int64 `json:"priority"` + + // SecretRef references the secret that contains the kubeconfig of the target cluster. + SecretRef SecretReference `json:"secretRef"` +} + +// ServiceTargetConfigStatus contains the status of a ServiceTargetConfig. +type ServiceTargetConfigStatus struct { + // ObservedGeneration is the most recent generation observed for this ServiceTargetConfig. + // It corresponds to the ServiceTargetConfig generation, which is updated on mutation by the landscaper service controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration"` + + // InstanceRefs is the list of references to instances that use this ServiceTargetConfig. + // +optional + InstanceRefs []ObjectReference `json:"instanceRefs,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/types_shared.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/types_shared.go new file mode 100644 index 000000000..c86fef32a --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/types_shared.go @@ -0,0 +1,85 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// ObjectReference is the reference to a kubernetes object. +type ObjectReference struct { + // Name is the name of the kubernetes object. + Name string `json:"name"` + + // Namespace is the namespace of kubernetes object. + // +optional + Namespace string `json:"namespace"` +} + +// NamespacedName returns the namespaced name for the object reference. +func (r *ObjectReference) NamespacedName() types.NamespacedName { + return types.NamespacedName{ + Name: r.Name, + Namespace: r.Namespace, + } +} + +// IsEmpty checks whether this reference has an empty name or empty namespace. +func (r *ObjectReference) IsEmpty() bool { + return len(r.Name) == 0 || len(r.Namespace) == 0 +} + +// Equals test whether this object reference equals the given object reference. +func (r *ObjectReference) Equals(other *ObjectReference) bool { + return r.Name == other.Name && r.Namespace == other.Namespace +} + +// IsObject tests whether this object reference references the given object. +func (r *ObjectReference) IsObject(o metav1.Object) bool { + return r.Name == o.GetName() && r.Namespace == o.GetNamespace() +} + +// SecretReference is a reference to data in a secret. +type SecretReference struct { + ObjectReference `json:",inline"` + + // Key is the name of the key in the secret that holds the data. + // +optional + Key string `json:"key"` +} + +// Error holds information about an error that occurred. +type Error struct { + // Operation describes the operator where the error occurred. + Operation string `json:"operation"` + + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + + // Last time the condition was updated. + LastUpdateTime metav1.Time `json:"lastUpdateTime"` + + // The reason for the condition's last transition. + Reason string `json:"reason"` + + // A human-readable message indicating details about the transition. + Message string `json:"message"` +} + +// LandscaperConfiguration contains the configuration for a landscaper service deployment. +type LandscaperConfiguration struct { + // Deployers is the list of deployers that are getting installed alongside with this Instance. + Deployers []string `json:"deployers"` +} + +// LandscaperServiceComponent defines the landscaper service component that is being used. +type LandscaperServiceComponent struct { + // Name defines the component name of the landscaper service component. + Name string `json:"name"` + + // Version defines the version of the landscaper service component. + Version string `json:"version"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/constants.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/constants.go new file mode 100644 index 000000000..fb0622300 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/constants.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +const ( + // LandscaperServiceFinalizer is the finalizer used for landscaper-service objects. + LandscaperServiceFinalizer = "finalizer.landscaper-service.gardener.cloud" +) diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/conversion.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/conversion.go new file mode 100644 index 000000000..6c45a8a74 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/conversion.go @@ -0,0 +1,13 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +func addConversionFuncs(scheme *runtime.Scheme) error { + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/defaults.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/defaults.go new file mode 100644 index 000000000..fa3a59334 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/defaults.go @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +func addDefaultsFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_ServiceTargetConfig sets the default values for ServiceTargetConfig objects +func SetDefaults_ServiceTargetConfig(obj *ServiceTargetConfig) { + if len(obj.Spec.SecretRef.Namespace) == 0 { + obj.Spec.SecretRef.Namespace = obj.GetNamespace() + } +} + +// SetDefaults_LandscaperDeployment sets the default values for LandscaperDeployment objects +func SetDefaults_LandscaperDeployment(_ *LandscaperDeployment) { +} + +// SetDefaults_Instance sets the default values for Instance objects +func SetDefaults_Instance(_ *Instance) { +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/doc.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/doc.go new file mode 100644 index 000000000..4c54957f3 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/doc.go @@ -0,0 +1,13 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +// Package v1alpha1 is the v1alpha1 version of the API. +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/gardener/landscaper-service/pkg/apis/core +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// Package v1alpha1 is a version of the API. +// +groupName=landscaper-service.gardener.cloud +package v1alpha1 diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/register.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/register.go new file mode 100644 index 000000000..860149363 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/register.go @@ -0,0 +1,65 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + lsschema "github.com/gardener/landscaper/apis/schema" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/gardener/landscaper-service/pkg/apis/core" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: core.GroupName, Version: "v1alpha1"} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder is a new Schema Builder which registers our API. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultsFuncs, addConversionFuncs) + localSchemeBuilder = &SchemeBuilder + // AddToScheme is a reference to the Schema Builder's AddToScheme function. + AddToScheme = SchemeBuilder.AddToScheme + + ResourceDefinition = lsschema.CustomResourceDefinitions{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + OutputDir: "../../pkg/crdmanager/crdresources", + + Definitions: []lsschema.CustomResourceDefinition{ + LandscaperDeploymentDefinition, + InstanceDefinition, + ServiceTargetConfigDefinition, + }, + } +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes( + SchemeGroupVersion, + &LandscaperDeployment{}, + &LandscaperDeploymentList{}, + &Instance{}, + &InstanceList{}, + &ServiceTargetConfig{}, + &ServiceTargetConfigList{}) + + if err := RegisterConversions(scheme); err != nil { + return err + } + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_instance.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_instance.go new file mode 100644 index 000000000..3f4a8c36f --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_instance.go @@ -0,0 +1,120 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + lsschema "github.com/gardener/landscaper/apis/schema" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstanceList contains a list of Instance +type InstanceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Instance `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// The Instance is created for each LandscaperDeployment. +// The landscaper service controller selects a suitable/available ServiceTargetConfig and creates +// an Installation. +type Instance struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec contains the specification for the Instance. + Spec InstanceSpec `json:"spec"` + + // Status contains the status for the Instance. + // +optional + Status InstanceStatus `json:"status"` +} + +// InstanceSpec contains the specification for an Instance. +type InstanceSpec struct { + // TenantId is the unique identifier of the owning tenant. + TenantId string `json:"tenantId"` + + // ID is the id of this instance + ID string `json:"id"` + + // LandscaperConfiguration contains the configuration for the landscaper service deployment + LandscaperConfiguration LandscaperConfiguration `json:"landscaperConfiguration"` + + // ServiceTargetConfigRef specifies the target cluster for which the installation is created. + ServiceTargetConfigRef ObjectReference `json:"serviceTargetConfigRef"` +} + +// InstanceStatus contains the status for an Instance. +type InstanceStatus struct { + // ObservedGeneration is the most recent generation observed for this Instance. + // It corresponds to the Instance generation, which is updated on mutation by the landscaper service controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration"` + + // LastError describes the last error that occurred. + // +optional + LastError *Error `json:"lastError,omitempty"` + + // LandscaperServiceComponent define the landscaper server component that is used for this instance. + // +optional + LandscaperServiceComponent *LandscaperServiceComponent `json:"landscaperServiceComponent"` + + // ContextRef references the landscaper context for this Instance. + // +optional + ContextRef *ObjectReference `json:"contextRef,omitempty"` + + // TargetRef references the Target for this Instance. + // +optional + TargetRef *ObjectReference `json:"targetRef,omitempty"` + + // InstallationRef references the Installation for this Instance. + // +optional + InstallationRef *ObjectReference `json:"installationRef,omitempty"` + + // ClusterEndpointRef contains the URL at which the landscaper cluster is accessible. + // +optional + ClusterEndpoint string `json:"clusterEndpoint,omitempty"` + + // ClusterKubeconfigRef contains the Kubeconfig which can be used for accessing the landscaper cluster. + // +optional + ClusterKubeconfig string `json:"clusterKubeconfig,omitempty"` +} + +var InstanceDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "instances", + Singular: "instance", + ShortNames: []string{ + "inst", + }, + Kind: "Instance", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + SubresourceStatus: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "ServiceTargetConfig", + Type: "string", + JSONPath: ".spec.serviceTargetConfigRef.name", + }, + { + Name: "Installation", + Type: "string", + JSONPath: ".status.installationRef.name", + }, + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_landscaperdeployment.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_landscaperdeployment.go new file mode 100644 index 000000000..b9f9f09fe --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_landscaperdeployment.go @@ -0,0 +1,95 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// LandscaperDeploymentList contains a list of LandscaperDeployment +type LandscaperDeploymentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LandscaperDeployment `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// The LandscaperDeployment is created to define a deployment of the landscaper. +type LandscaperDeployment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec contains the specification for the LandscaperDeployment + Spec LandscaperDeploymentSpec `json:"spec"` + + // Status contains the status of the LandscaperDeployment. + // +optional + Status LandscaperDeploymentStatus `json:"status"` +} + +// LandscaperDeploymentSpec contains the specification for a LandscaperDeployment. +type LandscaperDeploymentSpec struct { + // TenantId is the unique identifier of the owning tenant. + TenantId string `json:"tenantId"` + + // Purpose contains the purpose of this LandscaperDeployment. + Purpose string `json:"purpose"` + + // LandscaperConfiguration contains the configuration for the landscaper service deployment + LandscaperConfiguration LandscaperConfiguration `json:"landscaperConfiguration"` + + // Region selects the region this LandscaperDeployment should be installed on. + // +optional + Region string `json:"region,omitempty"` +} + +// LandscaperDeploymentStatus contains the status of a LandscaperDeployment. +type LandscaperDeploymentStatus struct { + // ObservedGeneration is the most recent generation observed for this LandscaperDeployment. + // It corresponds to the LandscaperDeployment generation, which is updated on mutation by the landscaper service controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration"` + + // LastError describes the last error that occurred. + // +optional + LastError *Error `json:"lastError,omitempty"` + + // InstanceRef references the instance that is created for this LandscaperDeployment. + // +optional + InstanceRef *ObjectReference `json:"instanceRef"` +} + +var LandscaperDeploymentDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "landscaperdeployments", + Singular: "landscaperdeployment", + ShortNames: []string{ + "lsdepl", + }, + Kind: "LandscaperDeployment", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + SubresourceStatus: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "Instance", + Type: "string", + JSONPath: ".status.instanceRef.name", + }, + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_servicetargetconfig.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_servicetargetconfig.go new file mode 100644 index 000000000..212bc312c --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_servicetargetconfig.go @@ -0,0 +1,112 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + lsschema "github.com/gardener/landscaper/apis/schema" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // ServiceTargetConfigVisibleLabelName label defines whether the ServiceTargetConfig is visible for scheduling. + // If set to "true", any Landscaper Service deployment can be scheduled on this seed. + // If not set or set to "false", no new Landscaper Service deployments can be scheduled on this seed. + ServiceTargetConfigVisibleLabelName = "config.landscaper-service.gardener.cloud/visible" + // ServiceTargetConfigRegionLabelName label specifies the region in which the target cluster is located. + ServiceTargetConfigRegionLabelName = "config.landscaper-service.gardener.cloud/region" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ServiceTargetConfigList contains a list of ServiceTargetConfig +type ServiceTargetConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ServiceTargetConfig `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// The ServiceTargetConfig is created to define the configuration for a Kubernetes cluster, that can host Landscaper Service deployments. +type ServiceTargetConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec contains the specification for the ServiceTargetConfig + Spec ServiceTargetConfigSpec `json:"spec"` + + // Status contains the status of the ServiceTargetConfig. + // +optional + Status ServiceTargetConfigStatus `json:"status"` +} + +// ServiceTargetConfigSpec contains the specification for a ServiceTargetConfig. +type ServiceTargetConfigSpec struct { + // ProviderType specifies the type of the underlying infrastructure provide. + ProviderType string `json:"providerType"` + + // The Priority of this ServiceTargetConfig. + // SeedConfigs with a higher priority number will be preferred over lower numbers + // when scheduling new landscaper service installations. + Priority int64 `json:"priority"` + + // SecretRef references the secret that contains the kubeconfig of the target cluster. + SecretRef SecretReference `json:"secretRef"` +} + +// ServiceTargetConfigStatus contains the status of a ServiceTargetConfig. +type ServiceTargetConfigStatus struct { + // ObservedGeneration is the most recent generation observed for this ServiceTargetConfig. + // It corresponds to the ServiceTargetConfig generation, which is updated on mutation by the landscaper service controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration"` + + // InstanceRefs is the list of references to instances that use this ServiceTargetConfig. + // +optional + InstanceRefs []ObjectReference `json:"instanceRefs,omitempty"` +} + +var ServiceTargetConfigDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "servicetargetconfigs", + Singular: "servicetargetconfig", + ShortNames: []string{ + "servcfg", + }, + Kind: "ServiceTargetConfig", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + SubresourceStatus: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "ProviderType", + Type: "string", + JSONPath: ".spec.providerType", + }, + { + Name: "Region", + Type: "string", + JSONPath: ".metadata.labels.config\\.landscaper-service\\.gardener\\.cloud/region", + }, + { + Name: "Visible", + Type: "string", + JSONPath: ".metadata.labels.config\\.landscaper-service\\.gardener\\.cloud/visible", + }, + { + Name: "Priority", + Type: "number", + JSONPath: ".spec.priority", + }, + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_shared.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_shared.go new file mode 100644 index 000000000..2694d2397 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/types_shared.go @@ -0,0 +1,85 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// ObjectReference is the reference to a kubernetes object. +type ObjectReference struct { + // Name is the name of the kubernetes object. + Name string `json:"name"` + + // Namespace is the namespace of kubernetes object. + // +optional + Namespace string `json:"namespace"` +} + +// NamespacedName returns the namespaced name for the object reference. +func (r *ObjectReference) NamespacedName() types.NamespacedName { + return types.NamespacedName{ + Name: r.Name, + Namespace: r.Namespace, + } +} + +// IsEmpty checks whether this reference has an empty name or empty namespace. +func (r *ObjectReference) IsEmpty() bool { + return len(r.Name) == 0 || len(r.Namespace) == 0 +} + +// Equals test whether this object reference equals the given object reference. +func (r *ObjectReference) Equals(other *ObjectReference) bool { + return r.Name == other.Name && r.Namespace == other.Namespace +} + +// IsObject tests whether this object reference references the given object. +func (r *ObjectReference) IsObject(o metav1.Object) bool { + return r.Name == o.GetName() && r.Namespace == o.GetNamespace() +} + +// SecretReference is a reference to data in a secret. +type SecretReference struct { + ObjectReference `json:",inline"` + + // Key is the name of the key in the secret that holds the data. + // +optional + Key string `json:"key"` +} + +// Error holds information about an error that occurred. +type Error struct { + // Operation describes the operator where the error occurred. + Operation string `json:"operation"` + + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + + // Last time the condition was updated. + LastUpdateTime metav1.Time `json:"lastUpdateTime"` + + // The reason for the condition's last transition. + Reason string `json:"reason"` + + // A human-readable message indicating details about the transition. + Message string `json:"message"` +} + +// LandscaperConfiguration contains the configuration for a landscaper service deployment. +type LandscaperConfiguration struct { + // Deployers is the list of deployers that are getting installed alongside with this Instance. + Deployers []string `json:"deployers"` +} + +// LandscaperServiceComponent defines the landscaper service component that is being used. +type LandscaperServiceComponent struct { + // Name defines the component name of the landscaper service component. + Name string `json:"name"` + + // Version defines the version of the landscaper service component. + Version string `json:"version"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.conversion.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000..c23562826 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,652 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + + core "github.com/gardener/landscaper-service/pkg/apis/core" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*Error)(nil), (*core.Error)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Error_To_core_Error(a.(*Error), b.(*core.Error), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Error)(nil), (*Error)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Error_To_v1alpha1_Error(a.(*core.Error), b.(*Error), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Instance)(nil), (*core.Instance)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Instance_To_core_Instance(a.(*Instance), b.(*core.Instance), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Instance)(nil), (*Instance)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Instance_To_v1alpha1_Instance(a.(*core.Instance), b.(*Instance), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceList)(nil), (*core.InstanceList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstanceList_To_core_InstanceList(a.(*InstanceList), b.(*core.InstanceList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstanceList)(nil), (*InstanceList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstanceList_To_v1alpha1_InstanceList(a.(*core.InstanceList), b.(*InstanceList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceSpec)(nil), (*core.InstanceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstanceSpec_To_core_InstanceSpec(a.(*InstanceSpec), b.(*core.InstanceSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstanceSpec)(nil), (*InstanceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstanceSpec_To_v1alpha1_InstanceSpec(a.(*core.InstanceSpec), b.(*InstanceSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceStatus)(nil), (*core.InstanceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstanceStatus_To_core_InstanceStatus(a.(*InstanceStatus), b.(*core.InstanceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstanceStatus)(nil), (*InstanceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstanceStatus_To_v1alpha1_InstanceStatus(a.(*core.InstanceStatus), b.(*InstanceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LandscaperConfiguration)(nil), (*core.LandscaperConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LandscaperConfiguration_To_core_LandscaperConfiguration(a.(*LandscaperConfiguration), b.(*core.LandscaperConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.LandscaperConfiguration)(nil), (*LandscaperConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(a.(*core.LandscaperConfiguration), b.(*LandscaperConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LandscaperDeployment)(nil), (*core.LandscaperDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LandscaperDeployment_To_core_LandscaperDeployment(a.(*LandscaperDeployment), b.(*core.LandscaperDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.LandscaperDeployment)(nil), (*LandscaperDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_LandscaperDeployment_To_v1alpha1_LandscaperDeployment(a.(*core.LandscaperDeployment), b.(*LandscaperDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LandscaperDeploymentList)(nil), (*core.LandscaperDeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LandscaperDeploymentList_To_core_LandscaperDeploymentList(a.(*LandscaperDeploymentList), b.(*core.LandscaperDeploymentList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.LandscaperDeploymentList)(nil), (*LandscaperDeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_LandscaperDeploymentList_To_v1alpha1_LandscaperDeploymentList(a.(*core.LandscaperDeploymentList), b.(*LandscaperDeploymentList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LandscaperDeploymentSpec)(nil), (*core.LandscaperDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LandscaperDeploymentSpec_To_core_LandscaperDeploymentSpec(a.(*LandscaperDeploymentSpec), b.(*core.LandscaperDeploymentSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.LandscaperDeploymentSpec)(nil), (*LandscaperDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_LandscaperDeploymentSpec_To_v1alpha1_LandscaperDeploymentSpec(a.(*core.LandscaperDeploymentSpec), b.(*LandscaperDeploymentSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LandscaperDeploymentStatus)(nil), (*core.LandscaperDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LandscaperDeploymentStatus_To_core_LandscaperDeploymentStatus(a.(*LandscaperDeploymentStatus), b.(*core.LandscaperDeploymentStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.LandscaperDeploymentStatus)(nil), (*LandscaperDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_LandscaperDeploymentStatus_To_v1alpha1_LandscaperDeploymentStatus(a.(*core.LandscaperDeploymentStatus), b.(*LandscaperDeploymentStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LandscaperServiceComponent)(nil), (*core.LandscaperServiceComponent)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LandscaperServiceComponent_To_core_LandscaperServiceComponent(a.(*LandscaperServiceComponent), b.(*core.LandscaperServiceComponent), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.LandscaperServiceComponent)(nil), (*LandscaperServiceComponent)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_LandscaperServiceComponent_To_v1alpha1_LandscaperServiceComponent(a.(*core.LandscaperServiceComponent), b.(*LandscaperServiceComponent), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ObjectReference)(nil), (*core.ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ObjectReference_To_core_ObjectReference(a.(*ObjectReference), b.(*core.ObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ObjectReference)(nil), (*ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ObjectReference_To_v1alpha1_ObjectReference(a.(*core.ObjectReference), b.(*ObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SecretReference)(nil), (*core.SecretReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SecretReference_To_core_SecretReference(a.(*SecretReference), b.(*core.SecretReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.SecretReference)(nil), (*SecretReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_SecretReference_To_v1alpha1_SecretReference(a.(*core.SecretReference), b.(*SecretReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ServiceTargetConfig)(nil), (*core.ServiceTargetConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ServiceTargetConfig_To_core_ServiceTargetConfig(a.(*ServiceTargetConfig), b.(*core.ServiceTargetConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ServiceTargetConfig)(nil), (*ServiceTargetConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ServiceTargetConfig_To_v1alpha1_ServiceTargetConfig(a.(*core.ServiceTargetConfig), b.(*ServiceTargetConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ServiceTargetConfigList)(nil), (*core.ServiceTargetConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ServiceTargetConfigList_To_core_ServiceTargetConfigList(a.(*ServiceTargetConfigList), b.(*core.ServiceTargetConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ServiceTargetConfigList)(nil), (*ServiceTargetConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ServiceTargetConfigList_To_v1alpha1_ServiceTargetConfigList(a.(*core.ServiceTargetConfigList), b.(*ServiceTargetConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ServiceTargetConfigSpec)(nil), (*core.ServiceTargetConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ServiceTargetConfigSpec_To_core_ServiceTargetConfigSpec(a.(*ServiceTargetConfigSpec), b.(*core.ServiceTargetConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ServiceTargetConfigSpec)(nil), (*ServiceTargetConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ServiceTargetConfigSpec_To_v1alpha1_ServiceTargetConfigSpec(a.(*core.ServiceTargetConfigSpec), b.(*ServiceTargetConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ServiceTargetConfigStatus)(nil), (*core.ServiceTargetConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ServiceTargetConfigStatus_To_core_ServiceTargetConfigStatus(a.(*ServiceTargetConfigStatus), b.(*core.ServiceTargetConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ServiceTargetConfigStatus)(nil), (*ServiceTargetConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ServiceTargetConfigStatus_To_v1alpha1_ServiceTargetConfigStatus(a.(*core.ServiceTargetConfigStatus), b.(*ServiceTargetConfigStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_Error_To_core_Error(in *Error, out *core.Error, s conversion.Scope) error { + out.Operation = in.Operation + out.LastTransitionTime = in.LastTransitionTime + out.LastUpdateTime = in.LastUpdateTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1alpha1_Error_To_core_Error is an autogenerated conversion function. +func Convert_v1alpha1_Error_To_core_Error(in *Error, out *core.Error, s conversion.Scope) error { + return autoConvert_v1alpha1_Error_To_core_Error(in, out, s) +} + +func autoConvert_core_Error_To_v1alpha1_Error(in *core.Error, out *Error, s conversion.Scope) error { + out.Operation = in.Operation + out.LastTransitionTime = in.LastTransitionTime + out.LastUpdateTime = in.LastUpdateTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_core_Error_To_v1alpha1_Error is an autogenerated conversion function. +func Convert_core_Error_To_v1alpha1_Error(in *core.Error, out *Error, s conversion.Scope) error { + return autoConvert_core_Error_To_v1alpha1_Error(in, out, s) +} + +func autoConvert_v1alpha1_Instance_To_core_Instance(in *Instance, out *core.Instance, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_InstanceSpec_To_core_InstanceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_InstanceStatus_To_core_InstanceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Instance_To_core_Instance is an autogenerated conversion function. +func Convert_v1alpha1_Instance_To_core_Instance(in *Instance, out *core.Instance, s conversion.Scope) error { + return autoConvert_v1alpha1_Instance_To_core_Instance(in, out, s) +} + +func autoConvert_core_Instance_To_v1alpha1_Instance(in *core.Instance, out *Instance, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_InstanceSpec_To_v1alpha1_InstanceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_core_InstanceStatus_To_v1alpha1_InstanceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_core_Instance_To_v1alpha1_Instance is an autogenerated conversion function. +func Convert_core_Instance_To_v1alpha1_Instance(in *core.Instance, out *Instance, s conversion.Scope) error { + return autoConvert_core_Instance_To_v1alpha1_Instance(in, out, s) +} + +func autoConvert_v1alpha1_InstanceList_To_core_InstanceList(in *InstanceList, out *core.InstanceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.Instance)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_InstanceList_To_core_InstanceList is an autogenerated conversion function. +func Convert_v1alpha1_InstanceList_To_core_InstanceList(in *InstanceList, out *core.InstanceList, s conversion.Scope) error { + return autoConvert_v1alpha1_InstanceList_To_core_InstanceList(in, out, s) +} + +func autoConvert_core_InstanceList_To_v1alpha1_InstanceList(in *core.InstanceList, out *InstanceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Instance)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_InstanceList_To_v1alpha1_InstanceList is an autogenerated conversion function. +func Convert_core_InstanceList_To_v1alpha1_InstanceList(in *core.InstanceList, out *InstanceList, s conversion.Scope) error { + return autoConvert_core_InstanceList_To_v1alpha1_InstanceList(in, out, s) +} + +func autoConvert_v1alpha1_InstanceSpec_To_core_InstanceSpec(in *InstanceSpec, out *core.InstanceSpec, s conversion.Scope) error { + out.TenantId = in.TenantId + out.ID = in.ID + if err := Convert_v1alpha1_LandscaperConfiguration_To_core_LandscaperConfiguration(&in.LandscaperConfiguration, &out.LandscaperConfiguration, s); err != nil { + return err + } + if err := Convert_v1alpha1_ObjectReference_To_core_ObjectReference(&in.ServiceTargetConfigRef, &out.ServiceTargetConfigRef, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_InstanceSpec_To_core_InstanceSpec is an autogenerated conversion function. +func Convert_v1alpha1_InstanceSpec_To_core_InstanceSpec(in *InstanceSpec, out *core.InstanceSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_InstanceSpec_To_core_InstanceSpec(in, out, s) +} + +func autoConvert_core_InstanceSpec_To_v1alpha1_InstanceSpec(in *core.InstanceSpec, out *InstanceSpec, s conversion.Scope) error { + out.TenantId = in.TenantId + out.ID = in.ID + if err := Convert_core_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(&in.LandscaperConfiguration, &out.LandscaperConfiguration, s); err != nil { + return err + } + if err := Convert_core_ObjectReference_To_v1alpha1_ObjectReference(&in.ServiceTargetConfigRef, &out.ServiceTargetConfigRef, s); err != nil { + return err + } + return nil +} + +// Convert_core_InstanceSpec_To_v1alpha1_InstanceSpec is an autogenerated conversion function. +func Convert_core_InstanceSpec_To_v1alpha1_InstanceSpec(in *core.InstanceSpec, out *InstanceSpec, s conversion.Scope) error { + return autoConvert_core_InstanceSpec_To_v1alpha1_InstanceSpec(in, out, s) +} + +func autoConvert_v1alpha1_InstanceStatus_To_core_InstanceStatus(in *InstanceStatus, out *core.InstanceStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.LastError = (*core.Error)(unsafe.Pointer(in.LastError)) + out.LandscaperServiceComponent = (*core.LandscaperServiceComponent)(unsafe.Pointer(in.LandscaperServiceComponent)) + out.ContextRef = (*core.ObjectReference)(unsafe.Pointer(in.ContextRef)) + out.TargetRef = (*core.ObjectReference)(unsafe.Pointer(in.TargetRef)) + out.InstallationRef = (*core.ObjectReference)(unsafe.Pointer(in.InstallationRef)) + out.ClusterEndpoint = in.ClusterEndpoint + out.ClusterKubeconfig = in.ClusterKubeconfig + return nil +} + +// Convert_v1alpha1_InstanceStatus_To_core_InstanceStatus is an autogenerated conversion function. +func Convert_v1alpha1_InstanceStatus_To_core_InstanceStatus(in *InstanceStatus, out *core.InstanceStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_InstanceStatus_To_core_InstanceStatus(in, out, s) +} + +func autoConvert_core_InstanceStatus_To_v1alpha1_InstanceStatus(in *core.InstanceStatus, out *InstanceStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.LastError = (*Error)(unsafe.Pointer(in.LastError)) + out.LandscaperServiceComponent = (*LandscaperServiceComponent)(unsafe.Pointer(in.LandscaperServiceComponent)) + out.ContextRef = (*ObjectReference)(unsafe.Pointer(in.ContextRef)) + out.TargetRef = (*ObjectReference)(unsafe.Pointer(in.TargetRef)) + out.InstallationRef = (*ObjectReference)(unsafe.Pointer(in.InstallationRef)) + out.ClusterEndpoint = in.ClusterEndpoint + out.ClusterKubeconfig = in.ClusterKubeconfig + return nil +} + +// Convert_core_InstanceStatus_To_v1alpha1_InstanceStatus is an autogenerated conversion function. +func Convert_core_InstanceStatus_To_v1alpha1_InstanceStatus(in *core.InstanceStatus, out *InstanceStatus, s conversion.Scope) error { + return autoConvert_core_InstanceStatus_To_v1alpha1_InstanceStatus(in, out, s) +} + +func autoConvert_v1alpha1_LandscaperConfiguration_To_core_LandscaperConfiguration(in *LandscaperConfiguration, out *core.LandscaperConfiguration, s conversion.Scope) error { + out.Deployers = *(*[]string)(unsafe.Pointer(&in.Deployers)) + return nil +} + +// Convert_v1alpha1_LandscaperConfiguration_To_core_LandscaperConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_LandscaperConfiguration_To_core_LandscaperConfiguration(in *LandscaperConfiguration, out *core.LandscaperConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_LandscaperConfiguration_To_core_LandscaperConfiguration(in, out, s) +} + +func autoConvert_core_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(in *core.LandscaperConfiguration, out *LandscaperConfiguration, s conversion.Scope) error { + out.Deployers = *(*[]string)(unsafe.Pointer(&in.Deployers)) + return nil +} + +// Convert_core_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration is an autogenerated conversion function. +func Convert_core_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(in *core.LandscaperConfiguration, out *LandscaperConfiguration, s conversion.Scope) error { + return autoConvert_core_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_LandscaperDeployment_To_core_LandscaperDeployment(in *LandscaperDeployment, out *core.LandscaperDeployment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_LandscaperDeploymentSpec_To_core_LandscaperDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_LandscaperDeploymentStatus_To_core_LandscaperDeploymentStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LandscaperDeployment_To_core_LandscaperDeployment is an autogenerated conversion function. +func Convert_v1alpha1_LandscaperDeployment_To_core_LandscaperDeployment(in *LandscaperDeployment, out *core.LandscaperDeployment, s conversion.Scope) error { + return autoConvert_v1alpha1_LandscaperDeployment_To_core_LandscaperDeployment(in, out, s) +} + +func autoConvert_core_LandscaperDeployment_To_v1alpha1_LandscaperDeployment(in *core.LandscaperDeployment, out *LandscaperDeployment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_LandscaperDeploymentSpec_To_v1alpha1_LandscaperDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_core_LandscaperDeploymentStatus_To_v1alpha1_LandscaperDeploymentStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_core_LandscaperDeployment_To_v1alpha1_LandscaperDeployment is an autogenerated conversion function. +func Convert_core_LandscaperDeployment_To_v1alpha1_LandscaperDeployment(in *core.LandscaperDeployment, out *LandscaperDeployment, s conversion.Scope) error { + return autoConvert_core_LandscaperDeployment_To_v1alpha1_LandscaperDeployment(in, out, s) +} + +func autoConvert_v1alpha1_LandscaperDeploymentList_To_core_LandscaperDeploymentList(in *LandscaperDeploymentList, out *core.LandscaperDeploymentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.LandscaperDeployment)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_LandscaperDeploymentList_To_core_LandscaperDeploymentList is an autogenerated conversion function. +func Convert_v1alpha1_LandscaperDeploymentList_To_core_LandscaperDeploymentList(in *LandscaperDeploymentList, out *core.LandscaperDeploymentList, s conversion.Scope) error { + return autoConvert_v1alpha1_LandscaperDeploymentList_To_core_LandscaperDeploymentList(in, out, s) +} + +func autoConvert_core_LandscaperDeploymentList_To_v1alpha1_LandscaperDeploymentList(in *core.LandscaperDeploymentList, out *LandscaperDeploymentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]LandscaperDeployment)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_LandscaperDeploymentList_To_v1alpha1_LandscaperDeploymentList is an autogenerated conversion function. +func Convert_core_LandscaperDeploymentList_To_v1alpha1_LandscaperDeploymentList(in *core.LandscaperDeploymentList, out *LandscaperDeploymentList, s conversion.Scope) error { + return autoConvert_core_LandscaperDeploymentList_To_v1alpha1_LandscaperDeploymentList(in, out, s) +} + +func autoConvert_v1alpha1_LandscaperDeploymentSpec_To_core_LandscaperDeploymentSpec(in *LandscaperDeploymentSpec, out *core.LandscaperDeploymentSpec, s conversion.Scope) error { + out.TenantId = in.TenantId + out.Purpose = in.Purpose + if err := Convert_v1alpha1_LandscaperConfiguration_To_core_LandscaperConfiguration(&in.LandscaperConfiguration, &out.LandscaperConfiguration, s); err != nil { + return err + } + out.Region = in.Region + return nil +} + +// Convert_v1alpha1_LandscaperDeploymentSpec_To_core_LandscaperDeploymentSpec is an autogenerated conversion function. +func Convert_v1alpha1_LandscaperDeploymentSpec_To_core_LandscaperDeploymentSpec(in *LandscaperDeploymentSpec, out *core.LandscaperDeploymentSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LandscaperDeploymentSpec_To_core_LandscaperDeploymentSpec(in, out, s) +} + +func autoConvert_core_LandscaperDeploymentSpec_To_v1alpha1_LandscaperDeploymentSpec(in *core.LandscaperDeploymentSpec, out *LandscaperDeploymentSpec, s conversion.Scope) error { + out.TenantId = in.TenantId + out.Purpose = in.Purpose + if err := Convert_core_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(&in.LandscaperConfiguration, &out.LandscaperConfiguration, s); err != nil { + return err + } + out.Region = in.Region + return nil +} + +// Convert_core_LandscaperDeploymentSpec_To_v1alpha1_LandscaperDeploymentSpec is an autogenerated conversion function. +func Convert_core_LandscaperDeploymentSpec_To_v1alpha1_LandscaperDeploymentSpec(in *core.LandscaperDeploymentSpec, out *LandscaperDeploymentSpec, s conversion.Scope) error { + return autoConvert_core_LandscaperDeploymentSpec_To_v1alpha1_LandscaperDeploymentSpec(in, out, s) +} + +func autoConvert_v1alpha1_LandscaperDeploymentStatus_To_core_LandscaperDeploymentStatus(in *LandscaperDeploymentStatus, out *core.LandscaperDeploymentStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.LastError = (*core.Error)(unsafe.Pointer(in.LastError)) + out.InstanceRef = (*core.ObjectReference)(unsafe.Pointer(in.InstanceRef)) + return nil +} + +// Convert_v1alpha1_LandscaperDeploymentStatus_To_core_LandscaperDeploymentStatus is an autogenerated conversion function. +func Convert_v1alpha1_LandscaperDeploymentStatus_To_core_LandscaperDeploymentStatus(in *LandscaperDeploymentStatus, out *core.LandscaperDeploymentStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_LandscaperDeploymentStatus_To_core_LandscaperDeploymentStatus(in, out, s) +} + +func autoConvert_core_LandscaperDeploymentStatus_To_v1alpha1_LandscaperDeploymentStatus(in *core.LandscaperDeploymentStatus, out *LandscaperDeploymentStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.LastError = (*Error)(unsafe.Pointer(in.LastError)) + out.InstanceRef = (*ObjectReference)(unsafe.Pointer(in.InstanceRef)) + return nil +} + +// Convert_core_LandscaperDeploymentStatus_To_v1alpha1_LandscaperDeploymentStatus is an autogenerated conversion function. +func Convert_core_LandscaperDeploymentStatus_To_v1alpha1_LandscaperDeploymentStatus(in *core.LandscaperDeploymentStatus, out *LandscaperDeploymentStatus, s conversion.Scope) error { + return autoConvert_core_LandscaperDeploymentStatus_To_v1alpha1_LandscaperDeploymentStatus(in, out, s) +} + +func autoConvert_v1alpha1_LandscaperServiceComponent_To_core_LandscaperServiceComponent(in *LandscaperServiceComponent, out *core.LandscaperServiceComponent, s conversion.Scope) error { + out.Name = in.Name + out.Version = in.Version + return nil +} + +// Convert_v1alpha1_LandscaperServiceComponent_To_core_LandscaperServiceComponent is an autogenerated conversion function. +func Convert_v1alpha1_LandscaperServiceComponent_To_core_LandscaperServiceComponent(in *LandscaperServiceComponent, out *core.LandscaperServiceComponent, s conversion.Scope) error { + return autoConvert_v1alpha1_LandscaperServiceComponent_To_core_LandscaperServiceComponent(in, out, s) +} + +func autoConvert_core_LandscaperServiceComponent_To_v1alpha1_LandscaperServiceComponent(in *core.LandscaperServiceComponent, out *LandscaperServiceComponent, s conversion.Scope) error { + out.Name = in.Name + out.Version = in.Version + return nil +} + +// Convert_core_LandscaperServiceComponent_To_v1alpha1_LandscaperServiceComponent is an autogenerated conversion function. +func Convert_core_LandscaperServiceComponent_To_v1alpha1_LandscaperServiceComponent(in *core.LandscaperServiceComponent, out *LandscaperServiceComponent, s conversion.Scope) error { + return autoConvert_core_LandscaperServiceComponent_To_v1alpha1_LandscaperServiceComponent(in, out, s) +} + +func autoConvert_v1alpha1_ObjectReference_To_core_ObjectReference(in *ObjectReference, out *core.ObjectReference, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +// Convert_v1alpha1_ObjectReference_To_core_ObjectReference is an autogenerated conversion function. +func Convert_v1alpha1_ObjectReference_To_core_ObjectReference(in *ObjectReference, out *core.ObjectReference, s conversion.Scope) error { + return autoConvert_v1alpha1_ObjectReference_To_core_ObjectReference(in, out, s) +} + +func autoConvert_core_ObjectReference_To_v1alpha1_ObjectReference(in *core.ObjectReference, out *ObjectReference, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +// Convert_core_ObjectReference_To_v1alpha1_ObjectReference is an autogenerated conversion function. +func Convert_core_ObjectReference_To_v1alpha1_ObjectReference(in *core.ObjectReference, out *ObjectReference, s conversion.Scope) error { + return autoConvert_core_ObjectReference_To_v1alpha1_ObjectReference(in, out, s) +} + +func autoConvert_v1alpha1_SecretReference_To_core_SecretReference(in *SecretReference, out *core.SecretReference, s conversion.Scope) error { + if err := Convert_v1alpha1_ObjectReference_To_core_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +// Convert_v1alpha1_SecretReference_To_core_SecretReference is an autogenerated conversion function. +func Convert_v1alpha1_SecretReference_To_core_SecretReference(in *SecretReference, out *core.SecretReference, s conversion.Scope) error { + return autoConvert_v1alpha1_SecretReference_To_core_SecretReference(in, out, s) +} + +func autoConvert_core_SecretReference_To_v1alpha1_SecretReference(in *core.SecretReference, out *SecretReference, s conversion.Scope) error { + if err := Convert_core_ObjectReference_To_v1alpha1_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +// Convert_core_SecretReference_To_v1alpha1_SecretReference is an autogenerated conversion function. +func Convert_core_SecretReference_To_v1alpha1_SecretReference(in *core.SecretReference, out *SecretReference, s conversion.Scope) error { + return autoConvert_core_SecretReference_To_v1alpha1_SecretReference(in, out, s) +} + +func autoConvert_v1alpha1_ServiceTargetConfig_To_core_ServiceTargetConfig(in *ServiceTargetConfig, out *core.ServiceTargetConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ServiceTargetConfigSpec_To_core_ServiceTargetConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ServiceTargetConfigStatus_To_core_ServiceTargetConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ServiceTargetConfig_To_core_ServiceTargetConfig is an autogenerated conversion function. +func Convert_v1alpha1_ServiceTargetConfig_To_core_ServiceTargetConfig(in *ServiceTargetConfig, out *core.ServiceTargetConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_ServiceTargetConfig_To_core_ServiceTargetConfig(in, out, s) +} + +func autoConvert_core_ServiceTargetConfig_To_v1alpha1_ServiceTargetConfig(in *core.ServiceTargetConfig, out *ServiceTargetConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_ServiceTargetConfigSpec_To_v1alpha1_ServiceTargetConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_core_ServiceTargetConfigStatus_To_v1alpha1_ServiceTargetConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_core_ServiceTargetConfig_To_v1alpha1_ServiceTargetConfig is an autogenerated conversion function. +func Convert_core_ServiceTargetConfig_To_v1alpha1_ServiceTargetConfig(in *core.ServiceTargetConfig, out *ServiceTargetConfig, s conversion.Scope) error { + return autoConvert_core_ServiceTargetConfig_To_v1alpha1_ServiceTargetConfig(in, out, s) +} + +func autoConvert_v1alpha1_ServiceTargetConfigList_To_core_ServiceTargetConfigList(in *ServiceTargetConfigList, out *core.ServiceTargetConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.ServiceTargetConfig)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_ServiceTargetConfigList_To_core_ServiceTargetConfigList is an autogenerated conversion function. +func Convert_v1alpha1_ServiceTargetConfigList_To_core_ServiceTargetConfigList(in *ServiceTargetConfigList, out *core.ServiceTargetConfigList, s conversion.Scope) error { + return autoConvert_v1alpha1_ServiceTargetConfigList_To_core_ServiceTargetConfigList(in, out, s) +} + +func autoConvert_core_ServiceTargetConfigList_To_v1alpha1_ServiceTargetConfigList(in *core.ServiceTargetConfigList, out *ServiceTargetConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ServiceTargetConfig)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_ServiceTargetConfigList_To_v1alpha1_ServiceTargetConfigList is an autogenerated conversion function. +func Convert_core_ServiceTargetConfigList_To_v1alpha1_ServiceTargetConfigList(in *core.ServiceTargetConfigList, out *ServiceTargetConfigList, s conversion.Scope) error { + return autoConvert_core_ServiceTargetConfigList_To_v1alpha1_ServiceTargetConfigList(in, out, s) +} + +func autoConvert_v1alpha1_ServiceTargetConfigSpec_To_core_ServiceTargetConfigSpec(in *ServiceTargetConfigSpec, out *core.ServiceTargetConfigSpec, s conversion.Scope) error { + out.ProviderType = in.ProviderType + out.Priority = in.Priority + if err := Convert_v1alpha1_SecretReference_To_core_SecretReference(&in.SecretRef, &out.SecretRef, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ServiceTargetConfigSpec_To_core_ServiceTargetConfigSpec is an autogenerated conversion function. +func Convert_v1alpha1_ServiceTargetConfigSpec_To_core_ServiceTargetConfigSpec(in *ServiceTargetConfigSpec, out *core.ServiceTargetConfigSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ServiceTargetConfigSpec_To_core_ServiceTargetConfigSpec(in, out, s) +} + +func autoConvert_core_ServiceTargetConfigSpec_To_v1alpha1_ServiceTargetConfigSpec(in *core.ServiceTargetConfigSpec, out *ServiceTargetConfigSpec, s conversion.Scope) error { + out.ProviderType = in.ProviderType + out.Priority = in.Priority + if err := Convert_core_SecretReference_To_v1alpha1_SecretReference(&in.SecretRef, &out.SecretRef, s); err != nil { + return err + } + return nil +} + +// Convert_core_ServiceTargetConfigSpec_To_v1alpha1_ServiceTargetConfigSpec is an autogenerated conversion function. +func Convert_core_ServiceTargetConfigSpec_To_v1alpha1_ServiceTargetConfigSpec(in *core.ServiceTargetConfigSpec, out *ServiceTargetConfigSpec, s conversion.Scope) error { + return autoConvert_core_ServiceTargetConfigSpec_To_v1alpha1_ServiceTargetConfigSpec(in, out, s) +} + +func autoConvert_v1alpha1_ServiceTargetConfigStatus_To_core_ServiceTargetConfigStatus(in *ServiceTargetConfigStatus, out *core.ServiceTargetConfigStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.InstanceRefs = *(*[]core.ObjectReference)(unsafe.Pointer(&in.InstanceRefs)) + return nil +} + +// Convert_v1alpha1_ServiceTargetConfigStatus_To_core_ServiceTargetConfigStatus is an autogenerated conversion function. +func Convert_v1alpha1_ServiceTargetConfigStatus_To_core_ServiceTargetConfigStatus(in *ServiceTargetConfigStatus, out *core.ServiceTargetConfigStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ServiceTargetConfigStatus_To_core_ServiceTargetConfigStatus(in, out, s) +} + +func autoConvert_core_ServiceTargetConfigStatus_To_v1alpha1_ServiceTargetConfigStatus(in *core.ServiceTargetConfigStatus, out *ServiceTargetConfigStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.InstanceRefs = *(*[]ObjectReference)(unsafe.Pointer(&in.InstanceRefs)) + return nil +} + +// Convert_core_ServiceTargetConfigStatus_To_v1alpha1_ServiceTargetConfigStatus is an autogenerated conversion function. +func Convert_core_ServiceTargetConfigStatus_To_v1alpha1_ServiceTargetConfigStatus(in *core.ServiceTargetConfigStatus, out *ServiceTargetConfigStatus, s conversion.Scope) error { + return autoConvert_core_ServiceTargetConfigStatus_To_v1alpha1_ServiceTargetConfigStatus(in, out, s) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..73290c09a --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,426 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Error) DeepCopyInto(out *Error) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Error. +func (in *Error) DeepCopy() *Error { + if in == nil { + return nil + } + out := new(Error) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Instance) DeepCopyInto(out *Instance) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance. +func (in *Instance) DeepCopy() *Instance { + if in == nil { + return nil + } + out := new(Instance) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Instance) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceList) DeepCopyInto(out *InstanceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Instance, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceList. +func (in *InstanceList) DeepCopy() *InstanceList { + if in == nil { + return nil + } + out := new(InstanceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstanceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceSpec) DeepCopyInto(out *InstanceSpec) { + *out = *in + in.LandscaperConfiguration.DeepCopyInto(&out.LandscaperConfiguration) + out.ServiceTargetConfigRef = in.ServiceTargetConfigRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSpec. +func (in *InstanceSpec) DeepCopy() *InstanceSpec { + if in == nil { + return nil + } + out := new(InstanceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus) { + *out = *in + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.LandscaperServiceComponent != nil { + in, out := &in.LandscaperServiceComponent, &out.LandscaperServiceComponent + *out = new(LandscaperServiceComponent) + **out = **in + } + if in.ContextRef != nil { + in, out := &in.ContextRef, &out.ContextRef + *out = new(ObjectReference) + **out = **in + } + if in.TargetRef != nil { + in, out := &in.TargetRef, &out.TargetRef + *out = new(ObjectReference) + **out = **in + } + if in.InstallationRef != nil { + in, out := &in.InstallationRef, &out.InstallationRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatus. +func (in *InstanceStatus) DeepCopy() *InstanceStatus { + if in == nil { + return nil + } + out := new(InstanceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperConfiguration) DeepCopyInto(out *LandscaperConfiguration) { + *out = *in + if in.Deployers != nil { + in, out := &in.Deployers, &out.Deployers + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperConfiguration. +func (in *LandscaperConfiguration) DeepCopy() *LandscaperConfiguration { + if in == nil { + return nil + } + out := new(LandscaperConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperDeployment) DeepCopyInto(out *LandscaperDeployment) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperDeployment. +func (in *LandscaperDeployment) DeepCopy() *LandscaperDeployment { + if in == nil { + return nil + } + out := new(LandscaperDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LandscaperDeployment) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperDeploymentList) DeepCopyInto(out *LandscaperDeploymentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LandscaperDeployment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperDeploymentList. +func (in *LandscaperDeploymentList) DeepCopy() *LandscaperDeploymentList { + if in == nil { + return nil + } + out := new(LandscaperDeploymentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LandscaperDeploymentList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperDeploymentSpec) DeepCopyInto(out *LandscaperDeploymentSpec) { + *out = *in + in.LandscaperConfiguration.DeepCopyInto(&out.LandscaperConfiguration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperDeploymentSpec. +func (in *LandscaperDeploymentSpec) DeepCopy() *LandscaperDeploymentSpec { + if in == nil { + return nil + } + out := new(LandscaperDeploymentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperDeploymentStatus) DeepCopyInto(out *LandscaperDeploymentStatus) { + *out = *in + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.InstanceRef != nil { + in, out := &in.InstanceRef, &out.InstanceRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperDeploymentStatus. +func (in *LandscaperDeploymentStatus) DeepCopy() *LandscaperDeploymentStatus { + if in == nil { + return nil + } + out := new(LandscaperDeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperServiceComponent) DeepCopyInto(out *LandscaperServiceComponent) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperServiceComponent. +func (in *LandscaperServiceComponent) DeepCopy() *LandscaperServiceComponent { + if in == nil { + return nil + } + out := new(LandscaperServiceComponent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectReference) DeepCopyInto(out *ObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference. +func (in *ObjectReference) DeepCopy() *ObjectReference { + if in == nil { + return nil + } + out := new(ObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretReference) DeepCopyInto(out *SecretReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference. +func (in *SecretReference) DeepCopy() *SecretReference { + if in == nil { + return nil + } + out := new(SecretReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceTargetConfig) DeepCopyInto(out *ServiceTargetConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTargetConfig. +func (in *ServiceTargetConfig) DeepCopy() *ServiceTargetConfig { + if in == nil { + return nil + } + out := new(ServiceTargetConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServiceTargetConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceTargetConfigList) DeepCopyInto(out *ServiceTargetConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ServiceTargetConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTargetConfigList. +func (in *ServiceTargetConfigList) DeepCopy() *ServiceTargetConfigList { + if in == nil { + return nil + } + out := new(ServiceTargetConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServiceTargetConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceTargetConfigSpec) DeepCopyInto(out *ServiceTargetConfigSpec) { + *out = *in + out.SecretRef = in.SecretRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTargetConfigSpec. +func (in *ServiceTargetConfigSpec) DeepCopy() *ServiceTargetConfigSpec { + if in == nil { + return nil + } + out := new(ServiceTargetConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceTargetConfigStatus) DeepCopyInto(out *ServiceTargetConfigStatus) { + *out = *in + if in.InstanceRefs != nil { + in, out := &in.InstanceRefs, &out.InstanceRefs + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTargetConfigStatus. +func (in *ServiceTargetConfigStatus) DeepCopy() *ServiceTargetConfigStatus { + if in == nil { + return nil + } + out := new(ServiceTargetConfigStatus) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.defaults.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.defaults.go new file mode 100644 index 000000000..7b54920d8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,61 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&Instance{}, func(obj interface{}) { SetObjectDefaults_Instance(obj.(*Instance)) }) + scheme.AddTypeDefaultingFunc(&InstanceList{}, func(obj interface{}) { SetObjectDefaults_InstanceList(obj.(*InstanceList)) }) + scheme.AddTypeDefaultingFunc(&LandscaperDeployment{}, func(obj interface{}) { SetObjectDefaults_LandscaperDeployment(obj.(*LandscaperDeployment)) }) + scheme.AddTypeDefaultingFunc(&LandscaperDeploymentList{}, func(obj interface{}) { SetObjectDefaults_LandscaperDeploymentList(obj.(*LandscaperDeploymentList)) }) + scheme.AddTypeDefaultingFunc(&ServiceTargetConfig{}, func(obj interface{}) { SetObjectDefaults_ServiceTargetConfig(obj.(*ServiceTargetConfig)) }) + scheme.AddTypeDefaultingFunc(&ServiceTargetConfigList{}, func(obj interface{}) { SetObjectDefaults_ServiceTargetConfigList(obj.(*ServiceTargetConfigList)) }) + return nil +} + +func SetObjectDefaults_Instance(in *Instance) { + SetDefaults_Instance(in) +} + +func SetObjectDefaults_InstanceList(in *InstanceList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_Instance(a) + } +} + +func SetObjectDefaults_LandscaperDeployment(in *LandscaperDeployment) { + SetDefaults_LandscaperDeployment(in) +} + +func SetObjectDefaults_LandscaperDeploymentList(in *LandscaperDeploymentList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_LandscaperDeployment(a) + } +} + +func SetObjectDefaults_ServiceTargetConfig(in *ServiceTargetConfig) { + SetDefaults_ServiceTargetConfig(in) +} + +func SetObjectDefaults_ServiceTargetConfigList(in *ServiceTargetConfigList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_ServiceTargetConfig(a) + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/zz_generated.deepcopy.go new file mode 100644 index 000000000..83263e43b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/apis/core/zz_generated.deepcopy.go @@ -0,0 +1,426 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package core + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Error) DeepCopyInto(out *Error) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Error. +func (in *Error) DeepCopy() *Error { + if in == nil { + return nil + } + out := new(Error) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Instance) DeepCopyInto(out *Instance) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance. +func (in *Instance) DeepCopy() *Instance { + if in == nil { + return nil + } + out := new(Instance) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Instance) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceList) DeepCopyInto(out *InstanceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Instance, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceList. +func (in *InstanceList) DeepCopy() *InstanceList { + if in == nil { + return nil + } + out := new(InstanceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstanceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceSpec) DeepCopyInto(out *InstanceSpec) { + *out = *in + in.LandscaperConfiguration.DeepCopyInto(&out.LandscaperConfiguration) + out.ServiceTargetConfigRef = in.ServiceTargetConfigRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSpec. +func (in *InstanceSpec) DeepCopy() *InstanceSpec { + if in == nil { + return nil + } + out := new(InstanceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus) { + *out = *in + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.LandscaperServiceComponent != nil { + in, out := &in.LandscaperServiceComponent, &out.LandscaperServiceComponent + *out = new(LandscaperServiceComponent) + **out = **in + } + if in.ContextRef != nil { + in, out := &in.ContextRef, &out.ContextRef + *out = new(ObjectReference) + **out = **in + } + if in.TargetRef != nil { + in, out := &in.TargetRef, &out.TargetRef + *out = new(ObjectReference) + **out = **in + } + if in.InstallationRef != nil { + in, out := &in.InstallationRef, &out.InstallationRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceStatus. +func (in *InstanceStatus) DeepCopy() *InstanceStatus { + if in == nil { + return nil + } + out := new(InstanceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperConfiguration) DeepCopyInto(out *LandscaperConfiguration) { + *out = *in + if in.Deployers != nil { + in, out := &in.Deployers, &out.Deployers + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperConfiguration. +func (in *LandscaperConfiguration) DeepCopy() *LandscaperConfiguration { + if in == nil { + return nil + } + out := new(LandscaperConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperDeployment) DeepCopyInto(out *LandscaperDeployment) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperDeployment. +func (in *LandscaperDeployment) DeepCopy() *LandscaperDeployment { + if in == nil { + return nil + } + out := new(LandscaperDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LandscaperDeployment) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperDeploymentList) DeepCopyInto(out *LandscaperDeploymentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LandscaperDeployment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperDeploymentList. +func (in *LandscaperDeploymentList) DeepCopy() *LandscaperDeploymentList { + if in == nil { + return nil + } + out := new(LandscaperDeploymentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LandscaperDeploymentList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperDeploymentSpec) DeepCopyInto(out *LandscaperDeploymentSpec) { + *out = *in + in.LandscaperConfiguration.DeepCopyInto(&out.LandscaperConfiguration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperDeploymentSpec. +func (in *LandscaperDeploymentSpec) DeepCopy() *LandscaperDeploymentSpec { + if in == nil { + return nil + } + out := new(LandscaperDeploymentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperDeploymentStatus) DeepCopyInto(out *LandscaperDeploymentStatus) { + *out = *in + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.InstanceRef != nil { + in, out := &in.InstanceRef, &out.InstanceRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperDeploymentStatus. +func (in *LandscaperDeploymentStatus) DeepCopy() *LandscaperDeploymentStatus { + if in == nil { + return nil + } + out := new(LandscaperDeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperServiceComponent) DeepCopyInto(out *LandscaperServiceComponent) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperServiceComponent. +func (in *LandscaperServiceComponent) DeepCopy() *LandscaperServiceComponent { + if in == nil { + return nil + } + out := new(LandscaperServiceComponent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectReference) DeepCopyInto(out *ObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference. +func (in *ObjectReference) DeepCopy() *ObjectReference { + if in == nil { + return nil + } + out := new(ObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretReference) DeepCopyInto(out *SecretReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference. +func (in *SecretReference) DeepCopy() *SecretReference { + if in == nil { + return nil + } + out := new(SecretReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceTargetConfig) DeepCopyInto(out *ServiceTargetConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTargetConfig. +func (in *ServiceTargetConfig) DeepCopy() *ServiceTargetConfig { + if in == nil { + return nil + } + out := new(ServiceTargetConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServiceTargetConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceTargetConfigList) DeepCopyInto(out *ServiceTargetConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ServiceTargetConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTargetConfigList. +func (in *ServiceTargetConfigList) DeepCopy() *ServiceTargetConfigList { + if in == nil { + return nil + } + out := new(ServiceTargetConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServiceTargetConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceTargetConfigSpec) DeepCopyInto(out *ServiceTargetConfigSpec) { + *out = *in + out.SecretRef = in.SecretRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTargetConfigSpec. +func (in *ServiceTargetConfigSpec) DeepCopy() *ServiceTargetConfigSpec { + if in == nil { + return nil + } + out := new(ServiceTargetConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceTargetConfigStatus) DeepCopyInto(out *ServiceTargetConfigStatus) { + *out = *in + if in.InstanceRefs != nil { + in, out := &in.InstanceRefs, &out.InstanceRefs + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTargetConfigStatus. +func (in *ServiceTargetConfigStatus) DeepCopy() *ServiceTargetConfigStatus { + if in == nil { + return nil + } + out := new(ServiceTargetConfigStatus) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper-service/pkg/utils/utils.go b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/utils/utils.go new file mode 100644 index 000000000..3d0b36a41 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper-service/pkg/utils/utils.go @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2021 "SAP SE or an SAP affiliate company and Gardener contributors" +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "fmt" + "strconv" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + + lssv1alpha1 "github.com/gardener/landscaper-service/pkg/apis/core/v1alpha1" +) + +// StringToAnyJSON marshals a string as an AnyJSON object. +func StringToAnyJSON(s string) lsv1alpha1.AnyJSON { + return lsv1alpha1.NewAnyJSON([]byte(fmt.Sprintf("\"%s\"", s))) +} + +// BoolToAnyJSON marshals a boolean as an AnyJSON object. +func BoolToAnyJSON(b bool) lsv1alpha1.AnyJSON { + return lsv1alpha1.NewAnyJSON([]byte(strconv.FormatBool(b))) +} + +// IntToAnyJSON marshals an integer as an AnyJSON object. +func IntToAnyJSON(i int) lsv1alpha1.AnyJSON { + return lsv1alpha1.NewAnyJSON([]byte(strconv.Itoa(i))) +} + +// ContainsReference checks whether the object reference list contains the specified object reference. +func ContainsReference(refList []lssv1alpha1.ObjectReference, ref *lssv1alpha1.ObjectReference) bool { + for _, e := range refList { + if e.Equals(ref) { + return true + } + } + return false +} + +// RemoveReference removes the given object reference from the object reference list if contained. +func RemoveReference(refList []lssv1alpha1.ObjectReference, ref *lssv1alpha1.ObjectReference) []lssv1alpha1.ObjectReference { + for i, e := range refList { + if e.Equals(ref) { + refList[i] = refList[len(refList)-1] + refList = refList[:len(refList)-1] + break + } + } + return refList +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/LICENSE b/integration-test/vendor/github.com/gardener/landscaper/apis/LICENSE new file mode 100644 index 000000000..5431dc12a --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/LICENSE @@ -0,0 +1 @@ +LICENSES/Apache-2.0.txt \ No newline at end of file diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/doc.go new file mode 100644 index 000000000..d043a229f --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/doc.go @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=config.landscaper.gardener.cloud +package config diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/install/install.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/install/install.go new file mode 100644 index 000000000..bd0849d0e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/install/install.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package install + +import ( + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + + "github.com/gardener/landscaper/apis/config" + "github.com/gardener/landscaper/apis/config/v1alpha1" +) + +var ( + schemeBuilder = runtime.NewSchemeBuilder( + v1alpha1.AddToScheme, + config.AddToScheme, + setVersionPriority, + ) + + AddToScheme = schemeBuilder.AddToScheme +) + +func setVersionPriority(scheme *runtime.Scheme) error { + return scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion) +} + +// Install installs all APIs in the scheme. +func Install(scheme *runtime.Scheme) { + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/register.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/register.go new file mode 100644 index 000000000..2d67d1577 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/register.go @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package config + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the name of the Garden API group. +const GroupName = "config.landscaper.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &LandscaperConfiguration{}, + &AgentConfiguration{}, + ) + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/types_agent_config.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/types_agent_config.go new file mode 100644 index 000000000..ff108fce2 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/types_agent_config.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package config + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AgentConfiguration contains all configuration for the landscaper agent +type AgentConfiguration struct { + metav1.TypeMeta `json:",inline"` + // Name is the name for the agent and environment. + // This name has to be landscaper globally unique. + Name string `json:"name"` + // Namespace is the namespace in the host cluster where the deployers should be installed. + // Defaults to ls-system + // +optional + Namespace string `json:"namespace,omitempty"` + // OCI defines a oci registry to use for definitions + // +optional + OCI *OCIConfiguration `json:"oci,omitempty"` + // TargetSelectors defines the target selector that is applied to all installed deployers + // +optional + TargetSelectors []lsv1alpha1.TargetSelector `json:"targetSelectors,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/types_landscaper_config.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/types_landscaper_config.go new file mode 100644 index 000000000..65ffac2b6 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/types_landscaper_config.go @@ -0,0 +1,277 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package config + +import ( + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lscore "github.com/gardener/landscaper/apis/core" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// LandscaperConfiguration contains all configuration for the landscaper controllers +type LandscaperConfiguration struct { + metav1.TypeMeta + // Controllers contains all controller specific configuration. + Controllers Controllers + // RepositoryContext defines the default repository context that should be used to resolve component descriptors. + // DEPRECATED: use controllers.context.config.default.repositoryContext instead. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject + // Registry configures the landscaper registry to resolve component descriptors, blueprints and other artifacts. + Registry RegistryConfiguration + // BlueprintStore contains the configuration for the blueprint cache. + BlueprintStore BlueprintStore + // Metrics allows to configure how metrics are exposed + //+optional + Metrics *MetricsConfiguration + // CrdManagement configures whether the landscaper controller should deploy the CRDs it needs into the cluster + // +optional + CrdManagement CrdManagementConfiguration + // DeployerManagement configures the deployer management of the landscaper. + // +optional + DeployerManagement DeployerManagementConfiguration + // DeployItemTimeouts contains configuration for multiple deploy item timeouts + // +optional + DeployItemTimeouts *DeployItemTimeouts +} + +// CommonControllerConfig describes common controller configuration that can be included in +// the specific controller configurations. +type CommonControllerConfig struct { + // Workers is the maximum number of concurrent Reconciles which can be run. + // Defaults to 1. + Workers int + + // CacheSyncTimeout refers to the time limit set to wait for syncing the kubernetes resource caches. + // Defaults to 2 minutes if not set. + CacheSyncTimeout *metav1.Duration +} + +// Controllers contains all configuration for the specific controllers +type Controllers struct { + // SyncPeriod determines the minimum frequency at which watched resources are + // reconciled. A lower period will correct entropy more quickly, but reduce + // responsiveness to change if there are many watched resources. Change this + // value only if you know what you are doing. Defaults to 10 hours if unset. + // there will a 10 percent jitter between the SyncPeriod of all controllers + // so that all controllers will not send list requests simultaneously. + // + // This applies to all controllers. + // + // A period sync happens for two reasons: + // 1. To insure against a bug in the controller that causes an object to not + // be requeued, when it otherwise should be requeued. + // 2. To insure against an unknown bug in controller-runtime, or its dependencies, + // that causes an object to not be requeued, when it otherwise should be + // requeued, or to be removed from the queue, when it otherwise should not + // be removed. + SyncPeriod *metav1.Duration + // Installations contains the controller config that reconciles installations. + Installations InstallationsController + // Installations contains the controller config that reconciles executions. + Executions ExecutionsController + // DeployItems contains the controller config that reconciles deploy items. + DeployItems DeployItemsController + // ComponentOverwrites contains the controller config that reconciles component overwrite configuration objects. + ComponentOverwrites ComponentOverwritesController + // Contexts contains the controller config that reconciles context objects. + Contexts ContextsController +} + +// InstallationsController contains the controller config that reconciles installations. +type InstallationsController struct { + CommonControllerConfig +} + +// ExecutionsController contains the controller config that reconciles executions. +type ExecutionsController struct { + CommonControllerConfig +} + +// DeployItemsController contains the controller config that reconciles deploy items. +type DeployItemsController struct { + CommonControllerConfig +} + +// ComponentOverwritesController contains the controller config that reconciles component overwrite configuration objects. +type ComponentOverwritesController struct { + CommonControllerConfig +} + +// ContextsController contains all configuration for the context controller. +type ContextsController struct { + CommonControllerConfig + Config ContextControllerConfig +} + +// ContextControllerConfig contains the context specific configuration. +type ContextControllerConfig struct { + Default ContextControllerDefaultConfig +} + +// ContextControllerDefaultConfig contains the configuration for the context defaults. +type ContextControllerDefaultConfig struct { + // Disable disables the default controller. + // If disabled no default contexts are created. + Disable bool + // ExcludedNamespaces defines a list of namespaces where no default context should be created. + // +optional + ExcludedNamespaces []string + // RepositoryContext defines the default repository context that should be used to resolve component descriptors. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject +} + +// DeployItemTimeouts contains multiple timeout configurations for deploy items +type DeployItemTimeouts struct { + // PickupTimeout defines how long a deployer can take to react on changes to a deploy item before the landscaper will mark it as failed. + // Allowed values are 'none' (to disable pickup timeout detection) and anything that is understood by golang's time.ParseDuration method. + // Defaults to five minutes if not specified. + // +optional + Pickup *lscore.Duration + // Abort specifies how long the deployer may take to abort handling a deploy item after getting the abort annotation. + // Allowed values are 'none' (to disable abort timeout detection) and anything that is understood by golang's time.ParseDuration method. + // Defaults to five minutes if not specified. + // +optional + Abort *lscore.Duration + // ProgressingDefault specifies how long the deployer may take to apply a deploy item by default. The value can be overwritten per deploy item in 'spec.timeout'. + // Allowed values are 'none' (to disable abort timeout detection) and anything that is understood by golang's time.ParseDuration method. + // Defaults to ten minutes if not specified. + // +optional + ProgressingDefault *lscore.Duration +} + +// RegistryConfiguration contains the configuration for the used definition registry +type RegistryConfiguration struct { + // Local defines a local registry to use for definitions + // +optional + Local *LocalRegistryConfiguration `json:"local,omitempty"` + + // OCI defines a oci registry to use for definitions + // +optional + OCI *OCIConfiguration `json:"oci,omitempty"` +} + +// LocalRegistryConfiguration contains the configuration for a local registry +type LocalRegistryConfiguration struct { + // RootPath configures the root path of a local registry. + // This path is used to search for components locally. + RootPath string `json:"rootPath"` +} + +// OCIConfiguration holds configuration for the oci registry +type OCIConfiguration struct { + // ConfigFiles path to additional docker configuration files + // +optional + ConfigFiles []string `json:"configFiles,omitempty"` + + // Cache holds configuration for the oci cache + // +optional + Cache *OCICacheConfiguration `json:"cache,omitempty"` + + // AllowPlainHttp allows the fallback to http if https is not supported by the registry. + AllowPlainHttp bool `json:"allowPlainHttp"` + // InsecureSkipVerify skips the certificate validation of the oci registry + InsecureSkipVerify bool `json:"insecureSkipVerify"` +} + +// OCICacheConfiguration contains the configuration for the oci cache +type OCICacheConfiguration struct { + // UseInMemoryOverlay enables an additional in memory overlay cache of oci images + // +optional + UseInMemoryOverlay bool `json:"useInMemoryOverlay,omitempty"` + + // Path specifies the path to the oci cache on the filesystem. + // Defaults to /tmp/ocicache + // +optional + Path string `json:"path"` +} + +// MetricsConfiguration allows to configure how metrics are exposed +type MetricsConfiguration struct { + // Port specifies the port on which metrics are published + Port int32 `json:"port"` +} + +// CrdManagementConfiguration contains the configuration of the CRD management +type CrdManagementConfiguration struct { + // DeployCustomResourceDefinitions specifies if CRDs should be deployed + DeployCustomResourceDefinitions *bool `json:"deployCrd"` + + // ForceUpdate specifies whether existing CRDs should be updated + // +optional + ForceUpdate *bool `json:"forceUpdate,omitempty"` +} + +// DeployerManagementConfiguration contains the configuration of the deployer management +type DeployerManagementConfiguration struct { + // Disable disables the landscaper deployer management. + Disable bool `json:"disable"` + // Namespace defines the system namespace where the deployer installation should be deployed to. + Namespace string `json:"namespace"` + // Agent contains the landscaper agent configuration. + Agent LandscaperAgentConfiguration `json:"agent"` + // DeployerRepositoryContext defines the repository context to fetch the component descriptors for the + // default deployer (helm, container, manifest). If not set, the open source repository context is used. + // +optional + DeployerRepositoryContext *cdv2.UnstructuredTypedObject `json:"deployerRepositoryContext,omitempty"` +} + +// LandscaperAgentConfiguration is the landscaper specific agent configuration +type LandscaperAgentConfiguration struct { + // Disable disables the default agent that is started with the landscaper. + // This is automatically disabled if the deployment management is disabled. + Disable bool `json:"disable"` + AgentConfiguration `json:",inline"` +} + +// IndexMethod describes the blueprint store index method +type IndexMethod string + +const ( + // BlueprintDigestIndex describes a IndexMethod that uses the digest of the blueprint. + // This is useful if blueprints and component descriptors are not immutable (e.g. during development) + BlueprintDigestIndex IndexMethod = "BlueprintDigestIndex" + // ComponentDescriptorIdentityMethod describes a IndexMethod that uses the component descriptor identity. + // This means that the blueprint is uniquely identified using the component-descriptors repository, name and version + // with the blueprint resource identity. + ComponentDescriptorIdentityMethod IndexMethod = "ComponentDescriptorIdentityMethod" +) + +// BlueprintStore contains the configuration for the blueprint store. +type BlueprintStore struct { + // Path defines the root path where the blueprints are cached. + Path string + // DisableCache disables the cache and always fetches the blob from the registry. + // The blueprint is still stored on the filesystem. + DisableCache bool + // IndexMethod describes the method that should be used to index blueprints in the store. + // If component descriptors and blueprint are immutable (blueprints cannot be updated) use ComponentDescriptorIdentityMethod + // otherwise use the BlueprintDigestIndex to index by the content hash. + // Defaults to ComponentDescriptorIdentityMethod + // +optional + IndexMethod IndexMethod + GarbageCollectionConfiguration +} + +// GarbageCollectionConfiguration contains all options for the cache garbage collection. +type GarbageCollectionConfiguration struct { + // Size is the size of the filesystem. + // If the value is 0 there is no limit and no garbage collection will happen. + // See the kubernetes quantity docs for detailed description of the format + // https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go + Size string + // GCHighThreshold defines the percent of disk usage which triggers files garbage collection. + GCHighThreshold float64 + // GCLowThreshold defines the percent of disk usage to which files garbage collection attempts to free. + GCLowThreshold float64 + // ResetInterval defines the interval when the hit reset should run. + ResetInterval metav1.Duration + // PreservedHitsProportion defines the percent of hits that should be preserved. + PreservedHitsProportion float64 +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/defaults.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/defaults.go new file mode 100644 index 000000000..2fa60d76a --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/defaults.go @@ -0,0 +1,154 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "time" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/utils/pointer" + + "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_LandscaperConfiguration sets the defaults for the landscaper configuration. +func SetDefaults_LandscaperConfiguration(obj *LandscaperConfiguration) { + if obj.Registry.OCI == nil { + obj.Registry.OCI = &OCIConfiguration{} + } + if obj.Registry.OCI.Cache == nil { + obj.Registry.OCI.Cache = &OCICacheConfiguration{ + UseInMemoryOverlay: false, + } + } + + SetDefaults_CommonControllerConfig(&obj.Controllers.Installations.CommonControllerConfig) + SetDefaults_CommonControllerConfig(&obj.Controllers.Executions.CommonControllerConfig) + SetDefaults_CommonControllerConfig(&obj.Controllers.DeployItems.CommonControllerConfig) + SetDefaults_CommonControllerConfig(&obj.Controllers.ComponentOverwrites.CommonControllerConfig) + SetDefaults_CommonControllerConfig(&obj.Controllers.Contexts.CommonControllerConfig) + + if len(obj.DeployerManagement.Namespace) == 0 { + obj.DeployerManagement.Namespace = "ls-system" + } + if obj.DeployItemTimeouts == nil { + obj.DeployItemTimeouts = &DeployItemTimeouts{} + } + if obj.DeployItemTimeouts.Pickup == nil { + obj.DeployItemTimeouts.Pickup = &v1alpha1.Duration{Duration: 5 * time.Minute} + } + if obj.DeployItemTimeouts.Abort == nil { + obj.DeployItemTimeouts.Abort = &v1alpha1.Duration{Duration: 5 * time.Minute} + } + if obj.DeployItemTimeouts.ProgressingDefault == nil { + obj.DeployItemTimeouts.ProgressingDefault = &v1alpha1.Duration{Duration: 10 * time.Minute} + } + + SetDefaults_BlueprintStore(&obj.BlueprintStore) + SetDefaults_CrdManagementConfiguration(&obj.CrdManagement) + + if obj.RepositoryContext != nil && obj.Controllers.Contexts.Config.Default.RepositoryContext == nil { + // migrate the repository context to the new structure. + // The old location is ignored if a repository context is defined in the new location. + obj.Controllers.Contexts.Config.Default.RepositoryContext = obj.RepositoryContext + } + + if obj.DeployerManagement.Disable { + obj.DeployerManagement.Agent.Disable = true + } + if len(obj.DeployerManagement.Agent.Name) == 0 { + obj.DeployerManagement.Agent.Name = "default" + } + if len(obj.DeployerManagement.Agent.Namespace) == 0 { + obj.DeployerManagement.Agent.Namespace = obj.DeployerManagement.Namespace + } + if obj.DeployerManagement.Agent.OCI == nil { + obj.DeployerManagement.Agent.OCI = obj.Registry.OCI + } + + if obj.DeployerManagement.DeployerRepositoryContext == nil { + defaultCtx, _ := cdv2.NewUnstructured(cdv2.NewOCIRegistryRepository("eu.gcr.io/gardener-project/development", "")) + obj.DeployerManagement.DeployerRepositoryContext = &defaultCtx + } +} + +// SetDefaults_CrdManagementConfiguration sets the defaults for the crd management configuration. +func SetDefaults_CrdManagementConfiguration(obj *CrdManagementConfiguration) { + if obj.DeployCustomResourceDefinitions == nil { + obj.DeployCustomResourceDefinitions = pointer.BoolPtr(true) + } + if obj.ForceUpdate == nil { + obj.ForceUpdate = pointer.BoolPtr(true) + } +} + +// SetDefaults_CommonControllerConfig sets the defaults for the CommonControllerConfig. +func SetDefaults_CommonControllerConfig(obj *CommonControllerConfig) { + if obj.Workers == 0 { + obj.Workers = 1 + } + if obj.CacheSyncTimeout == nil { + obj.CacheSyncTimeout = &metav1.Duration{ + Duration: 2 * time.Minute, + } + } +} + +// SetDefaults_AgentConfiguration sets the defaults for the landscaper configuration. +func SetDefaults_AgentConfiguration(obj *AgentConfiguration) { + if len(obj.Namespace) == 0 { + obj.Namespace = "ls-system" + } +} + +// SetDefaults_BlueprintStore sets the defaults for the landscaper blueprint store configuration. +func SetDefaults_BlueprintStore(obj *BlueprintStore) { + // GCHighThreshold defines the default percent of disk usage which triggers files garbage collection. + const GCHighThreshold float64 = 0.85 + + // GCLowThreshold defines the default percent of disk usage to which files garbage collection attempts to free. + const GCLowThreshold float64 = 0.80 + + // ResetInterval defines the default interval when the hit reset should run. + ResetInterval := metav1.Duration{Duration: 1 * time.Hour} + + // PreservedHitsProportion defines the default percent of hits that should be preserved. + const PreservedHitsProportion = 0.5 + + if len(obj.IndexMethod) == 0 { + obj.IndexMethod = BlueprintDigestIndex + } + + if obj.Size == "0" { + // no garbage collection configured ignore all other values + return + } + + if len(obj.Size) == 0 { + obj.Size = "250Mi" + } + + if obj.GCHighThreshold == 0 { + obj.GCHighThreshold = GCHighThreshold + } + if obj.GCLowThreshold == 0 { + obj.GCLowThreshold = GCLowThreshold + } + + if obj.ResetInterval == nil { + obj.ResetInterval = &ResetInterval + } + + if obj.PreservedHitsProportion == 0 { + obj.PreservedHitsProportion = PreservedHitsProportion + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/doc.go new file mode 100644 index 000000000..ad00580d9 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/doc.go @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=github.com/gardener/landscaper/apis/config +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=config.landscaper.gardener.cloud +package v1alpha1 diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/register.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/register.go new file mode 100644 index 000000000..d1f0fa677 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/register.go @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the name of the Garden API group. +const GroupName = "config.landscaper.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &LandscaperConfiguration{}, + &AgentConfiguration{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return addDefaultingFuncs(scheme) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/types_agent_config.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/types_agent_config.go new file mode 100644 index 000000000..831a6236d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/types_agent_config.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AgentConfiguration contains all configuration for the landscaper agent +type AgentConfiguration struct { + metav1.TypeMeta `json:",inline"` + // Name is the name for the agent and environment. + // This name has to be landscaper globally unique. + Name string `json:"name"` + // Namespace is the namespace in the host cluster where the deployers should be installed. + // Defaults to ls-system + // +optional + Namespace string `json:"namespace,omitempty"` + // OCI defines a oci registry to use for definitions + // +optional + OCI *OCIConfiguration `json:"oci,omitempty"` + // TargetSelectors defines the target selector that is applied to all installed deployers + // +optional + TargetSelectors []lsv1alpha1.TargetSelector `json:"targetSelectors,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/types_landscaper_config.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/types_landscaper_config.go new file mode 100644 index 000000000..a68cdb051 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/types_landscaper_config.go @@ -0,0 +1,277 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// LandscaperConfiguration contains all configuration for the landscaper controllers +type LandscaperConfiguration struct { + metav1.TypeMeta `json:",inline"` + // Controllers contains all controller specific configuration. + Controllers Controllers `json:"controllers"` + // RepositoryContext defines the default repository context that should be used to resolve component descriptors. + // DEPRECATED: use controllers.context.config.default.repositoryContext instead. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject `json:"repositoryContext,omitempty"` + // Registry configures the landscaper registry to resolve component descriptors, blueprints and other artifacts. + Registry RegistryConfiguration `json:"registry"` + // BlueprintStore contains the configuration for the blueprint cache. + BlueprintStore BlueprintStore `json:"blueprintStore"` + // Metrics allows to configure how metrics are exposed + //+optional + Metrics *MetricsConfiguration `json:"metrics,omitempty"` + // CrdManagement configures whether the landscaper controller should deploy the CRDs it needs into the cluster + // +optional + CrdManagement CrdManagementConfiguration `json:"crdManagement,omitempty"` + // DeployerManagement configures the deployer management of the landscaper. + // +optional + DeployerManagement DeployerManagementConfiguration `json:"deployerManagement,omitempty"` + // DeployItemTimeouts contains configuration for multiple deploy item timeouts + // +optional + DeployItemTimeouts *DeployItemTimeouts `json:"deployItemTimeouts,omitempty"` +} + +// CommonControllerConfig describes common controller configuration that can be included in +// the specific controller configurations. +type CommonControllerConfig struct { + // Workers is the maximum number of concurrent Reconciles which can be run. + // Defaults to 1. + Workers int `json:"workers"` + + // CacheSyncTimeout refers to the time limit set to wait for syncing the kubernetes resource caches. + // Defaults to 2 minutes if not set. + CacheSyncTimeout *metav1.Duration `json:"cacheSyncTimeout"` +} + +// Controllers contains all configuration for the specific controllers +type Controllers struct { + // SyncPeriod determines the minimum frequency at which watched resources are + // reconciled. A lower period will correct entropy more quickly, but reduce + // responsiveness to change if there are many watched resources. Change this + // value only if you know what you are doing. Defaults to 10 hours if unset. + // there will a 10 percent jitter between the SyncPeriod of all controllers + // so that all controllers will not send list requests simultaneously. + // + // This applies to all controllers. + // + // A period sync happens for two reasons: + // 1. To insure against a bug in the controller that causes an object to not + // be requeued, when it otherwise should be requeued. + // 2. To insure against an unknown bug in controller-runtime, or its dependencies, + // that causes an object to not be requeued, when it otherwise should be + // requeued, or to be removed from the queue, when it otherwise should not + // be removed. + SyncPeriod *metav1.Duration `json:"syncPeriod"` + // Installations contains the controller config that reconciles installations. + Installations InstallationsController `json:"installations"` + // Installations contains the controller config that reconciles executions. + Executions ExecutionsController `json:"executions"` + // DeployItems contains the controller config that reconciles deploy items. + DeployItems DeployItemsController `json:"deployItems"` + // ComponentOverwrites contains the controller config that reconciles component overwrite configuration objects. + ComponentOverwrites ComponentOverwritesController `json:"componentOverwrites"` + // Contexts contains the controller config that reconciles context objects. + Contexts ContextsController `json:"contexts"` +} + +// InstallationsController contains the controller config that reconciles installations. +type InstallationsController struct { + CommonControllerConfig +} + +// ExecutionsController contains the controller config that reconciles executions. +type ExecutionsController struct { + CommonControllerConfig +} + +// DeployItemsController contains the controller config that reconciles deploy items. +type DeployItemsController struct { + CommonControllerConfig +} + +// ComponentOverwritesController contains the controller config that reconciles component overwrite configuration objects. +type ComponentOverwritesController struct { + CommonControllerConfig +} + +// ContextsController contains all configuration for the context controller. +type ContextsController struct { + CommonControllerConfig + Config ContextControllerConfig `json:"config"` +} + +// ContextControllerConfig contains the context specific configuration. +type ContextControllerConfig struct { + Default ContextControllerDefaultConfig `json:"default"` +} + +// ContextControllerDefaultConfig contains the configuration for the context defaults. +type ContextControllerDefaultConfig struct { + // Disable disables the default controller. + // If disabled no default contexts are created. + Disable bool `json:"disable"` + // ExcludedNamespaces defines a list of namespaces where no default context should be created. + // +optional + ExcludedNamespaces []string `json:"excludedNamespaces"` + // RepositoryContext defines the default repository context that should be used to resolve component descriptors. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject `json:"repositoryContext,omitempty"` +} + +// DeployItemTimeouts contains multiple timeout configurations for deploy items +type DeployItemTimeouts struct { + // PickupTimeout defines how long a deployer can take to react on changes to a deploy item before the landscaper will mark it as failed. + // Allowed values are 'none' (to disable pickup timeout detection) and anything that is understood by golang's time.ParseDuration method. + // Defaults to five minutes if not specified. + // +optional + Pickup *lsv1alpha1.Duration `json:"pickup,omitempty"` + // Abort specifies how long the deployer may take to abort handling a deploy item after getting the abort annotation. + // Allowed values are 'none' (to disable abort timeout detection) and anything that is understood by golang's time.ParseDuration method. + // Defaults to five minutes if not specified. + // +optional + Abort *lsv1alpha1.Duration `json:"abort,omitempty"` + // ProgressingDefault specifies how long the deployer may take to apply a deploy item by default. The value can be overwritten per deploy item in 'spec.timeout'. + // Allowed values are 'none' (to disable abort timeout detection) and anything that is understood by golang's time.ParseDuration method. + // Defaults to ten minutes if not specified. + // +optional + ProgressingDefault *lsv1alpha1.Duration `json:"progressingDefault,omitempty"` +} + +// RegistryConfiguration contains the configuration for the used definition registry +type RegistryConfiguration struct { + // Local defines a local registry to use for definitions + // +optional + Local *LocalRegistryConfiguration `json:"local,omitempty"` + + // OCI defines a oci registry to use for definitions + // +optional + OCI *OCIConfiguration `json:"oci,omitempty"` +} + +// LocalRegistryConfiguration contains the configuration for a local registry +type LocalRegistryConfiguration struct { + // RootPath configures the root path of a local registry. + // This path is used to search for components locally. + RootPath string `json:"rootPath"` +} + +// OCIConfiguration holds configuration for the oci registry +type OCIConfiguration struct { + // ConfigFiles path to additional docker configuration files + // +optional + ConfigFiles []string `json:"configFiles,omitempty"` + + // Cache holds configuration for the oci cache + // +optional + Cache *OCICacheConfiguration `json:"cache,omitempty"` + + // AllowPlainHttp allows the fallback to http if https is not supported by the registry. + AllowPlainHttp bool `json:"allowPlainHttp"` + // InsecureSkipVerify skips the certificate validation of the oci registry + InsecureSkipVerify bool `json:"insecureSkipVerify"` +} + +// OCICacheConfiguration contains the configuration for the oci cache +type OCICacheConfiguration struct { + // UseInMemoryOverlay enables an additional in memory overlay cache of oci images + // +optional + UseInMemoryOverlay bool `json:"useInMemoryOverlay,omitempty"` + + // Path specifies the path to the oci cache on the filesystem. + // Defaults to /tmp/ocicache + // +optional + Path string `json:"path"` +} + +// MetricsConfiguration allows to configure how metrics are exposed +type MetricsConfiguration struct { + // Port specifies the port on which metrics are published + Port int32 `json:"port"` +} + +// CrdManagementConfiguration contains the configuration of the CRD management +type CrdManagementConfiguration struct { + // DeployCustomResourceDefinitions specifies if CRDs should be deployed + DeployCustomResourceDefinitions *bool `json:"deployCrd"` + + // ForceUpdate specifies whether existing CRDs should be updated + // +optional + ForceUpdate *bool `json:"forceUpdate,omitempty"` +} + +// DeployerManagementConfiguration contains the configuration of the deployer management +type DeployerManagementConfiguration struct { + // Disable disables the landscaper deployer management. + Disable bool `json:"disable"` + // Namespace defines the system namespace where the deployer installation should be deployed to. + Namespace string `json:"namespace"` + // Agent contains the landscaper agent configuration. + Agent LandscaperAgentConfiguration `json:"agent"` + // DeployerRepositoryContext defines the repository context to fetch the component descriptors for the + // default deployer (helm, container, manifest). If not set, the open source repository context is used. + // +optional + DeployerRepositoryContext *cdv2.UnstructuredTypedObject `json:"deployerRepositoryContext,omitempty"` +} + +// LandscaperAgentConfiguration is the landscaper specific agent configuration +type LandscaperAgentConfiguration struct { + // Disable disables the default agent that is started with the landscaper. + // This is automatically disabled if the deployment management is disabled. + Disable bool `json:"disable"` + AgentConfiguration `json:",inline"` +} + +// IndexMethod describes the blueprint store index method +type IndexMethod string + +const ( + // BlueprintDigestIndex describes a IndexMethod that uses the digest of the blueprint. + // This is useful if blueprints and component descriptors are not immutable (e.g. during development) + BlueprintDigestIndex IndexMethod = "BlueprintDigestIndex" + // ComponentDescriptorIdentityMethod describes a IndexMethod that uses the component descriptor identity. + // This means that the blueprint is uniquely identified using the component-descriptors repository, name and version + // with the blueprint resource identity. + ComponentDescriptorIdentityMethod IndexMethod = "ComponentDescriptorIdentityMethod" +) + +// BlueprintStore contains the configuration for the blueprint store. +type BlueprintStore struct { + // Path defines the root path where the blueprints are cached. + Path string `json:"path"` + // DisableCache disables the cache and always fetches the blob from the registry. + // The blueprint is still stored on the filesystem. + DisableCache bool `json:"disableCache"` + // IndexMethod describes the method that should be used to index blueprints in the store. + // If component descriptors and blueprint are immutable (blueprints cannot be updated) use ComponentDescriptorIdentityMethod + // otherwise use the BlueprintDigestIndex to index by the content hash. + // Defaults to ComponentDescriptorIdentityMethod + // +optional + IndexMethod IndexMethod `json:"indexMethod"` + GarbageCollectionConfiguration +} + +// GarbageCollectionConfiguration contains all options for the cache garbage collection. +type GarbageCollectionConfiguration struct { + // Size is the size of the filesystem. + // If the value is 0 there is no limit and no garbage collection will happen. + // See the kubernetes quantity docs for detailed description of the format + // https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go + Size string `json:"size,omitempty"` + // GCHighThreshold defines the percent of disk usage which triggers files garbage collection. + GCHighThreshold float64 `json:"gcHighThreshold,omitempty"` + // GCLowThreshold defines the percent of disk usage to which files garbage collection attempts to free. + GCLowThreshold float64 `json:"gcLowThreshold"` + // ResetInterval defines the interval when the hit reset should run. + ResetInterval *metav1.Duration `json:"resetInterval,omitempty"` + // PreservedHitsProportion defines the percent of hits that should be preserved. + PreservedHitsProportion float64 `json:"preservedHitsProportion,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.conversion.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000..66bbfebd8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,854 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + + config "github.com/gardener/landscaper/apis/config" + core "github.com/gardener/landscaper/apis/core" + corev1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*AgentConfiguration)(nil), (*config.AgentConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AgentConfiguration_To_config_AgentConfiguration(a.(*AgentConfiguration), b.(*config.AgentConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.AgentConfiguration)(nil), (*AgentConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_AgentConfiguration_To_v1alpha1_AgentConfiguration(a.(*config.AgentConfiguration), b.(*AgentConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BlueprintStore)(nil), (*config.BlueprintStore)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BlueprintStore_To_config_BlueprintStore(a.(*BlueprintStore), b.(*config.BlueprintStore), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.BlueprintStore)(nil), (*BlueprintStore)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_BlueprintStore_To_v1alpha1_BlueprintStore(a.(*config.BlueprintStore), b.(*BlueprintStore), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CommonControllerConfig)(nil), (*config.CommonControllerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(a.(*CommonControllerConfig), b.(*config.CommonControllerConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.CommonControllerConfig)(nil), (*CommonControllerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(a.(*config.CommonControllerConfig), b.(*CommonControllerConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentOverwritesController)(nil), (*config.ComponentOverwritesController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentOverwritesController_To_config_ComponentOverwritesController(a.(*ComponentOverwritesController), b.(*config.ComponentOverwritesController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.ComponentOverwritesController)(nil), (*ComponentOverwritesController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_ComponentOverwritesController_To_v1alpha1_ComponentOverwritesController(a.(*config.ComponentOverwritesController), b.(*ComponentOverwritesController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ContextControllerConfig)(nil), (*config.ContextControllerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ContextControllerConfig_To_config_ContextControllerConfig(a.(*ContextControllerConfig), b.(*config.ContextControllerConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.ContextControllerConfig)(nil), (*ContextControllerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_ContextControllerConfig_To_v1alpha1_ContextControllerConfig(a.(*config.ContextControllerConfig), b.(*ContextControllerConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ContextControllerDefaultConfig)(nil), (*config.ContextControllerDefaultConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ContextControllerDefaultConfig_To_config_ContextControllerDefaultConfig(a.(*ContextControllerDefaultConfig), b.(*config.ContextControllerDefaultConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.ContextControllerDefaultConfig)(nil), (*ContextControllerDefaultConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_ContextControllerDefaultConfig_To_v1alpha1_ContextControllerDefaultConfig(a.(*config.ContextControllerDefaultConfig), b.(*ContextControllerDefaultConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ContextsController)(nil), (*config.ContextsController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ContextsController_To_config_ContextsController(a.(*ContextsController), b.(*config.ContextsController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.ContextsController)(nil), (*ContextsController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_ContextsController_To_v1alpha1_ContextsController(a.(*config.ContextsController), b.(*ContextsController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Controllers)(nil), (*config.Controllers)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Controllers_To_config_Controllers(a.(*Controllers), b.(*config.Controllers), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.Controllers)(nil), (*Controllers)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_Controllers_To_v1alpha1_Controllers(a.(*config.Controllers), b.(*Controllers), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CrdManagementConfiguration)(nil), (*config.CrdManagementConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CrdManagementConfiguration_To_config_CrdManagementConfiguration(a.(*CrdManagementConfiguration), b.(*config.CrdManagementConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.CrdManagementConfiguration)(nil), (*CrdManagementConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_CrdManagementConfiguration_To_v1alpha1_CrdManagementConfiguration(a.(*config.CrdManagementConfiguration), b.(*CrdManagementConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployItemTimeouts)(nil), (*config.DeployItemTimeouts)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItemTimeouts_To_config_DeployItemTimeouts(a.(*DeployItemTimeouts), b.(*config.DeployItemTimeouts), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.DeployItemTimeouts)(nil), (*DeployItemTimeouts)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_DeployItemTimeouts_To_v1alpha1_DeployItemTimeouts(a.(*config.DeployItemTimeouts), b.(*DeployItemTimeouts), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployItemsController)(nil), (*config.DeployItemsController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItemsController_To_config_DeployItemsController(a.(*DeployItemsController), b.(*config.DeployItemsController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.DeployItemsController)(nil), (*DeployItemsController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_DeployItemsController_To_v1alpha1_DeployItemsController(a.(*config.DeployItemsController), b.(*DeployItemsController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployerManagementConfiguration)(nil), (*config.DeployerManagementConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployerManagementConfiguration_To_config_DeployerManagementConfiguration(a.(*DeployerManagementConfiguration), b.(*config.DeployerManagementConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.DeployerManagementConfiguration)(nil), (*DeployerManagementConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_DeployerManagementConfiguration_To_v1alpha1_DeployerManagementConfiguration(a.(*config.DeployerManagementConfiguration), b.(*DeployerManagementConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExecutionsController)(nil), (*config.ExecutionsController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExecutionsController_To_config_ExecutionsController(a.(*ExecutionsController), b.(*config.ExecutionsController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.ExecutionsController)(nil), (*ExecutionsController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_ExecutionsController_To_v1alpha1_ExecutionsController(a.(*config.ExecutionsController), b.(*ExecutionsController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GarbageCollectionConfiguration)(nil), (*config.GarbageCollectionConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GarbageCollectionConfiguration_To_config_GarbageCollectionConfiguration(a.(*GarbageCollectionConfiguration), b.(*config.GarbageCollectionConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.GarbageCollectionConfiguration)(nil), (*GarbageCollectionConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_GarbageCollectionConfiguration_To_v1alpha1_GarbageCollectionConfiguration(a.(*config.GarbageCollectionConfiguration), b.(*GarbageCollectionConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallationsController)(nil), (*config.InstallationsController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallationsController_To_config_InstallationsController(a.(*InstallationsController), b.(*config.InstallationsController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.InstallationsController)(nil), (*InstallationsController)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_InstallationsController_To_v1alpha1_InstallationsController(a.(*config.InstallationsController), b.(*InstallationsController), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LandscaperAgentConfiguration)(nil), (*config.LandscaperAgentConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LandscaperAgentConfiguration_To_config_LandscaperAgentConfiguration(a.(*LandscaperAgentConfiguration), b.(*config.LandscaperAgentConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.LandscaperAgentConfiguration)(nil), (*LandscaperAgentConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_LandscaperAgentConfiguration_To_v1alpha1_LandscaperAgentConfiguration(a.(*config.LandscaperAgentConfiguration), b.(*LandscaperAgentConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LandscaperConfiguration)(nil), (*config.LandscaperConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LandscaperConfiguration_To_config_LandscaperConfiguration(a.(*LandscaperConfiguration), b.(*config.LandscaperConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.LandscaperConfiguration)(nil), (*LandscaperConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(a.(*config.LandscaperConfiguration), b.(*LandscaperConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LocalRegistryConfiguration)(nil), (*config.LocalRegistryConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LocalRegistryConfiguration_To_config_LocalRegistryConfiguration(a.(*LocalRegistryConfiguration), b.(*config.LocalRegistryConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.LocalRegistryConfiguration)(nil), (*LocalRegistryConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_LocalRegistryConfiguration_To_v1alpha1_LocalRegistryConfiguration(a.(*config.LocalRegistryConfiguration), b.(*LocalRegistryConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MetricsConfiguration)(nil), (*config.MetricsConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_MetricsConfiguration_To_config_MetricsConfiguration(a.(*MetricsConfiguration), b.(*config.MetricsConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.MetricsConfiguration)(nil), (*MetricsConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_MetricsConfiguration_To_v1alpha1_MetricsConfiguration(a.(*config.MetricsConfiguration), b.(*MetricsConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCICacheConfiguration)(nil), (*config.OCICacheConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_OCICacheConfiguration_To_config_OCICacheConfiguration(a.(*OCICacheConfiguration), b.(*config.OCICacheConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.OCICacheConfiguration)(nil), (*OCICacheConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_OCICacheConfiguration_To_v1alpha1_OCICacheConfiguration(a.(*config.OCICacheConfiguration), b.(*OCICacheConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIConfiguration)(nil), (*config.OCIConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_OCIConfiguration_To_config_OCIConfiguration(a.(*OCIConfiguration), b.(*config.OCIConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.OCIConfiguration)(nil), (*OCIConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_OCIConfiguration_To_v1alpha1_OCIConfiguration(a.(*config.OCIConfiguration), b.(*OCIConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RegistryConfiguration)(nil), (*config.RegistryConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RegistryConfiguration_To_config_RegistryConfiguration(a.(*RegistryConfiguration), b.(*config.RegistryConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*config.RegistryConfiguration)(nil), (*RegistryConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_config_RegistryConfiguration_To_v1alpha1_RegistryConfiguration(a.(*config.RegistryConfiguration), b.(*RegistryConfiguration), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_AgentConfiguration_To_config_AgentConfiguration(in *AgentConfiguration, out *config.AgentConfiguration, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + out.OCI = (*config.OCIConfiguration)(unsafe.Pointer(in.OCI)) + out.TargetSelectors = *(*[]corev1alpha1.TargetSelector)(unsafe.Pointer(&in.TargetSelectors)) + return nil +} + +// Convert_v1alpha1_AgentConfiguration_To_config_AgentConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_AgentConfiguration_To_config_AgentConfiguration(in *AgentConfiguration, out *config.AgentConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_AgentConfiguration_To_config_AgentConfiguration(in, out, s) +} + +func autoConvert_config_AgentConfiguration_To_v1alpha1_AgentConfiguration(in *config.AgentConfiguration, out *AgentConfiguration, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + out.OCI = (*OCIConfiguration)(unsafe.Pointer(in.OCI)) + out.TargetSelectors = *(*[]corev1alpha1.TargetSelector)(unsafe.Pointer(&in.TargetSelectors)) + return nil +} + +// Convert_config_AgentConfiguration_To_v1alpha1_AgentConfiguration is an autogenerated conversion function. +func Convert_config_AgentConfiguration_To_v1alpha1_AgentConfiguration(in *config.AgentConfiguration, out *AgentConfiguration, s conversion.Scope) error { + return autoConvert_config_AgentConfiguration_To_v1alpha1_AgentConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_BlueprintStore_To_config_BlueprintStore(in *BlueprintStore, out *config.BlueprintStore, s conversion.Scope) error { + out.Path = in.Path + out.DisableCache = in.DisableCache + out.IndexMethod = config.IndexMethod(in.IndexMethod) + if err := Convert_v1alpha1_GarbageCollectionConfiguration_To_config_GarbageCollectionConfiguration(&in.GarbageCollectionConfiguration, &out.GarbageCollectionConfiguration, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_BlueprintStore_To_config_BlueprintStore is an autogenerated conversion function. +func Convert_v1alpha1_BlueprintStore_To_config_BlueprintStore(in *BlueprintStore, out *config.BlueprintStore, s conversion.Scope) error { + return autoConvert_v1alpha1_BlueprintStore_To_config_BlueprintStore(in, out, s) +} + +func autoConvert_config_BlueprintStore_To_v1alpha1_BlueprintStore(in *config.BlueprintStore, out *BlueprintStore, s conversion.Scope) error { + out.Path = in.Path + out.DisableCache = in.DisableCache + out.IndexMethod = IndexMethod(in.IndexMethod) + if err := Convert_config_GarbageCollectionConfiguration_To_v1alpha1_GarbageCollectionConfiguration(&in.GarbageCollectionConfiguration, &out.GarbageCollectionConfiguration, s); err != nil { + return err + } + return nil +} + +// Convert_config_BlueprintStore_To_v1alpha1_BlueprintStore is an autogenerated conversion function. +func Convert_config_BlueprintStore_To_v1alpha1_BlueprintStore(in *config.BlueprintStore, out *BlueprintStore, s conversion.Scope) error { + return autoConvert_config_BlueprintStore_To_v1alpha1_BlueprintStore(in, out, s) +} + +func autoConvert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(in *CommonControllerConfig, out *config.CommonControllerConfig, s conversion.Scope) error { + out.Workers = in.Workers + out.CacheSyncTimeout = (*v1.Duration)(unsafe.Pointer(in.CacheSyncTimeout)) + return nil +} + +// Convert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig is an autogenerated conversion function. +func Convert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(in *CommonControllerConfig, out *config.CommonControllerConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(in, out, s) +} + +func autoConvert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(in *config.CommonControllerConfig, out *CommonControllerConfig, s conversion.Scope) error { + out.Workers = in.Workers + out.CacheSyncTimeout = (*v1.Duration)(unsafe.Pointer(in.CacheSyncTimeout)) + return nil +} + +// Convert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig is an autogenerated conversion function. +func Convert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(in *config.CommonControllerConfig, out *CommonControllerConfig, s conversion.Scope) error { + return autoConvert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(in, out, s) +} + +func autoConvert_v1alpha1_ComponentOverwritesController_To_config_ComponentOverwritesController(in *ComponentOverwritesController, out *config.ComponentOverwritesController, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ComponentOverwritesController_To_config_ComponentOverwritesController is an autogenerated conversion function. +func Convert_v1alpha1_ComponentOverwritesController_To_config_ComponentOverwritesController(in *ComponentOverwritesController, out *config.ComponentOverwritesController, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentOverwritesController_To_config_ComponentOverwritesController(in, out, s) +} + +func autoConvert_config_ComponentOverwritesController_To_v1alpha1_ComponentOverwritesController(in *config.ComponentOverwritesController, out *ComponentOverwritesController, s conversion.Scope) error { + if err := Convert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_config_ComponentOverwritesController_To_v1alpha1_ComponentOverwritesController is an autogenerated conversion function. +func Convert_config_ComponentOverwritesController_To_v1alpha1_ComponentOverwritesController(in *config.ComponentOverwritesController, out *ComponentOverwritesController, s conversion.Scope) error { + return autoConvert_config_ComponentOverwritesController_To_v1alpha1_ComponentOverwritesController(in, out, s) +} + +func autoConvert_v1alpha1_ContextControllerConfig_To_config_ContextControllerConfig(in *ContextControllerConfig, out *config.ContextControllerConfig, s conversion.Scope) error { + if err := Convert_v1alpha1_ContextControllerDefaultConfig_To_config_ContextControllerDefaultConfig(&in.Default, &out.Default, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ContextControllerConfig_To_config_ContextControllerConfig is an autogenerated conversion function. +func Convert_v1alpha1_ContextControllerConfig_To_config_ContextControllerConfig(in *ContextControllerConfig, out *config.ContextControllerConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_ContextControllerConfig_To_config_ContextControllerConfig(in, out, s) +} + +func autoConvert_config_ContextControllerConfig_To_v1alpha1_ContextControllerConfig(in *config.ContextControllerConfig, out *ContextControllerConfig, s conversion.Scope) error { + if err := Convert_config_ContextControllerDefaultConfig_To_v1alpha1_ContextControllerDefaultConfig(&in.Default, &out.Default, s); err != nil { + return err + } + return nil +} + +// Convert_config_ContextControllerConfig_To_v1alpha1_ContextControllerConfig is an autogenerated conversion function. +func Convert_config_ContextControllerConfig_To_v1alpha1_ContextControllerConfig(in *config.ContextControllerConfig, out *ContextControllerConfig, s conversion.Scope) error { + return autoConvert_config_ContextControllerConfig_To_v1alpha1_ContextControllerConfig(in, out, s) +} + +func autoConvert_v1alpha1_ContextControllerDefaultConfig_To_config_ContextControllerDefaultConfig(in *ContextControllerDefaultConfig, out *config.ContextControllerDefaultConfig, s conversion.Scope) error { + out.Disable = in.Disable + out.ExcludedNamespaces = *(*[]string)(unsafe.Pointer(&in.ExcludedNamespaces)) + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + return nil +} + +// Convert_v1alpha1_ContextControllerDefaultConfig_To_config_ContextControllerDefaultConfig is an autogenerated conversion function. +func Convert_v1alpha1_ContextControllerDefaultConfig_To_config_ContextControllerDefaultConfig(in *ContextControllerDefaultConfig, out *config.ContextControllerDefaultConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_ContextControllerDefaultConfig_To_config_ContextControllerDefaultConfig(in, out, s) +} + +func autoConvert_config_ContextControllerDefaultConfig_To_v1alpha1_ContextControllerDefaultConfig(in *config.ContextControllerDefaultConfig, out *ContextControllerDefaultConfig, s conversion.Scope) error { + out.Disable = in.Disable + out.ExcludedNamespaces = *(*[]string)(unsafe.Pointer(&in.ExcludedNamespaces)) + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + return nil +} + +// Convert_config_ContextControllerDefaultConfig_To_v1alpha1_ContextControllerDefaultConfig is an autogenerated conversion function. +func Convert_config_ContextControllerDefaultConfig_To_v1alpha1_ContextControllerDefaultConfig(in *config.ContextControllerDefaultConfig, out *ContextControllerDefaultConfig, s conversion.Scope) error { + return autoConvert_config_ContextControllerDefaultConfig_To_v1alpha1_ContextControllerDefaultConfig(in, out, s) +} + +func autoConvert_v1alpha1_ContextsController_To_config_ContextsController(in *ContextsController, out *config.ContextsController, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + if err := Convert_v1alpha1_ContextControllerConfig_To_config_ContextControllerConfig(&in.Config, &out.Config, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ContextsController_To_config_ContextsController is an autogenerated conversion function. +func Convert_v1alpha1_ContextsController_To_config_ContextsController(in *ContextsController, out *config.ContextsController, s conversion.Scope) error { + return autoConvert_v1alpha1_ContextsController_To_config_ContextsController(in, out, s) +} + +func autoConvert_config_ContextsController_To_v1alpha1_ContextsController(in *config.ContextsController, out *ContextsController, s conversion.Scope) error { + if err := Convert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + if err := Convert_config_ContextControllerConfig_To_v1alpha1_ContextControllerConfig(&in.Config, &out.Config, s); err != nil { + return err + } + return nil +} + +// Convert_config_ContextsController_To_v1alpha1_ContextsController is an autogenerated conversion function. +func Convert_config_ContextsController_To_v1alpha1_ContextsController(in *config.ContextsController, out *ContextsController, s conversion.Scope) error { + return autoConvert_config_ContextsController_To_v1alpha1_ContextsController(in, out, s) +} + +func autoConvert_v1alpha1_Controllers_To_config_Controllers(in *Controllers, out *config.Controllers, s conversion.Scope) error { + out.SyncPeriod = (*v1.Duration)(unsafe.Pointer(in.SyncPeriod)) + if err := Convert_v1alpha1_InstallationsController_To_config_InstallationsController(&in.Installations, &out.Installations, s); err != nil { + return err + } + if err := Convert_v1alpha1_ExecutionsController_To_config_ExecutionsController(&in.Executions, &out.Executions, s); err != nil { + return err + } + if err := Convert_v1alpha1_DeployItemsController_To_config_DeployItemsController(&in.DeployItems, &out.DeployItems, s); err != nil { + return err + } + if err := Convert_v1alpha1_ComponentOverwritesController_To_config_ComponentOverwritesController(&in.ComponentOverwrites, &out.ComponentOverwrites, s); err != nil { + return err + } + if err := Convert_v1alpha1_ContextsController_To_config_ContextsController(&in.Contexts, &out.Contexts, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Controllers_To_config_Controllers is an autogenerated conversion function. +func Convert_v1alpha1_Controllers_To_config_Controllers(in *Controllers, out *config.Controllers, s conversion.Scope) error { + return autoConvert_v1alpha1_Controllers_To_config_Controllers(in, out, s) +} + +func autoConvert_config_Controllers_To_v1alpha1_Controllers(in *config.Controllers, out *Controllers, s conversion.Scope) error { + out.SyncPeriod = (*v1.Duration)(unsafe.Pointer(in.SyncPeriod)) + if err := Convert_config_InstallationsController_To_v1alpha1_InstallationsController(&in.Installations, &out.Installations, s); err != nil { + return err + } + if err := Convert_config_ExecutionsController_To_v1alpha1_ExecutionsController(&in.Executions, &out.Executions, s); err != nil { + return err + } + if err := Convert_config_DeployItemsController_To_v1alpha1_DeployItemsController(&in.DeployItems, &out.DeployItems, s); err != nil { + return err + } + if err := Convert_config_ComponentOverwritesController_To_v1alpha1_ComponentOverwritesController(&in.ComponentOverwrites, &out.ComponentOverwrites, s); err != nil { + return err + } + if err := Convert_config_ContextsController_To_v1alpha1_ContextsController(&in.Contexts, &out.Contexts, s); err != nil { + return err + } + return nil +} + +// Convert_config_Controllers_To_v1alpha1_Controllers is an autogenerated conversion function. +func Convert_config_Controllers_To_v1alpha1_Controllers(in *config.Controllers, out *Controllers, s conversion.Scope) error { + return autoConvert_config_Controllers_To_v1alpha1_Controllers(in, out, s) +} + +func autoConvert_v1alpha1_CrdManagementConfiguration_To_config_CrdManagementConfiguration(in *CrdManagementConfiguration, out *config.CrdManagementConfiguration, s conversion.Scope) error { + out.DeployCustomResourceDefinitions = (*bool)(unsafe.Pointer(in.DeployCustomResourceDefinitions)) + out.ForceUpdate = (*bool)(unsafe.Pointer(in.ForceUpdate)) + return nil +} + +// Convert_v1alpha1_CrdManagementConfiguration_To_config_CrdManagementConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_CrdManagementConfiguration_To_config_CrdManagementConfiguration(in *CrdManagementConfiguration, out *config.CrdManagementConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_CrdManagementConfiguration_To_config_CrdManagementConfiguration(in, out, s) +} + +func autoConvert_config_CrdManagementConfiguration_To_v1alpha1_CrdManagementConfiguration(in *config.CrdManagementConfiguration, out *CrdManagementConfiguration, s conversion.Scope) error { + out.DeployCustomResourceDefinitions = (*bool)(unsafe.Pointer(in.DeployCustomResourceDefinitions)) + out.ForceUpdate = (*bool)(unsafe.Pointer(in.ForceUpdate)) + return nil +} + +// Convert_config_CrdManagementConfiguration_To_v1alpha1_CrdManagementConfiguration is an autogenerated conversion function. +func Convert_config_CrdManagementConfiguration_To_v1alpha1_CrdManagementConfiguration(in *config.CrdManagementConfiguration, out *CrdManagementConfiguration, s conversion.Scope) error { + return autoConvert_config_CrdManagementConfiguration_To_v1alpha1_CrdManagementConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_DeployItemTimeouts_To_config_DeployItemTimeouts(in *DeployItemTimeouts, out *config.DeployItemTimeouts, s conversion.Scope) error { + out.Pickup = (*core.Duration)(unsafe.Pointer(in.Pickup)) + out.Abort = (*core.Duration)(unsafe.Pointer(in.Abort)) + out.ProgressingDefault = (*core.Duration)(unsafe.Pointer(in.ProgressingDefault)) + return nil +} + +// Convert_v1alpha1_DeployItemTimeouts_To_config_DeployItemTimeouts is an autogenerated conversion function. +func Convert_v1alpha1_DeployItemTimeouts_To_config_DeployItemTimeouts(in *DeployItemTimeouts, out *config.DeployItemTimeouts, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployItemTimeouts_To_config_DeployItemTimeouts(in, out, s) +} + +func autoConvert_config_DeployItemTimeouts_To_v1alpha1_DeployItemTimeouts(in *config.DeployItemTimeouts, out *DeployItemTimeouts, s conversion.Scope) error { + out.Pickup = (*corev1alpha1.Duration)(unsafe.Pointer(in.Pickup)) + out.Abort = (*corev1alpha1.Duration)(unsafe.Pointer(in.Abort)) + out.ProgressingDefault = (*corev1alpha1.Duration)(unsafe.Pointer(in.ProgressingDefault)) + return nil +} + +// Convert_config_DeployItemTimeouts_To_v1alpha1_DeployItemTimeouts is an autogenerated conversion function. +func Convert_config_DeployItemTimeouts_To_v1alpha1_DeployItemTimeouts(in *config.DeployItemTimeouts, out *DeployItemTimeouts, s conversion.Scope) error { + return autoConvert_config_DeployItemTimeouts_To_v1alpha1_DeployItemTimeouts(in, out, s) +} + +func autoConvert_v1alpha1_DeployItemsController_To_config_DeployItemsController(in *DeployItemsController, out *config.DeployItemsController, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_DeployItemsController_To_config_DeployItemsController is an autogenerated conversion function. +func Convert_v1alpha1_DeployItemsController_To_config_DeployItemsController(in *DeployItemsController, out *config.DeployItemsController, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployItemsController_To_config_DeployItemsController(in, out, s) +} + +func autoConvert_config_DeployItemsController_To_v1alpha1_DeployItemsController(in *config.DeployItemsController, out *DeployItemsController, s conversion.Scope) error { + if err := Convert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_config_DeployItemsController_To_v1alpha1_DeployItemsController is an autogenerated conversion function. +func Convert_config_DeployItemsController_To_v1alpha1_DeployItemsController(in *config.DeployItemsController, out *DeployItemsController, s conversion.Scope) error { + return autoConvert_config_DeployItemsController_To_v1alpha1_DeployItemsController(in, out, s) +} + +func autoConvert_v1alpha1_DeployerManagementConfiguration_To_config_DeployerManagementConfiguration(in *DeployerManagementConfiguration, out *config.DeployerManagementConfiguration, s conversion.Scope) error { + out.Disable = in.Disable + out.Namespace = in.Namespace + if err := Convert_v1alpha1_LandscaperAgentConfiguration_To_config_LandscaperAgentConfiguration(&in.Agent, &out.Agent, s); err != nil { + return err + } + out.DeployerRepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.DeployerRepositoryContext)) + return nil +} + +// Convert_v1alpha1_DeployerManagementConfiguration_To_config_DeployerManagementConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_DeployerManagementConfiguration_To_config_DeployerManagementConfiguration(in *DeployerManagementConfiguration, out *config.DeployerManagementConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployerManagementConfiguration_To_config_DeployerManagementConfiguration(in, out, s) +} + +func autoConvert_config_DeployerManagementConfiguration_To_v1alpha1_DeployerManagementConfiguration(in *config.DeployerManagementConfiguration, out *DeployerManagementConfiguration, s conversion.Scope) error { + out.Disable = in.Disable + out.Namespace = in.Namespace + if err := Convert_config_LandscaperAgentConfiguration_To_v1alpha1_LandscaperAgentConfiguration(&in.Agent, &out.Agent, s); err != nil { + return err + } + out.DeployerRepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.DeployerRepositoryContext)) + return nil +} + +// Convert_config_DeployerManagementConfiguration_To_v1alpha1_DeployerManagementConfiguration is an autogenerated conversion function. +func Convert_config_DeployerManagementConfiguration_To_v1alpha1_DeployerManagementConfiguration(in *config.DeployerManagementConfiguration, out *DeployerManagementConfiguration, s conversion.Scope) error { + return autoConvert_config_DeployerManagementConfiguration_To_v1alpha1_DeployerManagementConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_ExecutionsController_To_config_ExecutionsController(in *ExecutionsController, out *config.ExecutionsController, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ExecutionsController_To_config_ExecutionsController is an autogenerated conversion function. +func Convert_v1alpha1_ExecutionsController_To_config_ExecutionsController(in *ExecutionsController, out *config.ExecutionsController, s conversion.Scope) error { + return autoConvert_v1alpha1_ExecutionsController_To_config_ExecutionsController(in, out, s) +} + +func autoConvert_config_ExecutionsController_To_v1alpha1_ExecutionsController(in *config.ExecutionsController, out *ExecutionsController, s conversion.Scope) error { + if err := Convert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_config_ExecutionsController_To_v1alpha1_ExecutionsController is an autogenerated conversion function. +func Convert_config_ExecutionsController_To_v1alpha1_ExecutionsController(in *config.ExecutionsController, out *ExecutionsController, s conversion.Scope) error { + return autoConvert_config_ExecutionsController_To_v1alpha1_ExecutionsController(in, out, s) +} + +func autoConvert_v1alpha1_GarbageCollectionConfiguration_To_config_GarbageCollectionConfiguration(in *GarbageCollectionConfiguration, out *config.GarbageCollectionConfiguration, s conversion.Scope) error { + out.Size = in.Size + out.GCHighThreshold = in.GCHighThreshold + out.GCLowThreshold = in.GCLowThreshold + if err := v1.Convert_Pointer_v1_Duration_To_v1_Duration(&in.ResetInterval, &out.ResetInterval, s); err != nil { + return err + } + out.PreservedHitsProportion = in.PreservedHitsProportion + return nil +} + +// Convert_v1alpha1_GarbageCollectionConfiguration_To_config_GarbageCollectionConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_GarbageCollectionConfiguration_To_config_GarbageCollectionConfiguration(in *GarbageCollectionConfiguration, out *config.GarbageCollectionConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_GarbageCollectionConfiguration_To_config_GarbageCollectionConfiguration(in, out, s) +} + +func autoConvert_config_GarbageCollectionConfiguration_To_v1alpha1_GarbageCollectionConfiguration(in *config.GarbageCollectionConfiguration, out *GarbageCollectionConfiguration, s conversion.Scope) error { + out.Size = in.Size + out.GCHighThreshold = in.GCHighThreshold + out.GCLowThreshold = in.GCLowThreshold + if err := v1.Convert_v1_Duration_To_Pointer_v1_Duration(&in.ResetInterval, &out.ResetInterval, s); err != nil { + return err + } + out.PreservedHitsProportion = in.PreservedHitsProportion + return nil +} + +// Convert_config_GarbageCollectionConfiguration_To_v1alpha1_GarbageCollectionConfiguration is an autogenerated conversion function. +func Convert_config_GarbageCollectionConfiguration_To_v1alpha1_GarbageCollectionConfiguration(in *config.GarbageCollectionConfiguration, out *GarbageCollectionConfiguration, s conversion.Scope) error { + return autoConvert_config_GarbageCollectionConfiguration_To_v1alpha1_GarbageCollectionConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_InstallationsController_To_config_InstallationsController(in *InstallationsController, out *config.InstallationsController, s conversion.Scope) error { + if err := Convert_v1alpha1_CommonControllerConfig_To_config_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_InstallationsController_To_config_InstallationsController is an autogenerated conversion function. +func Convert_v1alpha1_InstallationsController_To_config_InstallationsController(in *InstallationsController, out *config.InstallationsController, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallationsController_To_config_InstallationsController(in, out, s) +} + +func autoConvert_config_InstallationsController_To_v1alpha1_InstallationsController(in *config.InstallationsController, out *InstallationsController, s conversion.Scope) error { + if err := Convert_config_CommonControllerConfig_To_v1alpha1_CommonControllerConfig(&in.CommonControllerConfig, &out.CommonControllerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_config_InstallationsController_To_v1alpha1_InstallationsController is an autogenerated conversion function. +func Convert_config_InstallationsController_To_v1alpha1_InstallationsController(in *config.InstallationsController, out *InstallationsController, s conversion.Scope) error { + return autoConvert_config_InstallationsController_To_v1alpha1_InstallationsController(in, out, s) +} + +func autoConvert_v1alpha1_LandscaperAgentConfiguration_To_config_LandscaperAgentConfiguration(in *LandscaperAgentConfiguration, out *config.LandscaperAgentConfiguration, s conversion.Scope) error { + out.Disable = in.Disable + if err := Convert_v1alpha1_AgentConfiguration_To_config_AgentConfiguration(&in.AgentConfiguration, &out.AgentConfiguration, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LandscaperAgentConfiguration_To_config_LandscaperAgentConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_LandscaperAgentConfiguration_To_config_LandscaperAgentConfiguration(in *LandscaperAgentConfiguration, out *config.LandscaperAgentConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_LandscaperAgentConfiguration_To_config_LandscaperAgentConfiguration(in, out, s) +} + +func autoConvert_config_LandscaperAgentConfiguration_To_v1alpha1_LandscaperAgentConfiguration(in *config.LandscaperAgentConfiguration, out *LandscaperAgentConfiguration, s conversion.Scope) error { + out.Disable = in.Disable + if err := Convert_config_AgentConfiguration_To_v1alpha1_AgentConfiguration(&in.AgentConfiguration, &out.AgentConfiguration, s); err != nil { + return err + } + return nil +} + +// Convert_config_LandscaperAgentConfiguration_To_v1alpha1_LandscaperAgentConfiguration is an autogenerated conversion function. +func Convert_config_LandscaperAgentConfiguration_To_v1alpha1_LandscaperAgentConfiguration(in *config.LandscaperAgentConfiguration, out *LandscaperAgentConfiguration, s conversion.Scope) error { + return autoConvert_config_LandscaperAgentConfiguration_To_v1alpha1_LandscaperAgentConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_LandscaperConfiguration_To_config_LandscaperConfiguration(in *LandscaperConfiguration, out *config.LandscaperConfiguration, s conversion.Scope) error { + if err := Convert_v1alpha1_Controllers_To_config_Controllers(&in.Controllers, &out.Controllers, s); err != nil { + return err + } + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + if err := Convert_v1alpha1_RegistryConfiguration_To_config_RegistryConfiguration(&in.Registry, &out.Registry, s); err != nil { + return err + } + if err := Convert_v1alpha1_BlueprintStore_To_config_BlueprintStore(&in.BlueprintStore, &out.BlueprintStore, s); err != nil { + return err + } + out.Metrics = (*config.MetricsConfiguration)(unsafe.Pointer(in.Metrics)) + if err := Convert_v1alpha1_CrdManagementConfiguration_To_config_CrdManagementConfiguration(&in.CrdManagement, &out.CrdManagement, s); err != nil { + return err + } + if err := Convert_v1alpha1_DeployerManagementConfiguration_To_config_DeployerManagementConfiguration(&in.DeployerManagement, &out.DeployerManagement, s); err != nil { + return err + } + out.DeployItemTimeouts = (*config.DeployItemTimeouts)(unsafe.Pointer(in.DeployItemTimeouts)) + return nil +} + +// Convert_v1alpha1_LandscaperConfiguration_To_config_LandscaperConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_LandscaperConfiguration_To_config_LandscaperConfiguration(in *LandscaperConfiguration, out *config.LandscaperConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_LandscaperConfiguration_To_config_LandscaperConfiguration(in, out, s) +} + +func autoConvert_config_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(in *config.LandscaperConfiguration, out *LandscaperConfiguration, s conversion.Scope) error { + if err := Convert_config_Controllers_To_v1alpha1_Controllers(&in.Controllers, &out.Controllers, s); err != nil { + return err + } + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + if err := Convert_config_RegistryConfiguration_To_v1alpha1_RegistryConfiguration(&in.Registry, &out.Registry, s); err != nil { + return err + } + if err := Convert_config_BlueprintStore_To_v1alpha1_BlueprintStore(&in.BlueprintStore, &out.BlueprintStore, s); err != nil { + return err + } + out.Metrics = (*MetricsConfiguration)(unsafe.Pointer(in.Metrics)) + if err := Convert_config_CrdManagementConfiguration_To_v1alpha1_CrdManagementConfiguration(&in.CrdManagement, &out.CrdManagement, s); err != nil { + return err + } + if err := Convert_config_DeployerManagementConfiguration_To_v1alpha1_DeployerManagementConfiguration(&in.DeployerManagement, &out.DeployerManagement, s); err != nil { + return err + } + out.DeployItemTimeouts = (*DeployItemTimeouts)(unsafe.Pointer(in.DeployItemTimeouts)) + return nil +} + +// Convert_config_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration is an autogenerated conversion function. +func Convert_config_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(in *config.LandscaperConfiguration, out *LandscaperConfiguration, s conversion.Scope) error { + return autoConvert_config_LandscaperConfiguration_To_v1alpha1_LandscaperConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_LocalRegistryConfiguration_To_config_LocalRegistryConfiguration(in *LocalRegistryConfiguration, out *config.LocalRegistryConfiguration, s conversion.Scope) error { + out.RootPath = in.RootPath + return nil +} + +// Convert_v1alpha1_LocalRegistryConfiguration_To_config_LocalRegistryConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_LocalRegistryConfiguration_To_config_LocalRegistryConfiguration(in *LocalRegistryConfiguration, out *config.LocalRegistryConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_LocalRegistryConfiguration_To_config_LocalRegistryConfiguration(in, out, s) +} + +func autoConvert_config_LocalRegistryConfiguration_To_v1alpha1_LocalRegistryConfiguration(in *config.LocalRegistryConfiguration, out *LocalRegistryConfiguration, s conversion.Scope) error { + out.RootPath = in.RootPath + return nil +} + +// Convert_config_LocalRegistryConfiguration_To_v1alpha1_LocalRegistryConfiguration is an autogenerated conversion function. +func Convert_config_LocalRegistryConfiguration_To_v1alpha1_LocalRegistryConfiguration(in *config.LocalRegistryConfiguration, out *LocalRegistryConfiguration, s conversion.Scope) error { + return autoConvert_config_LocalRegistryConfiguration_To_v1alpha1_LocalRegistryConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_MetricsConfiguration_To_config_MetricsConfiguration(in *MetricsConfiguration, out *config.MetricsConfiguration, s conversion.Scope) error { + out.Port = in.Port + return nil +} + +// Convert_v1alpha1_MetricsConfiguration_To_config_MetricsConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_MetricsConfiguration_To_config_MetricsConfiguration(in *MetricsConfiguration, out *config.MetricsConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_MetricsConfiguration_To_config_MetricsConfiguration(in, out, s) +} + +func autoConvert_config_MetricsConfiguration_To_v1alpha1_MetricsConfiguration(in *config.MetricsConfiguration, out *MetricsConfiguration, s conversion.Scope) error { + out.Port = in.Port + return nil +} + +// Convert_config_MetricsConfiguration_To_v1alpha1_MetricsConfiguration is an autogenerated conversion function. +func Convert_config_MetricsConfiguration_To_v1alpha1_MetricsConfiguration(in *config.MetricsConfiguration, out *MetricsConfiguration, s conversion.Scope) error { + return autoConvert_config_MetricsConfiguration_To_v1alpha1_MetricsConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_OCICacheConfiguration_To_config_OCICacheConfiguration(in *OCICacheConfiguration, out *config.OCICacheConfiguration, s conversion.Scope) error { + out.UseInMemoryOverlay = in.UseInMemoryOverlay + out.Path = in.Path + return nil +} + +// Convert_v1alpha1_OCICacheConfiguration_To_config_OCICacheConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_OCICacheConfiguration_To_config_OCICacheConfiguration(in *OCICacheConfiguration, out *config.OCICacheConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_OCICacheConfiguration_To_config_OCICacheConfiguration(in, out, s) +} + +func autoConvert_config_OCICacheConfiguration_To_v1alpha1_OCICacheConfiguration(in *config.OCICacheConfiguration, out *OCICacheConfiguration, s conversion.Scope) error { + out.UseInMemoryOverlay = in.UseInMemoryOverlay + out.Path = in.Path + return nil +} + +// Convert_config_OCICacheConfiguration_To_v1alpha1_OCICacheConfiguration is an autogenerated conversion function. +func Convert_config_OCICacheConfiguration_To_v1alpha1_OCICacheConfiguration(in *config.OCICacheConfiguration, out *OCICacheConfiguration, s conversion.Scope) error { + return autoConvert_config_OCICacheConfiguration_To_v1alpha1_OCICacheConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_OCIConfiguration_To_config_OCIConfiguration(in *OCIConfiguration, out *config.OCIConfiguration, s conversion.Scope) error { + out.ConfigFiles = *(*[]string)(unsafe.Pointer(&in.ConfigFiles)) + out.Cache = (*config.OCICacheConfiguration)(unsafe.Pointer(in.Cache)) + out.AllowPlainHttp = in.AllowPlainHttp + out.InsecureSkipVerify = in.InsecureSkipVerify + return nil +} + +// Convert_v1alpha1_OCIConfiguration_To_config_OCIConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_OCIConfiguration_To_config_OCIConfiguration(in *OCIConfiguration, out *config.OCIConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_OCIConfiguration_To_config_OCIConfiguration(in, out, s) +} + +func autoConvert_config_OCIConfiguration_To_v1alpha1_OCIConfiguration(in *config.OCIConfiguration, out *OCIConfiguration, s conversion.Scope) error { + out.ConfigFiles = *(*[]string)(unsafe.Pointer(&in.ConfigFiles)) + out.Cache = (*OCICacheConfiguration)(unsafe.Pointer(in.Cache)) + out.AllowPlainHttp = in.AllowPlainHttp + out.InsecureSkipVerify = in.InsecureSkipVerify + return nil +} + +// Convert_config_OCIConfiguration_To_v1alpha1_OCIConfiguration is an autogenerated conversion function. +func Convert_config_OCIConfiguration_To_v1alpha1_OCIConfiguration(in *config.OCIConfiguration, out *OCIConfiguration, s conversion.Scope) error { + return autoConvert_config_OCIConfiguration_To_v1alpha1_OCIConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_RegistryConfiguration_To_config_RegistryConfiguration(in *RegistryConfiguration, out *config.RegistryConfiguration, s conversion.Scope) error { + out.Local = (*config.LocalRegistryConfiguration)(unsafe.Pointer(in.Local)) + out.OCI = (*config.OCIConfiguration)(unsafe.Pointer(in.OCI)) + return nil +} + +// Convert_v1alpha1_RegistryConfiguration_To_config_RegistryConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_RegistryConfiguration_To_config_RegistryConfiguration(in *RegistryConfiguration, out *config.RegistryConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_RegistryConfiguration_To_config_RegistryConfiguration(in, out, s) +} + +func autoConvert_config_RegistryConfiguration_To_v1alpha1_RegistryConfiguration(in *config.RegistryConfiguration, out *RegistryConfiguration, s conversion.Scope) error { + out.Local = (*LocalRegistryConfiguration)(unsafe.Pointer(in.Local)) + out.OCI = (*OCIConfiguration)(unsafe.Pointer(in.OCI)) + return nil +} + +// Convert_config_RegistryConfiguration_To_v1alpha1_RegistryConfiguration is an autogenerated conversion function. +func Convert_config_RegistryConfiguration_To_v1alpha1_RegistryConfiguration(in *config.RegistryConfiguration, out *RegistryConfiguration, s conversion.Scope) error { + return autoConvert_config_RegistryConfiguration_To_v1alpha1_RegistryConfiguration(in, out, s) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..f8a7a1c4e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,507 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + + corev1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AgentConfiguration) DeepCopyInto(out *AgentConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.OCI != nil { + in, out := &in.OCI, &out.OCI + *out = new(OCIConfiguration) + (*in).DeepCopyInto(*out) + } + if in.TargetSelectors != nil { + in, out := &in.TargetSelectors, &out.TargetSelectors + *out = make([]corev1alpha1.TargetSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentConfiguration. +func (in *AgentConfiguration) DeepCopy() *AgentConfiguration { + if in == nil { + return nil + } + out := new(AgentConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AgentConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlueprintStore) DeepCopyInto(out *BlueprintStore) { + *out = *in + in.GarbageCollectionConfiguration.DeepCopyInto(&out.GarbageCollectionConfiguration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlueprintStore. +func (in *BlueprintStore) DeepCopy() *BlueprintStore { + if in == nil { + return nil + } + out := new(BlueprintStore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonControllerConfig) DeepCopyInto(out *CommonControllerConfig) { + *out = *in + if in.CacheSyncTimeout != nil { + in, out := &in.CacheSyncTimeout, &out.CacheSyncTimeout + *out = new(v1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonControllerConfig. +func (in *CommonControllerConfig) DeepCopy() *CommonControllerConfig { + if in == nil { + return nil + } + out := new(CommonControllerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwritesController) DeepCopyInto(out *ComponentOverwritesController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwritesController. +func (in *ComponentOverwritesController) DeepCopy() *ComponentOverwritesController { + if in == nil { + return nil + } + out := new(ComponentOverwritesController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContextControllerConfig) DeepCopyInto(out *ContextControllerConfig) { + *out = *in + in.Default.DeepCopyInto(&out.Default) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContextControllerConfig. +func (in *ContextControllerConfig) DeepCopy() *ContextControllerConfig { + if in == nil { + return nil + } + out := new(ContextControllerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContextControllerDefaultConfig) DeepCopyInto(out *ContextControllerDefaultConfig) { + *out = *in + if in.ExcludedNamespaces != nil { + in, out := &in.ExcludedNamespaces, &out.ExcludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContextControllerDefaultConfig. +func (in *ContextControllerDefaultConfig) DeepCopy() *ContextControllerDefaultConfig { + if in == nil { + return nil + } + out := new(ContextControllerDefaultConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContextsController) DeepCopyInto(out *ContextsController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + in.Config.DeepCopyInto(&out.Config) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContextsController. +func (in *ContextsController) DeepCopy() *ContextsController { + if in == nil { + return nil + } + out := new(ContextsController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Controllers) DeepCopyInto(out *Controllers) { + *out = *in + if in.SyncPeriod != nil { + in, out := &in.SyncPeriod, &out.SyncPeriod + *out = new(v1.Duration) + **out = **in + } + in.Installations.DeepCopyInto(&out.Installations) + in.Executions.DeepCopyInto(&out.Executions) + in.DeployItems.DeepCopyInto(&out.DeployItems) + in.ComponentOverwrites.DeepCopyInto(&out.ComponentOverwrites) + in.Contexts.DeepCopyInto(&out.Contexts) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Controllers. +func (in *Controllers) DeepCopy() *Controllers { + if in == nil { + return nil + } + out := new(Controllers) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CrdManagementConfiguration) DeepCopyInto(out *CrdManagementConfiguration) { + *out = *in + if in.DeployCustomResourceDefinitions != nil { + in, out := &in.DeployCustomResourceDefinitions, &out.DeployCustomResourceDefinitions + *out = new(bool) + **out = **in + } + if in.ForceUpdate != nil { + in, out := &in.ForceUpdate, &out.ForceUpdate + *out = new(bool) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrdManagementConfiguration. +func (in *CrdManagementConfiguration) DeepCopy() *CrdManagementConfiguration { + if in == nil { + return nil + } + out := new(CrdManagementConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemTimeouts) DeepCopyInto(out *DeployItemTimeouts) { + *out = *in + if in.Pickup != nil { + in, out := &in.Pickup, &out.Pickup + *out = new(corev1alpha1.Duration) + **out = **in + } + if in.Abort != nil { + in, out := &in.Abort, &out.Abort + *out = new(corev1alpha1.Duration) + **out = **in + } + if in.ProgressingDefault != nil { + in, out := &in.ProgressingDefault, &out.ProgressingDefault + *out = new(corev1alpha1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemTimeouts. +func (in *DeployItemTimeouts) DeepCopy() *DeployItemTimeouts { + if in == nil { + return nil + } + out := new(DeployItemTimeouts) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemsController) DeepCopyInto(out *DeployItemsController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemsController. +func (in *DeployItemsController) DeepCopy() *DeployItemsController { + if in == nil { + return nil + } + out := new(DeployItemsController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerManagementConfiguration) DeepCopyInto(out *DeployerManagementConfiguration) { + *out = *in + in.Agent.DeepCopyInto(&out.Agent) + if in.DeployerRepositoryContext != nil { + in, out := &in.DeployerRepositoryContext, &out.DeployerRepositoryContext + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerManagementConfiguration. +func (in *DeployerManagementConfiguration) DeepCopy() *DeployerManagementConfiguration { + if in == nil { + return nil + } + out := new(DeployerManagementConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionsController) DeepCopyInto(out *ExecutionsController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionsController. +func (in *ExecutionsController) DeepCopy() *ExecutionsController { + if in == nil { + return nil + } + out := new(ExecutionsController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GarbageCollectionConfiguration) DeepCopyInto(out *GarbageCollectionConfiguration) { + *out = *in + if in.ResetInterval != nil { + in, out := &in.ResetInterval, &out.ResetInterval + *out = new(v1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GarbageCollectionConfiguration. +func (in *GarbageCollectionConfiguration) DeepCopy() *GarbageCollectionConfiguration { + if in == nil { + return nil + } + out := new(GarbageCollectionConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationsController) DeepCopyInto(out *InstallationsController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationsController. +func (in *InstallationsController) DeepCopy() *InstallationsController { + if in == nil { + return nil + } + out := new(InstallationsController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperAgentConfiguration) DeepCopyInto(out *LandscaperAgentConfiguration) { + *out = *in + in.AgentConfiguration.DeepCopyInto(&out.AgentConfiguration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperAgentConfiguration. +func (in *LandscaperAgentConfiguration) DeepCopy() *LandscaperAgentConfiguration { + if in == nil { + return nil + } + out := new(LandscaperAgentConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperConfiguration) DeepCopyInto(out *LandscaperConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Controllers.DeepCopyInto(&out.Controllers) + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + in.Registry.DeepCopyInto(&out.Registry) + in.BlueprintStore.DeepCopyInto(&out.BlueprintStore) + if in.Metrics != nil { + in, out := &in.Metrics, &out.Metrics + *out = new(MetricsConfiguration) + **out = **in + } + in.CrdManagement.DeepCopyInto(&out.CrdManagement) + in.DeployerManagement.DeepCopyInto(&out.DeployerManagement) + if in.DeployItemTimeouts != nil { + in, out := &in.DeployItemTimeouts, &out.DeployItemTimeouts + *out = new(DeployItemTimeouts) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperConfiguration. +func (in *LandscaperConfiguration) DeepCopy() *LandscaperConfiguration { + if in == nil { + return nil + } + out := new(LandscaperConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LandscaperConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalRegistryConfiguration) DeepCopyInto(out *LocalRegistryConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalRegistryConfiguration. +func (in *LocalRegistryConfiguration) DeepCopy() *LocalRegistryConfiguration { + if in == nil { + return nil + } + out := new(LocalRegistryConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricsConfiguration) DeepCopyInto(out *MetricsConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsConfiguration. +func (in *MetricsConfiguration) DeepCopy() *MetricsConfiguration { + if in == nil { + return nil + } + out := new(MetricsConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCICacheConfiguration) DeepCopyInto(out *OCICacheConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCICacheConfiguration. +func (in *OCICacheConfiguration) DeepCopy() *OCICacheConfiguration { + if in == nil { + return nil + } + out := new(OCICacheConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIConfiguration) DeepCopyInto(out *OCIConfiguration) { + *out = *in + if in.ConfigFiles != nil { + in, out := &in.ConfigFiles, &out.ConfigFiles + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Cache != nil { + in, out := &in.Cache, &out.Cache + *out = new(OCICacheConfiguration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIConfiguration. +func (in *OCIConfiguration) DeepCopy() *OCIConfiguration { + if in == nil { + return nil + } + out := new(OCIConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryConfiguration) DeepCopyInto(out *RegistryConfiguration) { + *out = *in + if in.Local != nil { + in, out := &in.Local, &out.Local + *out = new(LocalRegistryConfiguration) + **out = **in + } + if in.OCI != nil { + in, out := &in.OCI, &out.OCI + *out = new(OCIConfiguration) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryConfiguration. +func (in *RegistryConfiguration) DeepCopy() *RegistryConfiguration { + if in == nil { + return nil + } + out := new(RegistryConfiguration) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.defaults.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.defaults.go new file mode 100644 index 000000000..412e5b123 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,40 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&AgentConfiguration{}, func(obj interface{}) { SetObjectDefaults_AgentConfiguration(obj.(*AgentConfiguration)) }) + scheme.AddTypeDefaultingFunc(&LandscaperConfiguration{}, func(obj interface{}) { SetObjectDefaults_LandscaperConfiguration(obj.(*LandscaperConfiguration)) }) + return nil +} + +func SetObjectDefaults_AgentConfiguration(in *AgentConfiguration) { + SetDefaults_AgentConfiguration(in) +} + +func SetObjectDefaults_LandscaperConfiguration(in *LandscaperConfiguration) { + SetDefaults_LandscaperConfiguration(in) + SetDefaults_CommonControllerConfig(&in.Controllers.Installations.CommonControllerConfig) + SetDefaults_CommonControllerConfig(&in.Controllers.Executions.CommonControllerConfig) + SetDefaults_CommonControllerConfig(&in.Controllers.DeployItems.CommonControllerConfig) + SetDefaults_CommonControllerConfig(&in.Controllers.ComponentOverwrites.CommonControllerConfig) + SetDefaults_CommonControllerConfig(&in.Controllers.Contexts.CommonControllerConfig) + SetDefaults_BlueprintStore(&in.BlueprintStore) + SetDefaults_CrdManagementConfiguration(&in.CrdManagement) + SetObjectDefaults_AgentConfiguration(&in.DeployerManagement.Agent.AgentConfiguration) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/config/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/config/zz_generated.deepcopy.go new file mode 100644 index 000000000..764076338 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/config/zz_generated.deepcopy.go @@ -0,0 +1,504 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package config + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + + core "github.com/gardener/landscaper/apis/core" + v1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AgentConfiguration) DeepCopyInto(out *AgentConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.OCI != nil { + in, out := &in.OCI, &out.OCI + *out = new(OCIConfiguration) + (*in).DeepCopyInto(*out) + } + if in.TargetSelectors != nil { + in, out := &in.TargetSelectors, &out.TargetSelectors + *out = make([]v1alpha1.TargetSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentConfiguration. +func (in *AgentConfiguration) DeepCopy() *AgentConfiguration { + if in == nil { + return nil + } + out := new(AgentConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AgentConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlueprintStore) DeepCopyInto(out *BlueprintStore) { + *out = *in + out.GarbageCollectionConfiguration = in.GarbageCollectionConfiguration + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlueprintStore. +func (in *BlueprintStore) DeepCopy() *BlueprintStore { + if in == nil { + return nil + } + out := new(BlueprintStore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonControllerConfig) DeepCopyInto(out *CommonControllerConfig) { + *out = *in + if in.CacheSyncTimeout != nil { + in, out := &in.CacheSyncTimeout, &out.CacheSyncTimeout + *out = new(v1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonControllerConfig. +func (in *CommonControllerConfig) DeepCopy() *CommonControllerConfig { + if in == nil { + return nil + } + out := new(CommonControllerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwritesController) DeepCopyInto(out *ComponentOverwritesController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwritesController. +func (in *ComponentOverwritesController) DeepCopy() *ComponentOverwritesController { + if in == nil { + return nil + } + out := new(ComponentOverwritesController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContextControllerConfig) DeepCopyInto(out *ContextControllerConfig) { + *out = *in + in.Default.DeepCopyInto(&out.Default) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContextControllerConfig. +func (in *ContextControllerConfig) DeepCopy() *ContextControllerConfig { + if in == nil { + return nil + } + out := new(ContextControllerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContextControllerDefaultConfig) DeepCopyInto(out *ContextControllerDefaultConfig) { + *out = *in + if in.ExcludedNamespaces != nil { + in, out := &in.ExcludedNamespaces, &out.ExcludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContextControllerDefaultConfig. +func (in *ContextControllerDefaultConfig) DeepCopy() *ContextControllerDefaultConfig { + if in == nil { + return nil + } + out := new(ContextControllerDefaultConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContextsController) DeepCopyInto(out *ContextsController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + in.Config.DeepCopyInto(&out.Config) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContextsController. +func (in *ContextsController) DeepCopy() *ContextsController { + if in == nil { + return nil + } + out := new(ContextsController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Controllers) DeepCopyInto(out *Controllers) { + *out = *in + if in.SyncPeriod != nil { + in, out := &in.SyncPeriod, &out.SyncPeriod + *out = new(v1.Duration) + **out = **in + } + in.Installations.DeepCopyInto(&out.Installations) + in.Executions.DeepCopyInto(&out.Executions) + in.DeployItems.DeepCopyInto(&out.DeployItems) + in.ComponentOverwrites.DeepCopyInto(&out.ComponentOverwrites) + in.Contexts.DeepCopyInto(&out.Contexts) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Controllers. +func (in *Controllers) DeepCopy() *Controllers { + if in == nil { + return nil + } + out := new(Controllers) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CrdManagementConfiguration) DeepCopyInto(out *CrdManagementConfiguration) { + *out = *in + if in.DeployCustomResourceDefinitions != nil { + in, out := &in.DeployCustomResourceDefinitions, &out.DeployCustomResourceDefinitions + *out = new(bool) + **out = **in + } + if in.ForceUpdate != nil { + in, out := &in.ForceUpdate, &out.ForceUpdate + *out = new(bool) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrdManagementConfiguration. +func (in *CrdManagementConfiguration) DeepCopy() *CrdManagementConfiguration { + if in == nil { + return nil + } + out := new(CrdManagementConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemTimeouts) DeepCopyInto(out *DeployItemTimeouts) { + *out = *in + if in.Pickup != nil { + in, out := &in.Pickup, &out.Pickup + *out = new(core.Duration) + **out = **in + } + if in.Abort != nil { + in, out := &in.Abort, &out.Abort + *out = new(core.Duration) + **out = **in + } + if in.ProgressingDefault != nil { + in, out := &in.ProgressingDefault, &out.ProgressingDefault + *out = new(core.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemTimeouts. +func (in *DeployItemTimeouts) DeepCopy() *DeployItemTimeouts { + if in == nil { + return nil + } + out := new(DeployItemTimeouts) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemsController) DeepCopyInto(out *DeployItemsController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemsController. +func (in *DeployItemsController) DeepCopy() *DeployItemsController { + if in == nil { + return nil + } + out := new(DeployItemsController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerManagementConfiguration) DeepCopyInto(out *DeployerManagementConfiguration) { + *out = *in + in.Agent.DeepCopyInto(&out.Agent) + if in.DeployerRepositoryContext != nil { + in, out := &in.DeployerRepositoryContext, &out.DeployerRepositoryContext + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerManagementConfiguration. +func (in *DeployerManagementConfiguration) DeepCopy() *DeployerManagementConfiguration { + if in == nil { + return nil + } + out := new(DeployerManagementConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionsController) DeepCopyInto(out *ExecutionsController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionsController. +func (in *ExecutionsController) DeepCopy() *ExecutionsController { + if in == nil { + return nil + } + out := new(ExecutionsController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GarbageCollectionConfiguration) DeepCopyInto(out *GarbageCollectionConfiguration) { + *out = *in + out.ResetInterval = in.ResetInterval + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GarbageCollectionConfiguration. +func (in *GarbageCollectionConfiguration) DeepCopy() *GarbageCollectionConfiguration { + if in == nil { + return nil + } + out := new(GarbageCollectionConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationsController) DeepCopyInto(out *InstallationsController) { + *out = *in + in.CommonControllerConfig.DeepCopyInto(&out.CommonControllerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationsController. +func (in *InstallationsController) DeepCopy() *InstallationsController { + if in == nil { + return nil + } + out := new(InstallationsController) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperAgentConfiguration) DeepCopyInto(out *LandscaperAgentConfiguration) { + *out = *in + in.AgentConfiguration.DeepCopyInto(&out.AgentConfiguration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperAgentConfiguration. +func (in *LandscaperAgentConfiguration) DeepCopy() *LandscaperAgentConfiguration { + if in == nil { + return nil + } + out := new(LandscaperAgentConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LandscaperConfiguration) DeepCopyInto(out *LandscaperConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Controllers.DeepCopyInto(&out.Controllers) + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + in.Registry.DeepCopyInto(&out.Registry) + out.BlueprintStore = in.BlueprintStore + if in.Metrics != nil { + in, out := &in.Metrics, &out.Metrics + *out = new(MetricsConfiguration) + **out = **in + } + in.CrdManagement.DeepCopyInto(&out.CrdManagement) + in.DeployerManagement.DeepCopyInto(&out.DeployerManagement) + if in.DeployItemTimeouts != nil { + in, out := &in.DeployItemTimeouts, &out.DeployItemTimeouts + *out = new(DeployItemTimeouts) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LandscaperConfiguration. +func (in *LandscaperConfiguration) DeepCopy() *LandscaperConfiguration { + if in == nil { + return nil + } + out := new(LandscaperConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LandscaperConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalRegistryConfiguration) DeepCopyInto(out *LocalRegistryConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalRegistryConfiguration. +func (in *LocalRegistryConfiguration) DeepCopy() *LocalRegistryConfiguration { + if in == nil { + return nil + } + out := new(LocalRegistryConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricsConfiguration) DeepCopyInto(out *MetricsConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsConfiguration. +func (in *MetricsConfiguration) DeepCopy() *MetricsConfiguration { + if in == nil { + return nil + } + out := new(MetricsConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCICacheConfiguration) DeepCopyInto(out *OCICacheConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCICacheConfiguration. +func (in *OCICacheConfiguration) DeepCopy() *OCICacheConfiguration { + if in == nil { + return nil + } + out := new(OCICacheConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIConfiguration) DeepCopyInto(out *OCIConfiguration) { + *out = *in + if in.ConfigFiles != nil { + in, out := &in.ConfigFiles, &out.ConfigFiles + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Cache != nil { + in, out := &in.Cache, &out.Cache + *out = new(OCICacheConfiguration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIConfiguration. +func (in *OCIConfiguration) DeepCopy() *OCIConfiguration { + if in == nil { + return nil + } + out := new(OCIConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryConfiguration) DeepCopyInto(out *RegistryConfiguration) { + *out = *in + if in.Local != nil { + in, out := &in.Local, &out.Local + *out = new(LocalRegistryConfiguration) + **out = **in + } + if in.OCI != nil { + in, out := &in.OCI, &out.OCI + *out = new(OCIConfiguration) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryConfiguration. +func (in *RegistryConfiguration) DeepCopy() *RegistryConfiguration { + if in == nil { + return nil + } + out := new(RegistryConfiguration) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/doc.go new file mode 100644 index 000000000..40e382daf --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/doc.go @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=landscaper.gardener.cloud +package core diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/install/install.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/install/install.go new file mode 100644 index 000000000..522cb9eff --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/install/install.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package install + +import ( + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + + "github.com/gardener/landscaper/apis/core" + "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +var ( + schemeBuilder = runtime.NewSchemeBuilder( + v1alpha1.AddToScheme, + core.AddToScheme, + setVersionPriority, + ) + + AddToScheme = schemeBuilder.AddToScheme +) + +func setVersionPriority(scheme *runtime.Scheme) error { + return scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion) +} + +// Install installs all APIs in the scheme. +func Install(scheme *runtime.Scheme) { + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/register.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/register.go new file mode 100644 index 000000000..a93949455 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/register.go @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the name of the Garden API group. +const GroupName = "landscaper.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &DataObject{}, + &DataObjectList{}, + &Target{}, + &TargetList{}, + &Blueprint{}, + &InstallationTemplate{}, + &Installation{}, + &InstallationList{}, + &Execution{}, + &ExecutionList{}, + &DeployItem{}, + &DeployItemList{}, + &ComponentOverwrites{}, + &ComponentOverwritesList{}, + &Environment{}, + &EnvironmentList{}, + &DeployerRegistration{}, + &DeployerRegistrationList{}, + ) + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_blueprint.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_blueprint.go new file mode 100644 index 000000000..ff04d0aa4 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_blueprint.go @@ -0,0 +1,204 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// BlueprintResourceType is the name of the blueprint resource defined in component descriptors. +const BlueprintResourceType = "blueprint" + +// ImportType is a string alias +type ImportType string + +// ExportType is a string alias +type ExportType string + +// ImportTypeData is the import type for data imports +const ImportTypeData = ImportType("data") + +// ImportTypeTarget is the import type for target imports +const ImportTypeTarget = ImportType("target") + +// ImportTypeTargetList is the import type for targetlist imports +const ImportTypeTargetList = ImportType("targetList") + +// ImportTypeComponentDescriptor is the import type for component descriptor imports +const ImportTypeComponentDescriptor = ImportType("componentDescriptor") + +// ImportTypeComponentDescriptorList is the import type for component descriptor list imports +const ImportTypeComponentDescriptorList = ImportType("componentDescriptorList") + +// ExportTypeData is the export type for data exports +const ExportTypeData = ExportType(ImportTypeData) + +// ExportTypeTarget is the export type for target exports +const ExportTypeTarget = ExportType(ImportTypeTarget) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Blueprint contains the configuration of a component +type Blueprint struct { + metav1.TypeMeta `json:",inline"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. + // +optional + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` + + // JSONSchemaVersion defines the default jsonschema version of the blueprint. + // e.g. "https://json-schema.org/draft/2019-09/schema" + // +optional + JSONSchemaVersion string `json:"jsonSchemaVersion"` + + // LocalTypes defines additional blueprint local schemas + // +optional + LocalTypes map[string]JSONSchemaDefinition `json:"localTypes,omitempty"` + + // Imports define the import values that are needed for the definition and its sub-definitions. + // +optional + Imports ImportDefinitionList `json:"imports,omitempty"` + + // Exports define the exported values of the definition and its sub-definitions + // +optional + Exports ExportDefinitionList `json:"exports,omitempty"` + + // Subinstallations defines an optional list of subinstallations (for aggregating blueprints). + // +optional + Subinstallations SubinstallationTemplateList `json:"subinstallations,omitempty"` + + // SubinstallationExecutions defines the templating executors that are sequentially executed by the landscaper. + // The templates must return a list of installation templates. + // Both subinstallations and SubinstallationExecutions are valid options and will be merged. + // +optional + SubinstallationExecutions []TemplateExecutor `json:"subinstallationExecutions,omitempty"` + + // DeployExecutions defines the templating executors that are sequentially executed by the landscaper. + // The templates must return a list of deploy item templates. + // +optional + DeployExecutions []TemplateExecutor `json:"deployExecutions,omitempty"` + + // ExportExecutions defines the templating executors that are used to generate the exports. + // +optional + ExportExecutions []TemplateExecutor `json:"exportExecutions,omitempty"` +} + +// ImportDefinitionList defines a list of import defiinitions. +type ImportDefinitionList []ImportDefinition + +// ImportDefinition defines a imported value +type ImportDefinition struct { + FieldValueDefinition `json:",inline"` + + // Type specifies which kind of object is being imported. + // This field should be set and will likely be mandatory in future. + // +optional + Type ImportType `json:"type,omitempty"` + + // Required specifies whether the import is required for the component to run. + // Defaults to true. + // +optional + Required *bool `json:"required"` + + // Default sets a default value for the current import that is used if the key is not set. + Default Default `json:"default,omitempty"` + + // ConditionalImports are Imports that are only valid if this imports is satisfied. + // Does only make sense for optional imports. + // todo: maybe restrict only for required=false + // todo: see if this works with recursion + // +optional + ConditionalImports []ImportDefinition `json:"imports,omitempty"` +} + +// ExportDefinitionList defines a list of export definitions. +type ExportDefinitionList []ExportDefinition + +// ExportDefinition defines a exported value +type ExportDefinition struct { + FieldValueDefinition `json:",inline"` + + // Type specifies which kind of object is being exported. + // This field should be set and will likely be mandatory in future. + // +optional + Type ExportType `json:"type,omitempty"` +} + +// FieldValueDefinition defines a im- or exported field. +// Either schema or target type have to be defined +type FieldValueDefinition struct { + // Name defines the field name to search for the value and map to exports. + // Ref: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#selecting-fields + Name string `json:"name"` + // Schema defines the imported value as jsonschema. + // +optional + Schema *JSONSchemaDefinition `json:"schema,omitempty"` + // TargetType defines the type of the imported target. + // +optional + TargetType string `json:"targetType,omitempty"` +} + +// Default defines a default value (future idea: also reference?). +type Default struct { + Value AnyJSON `json:"value"` +} + +// BlueprintStaticDataSource defines a static data source for a blueprint +type BlueprintStaticDataSource struct { + // Value defined inline a raw data + // +optional + Value AnyJSON `json:"value,omitempty"` + + // ValueFrom defines data from an external resource + ValueFrom *StaticDataValueFrom `json:"valueFrom,omitempty"` +} + +// BlueprintStaticDataValueFrom defines static data that is read from a external resource. +type BlueprintStaticDataValueFrom struct { + // Selects a key of a secret in the installations's namespace + // +optional + LocalPath string `json:"localPath,omitempty"` +} + +// TemplateType describes the template mechanism. +type TemplateType string + +// GOTemplateType describes the go templating type. +const GOTemplateType TemplateType = "GoTemplate" + +// SpiffTemplateType describes the spiff type. +const SpiffTemplateType TemplateType = "Spiff" + +// TemplateExecutor describes a templating mechanism and configuration. +type TemplateExecutor struct { + // Name is the unique name of the template + Name string `json:"name"` + // Type describes the templating mechanism. + Type TemplateType `json:"type"` + // File is the path to the template in the blueprint's content. + // +optional + File string `json:"file,omitempty"` + // Template contains an optional inline template. + // The template has to be of string for go template + // and a valid yaml/json for spiff. + // + optional + Template AnyJSON `json:"template,omitempty"` +} + +// SubinstallationTemplateList is a list of installation templates +type SubinstallationTemplateList []SubinstallationTemplate + +// SubinstallationTemplate defines a subinstallation template. +type SubinstallationTemplate struct { + // File references a subinstallation template stored in another file. + // +optional + File string `json:"file,omitempty"` + + // An inline subinstallation template. + // +optional + *InstallationTemplate `json:",inline"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_component_overwrite.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_component_overwrite.go new file mode 100644 index 000000000..9c36c52d6 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_component_overwrite.go @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ComponentOverwritesList contains a list of ComponentOverwrites +type ComponentOverwritesList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ComponentOverwrites `json:"items"` +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ComponentOverwrites are resources that can hold any kind json or yaml data. +// +kubebuilder:resource:path="componentoverwrites",scope="Cluster",shortName={"compoverwrite","co","overwrite"},singular="componentoverwrites" +type ComponentOverwrites struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Overwrites defines a list of component overwrites + Overwrites ComponentOverwriteList `json:"overwrites,omitempty"` +} + +// ComponentOverwriteList is a list of component overwrites. +type ComponentOverwriteList []ComponentOverwrite + +// ComponentOverwrite defines an overwrite for a specific component and/or version of a component. +type ComponentOverwrite struct { + // Component defines the component that should be replaced. + // The version is optional and will default to all found versions + Component ComponentOverwriteReference `json:"component"` + // Target defines the replacement target for the component or version. + Target ComponentOverwriteReference `json:"target"` +} + +// ComponentOverwriteReference defines a component reference by +type ComponentOverwriteReference struct { + // RepositoryContext defines the context of the component repository to resolve blueprints. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject `json:"repositoryContext,omitempty"` + // ComponentName defines the unique of the component containing the resource. + // +optional + ComponentName string `json:"componentName"` + // Version defines the version of the component. + // +optional + Version string `json:"version"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_context.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_context.go new file mode 100644 index 000000000..5470b4517 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_context.go @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ContextList contains a list of Contexts +type ContextList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Context `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Context is a resource that contains shared information of installations. +// This includes information about the repository context like the context itself or secrets to access the oci artifacts. +// But it can also contain deployer specific config. +type Context struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // RepositoryContext defines the context of the component repository to resolve blueprints. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject `json:"repositoryContext,omitempty"` + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints, component descriptors and jsonschemas from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []corev1.LocalObjectReference `json:"registryPullSecrets,omitempty"` + // Configurations contains arbitrary configuration information for dedicated purposes given by a string key. + // The key should use a dns-like syntax to express the purpose and avoid conflicts. + // +optional + Configurations map[string]AnyJSON `json:"configurations,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_dataobject.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_dataobject.go new file mode 100644 index 000000000..53c74eb0b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_dataobject.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DataObjectList contains a list of DataObject +type DataObjectList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DataObject `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DataObject are resources that can hold any kind of json or yaml data. +type DataObject struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Data contains the data of the object as string. + Data AnyJSON `json:"data"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_deployer_registration.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_deployer_registration.go new file mode 100644 index 000000000..6459a9d6d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_deployer_registration.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DeployerRegistrationList contains a list of DeployerRegistration +type DeployerRegistrationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DeployerRegistration `json:"items"` +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DeployerRegistration defines a installation template for a deployer. +type DeployerRegistration struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec defines the deployer registration configuration. + Spec DeployerRegistrationSpec `json:"spec"` +} + +// DeployerRegistrationSpec defines the configuration of a deployer registration +type DeployerRegistrationSpec struct { + // DeployItemTypes defines the types of deploy items that are handled by the deployer. + DeployItemTypes []DeployItemType `json:"types"` + // InstallationTemplate defines the installation template for installing a deployer.´ + InstallationTemplate DeployerInstallationTemplate `json:"installationTemplate"` +} + +type DeployerInstallationTemplate struct { + //ComponentDescriptor is a reference to the installation's component descriptor + // +optional + ComponentDescriptor *ComponentDescriptorDefinition `json:"componentDescriptor,omitempty"` + // Blueprint is the resolved reference to the definition. + Blueprint BlueprintDefinition `json:"blueprint"` + // Imports define the imported data objects and targets. + // +optional + Imports InstallationImports `json:"imports,omitempty"` + // ImportDataMappings contains a template for restructuring imports. + // It is expected to contain a key for every blueprint-defined data import. + // Missing keys will be defaulted to their respective data import. + // Example: namespace: (( installation.imports.namespace )) + // +optional + ImportDataMappings map[string]AnyJSON `json:"importDataMappings,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_deployitem.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_deployitem.go new file mode 100644 index 000000000..5f5d98daf --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_deployitem.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" +) + +// DeployItemType defines the type of the deploy item +type DeployItemType string + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DeployItemList contains a list of DeployItems +type DeployItemList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DeployItem `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DeployItem defines a resource that should be processed by a external deployer +// +kubebuilder:subresource:status +type DeployItem struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DeployItemSpec `json:"spec"` + + // +optional + Status DeployItemStatus `json:"status"` +} + +// DeployItemSpec contains the definition of a deploy item. +type DeployItemSpec struct { + // Type is the type of the deployer that should handle the item. + Type DeployItemType `json:"type"` + // Target specifies an optional target of the deploy item. + // In most cases it contains the secrets to access a evironment. + // It is also used by the deployers to determine the ownernship. + // +optional + Target *ObjectReference `json:"target,omitempty"` + // Context defines the current context of the deployitem. + // +optional + Context string `json:"context,omitempty"` + // Configuration contains the deployer type specific configuration. + Configuration *runtime.RawExtension `json:"config,omitempty"` + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints, component descriptors and jsonschemas from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []ObjectReference `json:"registryPullSecrets,omitempty"` + // Timeout specifies how long the deployer may take to apply the deploy item. + // When the time is exceeded, the landscaper will add the abort annotation to the deploy item + // and later put it in 'Failed' if the deployer doesn't handle the abort properly. + // Value has to be parsable by time.ParseDuration (or 'none' to deactivate the timeout). + // Defaults to ten minutes if not specified. + // +optional + Timeout *Duration `json:"timeout,omitempty"` +} + +// DeployItemStatus contains the status of a deploy item +type DeployItemStatus struct { + // Phase is the current phase of the DeployItem + Phase ExecutionPhase `json:"phase,omitempty"` + + // ObservedGeneration is the most recent generation observed for this DeployItem. + // It corresponds to the DeployItem generation, which is updated on mutation by the landscaper. + ObservedGeneration int64 `json:"observedGeneration"` + + // Conditions contains the actual condition of a deploy item + // +optional + Conditions []Condition `json:"conditions,omitempty"` + + // LastError describes the last error that occurred. + LastError *Error `json:"lastError,omitempty"` + + // LastReconcileTime indicates when the reconciliation of the last change to the deploy item has started + // +optional + LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"` + + // Deployer describes the deployer that has reconciled the deploy item. + // +optional + Deployer DeployerInformation `json:"deployer,omitempty"` + + // ProviderStatus contains the provider specific status + // +optional + ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"` + + // ExportReference is the reference to the object that contains the exported values. + // +optional + ExportReference *ObjectReference `json:"exportRef,omitempty"` +} + +// DeployerInformation holds additional information about the deployer that +// has reconciled or is reconciling the deploy item. +type DeployerInformation struct { + // Identity describes the unique identity of the deployer. + Identity string `json:"identity"` + // Name is the name of the deployer. + Name string `json:"name"` + // Version is the version of the deployer. + Version string `json:"version"` +} + +// TargetSelector describes a selector that matches specific targets. +// +k8s:deepcopy-gen=true +type TargetSelector struct { + // Targets defines a list of specific targets (name and namespace) + // that should be reconciled. + // +optional + Targets []ObjectReference `json:"targets,omitempty"` + // Annotations matches a target based on annotations. + // +optional + Annotations []Requirement `json:"annotations,omitempty"` + // Labels matches a target based on its labels. + // +optional + Labels []Requirement `json:"labels,omitempty"` +} + +// Requirement contains values, a key, and an operator that relates the key and values. +// The zero value of Requirement is invalid. +// Requirement implements both set based match and exact match +// Requirement should be initialized via NewRequirement constructor for creating a valid Requirement. +// +k8s:deepcopy-gen=true +type Requirement struct { + Key string `json:"key"` + Operator selection.Operator `json:"operator"` + // In huge majority of cases we have at most one value here. + // It is generally faster to operate on a single-element slice + // than on a single-element map, so we have a slice here. + // +optional + Values []string `json:"values,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_environment.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_environment.go new file mode 100644 index 000000000..5fdd08a4d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_environment.go @@ -0,0 +1,83 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EnvironmentList contains a list of Environments +type EnvironmentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Environment `json:"items"` +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Environment defines a environment that is created by a agent. +type Environment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec defines the environment. + Spec EnvironmentSpec `json:"spec"` +} + +// EnvironmentSpec defines the environment configuration. +type EnvironmentSpec struct { + // HostTarget describes the target that is used for the deployers. + HostTarget TargetTemplate `json:"hostTarget"` + // Namespace is the host cluster namespace where the deployers should be installed. + Namespace string `json:"namespace"` + // LandscaperClusterRestConfig describes the connection information to connect to the + // landscaper cluster. + // This information should be provided by the agent as the access information may differ + // when calling from different networking zones. + LandscaperClusterRestConfig ClusterRestConfig `json:"landscaperClusterConfig"` + // TargetSelectors defines the target selector that is applied to all installed deployers + TargetSelectors []TargetSelector `json:"targetSelectors"` +} + +// ClusterRestConfig describes parts of a rest.Config +// that is used to access the +type ClusterRestConfig struct { + // Host must be a host string, a host:port pair, or a URL to the base of the apiserver. + // If a URL is given then the (optional) Path of that URL represents a prefix that must + // be appended to all request URIs used to access the apiserver. This allows a frontend + // proxy to easily relocate all of the apiserver endpoints. + Host string `json:"host"` + // APIPath is a sub-path that points to an API root. + APIPath string `json:"apiPath"` + + TLSClientConfig `json:",inline"` +} + +// TLSClientConfig contains settings to enable transport layer security +type TLSClientConfig struct { + // Server should be accessed without verifying the TLS certificate. For testing only. + // +optional + Insecure bool `json:"insecure"` + // ServerName is passed to the server for SNI and is used in the client to check server + // ceritificates against. If ServerName is empty, the hostname used to contact the + // server is used. + // +optional + ServerName string `json:"serverName,omitempty"` + + // CAData holds PEM-encoded bytes (typically read from a root certificates bundle). + // CAData takes precedence over CAFile + // +optional + CAData []byte `json:"caData,omitempty"` + + // NextProtos is a list of supported application level protocols, in order of preference. + // Used to populate tls.Config.NextProtos. + // To indicate to the server http/1.1 is preferred over http/2, set to ["http/1.1", "h2"] (though the server is free to ignore that preference). + // To use only http/1.1, set to ["http/1.1"]. + // +optional + NextProtos []string `json:"nextProtos,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_execution.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_execution.go new file mode 100644 index 000000000..8879faea8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_execution.go @@ -0,0 +1,127 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// ExecutionManagedByLabel is the label of a deploy item that contains the name of the managed execution. +// This label is used by the extension controller to identify its managed deploy items +// todo: add conversion +const ExecutionManagedByLabel = "execution.landscaper.gardener.cloud/managed-by" + +// ExecutionManagedNameAnnotation is the unique identifier of the deploy items managed by a execution. +// It corresponds to the execution item name. +// todo: add conversion +const ExecutionManagedNameAnnotation = "execution.landscaper.gardener.cloud/name" + +// ReconcileDeployItemsCondition is the Conditions type to indicate the deploy items status. +const ReconcileDeployItemsCondition ConditionType = "ReconcileDeployItems" + +type ExecutionPhase string + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ExecutionList contains a list of Executions‚ +type ExecutionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Execution `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Execution contains the configuration of a execution and deploy item +type Execution struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec defines a execution and its items + Spec ExecutionSpec `json:"spec"` + // Status contains the current status of the execution. + // +optional + Status ExecutionStatus `json:"status"` +} + +// ExecutionSpec defines a execution plan. +type ExecutionSpec struct { + // Context defines the current context of the execution. + // +optional + Context string `json:"context,omitempty"` + // DeployItems defines all execution items that need to be scheduled. + DeployItems DeployItemTemplateList `json:"deployItems,omitempty"` + + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints, component descriptors and jsonschemas from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []ObjectReference `json:"registryPullSecrets,omitempty"` +} + +// ExecutionStatus contains the current status of a execution. +type ExecutionStatus struct { + // Phase is the current phase of the execution . + Phase ExecutionPhase `json:"phase,omitempty"` + + // ObservedGeneration is the most recent generation observed for this Execution. + // It corresponds to the Execution generation, which is updated on mutation by the landscaper. + ObservedGeneration int64 `json:"observedGeneration"` + + // Conditions contains the actual condition of a execution + Conditions []Condition `json:"conditions,omitempty"` + + // LastError describes the last error that occurred. + LastError *Error `json:"lastError,omitempty"` + + // ExportReference references the object that contains the exported values. + // only used for operation purpose. + // +optional + ExportReference *ObjectReference `json:"exportRef,omitempty"` + + // DeployItemReferences contain the state of all deploy items. + DeployItemReferences []VersionedNamedObjectReference `json:"deployItemRefs,omitempty"` + + // ExecutionGenerations stores which generation the execution had when it last applied a specific deployitem. + // So in this case, the observedGeneration refers to the executions generation. + ExecutionGenerations []ExecutionGeneration `json:"execGenerations,omitempty"` +} + +// ExecutionGeneration links a deployitem to the generation of the execution when it was applied. +type ExecutionGeneration struct { + // Name is the name of the deployitem this generation refers to. + Name string `json:"name"` + // ObservedGeneration stores the generation which the execution had when it last applied the referenced deployitem. + ObservedGeneration int64 `json:"observedGeneration"` +} + +// DeployItemTemplateList is a list of deploy item templates +type DeployItemTemplateList []DeployItemTemplate + +// DeployItemTemplate defines a execution element that is translated into a deploy item. +// +k8s:deepcopy-gen=true +type DeployItemTemplate struct { + // Name is the unique name of the execution. + Name string `json:"name"` + + // DataType is the DeployItem type of the execution. + Type DeployItemType `json:"type"` + + // Target is the object reference to the target that the deploy item should deploy to. + // +optional + Target *ObjectReference `json:"target,omitempty"` + + // Labels is the map of labels to be added to the deploy item. + // +optional + Labels map[string]string `json:"labels,omitempty"` + + // ProviderConfiguration contains the type specific configuration for the execution. + Configuration *runtime.RawExtension `json:"config"` + + // DependsOn lists deploy items that need to be executed before this one + DependsOn []string `json:"dependsOn,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_installation.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_installation.go new file mode 100644 index 000000000..6f149847d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_installation.go @@ -0,0 +1,417 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ComponentInstallationPhase is a string that contains the component's installation phase +type ComponentInstallationPhase string + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstallationList contains a list of Components +type InstallationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Installation `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Installation contains the configuration of a installation +type Installation struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec contains the specification for a installation. + Spec InstallationSpec `json:"spec"` + + // Status contains the status of the installation. + // +optional + Status InstallationStatus `json:"status"` +} + +// InstallationSpec defines a component installation. +type InstallationSpec struct { + // Context defines the current context of the installation. + // +optional + Context string `json:"context,omitempty"` + + //ComponentDescriptor is a reference to the installation's component descriptor + // +optional + ComponentDescriptor *ComponentDescriptorDefinition `json:"componentDescriptor,omitempty"` + + // Blueprint is the resolved reference to the definition. + Blueprint BlueprintDefinition `json:"blueprint"` + + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints, component descriptors and jsonschemas from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []ObjectReference `json:"registryPullSecrets,omitempty"` + + // Imports define the imported data objects and targets. + // +optional + Imports InstallationImports `json:"imports,omitempty"` + + // ImportDataMappings contains a template for restructuring imports. + // It is expected to contain a key for every blueprint-defined data import. + // Missing keys will be defaulted to their respective data import. + // Example: namespace: (( installation.imports.namespace )) + // +optional + ImportDataMappings map[string]AnyJSON `json:"importDataMappings,omitempty"` + + // Exports define the exported data objects and targets. + // +optional + Exports InstallationExports `json:"exports,omitempty"` + + // ExportDataMappings contains a template for restructuring exports. + // It is expected to contain a key for every blueprint-defined data export. + // Missing keys will be defaulted to their respective data export. + // Example: namespace: (( blueprint.exports.namespace )) + // +optional + ExportDataMappings map[string]AnyJSON `json:"exportDataMappings,omitempty"` +} + +// InstallationStatus contains the current status of a Installation. +type InstallationStatus struct { + // Phase is the current phase of the installation. + Phase ComponentInstallationPhase `json:"phase,omitempty"` + + // ObservedGeneration is the most recent generation observed for this ControllerInstallations. + // It corresponds to the ControllerInstallations generation, which is updated on mutation by the landscaper. + ObservedGeneration int64 `json:"observedGeneration"` + + // Conditions contains the actual condition of a installation + Conditions []Condition `json:"conditions,omitempty"` + + // LastError describes the last error that occurred. + LastError *Error `json:"lastError,omitempty"` + + // ConfigGeneration is the generation of the exported values. + ConfigGeneration string `json:"configGeneration"` + + // Imports contain the state of the imported values. + Imports []ImportStatus `json:"imports,omitempty"` + + // InstallationReferences contain all references to sub-components + // that are created based on the component definition. + InstallationReferences []NamedObjectReference `json:"installationRefs,omitempty"` + + // ExecutionReference is the reference to the execution that schedules the templated execution items. + ExecutionReference *ObjectReference `json:"executionRef,omitempty"` +} + +// InstallationImports defines import of data objects and targets. +type InstallationImports struct { + // Data defines all data object imports. + // +optional + Data []DataImport `json:"data,omitempty"` + + // Targets defines all target imports. + // +optional + Targets []TargetImport `json:"targets,omitempty"` + + // ComponentDescriptors defines all component descriptor imports. + // +optional + ComponentDescriptors []ComponentDescriptorImport `json:"componentDescriptors,omitempty"` +} + +// InstallationExports defines exports of data objects and targets. +type InstallationExports struct { + // Data defines all data object exports. + // +optional + Data []DataExport `json:"data,omitempty"` + + // Targets defines all target exports. + // +optional + Targets []TargetExport `json:"targets,omitempty"` +} + +// DataImport is a data object import. +type DataImport struct { + // Name the internal name of the imported/exported data. + Name string `json:"name"` + + // DataRef is the name of the in-cluster data object. + DataRef string `json:"dataRef"` + + // Version specifies the imported data version. + // defaults to "v1" + // +optional + Version string `json:"version,omitempty"` + + // SecretRef defines a data reference from a secret. + // This method is not allowed in installation templates. + // +optional + SecretRef *SecretReference `json:"secretRef,omitempty"` + + // ConfigMapRef defines a data reference from a configmap. + // This method is not allowed in installation templates. + // +optional + ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"` +} + +// DataExport is a data object export. +type DataExport struct { + // Name the internal name of the imported/exported data. + Name string `json:"name"` + + // DataRef is the name of the in-cluster data object. + DataRef string `json:"dataRef"` +} + +// TargetImport is either a single target or a target list import. +type TargetImport struct { + // Name the internal name of the imported target. + Name string `json:"name"` + + // Target is the name of the in-cluster target object. + // Exactly one of Target, Targets, and TargetListReference has to be specified. + // +optional + Target string `json:"target,omitempty"` + + // Targets is a list of in-cluster target objects. + // Exactly one of Target, Targets, and TargetListReference has to be specified. + // +optional + Targets []string `json:"targets"` + + // TargetListReference can (only) be used to import a targetlist that has been imported by the parent installation. + // Exactly one of Target, Targets, and TargetListReference has to be specified. + // +optional + TargetListReference string `json:"targetListRef,omitempty"` +} + +// TargetExport is a single target export. +type TargetExport struct { + // Name the internal name of the exported target. + Name string `json:"name"` + + // Target is the name of the in-cluster target object. + // +optional + Target string `json:"target,omitempty"` +} + +type ComponentDescriptorImport struct { + // Name the internal name of the imported/exported component descriptor. + Name string `json:"name"` + + // Ref is a reference to a component descriptor in a registry. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + Ref *ComponentDescriptorReference `json:"ref,omitempty"` + + // SecretRef is a reference to a key in a secret in the cluster. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + SecretRef *SecretReference `json:"secretRef,omitempty"` + + // ConfigMapRef is a reference to a key in a config map in the cluster. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"` + + // List represents a list of component descriptor imports. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + List []ComponentDescriptorImportData `json:"list,omitempty"` + + // DataRef can be used to reference component descriptors imported by the parent installation. + // This field is used in subinstallation templates only, use one of the other fields instead for root installations. + // +optional + DataRef string `json:"dataRef,omitempty"` +} + +type ComponentDescriptorImportData struct { + // Ref is a reference to a component descriptor in a registry. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + Ref *ComponentDescriptorReference `json:"ref,omitempty"` + + // SecretRef is a reference to a key in a secret in the cluster. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + SecretRef *SecretReference `json:"secretRef,omitempty"` + + // ConfigMapRef is a reference to a key in a config map in the cluster. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"` + + // DataRef can be used to reference component descriptors imported by the parent installation. + // This field is used in subinstallation templates only, use one of the other fields instead for root installations. + // +optional + DataRef string `json:"dataRef,omitempty"` +} + +// BlueprintDefinition defines the blueprint that should be used for the installation. +type BlueprintDefinition struct { + // Reference defines a remote reference to a blueprint + // +optional + Reference *RemoteBlueprintReference `json:"ref,omitempty"` + // Inline defines a inline yaml filesystem with a blueprint. + // +optional + Inline *InlineBlueprint `json:"inline,omitempty"` +} + +// RemoteBlueprintReference describes a reference to a blueprint defined by a component descriptor. +type RemoteBlueprintReference struct { + // ResourceName is the name of the blueprint as defined by a component descriptor. + ResourceName string `json:"resourceName"` +} + +// InlineBlueprint defines an inline blueprint with component descriptor and +// filesystem. +type InlineBlueprint struct { + // Filesystem defines a inline yaml filesystem with a blueprint. + Filesystem AnyJSON `json:"filesystem"` +} + +// ComponentDescriptorDefinition defines the component descriptor that should be used +// for the installatoin +type ComponentDescriptorDefinition struct { + // ComponentDescriptorReference is the reference to a component descriptor + // +optional + Reference *ComponentDescriptorReference `json:"ref,omitempty"` + + // InlineDescriptorReference defines an inline component descriptor + // +optional + Inline *cdv2.ComponentDescriptor `json:"inline,omitempty"` +} + +// ComponentDescriptorReference is the reference to a component descriptor. +// given an optional context. +type ComponentDescriptorReference struct { + // RepositoryContext defines the context of the component repository to resolve blueprints. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject `json:"repositoryContext,omitempty"` + // ComponentName defines the unique of the component containing the resource. + ComponentName string `json:"componentName"` + // Version defines the version of the component. + Version string `json:"version"` +} + +// ObjectMeta returns the component descriptor v2 compatible object meta for a resource reference. +func (r ComponentDescriptorReference) ObjectMeta() cdv2.ObjectMeta { + return cdv2.ObjectMeta{ + Name: r.ComponentName, + Version: r.Version, + } +} + +// StaticDataSource defines a static data source +type StaticDataSource struct { + // Value defined inline a raw data + // +optional + Value AnyJSON `json:"value,omitempty"` + + // ValueFrom defines data from an external resource + ValueFrom *StaticDataValueFrom `json:"valueFrom,omitempty"` +} + +// StaticDataValueFrom defines a static data that is read from a external resource. +type StaticDataValueFrom struct { + // Selects a key of a secret in the installations's namespace + // +optional + SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"` + + // Selects a key from multiple secrets in the installations's namespace + // that matches the given labels. + // +optional + SecretLabelSelector *SecretLabelSelectorRef `json:"secretLabelSelector,omitempty"` +} + +// SecretLabelSelectorRef selects secrets with the given label and key. +type SecretLabelSelectorRef struct { + // Selector is a map of labels to select specific secrets. + Selector map[string]string `json:"selector"` + + // The key of the secret to select from. Must be a valid secret key. + Key string `json:"key"` +} + +// ImportStatusType defines the type of a import status. +type ImportStatusType string + +const ( + // DataImportStatusType is an ImportStatusType for data objects + DataImportStatusType ImportStatusType = "dataobject" + // TargetImportStatusType is an ImportStatusType for targets + TargetImportStatusType ImportStatusType = "target" + // TargetListImportStatusType is an ImportStatusType for target lists + TargetListImportStatusType ImportStatusType = "targetList" + // CDImportStatusType is an ImportStatusType for component descriptors + CDImportStatusType ImportStatusType = "componentDescriptor" + // CDListImportStatusType is an ImportStatusType for component descriptor lists + CDListImportStatusType ImportStatusType = "componentDescriptorList" +) + +// TargetImportStatus +type TargetImportStatus struct { + // Target is the name of the in-cluster target object. + Target string `json:"target,omitempty"` + // SourceRef is the reference to the installation from where the value is imported + SourceRef *ObjectReference `json:"sourceRef,omitempty"` + // ConfigGeneration is the generation of the imported value. + ConfigGeneration string `json:"configGeneration,omitempty"` +} + +/// CDImportStatus is the import status of a component descriptor +type CDImportStatus struct { + // ComponentDescriptorRef is a reference to a component descriptor + // +optional + ComponentDescriptorRef *ComponentDescriptorReference `json:"componentDescriptorRef,omitempty"` + // SecretRef is the name of the secret. + // +optional + SecretRef string `json:"secretRef,omitempty"` + // ConfigMapRef is the name of the imported configmap. + // +optional + ConfigMapRef string `json:"configMapRef,omitempty"` + // SourceRef is the reference to the installation from where the value is imported + SourceRef *ObjectReference `json:"sourceRef,omitempty"` +} + +// ImportStatus hold the state of a import. +type ImportStatus struct { + // Name is the distinct identifier of the import. + // Can be either from data or target imports + Name string `json:"name"` + // Type defines the kind of import. + // Can be either DataObject, Target, or TargetList + Type ImportStatusType `json:"type"` + // Target is the name of the in-cluster target object. + // +optional + Target string `json:"target,omitempty"` + // TargetList is a list of import statuses for in-cluster target objects. + // +optional + Targets []TargetImportStatus `json:"targetList,omitempty"` + // ComponentDescriptorRef is a reference to a component descriptor + // +optional + ComponentDescriptorRef *ComponentDescriptorReference `json:"componentDescriptorRef,omitempty"` + // ComponentDescriptors is a list of import statuses for component descriptors + // +optional + ComponentDescriptors []CDImportStatus `json:"componentDescriptorList,omitempty"` + // DataRef is the name of the in-cluster data object. + // +optional + DataRef string `json:"dataRef,omitempty"` + // SecretRef is the name of the secret. + // +optional + SecretRef string `json:"secretRef,omitempty"` + // ConfigMapRef is the name of the imported configmap. + // +optional + ConfigMapRef string `json:"configMapRef,omitempty"` + // SourceRef is the reference to the installation from where the value is imported + // +optional + SourceRef *ObjectReference `json:"sourceRef,omitempty"` + // ConfigGeneration is the generation of the imported value. + // +optional + ConfigGeneration string `json:"configGeneration,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_installationtemplate.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_installationtemplate.go new file mode 100644 index 000000000..9ac3dbb1b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_installationtemplate.go @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstallationTemplate defines a subinstallation in a blueprint. +type InstallationTemplate struct { + metav1.TypeMeta `json:",inline"` + + // Name is the unique name of the step + Name string `json:"name"` + + // Reference defines a reference to a Blueprint. + // The blueprint can reside in an OCI or other supported location. + Blueprint InstallationTemplateBlueprintDefinition `json:"blueprint"` + + // Imports define the imported data objects and targets. + // +optional + Imports InstallationImports `json:"imports,omitempty"` + + // ImportDataMappings contains a template for restructuring imports. + // It is expected to contain a key for every blueprint-defined data import. + // Missing keys will be defaulted to their respective data import. + // Example: namespace: (( installation.imports.namespace )) + // +optional + ImportDataMappings map[string]AnyJSON `json:"importDataMappings,omitempty"` + + // Exports define the exported data objects and targets. + // +optional + Exports InstallationExports `json:"exports,omitempty"` + + // ExportDataMappings contains a template for restructuring exports. + // It is expected to contain a key for every blueprint-defined data export. + // Missing keys will be defaulted to their respective data export. + // Example: namespace: (( blueprint.exports.namespace )) + // +optional + ExportDataMappings map[string]AnyJSON `json:"exportDataMappings,omitempty"` +} + +// InstallationTemplateList is a list of installation templates. +type InstallationTemplateList []*InstallationTemplate + +// InstallationTemplateBlueprintDefinition contains either a reference to a blueprint or an inline definition. +type InstallationTemplateBlueprintDefinition struct { + // Ref is a reference to a blueprint. + // Only blueprints that are defined by the component descriptor of the current blueprint can be referenced here. + // Example: cd://componentReference/dns/resources/blueprint + // +optional + Ref string `json:"ref,omitempty"` + + // Filesystem defines a virtual filesystem with all files needed for a blueprint. + // The filesystem must be a YAML filesystem. + // +optional + Filesystem AnyJSON `json:"filesystem,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_shared.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_shared.go new file mode 100644 index 000000000..ba8df66e3 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_shared.go @@ -0,0 +1,314 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + "encoding/json" + "errors" + "fmt" + "time" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// JSONSchemaDefinition defines a jsonschema. +type JSONSchemaDefinition struct { + json.RawMessage `json:",inline"` +} + +// MarshalJSON implements the json marshaling for a JSON +func (s JSONSchemaDefinition) MarshalJSON() ([]byte, error) { + return s.RawMessage.MarshalJSON() +} + +// UnmarshalJSON implements json unmarshaling for a JSON +func (s *JSONSchemaDefinition) UnmarshalJSON(data []byte) error { + raw := json.RawMessage{} + if err := raw.UnmarshalJSON(data); err != nil { + return err + } + *s = JSONSchemaDefinition{RawMessage: raw} + return nil +} + +func (_ JSONSchemaDefinition) OpenAPISchemaType() []string { return []string{"object"} } +func (_ JSONSchemaDefinition) OpenAPISchemaFormat() string { return "" } + +// Duration is a wrapper for time.Duration that implements JSON marshalling and openapi scheme. +type Duration struct { + time.Duration +} + +// MarshalJSON implements the json marshaling for a Duration +func (d Duration) MarshalJSON() ([]byte, error) { + if d.Duration == 0 { + return []byte("\"none\""), nil + } + return []byte(fmt.Sprintf("%q", d.Duration.String())), nil +} + +// UnmarshalJSON implements json unmarshaling for a Duration +func (d *Duration) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + if s == "none" { + *d = Duration{Duration: 0} + return nil + } + dur, err := time.ParseDuration(s) + if err != nil { + return fmt.Errorf("unable to parse string into a duration: %w", err) + } + *d = Duration{Duration: dur} + return nil +} + +func (_ Duration) OpenAPISchemaType() []string { return []string{"string"} } +func (_ Duration) OpenAPISchemaFormat() string { return "" } + +// AnyJSON enhances the json.RawMessages with a dedicated openapi definition so that all +// it is correctly generated +type AnyJSON struct { + json.RawMessage `json:",inline"` +} + +// NewAnyJSON creates a new any json object. +func NewAnyJSON(data []byte) AnyJSON { + return AnyJSON{ + RawMessage: data, + } +} + +// MarshalJSON implements the json marshaling for a JSON +func (s AnyJSON) MarshalJSON() ([]byte, error) { + return s.RawMessage.MarshalJSON() +} + +// UnmarshalJSON implements json unmarshaling for a JSON +func (s *AnyJSON) UnmarshalJSON(data []byte) error { + raw := json.RawMessage{} + if err := raw.UnmarshalJSON(data); err != nil { + return err + } + *s = AnyJSON{RawMessage: raw} + return nil +} + +func (_ AnyJSON) OpenAPISchemaType() []string { + return []string{ + "object", + "string", + "number", + "array", + "boolean", + } +} +func (_ AnyJSON) OpenAPISchemaFormat() string { return "" } + +// ConditionStatus is the status of a condition. +type ConditionStatus string + +// ConditionType is a string alias. +type ConditionType string + +const ( + // ConditionTrue means a resource is in the condition. + ConditionTrue ConditionStatus = "True" + // ConditionFalse means a resource is not in the condition. + ConditionFalse ConditionStatus = "False" + // ConditionUnknown means Landscaper can't decide if a resource is in the condition or not. + ConditionUnknown ConditionStatus = "Unknown" + // ConditionProgressing means the condition was seen true, failed but stayed within a predefined failure threshold. + // In the future, we could add other intermediate conditions, e.g. ConditionDegraded. + ConditionProgressing ConditionStatus = "Progressing" + + // ConditionCheckError is a constant for a reason in condition. + ConditionCheckError = "ConditionCheckError" +) + +// ErrorCode is a string alias. +type ErrorCode string + +const ( + // ErrorUnauthorized indicates that the last error occurred due to invalid credentials. + ErrorUnauthorized ErrorCode = "ERR_UNAUTHORIZED" + // ErrorCleanupResources indicates that the last error occurred due to resources are stuck in deletion. + ErrorCleanupResources ErrorCode = "ERR_CLEANUP" + // ErrorConfigurationProblem indicates that the last error occurred due a configuration problem. + ErrorConfigurationProblem ErrorCode = "ERR_CONFIGURATION_PROBLEM" + // ErrorInternalProblem indicates that the last error occurred due to a servere internal error + ErrorInternalProblem ErrorCode = "ERR_INTERNAL_PROBLEM" + // ErrorReadinessCheckTimeout indicates that objects failed the readiness check within the given time + ErrorReadinessCheckTimeout ErrorCode = "ERR_READINESS_CHECK_TIMEOUT" + // ErrorTimeout indicates that an operation timed out. + ErrorTimeout ErrorCode = "ERR_TIMEOUT" + // ErrorCyclicDependencies indicates that there are cyclic dependencies between multiple installations/deployitems. + ErrorCyclicDependencies ErrorCode = "ERR_CYCLIC_DEPENDENCIES" +) + +// Condition holds the information about the state of a resource. +type Condition struct { + // DataType of the Shoot condition. + Type ConditionType `json:"type"` + // Status of the condition, one of True, False, Unknown. + Status ConditionStatus `json:"status"` + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + // Last time the condition was updated. + LastUpdateTime metav1.Time `json:"lastUpdateTime"` + // The reason for the condition's last transition. + Reason string `json:"reason"` + // A human readable message indicating details about the transition. + Message string `json:"message"` + // Well-defined error codes in case the condition reports a problem. + // +optional + Codes []ErrorCode `json:"codes,omitempty"` +} + +// Error holds information about an error that occurred. +type Error struct { + // Operation describes the operator where the error ocurred. + Operation string `json:"operation"` + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + // Last time the condition was updated. + LastUpdateTime metav1.Time `json:"lastUpdateTime"` + // The reason for the condition's last transition. + Reason string `json:"reason"` + // A human readable message indicating details about the transition. + Message string `json:"message"` + // Well-defined error codes in case the condition reports a problem. + // +optional + Codes []ErrorCode `json:"codes,omitempty"` +} + +type Operation string + +const ( + // ReconcileOperation is a annotation for the landscaper to reconcile the resource + ReconcileOperation Operation = "reconcile" + + // ForceReconcileOperation forces the landscaper to not wait for children (executions nor subinstallations) to be completed. + ForceReconcileOperation Operation = "force-reconcile" + + // AbortOperation is the annotation to let the landscaper abort all currently running children and itself. + AbortOperation Operation = "abort" +) + +// ObjectReference is the reference to a kubernetes object. +type ObjectReference struct { + // Name is the name of the kubernetes object. + Name string `json:"name"` + + // Namespace is the namespace of kubernetes object. + // +optional + Namespace string `json:"namespace"` +} + +// NamespacedName returns the namespaced name for the object reference +func (r *ObjectReference) NamespacedName() types.NamespacedName { + return types.NamespacedName{ + Name: r.Name, + Namespace: r.Namespace, + } +} + +// TypedObjectReference is a reference to a typed kubernetes object. +type TypedObjectReference struct { + // APIVersion is the group and version for the resource being referenced. + // If APIVersion is not specified, the specified Kind must be in the core API group. + // For any other third-party types, APIVersion is required. + APIVersion string `json:"apiVersion"` + // Kind is the type of resource being referenced + Kind string `json:"kind"` + + ObjectReference `json:",inline"` +} + +// NamedObjectReference is a named reference to a specific resource. +type NamedObjectReference struct { + // Name is the unique name of the reference. + Name string `json:"name"` + + // Reference is the reference to an object. + Reference ObjectReference `json:"ref"` +} + +// VersionedObjectReference is a reference to a object with its last observed resource generation. +// This struct is used by status fields. +type VersionedObjectReference struct { + ObjectReference `json:",inline"` + + // ObservedGeneration defines the last observed generation of the referenced resource. + ObservedGeneration int64 `json:"observedGeneration"` +} + +// VersionedNamedObjectReference is a named reference to a object with its last observed resource generation. +// This struct is used by status fields. +type VersionedNamedObjectReference struct { + // Name is the unique name of the reference. + Name string `json:"name"` + + // Reference is the reference to an object. + Reference VersionedObjectReference `json:"ref"` +} + +// SecretReference is reference to data in a secret. +// The secret can also be in a different namespace. +type SecretReference struct { + ObjectReference `json:",inline"` + // Key is the name of the key in the secret that holds the data. + // +optional + Key string `json:"key"` +} + +// ConfigMapReference is reference to data in a configmap. +// The configmap can also be in a different namespace. +type ConfigMapReference struct { + ObjectReference `json:",inline"` + // Key is the name of the key in the configmap that holds the data. + // +optional + Key string `json:"key"` +} + +// ComponentDescriptorKind is the kind of a component descriptor. +// It can be a component or a resource. +type ComponentDescriptorKind string + +var UnknownComponentDescriptorKindKindError = errors.New("UnknownComponentDescriptorKindKind") + +const ( + // ComponentResourceKind is the kind of a component. + ComponentResourceKind ComponentDescriptorKind = "component" + // ResourceKind is the kind of a local resource. + ResourceKind ComponentDescriptorKind = "resource" +) + +// ResourceReference defines the reference to a resource defined in a component descriptor. +type ResourceReference struct { + // ComponentName defines the unique of the component containing the resource. + ComponentName string `json:"componentName"` + // ResourceName defines the name of the resource. + ResourceName string `json:"resourceName"` +} + +// VersionedResourceReference defines the reference to a resource with its version. +type VersionedResourceReference struct { + ResourceReference `json:",inline"` + // Version defines the version of the component. + Version string `json:"version"` +} + +// ObjectMeta returns the component descriptor v2 compatible object meta for a resource reference. +func (r VersionedResourceReference) ObjectMeta() cdv2.ObjectMeta { + return cdv2.ObjectMeta{ + Name: r.ComponentName, + Version: r.Version, + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_target.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_target.go new file mode 100644 index 000000000..dcf1291a8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/types_target.go @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package core + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TargetType defines the type of the target. +type TargetType string + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TargetList contains a list of Targets +type TargetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Target `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Target defines a specific data object that defines target environment. +// Every deploy item can have a target which is used by the deployer to install the specific application. +type Target struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec TargetSpec `json:"spec"` +} + +// TargetSpec contains the definition of a target. +type TargetSpec struct { + // Type is the type of the target that defines its data structure. + // The actual schema may be defined by a target type crd in the future. + Type TargetType `json:"type"` + // Configuration contains the target type specific configuration. + // +optional + Configuration AnyJSON `json:"config,omitempty"` +} + +// TargetTemplate exposes specific parts of a target that are used in the exports +// to export a target +type TargetTemplate struct { + TargetSpec `json:",inline"` + + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. May match selectors of replication controllers + // and services. + // More info: http://kubernetes.io/docs/user-guide/labels + // +optional + Labels map[string]string `json:"labels,omitempty"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. They are not + // queryable and should be preserved when modifying objects. + // More info: http://kubernetes.io/docs/user-guide/annotations + // +optional + Annotations map[string]string `json:"annotations,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/constants.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/constants.go new file mode 100644 index 000000000..efd81559f --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/constants.go @@ -0,0 +1,88 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +const ( + // LandscapeConfigName is the namespace unique name of the landscape configuration + LandscapeConfigName = "default" + + // DataObjectSecretDataKey is the key of the secret where the landscape and installations stores their merged configuration. + DataObjectSecretDataKey = "config" + + // LandscaperFinalizer is the finalizer of the landscaper + LandscaperFinalizer = "finalizer.landscaper.gardener.cloud" + + // LandscaperDMFinalizer is the finalizer of the landscaper deployer management. + LandscaperDMFinalizer = "finalizer.deployermanagement.landscaper.gardener.cloud" + + // LandscaperAgentFinalizer is the finalizer of the landscaper agent. + LandscaperAgentFinalizer = "finalizer.agent.landscaper.gardener.cloud" + + // Annotations + + // OperationAnnotation is the annotation that specifies a operation for a component + OperationAnnotation = "landscaper.gardener.cloud/operation" + + // DeleteWithoutUninstallAnnotation is the annotation that specifies that root installations are deleted without + // uninstalling the deployed artifacts + DeleteWithoutUninstallAnnotation = "landscaper.gardener.cloud/delete-without-uninstall" + + // ReconcileTimestampAnnotation is used to recognize timeouts in deployitems + ReconcileTimestampAnnotation = "landscaper.gardener.cloud/reconcile-time" + + // AbortTimestampAnnotation is used to recognize timeouts in deployitems + AbortTimestampAnnotation = "landscaper.gardener.cloud/abort-time" + + // IgnoreAnnotation can be used to stop reconciliation for landscaper resources. + // Will only have an effect if set to 'true'. + IgnoreAnnotation = "landscaper.gardener.cloud/ignore" + + // Labels + + // LandscaperComponentLabelName is the name of the labels the holds the information about landscaper components. + // This label should be set on landscaper related components like the landscaper controller or deployers. + LandscaperComponentLabelName = "landscaper.gardener.cloud/component" + + // DeployerRegistrationLabelName is the name of the label that holds the reference to the deployer registration + // that installation originated from. + DeployerRegistrationLabelName = "deployers.landscaper.gardener.cloud/deployer-registration" + + // DeployerEnvironmentLabelName is the name of the label that holds the reference to the deployer environment + // that installation originated from. + DeployerEnvironmentLabelName = "deployers.landscaper.gardener.cloud/environment" + + // DMEnvironmentTargetAnnotationName is the name of the annotation for the deployer host targets + // that defines which environment is responsible for the item. + DMEnvironmentTargetAnnotationName = DeployerEnvironmentLabelName + + // DeployerEnvironmentTargetAnnotationName is the default name for the target selector of specific environments. + DeployerEnvironmentTargetAnnotationName = "landscaper.gardener.cloud/environment" + + // DeployerOnlyTargetAnnotationName marks a target to be used to deploy only deployers + DeployerOnlyTargetAnnotationName = "landscaper.gardener.cloud/deployer-only" + + // NotUseDefaultDeployerAnnotation is the installation annotation that refuses the internal deployer to reconcile + // the installation. + NotUseDefaultDeployerAnnotation = "landscaper.gardener.cloud/not-internal" + + // Component Descriptor + + // InlineComponentDescriptorLabel is the label name used for nested inline component descriptors + InlineComponentDescriptorLabel = "landscaper.gardener.cloud/component-descriptor" + + // BlueprintFileName is the filename of a component definition on a local path + BlueprintFileName = "blueprint.yaml" + + // LandscaperMetricsNamespaceName describes the prometheus metrics namespace for the landscaper component + LandscaperMetricsNamespaceName = "ociclient" +) + +// DeployItem care controller constants +const ( + PickupTimeoutReason = "PickupTimeout" // for error messages + PickupTimeoutOperation = "WaitingForPickup" // for error messages + AbortingTimeoutReason = "AbortingTimeout" // for error messages + AbortingTimeoutOperation = "WaitingForAbort" // for error messages +) diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/conversion.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/conversion.go new file mode 100644 index 000000000..107111eb3 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/conversion.go @@ -0,0 +1,96 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "unsafe" + + "k8s.io/apimachinery/pkg/conversion" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/gardener/landscaper/apis/core" +) + +func addConversionFuncs(scheme *runtime.Scheme) error { + if err := scheme.AddGeneratedConversionFunc((*DeployItemTemplateList)(nil), (*core.DeployItemTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItemTemplateList_To_core_DeployItemTemplateList(a.(*DeployItemTemplateList), b.(*core.DeployItemTemplateList), scope) + }); err != nil { + return err + } + if err := scheme.AddGeneratedConversionFunc((*core.DeployItemTemplateList)(nil), (*DeployItemTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployItemTemplateList_To_v1alpha1_DeployItemTemplateList(a.(*core.DeployItemTemplateList), b.(*DeployItemTemplateList), scope) + }); err != nil { + return err + } + + if err := scheme.AddGeneratedConversionFunc((*ExecutionSpec)(nil), (*core.ExecutionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExecutionSpec_To_core_ExecutionSpec(a.(*ExecutionSpec), b.(*core.ExecutionSpec), scope) + }); err != nil { + return err + } + if err := scheme.AddGeneratedConversionFunc((*core.ExecutionSpec)(nil), (*ExecutionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ExecutionSpec_To_v1alpha1_ExecutionSpec(a.(*core.ExecutionSpec), b.(*ExecutionSpec), scope) + }); err != nil { + return err + } + + return nil +} + +// Convert_v1alpha1_ExecutionSpec_To_core_ExecutionSpec is an autogenerated conversion function. +func Convert_v1alpha1_ExecutionSpec_To_core_ExecutionSpec(in *ExecutionSpec, out *core.ExecutionSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_DeployItemTemplateList_To_core_DeployItemTemplateList((*DeployItemTemplateList)(unsafe.Pointer(&in.DeployItems)), (*core.DeployItemTemplateList)(unsafe.Pointer(&out.DeployItems)), s); err != nil { + return err + } + out.RegistryPullSecrets = *(*[]core.ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + return nil +} + +// Convert_core_ExecutionSpec_To_v1alpha1_ExecutionSpec is an autogenerated conversion function. +func Convert_core_ExecutionSpec_To_v1alpha1_ExecutionSpec(in *core.ExecutionSpec, out *ExecutionSpec, s conversion.Scope) error { + if err := Convert_core_DeployItemTemplateList_To_v1alpha1_DeployItemTemplateList((*core.DeployItemTemplateList)(unsafe.Pointer(&in.DeployItems)), (*DeployItemTemplateList)(unsafe.Pointer(&out.DeployItems)), s); err != nil { + return err + } + out.RegistryPullSecrets = *(*[]ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + return nil +} + +// Convert_v1alpha1_DeployItemTemplateList_To_core_DeployItemTemplateList is an autogenerated conversion function. +func Convert_v1alpha1_DeployItemTemplateList_To_core_DeployItemTemplateList(in *DeployItemTemplateList, out *core.DeployItemTemplateList, s conversion.Scope) error { + if in == nil { + return nil + } + + outDeployItemTmplList := make(core.DeployItemTemplateList, len(*in)) + for i, inTmpl := range *in { + outTmpl := core.DeployItemTemplate{} + if err := Convert_v1alpha1_DeployItemTemplate_To_core_DeployItemTemplate(&inTmpl, &outTmpl, s); err != nil { + return err + } + outDeployItemTmplList[i] = outTmpl + } + *out = outDeployItemTmplList + + return nil +} + +// Convert_core_DeployItemTemplateList_To_v1alpha1_DeployItemTemplateList is an autogenerated conversion function. +func Convert_core_DeployItemTemplateList_To_v1alpha1_DeployItemTemplateList(in *core.DeployItemTemplateList, out *DeployItemTemplateList, s conversion.Scope) error { + if in == nil { + return nil + } + + outDeployItemTmplList := make(DeployItemTemplateList, len(*in)) + for i, inTmpl := range *in { + outTmpl := DeployItemTemplate{} + if err := Convert_core_DeployItemTemplate_To_v1alpha1_DeployItemTemplate(&inTmpl, &outTmpl, s); err != nil { + return err + } + outDeployItemTmplList[i] = outTmpl + } + *out = outDeployItemTmplList + + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/defaults.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/defaults.go new file mode 100644 index 000000000..4c4fa7eb8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/defaults.go @@ -0,0 +1,156 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/utils/pointer" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_Blueprint sets default values for blueprint objects +func SetDefaults_Blueprint(obj *Blueprint) { + if len(obj.JSONSchemaVersion) == 0 { + obj.JSONSchemaVersion = "https://json-schema.org/draft/2019-09/schema" + } + + SetDefaults_DefinitionImport(&obj.Imports) + SetDefaults_DefinitionExport(&obj.Exports) +} + +// SetDefaults_DefinitionImport sets default values for the ImportDefinition objects +func SetDefaults_DefinitionImport(imports *ImportDefinitionList) { + if imports == nil { + return + } + for i := 0; i < len(*imports); i++ { + imp := &(*imports)[i] + if imp.Required == nil { + imp.Required = pointer.BoolPtr(true) + } + SetDefaults_DefinitionImport(&imp.ConditionalImports) + if len(imp.Type) != 0 { + // type is already set + continue + } + if imp.Schema != nil && len(imp.TargetType) != 0 { + // definition is invalid + continue + } + if imp.Schema != nil { + imp.Type = ImportTypeData + } else if len(imp.TargetType) != 0 { + imp.Type = ImportTypeTarget + } + } +} + +// SetDefaults_DefinitionExport sets default values for the ImportDefinition objects +func SetDefaults_DefinitionExport(exports *ExportDefinitionList) { + if exports == nil { + return + } + for i := 0; i < len(*exports); i++ { + exp := &(*exports)[i] + if len(exp.Type) != 0 { + // type is already set + continue + } + if exp.Schema != nil && len(exp.TargetType) != 0 { + // definition is invalid + continue + } + if exp.Schema != nil { + exp.Type = ExportTypeData + } else if len(exp.TargetType) != 0 { + exp.Type = ExportTypeTarget + } + } +} + +// SetDefaults_Installation sets default values for installation objects +func SetDefaults_Installation(obj *Installation) { + + // default the repository context to "default" + if len(obj.Spec.Context) == 0 { + obj.Spec.Context = DefaultContextName + } + + // default the namespace of imports + for i, dataImport := range obj.Spec.Imports.Data { + if dataImport.ConfigMapRef != nil { + if len(dataImport.ConfigMapRef.Namespace) == 0 { + obj.Spec.Imports.Data[i].ConfigMapRef.Namespace = obj.GetNamespace() + } + } + if dataImport.SecretRef != nil { + if len(dataImport.SecretRef.Namespace) == 0 { + obj.Spec.Imports.Data[i].SecretRef.Namespace = obj.GetNamespace() + } + } + } + for i, cdImport := range obj.Spec.Imports.ComponentDescriptors { + if cdImport.ConfigMapRef != nil { + if len(cdImport.ConfigMapRef.Namespace) == 0 { + obj.Spec.Imports.ComponentDescriptors[i].ConfigMapRef.Namespace = obj.GetNamespace() + } + } + if cdImport.SecretRef != nil { + if len(cdImport.SecretRef.Namespace) == 0 { + obj.Spec.Imports.ComponentDescriptors[i].SecretRef.Namespace = obj.GetNamespace() + } + } + if cdImport.Ref != nil { + if cdImport.Ref.RepositoryContext == nil { + if obj.Spec.ComponentDescriptor != nil && obj.Spec.ComponentDescriptor.Reference != nil { + cdImport.Ref.RepositoryContext = obj.Spec.ComponentDescriptor.Reference.RepositoryContext + } + } + } + + if len(cdImport.List) != 0 { + for j := range cdImport.List { + impDef := &cdImport.List[j] + + if impDef.ConfigMapRef != nil { + if len(impDef.ConfigMapRef.Namespace) == 0 { + impDef.ConfigMapRef.Namespace = obj.GetNamespace() + } + } + if impDef.SecretRef != nil { + if len(impDef.SecretRef.Namespace) == 0 { + impDef.SecretRef.Namespace = obj.GetNamespace() + } + } + if impDef.Ref != nil { + if impDef.Ref.RepositoryContext == nil { + if obj.Spec.ComponentDescriptor != nil && obj.Spec.ComponentDescriptor.Reference != nil { + impDef.Ref.RepositoryContext = obj.Spec.ComponentDescriptor.Reference.RepositoryContext + } + } + } + } + } + } +} + +// SetDefaults_Execution sets default values for Execution objects +func SetDefaults_Execution(obj *Execution) { + // default the repository context to "default" + if len(obj.Spec.Context) == 0 { + obj.Spec.Context = DefaultContextName + } +} + +// SetDefaults_DeployItem sets default values for DeployItem objects +func SetDefaults_DeployItem(obj *DeployItem) { + // default the repository context to "default" + if len(obj.Spec.Context) == 0 { + obj.Spec.Context = DefaultContextName + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/doc.go new file mode 100644 index 000000000..910a61232 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/doc.go @@ -0,0 +1,15 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package v1alpha1 is the v1alpha1 version of the API. +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/gardener/landscaper/apis/core +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +//go:generate gen-crd-api-reference-docs -api-dir . -config ../../../hack/api-reference/core-config.json -template-dir ../../../hack/api-reference/template -out-file ../../../docs/api-reference/core.md + +// Package v1alpha1 is a version of the API. +// +groupName=landscaper.gardener.cloud +package v1alpha1 diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/register.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/register.go new file mode 100644 index 000000000..a0550a1ea --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/register.go @@ -0,0 +1,89 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package v1alpha1 is the v1alpha1 version of the API. +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + lsschema "github.com/gardener/landscaper/apis/schema" + + "github.com/gardener/landscaper/apis/core" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: core.GroupName, Version: "v1alpha1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder is a new Schema Builder which registers our API. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs, addConversionFuncs) + localSchemeBuilder = &SchemeBuilder + // AddToScheme is a reference to the Schema Builder's AddToScheme function. + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &DataObject{}, + &DataObjectList{}, + &Target{}, + &TargetList{}, + &Blueprint{}, + &InstallationTemplate{}, + &Installation{}, + &InstallationList{}, + &Execution{}, + &ExecutionList{}, + &DeployItem{}, + &DeployItemList{}, + &Context{}, + &ContextList{}, + &ComponentOverwrites{}, + &ComponentOverwritesList{}, + &Environment{}, + &EnvironmentList{}, + &DeployerRegistration{}, + &DeployerRegistrationList{}, + ) + if err := RegisterConversions(scheme); err != nil { + return err + } + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} + +// ResourceDefinition defines the custom resources of this version. +var ResourceDefinition = func() lsschema.CustomResourceDefinitions { + return lsschema.CustomResourceDefinitions{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + OutputDir: "../pkg/landscaper/crdmanager/crdresources", + + Definitions: []lsschema.CustomResourceDefinition{ + InstallationDefinition, + ExecutionDefinition, + DeployItemDefinition, + DataObjectDefinition, + TargetDefinition, + ContextDefinition, + DeployerRegistrationDefinition, + EnvironmentDefinition, + ComponentOverwritesDefinition, + }, + } +}() diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_blueprint.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_blueprint.go new file mode 100644 index 000000000..cda5c0f36 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_blueprint.go @@ -0,0 +1,203 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// BlueprintResourceType is the name of the blueprint resource defined in component descriptors. +const BlueprintResourceType = "blueprint" + +// ImportType is a string alias +type ImportType string + +// ExportType is a string alias +type ExportType string + +// ImportTypeData is the import type for data imports +const ImportTypeData = ImportType("data") + +// ImportTypeTarget is the import type for target imports +const ImportTypeTarget = ImportType("target") + +// ImportTypeTargetList is the import type for targetlist imports +const ImportTypeTargetList = ImportType("targetList") + +// ImportTypeComponentDescriptor is the import type for component descriptor imports +const ImportTypeComponentDescriptor = ImportType("componentDescriptor") + +// ImportTypeComponentDescriptorList is the import type for component descriptor list imports +const ImportTypeComponentDescriptorList = ImportType("componentDescriptorList") + +// ExportTypeData is the export type for data exports +const ExportTypeData = ExportType(ImportTypeData) + +// ExportTypeTarget is the export type for target exports +const ExportTypeTarget = ExportType(ImportTypeTarget) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Blueprint contains the configuration of a component +// +kubebuilder:skip +type Blueprint struct { + metav1.TypeMeta `json:",inline"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. + // +optional + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` + + // JSONSchemaVersion defines the default jsonschema version of the blueprint. + // e.g. "https://json-schema.org/draft/2019-09/schema" + // +optional + JSONSchemaVersion string `json:"jsonSchemaVersion"` + + // LocalTypes defines additional blueprint local schemas + // +optional + LocalTypes map[string]JSONSchemaDefinition `json:"localTypes,omitempty"` + + // Imports define the import values that are needed for the definition and its sub-definitions. + // +optional + Imports ImportDefinitionList `json:"imports,omitempty"` + + // Exports define the exported values of the definition and its sub-definitions + // +optional + Exports ExportDefinitionList `json:"exports,omitempty"` + + // Subinstallations defines an optional list of subinstallations (for aggregating blueprints). + // +optional + Subinstallations SubinstallationTemplateList `json:"subinstallations,omitempty"` + + // SubinstallationExecutions defines the templating executors that are sequentially executed by the landscaper. + // The templates must return a list of installation templates. + // Both subinstallations and SubinstallationExecutions are valid options and will be merged. + // +optional + SubinstallationExecutions []TemplateExecutor `json:"subinstallationExecutions,omitempty"` + + // DeployExecutions defines the templating executors that are sequentially executed by the landscaper. + // The templates must return a list of deploy item templates. + // +optional + DeployExecutions []TemplateExecutor `json:"deployExecutions,omitempty"` + + // ExportExecutions defines the templating executors that are used to generate the exports. + // +optional + ExportExecutions []TemplateExecutor `json:"exportExecutions,omitempty"` +} + +// ImportDefinitionList defines a list of import defiinitions. +type ImportDefinitionList []ImportDefinition + +// ImportDefinition defines a imported value +type ImportDefinition struct { + FieldValueDefinition `json:",inline"` + + // Type specifies which kind of object is being imported. + // This field should be set and will likely be mandatory in future. + // +optional + Type ImportType `json:"type,omitempty"` + + // Required specifies whether the import is required for the component to run. + // Defaults to true. + // +optional + Required *bool `json:"required"` + + // Default sets a default value for the current import that is used if the key is not set. + Default Default `json:"default,omitempty"` + + // ConditionalImports are Imports that are only valid if this imports is satisfied. + // Does only make sense for optional imports. + // +optional + ConditionalImports ImportDefinitionList `json:"imports,omitempty"` +} + +// ExportDefinitionList defines a list of export definitions. +type ExportDefinitionList []ExportDefinition + +// ExportDefinition defines a exported value +type ExportDefinition struct { + FieldValueDefinition `json:",inline"` + + // Type specifies which kind of object is being exported. + // This field should be set and will likely be mandatory in future. + // +optional + Type ExportType `json:"type,omitempty"` +} + +// FieldValueDefinition defines a im- or exported field. +// Either schema or target type have to be defined +type FieldValueDefinition struct { + // Name defines the field name to search for the value and map to exports. + // Ref: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#selecting-fields + Name string `json:"name"` + // Schema defines the imported value as jsonschema. + // +optional + Schema *JSONSchemaDefinition `json:"schema,omitempty"` + // TargetType defines the type of the imported target. + // +optional + TargetType string `json:"targetType,omitempty"` +} + +// Default defines a default value (future idea: also reference?). +type Default struct { + Value AnyJSON `json:"value"` +} + +// BlueprintStaticDataSource defines a static data source for a blueprint +type BlueprintStaticDataSource struct { + // Value defined inline a raw data + // +optional + Value AnyJSON `json:"value,omitempty"` + + // ValueFrom defines data from an external resource + ValueFrom *StaticDataValueFrom `json:"valueFrom,omitempty"` +} + +// BlueprintStaticDataValueFrom defines static data that is read from a external resource. +type BlueprintStaticDataValueFrom struct { + // Selects a key of a secret in the installations's namespace + // +optional + LocalPath string `json:"localPath,omitempty"` +} + +// TemplateType describes the template mechanism. +type TemplateType string + +// GOTemplateType describes the go templating type. +const GOTemplateType TemplateType = "GoTemplate" + +// SpiffTemplateType describes the spiff templating type. +const SpiffTemplateType TemplateType = "Spiff" + +// TemplateExecutor describes a templating mechanism and configuration. +type TemplateExecutor struct { + // Name is the unique name of the template + Name string `json:"name"` + // Type describes the templating mechanism. + Type TemplateType `json:"type"` + // File is the path to the template in the blueprint's content. + // +optional + File string `json:"file,omitempty"` + // Template contains an optional inline template. + // The template has to be of string for go template + // and a valid yaml/json for spiff. + // + optional + Template AnyJSON `json:"template,omitempty"` +} + +// SubinstallationTemplateList is a list of installation templates +type SubinstallationTemplateList []SubinstallationTemplate + +// SubinstallationTemplate defines a subinstallation template. +type SubinstallationTemplate struct { + // File references a subinstallation template stored in another file. + // +optional + File string `json:"file,omitempty"` + + // An inline subinstallation template. + // +optional + *InstallationTemplate `json:",inline"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_component_overwrite.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_component_overwrite.go new file mode 100644 index 000000000..bc5537d3d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_component_overwrite.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ComponentOverwritesList contains a list of ComponentOverwrites +type ComponentOverwritesList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ComponentOverwrites `json:"items"` +} + +// ComponentOverwritesDefinition defines the ComponentOverwrites resource CRD. +var ComponentOverwritesDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "componentoverwrites", + Singular: "componentoverwrites", + ShortNames: []string{ + "compoverwrite", + "co", + "overwrite", + }, + Kind: "ComponentOverwrites", + }, + Scope: lsschema.ClusterScoped, + Storage: true, + Served: true, +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ComponentOverwrites are resources that can hold any kind json or yaml data. +type ComponentOverwrites struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Overwrites defines a list of component overwrites + Overwrites ComponentOverwriteList `json:"overwrites,omitempty"` +} + +// ComponentOverwriteList is a list of component overwrites. +type ComponentOverwriteList []ComponentOverwrite + +// ComponentOverwrite defines an overwrite for a specific component and/or version of a component. +type ComponentOverwrite struct { + // Component defines the component that should be replaced. + // The version is optional and will default to all found versions + Component ComponentOverwriteReference `json:"component"` + // Target defines the replacement target for the component or version. + Target ComponentOverwriteReference `json:"target"` +} + +// ComponentOverwriteReference defines a component reference by +type ComponentOverwriteReference struct { + // RepositoryContext defines the context of the component repository to resolve blueprints. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject `json:"repositoryContext,omitempty"` + // ComponentName defines the unique of the component containing the resource. + // +optional + ComponentName string `json:"componentName"` + // Version defines the version of the component. + // +optional + Version string `json:"version"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_context.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_context.go new file mode 100644 index 000000000..257ed08a6 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_context.go @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// DefaultContextName is the name of the default context that is replicated in all namespaces. +const DefaultContextName = "default" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ContextList contains a list of Contexts +type ContextList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Context `json:"items"` +} + +// ContextDefinition defines the Context resource CRD. +var ContextDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "contexts", + Singular: "context", + ShortNames: []string{ + "ctx", + }, + Kind: "Context", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Context is a resource that contains shared information of installations. +// This includes information about the repository context like the context itself or secrets to access the oci artifacts. +// But it can also contain deployer specific config. +type Context struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // RepositoryContext defines the context of the component repository to resolve blueprints. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject `json:"repositoryContext,omitempty"` + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints, component descriptors and jsonschemas from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []corev1.LocalObjectReference `json:"registryPullSecrets,omitempty"` + // Configurations contains arbitrary configuration information for dedicated purposes given by a string key. + // The key should use a dns-like syntax to express the purpose and avoid conflicts. + // +optional + Configurations map[string]AnyJSON `json:"configurations,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_dataobject.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_dataobject.go new file mode 100644 index 000000000..89476fa18 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_dataobject.go @@ -0,0 +1,92 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// DataObjectSourceType defines the context of a data object. +type DataObjectSourceType string + +const ( + // ExportDataObjectSourceType is the data object type of a exported object. + ExportDataObjectSourceType DataObjectSourceType = "export" + // ExportDataObjectSourceType is the data object type of a imported object. + ImportDataObjectSourceType DataObjectSourceType = "import" +) + +// DataObjectTypeAnnotation defines the name of the annotation that specifies the type of the dataobject. +const DataObjectTypeAnnotation = "data.landscaper.gardener.cloud/type" + +// DataObjectContextLabel defines the name of the label that specifies the context of the dataobject. +const DataObjectContextLabel = "data.landscaper.gardener.cloud/context" + +// DataObjectSourceTypeLabel defines the name of the label that specifies the source type (import or export) of the dataobject. +const DataObjectSourceTypeLabel = "data.landscaper.gardener.cloud/sourceType" + +// DataObjectKeyLabel defines the name of the label that specifies the export or imported key of the dataobject. +const DataObjectKeyLabel = "data.landscaper.gardener.cloud/key" + +// DataObjectSourceLabel defines the name of the label that specifies the source of the dataobject. +const DataObjectSourceLabel = "data.landscaper.gardener.cloud/source" + +// DataObjectHashAnnotation defines the name of the annotation that specifies the hash of the data. +const DataObjectHashAnnotation = "data.landscaper.gardener.cloud/hash" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DataObjectList contains a list of DataObject +type DataObjectList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DataObject `json:"items"` +} + +// DataObjectDefinition defines the DataObject resource CRD. +var DataObjectDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "dataobjects", + Singular: "dataobject", + ShortNames: []string{ + "do", + "dobj", + }, + Kind: "DataObject", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "Context", + Type: "string", + JSONPath: ".metadata.labels['data\\.landscaper\\.gardener\\.cloud\\/context']", + }, + { + Name: "Key", + Type: "string", + JSONPath: ".metadata.labels['data\\.landscaper\\.gardener\\.cloud\\/key']", + }, + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DataObject are resources that can hold any kind json or yaml data. +type DataObject struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Data contains the data of the object as string. + Data AnyJSON `json:"data"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_deployer_registration.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_deployer_registration.go new file mode 100644 index 000000000..0397556b3 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_deployer_registration.go @@ -0,0 +1,81 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DeployerRegistrationList contains a list of DeployerRegistration +type DeployerRegistrationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DeployerRegistration `json:"items"` +} + +// DeployerRegistrationDefinition defines the DeployerRegistration resource CRD. +var DeployerRegistrationDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "deployerregistrations", + Singular: "deployerregistration", + ShortNames: []string{ + "deployreg", + "deployerreg", + "dreg", + }, + Kind: "DeployerRegistration", + }, + Scope: lsschema.ClusterScoped, + Storage: true, + Served: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DeployerRegistration defines a installation template for a deployer. +type DeployerRegistration struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec defines the deployer registration configuration. + Spec DeployerRegistrationSpec `json:"spec"` +} + +// DeployerRegistrationSpec defines the configuration of a deployer registration +type DeployerRegistrationSpec struct { + // DeployItemTypes defines the types of deploy items that are handled by the deployer. + DeployItemTypes []DeployItemType `json:"types"` + // InstallationTemplate defines the installation template for installing a deployer.´ + InstallationTemplate DeployerInstallationTemplate `json:"installationTemplate"` +} + +type DeployerInstallationTemplate struct { + //ComponentDescriptor is a reference to the installation's component descriptor + // +optional + ComponentDescriptor *ComponentDescriptorDefinition `json:"componentDescriptor,omitempty"` + // Blueprint is the resolved reference to the definition. + Blueprint BlueprintDefinition `json:"blueprint"` + // Imports define the imported data objects and targets. + // +optional + Imports InstallationImports `json:"imports,omitempty"` + // ImportDataMappings contains a template for restructuring imports. + // It is expected to contain a key for every blueprint-defined data import. + // Missing keys will be defaulted to their respective data import. + // Example: namespace: (( installation.imports.namespace )) + // +optional + ImportDataMappings map[string]AnyJSON `json:"importDataMappings,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_deployitem.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_deployitem.go new file mode 100644 index 000000000..ec27d3c1d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_deployitem.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// DeployItemValidationCondition is the Conditions type to indicate the deploy items configuration validation status. +const DeployItemValidationCondition ConditionType = "DeployItemValidation" + +// DeployItemType defines the type of the deploy item +type DeployItemType string + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DeployItemList contains a list of DeployItems +type DeployItemList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DeployItem `json:"items"` +} + +// DeployItemDefinition defines the DeployItem resource CRD. +var DeployItemDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "deployitems", + Singular: "deployitem", + ShortNames: []string{ + "di", + }, + Kind: "DeployItem", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + SubresourceStatus: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "Type", + Type: "string", + JSONPath: ".spec.type", + }, + { + Name: "Phase", + Type: "string", + JSONPath: ".status.phase", + }, + { + Name: "ExportRef", + Type: "string", + JSONPath: ".status.exportRef.name", + }, + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DeployItem defines a resource that should be processed by a external deployer +type DeployItem struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DeployItemSpec `json:"spec"` + + // +optional + Status DeployItemStatus `json:"status"` +} + +// DeployItemSpec contains the definition of a deploy item. +type DeployItemSpec struct { + // Type is the type of the deployer that should handle the item. + Type DeployItemType `json:"type"` + // Target specifies an optional target of the deploy item. + // In most cases it contains the secrets to access a evironment. + // It is also used by the deployers to determine the ownernship. + // +optional + Target *ObjectReference `json:"target,omitempty"` + // Context defines the current context of the deployitem. + // +optional + Context string `json:"context,omitempty"` + // Configuration contains the deployer type specific configuration. + Configuration *runtime.RawExtension `json:"config,omitempty"` + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints, component descriptors and jsonschemas from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []ObjectReference `json:"registryPullSecrets,omitempty"` + // Timeout specifies how long the deployer may take to apply the deploy item. + // When the time is exceeded, the landscaper will add the abort annotation to the deploy item + // and later put it in 'Failed' if the deployer doesn't handle the abort properly. + // Value has to be parsable by time.ParseDuration (or 'none' to deactivate the timeout). + // Defaults to ten minutes if not specified. + // +optional + Timeout *Duration `json:"timeout,omitempty"` +} + +// DeployItemStatus contains the status of a deploy item. +// todo: add operation +type DeployItemStatus struct { + // Phase is the current phase of the DeployItem + Phase ExecutionPhase `json:"phase,omitempty"` + + // ObservedGeneration is the most recent generation observed for this DeployItem. + // It corresponds to the DeployItem generation, which is updated on mutation by the landscaper. + ObservedGeneration int64 `json:"observedGeneration"` + + // Conditions contains the actual condition of a deploy item + // +optional + Conditions []Condition `json:"conditions,omitempty"` + + // LastError describes the last error that occurred. + LastError *Error `json:"lastError,omitempty"` + + // LastReconcileTime indicates when the reconciliation of the last change to the deploy item has started + // +optional + LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"` + + // Deployer describes the deployer that has reconciled the deploy item. + // +optional + Deployer DeployerInformation `json:"deployer,omitempty"` + + // ProviderStatus contains the provider specific status + // +optional + ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"` + + // ExportReference is the reference to the object that contains the exported values. + // +optional + ExportReference *ObjectReference `json:"exportRef,omitempty"` +} + +// DeployerInformation holds additional information about the deployer that +// has reconciled or is reconciling the deploy item. +type DeployerInformation struct { + // Identity describes the unique identity of the deployer. + Identity string `json:"identity"` + // Name is the name of the deployer. + Name string `json:"name"` + // Version is the version of the deployer. + Version string `json:"version"` +} + +// TargetSelector describes a selector that matches specific targets. +// +k8s:deepcopy-gen=true +type TargetSelector struct { + // Targets defines a list of specific targets (name and namespace) + // that should be reconciled. + // +optional + Targets []ObjectReference `json:"targets,omitempty"` + // Annotations matches a target based on annotations. + // +optional + Annotations []Requirement `json:"annotations,omitempty"` + // Labels matches a target based on its labels. + // +optional + Labels []Requirement `json:"labels,omitempty"` +} + +// Requirement contains values, a key, and an operator that relates the key and values. +// The zero value of Requirement is invalid. +// Requirement implements both set based match and exact match +// Requirement should be initialized via NewRequirement constructor for creating a valid Requirement. +// +k8s:deepcopy-gen=true +type Requirement struct { + Key string `json:"key"` + Operator selection.Operator `json:"operator"` + // In huge majority of cases we have at most one value here. + // It is generally faster to operate on a single-element slice + // than on a single-element map, so we have a slice here. + // +optional + Values []string `json:"values,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_environment.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_environment.go new file mode 100644 index 000000000..7e90841ed --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_environment.go @@ -0,0 +1,107 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EnvironmentList contains a list of Environments +type EnvironmentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Environment `json:"items"` +} + +// EnvironmentDefinition defines the Environment resource CRD. +var EnvironmentDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "environments", + Singular: "environment", + ShortNames: []string{ + "env", + }, + Kind: "Environment", + }, + Scope: lsschema.ClusterScoped, + Storage: true, + Served: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Environment defines a environment that is created by a agent. +type Environment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec defines the environment. + Spec EnvironmentSpec `json:"spec"` +} + +// EnvironmentSpec defines the environment configuration. +type EnvironmentSpec struct { + // HostTarget describes the target that is used for the deployers. + HostTarget TargetTemplate `json:"hostTarget"` + // Namespace is the host cluster namespace where the deployers should be installed. + Namespace string `json:"namespace"` + // LandscaperClusterRestConfig describes the connection information to connect to the + // landscaper cluster. + // This information should be provided by the agent as the access information may differ + // when calling from different networking zones. + LandscaperClusterRestConfig ClusterRestConfig `json:"landscaperClusterConfig"` + // TargetSelector defines the target selector that is applied to all installed deployers + TargetSelectors []TargetSelector `json:"targetSelectors"` +} + +// ClusterRestConfig describes parts of a rest.Config +// that is used to access the +type ClusterRestConfig struct { + // Host must be a host string, a host:port pair, or a URL to the base of the apiserver. + // If a URL is given then the (optional) Path of that URL represents a prefix that must + // be appended to all request URIs used to access the apiserver. This allows a frontend + // proxy to easily relocate all of the apiserver endpoints. + Host string `json:"host"` + // APIPath is a sub-path that points to an API root. + APIPath string `json:"apiPath"` + + TLSClientConfig `json:",inline"` +} + +// TLSClientConfig contains settings to enable transport layer security +type TLSClientConfig struct { + // Server should be accessed without verifying the TLS certificate. For testing only. + // +optional + Insecure bool `json:"insecure"` + // ServerName is passed to the server for SNI and is used in the client to check server + // ceritificates against. If ServerName is empty, the hostname used to contact the + // server is used. + // +optional + ServerName string `json:"serverName,omitempty"` + + // CAData holds PEM-encoded bytes (typically read from a root certificates bundle). + // CAData takes precedence over CAFile + // +optional + CAData []byte `json:"caData,omitempty"` + + // NextProtos is a list of supported application level protocols, in order of preference. + // Used to populate tls.Config.NextProtos. + // To indicate to the server http/1.1 is preferred over http/2, set to ["http/1.1", "h2"] (though the server is free to ignore that preference). + // To use only http/1.1, set to ["http/1.1"]. + // +optional + NextProtos []string `json:"nextProtos,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_execution.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_execution.go new file mode 100644 index 000000000..6221f8e24 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_execution.go @@ -0,0 +1,187 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// ExecutionManagedByLabel is the label of a deploy item that contains the name of the managed execution. +// This label is used by the extension controller to identify its managed deploy items +// todo: add conversion +const ExecutionManagedByLabel = "execution.landscaper.gardener.cloud/managed-by" + +// ExecutionManagedNameLabel is the unique identifier of the deploy item managed by a execution. +// It corresponds to the execution item name. +// todo: add conversion +const ExecutionManagedNameLabel = "execution.landscaper.gardener.cloud/name" + +// ExecutionDependsOnAnnotation is name of the annotation that holds the dependsOn data +// defined in the execution. +// This annotation is mainly to correctly cleanup orphaned deploy items that are not part of the execution anymore. +// todo: add conversion +const ExecutionDependsOnAnnotation = "execution.landscaper.gardener.cloud/dependsOn" + +// ReconcileDeployItemsCondition is the Conditions type to indicate the deploy items status. +const ReconcileDeployItemsCondition ConditionType = "ReconcileDeployItems" + +type ExecutionPhase string + +const ( + ExecutionPhaseInit = ExecutionPhase(ComponentPhaseInit) + ExecutionPhaseProgressing = ExecutionPhase(ComponentPhaseProgressing) + ExecutionPhaseDeleting = ExecutionPhase(ComponentPhaseDeleting) + ExecutionPhaseSucceeded = ExecutionPhase(ComponentPhaseSucceeded) + ExecutionPhaseFailed = ExecutionPhase(ComponentPhaseFailed) +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ExecutionList contains a list of Executions‚ +type ExecutionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Execution `json:"items"` +} + +// ExecutionDefinition defines the Execution resource CRD. +var ExecutionDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "executions", + Singular: "execution", + ShortNames: []string{ + "exec", + }, + Kind: "Execution", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + SubresourceStatus: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "Phase", + Type: "string", + JSONPath: ".status.phase", + }, + { + Name: "ExportRef", + Type: "string", + JSONPath: ".status.exportRef.name", + }, + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Execution contains the configuration of a execution and deploy item +// +kubebuilder:resource:path="executions",scope="Namespaced",shortName="exec",singular="execution" +// +kubebuilder:printcolumn:JSONPath=".status.phase",name=Phase,type=string +// +kubebuilder:printcolumn:JSONPath=".status.exportRef.name",name=ExportRef,type=string +// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name=Age,type=date +// +kubebuilder:subresource:status +type Execution struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec defines a execution and its items + Spec ExecutionSpec `json:"spec"` + // Status contains the current status of the execution. + // +optional + Status ExecutionStatus `json:"status"` +} + +// ExecutionSpec defines a execution plan. +type ExecutionSpec struct { + // Context defines the current context of the execution. + // +optional + Context string `json:"context,omitempty"` + + // DeployItems defines all execution items that need to be scheduled. + DeployItems DeployItemTemplateList `json:"deployItems,omitempty"` + + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints, component descriptors and jsonschemas from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []ObjectReference `json:"registryPullSecrets,omitempty"` +} + +// ExecutionStatus contains the current status of a execution. +type ExecutionStatus struct { + // Phase is the current phase of the execution. + Phase ExecutionPhase `json:"phase,omitempty"` + + // ObservedGeneration is the most recent generation observed for this Execution. + // It corresponds to the Execution generation, which is updated on mutation by the landscaper. + // +optional + ObservedGeneration int64 `json:"observedGeneration"` + + // Conditions contains the actual condition of a execution + // +optional + Conditions []Condition `json:"conditions,omitempty"` + + // LastError describes the last error that occurred. + // +optional + LastError *Error `json:"lastError,omitempty"` + + // ExportReference references the object that contains the exported values. + // only used for operation purpose. + // +optional + ExportReference *ObjectReference `json:"exportRef,omitempty"` + + // DeployItemReferences contain the state of all deploy items. + // +optional + DeployItemReferences []VersionedNamedObjectReference `json:"deployItemRefs,omitempty"` + + // ExecutionGenerations stores which generation the execution had when it last applied a specific deployitem. + // So in this case, the observedGeneration refers to the executions generation. + // +optional + ExecutionGenerations []ExecutionGeneration `json:"execGenerations,omitempty"` +} + +// ExecutionGeneration links a deployitem to the generation of the execution when it was applied. +type ExecutionGeneration struct { + // Name is the name of the deployitem this generation refers to. + Name string `json:"name"` + // ObservedGeneration stores the generation which the execution had when it last applied the referenced deployitem. + ObservedGeneration int64 `json:"observedGeneration"` +} + +// DeployItemTemplateList is a list of deploy item templates +type DeployItemTemplateList []DeployItemTemplate + +// DeployItemTemplate defines a execution element that is translated into a deploy item. +// +k8s:deepcopy-gen=true +type DeployItemTemplate struct { + // Name is the unique name of the execution. + Name string `json:"name"` + + // DataType is the DeployItem type of the execution. + Type DeployItemType `json:"type"` + + // Target is the object reference to the target that the deploy item should deploy to. + // +optional + Target *ObjectReference `json:"target,omitempty"` + + // Labels is the map of labels to be added to the deploy item. + // +optional + Labels map[string]string `json:"labels,omitempty"` + + // ProviderConfiguration contains the type specific configuration for the execution. + Configuration *runtime.RawExtension `json:"config"` + + // DependsOn lists deploy items that need to be executed before this one + DependsOn []string `json:"dependsOn,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_installation.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_installation.go new file mode 100644 index 000000000..e452491b8 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_installation.go @@ -0,0 +1,556 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "encoding/json" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsschema "github.com/gardener/landscaper/apis/schema" +) + +// EncompassedByLabel is the label that contains the name of the parent installation +// that encompasses the current installation. +// todo: add conversion +const EncompassedByLabel = "landscaper.gardener.cloud/encompassed-by" + +// SubinstallationNameAnnotation is the annotation that contains the name of the subinstallation. +// todo: add conversion +const SubinstallationNameAnnotation = "landscaper.gardener.cloud/subinstallation-name" + +// todo: keep only subinstallations? +const KeepChildrenAnnotation = "landscaper.gardener.cloud/keep-children" + +// EnsureSubInstallationsCondition is the Conditions type to indicate the sub installation status. +const EnsureSubInstallationsCondition ConditionType = "EnsureSubInstallations" + +// ReconcileExecutionCondition is the Conditions type to indicate the execution reconcile status. +const ReconcileExecutionCondition ConditionType = "ReconcileExecution" + +// ValidateImportsCondition is the Conditions type to indicate status of the import validation. +const ValidateImportsCondition ConditionType = "ValidateImports" + +// CreateImportsCondition is the Conditions type to indicate status of the imported data and data objects. +const CreateImportsCondition ConditionType = "CreateImports" + +// CreateExportsCondition is the Conditions type to indicate status of the exported data and data objects. +const CreateExportsCondition ConditionType = "CreateExports" + +// EnsureExecutionsCondition is the Conditions type to indicate the executions status. +const EnsureExecutionsCondition ConditionType = "EnsureExecutions" + +// ValidateExportCondition is the Conditions type to indicate validation status of teh exported data. +const ValidateExportCondition ConditionType = "ValidateExport" + +// ComponentReferenceOverwriteCondition is the Conditions type to indicate that the component reference was overwritten. +const ComponentReferenceOverwriteCondition ConditionType = "ComponentReferenceOverwrite" + +type ComponentInstallationPhase string + +const ( + ComponentPhaseInit ComponentInstallationPhase = "Init" + ComponentPhasePending ComponentInstallationPhase = "PendingDependencies" + ComponentPhaseProgressing ComponentInstallationPhase = "Progressing" + ComponentPhaseDeleting ComponentInstallationPhase = "Deleting" + ComponentPhaseAborted ComponentInstallationPhase = "Aborted" + ComponentPhaseSucceeded ComponentInstallationPhase = "Succeeded" + ComponentPhaseFailed ComponentInstallationPhase = "Failed" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstallationList contains a list of Components +type InstallationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Installation `json:"items"` +} + +// InstallationDefinition defines the Installation resource CRD. +var InstallationDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "installations", + Singular: "installation", + ShortNames: []string{ + "inst", + }, + Kind: "Installation", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + SubresourceStatus: true, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "phase", + Type: "string", + JSONPath: ".status.phase", + }, + { + Name: "Execution", + Type: "string", + JSONPath: ".status.executionRef.name", + }, + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Installation contains the configuration of a component +type Installation struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec contains the specification for a installation. + Spec InstallationSpec `json:"spec"` + + // Status contains the status of the installation. + // +optional + Status InstallationStatus `json:"status"` +} + +// InstallationSpec defines a component installation. +type InstallationSpec struct { + // Context defines the current context of the installation. + // +optional + Context string `json:"context,omitempty"` + + //ComponentDescriptor is a reference to the installation's component descriptor + // +optional + ComponentDescriptor *ComponentDescriptorDefinition `json:"componentDescriptor,omitempty"` + + // Blueprint is the resolved reference to the definition. + Blueprint BlueprintDefinition `json:"blueprint"` + + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints, component descriptors and jsonschemas from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []ObjectReference `json:"registryPullSecrets,omitempty"` + + // Imports define the imported data objects and targets. + // +optional + Imports InstallationImports `json:"imports,omitempty"` + + // ImportDataMappings contains a template for restructuring imports. + // It is expected to contain a key for every blueprint-defined data import. + // Missing keys will be defaulted to their respective data import. + // Example: namespace: (( installation.imports.namespace )) + // +optional + ImportDataMappings map[string]AnyJSON `json:"importDataMappings,omitempty"` + + // Exports define the exported data objects and targets. + // +optional + Exports InstallationExports `json:"exports,omitempty"` + + // ExportDataMappings contains a template for restructuring exports. + // It is expected to contain a key for every blueprint-defined data export. + // Missing keys will be defaulted to their respective data export. + // Example: namespace: (( blueprint.exports.namespace )) + // +optional + ExportDataMappings map[string]AnyJSON `json:"exportDataMappings,omitempty"` +} + +// InstallationStatus contains the current status of a Installation. +type InstallationStatus struct { + // Phase is the current phase of the installation. + Phase ComponentInstallationPhase `json:"phase,omitempty"` + + // ObservedGeneration is the most recent generation observed for this ControllerInstallations. + // It corresponds to the ControllerInstallations generation, which is updated on mutation by the landscaper. + ObservedGeneration int64 `json:"observedGeneration"` + + // Conditions contains the actual condition of a installation + Conditions []Condition `json:"conditions,omitempty"` + + // LastError describes the last error that occurred. + LastError *Error `json:"lastError,omitempty"` + + // ConfigGeneration is the generation of the exported values. + ConfigGeneration string `json:"configGeneration"` + + // Imports contain the state of the imported values. + Imports []ImportStatus `json:"imports,omitempty"` + + // InstallationReferences contain all references to sub-components + // that are created based on the component definition. + InstallationReferences []NamedObjectReference `json:"installationRefs,omitempty"` + + // ExecutionReference is the reference to the execution that schedules the templated execution items. + ExecutionReference *ObjectReference `json:"executionRef,omitempty"` +} + +// InstallationImports defines import of data objects and targets. +type InstallationImports struct { + // Data defines all data object imports. + // +optional + Data []DataImport `json:"data,omitempty"` + + // Targets defines all target imports. + // +optional + Targets []TargetImport `json:"targets,omitempty"` + + // ComponentDescriptors defines all component descriptor imports. + // +optional + ComponentDescriptors []ComponentDescriptorImport `json:"componentDescriptors,omitempty"` +} + +// InstallationExports defines exports of data objects and targets. +type InstallationExports struct { + // Data defines all data object exports. + // +optional + Data []DataExport `json:"data,omitempty"` + + // Targets defines all target exports. + // +optional + Targets []TargetExport `json:"targets,omitempty"` +} + +// DataImport is a data object import. +type DataImport struct { + // Name the internal name of the imported/exported data. + Name string `json:"name"` + + // DataRef is the name of the in-cluster data object. + // The reference can also be a namespaces name. E.g. "default/mydataref" + // +optional + DataRef string `json:"dataRef,omitempty"` + + // Version specifies the imported data version. + // defaults to "v1" + // +optional + Version string `json:"version,omitempty"` + + // SecretRef defines a data reference from a secret. + // This method is not allowed in installation templates. + // +optional + SecretRef *SecretReference `json:"secretRef,omitempty"` + + // ConfigMapRef defines a data reference from a configmap. + // This method is not allowed in installation templates. + // +optional + ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"` +} + +// DataExport is a data object export. +type DataExport struct { + // Name the internal name of the imported/exported data. + Name string `json:"name"` + + // DataRef is the name of the in-cluster data object. + DataRef string `json:"dataRef"` +} + +// TargetImport is either a single target or a target list import. +type TargetImport struct { + // Name the internal name of the imported target. + Name string `json:"name"` + + // Target is the name of the in-cluster target object. + // Exactly one of Target, Targets, and TargetListReference has to be specified. + // +optional + Target string `json:"target,omitempty"` + + // Targets is a list of in-cluster target objects. + // Exactly one of Target, Targets, and TargetListReference has to be specified. + // +optional + Targets []string `json:"targets"` + + // TargetListReference can (only) be used to import a targetlist that has been imported by the parent installation. + // Exactly one of Target, Targets, and TargetListReference has to be specified. + // +optional + TargetListReference string `json:"targetListRef,omitempty"` +} + +// TargetExport is a single target export. +type TargetExport struct { + // Name the internal name of the exported target. + Name string `json:"name"` + + // Target is the name of the in-cluster target object. + // +optional + Target string `json:"target,omitempty"` +} + +type ComponentDescriptorImport struct { + // Name the internal name of the imported/exported component descriptor. + Name string `json:"name"` + + // Ref is a reference to a component descriptor in a registry. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + Ref *ComponentDescriptorReference `json:"ref,omitempty"` + + // SecretRef is a reference to a key in a secret in the cluster. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + SecretRef *SecretReference `json:"secretRef,omitempty"` + + // ConfigMapRef is a reference to a key in a config map in the cluster. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"` + + // List represents a list of component descriptor imports. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + List []ComponentDescriptorImportData `json:"list,omitempty"` + + // DataRef can be used to reference component descriptors imported by the parent installation. + // This field is used in subinstallation templates only, use one of the other fields instead for root installations. + // +optional + DataRef string `json:"dataRef,omitempty"` +} + +type ComponentDescriptorImportData struct { + // Ref is a reference to a component descriptor in a registry. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + Ref *ComponentDescriptorReference `json:"ref,omitempty"` + + // SecretRef is a reference to a key in a secret in the cluster. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + SecretRef *SecretReference `json:"secretRef,omitempty"` + + // ConfigMapRef is a reference to a key in a config map in the cluster. + // Exactly one of Ref, SecretRef, ConfigMapRef, and List has to be specified. + // +optional + ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"` + + // DataRef can be used to reference component descriptors imported by the parent installation. + // This field is used in subinstallation templates only, use one of the other fields instead for root installations. + // +optional + DataRef string `json:"dataRef,omitempty"` +} + +// BlueprintDefinition defines the blueprint that should be used for the installation. +type BlueprintDefinition struct { + // Reference defines a remote reference to a blueprint + // +optional + Reference *RemoteBlueprintReference `json:"ref,omitempty"` + // Inline defines a inline yaml filesystem with a blueprint. + // +optional + Inline *InlineBlueprint `json:"inline,omitempty"` +} + +// RemoteBlueprintReference describes a reference to a blueprint defined by a component descriptor. +type RemoteBlueprintReference struct { + // ResourceName is the name of the blueprint as defined by a component descriptor. + ResourceName string `json:"resourceName"` +} + +// InlineBlueprint defines a inline blueprint with component descriptor and +// filesystem. +type InlineBlueprint struct { + // Filesystem defines a inline yaml filesystem with a blueprint. + Filesystem AnyJSON `json:"filesystem"` +} + +// ComponentDescriptorDefinition defines the component descriptor that should be used +// for the installation +type ComponentDescriptorDefinition struct { + // ComponentDescriptorReference is the reference to a component descriptor + // +optional + Reference *ComponentDescriptorReference `json:"ref,omitempty"` + + // InlineDescriptorReference defines an inline component descriptor + // +optional + Inline *cdv2.ComponentDescriptor `json:"inline,omitempty"` +} + +// ComponentDescriptorReference is the reference to a component descriptor. +// given an optional context. +type ComponentDescriptorReference struct { + // RepositoryContext defines the context of the component repository to resolve blueprints. + // +optional + RepositoryContext *cdv2.UnstructuredTypedObject `json:"repositoryContext,omitempty"` + // ComponentName defines the unique of the component containing the resource. + ComponentName string `json:"componentName"` + // Version defines the version of the component. + Version string `json:"version"` +} + +// ObjectMeta returns the component descriptor v2 compatible object meta for a resource reference. +func (r ComponentDescriptorReference) ObjectMeta() cdv2.ObjectMeta { + return cdv2.ObjectMeta{ + Name: r.ComponentName, + Version: r.Version, + } +} + +// StaticDataSource defines a static data source +type StaticDataSource struct { + // Value defined inline a raw data + // +optional + Value AnyJSON `json:"value,omitempty"` + + // ValueFrom defines data from an external resource + ValueFrom *StaticDataValueFrom `json:"valueFrom,omitempty"` +} + +// StaticDataValueFrom defines a static data that is read from a external resource. +type StaticDataValueFrom struct { + // Selects a key of a secret in the installations's namespace + // +optional + SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"` + + // Selects a key from multiple secrets in the installations's namespace + // that matches the given labels. + // +optional + SecretLabelSelector *SecretLabelSelectorRef `json:"secretLabelSelector,omitempty"` +} + +// SecretLabelSelectorRef selects secrets with the given label and key. +type SecretLabelSelectorRef struct { + // Selector is a map of labels to select specific secrets. + Selector map[string]string `json:"selector"` + + // The key of the secret to select from. Must be a valid secret key. + Key string `json:"key"` +} + +// ImportStatusType defines the type of a import status. +type ImportStatusType string + +const ( + // DataImportStatusType is an ImportStatusType for data objects + DataImportStatusType ImportStatusType = "dataobject" + // TargetImportStatusType is an ImportStatusType for targets + TargetImportStatusType ImportStatusType = "target" + // TargetListImportStatusType is an ImportStatusType for target lists + TargetListImportStatusType ImportStatusType = "targetList" + // CDImportStatusType is an ImportStatusType for component descriptors + CDImportStatusType ImportStatusType = "componentDescriptor" + // CDListImportStatusType is an ImportStatusType for component descriptor lists + CDListImportStatusType ImportStatusType = "componentDescriptorList" +) + +// TargetImportStatus +type TargetImportStatus struct { + // Target is the name of the in-cluster target object. + Target string `json:"target,omitempty"` + // SourceRef is the reference to the installation from where the value is imported + SourceRef *ObjectReference `json:"sourceRef,omitempty"` + // ConfigGeneration is the generation of the imported value. + ConfigGeneration string `json:"configGeneration,omitempty"` +} + +// CDImportStatus is the import status of a component descriptor +type CDImportStatus struct { + // ComponentDescriptorRef is a reference to a component descriptor + // +optional + ComponentDescriptorRef *ComponentDescriptorReference `json:"componentDescriptorRef,omitempty"` + // SecretRef is the name of the secret. + // +optional + SecretRef string `json:"secretRef,omitempty"` + // ConfigMapRef is the name of the imported configmap. + // +optional + ConfigMapRef string `json:"configMapRef,omitempty"` + // SourceRef is the reference to the installation from where the value is imported + SourceRef *ObjectReference `json:"sourceRef,omitempty"` +} + +// ImportStatus hold the state of a import. +type ImportStatus struct { + // Name is the distinct identifier of the import. + // Can be either from data or target imports + Name string `json:"name"` + // Type defines the kind of import. + // Can be either DataObject, Target, or TargetList + Type ImportStatusType `json:"type"` + // Target is the name of the in-cluster target object. + // +optional + Target string `json:"target,omitempty"` + // TargetList is a list of import statuses for in-cluster target objects. + // +optional + Targets []TargetImportStatus `json:"targetList,omitempty"` + // ComponentDescriptorRef is a reference to a component descriptor + // +optional + ComponentDescriptorRef *ComponentDescriptorReference `json:"componentDescriptorRef,omitempty"` + // ComponentDescriptors is a list of import statuses for component descriptors + // +optional + ComponentDescriptors []CDImportStatus `json:"componentDescriptorList,omitempty"` + // DataRef is the name of the in-cluster data object. + // +optional + DataRef string `json:"dataRef,omitempty"` + // SecretRef is the name of the secret. + // +optional + SecretRef string `json:"secretRef,omitempty"` + // ConfigMapRef is the name of the imported configmap. + // +optional + ConfigMapRef string `json:"configMapRef,omitempty"` + // SourceRef is the reference to the installation from where the value is imported + // +optional + SourceRef *ObjectReference `json:"sourceRef,omitempty"` + // ConfigGeneration is the generation of the imported value. + // +optional + ConfigGeneration string `json:"configGeneration,omitempty"` +} + +// MarshalJSON implements the json marshaling for a TargetImport +// Why this is needed: +// We need Targets to not have the 'omitempty' annotation, +// because the code distinguishes between nil and an empty list. +// Not having the annotation causes the default json marshal to write +// 'null' in case of nil, which causes problems. +func (ti TargetImport) MarshalJSON() ([]byte, error) { + + type TargetImportWithTargets struct { + Name string `json:"name"` + Target string `json:"target,omitempty"` + Targets []string `json:"targets"` + TargetListReference string `json:"targetListRef,omitempty"` + } + type TargetImportWithoutTargets struct { + Name string `json:"name"` + Target string `json:"target,omitempty"` + Targets []string `json:"targets,omitempty"` + TargetListReference string `json:"targetListRef,omitempty"` + } + + if ti.Targets == nil { + return json.Marshal(TargetImportWithoutTargets(ti)) + } + return json.Marshal(TargetImportWithTargets(ti)) +} + +// MarshalJSON implements the json marshaling for a ComponentDescriptorImport +// This is needed for the same reasons as the MarshalJSON function for TargetImports. +func (cdi ComponentDescriptorImport) MarshalJSON() ([]byte, error) { + + type ComponentDescriptorImportWithCDs struct { + Name string `json:"name"` + Ref *ComponentDescriptorReference `json:"ref,omitempty"` + SecretRef *SecretReference `json:"secretRef,omitempty"` + ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"` + List []ComponentDescriptorImportData `json:"list"` + DataRef string `json:"dataRef,omitempty"` + } + + type ComponentDescriptorImportWithoutCDs struct { + Name string `json:"name"` + Ref *ComponentDescriptorReference `json:"ref,omitempty"` + SecretRef *SecretReference `json:"secretRef,omitempty"` + ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"` + List []ComponentDescriptorImportData `json:"list,omitempty"` + DataRef string `json:"dataRef,omitempty"` + } + + if cdi.List == nil { + return json.Marshal(ComponentDescriptorImportWithoutCDs(cdi)) + } + return json.Marshal(ComponentDescriptorImportWithCDs(cdi)) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_installationtemplate.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_installationtemplate.go new file mode 100644 index 000000000..0e1b56660 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_installationtemplate.go @@ -0,0 +1,64 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstallationTemplate defines a subinstallation in a blueprint. +// +kubebuilder:skip +type InstallationTemplate struct { + metav1.TypeMeta `json:",inline"` + + // Name is the unique name of the step + Name string `json:"name"` + + // Reference defines a reference to a Blueprint. + // The blueprint can reside in an OCI or other supported location. + Blueprint InstallationTemplateBlueprintDefinition `json:"blueprint"` + + // Imports define the imported data objects and targets. + // +optional + Imports InstallationImports `json:"imports,omitempty"` + + // ImportDataMappings contains a template for restructuring imports. + // It is expected to contain a key for every blueprint-defined data import. + // Missing keys will be defaulted to their respective data import. + // Example: namespace: (( installation.imports.namespace )) + // +optional + ImportDataMappings map[string]AnyJSON `json:"importDataMappings,omitempty"` + + // Exports define the exported data objects and targets. + // +optional + Exports InstallationExports `json:"exports,omitempty"` + + // ExportDataMappings contains a template for restructuring exports. + // It is expected to contain a key for every blueprint-defined data export. + // Missing keys will be defaulted to their respective data export. + // Example: namespace: (( blueprint.exports.namespace )) + // +optional + ExportDataMappings map[string]AnyJSON `json:"exportDataMappings,omitempty"` +} + +// InstallationTemplateList is a list of installation templates. +type InstallationTemplateList []*InstallationTemplate + +// InstallationTemplateBlueprintDefinition contains either a reference to a blueprint or an inline definition. +type InstallationTemplateBlueprintDefinition struct { + // Ref is a reference to a blueprint. + // Only blueprints that are defined by the component descriptor of the current blueprint can be referenced here. + // Example: cd://componentReference/dns/resources/blueprint + // +optional + Ref string `json:"ref,omitempty"` + + // Filesystem defines a virtual filesystem with all files needed for a blueprint. + // The filesystem must be a YAML filesystem. + // +optional + Filesystem AnyJSON `json:"filesystem,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_shared.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_shared.go new file mode 100644 index 000000000..4e62da1ec --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_shared.go @@ -0,0 +1,330 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "encoding/json" + "errors" + "fmt" + "time" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// JSONSchemaDefinition defines a jsonschema. +// +k8s:openapi-gen=true +type JSONSchemaDefinition struct { + json.RawMessage `json:",inline"` +} + +// MarshalJSON implements the json marshaling for a JSON +func (s JSONSchemaDefinition) MarshalJSON() ([]byte, error) { + return s.RawMessage.MarshalJSON() +} + +// UnmarshalJSON implements json unmarshaling for a JSON +func (s *JSONSchemaDefinition) UnmarshalJSON(data []byte) error { + raw := json.RawMessage{} + if err := raw.UnmarshalJSON(data); err != nil { + return err + } + *s = JSONSchemaDefinition{RawMessage: raw} + return nil +} + +func (_ JSONSchemaDefinition) OpenAPISchemaType() []string { return []string{"object"} } +func (_ JSONSchemaDefinition) OpenAPISchemaFormat() string { return "" } + +// Duration is a wrapper for time.Duration that implements JSON marshalling and openapi scheme. +type Duration struct { + time.Duration `json:",inline"` +} + +// MarshalJSON implements the json marshaling for a Duration +func (d Duration) MarshalJSON() ([]byte, error) { + if d.Duration == 0 { + return []byte("\"none\""), nil + } + return []byte(fmt.Sprintf("%q", d.Duration.String())), nil +} + +// UnmarshalJSON implements json unmarshaling for a Duration +func (d *Duration) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + if s == "none" { + *d = Duration{Duration: 0} + return nil + } + dur, err := time.ParseDuration(s) + if err != nil { + return fmt.Errorf("unable to parse string into a duration: %w", err) + } + *d = Duration{Duration: dur} + return nil +} + +func (_ Duration) OpenAPISchemaType() []string { return []string{"string"} } +func (_ Duration) OpenAPISchemaFormat() string { return "" } + +// AnyJSON enhances the json.RawMessages with a dedicated openapi definition so that all +// it is correctly generated +// +k8s:openapi-gen=true +type AnyJSON struct { + json.RawMessage `json:",inline"` +} + +// NewAnyJSON creates a new any json object. +func NewAnyJSON(data []byte) AnyJSON { + return AnyJSON{ + RawMessage: data, + } +} + +// MarshalJSON implements the json marshaling for a JSON +func (s AnyJSON) MarshalJSON() ([]byte, error) { + return s.RawMessage.MarshalJSON() +} + +// UnmarshalJSON implements json unmarshaling for a JSON +func (s *AnyJSON) UnmarshalJSON(data []byte) error { + if string(data) == "null" { + *s = AnyJSON{RawMessage: nil} + return nil + } + + raw := json.RawMessage{} + if err := raw.UnmarshalJSON(data); err != nil { + return err + } + *s = AnyJSON{RawMessage: raw} + return nil +} + +func (_ AnyJSON) OpenAPISchemaType() []string { + return []string{ + "object", + "string", + "number", + "array", + "boolean", + } +} +func (_ AnyJSON) OpenAPISchemaFormat() string { return "" } + +// ConditionStatus is the status of a condition. +type ConditionStatus string + +// ConditionType is a string alias. +type ConditionType string + +const ( + // ConditionTrue means a resource is in the condition. + ConditionTrue ConditionStatus = "True" + // ConditionFalse means a resource is not in the condition. + ConditionFalse ConditionStatus = "False" + // ConditionUnknown means Landscaper can't decide if a resource is in the condition or not. + ConditionUnknown ConditionStatus = "Unknown" + // ConditionProgressing means the condition was seen true, failed but stayed within a predefined failure threshold. + // In the future, we could add other intermediate conditions, e.g. ConditionDegraded. + ConditionProgressing ConditionStatus = "Progressing" + + // ConditionCheckError is a constant for a reason in condition. + ConditionCheckError = "ConditionCheckError" +) + +// ErrorCode is a string alias. +type ErrorCode string + +const ( + // ErrorUnauthorized indicates that the last error occurred due to invalid credentials. + ErrorUnauthorized ErrorCode = "ERR_UNAUTHORIZED" + // ErrorCleanupResources indicates that the last error occurred due to resources are stuck in deletion. + ErrorCleanupResources ErrorCode = "ERR_CLEANUP" + // ErrorConfigurationProblem indicates that the last error occurred due a configuration problem. + ErrorConfigurationProblem ErrorCode = "ERR_CONFIGURATION_PROBLEM" + // ErrorInternalProblem indicates that the last error occurred due to a servere internal error + ErrorInternalProblem ErrorCode = "ERR_INTERNAL_PROBLEM" + // ErrorReadinessCheckTimeout indicates that objects failed the readiness check within the given time + ErrorReadinessCheckTimeout ErrorCode = "ERR_READINESS_CHECK_TIMEOUT" + // ErrorTimeout indicates that an operation timed out. + ErrorTimeout ErrorCode = "ERR_TIMEOUT" + // ErrorCyclicDependencies indicates that there are cyclic dependencies between multiple installations/deployitems. + ErrorCyclicDependencies ErrorCode = "ERR_CYCLIC_DEPENDENCIES" +) + +// UnrecoverableErrorCodes defines unrecoverable error codes +var UnrecoverableErrorCodes = []ErrorCode{ + ErrorConfigurationProblem, + ErrorInternalProblem, + ErrorReadinessCheckTimeout, + ErrorTimeout, + ErrorCyclicDependencies, +} + +// Condition holds the information about the state of a resource. +type Condition struct { + // DataType of the Shoot condition. + Type ConditionType `json:"type"` + // Status of the condition, one of True, False, Unknown. + Status ConditionStatus `json:"status"` + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + // Last time the condition was updated. + LastUpdateTime metav1.Time `json:"lastUpdateTime"` + // The reason for the condition's last transition. + Reason string `json:"reason"` + // A human readable message indicating details about the transition. + Message string `json:"message"` + // Well-defined error codes in case the condition reports a problem. + // +optional + Codes []ErrorCode `json:"codes,omitempty"` +} + +// Error holds information about an error that occurred. +type Error struct { + // Operation describes the operator where the error occurred. + Operation string `json:"operation"` + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + // Last time the condition was updated. + LastUpdateTime metav1.Time `json:"lastUpdateTime"` + // The reason for the condition's last transition. + Reason string `json:"reason"` + // A human readable message indicating details about the transition. + Message string `json:"message"` + // Well-defined error codes in case the condition reports a problem. + // +optional + Codes []ErrorCode `json:"codes,omitempty"` +} + +type Operation string + +const ( + // ReconcileOperation is a annotation for the landscaper to reconcile the resource + ReconcileOperation Operation = "reconcile" + + // ForceReconcileOperation forces the landscaper to not wait for children (executions nor subinstallations) to be completed. + ForceReconcileOperation Operation = "force-reconcile" + + // AbortOperation is the annotation to let the landscaper abort all currently running children and itself. + AbortOperation Operation = "abort" +) + +// ObjectReference is the reference to a kubernetes object. +type ObjectReference struct { + // Name is the name of the kubernetes object. + Name string `json:"name"` + + // Namespace is the namespace of kubernetes object. + // +optional + Namespace string `json:"namespace"` +} + +// NamespacedName returns the namespaced name for the object reference +func (r *ObjectReference) NamespacedName() types.NamespacedName { + return types.NamespacedName{ + Name: r.Name, + Namespace: r.Namespace, + } +} + +// TypedObjectReference is a reference to a typed kubernetes object. +type TypedObjectReference struct { + // APIVersion is the group and version for the resource being referenced. + // If APIVersion is not specified, the specified Kind must be in the core API group. + // For any other third-party types, APIVersion is required. + APIVersion string `json:"apiVersion"` + // Kind is the type of resource being referenced + Kind string `json:"kind"` + + ObjectReference `json:",inline"` +} + +// NamedObjectReference is a named reference to a specific resource. +type NamedObjectReference struct { + // Name is the unique name of the reference. + Name string `json:"name"` + + // Reference is the reference to an object. + Reference ObjectReference `json:"ref"` +} + +// VersionedObjectReference is a reference to a object with its last observed resource generation. +// This struct is used by status fields. +type VersionedObjectReference struct { + ObjectReference `json:",inline"` + + // ObservedGeneration defines the last observed generation of the referenced resource. + ObservedGeneration int64 `json:"observedGeneration"` +} + +// VersionedNamedObjectReference is a named reference to a object with its last observed resource generation. +// This struct is used by status fields. +type VersionedNamedObjectReference struct { + // Name is the unique name of the reference. + Name string `json:"name"` + + // Reference is the reference to an object. + Reference VersionedObjectReference `json:"ref"` +} + +// SecretReference is reference to data in a secret. +// The secret can also be in a different namespace. +type SecretReference struct { + ObjectReference `json:",inline"` + // Key is the name of the key in the secret that holds the data. + // +optional + Key string `json:"key"` +} + +// ConfigMapReference is reference to data in a configmap. +// The configmap can also be in a different namespace. +type ConfigMapReference struct { + ObjectReference `json:",inline"` + // Key is the name of the key in the configmap that holds the data. + // +optional + Key string `json:"key"` +} + +// ComponentDescriptorKind is the kind of a component descriptor. +// It can be a component or a resource. +type ComponentDescriptorKind string + +var UnknownComponentDescriptorKindKindError = errors.New("UnknownComponentDescriptorKindKind") + +const ( + // ComponentResourceKind is the kind of a component. + ComponentResourceKind ComponentDescriptorKind = "component" + // ResourceKind is the kind of a local resource. + ResourceKind ComponentDescriptorKind = "resource" +) + +// ResourceReference defines the reference to a resource defined in a component descriptor. +type ResourceReference struct { + // ComponentName defines the unique of the component containing the resource. + ComponentName string `json:"componentName"` + // ResourceName defines the name of the resource. + ResourceName string `json:"resourceName"` +} + +// VersionedResourceReference defines the reference to a resource with its version. +type VersionedResourceReference struct { + ResourceReference `json:",inline"` + // Version defines the version of the component. + Version string `json:"version"` +} + +// ObjectMeta returns the component descriptor v2 compatible object meta for a resource reference. +func (r VersionedResourceReference) ObjectMeta() cdv2.ObjectMeta { + return cdv2.ObjectMeta{ + Name: r.ComponentName, + Version: r.Version, + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_target.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_target.go new file mode 100644 index 000000000..9f2a8a9d5 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/types_target.go @@ -0,0 +1,173 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "encoding/json" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsschema "github.com/gardener/landscaper/apis/schema" + + "github.com/gardener/landscaper/apis/core" +) + +// TargetType defines the type of the target. +type TargetType string + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TargetList contains a list of Targets +type TargetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Target `json:"items"` +} + +// TargetDefinition defines the Target resource CRD. +var TargetDefinition = lsschema.CustomResourceDefinition{ + Names: lsschema.CustomResourceDefinitionNames{ + Plural: "targets", + Singular: "target", + ShortNames: []string{ + "tgt", + "tg", + }, + Kind: "Target", + }, + Scope: lsschema.NamespaceScoped, + Storage: true, + Served: true, + SubresourceStatus: false, + AdditionalPrinterColumns: []lsschema.CustomResourceColumnDefinition{ + { + Name: "Type", + Type: "string", + JSONPath: ".spec.type", + }, + { + Name: "Context", + Type: "string", + JSONPath: ".metadata.labels['data\\.landscaper\\.gardener\\.cloud\\/context']", + }, + { + Name: "Key", + Type: "string", + JSONPath: ".metadata.labels['data\\.landscaper\\.gardener\\.cloud\\/key']", + }, + { + Name: "Age", + Type: "date", + JSONPath: ".metadata.creationTimestamp", + }, + }, +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Target defines a specific data object that defines target environment. +// Every deploy item can have a target which is used by the deployer to install the specific application. +type Target struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec TargetSpec `json:"spec"` +} + +// TargetSpec contains the definition of a target. +type TargetSpec struct { + // Type is the type of the target that defines its data structure. + // The actual schema may be defined by a target type crd in the future. + Type TargetType `json:"type"` + // Configuration contains the target type specific configuration. + // +optional + Configuration AnyJSON `json:"config,omitempty"` +} + +// TargetTemplate exposes specific parts of a target that are used in the exports +// to export a target +type TargetTemplate struct { + TargetSpec `json:",inline"` + + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. May match selectors of replication controllers + // and services. + // More info: http://kubernetes.io/docs/user-guide/labels + // +optional + Labels map[string]string `json:"labels,omitempty"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. They are not + // queryable and should be preserved when modifying objects. + // More info: http://kubernetes.io/docs/user-guide/annotations + // +optional + Annotations map[string]string `json:"annotations,omitempty"` +} + +////////////////////////////// +// Target Types // +////////////////////////////// +// todo: refactor to own package + +// KubernetesClusterTargetType defines the landscaper kubernetes cluster target. +const KubernetesClusterTargetType TargetType = core.GroupName + "/kubernetes-cluster" + +// KubernetesClusterTargetConfig defines the landscaper kubernetes cluster target config. +type KubernetesClusterTargetConfig struct { + // Kubeconfig defines kubeconfig as string. + Kubeconfig ValueRef `json:"kubeconfig"` +} + +// DefaultKubeconfigKey is the default that is used to hold a kubeconfig. +const DefaultKubeconfigKey = "kubeconfig" + +// ValueRef holds a value that can be either defined by string or by a secret ref. +type ValueRef struct { + StrVal *string `json:"-"` + SecretRef *SecretReference `json:"secretRef,omitempty"` +} + +// valueRefJSON is a helper struct to decode json into a secret ref object. +type valueRefJSON struct { + SecretRef *SecretReference `json:"secretRef,omitempty"` +} + +// MarshalJSON implements the json marshaling for a JSON +func (v ValueRef) MarshalJSON() ([]byte, error) { + if v.StrVal != nil { + return json.Marshal(v.StrVal) + } + ref := valueRefJSON{ + SecretRef: v.SecretRef, + } + return json.Marshal(ref) +} + +// UnmarshalJSON implements json unmarshaling for a JSON +func (v *ValueRef) UnmarshalJSON(data []byte) error { + if data[0] == '"' { + var strVal string + if err := json.Unmarshal(data, &strVal); err != nil { + return err + } + v.StrVal = &strVal + return nil + } + ref := &valueRefJSON{} + if err := json.Unmarshal(data, ref); err != nil { + return err + } + v.SecretRef = ref.SecretRef + return nil +} + +func (v ValueRef) OpenAPISchemaType() []string { + return []string{ + "object", + "string", + } +} +func (v ValueRef) OpenAPISchemaFormat() string { return "" } diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.conversion.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000..f0d581eca --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,3040 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + time "time" + unsafe "unsafe" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + selection "k8s.io/apimachinery/pkg/selection" + + core "github.com/gardener/landscaper/apis/core" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*AnyJSON)(nil), (*core.AnyJSON)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AnyJSON_To_core_AnyJSON(a.(*AnyJSON), b.(*core.AnyJSON), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.AnyJSON)(nil), (*AnyJSON)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_AnyJSON_To_v1alpha1_AnyJSON(a.(*core.AnyJSON), b.(*AnyJSON), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Blueprint)(nil), (*core.Blueprint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Blueprint_To_core_Blueprint(a.(*Blueprint), b.(*core.Blueprint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Blueprint)(nil), (*Blueprint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Blueprint_To_v1alpha1_Blueprint(a.(*core.Blueprint), b.(*Blueprint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BlueprintDefinition)(nil), (*core.BlueprintDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BlueprintDefinition_To_core_BlueprintDefinition(a.(*BlueprintDefinition), b.(*core.BlueprintDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.BlueprintDefinition)(nil), (*BlueprintDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_BlueprintDefinition_To_v1alpha1_BlueprintDefinition(a.(*core.BlueprintDefinition), b.(*BlueprintDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BlueprintStaticDataSource)(nil), (*core.BlueprintStaticDataSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BlueprintStaticDataSource_To_core_BlueprintStaticDataSource(a.(*BlueprintStaticDataSource), b.(*core.BlueprintStaticDataSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.BlueprintStaticDataSource)(nil), (*BlueprintStaticDataSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_BlueprintStaticDataSource_To_v1alpha1_BlueprintStaticDataSource(a.(*core.BlueprintStaticDataSource), b.(*BlueprintStaticDataSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*BlueprintStaticDataValueFrom)(nil), (*core.BlueprintStaticDataValueFrom)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_BlueprintStaticDataValueFrom_To_core_BlueprintStaticDataValueFrom(a.(*BlueprintStaticDataValueFrom), b.(*core.BlueprintStaticDataValueFrom), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.BlueprintStaticDataValueFrom)(nil), (*BlueprintStaticDataValueFrom)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_BlueprintStaticDataValueFrom_To_v1alpha1_BlueprintStaticDataValueFrom(a.(*core.BlueprintStaticDataValueFrom), b.(*BlueprintStaticDataValueFrom), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CDImportStatus)(nil), (*core.CDImportStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CDImportStatus_To_core_CDImportStatus(a.(*CDImportStatus), b.(*core.CDImportStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.CDImportStatus)(nil), (*CDImportStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_CDImportStatus_To_v1alpha1_CDImportStatus(a.(*core.CDImportStatus), b.(*CDImportStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterRestConfig)(nil), (*core.ClusterRestConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterRestConfig_To_core_ClusterRestConfig(a.(*ClusterRestConfig), b.(*core.ClusterRestConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ClusterRestConfig)(nil), (*ClusterRestConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ClusterRestConfig_To_v1alpha1_ClusterRestConfig(a.(*core.ClusterRestConfig), b.(*ClusterRestConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentDescriptorDefinition)(nil), (*core.ComponentDescriptorDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentDescriptorDefinition_To_core_ComponentDescriptorDefinition(a.(*ComponentDescriptorDefinition), b.(*core.ComponentDescriptorDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ComponentDescriptorDefinition)(nil), (*ComponentDescriptorDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ComponentDescriptorDefinition_To_v1alpha1_ComponentDescriptorDefinition(a.(*core.ComponentDescriptorDefinition), b.(*ComponentDescriptorDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentDescriptorImport)(nil), (*core.ComponentDescriptorImport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentDescriptorImport_To_core_ComponentDescriptorImport(a.(*ComponentDescriptorImport), b.(*core.ComponentDescriptorImport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ComponentDescriptorImport)(nil), (*ComponentDescriptorImport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ComponentDescriptorImport_To_v1alpha1_ComponentDescriptorImport(a.(*core.ComponentDescriptorImport), b.(*ComponentDescriptorImport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentDescriptorImportData)(nil), (*core.ComponentDescriptorImportData)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentDescriptorImportData_To_core_ComponentDescriptorImportData(a.(*ComponentDescriptorImportData), b.(*core.ComponentDescriptorImportData), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ComponentDescriptorImportData)(nil), (*ComponentDescriptorImportData)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ComponentDescriptorImportData_To_v1alpha1_ComponentDescriptorImportData(a.(*core.ComponentDescriptorImportData), b.(*ComponentDescriptorImportData), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentDescriptorReference)(nil), (*core.ComponentDescriptorReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentDescriptorReference_To_core_ComponentDescriptorReference(a.(*ComponentDescriptorReference), b.(*core.ComponentDescriptorReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ComponentDescriptorReference)(nil), (*ComponentDescriptorReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ComponentDescriptorReference_To_v1alpha1_ComponentDescriptorReference(a.(*core.ComponentDescriptorReference), b.(*ComponentDescriptorReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentOverwrite)(nil), (*core.ComponentOverwrite)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentOverwrite_To_core_ComponentOverwrite(a.(*ComponentOverwrite), b.(*core.ComponentOverwrite), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ComponentOverwrite)(nil), (*ComponentOverwrite)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ComponentOverwrite_To_v1alpha1_ComponentOverwrite(a.(*core.ComponentOverwrite), b.(*ComponentOverwrite), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentOverwriteReference)(nil), (*core.ComponentOverwriteReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentOverwriteReference_To_core_ComponentOverwriteReference(a.(*ComponentOverwriteReference), b.(*core.ComponentOverwriteReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ComponentOverwriteReference)(nil), (*ComponentOverwriteReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ComponentOverwriteReference_To_v1alpha1_ComponentOverwriteReference(a.(*core.ComponentOverwriteReference), b.(*ComponentOverwriteReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentOverwrites)(nil), (*core.ComponentOverwrites)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentOverwrites_To_core_ComponentOverwrites(a.(*ComponentOverwrites), b.(*core.ComponentOverwrites), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ComponentOverwrites)(nil), (*ComponentOverwrites)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ComponentOverwrites_To_v1alpha1_ComponentOverwrites(a.(*core.ComponentOverwrites), b.(*ComponentOverwrites), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ComponentOverwritesList)(nil), (*core.ComponentOverwritesList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ComponentOverwritesList_To_core_ComponentOverwritesList(a.(*ComponentOverwritesList), b.(*core.ComponentOverwritesList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ComponentOverwritesList)(nil), (*ComponentOverwritesList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ComponentOverwritesList_To_v1alpha1_ComponentOverwritesList(a.(*core.ComponentOverwritesList), b.(*ComponentOverwritesList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Condition)(nil), (*core.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Condition_To_core_Condition(a.(*Condition), b.(*core.Condition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Condition)(nil), (*Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Condition_To_v1alpha1_Condition(a.(*core.Condition), b.(*Condition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ConfigMapReference)(nil), (*core.ConfigMapReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ConfigMapReference_To_core_ConfigMapReference(a.(*ConfigMapReference), b.(*core.ConfigMapReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ConfigMapReference)(nil), (*ConfigMapReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ConfigMapReference_To_v1alpha1_ConfigMapReference(a.(*core.ConfigMapReference), b.(*ConfigMapReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Context)(nil), (*core.Context)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Context_To_core_Context(a.(*Context), b.(*core.Context), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Context)(nil), (*Context)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Context_To_v1alpha1_Context(a.(*core.Context), b.(*Context), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ContextList)(nil), (*core.ContextList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ContextList_To_core_ContextList(a.(*ContextList), b.(*core.ContextList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ContextList)(nil), (*ContextList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ContextList_To_v1alpha1_ContextList(a.(*core.ContextList), b.(*ContextList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DataExport)(nil), (*core.DataExport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DataExport_To_core_DataExport(a.(*DataExport), b.(*core.DataExport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DataExport)(nil), (*DataExport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DataExport_To_v1alpha1_DataExport(a.(*core.DataExport), b.(*DataExport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DataImport)(nil), (*core.DataImport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DataImport_To_core_DataImport(a.(*DataImport), b.(*core.DataImport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DataImport)(nil), (*DataImport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DataImport_To_v1alpha1_DataImport(a.(*core.DataImport), b.(*DataImport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DataObject)(nil), (*core.DataObject)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DataObject_To_core_DataObject(a.(*DataObject), b.(*core.DataObject), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DataObject)(nil), (*DataObject)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DataObject_To_v1alpha1_DataObject(a.(*core.DataObject), b.(*DataObject), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DataObjectList)(nil), (*core.DataObjectList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DataObjectList_To_core_DataObjectList(a.(*DataObjectList), b.(*core.DataObjectList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DataObjectList)(nil), (*DataObjectList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DataObjectList_To_v1alpha1_DataObjectList(a.(*core.DataObjectList), b.(*DataObjectList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Default)(nil), (*core.Default)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Default_To_core_Default(a.(*Default), b.(*core.Default), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Default)(nil), (*Default)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Default_To_v1alpha1_Default(a.(*core.Default), b.(*Default), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployItem)(nil), (*core.DeployItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItem_To_core_DeployItem(a.(*DeployItem), b.(*core.DeployItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployItem)(nil), (*DeployItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployItem_To_v1alpha1_DeployItem(a.(*core.DeployItem), b.(*DeployItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployItemList)(nil), (*core.DeployItemList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItemList_To_core_DeployItemList(a.(*DeployItemList), b.(*core.DeployItemList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployItemList)(nil), (*DeployItemList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployItemList_To_v1alpha1_DeployItemList(a.(*core.DeployItemList), b.(*DeployItemList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployItemSpec)(nil), (*core.DeployItemSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItemSpec_To_core_DeployItemSpec(a.(*DeployItemSpec), b.(*core.DeployItemSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployItemSpec)(nil), (*DeployItemSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployItemSpec_To_v1alpha1_DeployItemSpec(a.(*core.DeployItemSpec), b.(*DeployItemSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployItemStatus)(nil), (*core.DeployItemStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItemStatus_To_core_DeployItemStatus(a.(*DeployItemStatus), b.(*core.DeployItemStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployItemStatus)(nil), (*DeployItemStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployItemStatus_To_v1alpha1_DeployItemStatus(a.(*core.DeployItemStatus), b.(*DeployItemStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployItemTemplate)(nil), (*core.DeployItemTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItemTemplate_To_core_DeployItemTemplate(a.(*DeployItemTemplate), b.(*core.DeployItemTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployItemTemplate)(nil), (*DeployItemTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployItemTemplate_To_v1alpha1_DeployItemTemplate(a.(*core.DeployItemTemplate), b.(*DeployItemTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployerInformation)(nil), (*core.DeployerInformation)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployerInformation_To_core_DeployerInformation(a.(*DeployerInformation), b.(*core.DeployerInformation), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployerInformation)(nil), (*DeployerInformation)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployerInformation_To_v1alpha1_DeployerInformation(a.(*core.DeployerInformation), b.(*DeployerInformation), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployerInstallationTemplate)(nil), (*core.DeployerInstallationTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployerInstallationTemplate_To_core_DeployerInstallationTemplate(a.(*DeployerInstallationTemplate), b.(*core.DeployerInstallationTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployerInstallationTemplate)(nil), (*DeployerInstallationTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployerInstallationTemplate_To_v1alpha1_DeployerInstallationTemplate(a.(*core.DeployerInstallationTemplate), b.(*DeployerInstallationTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployerRegistration)(nil), (*core.DeployerRegistration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployerRegistration_To_core_DeployerRegistration(a.(*DeployerRegistration), b.(*core.DeployerRegistration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployerRegistration)(nil), (*DeployerRegistration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployerRegistration_To_v1alpha1_DeployerRegistration(a.(*core.DeployerRegistration), b.(*DeployerRegistration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployerRegistrationList)(nil), (*core.DeployerRegistrationList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployerRegistrationList_To_core_DeployerRegistrationList(a.(*DeployerRegistrationList), b.(*core.DeployerRegistrationList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployerRegistrationList)(nil), (*DeployerRegistrationList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployerRegistrationList_To_v1alpha1_DeployerRegistrationList(a.(*core.DeployerRegistrationList), b.(*DeployerRegistrationList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DeployerRegistrationSpec)(nil), (*core.DeployerRegistrationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployerRegistrationSpec_To_core_DeployerRegistrationSpec(a.(*DeployerRegistrationSpec), b.(*core.DeployerRegistrationSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.DeployerRegistrationSpec)(nil), (*DeployerRegistrationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployerRegistrationSpec_To_v1alpha1_DeployerRegistrationSpec(a.(*core.DeployerRegistrationSpec), b.(*DeployerRegistrationSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Duration)(nil), (*core.Duration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Duration_To_core_Duration(a.(*Duration), b.(*core.Duration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Duration)(nil), (*Duration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Duration_To_v1alpha1_Duration(a.(*core.Duration), b.(*Duration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Environment)(nil), (*core.Environment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Environment_To_core_Environment(a.(*Environment), b.(*core.Environment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Environment)(nil), (*Environment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Environment_To_v1alpha1_Environment(a.(*core.Environment), b.(*Environment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EnvironmentList)(nil), (*core.EnvironmentList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EnvironmentList_To_core_EnvironmentList(a.(*EnvironmentList), b.(*core.EnvironmentList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.EnvironmentList)(nil), (*EnvironmentList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_EnvironmentList_To_v1alpha1_EnvironmentList(a.(*core.EnvironmentList), b.(*EnvironmentList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EnvironmentSpec)(nil), (*core.EnvironmentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EnvironmentSpec_To_core_EnvironmentSpec(a.(*EnvironmentSpec), b.(*core.EnvironmentSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.EnvironmentSpec)(nil), (*EnvironmentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_EnvironmentSpec_To_v1alpha1_EnvironmentSpec(a.(*core.EnvironmentSpec), b.(*EnvironmentSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Error)(nil), (*core.Error)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Error_To_core_Error(a.(*Error), b.(*core.Error), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Error)(nil), (*Error)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Error_To_v1alpha1_Error(a.(*core.Error), b.(*Error), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Execution)(nil), (*core.Execution)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Execution_To_core_Execution(a.(*Execution), b.(*core.Execution), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Execution)(nil), (*Execution)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Execution_To_v1alpha1_Execution(a.(*core.Execution), b.(*Execution), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExecutionGeneration)(nil), (*core.ExecutionGeneration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExecutionGeneration_To_core_ExecutionGeneration(a.(*ExecutionGeneration), b.(*core.ExecutionGeneration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ExecutionGeneration)(nil), (*ExecutionGeneration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ExecutionGeneration_To_v1alpha1_ExecutionGeneration(a.(*core.ExecutionGeneration), b.(*ExecutionGeneration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExecutionList)(nil), (*core.ExecutionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExecutionList_To_core_ExecutionList(a.(*ExecutionList), b.(*core.ExecutionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ExecutionList)(nil), (*ExecutionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ExecutionList_To_v1alpha1_ExecutionList(a.(*core.ExecutionList), b.(*ExecutionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExecutionStatus)(nil), (*core.ExecutionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExecutionStatus_To_core_ExecutionStatus(a.(*ExecutionStatus), b.(*core.ExecutionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ExecutionStatus)(nil), (*ExecutionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ExecutionStatus_To_v1alpha1_ExecutionStatus(a.(*core.ExecutionStatus), b.(*ExecutionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExportDefinition)(nil), (*core.ExportDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExportDefinition_To_core_ExportDefinition(a.(*ExportDefinition), b.(*core.ExportDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ExportDefinition)(nil), (*ExportDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ExportDefinition_To_v1alpha1_ExportDefinition(a.(*core.ExportDefinition), b.(*ExportDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*FieldValueDefinition)(nil), (*core.FieldValueDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_FieldValueDefinition_To_core_FieldValueDefinition(a.(*FieldValueDefinition), b.(*core.FieldValueDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.FieldValueDefinition)(nil), (*FieldValueDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_FieldValueDefinition_To_v1alpha1_FieldValueDefinition(a.(*core.FieldValueDefinition), b.(*FieldValueDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ImportDefinition)(nil), (*core.ImportDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ImportDefinition_To_core_ImportDefinition(a.(*ImportDefinition), b.(*core.ImportDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ImportDefinition)(nil), (*ImportDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ImportDefinition_To_v1alpha1_ImportDefinition(a.(*core.ImportDefinition), b.(*ImportDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ImportStatus)(nil), (*core.ImportStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ImportStatus_To_core_ImportStatus(a.(*ImportStatus), b.(*core.ImportStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ImportStatus)(nil), (*ImportStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ImportStatus_To_v1alpha1_ImportStatus(a.(*core.ImportStatus), b.(*ImportStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InlineBlueprint)(nil), (*core.InlineBlueprint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InlineBlueprint_To_core_InlineBlueprint(a.(*InlineBlueprint), b.(*core.InlineBlueprint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InlineBlueprint)(nil), (*InlineBlueprint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InlineBlueprint_To_v1alpha1_InlineBlueprint(a.(*core.InlineBlueprint), b.(*InlineBlueprint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Installation)(nil), (*core.Installation)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Installation_To_core_Installation(a.(*Installation), b.(*core.Installation), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Installation)(nil), (*Installation)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Installation_To_v1alpha1_Installation(a.(*core.Installation), b.(*Installation), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallationExports)(nil), (*core.InstallationExports)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallationExports_To_core_InstallationExports(a.(*InstallationExports), b.(*core.InstallationExports), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstallationExports)(nil), (*InstallationExports)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstallationExports_To_v1alpha1_InstallationExports(a.(*core.InstallationExports), b.(*InstallationExports), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallationImports)(nil), (*core.InstallationImports)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallationImports_To_core_InstallationImports(a.(*InstallationImports), b.(*core.InstallationImports), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstallationImports)(nil), (*InstallationImports)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstallationImports_To_v1alpha1_InstallationImports(a.(*core.InstallationImports), b.(*InstallationImports), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallationList)(nil), (*core.InstallationList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallationList_To_core_InstallationList(a.(*InstallationList), b.(*core.InstallationList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstallationList)(nil), (*InstallationList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstallationList_To_v1alpha1_InstallationList(a.(*core.InstallationList), b.(*InstallationList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallationSpec)(nil), (*core.InstallationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallationSpec_To_core_InstallationSpec(a.(*InstallationSpec), b.(*core.InstallationSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstallationSpec)(nil), (*InstallationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstallationSpec_To_v1alpha1_InstallationSpec(a.(*core.InstallationSpec), b.(*InstallationSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallationStatus)(nil), (*core.InstallationStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallationStatus_To_core_InstallationStatus(a.(*InstallationStatus), b.(*core.InstallationStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstallationStatus)(nil), (*InstallationStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstallationStatus_To_v1alpha1_InstallationStatus(a.(*core.InstallationStatus), b.(*InstallationStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallationTemplate)(nil), (*core.InstallationTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallationTemplate_To_core_InstallationTemplate(a.(*InstallationTemplate), b.(*core.InstallationTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstallationTemplate)(nil), (*InstallationTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstallationTemplate_To_v1alpha1_InstallationTemplate(a.(*core.InstallationTemplate), b.(*InstallationTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallationTemplateBlueprintDefinition)(nil), (*core.InstallationTemplateBlueprintDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallationTemplateBlueprintDefinition_To_core_InstallationTemplateBlueprintDefinition(a.(*InstallationTemplateBlueprintDefinition), b.(*core.InstallationTemplateBlueprintDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.InstallationTemplateBlueprintDefinition)(nil), (*InstallationTemplateBlueprintDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_InstallationTemplateBlueprintDefinition_To_v1alpha1_InstallationTemplateBlueprintDefinition(a.(*core.InstallationTemplateBlueprintDefinition), b.(*InstallationTemplateBlueprintDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*JSONSchemaDefinition)(nil), (*core.JSONSchemaDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_JSONSchemaDefinition_To_core_JSONSchemaDefinition(a.(*JSONSchemaDefinition), b.(*core.JSONSchemaDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.JSONSchemaDefinition)(nil), (*JSONSchemaDefinition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_JSONSchemaDefinition_To_v1alpha1_JSONSchemaDefinition(a.(*core.JSONSchemaDefinition), b.(*JSONSchemaDefinition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NamedObjectReference)(nil), (*core.NamedObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NamedObjectReference_To_core_NamedObjectReference(a.(*NamedObjectReference), b.(*core.NamedObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.NamedObjectReference)(nil), (*NamedObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_NamedObjectReference_To_v1alpha1_NamedObjectReference(a.(*core.NamedObjectReference), b.(*NamedObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ObjectReference)(nil), (*core.ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ObjectReference_To_core_ObjectReference(a.(*ObjectReference), b.(*core.ObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ObjectReference)(nil), (*ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ObjectReference_To_v1alpha1_ObjectReference(a.(*core.ObjectReference), b.(*ObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RemoteBlueprintReference)(nil), (*core.RemoteBlueprintReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RemoteBlueprintReference_To_core_RemoteBlueprintReference(a.(*RemoteBlueprintReference), b.(*core.RemoteBlueprintReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.RemoteBlueprintReference)(nil), (*RemoteBlueprintReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_RemoteBlueprintReference_To_v1alpha1_RemoteBlueprintReference(a.(*core.RemoteBlueprintReference), b.(*RemoteBlueprintReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Requirement)(nil), (*core.Requirement)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Requirement_To_core_Requirement(a.(*Requirement), b.(*core.Requirement), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Requirement)(nil), (*Requirement)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Requirement_To_v1alpha1_Requirement(a.(*core.Requirement), b.(*Requirement), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ResourceReference)(nil), (*core.ResourceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ResourceReference_To_core_ResourceReference(a.(*ResourceReference), b.(*core.ResourceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ResourceReference)(nil), (*ResourceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ResourceReference_To_v1alpha1_ResourceReference(a.(*core.ResourceReference), b.(*ResourceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SecretLabelSelectorRef)(nil), (*core.SecretLabelSelectorRef)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SecretLabelSelectorRef_To_core_SecretLabelSelectorRef(a.(*SecretLabelSelectorRef), b.(*core.SecretLabelSelectorRef), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.SecretLabelSelectorRef)(nil), (*SecretLabelSelectorRef)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_SecretLabelSelectorRef_To_v1alpha1_SecretLabelSelectorRef(a.(*core.SecretLabelSelectorRef), b.(*SecretLabelSelectorRef), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SecretReference)(nil), (*core.SecretReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SecretReference_To_core_SecretReference(a.(*SecretReference), b.(*core.SecretReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.SecretReference)(nil), (*SecretReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_SecretReference_To_v1alpha1_SecretReference(a.(*core.SecretReference), b.(*SecretReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*StaticDataSource)(nil), (*core.StaticDataSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_StaticDataSource_To_core_StaticDataSource(a.(*StaticDataSource), b.(*core.StaticDataSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.StaticDataSource)(nil), (*StaticDataSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_StaticDataSource_To_v1alpha1_StaticDataSource(a.(*core.StaticDataSource), b.(*StaticDataSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*StaticDataValueFrom)(nil), (*core.StaticDataValueFrom)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_StaticDataValueFrom_To_core_StaticDataValueFrom(a.(*StaticDataValueFrom), b.(*core.StaticDataValueFrom), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.StaticDataValueFrom)(nil), (*StaticDataValueFrom)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_StaticDataValueFrom_To_v1alpha1_StaticDataValueFrom(a.(*core.StaticDataValueFrom), b.(*StaticDataValueFrom), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SubinstallationTemplate)(nil), (*core.SubinstallationTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SubinstallationTemplate_To_core_SubinstallationTemplate(a.(*SubinstallationTemplate), b.(*core.SubinstallationTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.SubinstallationTemplate)(nil), (*SubinstallationTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_SubinstallationTemplate_To_v1alpha1_SubinstallationTemplate(a.(*core.SubinstallationTemplate), b.(*SubinstallationTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TLSClientConfig)(nil), (*core.TLSClientConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TLSClientConfig_To_core_TLSClientConfig(a.(*TLSClientConfig), b.(*core.TLSClientConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TLSClientConfig)(nil), (*TLSClientConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TLSClientConfig_To_v1alpha1_TLSClientConfig(a.(*core.TLSClientConfig), b.(*TLSClientConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Target)(nil), (*core.Target)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Target_To_core_Target(a.(*Target), b.(*core.Target), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.Target)(nil), (*Target)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_Target_To_v1alpha1_Target(a.(*core.Target), b.(*Target), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TargetExport)(nil), (*core.TargetExport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TargetExport_To_core_TargetExport(a.(*TargetExport), b.(*core.TargetExport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TargetExport)(nil), (*TargetExport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TargetExport_To_v1alpha1_TargetExport(a.(*core.TargetExport), b.(*TargetExport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TargetImport)(nil), (*core.TargetImport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TargetImport_To_core_TargetImport(a.(*TargetImport), b.(*core.TargetImport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TargetImport)(nil), (*TargetImport)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TargetImport_To_v1alpha1_TargetImport(a.(*core.TargetImport), b.(*TargetImport), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TargetImportStatus)(nil), (*core.TargetImportStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TargetImportStatus_To_core_TargetImportStatus(a.(*TargetImportStatus), b.(*core.TargetImportStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TargetImportStatus)(nil), (*TargetImportStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TargetImportStatus_To_v1alpha1_TargetImportStatus(a.(*core.TargetImportStatus), b.(*TargetImportStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TargetList)(nil), (*core.TargetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TargetList_To_core_TargetList(a.(*TargetList), b.(*core.TargetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TargetList)(nil), (*TargetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TargetList_To_v1alpha1_TargetList(a.(*core.TargetList), b.(*TargetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TargetSelector)(nil), (*core.TargetSelector)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TargetSelector_To_core_TargetSelector(a.(*TargetSelector), b.(*core.TargetSelector), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TargetSelector)(nil), (*TargetSelector)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TargetSelector_To_v1alpha1_TargetSelector(a.(*core.TargetSelector), b.(*TargetSelector), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TargetSpec)(nil), (*core.TargetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TargetSpec_To_core_TargetSpec(a.(*TargetSpec), b.(*core.TargetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TargetSpec)(nil), (*TargetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TargetSpec_To_v1alpha1_TargetSpec(a.(*core.TargetSpec), b.(*TargetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TargetTemplate)(nil), (*core.TargetTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TargetTemplate_To_core_TargetTemplate(a.(*TargetTemplate), b.(*core.TargetTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TargetTemplate)(nil), (*TargetTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TargetTemplate_To_v1alpha1_TargetTemplate(a.(*core.TargetTemplate), b.(*TargetTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TemplateExecutor)(nil), (*core.TemplateExecutor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TemplateExecutor_To_core_TemplateExecutor(a.(*TemplateExecutor), b.(*core.TemplateExecutor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TemplateExecutor)(nil), (*TemplateExecutor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TemplateExecutor_To_v1alpha1_TemplateExecutor(a.(*core.TemplateExecutor), b.(*TemplateExecutor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TypedObjectReference)(nil), (*core.TypedObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TypedObjectReference_To_core_TypedObjectReference(a.(*TypedObjectReference), b.(*core.TypedObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.TypedObjectReference)(nil), (*TypedObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_TypedObjectReference_To_v1alpha1_TypedObjectReference(a.(*core.TypedObjectReference), b.(*TypedObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VersionedNamedObjectReference)(nil), (*core.VersionedNamedObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VersionedNamedObjectReference_To_core_VersionedNamedObjectReference(a.(*VersionedNamedObjectReference), b.(*core.VersionedNamedObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.VersionedNamedObjectReference)(nil), (*VersionedNamedObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_VersionedNamedObjectReference_To_v1alpha1_VersionedNamedObjectReference(a.(*core.VersionedNamedObjectReference), b.(*VersionedNamedObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VersionedObjectReference)(nil), (*core.VersionedObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VersionedObjectReference_To_core_VersionedObjectReference(a.(*VersionedObjectReference), b.(*core.VersionedObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.VersionedObjectReference)(nil), (*VersionedObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_VersionedObjectReference_To_v1alpha1_VersionedObjectReference(a.(*core.VersionedObjectReference), b.(*VersionedObjectReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VersionedResourceReference)(nil), (*core.VersionedResourceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VersionedResourceReference_To_core_VersionedResourceReference(a.(*VersionedResourceReference), b.(*core.VersionedResourceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.VersionedResourceReference)(nil), (*VersionedResourceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_VersionedResourceReference_To_v1alpha1_VersionedResourceReference(a.(*core.VersionedResourceReference), b.(*VersionedResourceReference), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*core.DeployItemTemplateList)(nil), (*DeployItemTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_DeployItemTemplateList_To_v1alpha1_DeployItemTemplateList(a.(*core.DeployItemTemplateList), b.(*DeployItemTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*core.ExecutionSpec)(nil), (*ExecutionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ExecutionSpec_To_v1alpha1_ExecutionSpec(a.(*core.ExecutionSpec), b.(*ExecutionSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*DeployItemTemplateList)(nil), (*core.DeployItemTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DeployItemTemplateList_To_core_DeployItemTemplateList(a.(*DeployItemTemplateList), b.(*core.DeployItemTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*ExecutionSpec)(nil), (*core.ExecutionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExecutionSpec_To_core_ExecutionSpec(a.(*ExecutionSpec), b.(*core.ExecutionSpec), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_AnyJSON_To_core_AnyJSON(in *AnyJSON, out *core.AnyJSON, s conversion.Scope) error { + out.RawMessage = *(*json.RawMessage)(unsafe.Pointer(&in.RawMessage)) + return nil +} + +// Convert_v1alpha1_AnyJSON_To_core_AnyJSON is an autogenerated conversion function. +func Convert_v1alpha1_AnyJSON_To_core_AnyJSON(in *AnyJSON, out *core.AnyJSON, s conversion.Scope) error { + return autoConvert_v1alpha1_AnyJSON_To_core_AnyJSON(in, out, s) +} + +func autoConvert_core_AnyJSON_To_v1alpha1_AnyJSON(in *core.AnyJSON, out *AnyJSON, s conversion.Scope) error { + out.RawMessage = *(*json.RawMessage)(unsafe.Pointer(&in.RawMessage)) + return nil +} + +// Convert_core_AnyJSON_To_v1alpha1_AnyJSON is an autogenerated conversion function. +func Convert_core_AnyJSON_To_v1alpha1_AnyJSON(in *core.AnyJSON, out *AnyJSON, s conversion.Scope) error { + return autoConvert_core_AnyJSON_To_v1alpha1_AnyJSON(in, out, s) +} + +func autoConvert_v1alpha1_Blueprint_To_core_Blueprint(in *Blueprint, out *core.Blueprint, s conversion.Scope) error { + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.JSONSchemaVersion = in.JSONSchemaVersion + out.LocalTypes = *(*map[string]core.JSONSchemaDefinition)(unsafe.Pointer(&in.LocalTypes)) + out.Imports = *(*core.ImportDefinitionList)(unsafe.Pointer(&in.Imports)) + out.Exports = *(*core.ExportDefinitionList)(unsafe.Pointer(&in.Exports)) + out.Subinstallations = *(*core.SubinstallationTemplateList)(unsafe.Pointer(&in.Subinstallations)) + out.SubinstallationExecutions = *(*[]core.TemplateExecutor)(unsafe.Pointer(&in.SubinstallationExecutions)) + out.DeployExecutions = *(*[]core.TemplateExecutor)(unsafe.Pointer(&in.DeployExecutions)) + out.ExportExecutions = *(*[]core.TemplateExecutor)(unsafe.Pointer(&in.ExportExecutions)) + return nil +} + +// Convert_v1alpha1_Blueprint_To_core_Blueprint is an autogenerated conversion function. +func Convert_v1alpha1_Blueprint_To_core_Blueprint(in *Blueprint, out *core.Blueprint, s conversion.Scope) error { + return autoConvert_v1alpha1_Blueprint_To_core_Blueprint(in, out, s) +} + +func autoConvert_core_Blueprint_To_v1alpha1_Blueprint(in *core.Blueprint, out *Blueprint, s conversion.Scope) error { + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.JSONSchemaVersion = in.JSONSchemaVersion + out.LocalTypes = *(*map[string]JSONSchemaDefinition)(unsafe.Pointer(&in.LocalTypes)) + out.Imports = *(*ImportDefinitionList)(unsafe.Pointer(&in.Imports)) + out.Exports = *(*ExportDefinitionList)(unsafe.Pointer(&in.Exports)) + out.Subinstallations = *(*SubinstallationTemplateList)(unsafe.Pointer(&in.Subinstallations)) + out.SubinstallationExecutions = *(*[]TemplateExecutor)(unsafe.Pointer(&in.SubinstallationExecutions)) + out.DeployExecutions = *(*[]TemplateExecutor)(unsafe.Pointer(&in.DeployExecutions)) + out.ExportExecutions = *(*[]TemplateExecutor)(unsafe.Pointer(&in.ExportExecutions)) + return nil +} + +// Convert_core_Blueprint_To_v1alpha1_Blueprint is an autogenerated conversion function. +func Convert_core_Blueprint_To_v1alpha1_Blueprint(in *core.Blueprint, out *Blueprint, s conversion.Scope) error { + return autoConvert_core_Blueprint_To_v1alpha1_Blueprint(in, out, s) +} + +func autoConvert_v1alpha1_BlueprintDefinition_To_core_BlueprintDefinition(in *BlueprintDefinition, out *core.BlueprintDefinition, s conversion.Scope) error { + out.Reference = (*core.RemoteBlueprintReference)(unsafe.Pointer(in.Reference)) + out.Inline = (*core.InlineBlueprint)(unsafe.Pointer(in.Inline)) + return nil +} + +// Convert_v1alpha1_BlueprintDefinition_To_core_BlueprintDefinition is an autogenerated conversion function. +func Convert_v1alpha1_BlueprintDefinition_To_core_BlueprintDefinition(in *BlueprintDefinition, out *core.BlueprintDefinition, s conversion.Scope) error { + return autoConvert_v1alpha1_BlueprintDefinition_To_core_BlueprintDefinition(in, out, s) +} + +func autoConvert_core_BlueprintDefinition_To_v1alpha1_BlueprintDefinition(in *core.BlueprintDefinition, out *BlueprintDefinition, s conversion.Scope) error { + out.Reference = (*RemoteBlueprintReference)(unsafe.Pointer(in.Reference)) + out.Inline = (*InlineBlueprint)(unsafe.Pointer(in.Inline)) + return nil +} + +// Convert_core_BlueprintDefinition_To_v1alpha1_BlueprintDefinition is an autogenerated conversion function. +func Convert_core_BlueprintDefinition_To_v1alpha1_BlueprintDefinition(in *core.BlueprintDefinition, out *BlueprintDefinition, s conversion.Scope) error { + return autoConvert_core_BlueprintDefinition_To_v1alpha1_BlueprintDefinition(in, out, s) +} + +func autoConvert_v1alpha1_BlueprintStaticDataSource_To_core_BlueprintStaticDataSource(in *BlueprintStaticDataSource, out *core.BlueprintStaticDataSource, s conversion.Scope) error { + if err := Convert_v1alpha1_AnyJSON_To_core_AnyJSON(&in.Value, &out.Value, s); err != nil { + return err + } + out.ValueFrom = (*core.StaticDataValueFrom)(unsafe.Pointer(in.ValueFrom)) + return nil +} + +// Convert_v1alpha1_BlueprintStaticDataSource_To_core_BlueprintStaticDataSource is an autogenerated conversion function. +func Convert_v1alpha1_BlueprintStaticDataSource_To_core_BlueprintStaticDataSource(in *BlueprintStaticDataSource, out *core.BlueprintStaticDataSource, s conversion.Scope) error { + return autoConvert_v1alpha1_BlueprintStaticDataSource_To_core_BlueprintStaticDataSource(in, out, s) +} + +func autoConvert_core_BlueprintStaticDataSource_To_v1alpha1_BlueprintStaticDataSource(in *core.BlueprintStaticDataSource, out *BlueprintStaticDataSource, s conversion.Scope) error { + if err := Convert_core_AnyJSON_To_v1alpha1_AnyJSON(&in.Value, &out.Value, s); err != nil { + return err + } + out.ValueFrom = (*StaticDataValueFrom)(unsafe.Pointer(in.ValueFrom)) + return nil +} + +// Convert_core_BlueprintStaticDataSource_To_v1alpha1_BlueprintStaticDataSource is an autogenerated conversion function. +func Convert_core_BlueprintStaticDataSource_To_v1alpha1_BlueprintStaticDataSource(in *core.BlueprintStaticDataSource, out *BlueprintStaticDataSource, s conversion.Scope) error { + return autoConvert_core_BlueprintStaticDataSource_To_v1alpha1_BlueprintStaticDataSource(in, out, s) +} + +func autoConvert_v1alpha1_BlueprintStaticDataValueFrom_To_core_BlueprintStaticDataValueFrom(in *BlueprintStaticDataValueFrom, out *core.BlueprintStaticDataValueFrom, s conversion.Scope) error { + out.LocalPath = in.LocalPath + return nil +} + +// Convert_v1alpha1_BlueprintStaticDataValueFrom_To_core_BlueprintStaticDataValueFrom is an autogenerated conversion function. +func Convert_v1alpha1_BlueprintStaticDataValueFrom_To_core_BlueprintStaticDataValueFrom(in *BlueprintStaticDataValueFrom, out *core.BlueprintStaticDataValueFrom, s conversion.Scope) error { + return autoConvert_v1alpha1_BlueprintStaticDataValueFrom_To_core_BlueprintStaticDataValueFrom(in, out, s) +} + +func autoConvert_core_BlueprintStaticDataValueFrom_To_v1alpha1_BlueprintStaticDataValueFrom(in *core.BlueprintStaticDataValueFrom, out *BlueprintStaticDataValueFrom, s conversion.Scope) error { + out.LocalPath = in.LocalPath + return nil +} + +// Convert_core_BlueprintStaticDataValueFrom_To_v1alpha1_BlueprintStaticDataValueFrom is an autogenerated conversion function. +func Convert_core_BlueprintStaticDataValueFrom_To_v1alpha1_BlueprintStaticDataValueFrom(in *core.BlueprintStaticDataValueFrom, out *BlueprintStaticDataValueFrom, s conversion.Scope) error { + return autoConvert_core_BlueprintStaticDataValueFrom_To_v1alpha1_BlueprintStaticDataValueFrom(in, out, s) +} + +func autoConvert_v1alpha1_CDImportStatus_To_core_CDImportStatus(in *CDImportStatus, out *core.CDImportStatus, s conversion.Scope) error { + out.ComponentDescriptorRef = (*core.ComponentDescriptorReference)(unsafe.Pointer(in.ComponentDescriptorRef)) + out.SecretRef = in.SecretRef + out.ConfigMapRef = in.ConfigMapRef + out.SourceRef = (*core.ObjectReference)(unsafe.Pointer(in.SourceRef)) + return nil +} + +// Convert_v1alpha1_CDImportStatus_To_core_CDImportStatus is an autogenerated conversion function. +func Convert_v1alpha1_CDImportStatus_To_core_CDImportStatus(in *CDImportStatus, out *core.CDImportStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_CDImportStatus_To_core_CDImportStatus(in, out, s) +} + +func autoConvert_core_CDImportStatus_To_v1alpha1_CDImportStatus(in *core.CDImportStatus, out *CDImportStatus, s conversion.Scope) error { + out.ComponentDescriptorRef = (*ComponentDescriptorReference)(unsafe.Pointer(in.ComponentDescriptorRef)) + out.SecretRef = in.SecretRef + out.ConfigMapRef = in.ConfigMapRef + out.SourceRef = (*ObjectReference)(unsafe.Pointer(in.SourceRef)) + return nil +} + +// Convert_core_CDImportStatus_To_v1alpha1_CDImportStatus is an autogenerated conversion function. +func Convert_core_CDImportStatus_To_v1alpha1_CDImportStatus(in *core.CDImportStatus, out *CDImportStatus, s conversion.Scope) error { + return autoConvert_core_CDImportStatus_To_v1alpha1_CDImportStatus(in, out, s) +} + +func autoConvert_v1alpha1_ClusterRestConfig_To_core_ClusterRestConfig(in *ClusterRestConfig, out *core.ClusterRestConfig, s conversion.Scope) error { + out.Host = in.Host + out.APIPath = in.APIPath + if err := Convert_v1alpha1_TLSClientConfig_To_core_TLSClientConfig(&in.TLSClientConfig, &out.TLSClientConfig, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ClusterRestConfig_To_core_ClusterRestConfig is an autogenerated conversion function. +func Convert_v1alpha1_ClusterRestConfig_To_core_ClusterRestConfig(in *ClusterRestConfig, out *core.ClusterRestConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterRestConfig_To_core_ClusterRestConfig(in, out, s) +} + +func autoConvert_core_ClusterRestConfig_To_v1alpha1_ClusterRestConfig(in *core.ClusterRestConfig, out *ClusterRestConfig, s conversion.Scope) error { + out.Host = in.Host + out.APIPath = in.APIPath + if err := Convert_core_TLSClientConfig_To_v1alpha1_TLSClientConfig(&in.TLSClientConfig, &out.TLSClientConfig, s); err != nil { + return err + } + return nil +} + +// Convert_core_ClusterRestConfig_To_v1alpha1_ClusterRestConfig is an autogenerated conversion function. +func Convert_core_ClusterRestConfig_To_v1alpha1_ClusterRestConfig(in *core.ClusterRestConfig, out *ClusterRestConfig, s conversion.Scope) error { + return autoConvert_core_ClusterRestConfig_To_v1alpha1_ClusterRestConfig(in, out, s) +} + +func autoConvert_v1alpha1_ComponentDescriptorDefinition_To_core_ComponentDescriptorDefinition(in *ComponentDescriptorDefinition, out *core.ComponentDescriptorDefinition, s conversion.Scope) error { + out.Reference = (*core.ComponentDescriptorReference)(unsafe.Pointer(in.Reference)) + out.Inline = (*v2.ComponentDescriptor)(unsafe.Pointer(in.Inline)) + return nil +} + +// Convert_v1alpha1_ComponentDescriptorDefinition_To_core_ComponentDescriptorDefinition is an autogenerated conversion function. +func Convert_v1alpha1_ComponentDescriptorDefinition_To_core_ComponentDescriptorDefinition(in *ComponentDescriptorDefinition, out *core.ComponentDescriptorDefinition, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentDescriptorDefinition_To_core_ComponentDescriptorDefinition(in, out, s) +} + +func autoConvert_core_ComponentDescriptorDefinition_To_v1alpha1_ComponentDescriptorDefinition(in *core.ComponentDescriptorDefinition, out *ComponentDescriptorDefinition, s conversion.Scope) error { + out.Reference = (*ComponentDescriptorReference)(unsafe.Pointer(in.Reference)) + out.Inline = (*v2.ComponentDescriptor)(unsafe.Pointer(in.Inline)) + return nil +} + +// Convert_core_ComponentDescriptorDefinition_To_v1alpha1_ComponentDescriptorDefinition is an autogenerated conversion function. +func Convert_core_ComponentDescriptorDefinition_To_v1alpha1_ComponentDescriptorDefinition(in *core.ComponentDescriptorDefinition, out *ComponentDescriptorDefinition, s conversion.Scope) error { + return autoConvert_core_ComponentDescriptorDefinition_To_v1alpha1_ComponentDescriptorDefinition(in, out, s) +} + +func autoConvert_v1alpha1_ComponentDescriptorImport_To_core_ComponentDescriptorImport(in *ComponentDescriptorImport, out *core.ComponentDescriptorImport, s conversion.Scope) error { + out.Name = in.Name + out.Ref = (*core.ComponentDescriptorReference)(unsafe.Pointer(in.Ref)) + out.SecretRef = (*core.SecretReference)(unsafe.Pointer(in.SecretRef)) + out.ConfigMapRef = (*core.ConfigMapReference)(unsafe.Pointer(in.ConfigMapRef)) + out.List = *(*[]core.ComponentDescriptorImportData)(unsafe.Pointer(&in.List)) + out.DataRef = in.DataRef + return nil +} + +// Convert_v1alpha1_ComponentDescriptorImport_To_core_ComponentDescriptorImport is an autogenerated conversion function. +func Convert_v1alpha1_ComponentDescriptorImport_To_core_ComponentDescriptorImport(in *ComponentDescriptorImport, out *core.ComponentDescriptorImport, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentDescriptorImport_To_core_ComponentDescriptorImport(in, out, s) +} + +func autoConvert_core_ComponentDescriptorImport_To_v1alpha1_ComponentDescriptorImport(in *core.ComponentDescriptorImport, out *ComponentDescriptorImport, s conversion.Scope) error { + out.Name = in.Name + out.Ref = (*ComponentDescriptorReference)(unsafe.Pointer(in.Ref)) + out.SecretRef = (*SecretReference)(unsafe.Pointer(in.SecretRef)) + out.ConfigMapRef = (*ConfigMapReference)(unsafe.Pointer(in.ConfigMapRef)) + out.List = *(*[]ComponentDescriptorImportData)(unsafe.Pointer(&in.List)) + out.DataRef = in.DataRef + return nil +} + +// Convert_core_ComponentDescriptorImport_To_v1alpha1_ComponentDescriptorImport is an autogenerated conversion function. +func Convert_core_ComponentDescriptorImport_To_v1alpha1_ComponentDescriptorImport(in *core.ComponentDescriptorImport, out *ComponentDescriptorImport, s conversion.Scope) error { + return autoConvert_core_ComponentDescriptorImport_To_v1alpha1_ComponentDescriptorImport(in, out, s) +} + +func autoConvert_v1alpha1_ComponentDescriptorImportData_To_core_ComponentDescriptorImportData(in *ComponentDescriptorImportData, out *core.ComponentDescriptorImportData, s conversion.Scope) error { + out.Ref = (*core.ComponentDescriptorReference)(unsafe.Pointer(in.Ref)) + out.SecretRef = (*core.SecretReference)(unsafe.Pointer(in.SecretRef)) + out.ConfigMapRef = (*core.ConfigMapReference)(unsafe.Pointer(in.ConfigMapRef)) + out.DataRef = in.DataRef + return nil +} + +// Convert_v1alpha1_ComponentDescriptorImportData_To_core_ComponentDescriptorImportData is an autogenerated conversion function. +func Convert_v1alpha1_ComponentDescriptorImportData_To_core_ComponentDescriptorImportData(in *ComponentDescriptorImportData, out *core.ComponentDescriptorImportData, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentDescriptorImportData_To_core_ComponentDescriptorImportData(in, out, s) +} + +func autoConvert_core_ComponentDescriptorImportData_To_v1alpha1_ComponentDescriptorImportData(in *core.ComponentDescriptorImportData, out *ComponentDescriptorImportData, s conversion.Scope) error { + out.Ref = (*ComponentDescriptorReference)(unsafe.Pointer(in.Ref)) + out.SecretRef = (*SecretReference)(unsafe.Pointer(in.SecretRef)) + out.ConfigMapRef = (*ConfigMapReference)(unsafe.Pointer(in.ConfigMapRef)) + out.DataRef = in.DataRef + return nil +} + +// Convert_core_ComponentDescriptorImportData_To_v1alpha1_ComponentDescriptorImportData is an autogenerated conversion function. +func Convert_core_ComponentDescriptorImportData_To_v1alpha1_ComponentDescriptorImportData(in *core.ComponentDescriptorImportData, out *ComponentDescriptorImportData, s conversion.Scope) error { + return autoConvert_core_ComponentDescriptorImportData_To_v1alpha1_ComponentDescriptorImportData(in, out, s) +} + +func autoConvert_v1alpha1_ComponentDescriptorReference_To_core_ComponentDescriptorReference(in *ComponentDescriptorReference, out *core.ComponentDescriptorReference, s conversion.Scope) error { + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + out.ComponentName = in.ComponentName + out.Version = in.Version + return nil +} + +// Convert_v1alpha1_ComponentDescriptorReference_To_core_ComponentDescriptorReference is an autogenerated conversion function. +func Convert_v1alpha1_ComponentDescriptorReference_To_core_ComponentDescriptorReference(in *ComponentDescriptorReference, out *core.ComponentDescriptorReference, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentDescriptorReference_To_core_ComponentDescriptorReference(in, out, s) +} + +func autoConvert_core_ComponentDescriptorReference_To_v1alpha1_ComponentDescriptorReference(in *core.ComponentDescriptorReference, out *ComponentDescriptorReference, s conversion.Scope) error { + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + out.ComponentName = in.ComponentName + out.Version = in.Version + return nil +} + +// Convert_core_ComponentDescriptorReference_To_v1alpha1_ComponentDescriptorReference is an autogenerated conversion function. +func Convert_core_ComponentDescriptorReference_To_v1alpha1_ComponentDescriptorReference(in *core.ComponentDescriptorReference, out *ComponentDescriptorReference, s conversion.Scope) error { + return autoConvert_core_ComponentDescriptorReference_To_v1alpha1_ComponentDescriptorReference(in, out, s) +} + +func autoConvert_v1alpha1_ComponentOverwrite_To_core_ComponentOverwrite(in *ComponentOverwrite, out *core.ComponentOverwrite, s conversion.Scope) error { + if err := Convert_v1alpha1_ComponentOverwriteReference_To_core_ComponentOverwriteReference(&in.Component, &out.Component, s); err != nil { + return err + } + if err := Convert_v1alpha1_ComponentOverwriteReference_To_core_ComponentOverwriteReference(&in.Target, &out.Target, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ComponentOverwrite_To_core_ComponentOverwrite is an autogenerated conversion function. +func Convert_v1alpha1_ComponentOverwrite_To_core_ComponentOverwrite(in *ComponentOverwrite, out *core.ComponentOverwrite, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentOverwrite_To_core_ComponentOverwrite(in, out, s) +} + +func autoConvert_core_ComponentOverwrite_To_v1alpha1_ComponentOverwrite(in *core.ComponentOverwrite, out *ComponentOverwrite, s conversion.Scope) error { + if err := Convert_core_ComponentOverwriteReference_To_v1alpha1_ComponentOverwriteReference(&in.Component, &out.Component, s); err != nil { + return err + } + if err := Convert_core_ComponentOverwriteReference_To_v1alpha1_ComponentOverwriteReference(&in.Target, &out.Target, s); err != nil { + return err + } + return nil +} + +// Convert_core_ComponentOverwrite_To_v1alpha1_ComponentOverwrite is an autogenerated conversion function. +func Convert_core_ComponentOverwrite_To_v1alpha1_ComponentOverwrite(in *core.ComponentOverwrite, out *ComponentOverwrite, s conversion.Scope) error { + return autoConvert_core_ComponentOverwrite_To_v1alpha1_ComponentOverwrite(in, out, s) +} + +func autoConvert_v1alpha1_ComponentOverwriteReference_To_core_ComponentOverwriteReference(in *ComponentOverwriteReference, out *core.ComponentOverwriteReference, s conversion.Scope) error { + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + out.ComponentName = in.ComponentName + out.Version = in.Version + return nil +} + +// Convert_v1alpha1_ComponentOverwriteReference_To_core_ComponentOverwriteReference is an autogenerated conversion function. +func Convert_v1alpha1_ComponentOverwriteReference_To_core_ComponentOverwriteReference(in *ComponentOverwriteReference, out *core.ComponentOverwriteReference, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentOverwriteReference_To_core_ComponentOverwriteReference(in, out, s) +} + +func autoConvert_core_ComponentOverwriteReference_To_v1alpha1_ComponentOverwriteReference(in *core.ComponentOverwriteReference, out *ComponentOverwriteReference, s conversion.Scope) error { + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + out.ComponentName = in.ComponentName + out.Version = in.Version + return nil +} + +// Convert_core_ComponentOverwriteReference_To_v1alpha1_ComponentOverwriteReference is an autogenerated conversion function. +func Convert_core_ComponentOverwriteReference_To_v1alpha1_ComponentOverwriteReference(in *core.ComponentOverwriteReference, out *ComponentOverwriteReference, s conversion.Scope) error { + return autoConvert_core_ComponentOverwriteReference_To_v1alpha1_ComponentOverwriteReference(in, out, s) +} + +func autoConvert_v1alpha1_ComponentOverwrites_To_core_ComponentOverwrites(in *ComponentOverwrites, out *core.ComponentOverwrites, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Overwrites = *(*core.ComponentOverwriteList)(unsafe.Pointer(&in.Overwrites)) + return nil +} + +// Convert_v1alpha1_ComponentOverwrites_To_core_ComponentOverwrites is an autogenerated conversion function. +func Convert_v1alpha1_ComponentOverwrites_To_core_ComponentOverwrites(in *ComponentOverwrites, out *core.ComponentOverwrites, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentOverwrites_To_core_ComponentOverwrites(in, out, s) +} + +func autoConvert_core_ComponentOverwrites_To_v1alpha1_ComponentOverwrites(in *core.ComponentOverwrites, out *ComponentOverwrites, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Overwrites = *(*ComponentOverwriteList)(unsafe.Pointer(&in.Overwrites)) + return nil +} + +// Convert_core_ComponentOverwrites_To_v1alpha1_ComponentOverwrites is an autogenerated conversion function. +func Convert_core_ComponentOverwrites_To_v1alpha1_ComponentOverwrites(in *core.ComponentOverwrites, out *ComponentOverwrites, s conversion.Scope) error { + return autoConvert_core_ComponentOverwrites_To_v1alpha1_ComponentOverwrites(in, out, s) +} + +func autoConvert_v1alpha1_ComponentOverwritesList_To_core_ComponentOverwritesList(in *ComponentOverwritesList, out *core.ComponentOverwritesList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.ComponentOverwrites)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_ComponentOverwritesList_To_core_ComponentOverwritesList is an autogenerated conversion function. +func Convert_v1alpha1_ComponentOverwritesList_To_core_ComponentOverwritesList(in *ComponentOverwritesList, out *core.ComponentOverwritesList, s conversion.Scope) error { + return autoConvert_v1alpha1_ComponentOverwritesList_To_core_ComponentOverwritesList(in, out, s) +} + +func autoConvert_core_ComponentOverwritesList_To_v1alpha1_ComponentOverwritesList(in *core.ComponentOverwritesList, out *ComponentOverwritesList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ComponentOverwrites)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_ComponentOverwritesList_To_v1alpha1_ComponentOverwritesList is an autogenerated conversion function. +func Convert_core_ComponentOverwritesList_To_v1alpha1_ComponentOverwritesList(in *core.ComponentOverwritesList, out *ComponentOverwritesList, s conversion.Scope) error { + return autoConvert_core_ComponentOverwritesList_To_v1alpha1_ComponentOverwritesList(in, out, s) +} + +func autoConvert_v1alpha1_Condition_To_core_Condition(in *Condition, out *core.Condition, s conversion.Scope) error { + out.Type = core.ConditionType(in.Type) + out.Status = core.ConditionStatus(in.Status) + out.LastTransitionTime = in.LastTransitionTime + out.LastUpdateTime = in.LastUpdateTime + out.Reason = in.Reason + out.Message = in.Message + out.Codes = *(*[]core.ErrorCode)(unsafe.Pointer(&in.Codes)) + return nil +} + +// Convert_v1alpha1_Condition_To_core_Condition is an autogenerated conversion function. +func Convert_v1alpha1_Condition_To_core_Condition(in *Condition, out *core.Condition, s conversion.Scope) error { + return autoConvert_v1alpha1_Condition_To_core_Condition(in, out, s) +} + +func autoConvert_core_Condition_To_v1alpha1_Condition(in *core.Condition, out *Condition, s conversion.Scope) error { + out.Type = ConditionType(in.Type) + out.Status = ConditionStatus(in.Status) + out.LastTransitionTime = in.LastTransitionTime + out.LastUpdateTime = in.LastUpdateTime + out.Reason = in.Reason + out.Message = in.Message + out.Codes = *(*[]ErrorCode)(unsafe.Pointer(&in.Codes)) + return nil +} + +// Convert_core_Condition_To_v1alpha1_Condition is an autogenerated conversion function. +func Convert_core_Condition_To_v1alpha1_Condition(in *core.Condition, out *Condition, s conversion.Scope) error { + return autoConvert_core_Condition_To_v1alpha1_Condition(in, out, s) +} + +func autoConvert_v1alpha1_ConfigMapReference_To_core_ConfigMapReference(in *ConfigMapReference, out *core.ConfigMapReference, s conversion.Scope) error { + if err := Convert_v1alpha1_ObjectReference_To_core_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +// Convert_v1alpha1_ConfigMapReference_To_core_ConfigMapReference is an autogenerated conversion function. +func Convert_v1alpha1_ConfigMapReference_To_core_ConfigMapReference(in *ConfigMapReference, out *core.ConfigMapReference, s conversion.Scope) error { + return autoConvert_v1alpha1_ConfigMapReference_To_core_ConfigMapReference(in, out, s) +} + +func autoConvert_core_ConfigMapReference_To_v1alpha1_ConfigMapReference(in *core.ConfigMapReference, out *ConfigMapReference, s conversion.Scope) error { + if err := Convert_core_ObjectReference_To_v1alpha1_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +// Convert_core_ConfigMapReference_To_v1alpha1_ConfigMapReference is an autogenerated conversion function. +func Convert_core_ConfigMapReference_To_v1alpha1_ConfigMapReference(in *core.ConfigMapReference, out *ConfigMapReference, s conversion.Scope) error { + return autoConvert_core_ConfigMapReference_To_v1alpha1_ConfigMapReference(in, out, s) +} + +func autoConvert_v1alpha1_Context_To_core_Context(in *Context, out *core.Context, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + out.RegistryPullSecrets = *(*[]v1.LocalObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + out.Configurations = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.Configurations)) + return nil +} + +// Convert_v1alpha1_Context_To_core_Context is an autogenerated conversion function. +func Convert_v1alpha1_Context_To_core_Context(in *Context, out *core.Context, s conversion.Scope) error { + return autoConvert_v1alpha1_Context_To_core_Context(in, out, s) +} + +func autoConvert_core_Context_To_v1alpha1_Context(in *core.Context, out *Context, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.RepositoryContext = (*v2.UnstructuredTypedObject)(unsafe.Pointer(in.RepositoryContext)) + out.RegistryPullSecrets = *(*[]v1.LocalObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + out.Configurations = *(*map[string]AnyJSON)(unsafe.Pointer(&in.Configurations)) + return nil +} + +// Convert_core_Context_To_v1alpha1_Context is an autogenerated conversion function. +func Convert_core_Context_To_v1alpha1_Context(in *core.Context, out *Context, s conversion.Scope) error { + return autoConvert_core_Context_To_v1alpha1_Context(in, out, s) +} + +func autoConvert_v1alpha1_ContextList_To_core_ContextList(in *ContextList, out *core.ContextList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.Context)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_ContextList_To_core_ContextList is an autogenerated conversion function. +func Convert_v1alpha1_ContextList_To_core_ContextList(in *ContextList, out *core.ContextList, s conversion.Scope) error { + return autoConvert_v1alpha1_ContextList_To_core_ContextList(in, out, s) +} + +func autoConvert_core_ContextList_To_v1alpha1_ContextList(in *core.ContextList, out *ContextList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Context)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_ContextList_To_v1alpha1_ContextList is an autogenerated conversion function. +func Convert_core_ContextList_To_v1alpha1_ContextList(in *core.ContextList, out *ContextList, s conversion.Scope) error { + return autoConvert_core_ContextList_To_v1alpha1_ContextList(in, out, s) +} + +func autoConvert_v1alpha1_DataExport_To_core_DataExport(in *DataExport, out *core.DataExport, s conversion.Scope) error { + out.Name = in.Name + out.DataRef = in.DataRef + return nil +} + +// Convert_v1alpha1_DataExport_To_core_DataExport is an autogenerated conversion function. +func Convert_v1alpha1_DataExport_To_core_DataExport(in *DataExport, out *core.DataExport, s conversion.Scope) error { + return autoConvert_v1alpha1_DataExport_To_core_DataExport(in, out, s) +} + +func autoConvert_core_DataExport_To_v1alpha1_DataExport(in *core.DataExport, out *DataExport, s conversion.Scope) error { + out.Name = in.Name + out.DataRef = in.DataRef + return nil +} + +// Convert_core_DataExport_To_v1alpha1_DataExport is an autogenerated conversion function. +func Convert_core_DataExport_To_v1alpha1_DataExport(in *core.DataExport, out *DataExport, s conversion.Scope) error { + return autoConvert_core_DataExport_To_v1alpha1_DataExport(in, out, s) +} + +func autoConvert_v1alpha1_DataImport_To_core_DataImport(in *DataImport, out *core.DataImport, s conversion.Scope) error { + out.Name = in.Name + out.DataRef = in.DataRef + out.Version = in.Version + out.SecretRef = (*core.SecretReference)(unsafe.Pointer(in.SecretRef)) + out.ConfigMapRef = (*core.ConfigMapReference)(unsafe.Pointer(in.ConfigMapRef)) + return nil +} + +// Convert_v1alpha1_DataImport_To_core_DataImport is an autogenerated conversion function. +func Convert_v1alpha1_DataImport_To_core_DataImport(in *DataImport, out *core.DataImport, s conversion.Scope) error { + return autoConvert_v1alpha1_DataImport_To_core_DataImport(in, out, s) +} + +func autoConvert_core_DataImport_To_v1alpha1_DataImport(in *core.DataImport, out *DataImport, s conversion.Scope) error { + out.Name = in.Name + out.DataRef = in.DataRef + out.Version = in.Version + out.SecretRef = (*SecretReference)(unsafe.Pointer(in.SecretRef)) + out.ConfigMapRef = (*ConfigMapReference)(unsafe.Pointer(in.ConfigMapRef)) + return nil +} + +// Convert_core_DataImport_To_v1alpha1_DataImport is an autogenerated conversion function. +func Convert_core_DataImport_To_v1alpha1_DataImport(in *core.DataImport, out *DataImport, s conversion.Scope) error { + return autoConvert_core_DataImport_To_v1alpha1_DataImport(in, out, s) +} + +func autoConvert_v1alpha1_DataObject_To_core_DataObject(in *DataObject, out *core.DataObject, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_AnyJSON_To_core_AnyJSON(&in.Data, &out.Data, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_DataObject_To_core_DataObject is an autogenerated conversion function. +func Convert_v1alpha1_DataObject_To_core_DataObject(in *DataObject, out *core.DataObject, s conversion.Scope) error { + return autoConvert_v1alpha1_DataObject_To_core_DataObject(in, out, s) +} + +func autoConvert_core_DataObject_To_v1alpha1_DataObject(in *core.DataObject, out *DataObject, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_AnyJSON_To_v1alpha1_AnyJSON(&in.Data, &out.Data, s); err != nil { + return err + } + return nil +} + +// Convert_core_DataObject_To_v1alpha1_DataObject is an autogenerated conversion function. +func Convert_core_DataObject_To_v1alpha1_DataObject(in *core.DataObject, out *DataObject, s conversion.Scope) error { + return autoConvert_core_DataObject_To_v1alpha1_DataObject(in, out, s) +} + +func autoConvert_v1alpha1_DataObjectList_To_core_DataObjectList(in *DataObjectList, out *core.DataObjectList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.DataObject)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_DataObjectList_To_core_DataObjectList is an autogenerated conversion function. +func Convert_v1alpha1_DataObjectList_To_core_DataObjectList(in *DataObjectList, out *core.DataObjectList, s conversion.Scope) error { + return autoConvert_v1alpha1_DataObjectList_To_core_DataObjectList(in, out, s) +} + +func autoConvert_core_DataObjectList_To_v1alpha1_DataObjectList(in *core.DataObjectList, out *DataObjectList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]DataObject)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_DataObjectList_To_v1alpha1_DataObjectList is an autogenerated conversion function. +func Convert_core_DataObjectList_To_v1alpha1_DataObjectList(in *core.DataObjectList, out *DataObjectList, s conversion.Scope) error { + return autoConvert_core_DataObjectList_To_v1alpha1_DataObjectList(in, out, s) +} + +func autoConvert_v1alpha1_Default_To_core_Default(in *Default, out *core.Default, s conversion.Scope) error { + if err := Convert_v1alpha1_AnyJSON_To_core_AnyJSON(&in.Value, &out.Value, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Default_To_core_Default is an autogenerated conversion function. +func Convert_v1alpha1_Default_To_core_Default(in *Default, out *core.Default, s conversion.Scope) error { + return autoConvert_v1alpha1_Default_To_core_Default(in, out, s) +} + +func autoConvert_core_Default_To_v1alpha1_Default(in *core.Default, out *Default, s conversion.Scope) error { + if err := Convert_core_AnyJSON_To_v1alpha1_AnyJSON(&in.Value, &out.Value, s); err != nil { + return err + } + return nil +} + +// Convert_core_Default_To_v1alpha1_Default is an autogenerated conversion function. +func Convert_core_Default_To_v1alpha1_Default(in *core.Default, out *Default, s conversion.Scope) error { + return autoConvert_core_Default_To_v1alpha1_Default(in, out, s) +} + +func autoConvert_v1alpha1_DeployItem_To_core_DeployItem(in *DeployItem, out *core.DeployItem, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_DeployItemSpec_To_core_DeployItemSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_DeployItemStatus_To_core_DeployItemStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_DeployItem_To_core_DeployItem is an autogenerated conversion function. +func Convert_v1alpha1_DeployItem_To_core_DeployItem(in *DeployItem, out *core.DeployItem, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployItem_To_core_DeployItem(in, out, s) +} + +func autoConvert_core_DeployItem_To_v1alpha1_DeployItem(in *core.DeployItem, out *DeployItem, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_DeployItemSpec_To_v1alpha1_DeployItemSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_core_DeployItemStatus_To_v1alpha1_DeployItemStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_core_DeployItem_To_v1alpha1_DeployItem is an autogenerated conversion function. +func Convert_core_DeployItem_To_v1alpha1_DeployItem(in *core.DeployItem, out *DeployItem, s conversion.Scope) error { + return autoConvert_core_DeployItem_To_v1alpha1_DeployItem(in, out, s) +} + +func autoConvert_v1alpha1_DeployItemList_To_core_DeployItemList(in *DeployItemList, out *core.DeployItemList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.DeployItem)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_DeployItemList_To_core_DeployItemList is an autogenerated conversion function. +func Convert_v1alpha1_DeployItemList_To_core_DeployItemList(in *DeployItemList, out *core.DeployItemList, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployItemList_To_core_DeployItemList(in, out, s) +} + +func autoConvert_core_DeployItemList_To_v1alpha1_DeployItemList(in *core.DeployItemList, out *DeployItemList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]DeployItem)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_DeployItemList_To_v1alpha1_DeployItemList is an autogenerated conversion function. +func Convert_core_DeployItemList_To_v1alpha1_DeployItemList(in *core.DeployItemList, out *DeployItemList, s conversion.Scope) error { + return autoConvert_core_DeployItemList_To_v1alpha1_DeployItemList(in, out, s) +} + +func autoConvert_v1alpha1_DeployItemSpec_To_core_DeployItemSpec(in *DeployItemSpec, out *core.DeployItemSpec, s conversion.Scope) error { + out.Type = core.DeployItemType(in.Type) + out.Target = (*core.ObjectReference)(unsafe.Pointer(in.Target)) + out.Context = in.Context + out.Configuration = (*runtime.RawExtension)(unsafe.Pointer(in.Configuration)) + out.RegistryPullSecrets = *(*[]core.ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + out.Timeout = (*core.Duration)(unsafe.Pointer(in.Timeout)) + return nil +} + +// Convert_v1alpha1_DeployItemSpec_To_core_DeployItemSpec is an autogenerated conversion function. +func Convert_v1alpha1_DeployItemSpec_To_core_DeployItemSpec(in *DeployItemSpec, out *core.DeployItemSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployItemSpec_To_core_DeployItemSpec(in, out, s) +} + +func autoConvert_core_DeployItemSpec_To_v1alpha1_DeployItemSpec(in *core.DeployItemSpec, out *DeployItemSpec, s conversion.Scope) error { + out.Type = DeployItemType(in.Type) + out.Target = (*ObjectReference)(unsafe.Pointer(in.Target)) + out.Context = in.Context + out.Configuration = (*runtime.RawExtension)(unsafe.Pointer(in.Configuration)) + out.RegistryPullSecrets = *(*[]ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + out.Timeout = (*Duration)(unsafe.Pointer(in.Timeout)) + return nil +} + +// Convert_core_DeployItemSpec_To_v1alpha1_DeployItemSpec is an autogenerated conversion function. +func Convert_core_DeployItemSpec_To_v1alpha1_DeployItemSpec(in *core.DeployItemSpec, out *DeployItemSpec, s conversion.Scope) error { + return autoConvert_core_DeployItemSpec_To_v1alpha1_DeployItemSpec(in, out, s) +} + +func autoConvert_v1alpha1_DeployItemStatus_To_core_DeployItemStatus(in *DeployItemStatus, out *core.DeployItemStatus, s conversion.Scope) error { + out.Phase = core.ExecutionPhase(in.Phase) + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*[]core.Condition)(unsafe.Pointer(&in.Conditions)) + out.LastError = (*core.Error)(unsafe.Pointer(in.LastError)) + out.LastReconcileTime = (*metav1.Time)(unsafe.Pointer(in.LastReconcileTime)) + if err := Convert_v1alpha1_DeployerInformation_To_core_DeployerInformation(&in.Deployer, &out.Deployer, s); err != nil { + return err + } + out.ProviderStatus = (*runtime.RawExtension)(unsafe.Pointer(in.ProviderStatus)) + out.ExportReference = (*core.ObjectReference)(unsafe.Pointer(in.ExportReference)) + return nil +} + +// Convert_v1alpha1_DeployItemStatus_To_core_DeployItemStatus is an autogenerated conversion function. +func Convert_v1alpha1_DeployItemStatus_To_core_DeployItemStatus(in *DeployItemStatus, out *core.DeployItemStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployItemStatus_To_core_DeployItemStatus(in, out, s) +} + +func autoConvert_core_DeployItemStatus_To_v1alpha1_DeployItemStatus(in *core.DeployItemStatus, out *DeployItemStatus, s conversion.Scope) error { + out.Phase = ExecutionPhase(in.Phase) + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*[]Condition)(unsafe.Pointer(&in.Conditions)) + out.LastError = (*Error)(unsafe.Pointer(in.LastError)) + out.LastReconcileTime = (*metav1.Time)(unsafe.Pointer(in.LastReconcileTime)) + if err := Convert_core_DeployerInformation_To_v1alpha1_DeployerInformation(&in.Deployer, &out.Deployer, s); err != nil { + return err + } + out.ProviderStatus = (*runtime.RawExtension)(unsafe.Pointer(in.ProviderStatus)) + out.ExportReference = (*ObjectReference)(unsafe.Pointer(in.ExportReference)) + return nil +} + +// Convert_core_DeployItemStatus_To_v1alpha1_DeployItemStatus is an autogenerated conversion function. +func Convert_core_DeployItemStatus_To_v1alpha1_DeployItemStatus(in *core.DeployItemStatus, out *DeployItemStatus, s conversion.Scope) error { + return autoConvert_core_DeployItemStatus_To_v1alpha1_DeployItemStatus(in, out, s) +} + +func autoConvert_v1alpha1_DeployItemTemplate_To_core_DeployItemTemplate(in *DeployItemTemplate, out *core.DeployItemTemplate, s conversion.Scope) error { + out.Name = in.Name + out.Type = core.DeployItemType(in.Type) + out.Target = (*core.ObjectReference)(unsafe.Pointer(in.Target)) + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Configuration = (*runtime.RawExtension)(unsafe.Pointer(in.Configuration)) + out.DependsOn = *(*[]string)(unsafe.Pointer(&in.DependsOn)) + return nil +} + +// Convert_v1alpha1_DeployItemTemplate_To_core_DeployItemTemplate is an autogenerated conversion function. +func Convert_v1alpha1_DeployItemTemplate_To_core_DeployItemTemplate(in *DeployItemTemplate, out *core.DeployItemTemplate, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployItemTemplate_To_core_DeployItemTemplate(in, out, s) +} + +func autoConvert_core_DeployItemTemplate_To_v1alpha1_DeployItemTemplate(in *core.DeployItemTemplate, out *DeployItemTemplate, s conversion.Scope) error { + out.Name = in.Name + out.Type = DeployItemType(in.Type) + out.Target = (*ObjectReference)(unsafe.Pointer(in.Target)) + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Configuration = (*runtime.RawExtension)(unsafe.Pointer(in.Configuration)) + out.DependsOn = *(*[]string)(unsafe.Pointer(&in.DependsOn)) + return nil +} + +// Convert_core_DeployItemTemplate_To_v1alpha1_DeployItemTemplate is an autogenerated conversion function. +func Convert_core_DeployItemTemplate_To_v1alpha1_DeployItemTemplate(in *core.DeployItemTemplate, out *DeployItemTemplate, s conversion.Scope) error { + return autoConvert_core_DeployItemTemplate_To_v1alpha1_DeployItemTemplate(in, out, s) +} + +func autoConvert_v1alpha1_DeployerInformation_To_core_DeployerInformation(in *DeployerInformation, out *core.DeployerInformation, s conversion.Scope) error { + out.Identity = in.Identity + out.Name = in.Name + out.Version = in.Version + return nil +} + +// Convert_v1alpha1_DeployerInformation_To_core_DeployerInformation is an autogenerated conversion function. +func Convert_v1alpha1_DeployerInformation_To_core_DeployerInformation(in *DeployerInformation, out *core.DeployerInformation, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployerInformation_To_core_DeployerInformation(in, out, s) +} + +func autoConvert_core_DeployerInformation_To_v1alpha1_DeployerInformation(in *core.DeployerInformation, out *DeployerInformation, s conversion.Scope) error { + out.Identity = in.Identity + out.Name = in.Name + out.Version = in.Version + return nil +} + +// Convert_core_DeployerInformation_To_v1alpha1_DeployerInformation is an autogenerated conversion function. +func Convert_core_DeployerInformation_To_v1alpha1_DeployerInformation(in *core.DeployerInformation, out *DeployerInformation, s conversion.Scope) error { + return autoConvert_core_DeployerInformation_To_v1alpha1_DeployerInformation(in, out, s) +} + +func autoConvert_v1alpha1_DeployerInstallationTemplate_To_core_DeployerInstallationTemplate(in *DeployerInstallationTemplate, out *core.DeployerInstallationTemplate, s conversion.Scope) error { + out.ComponentDescriptor = (*core.ComponentDescriptorDefinition)(unsafe.Pointer(in.ComponentDescriptor)) + if err := Convert_v1alpha1_BlueprintDefinition_To_core_BlueprintDefinition(&in.Blueprint, &out.Blueprint, s); err != nil { + return err + } + if err := Convert_v1alpha1_InstallationImports_To_core_InstallationImports(&in.Imports, &out.Imports, s); err != nil { + return err + } + out.ImportDataMappings = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.ImportDataMappings)) + return nil +} + +// Convert_v1alpha1_DeployerInstallationTemplate_To_core_DeployerInstallationTemplate is an autogenerated conversion function. +func Convert_v1alpha1_DeployerInstallationTemplate_To_core_DeployerInstallationTemplate(in *DeployerInstallationTemplate, out *core.DeployerInstallationTemplate, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployerInstallationTemplate_To_core_DeployerInstallationTemplate(in, out, s) +} + +func autoConvert_core_DeployerInstallationTemplate_To_v1alpha1_DeployerInstallationTemplate(in *core.DeployerInstallationTemplate, out *DeployerInstallationTemplate, s conversion.Scope) error { + out.ComponentDescriptor = (*ComponentDescriptorDefinition)(unsafe.Pointer(in.ComponentDescriptor)) + if err := Convert_core_BlueprintDefinition_To_v1alpha1_BlueprintDefinition(&in.Blueprint, &out.Blueprint, s); err != nil { + return err + } + if err := Convert_core_InstallationImports_To_v1alpha1_InstallationImports(&in.Imports, &out.Imports, s); err != nil { + return err + } + out.ImportDataMappings = *(*map[string]AnyJSON)(unsafe.Pointer(&in.ImportDataMappings)) + return nil +} + +// Convert_core_DeployerInstallationTemplate_To_v1alpha1_DeployerInstallationTemplate is an autogenerated conversion function. +func Convert_core_DeployerInstallationTemplate_To_v1alpha1_DeployerInstallationTemplate(in *core.DeployerInstallationTemplate, out *DeployerInstallationTemplate, s conversion.Scope) error { + return autoConvert_core_DeployerInstallationTemplate_To_v1alpha1_DeployerInstallationTemplate(in, out, s) +} + +func autoConvert_v1alpha1_DeployerRegistration_To_core_DeployerRegistration(in *DeployerRegistration, out *core.DeployerRegistration, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_DeployerRegistrationSpec_To_core_DeployerRegistrationSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_DeployerRegistration_To_core_DeployerRegistration is an autogenerated conversion function. +func Convert_v1alpha1_DeployerRegistration_To_core_DeployerRegistration(in *DeployerRegistration, out *core.DeployerRegistration, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployerRegistration_To_core_DeployerRegistration(in, out, s) +} + +func autoConvert_core_DeployerRegistration_To_v1alpha1_DeployerRegistration(in *core.DeployerRegistration, out *DeployerRegistration, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_DeployerRegistrationSpec_To_v1alpha1_DeployerRegistrationSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_core_DeployerRegistration_To_v1alpha1_DeployerRegistration is an autogenerated conversion function. +func Convert_core_DeployerRegistration_To_v1alpha1_DeployerRegistration(in *core.DeployerRegistration, out *DeployerRegistration, s conversion.Scope) error { + return autoConvert_core_DeployerRegistration_To_v1alpha1_DeployerRegistration(in, out, s) +} + +func autoConvert_v1alpha1_DeployerRegistrationList_To_core_DeployerRegistrationList(in *DeployerRegistrationList, out *core.DeployerRegistrationList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.DeployerRegistration)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_DeployerRegistrationList_To_core_DeployerRegistrationList is an autogenerated conversion function. +func Convert_v1alpha1_DeployerRegistrationList_To_core_DeployerRegistrationList(in *DeployerRegistrationList, out *core.DeployerRegistrationList, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployerRegistrationList_To_core_DeployerRegistrationList(in, out, s) +} + +func autoConvert_core_DeployerRegistrationList_To_v1alpha1_DeployerRegistrationList(in *core.DeployerRegistrationList, out *DeployerRegistrationList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]DeployerRegistration)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_DeployerRegistrationList_To_v1alpha1_DeployerRegistrationList is an autogenerated conversion function. +func Convert_core_DeployerRegistrationList_To_v1alpha1_DeployerRegistrationList(in *core.DeployerRegistrationList, out *DeployerRegistrationList, s conversion.Scope) error { + return autoConvert_core_DeployerRegistrationList_To_v1alpha1_DeployerRegistrationList(in, out, s) +} + +func autoConvert_v1alpha1_DeployerRegistrationSpec_To_core_DeployerRegistrationSpec(in *DeployerRegistrationSpec, out *core.DeployerRegistrationSpec, s conversion.Scope) error { + out.DeployItemTypes = *(*[]core.DeployItemType)(unsafe.Pointer(&in.DeployItemTypes)) + if err := Convert_v1alpha1_DeployerInstallationTemplate_To_core_DeployerInstallationTemplate(&in.InstallationTemplate, &out.InstallationTemplate, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_DeployerRegistrationSpec_To_core_DeployerRegistrationSpec is an autogenerated conversion function. +func Convert_v1alpha1_DeployerRegistrationSpec_To_core_DeployerRegistrationSpec(in *DeployerRegistrationSpec, out *core.DeployerRegistrationSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_DeployerRegistrationSpec_To_core_DeployerRegistrationSpec(in, out, s) +} + +func autoConvert_core_DeployerRegistrationSpec_To_v1alpha1_DeployerRegistrationSpec(in *core.DeployerRegistrationSpec, out *DeployerRegistrationSpec, s conversion.Scope) error { + out.DeployItemTypes = *(*[]DeployItemType)(unsafe.Pointer(&in.DeployItemTypes)) + if err := Convert_core_DeployerInstallationTemplate_To_v1alpha1_DeployerInstallationTemplate(&in.InstallationTemplate, &out.InstallationTemplate, s); err != nil { + return err + } + return nil +} + +// Convert_core_DeployerRegistrationSpec_To_v1alpha1_DeployerRegistrationSpec is an autogenerated conversion function. +func Convert_core_DeployerRegistrationSpec_To_v1alpha1_DeployerRegistrationSpec(in *core.DeployerRegistrationSpec, out *DeployerRegistrationSpec, s conversion.Scope) error { + return autoConvert_core_DeployerRegistrationSpec_To_v1alpha1_DeployerRegistrationSpec(in, out, s) +} + +func autoConvert_v1alpha1_Duration_To_core_Duration(in *Duration, out *core.Duration, s conversion.Scope) error { + out.Duration = time.Duration(in.Duration) + return nil +} + +// Convert_v1alpha1_Duration_To_core_Duration is an autogenerated conversion function. +func Convert_v1alpha1_Duration_To_core_Duration(in *Duration, out *core.Duration, s conversion.Scope) error { + return autoConvert_v1alpha1_Duration_To_core_Duration(in, out, s) +} + +func autoConvert_core_Duration_To_v1alpha1_Duration(in *core.Duration, out *Duration, s conversion.Scope) error { + out.Duration = time.Duration(in.Duration) + return nil +} + +// Convert_core_Duration_To_v1alpha1_Duration is an autogenerated conversion function. +func Convert_core_Duration_To_v1alpha1_Duration(in *core.Duration, out *Duration, s conversion.Scope) error { + return autoConvert_core_Duration_To_v1alpha1_Duration(in, out, s) +} + +func autoConvert_v1alpha1_Environment_To_core_Environment(in *Environment, out *core.Environment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_EnvironmentSpec_To_core_EnvironmentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Environment_To_core_Environment is an autogenerated conversion function. +func Convert_v1alpha1_Environment_To_core_Environment(in *Environment, out *core.Environment, s conversion.Scope) error { + return autoConvert_v1alpha1_Environment_To_core_Environment(in, out, s) +} + +func autoConvert_core_Environment_To_v1alpha1_Environment(in *core.Environment, out *Environment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_EnvironmentSpec_To_v1alpha1_EnvironmentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_core_Environment_To_v1alpha1_Environment is an autogenerated conversion function. +func Convert_core_Environment_To_v1alpha1_Environment(in *core.Environment, out *Environment, s conversion.Scope) error { + return autoConvert_core_Environment_To_v1alpha1_Environment(in, out, s) +} + +func autoConvert_v1alpha1_EnvironmentList_To_core_EnvironmentList(in *EnvironmentList, out *core.EnvironmentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.Environment)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_EnvironmentList_To_core_EnvironmentList is an autogenerated conversion function. +func Convert_v1alpha1_EnvironmentList_To_core_EnvironmentList(in *EnvironmentList, out *core.EnvironmentList, s conversion.Scope) error { + return autoConvert_v1alpha1_EnvironmentList_To_core_EnvironmentList(in, out, s) +} + +func autoConvert_core_EnvironmentList_To_v1alpha1_EnvironmentList(in *core.EnvironmentList, out *EnvironmentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Environment)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_EnvironmentList_To_v1alpha1_EnvironmentList is an autogenerated conversion function. +func Convert_core_EnvironmentList_To_v1alpha1_EnvironmentList(in *core.EnvironmentList, out *EnvironmentList, s conversion.Scope) error { + return autoConvert_core_EnvironmentList_To_v1alpha1_EnvironmentList(in, out, s) +} + +func autoConvert_v1alpha1_EnvironmentSpec_To_core_EnvironmentSpec(in *EnvironmentSpec, out *core.EnvironmentSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_TargetTemplate_To_core_TargetTemplate(&in.HostTarget, &out.HostTarget, s); err != nil { + return err + } + out.Namespace = in.Namespace + if err := Convert_v1alpha1_ClusterRestConfig_To_core_ClusterRestConfig(&in.LandscaperClusterRestConfig, &out.LandscaperClusterRestConfig, s); err != nil { + return err + } + out.TargetSelectors = *(*[]core.TargetSelector)(unsafe.Pointer(&in.TargetSelectors)) + return nil +} + +// Convert_v1alpha1_EnvironmentSpec_To_core_EnvironmentSpec is an autogenerated conversion function. +func Convert_v1alpha1_EnvironmentSpec_To_core_EnvironmentSpec(in *EnvironmentSpec, out *core.EnvironmentSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_EnvironmentSpec_To_core_EnvironmentSpec(in, out, s) +} + +func autoConvert_core_EnvironmentSpec_To_v1alpha1_EnvironmentSpec(in *core.EnvironmentSpec, out *EnvironmentSpec, s conversion.Scope) error { + if err := Convert_core_TargetTemplate_To_v1alpha1_TargetTemplate(&in.HostTarget, &out.HostTarget, s); err != nil { + return err + } + out.Namespace = in.Namespace + if err := Convert_core_ClusterRestConfig_To_v1alpha1_ClusterRestConfig(&in.LandscaperClusterRestConfig, &out.LandscaperClusterRestConfig, s); err != nil { + return err + } + out.TargetSelectors = *(*[]TargetSelector)(unsafe.Pointer(&in.TargetSelectors)) + return nil +} + +// Convert_core_EnvironmentSpec_To_v1alpha1_EnvironmentSpec is an autogenerated conversion function. +func Convert_core_EnvironmentSpec_To_v1alpha1_EnvironmentSpec(in *core.EnvironmentSpec, out *EnvironmentSpec, s conversion.Scope) error { + return autoConvert_core_EnvironmentSpec_To_v1alpha1_EnvironmentSpec(in, out, s) +} + +func autoConvert_v1alpha1_Error_To_core_Error(in *Error, out *core.Error, s conversion.Scope) error { + out.Operation = in.Operation + out.LastTransitionTime = in.LastTransitionTime + out.LastUpdateTime = in.LastUpdateTime + out.Reason = in.Reason + out.Message = in.Message + out.Codes = *(*[]core.ErrorCode)(unsafe.Pointer(&in.Codes)) + return nil +} + +// Convert_v1alpha1_Error_To_core_Error is an autogenerated conversion function. +func Convert_v1alpha1_Error_To_core_Error(in *Error, out *core.Error, s conversion.Scope) error { + return autoConvert_v1alpha1_Error_To_core_Error(in, out, s) +} + +func autoConvert_core_Error_To_v1alpha1_Error(in *core.Error, out *Error, s conversion.Scope) error { + out.Operation = in.Operation + out.LastTransitionTime = in.LastTransitionTime + out.LastUpdateTime = in.LastUpdateTime + out.Reason = in.Reason + out.Message = in.Message + out.Codes = *(*[]ErrorCode)(unsafe.Pointer(&in.Codes)) + return nil +} + +// Convert_core_Error_To_v1alpha1_Error is an autogenerated conversion function. +func Convert_core_Error_To_v1alpha1_Error(in *core.Error, out *Error, s conversion.Scope) error { + return autoConvert_core_Error_To_v1alpha1_Error(in, out, s) +} + +func autoConvert_v1alpha1_Execution_To_core_Execution(in *Execution, out *core.Execution, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ExecutionSpec_To_core_ExecutionSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ExecutionStatus_To_core_ExecutionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Execution_To_core_Execution is an autogenerated conversion function. +func Convert_v1alpha1_Execution_To_core_Execution(in *Execution, out *core.Execution, s conversion.Scope) error { + return autoConvert_v1alpha1_Execution_To_core_Execution(in, out, s) +} + +func autoConvert_core_Execution_To_v1alpha1_Execution(in *core.Execution, out *Execution, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_ExecutionSpec_To_v1alpha1_ExecutionSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_core_ExecutionStatus_To_v1alpha1_ExecutionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_core_Execution_To_v1alpha1_Execution is an autogenerated conversion function. +func Convert_core_Execution_To_v1alpha1_Execution(in *core.Execution, out *Execution, s conversion.Scope) error { + return autoConvert_core_Execution_To_v1alpha1_Execution(in, out, s) +} + +func autoConvert_v1alpha1_ExecutionGeneration_To_core_ExecutionGeneration(in *ExecutionGeneration, out *core.ExecutionGeneration, s conversion.Scope) error { + out.Name = in.Name + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +// Convert_v1alpha1_ExecutionGeneration_To_core_ExecutionGeneration is an autogenerated conversion function. +func Convert_v1alpha1_ExecutionGeneration_To_core_ExecutionGeneration(in *ExecutionGeneration, out *core.ExecutionGeneration, s conversion.Scope) error { + return autoConvert_v1alpha1_ExecutionGeneration_To_core_ExecutionGeneration(in, out, s) +} + +func autoConvert_core_ExecutionGeneration_To_v1alpha1_ExecutionGeneration(in *core.ExecutionGeneration, out *ExecutionGeneration, s conversion.Scope) error { + out.Name = in.Name + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +// Convert_core_ExecutionGeneration_To_v1alpha1_ExecutionGeneration is an autogenerated conversion function. +func Convert_core_ExecutionGeneration_To_v1alpha1_ExecutionGeneration(in *core.ExecutionGeneration, out *ExecutionGeneration, s conversion.Scope) error { + return autoConvert_core_ExecutionGeneration_To_v1alpha1_ExecutionGeneration(in, out, s) +} + +func autoConvert_v1alpha1_ExecutionList_To_core_ExecutionList(in *ExecutionList, out *core.ExecutionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]core.Execution, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Execution_To_core_Execution(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_ExecutionList_To_core_ExecutionList is an autogenerated conversion function. +func Convert_v1alpha1_ExecutionList_To_core_ExecutionList(in *ExecutionList, out *core.ExecutionList, s conversion.Scope) error { + return autoConvert_v1alpha1_ExecutionList_To_core_ExecutionList(in, out, s) +} + +func autoConvert_core_ExecutionList_To_v1alpha1_ExecutionList(in *core.ExecutionList, out *ExecutionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Execution, len(*in)) + for i := range *in { + if err := Convert_core_Execution_To_v1alpha1_Execution(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_core_ExecutionList_To_v1alpha1_ExecutionList is an autogenerated conversion function. +func Convert_core_ExecutionList_To_v1alpha1_ExecutionList(in *core.ExecutionList, out *ExecutionList, s conversion.Scope) error { + return autoConvert_core_ExecutionList_To_v1alpha1_ExecutionList(in, out, s) +} + +func autoConvert_v1alpha1_ExecutionSpec_To_core_ExecutionSpec(in *ExecutionSpec, out *core.ExecutionSpec, s conversion.Scope) error { + out.Context = in.Context + out.DeployItems = *(*core.DeployItemTemplateList)(unsafe.Pointer(&in.DeployItems)) + out.RegistryPullSecrets = *(*[]core.ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + return nil +} + +func autoConvert_core_ExecutionSpec_To_v1alpha1_ExecutionSpec(in *core.ExecutionSpec, out *ExecutionSpec, s conversion.Scope) error { + out.Context = in.Context + out.DeployItems = *(*DeployItemTemplateList)(unsafe.Pointer(&in.DeployItems)) + out.RegistryPullSecrets = *(*[]ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + return nil +} + +func autoConvert_v1alpha1_ExecutionStatus_To_core_ExecutionStatus(in *ExecutionStatus, out *core.ExecutionStatus, s conversion.Scope) error { + out.Phase = core.ExecutionPhase(in.Phase) + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*[]core.Condition)(unsafe.Pointer(&in.Conditions)) + out.LastError = (*core.Error)(unsafe.Pointer(in.LastError)) + out.ExportReference = (*core.ObjectReference)(unsafe.Pointer(in.ExportReference)) + out.DeployItemReferences = *(*[]core.VersionedNamedObjectReference)(unsafe.Pointer(&in.DeployItemReferences)) + out.ExecutionGenerations = *(*[]core.ExecutionGeneration)(unsafe.Pointer(&in.ExecutionGenerations)) + return nil +} + +// Convert_v1alpha1_ExecutionStatus_To_core_ExecutionStatus is an autogenerated conversion function. +func Convert_v1alpha1_ExecutionStatus_To_core_ExecutionStatus(in *ExecutionStatus, out *core.ExecutionStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ExecutionStatus_To_core_ExecutionStatus(in, out, s) +} + +func autoConvert_core_ExecutionStatus_To_v1alpha1_ExecutionStatus(in *core.ExecutionStatus, out *ExecutionStatus, s conversion.Scope) error { + out.Phase = ExecutionPhase(in.Phase) + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*[]Condition)(unsafe.Pointer(&in.Conditions)) + out.LastError = (*Error)(unsafe.Pointer(in.LastError)) + out.ExportReference = (*ObjectReference)(unsafe.Pointer(in.ExportReference)) + out.DeployItemReferences = *(*[]VersionedNamedObjectReference)(unsafe.Pointer(&in.DeployItemReferences)) + out.ExecutionGenerations = *(*[]ExecutionGeneration)(unsafe.Pointer(&in.ExecutionGenerations)) + return nil +} + +// Convert_core_ExecutionStatus_To_v1alpha1_ExecutionStatus is an autogenerated conversion function. +func Convert_core_ExecutionStatus_To_v1alpha1_ExecutionStatus(in *core.ExecutionStatus, out *ExecutionStatus, s conversion.Scope) error { + return autoConvert_core_ExecutionStatus_To_v1alpha1_ExecutionStatus(in, out, s) +} + +func autoConvert_v1alpha1_ExportDefinition_To_core_ExportDefinition(in *ExportDefinition, out *core.ExportDefinition, s conversion.Scope) error { + if err := Convert_v1alpha1_FieldValueDefinition_To_core_FieldValueDefinition(&in.FieldValueDefinition, &out.FieldValueDefinition, s); err != nil { + return err + } + out.Type = core.ExportType(in.Type) + return nil +} + +// Convert_v1alpha1_ExportDefinition_To_core_ExportDefinition is an autogenerated conversion function. +func Convert_v1alpha1_ExportDefinition_To_core_ExportDefinition(in *ExportDefinition, out *core.ExportDefinition, s conversion.Scope) error { + return autoConvert_v1alpha1_ExportDefinition_To_core_ExportDefinition(in, out, s) +} + +func autoConvert_core_ExportDefinition_To_v1alpha1_ExportDefinition(in *core.ExportDefinition, out *ExportDefinition, s conversion.Scope) error { + if err := Convert_core_FieldValueDefinition_To_v1alpha1_FieldValueDefinition(&in.FieldValueDefinition, &out.FieldValueDefinition, s); err != nil { + return err + } + out.Type = ExportType(in.Type) + return nil +} + +// Convert_core_ExportDefinition_To_v1alpha1_ExportDefinition is an autogenerated conversion function. +func Convert_core_ExportDefinition_To_v1alpha1_ExportDefinition(in *core.ExportDefinition, out *ExportDefinition, s conversion.Scope) error { + return autoConvert_core_ExportDefinition_To_v1alpha1_ExportDefinition(in, out, s) +} + +func autoConvert_v1alpha1_FieldValueDefinition_To_core_FieldValueDefinition(in *FieldValueDefinition, out *core.FieldValueDefinition, s conversion.Scope) error { + out.Name = in.Name + out.Schema = (*core.JSONSchemaDefinition)(unsafe.Pointer(in.Schema)) + out.TargetType = in.TargetType + return nil +} + +// Convert_v1alpha1_FieldValueDefinition_To_core_FieldValueDefinition is an autogenerated conversion function. +func Convert_v1alpha1_FieldValueDefinition_To_core_FieldValueDefinition(in *FieldValueDefinition, out *core.FieldValueDefinition, s conversion.Scope) error { + return autoConvert_v1alpha1_FieldValueDefinition_To_core_FieldValueDefinition(in, out, s) +} + +func autoConvert_core_FieldValueDefinition_To_v1alpha1_FieldValueDefinition(in *core.FieldValueDefinition, out *FieldValueDefinition, s conversion.Scope) error { + out.Name = in.Name + out.Schema = (*JSONSchemaDefinition)(unsafe.Pointer(in.Schema)) + out.TargetType = in.TargetType + return nil +} + +// Convert_core_FieldValueDefinition_To_v1alpha1_FieldValueDefinition is an autogenerated conversion function. +func Convert_core_FieldValueDefinition_To_v1alpha1_FieldValueDefinition(in *core.FieldValueDefinition, out *FieldValueDefinition, s conversion.Scope) error { + return autoConvert_core_FieldValueDefinition_To_v1alpha1_FieldValueDefinition(in, out, s) +} + +func autoConvert_v1alpha1_ImportDefinition_To_core_ImportDefinition(in *ImportDefinition, out *core.ImportDefinition, s conversion.Scope) error { + if err := Convert_v1alpha1_FieldValueDefinition_To_core_FieldValueDefinition(&in.FieldValueDefinition, &out.FieldValueDefinition, s); err != nil { + return err + } + out.Type = core.ImportType(in.Type) + out.Required = (*bool)(unsafe.Pointer(in.Required)) + if err := Convert_v1alpha1_Default_To_core_Default(&in.Default, &out.Default, s); err != nil { + return err + } + out.ConditionalImports = *(*[]core.ImportDefinition)(unsafe.Pointer(&in.ConditionalImports)) + return nil +} + +// Convert_v1alpha1_ImportDefinition_To_core_ImportDefinition is an autogenerated conversion function. +func Convert_v1alpha1_ImportDefinition_To_core_ImportDefinition(in *ImportDefinition, out *core.ImportDefinition, s conversion.Scope) error { + return autoConvert_v1alpha1_ImportDefinition_To_core_ImportDefinition(in, out, s) +} + +func autoConvert_core_ImportDefinition_To_v1alpha1_ImportDefinition(in *core.ImportDefinition, out *ImportDefinition, s conversion.Scope) error { + if err := Convert_core_FieldValueDefinition_To_v1alpha1_FieldValueDefinition(&in.FieldValueDefinition, &out.FieldValueDefinition, s); err != nil { + return err + } + out.Type = ImportType(in.Type) + out.Required = (*bool)(unsafe.Pointer(in.Required)) + if err := Convert_core_Default_To_v1alpha1_Default(&in.Default, &out.Default, s); err != nil { + return err + } + out.ConditionalImports = *(*ImportDefinitionList)(unsafe.Pointer(&in.ConditionalImports)) + return nil +} + +// Convert_core_ImportDefinition_To_v1alpha1_ImportDefinition is an autogenerated conversion function. +func Convert_core_ImportDefinition_To_v1alpha1_ImportDefinition(in *core.ImportDefinition, out *ImportDefinition, s conversion.Scope) error { + return autoConvert_core_ImportDefinition_To_v1alpha1_ImportDefinition(in, out, s) +} + +func autoConvert_v1alpha1_ImportStatus_To_core_ImportStatus(in *ImportStatus, out *core.ImportStatus, s conversion.Scope) error { + out.Name = in.Name + out.Type = core.ImportStatusType(in.Type) + out.Target = in.Target + out.Targets = *(*[]core.TargetImportStatus)(unsafe.Pointer(&in.Targets)) + out.ComponentDescriptorRef = (*core.ComponentDescriptorReference)(unsafe.Pointer(in.ComponentDescriptorRef)) + out.ComponentDescriptors = *(*[]core.CDImportStatus)(unsafe.Pointer(&in.ComponentDescriptors)) + out.DataRef = in.DataRef + out.SecretRef = in.SecretRef + out.ConfigMapRef = in.ConfigMapRef + out.SourceRef = (*core.ObjectReference)(unsafe.Pointer(in.SourceRef)) + out.ConfigGeneration = in.ConfigGeneration + return nil +} + +// Convert_v1alpha1_ImportStatus_To_core_ImportStatus is an autogenerated conversion function. +func Convert_v1alpha1_ImportStatus_To_core_ImportStatus(in *ImportStatus, out *core.ImportStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ImportStatus_To_core_ImportStatus(in, out, s) +} + +func autoConvert_core_ImportStatus_To_v1alpha1_ImportStatus(in *core.ImportStatus, out *ImportStatus, s conversion.Scope) error { + out.Name = in.Name + out.Type = ImportStatusType(in.Type) + out.Target = in.Target + out.Targets = *(*[]TargetImportStatus)(unsafe.Pointer(&in.Targets)) + out.ComponentDescriptorRef = (*ComponentDescriptorReference)(unsafe.Pointer(in.ComponentDescriptorRef)) + out.ComponentDescriptors = *(*[]CDImportStatus)(unsafe.Pointer(&in.ComponentDescriptors)) + out.DataRef = in.DataRef + out.SecretRef = in.SecretRef + out.ConfigMapRef = in.ConfigMapRef + out.SourceRef = (*ObjectReference)(unsafe.Pointer(in.SourceRef)) + out.ConfigGeneration = in.ConfigGeneration + return nil +} + +// Convert_core_ImportStatus_To_v1alpha1_ImportStatus is an autogenerated conversion function. +func Convert_core_ImportStatus_To_v1alpha1_ImportStatus(in *core.ImportStatus, out *ImportStatus, s conversion.Scope) error { + return autoConvert_core_ImportStatus_To_v1alpha1_ImportStatus(in, out, s) +} + +func autoConvert_v1alpha1_InlineBlueprint_To_core_InlineBlueprint(in *InlineBlueprint, out *core.InlineBlueprint, s conversion.Scope) error { + if err := Convert_v1alpha1_AnyJSON_To_core_AnyJSON(&in.Filesystem, &out.Filesystem, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_InlineBlueprint_To_core_InlineBlueprint is an autogenerated conversion function. +func Convert_v1alpha1_InlineBlueprint_To_core_InlineBlueprint(in *InlineBlueprint, out *core.InlineBlueprint, s conversion.Scope) error { + return autoConvert_v1alpha1_InlineBlueprint_To_core_InlineBlueprint(in, out, s) +} + +func autoConvert_core_InlineBlueprint_To_v1alpha1_InlineBlueprint(in *core.InlineBlueprint, out *InlineBlueprint, s conversion.Scope) error { + if err := Convert_core_AnyJSON_To_v1alpha1_AnyJSON(&in.Filesystem, &out.Filesystem, s); err != nil { + return err + } + return nil +} + +// Convert_core_InlineBlueprint_To_v1alpha1_InlineBlueprint is an autogenerated conversion function. +func Convert_core_InlineBlueprint_To_v1alpha1_InlineBlueprint(in *core.InlineBlueprint, out *InlineBlueprint, s conversion.Scope) error { + return autoConvert_core_InlineBlueprint_To_v1alpha1_InlineBlueprint(in, out, s) +} + +func autoConvert_v1alpha1_Installation_To_core_Installation(in *Installation, out *core.Installation, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_InstallationSpec_To_core_InstallationSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_InstallationStatus_To_core_InstallationStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Installation_To_core_Installation is an autogenerated conversion function. +func Convert_v1alpha1_Installation_To_core_Installation(in *Installation, out *core.Installation, s conversion.Scope) error { + return autoConvert_v1alpha1_Installation_To_core_Installation(in, out, s) +} + +func autoConvert_core_Installation_To_v1alpha1_Installation(in *core.Installation, out *Installation, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_InstallationSpec_To_v1alpha1_InstallationSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_core_InstallationStatus_To_v1alpha1_InstallationStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_core_Installation_To_v1alpha1_Installation is an autogenerated conversion function. +func Convert_core_Installation_To_v1alpha1_Installation(in *core.Installation, out *Installation, s conversion.Scope) error { + return autoConvert_core_Installation_To_v1alpha1_Installation(in, out, s) +} + +func autoConvert_v1alpha1_InstallationExports_To_core_InstallationExports(in *InstallationExports, out *core.InstallationExports, s conversion.Scope) error { + out.Data = *(*[]core.DataExport)(unsafe.Pointer(&in.Data)) + out.Targets = *(*[]core.TargetExport)(unsafe.Pointer(&in.Targets)) + return nil +} + +// Convert_v1alpha1_InstallationExports_To_core_InstallationExports is an autogenerated conversion function. +func Convert_v1alpha1_InstallationExports_To_core_InstallationExports(in *InstallationExports, out *core.InstallationExports, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallationExports_To_core_InstallationExports(in, out, s) +} + +func autoConvert_core_InstallationExports_To_v1alpha1_InstallationExports(in *core.InstallationExports, out *InstallationExports, s conversion.Scope) error { + out.Data = *(*[]DataExport)(unsafe.Pointer(&in.Data)) + out.Targets = *(*[]TargetExport)(unsafe.Pointer(&in.Targets)) + return nil +} + +// Convert_core_InstallationExports_To_v1alpha1_InstallationExports is an autogenerated conversion function. +func Convert_core_InstallationExports_To_v1alpha1_InstallationExports(in *core.InstallationExports, out *InstallationExports, s conversion.Scope) error { + return autoConvert_core_InstallationExports_To_v1alpha1_InstallationExports(in, out, s) +} + +func autoConvert_v1alpha1_InstallationImports_To_core_InstallationImports(in *InstallationImports, out *core.InstallationImports, s conversion.Scope) error { + out.Data = *(*[]core.DataImport)(unsafe.Pointer(&in.Data)) + out.Targets = *(*[]core.TargetImport)(unsafe.Pointer(&in.Targets)) + out.ComponentDescriptors = *(*[]core.ComponentDescriptorImport)(unsafe.Pointer(&in.ComponentDescriptors)) + return nil +} + +// Convert_v1alpha1_InstallationImports_To_core_InstallationImports is an autogenerated conversion function. +func Convert_v1alpha1_InstallationImports_To_core_InstallationImports(in *InstallationImports, out *core.InstallationImports, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallationImports_To_core_InstallationImports(in, out, s) +} + +func autoConvert_core_InstallationImports_To_v1alpha1_InstallationImports(in *core.InstallationImports, out *InstallationImports, s conversion.Scope) error { + out.Data = *(*[]DataImport)(unsafe.Pointer(&in.Data)) + out.Targets = *(*[]TargetImport)(unsafe.Pointer(&in.Targets)) + out.ComponentDescriptors = *(*[]ComponentDescriptorImport)(unsafe.Pointer(&in.ComponentDescriptors)) + return nil +} + +// Convert_core_InstallationImports_To_v1alpha1_InstallationImports is an autogenerated conversion function. +func Convert_core_InstallationImports_To_v1alpha1_InstallationImports(in *core.InstallationImports, out *InstallationImports, s conversion.Scope) error { + return autoConvert_core_InstallationImports_To_v1alpha1_InstallationImports(in, out, s) +} + +func autoConvert_v1alpha1_InstallationList_To_core_InstallationList(in *InstallationList, out *core.InstallationList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.Installation)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_InstallationList_To_core_InstallationList is an autogenerated conversion function. +func Convert_v1alpha1_InstallationList_To_core_InstallationList(in *InstallationList, out *core.InstallationList, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallationList_To_core_InstallationList(in, out, s) +} + +func autoConvert_core_InstallationList_To_v1alpha1_InstallationList(in *core.InstallationList, out *InstallationList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Installation)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_InstallationList_To_v1alpha1_InstallationList is an autogenerated conversion function. +func Convert_core_InstallationList_To_v1alpha1_InstallationList(in *core.InstallationList, out *InstallationList, s conversion.Scope) error { + return autoConvert_core_InstallationList_To_v1alpha1_InstallationList(in, out, s) +} + +func autoConvert_v1alpha1_InstallationSpec_To_core_InstallationSpec(in *InstallationSpec, out *core.InstallationSpec, s conversion.Scope) error { + out.Context = in.Context + out.ComponentDescriptor = (*core.ComponentDescriptorDefinition)(unsafe.Pointer(in.ComponentDescriptor)) + if err := Convert_v1alpha1_BlueprintDefinition_To_core_BlueprintDefinition(&in.Blueprint, &out.Blueprint, s); err != nil { + return err + } + out.RegistryPullSecrets = *(*[]core.ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + if err := Convert_v1alpha1_InstallationImports_To_core_InstallationImports(&in.Imports, &out.Imports, s); err != nil { + return err + } + out.ImportDataMappings = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.ImportDataMappings)) + if err := Convert_v1alpha1_InstallationExports_To_core_InstallationExports(&in.Exports, &out.Exports, s); err != nil { + return err + } + out.ExportDataMappings = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.ExportDataMappings)) + return nil +} + +// Convert_v1alpha1_InstallationSpec_To_core_InstallationSpec is an autogenerated conversion function. +func Convert_v1alpha1_InstallationSpec_To_core_InstallationSpec(in *InstallationSpec, out *core.InstallationSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallationSpec_To_core_InstallationSpec(in, out, s) +} + +func autoConvert_core_InstallationSpec_To_v1alpha1_InstallationSpec(in *core.InstallationSpec, out *InstallationSpec, s conversion.Scope) error { + out.Context = in.Context + out.ComponentDescriptor = (*ComponentDescriptorDefinition)(unsafe.Pointer(in.ComponentDescriptor)) + if err := Convert_core_BlueprintDefinition_To_v1alpha1_BlueprintDefinition(&in.Blueprint, &out.Blueprint, s); err != nil { + return err + } + out.RegistryPullSecrets = *(*[]ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + if err := Convert_core_InstallationImports_To_v1alpha1_InstallationImports(&in.Imports, &out.Imports, s); err != nil { + return err + } + out.ImportDataMappings = *(*map[string]AnyJSON)(unsafe.Pointer(&in.ImportDataMappings)) + if err := Convert_core_InstallationExports_To_v1alpha1_InstallationExports(&in.Exports, &out.Exports, s); err != nil { + return err + } + out.ExportDataMappings = *(*map[string]AnyJSON)(unsafe.Pointer(&in.ExportDataMappings)) + return nil +} + +// Convert_core_InstallationSpec_To_v1alpha1_InstallationSpec is an autogenerated conversion function. +func Convert_core_InstallationSpec_To_v1alpha1_InstallationSpec(in *core.InstallationSpec, out *InstallationSpec, s conversion.Scope) error { + return autoConvert_core_InstallationSpec_To_v1alpha1_InstallationSpec(in, out, s) +} + +func autoConvert_v1alpha1_InstallationStatus_To_core_InstallationStatus(in *InstallationStatus, out *core.InstallationStatus, s conversion.Scope) error { + out.Phase = core.ComponentInstallationPhase(in.Phase) + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*[]core.Condition)(unsafe.Pointer(&in.Conditions)) + out.LastError = (*core.Error)(unsafe.Pointer(in.LastError)) + out.ConfigGeneration = in.ConfigGeneration + out.Imports = *(*[]core.ImportStatus)(unsafe.Pointer(&in.Imports)) + out.InstallationReferences = *(*[]core.NamedObjectReference)(unsafe.Pointer(&in.InstallationReferences)) + out.ExecutionReference = (*core.ObjectReference)(unsafe.Pointer(in.ExecutionReference)) + return nil +} + +// Convert_v1alpha1_InstallationStatus_To_core_InstallationStatus is an autogenerated conversion function. +func Convert_v1alpha1_InstallationStatus_To_core_InstallationStatus(in *InstallationStatus, out *core.InstallationStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallationStatus_To_core_InstallationStatus(in, out, s) +} + +func autoConvert_core_InstallationStatus_To_v1alpha1_InstallationStatus(in *core.InstallationStatus, out *InstallationStatus, s conversion.Scope) error { + out.Phase = ComponentInstallationPhase(in.Phase) + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*[]Condition)(unsafe.Pointer(&in.Conditions)) + out.LastError = (*Error)(unsafe.Pointer(in.LastError)) + out.ConfigGeneration = in.ConfigGeneration + out.Imports = *(*[]ImportStatus)(unsafe.Pointer(&in.Imports)) + out.InstallationReferences = *(*[]NamedObjectReference)(unsafe.Pointer(&in.InstallationReferences)) + out.ExecutionReference = (*ObjectReference)(unsafe.Pointer(in.ExecutionReference)) + return nil +} + +// Convert_core_InstallationStatus_To_v1alpha1_InstallationStatus is an autogenerated conversion function. +func Convert_core_InstallationStatus_To_v1alpha1_InstallationStatus(in *core.InstallationStatus, out *InstallationStatus, s conversion.Scope) error { + return autoConvert_core_InstallationStatus_To_v1alpha1_InstallationStatus(in, out, s) +} + +func autoConvert_v1alpha1_InstallationTemplate_To_core_InstallationTemplate(in *InstallationTemplate, out *core.InstallationTemplate, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_v1alpha1_InstallationTemplateBlueprintDefinition_To_core_InstallationTemplateBlueprintDefinition(&in.Blueprint, &out.Blueprint, s); err != nil { + return err + } + if err := Convert_v1alpha1_InstallationImports_To_core_InstallationImports(&in.Imports, &out.Imports, s); err != nil { + return err + } + out.ImportDataMappings = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.ImportDataMappings)) + if err := Convert_v1alpha1_InstallationExports_To_core_InstallationExports(&in.Exports, &out.Exports, s); err != nil { + return err + } + out.ExportDataMappings = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.ExportDataMappings)) + return nil +} + +// Convert_v1alpha1_InstallationTemplate_To_core_InstallationTemplate is an autogenerated conversion function. +func Convert_v1alpha1_InstallationTemplate_To_core_InstallationTemplate(in *InstallationTemplate, out *core.InstallationTemplate, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallationTemplate_To_core_InstallationTemplate(in, out, s) +} + +func autoConvert_core_InstallationTemplate_To_v1alpha1_InstallationTemplate(in *core.InstallationTemplate, out *InstallationTemplate, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_core_InstallationTemplateBlueprintDefinition_To_v1alpha1_InstallationTemplateBlueprintDefinition(&in.Blueprint, &out.Blueprint, s); err != nil { + return err + } + if err := Convert_core_InstallationImports_To_v1alpha1_InstallationImports(&in.Imports, &out.Imports, s); err != nil { + return err + } + out.ImportDataMappings = *(*map[string]AnyJSON)(unsafe.Pointer(&in.ImportDataMappings)) + if err := Convert_core_InstallationExports_To_v1alpha1_InstallationExports(&in.Exports, &out.Exports, s); err != nil { + return err + } + out.ExportDataMappings = *(*map[string]AnyJSON)(unsafe.Pointer(&in.ExportDataMappings)) + return nil +} + +// Convert_core_InstallationTemplate_To_v1alpha1_InstallationTemplate is an autogenerated conversion function. +func Convert_core_InstallationTemplate_To_v1alpha1_InstallationTemplate(in *core.InstallationTemplate, out *InstallationTemplate, s conversion.Scope) error { + return autoConvert_core_InstallationTemplate_To_v1alpha1_InstallationTemplate(in, out, s) +} + +func autoConvert_v1alpha1_InstallationTemplateBlueprintDefinition_To_core_InstallationTemplateBlueprintDefinition(in *InstallationTemplateBlueprintDefinition, out *core.InstallationTemplateBlueprintDefinition, s conversion.Scope) error { + out.Ref = in.Ref + if err := Convert_v1alpha1_AnyJSON_To_core_AnyJSON(&in.Filesystem, &out.Filesystem, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_InstallationTemplateBlueprintDefinition_To_core_InstallationTemplateBlueprintDefinition is an autogenerated conversion function. +func Convert_v1alpha1_InstallationTemplateBlueprintDefinition_To_core_InstallationTemplateBlueprintDefinition(in *InstallationTemplateBlueprintDefinition, out *core.InstallationTemplateBlueprintDefinition, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallationTemplateBlueprintDefinition_To_core_InstallationTemplateBlueprintDefinition(in, out, s) +} + +func autoConvert_core_InstallationTemplateBlueprintDefinition_To_v1alpha1_InstallationTemplateBlueprintDefinition(in *core.InstallationTemplateBlueprintDefinition, out *InstallationTemplateBlueprintDefinition, s conversion.Scope) error { + out.Ref = in.Ref + if err := Convert_core_AnyJSON_To_v1alpha1_AnyJSON(&in.Filesystem, &out.Filesystem, s); err != nil { + return err + } + return nil +} + +// Convert_core_InstallationTemplateBlueprintDefinition_To_v1alpha1_InstallationTemplateBlueprintDefinition is an autogenerated conversion function. +func Convert_core_InstallationTemplateBlueprintDefinition_To_v1alpha1_InstallationTemplateBlueprintDefinition(in *core.InstallationTemplateBlueprintDefinition, out *InstallationTemplateBlueprintDefinition, s conversion.Scope) error { + return autoConvert_core_InstallationTemplateBlueprintDefinition_To_v1alpha1_InstallationTemplateBlueprintDefinition(in, out, s) +} + +func autoConvert_v1alpha1_JSONSchemaDefinition_To_core_JSONSchemaDefinition(in *JSONSchemaDefinition, out *core.JSONSchemaDefinition, s conversion.Scope) error { + out.RawMessage = *(*json.RawMessage)(unsafe.Pointer(&in.RawMessage)) + return nil +} + +// Convert_v1alpha1_JSONSchemaDefinition_To_core_JSONSchemaDefinition is an autogenerated conversion function. +func Convert_v1alpha1_JSONSchemaDefinition_To_core_JSONSchemaDefinition(in *JSONSchemaDefinition, out *core.JSONSchemaDefinition, s conversion.Scope) error { + return autoConvert_v1alpha1_JSONSchemaDefinition_To_core_JSONSchemaDefinition(in, out, s) +} + +func autoConvert_core_JSONSchemaDefinition_To_v1alpha1_JSONSchemaDefinition(in *core.JSONSchemaDefinition, out *JSONSchemaDefinition, s conversion.Scope) error { + out.RawMessage = *(*json.RawMessage)(unsafe.Pointer(&in.RawMessage)) + return nil +} + +// Convert_core_JSONSchemaDefinition_To_v1alpha1_JSONSchemaDefinition is an autogenerated conversion function. +func Convert_core_JSONSchemaDefinition_To_v1alpha1_JSONSchemaDefinition(in *core.JSONSchemaDefinition, out *JSONSchemaDefinition, s conversion.Scope) error { + return autoConvert_core_JSONSchemaDefinition_To_v1alpha1_JSONSchemaDefinition(in, out, s) +} + +func autoConvert_v1alpha1_NamedObjectReference_To_core_NamedObjectReference(in *NamedObjectReference, out *core.NamedObjectReference, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_v1alpha1_ObjectReference_To_core_ObjectReference(&in.Reference, &out.Reference, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NamedObjectReference_To_core_NamedObjectReference is an autogenerated conversion function. +func Convert_v1alpha1_NamedObjectReference_To_core_NamedObjectReference(in *NamedObjectReference, out *core.NamedObjectReference, s conversion.Scope) error { + return autoConvert_v1alpha1_NamedObjectReference_To_core_NamedObjectReference(in, out, s) +} + +func autoConvert_core_NamedObjectReference_To_v1alpha1_NamedObjectReference(in *core.NamedObjectReference, out *NamedObjectReference, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_core_ObjectReference_To_v1alpha1_ObjectReference(&in.Reference, &out.Reference, s); err != nil { + return err + } + return nil +} + +// Convert_core_NamedObjectReference_To_v1alpha1_NamedObjectReference is an autogenerated conversion function. +func Convert_core_NamedObjectReference_To_v1alpha1_NamedObjectReference(in *core.NamedObjectReference, out *NamedObjectReference, s conversion.Scope) error { + return autoConvert_core_NamedObjectReference_To_v1alpha1_NamedObjectReference(in, out, s) +} + +func autoConvert_v1alpha1_ObjectReference_To_core_ObjectReference(in *ObjectReference, out *core.ObjectReference, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +// Convert_v1alpha1_ObjectReference_To_core_ObjectReference is an autogenerated conversion function. +func Convert_v1alpha1_ObjectReference_To_core_ObjectReference(in *ObjectReference, out *core.ObjectReference, s conversion.Scope) error { + return autoConvert_v1alpha1_ObjectReference_To_core_ObjectReference(in, out, s) +} + +func autoConvert_core_ObjectReference_To_v1alpha1_ObjectReference(in *core.ObjectReference, out *ObjectReference, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +// Convert_core_ObjectReference_To_v1alpha1_ObjectReference is an autogenerated conversion function. +func Convert_core_ObjectReference_To_v1alpha1_ObjectReference(in *core.ObjectReference, out *ObjectReference, s conversion.Scope) error { + return autoConvert_core_ObjectReference_To_v1alpha1_ObjectReference(in, out, s) +} + +func autoConvert_v1alpha1_RemoteBlueprintReference_To_core_RemoteBlueprintReference(in *RemoteBlueprintReference, out *core.RemoteBlueprintReference, s conversion.Scope) error { + out.ResourceName = in.ResourceName + return nil +} + +// Convert_v1alpha1_RemoteBlueprintReference_To_core_RemoteBlueprintReference is an autogenerated conversion function. +func Convert_v1alpha1_RemoteBlueprintReference_To_core_RemoteBlueprintReference(in *RemoteBlueprintReference, out *core.RemoteBlueprintReference, s conversion.Scope) error { + return autoConvert_v1alpha1_RemoteBlueprintReference_To_core_RemoteBlueprintReference(in, out, s) +} + +func autoConvert_core_RemoteBlueprintReference_To_v1alpha1_RemoteBlueprintReference(in *core.RemoteBlueprintReference, out *RemoteBlueprintReference, s conversion.Scope) error { + out.ResourceName = in.ResourceName + return nil +} + +// Convert_core_RemoteBlueprintReference_To_v1alpha1_RemoteBlueprintReference is an autogenerated conversion function. +func Convert_core_RemoteBlueprintReference_To_v1alpha1_RemoteBlueprintReference(in *core.RemoteBlueprintReference, out *RemoteBlueprintReference, s conversion.Scope) error { + return autoConvert_core_RemoteBlueprintReference_To_v1alpha1_RemoteBlueprintReference(in, out, s) +} + +func autoConvert_v1alpha1_Requirement_To_core_Requirement(in *Requirement, out *core.Requirement, s conversion.Scope) error { + out.Key = in.Key + out.Operator = selection.Operator(in.Operator) + out.Values = *(*[]string)(unsafe.Pointer(&in.Values)) + return nil +} + +// Convert_v1alpha1_Requirement_To_core_Requirement is an autogenerated conversion function. +func Convert_v1alpha1_Requirement_To_core_Requirement(in *Requirement, out *core.Requirement, s conversion.Scope) error { + return autoConvert_v1alpha1_Requirement_To_core_Requirement(in, out, s) +} + +func autoConvert_core_Requirement_To_v1alpha1_Requirement(in *core.Requirement, out *Requirement, s conversion.Scope) error { + out.Key = in.Key + out.Operator = selection.Operator(in.Operator) + out.Values = *(*[]string)(unsafe.Pointer(&in.Values)) + return nil +} + +// Convert_core_Requirement_To_v1alpha1_Requirement is an autogenerated conversion function. +func Convert_core_Requirement_To_v1alpha1_Requirement(in *core.Requirement, out *Requirement, s conversion.Scope) error { + return autoConvert_core_Requirement_To_v1alpha1_Requirement(in, out, s) +} + +func autoConvert_v1alpha1_ResourceReference_To_core_ResourceReference(in *ResourceReference, out *core.ResourceReference, s conversion.Scope) error { + out.ComponentName = in.ComponentName + out.ResourceName = in.ResourceName + return nil +} + +// Convert_v1alpha1_ResourceReference_To_core_ResourceReference is an autogenerated conversion function. +func Convert_v1alpha1_ResourceReference_To_core_ResourceReference(in *ResourceReference, out *core.ResourceReference, s conversion.Scope) error { + return autoConvert_v1alpha1_ResourceReference_To_core_ResourceReference(in, out, s) +} + +func autoConvert_core_ResourceReference_To_v1alpha1_ResourceReference(in *core.ResourceReference, out *ResourceReference, s conversion.Scope) error { + out.ComponentName = in.ComponentName + out.ResourceName = in.ResourceName + return nil +} + +// Convert_core_ResourceReference_To_v1alpha1_ResourceReference is an autogenerated conversion function. +func Convert_core_ResourceReference_To_v1alpha1_ResourceReference(in *core.ResourceReference, out *ResourceReference, s conversion.Scope) error { + return autoConvert_core_ResourceReference_To_v1alpha1_ResourceReference(in, out, s) +} + +func autoConvert_v1alpha1_SecretLabelSelectorRef_To_core_SecretLabelSelectorRef(in *SecretLabelSelectorRef, out *core.SecretLabelSelectorRef, s conversion.Scope) error { + out.Selector = *(*map[string]string)(unsafe.Pointer(&in.Selector)) + out.Key = in.Key + return nil +} + +// Convert_v1alpha1_SecretLabelSelectorRef_To_core_SecretLabelSelectorRef is an autogenerated conversion function. +func Convert_v1alpha1_SecretLabelSelectorRef_To_core_SecretLabelSelectorRef(in *SecretLabelSelectorRef, out *core.SecretLabelSelectorRef, s conversion.Scope) error { + return autoConvert_v1alpha1_SecretLabelSelectorRef_To_core_SecretLabelSelectorRef(in, out, s) +} + +func autoConvert_core_SecretLabelSelectorRef_To_v1alpha1_SecretLabelSelectorRef(in *core.SecretLabelSelectorRef, out *SecretLabelSelectorRef, s conversion.Scope) error { + out.Selector = *(*map[string]string)(unsafe.Pointer(&in.Selector)) + out.Key = in.Key + return nil +} + +// Convert_core_SecretLabelSelectorRef_To_v1alpha1_SecretLabelSelectorRef is an autogenerated conversion function. +func Convert_core_SecretLabelSelectorRef_To_v1alpha1_SecretLabelSelectorRef(in *core.SecretLabelSelectorRef, out *SecretLabelSelectorRef, s conversion.Scope) error { + return autoConvert_core_SecretLabelSelectorRef_To_v1alpha1_SecretLabelSelectorRef(in, out, s) +} + +func autoConvert_v1alpha1_SecretReference_To_core_SecretReference(in *SecretReference, out *core.SecretReference, s conversion.Scope) error { + if err := Convert_v1alpha1_ObjectReference_To_core_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +// Convert_v1alpha1_SecretReference_To_core_SecretReference is an autogenerated conversion function. +func Convert_v1alpha1_SecretReference_To_core_SecretReference(in *SecretReference, out *core.SecretReference, s conversion.Scope) error { + return autoConvert_v1alpha1_SecretReference_To_core_SecretReference(in, out, s) +} + +func autoConvert_core_SecretReference_To_v1alpha1_SecretReference(in *core.SecretReference, out *SecretReference, s conversion.Scope) error { + if err := Convert_core_ObjectReference_To_v1alpha1_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + out.Key = in.Key + return nil +} + +// Convert_core_SecretReference_To_v1alpha1_SecretReference is an autogenerated conversion function. +func Convert_core_SecretReference_To_v1alpha1_SecretReference(in *core.SecretReference, out *SecretReference, s conversion.Scope) error { + return autoConvert_core_SecretReference_To_v1alpha1_SecretReference(in, out, s) +} + +func autoConvert_v1alpha1_StaticDataSource_To_core_StaticDataSource(in *StaticDataSource, out *core.StaticDataSource, s conversion.Scope) error { + if err := Convert_v1alpha1_AnyJSON_To_core_AnyJSON(&in.Value, &out.Value, s); err != nil { + return err + } + out.ValueFrom = (*core.StaticDataValueFrom)(unsafe.Pointer(in.ValueFrom)) + return nil +} + +// Convert_v1alpha1_StaticDataSource_To_core_StaticDataSource is an autogenerated conversion function. +func Convert_v1alpha1_StaticDataSource_To_core_StaticDataSource(in *StaticDataSource, out *core.StaticDataSource, s conversion.Scope) error { + return autoConvert_v1alpha1_StaticDataSource_To_core_StaticDataSource(in, out, s) +} + +func autoConvert_core_StaticDataSource_To_v1alpha1_StaticDataSource(in *core.StaticDataSource, out *StaticDataSource, s conversion.Scope) error { + if err := Convert_core_AnyJSON_To_v1alpha1_AnyJSON(&in.Value, &out.Value, s); err != nil { + return err + } + out.ValueFrom = (*StaticDataValueFrom)(unsafe.Pointer(in.ValueFrom)) + return nil +} + +// Convert_core_StaticDataSource_To_v1alpha1_StaticDataSource is an autogenerated conversion function. +func Convert_core_StaticDataSource_To_v1alpha1_StaticDataSource(in *core.StaticDataSource, out *StaticDataSource, s conversion.Scope) error { + return autoConvert_core_StaticDataSource_To_v1alpha1_StaticDataSource(in, out, s) +} + +func autoConvert_v1alpha1_StaticDataValueFrom_To_core_StaticDataValueFrom(in *StaticDataValueFrom, out *core.StaticDataValueFrom, s conversion.Scope) error { + out.SecretKeyRef = (*v1.SecretKeySelector)(unsafe.Pointer(in.SecretKeyRef)) + out.SecretLabelSelector = (*core.SecretLabelSelectorRef)(unsafe.Pointer(in.SecretLabelSelector)) + return nil +} + +// Convert_v1alpha1_StaticDataValueFrom_To_core_StaticDataValueFrom is an autogenerated conversion function. +func Convert_v1alpha1_StaticDataValueFrom_To_core_StaticDataValueFrom(in *StaticDataValueFrom, out *core.StaticDataValueFrom, s conversion.Scope) error { + return autoConvert_v1alpha1_StaticDataValueFrom_To_core_StaticDataValueFrom(in, out, s) +} + +func autoConvert_core_StaticDataValueFrom_To_v1alpha1_StaticDataValueFrom(in *core.StaticDataValueFrom, out *StaticDataValueFrom, s conversion.Scope) error { + out.SecretKeyRef = (*v1.SecretKeySelector)(unsafe.Pointer(in.SecretKeyRef)) + out.SecretLabelSelector = (*SecretLabelSelectorRef)(unsafe.Pointer(in.SecretLabelSelector)) + return nil +} + +// Convert_core_StaticDataValueFrom_To_v1alpha1_StaticDataValueFrom is an autogenerated conversion function. +func Convert_core_StaticDataValueFrom_To_v1alpha1_StaticDataValueFrom(in *core.StaticDataValueFrom, out *StaticDataValueFrom, s conversion.Scope) error { + return autoConvert_core_StaticDataValueFrom_To_v1alpha1_StaticDataValueFrom(in, out, s) +} + +func autoConvert_v1alpha1_SubinstallationTemplate_To_core_SubinstallationTemplate(in *SubinstallationTemplate, out *core.SubinstallationTemplate, s conversion.Scope) error { + out.File = in.File + out.InstallationTemplate = (*core.InstallationTemplate)(unsafe.Pointer(in.InstallationTemplate)) + return nil +} + +// Convert_v1alpha1_SubinstallationTemplate_To_core_SubinstallationTemplate is an autogenerated conversion function. +func Convert_v1alpha1_SubinstallationTemplate_To_core_SubinstallationTemplate(in *SubinstallationTemplate, out *core.SubinstallationTemplate, s conversion.Scope) error { + return autoConvert_v1alpha1_SubinstallationTemplate_To_core_SubinstallationTemplate(in, out, s) +} + +func autoConvert_core_SubinstallationTemplate_To_v1alpha1_SubinstallationTemplate(in *core.SubinstallationTemplate, out *SubinstallationTemplate, s conversion.Scope) error { + out.File = in.File + out.InstallationTemplate = (*InstallationTemplate)(unsafe.Pointer(in.InstallationTemplate)) + return nil +} + +// Convert_core_SubinstallationTemplate_To_v1alpha1_SubinstallationTemplate is an autogenerated conversion function. +func Convert_core_SubinstallationTemplate_To_v1alpha1_SubinstallationTemplate(in *core.SubinstallationTemplate, out *SubinstallationTemplate, s conversion.Scope) error { + return autoConvert_core_SubinstallationTemplate_To_v1alpha1_SubinstallationTemplate(in, out, s) +} + +func autoConvert_v1alpha1_TLSClientConfig_To_core_TLSClientConfig(in *TLSClientConfig, out *core.TLSClientConfig, s conversion.Scope) error { + out.Insecure = in.Insecure + out.ServerName = in.ServerName + out.CAData = *(*[]byte)(unsafe.Pointer(&in.CAData)) + out.NextProtos = *(*[]string)(unsafe.Pointer(&in.NextProtos)) + return nil +} + +// Convert_v1alpha1_TLSClientConfig_To_core_TLSClientConfig is an autogenerated conversion function. +func Convert_v1alpha1_TLSClientConfig_To_core_TLSClientConfig(in *TLSClientConfig, out *core.TLSClientConfig, s conversion.Scope) error { + return autoConvert_v1alpha1_TLSClientConfig_To_core_TLSClientConfig(in, out, s) +} + +func autoConvert_core_TLSClientConfig_To_v1alpha1_TLSClientConfig(in *core.TLSClientConfig, out *TLSClientConfig, s conversion.Scope) error { + out.Insecure = in.Insecure + out.ServerName = in.ServerName + out.CAData = *(*[]byte)(unsafe.Pointer(&in.CAData)) + out.NextProtos = *(*[]string)(unsafe.Pointer(&in.NextProtos)) + return nil +} + +// Convert_core_TLSClientConfig_To_v1alpha1_TLSClientConfig is an autogenerated conversion function. +func Convert_core_TLSClientConfig_To_v1alpha1_TLSClientConfig(in *core.TLSClientConfig, out *TLSClientConfig, s conversion.Scope) error { + return autoConvert_core_TLSClientConfig_To_v1alpha1_TLSClientConfig(in, out, s) +} + +func autoConvert_v1alpha1_Target_To_core_Target(in *Target, out *core.Target, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_TargetSpec_To_core_TargetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Target_To_core_Target is an autogenerated conversion function. +func Convert_v1alpha1_Target_To_core_Target(in *Target, out *core.Target, s conversion.Scope) error { + return autoConvert_v1alpha1_Target_To_core_Target(in, out, s) +} + +func autoConvert_core_Target_To_v1alpha1_Target(in *core.Target, out *Target, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_core_TargetSpec_To_v1alpha1_TargetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_core_Target_To_v1alpha1_Target is an autogenerated conversion function. +func Convert_core_Target_To_v1alpha1_Target(in *core.Target, out *Target, s conversion.Scope) error { + return autoConvert_core_Target_To_v1alpha1_Target(in, out, s) +} + +func autoConvert_v1alpha1_TargetExport_To_core_TargetExport(in *TargetExport, out *core.TargetExport, s conversion.Scope) error { + out.Name = in.Name + out.Target = in.Target + return nil +} + +// Convert_v1alpha1_TargetExport_To_core_TargetExport is an autogenerated conversion function. +func Convert_v1alpha1_TargetExport_To_core_TargetExport(in *TargetExport, out *core.TargetExport, s conversion.Scope) error { + return autoConvert_v1alpha1_TargetExport_To_core_TargetExport(in, out, s) +} + +func autoConvert_core_TargetExport_To_v1alpha1_TargetExport(in *core.TargetExport, out *TargetExport, s conversion.Scope) error { + out.Name = in.Name + out.Target = in.Target + return nil +} + +// Convert_core_TargetExport_To_v1alpha1_TargetExport is an autogenerated conversion function. +func Convert_core_TargetExport_To_v1alpha1_TargetExport(in *core.TargetExport, out *TargetExport, s conversion.Scope) error { + return autoConvert_core_TargetExport_To_v1alpha1_TargetExport(in, out, s) +} + +func autoConvert_v1alpha1_TargetImport_To_core_TargetImport(in *TargetImport, out *core.TargetImport, s conversion.Scope) error { + out.Name = in.Name + out.Target = in.Target + out.Targets = *(*[]string)(unsafe.Pointer(&in.Targets)) + out.TargetListReference = in.TargetListReference + return nil +} + +// Convert_v1alpha1_TargetImport_To_core_TargetImport is an autogenerated conversion function. +func Convert_v1alpha1_TargetImport_To_core_TargetImport(in *TargetImport, out *core.TargetImport, s conversion.Scope) error { + return autoConvert_v1alpha1_TargetImport_To_core_TargetImport(in, out, s) +} + +func autoConvert_core_TargetImport_To_v1alpha1_TargetImport(in *core.TargetImport, out *TargetImport, s conversion.Scope) error { + out.Name = in.Name + out.Target = in.Target + out.Targets = *(*[]string)(unsafe.Pointer(&in.Targets)) + out.TargetListReference = in.TargetListReference + return nil +} + +// Convert_core_TargetImport_To_v1alpha1_TargetImport is an autogenerated conversion function. +func Convert_core_TargetImport_To_v1alpha1_TargetImport(in *core.TargetImport, out *TargetImport, s conversion.Scope) error { + return autoConvert_core_TargetImport_To_v1alpha1_TargetImport(in, out, s) +} + +func autoConvert_v1alpha1_TargetImportStatus_To_core_TargetImportStatus(in *TargetImportStatus, out *core.TargetImportStatus, s conversion.Scope) error { + out.Target = in.Target + out.SourceRef = (*core.ObjectReference)(unsafe.Pointer(in.SourceRef)) + out.ConfigGeneration = in.ConfigGeneration + return nil +} + +// Convert_v1alpha1_TargetImportStatus_To_core_TargetImportStatus is an autogenerated conversion function. +func Convert_v1alpha1_TargetImportStatus_To_core_TargetImportStatus(in *TargetImportStatus, out *core.TargetImportStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_TargetImportStatus_To_core_TargetImportStatus(in, out, s) +} + +func autoConvert_core_TargetImportStatus_To_v1alpha1_TargetImportStatus(in *core.TargetImportStatus, out *TargetImportStatus, s conversion.Scope) error { + out.Target = in.Target + out.SourceRef = (*ObjectReference)(unsafe.Pointer(in.SourceRef)) + out.ConfigGeneration = in.ConfigGeneration + return nil +} + +// Convert_core_TargetImportStatus_To_v1alpha1_TargetImportStatus is an autogenerated conversion function. +func Convert_core_TargetImportStatus_To_v1alpha1_TargetImportStatus(in *core.TargetImportStatus, out *TargetImportStatus, s conversion.Scope) error { + return autoConvert_core_TargetImportStatus_To_v1alpha1_TargetImportStatus(in, out, s) +} + +func autoConvert_v1alpha1_TargetList_To_core_TargetList(in *TargetList, out *core.TargetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]core.Target)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_TargetList_To_core_TargetList is an autogenerated conversion function. +func Convert_v1alpha1_TargetList_To_core_TargetList(in *TargetList, out *core.TargetList, s conversion.Scope) error { + return autoConvert_v1alpha1_TargetList_To_core_TargetList(in, out, s) +} + +func autoConvert_core_TargetList_To_v1alpha1_TargetList(in *core.TargetList, out *TargetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Target)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_core_TargetList_To_v1alpha1_TargetList is an autogenerated conversion function. +func Convert_core_TargetList_To_v1alpha1_TargetList(in *core.TargetList, out *TargetList, s conversion.Scope) error { + return autoConvert_core_TargetList_To_v1alpha1_TargetList(in, out, s) +} + +func autoConvert_v1alpha1_TargetSelector_To_core_TargetSelector(in *TargetSelector, out *core.TargetSelector, s conversion.Scope) error { + out.Targets = *(*[]core.ObjectReference)(unsafe.Pointer(&in.Targets)) + out.Annotations = *(*[]core.Requirement)(unsafe.Pointer(&in.Annotations)) + out.Labels = *(*[]core.Requirement)(unsafe.Pointer(&in.Labels)) + return nil +} + +// Convert_v1alpha1_TargetSelector_To_core_TargetSelector is an autogenerated conversion function. +func Convert_v1alpha1_TargetSelector_To_core_TargetSelector(in *TargetSelector, out *core.TargetSelector, s conversion.Scope) error { + return autoConvert_v1alpha1_TargetSelector_To_core_TargetSelector(in, out, s) +} + +func autoConvert_core_TargetSelector_To_v1alpha1_TargetSelector(in *core.TargetSelector, out *TargetSelector, s conversion.Scope) error { + out.Targets = *(*[]ObjectReference)(unsafe.Pointer(&in.Targets)) + out.Annotations = *(*[]Requirement)(unsafe.Pointer(&in.Annotations)) + out.Labels = *(*[]Requirement)(unsafe.Pointer(&in.Labels)) + return nil +} + +// Convert_core_TargetSelector_To_v1alpha1_TargetSelector is an autogenerated conversion function. +func Convert_core_TargetSelector_To_v1alpha1_TargetSelector(in *core.TargetSelector, out *TargetSelector, s conversion.Scope) error { + return autoConvert_core_TargetSelector_To_v1alpha1_TargetSelector(in, out, s) +} + +func autoConvert_v1alpha1_TargetSpec_To_core_TargetSpec(in *TargetSpec, out *core.TargetSpec, s conversion.Scope) error { + out.Type = core.TargetType(in.Type) + if err := Convert_v1alpha1_AnyJSON_To_core_AnyJSON(&in.Configuration, &out.Configuration, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_TargetSpec_To_core_TargetSpec is an autogenerated conversion function. +func Convert_v1alpha1_TargetSpec_To_core_TargetSpec(in *TargetSpec, out *core.TargetSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_TargetSpec_To_core_TargetSpec(in, out, s) +} + +func autoConvert_core_TargetSpec_To_v1alpha1_TargetSpec(in *core.TargetSpec, out *TargetSpec, s conversion.Scope) error { + out.Type = TargetType(in.Type) + if err := Convert_core_AnyJSON_To_v1alpha1_AnyJSON(&in.Configuration, &out.Configuration, s); err != nil { + return err + } + return nil +} + +// Convert_core_TargetSpec_To_v1alpha1_TargetSpec is an autogenerated conversion function. +func Convert_core_TargetSpec_To_v1alpha1_TargetSpec(in *core.TargetSpec, out *TargetSpec, s conversion.Scope) error { + return autoConvert_core_TargetSpec_To_v1alpha1_TargetSpec(in, out, s) +} + +func autoConvert_v1alpha1_TargetTemplate_To_core_TargetTemplate(in *TargetTemplate, out *core.TargetTemplate, s conversion.Scope) error { + if err := Convert_v1alpha1_TargetSpec_To_core_TargetSpec(&in.TargetSpec, &out.TargetSpec, s); err != nil { + return err + } + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + return nil +} + +// Convert_v1alpha1_TargetTemplate_To_core_TargetTemplate is an autogenerated conversion function. +func Convert_v1alpha1_TargetTemplate_To_core_TargetTemplate(in *TargetTemplate, out *core.TargetTemplate, s conversion.Scope) error { + return autoConvert_v1alpha1_TargetTemplate_To_core_TargetTemplate(in, out, s) +} + +func autoConvert_core_TargetTemplate_To_v1alpha1_TargetTemplate(in *core.TargetTemplate, out *TargetTemplate, s conversion.Scope) error { + if err := Convert_core_TargetSpec_To_v1alpha1_TargetSpec(&in.TargetSpec, &out.TargetSpec, s); err != nil { + return err + } + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + return nil +} + +// Convert_core_TargetTemplate_To_v1alpha1_TargetTemplate is an autogenerated conversion function. +func Convert_core_TargetTemplate_To_v1alpha1_TargetTemplate(in *core.TargetTemplate, out *TargetTemplate, s conversion.Scope) error { + return autoConvert_core_TargetTemplate_To_v1alpha1_TargetTemplate(in, out, s) +} + +func autoConvert_v1alpha1_TemplateExecutor_To_core_TemplateExecutor(in *TemplateExecutor, out *core.TemplateExecutor, s conversion.Scope) error { + out.Name = in.Name + out.Type = core.TemplateType(in.Type) + out.File = in.File + if err := Convert_v1alpha1_AnyJSON_To_core_AnyJSON(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_TemplateExecutor_To_core_TemplateExecutor is an autogenerated conversion function. +func Convert_v1alpha1_TemplateExecutor_To_core_TemplateExecutor(in *TemplateExecutor, out *core.TemplateExecutor, s conversion.Scope) error { + return autoConvert_v1alpha1_TemplateExecutor_To_core_TemplateExecutor(in, out, s) +} + +func autoConvert_core_TemplateExecutor_To_v1alpha1_TemplateExecutor(in *core.TemplateExecutor, out *TemplateExecutor, s conversion.Scope) error { + out.Name = in.Name + out.Type = TemplateType(in.Type) + out.File = in.File + if err := Convert_core_AnyJSON_To_v1alpha1_AnyJSON(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_core_TemplateExecutor_To_v1alpha1_TemplateExecutor is an autogenerated conversion function. +func Convert_core_TemplateExecutor_To_v1alpha1_TemplateExecutor(in *core.TemplateExecutor, out *TemplateExecutor, s conversion.Scope) error { + return autoConvert_core_TemplateExecutor_To_v1alpha1_TemplateExecutor(in, out, s) +} + +func autoConvert_v1alpha1_TypedObjectReference_To_core_TypedObjectReference(in *TypedObjectReference, out *core.TypedObjectReference, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Kind = in.Kind + if err := Convert_v1alpha1_ObjectReference_To_core_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_TypedObjectReference_To_core_TypedObjectReference is an autogenerated conversion function. +func Convert_v1alpha1_TypedObjectReference_To_core_TypedObjectReference(in *TypedObjectReference, out *core.TypedObjectReference, s conversion.Scope) error { + return autoConvert_v1alpha1_TypedObjectReference_To_core_TypedObjectReference(in, out, s) +} + +func autoConvert_core_TypedObjectReference_To_v1alpha1_TypedObjectReference(in *core.TypedObjectReference, out *TypedObjectReference, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Kind = in.Kind + if err := Convert_core_ObjectReference_To_v1alpha1_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + return nil +} + +// Convert_core_TypedObjectReference_To_v1alpha1_TypedObjectReference is an autogenerated conversion function. +func Convert_core_TypedObjectReference_To_v1alpha1_TypedObjectReference(in *core.TypedObjectReference, out *TypedObjectReference, s conversion.Scope) error { + return autoConvert_core_TypedObjectReference_To_v1alpha1_TypedObjectReference(in, out, s) +} + +func autoConvert_v1alpha1_VersionedNamedObjectReference_To_core_VersionedNamedObjectReference(in *VersionedNamedObjectReference, out *core.VersionedNamedObjectReference, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_v1alpha1_VersionedObjectReference_To_core_VersionedObjectReference(&in.Reference, &out.Reference, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VersionedNamedObjectReference_To_core_VersionedNamedObjectReference is an autogenerated conversion function. +func Convert_v1alpha1_VersionedNamedObjectReference_To_core_VersionedNamedObjectReference(in *VersionedNamedObjectReference, out *core.VersionedNamedObjectReference, s conversion.Scope) error { + return autoConvert_v1alpha1_VersionedNamedObjectReference_To_core_VersionedNamedObjectReference(in, out, s) +} + +func autoConvert_core_VersionedNamedObjectReference_To_v1alpha1_VersionedNamedObjectReference(in *core.VersionedNamedObjectReference, out *VersionedNamedObjectReference, s conversion.Scope) error { + out.Name = in.Name + if err := Convert_core_VersionedObjectReference_To_v1alpha1_VersionedObjectReference(&in.Reference, &out.Reference, s); err != nil { + return err + } + return nil +} + +// Convert_core_VersionedNamedObjectReference_To_v1alpha1_VersionedNamedObjectReference is an autogenerated conversion function. +func Convert_core_VersionedNamedObjectReference_To_v1alpha1_VersionedNamedObjectReference(in *core.VersionedNamedObjectReference, out *VersionedNamedObjectReference, s conversion.Scope) error { + return autoConvert_core_VersionedNamedObjectReference_To_v1alpha1_VersionedNamedObjectReference(in, out, s) +} + +func autoConvert_v1alpha1_VersionedObjectReference_To_core_VersionedObjectReference(in *VersionedObjectReference, out *core.VersionedObjectReference, s conversion.Scope) error { + if err := Convert_v1alpha1_ObjectReference_To_core_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +// Convert_v1alpha1_VersionedObjectReference_To_core_VersionedObjectReference is an autogenerated conversion function. +func Convert_v1alpha1_VersionedObjectReference_To_core_VersionedObjectReference(in *VersionedObjectReference, out *core.VersionedObjectReference, s conversion.Scope) error { + return autoConvert_v1alpha1_VersionedObjectReference_To_core_VersionedObjectReference(in, out, s) +} + +func autoConvert_core_VersionedObjectReference_To_v1alpha1_VersionedObjectReference(in *core.VersionedObjectReference, out *VersionedObjectReference, s conversion.Scope) error { + if err := Convert_core_ObjectReference_To_v1alpha1_ObjectReference(&in.ObjectReference, &out.ObjectReference, s); err != nil { + return err + } + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +// Convert_core_VersionedObjectReference_To_v1alpha1_VersionedObjectReference is an autogenerated conversion function. +func Convert_core_VersionedObjectReference_To_v1alpha1_VersionedObjectReference(in *core.VersionedObjectReference, out *VersionedObjectReference, s conversion.Scope) error { + return autoConvert_core_VersionedObjectReference_To_v1alpha1_VersionedObjectReference(in, out, s) +} + +func autoConvert_v1alpha1_VersionedResourceReference_To_core_VersionedResourceReference(in *VersionedResourceReference, out *core.VersionedResourceReference, s conversion.Scope) error { + if err := Convert_v1alpha1_ResourceReference_To_core_ResourceReference(&in.ResourceReference, &out.ResourceReference, s); err != nil { + return err + } + out.Version = in.Version + return nil +} + +// Convert_v1alpha1_VersionedResourceReference_To_core_VersionedResourceReference is an autogenerated conversion function. +func Convert_v1alpha1_VersionedResourceReference_To_core_VersionedResourceReference(in *VersionedResourceReference, out *core.VersionedResourceReference, s conversion.Scope) error { + return autoConvert_v1alpha1_VersionedResourceReference_To_core_VersionedResourceReference(in, out, s) +} + +func autoConvert_core_VersionedResourceReference_To_v1alpha1_VersionedResourceReference(in *core.VersionedResourceReference, out *VersionedResourceReference, s conversion.Scope) error { + if err := Convert_core_ResourceReference_To_v1alpha1_ResourceReference(&in.ResourceReference, &out.ResourceReference, s); err != nil { + return err + } + out.Version = in.Version + return nil +} + +// Convert_core_VersionedResourceReference_To_v1alpha1_VersionedResourceReference is an autogenerated conversion function. +func Convert_core_VersionedResourceReference_To_v1alpha1_VersionedResourceReference(in *core.VersionedResourceReference, out *VersionedResourceReference, s conversion.Scope) error { + return autoConvert_core_VersionedResourceReference_To_v1alpha1_VersionedResourceReference(in, out, s) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..ca694164b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,2362 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AnyJSON) DeepCopyInto(out *AnyJSON) { + *out = *in + if in.RawMessage != nil { + in, out := &in.RawMessage, &out.RawMessage + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnyJSON. +func (in *AnyJSON) DeepCopy() *AnyJSON { + if in == nil { + return nil + } + out := new(AnyJSON) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Blueprint) DeepCopyInto(out *Blueprint) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.LocalTypes != nil { + in, out := &in.LocalTypes, &out.LocalTypes + *out = make(map[string]JSONSchemaDefinition, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Imports != nil { + in, out := &in.Imports, &out.Imports + *out = make(ImportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Exports != nil { + in, out := &in.Exports, &out.Exports + *out = make(ExportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Subinstallations != nil { + in, out := &in.Subinstallations, &out.Subinstallations + *out = make(SubinstallationTemplateList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SubinstallationExecutions != nil { + in, out := &in.SubinstallationExecutions, &out.SubinstallationExecutions + *out = make([]TemplateExecutor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DeployExecutions != nil { + in, out := &in.DeployExecutions, &out.DeployExecutions + *out = make([]TemplateExecutor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ExportExecutions != nil { + in, out := &in.ExportExecutions, &out.ExportExecutions + *out = make([]TemplateExecutor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Blueprint. +func (in *Blueprint) DeepCopy() *Blueprint { + if in == nil { + return nil + } + out := new(Blueprint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Blueprint) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlueprintDefinition) DeepCopyInto(out *BlueprintDefinition) { + *out = *in + if in.Reference != nil { + in, out := &in.Reference, &out.Reference + *out = new(RemoteBlueprintReference) + **out = **in + } + if in.Inline != nil { + in, out := &in.Inline, &out.Inline + *out = new(InlineBlueprint) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlueprintDefinition. +func (in *BlueprintDefinition) DeepCopy() *BlueprintDefinition { + if in == nil { + return nil + } + out := new(BlueprintDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlueprintStaticDataSource) DeepCopyInto(out *BlueprintStaticDataSource) { + *out = *in + in.Value.DeepCopyInto(&out.Value) + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + *out = new(StaticDataValueFrom) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlueprintStaticDataSource. +func (in *BlueprintStaticDataSource) DeepCopy() *BlueprintStaticDataSource { + if in == nil { + return nil + } + out := new(BlueprintStaticDataSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlueprintStaticDataValueFrom) DeepCopyInto(out *BlueprintStaticDataValueFrom) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlueprintStaticDataValueFrom. +func (in *BlueprintStaticDataValueFrom) DeepCopy() *BlueprintStaticDataValueFrom { + if in == nil { + return nil + } + out := new(BlueprintStaticDataValueFrom) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CDImportStatus) DeepCopyInto(out *CDImportStatus) { + *out = *in + if in.ComponentDescriptorRef != nil { + in, out := &in.ComponentDescriptorRef, &out.ComponentDescriptorRef + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.SourceRef != nil { + in, out := &in.SourceRef, &out.SourceRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDImportStatus. +func (in *CDImportStatus) DeepCopy() *CDImportStatus { + if in == nil { + return nil + } + out := new(CDImportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterRestConfig) DeepCopyInto(out *ClusterRestConfig) { + *out = *in + in.TLSClientConfig.DeepCopyInto(&out.TLSClientConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRestConfig. +func (in *ClusterRestConfig) DeepCopy() *ClusterRestConfig { + if in == nil { + return nil + } + out := new(ClusterRestConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptorDefinition) DeepCopyInto(out *ComponentDescriptorDefinition) { + *out = *in + if in.Reference != nil { + in, out := &in.Reference, &out.Reference + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.Inline != nil { + in, out := &in.Inline, &out.Inline + *out = new(v2.ComponentDescriptor) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptorDefinition. +func (in *ComponentDescriptorDefinition) DeepCopy() *ComponentDescriptorDefinition { + if in == nil { + return nil + } + out := new(ComponentDescriptorDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptorImport) DeepCopyInto(out *ComponentDescriptorImport) { + *out = *in + if in.Ref != nil { + in, out := &in.Ref, &out.Ref + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(SecretReference) + **out = **in + } + if in.ConfigMapRef != nil { + in, out := &in.ConfigMapRef, &out.ConfigMapRef + *out = new(ConfigMapReference) + **out = **in + } + if in.List != nil { + in, out := &in.List, &out.List + *out = make([]ComponentDescriptorImportData, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptorImport. +func (in *ComponentDescriptorImport) DeepCopy() *ComponentDescriptorImport { + if in == nil { + return nil + } + out := new(ComponentDescriptorImport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptorImportData) DeepCopyInto(out *ComponentDescriptorImportData) { + *out = *in + if in.Ref != nil { + in, out := &in.Ref, &out.Ref + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(SecretReference) + **out = **in + } + if in.ConfigMapRef != nil { + in, out := &in.ConfigMapRef, &out.ConfigMapRef + *out = new(ConfigMapReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptorImportData. +func (in *ComponentDescriptorImportData) DeepCopy() *ComponentDescriptorImportData { + if in == nil { + return nil + } + out := new(ComponentDescriptorImportData) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptorReference) DeepCopyInto(out *ComponentDescriptorReference) { + *out = *in + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptorReference. +func (in *ComponentDescriptorReference) DeepCopy() *ComponentDescriptorReference { + if in == nil { + return nil + } + out := new(ComponentDescriptorReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwrite) DeepCopyInto(out *ComponentOverwrite) { + *out = *in + in.Component.DeepCopyInto(&out.Component) + in.Target.DeepCopyInto(&out.Target) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwrite. +func (in *ComponentOverwrite) DeepCopy() *ComponentOverwrite { + if in == nil { + return nil + } + out := new(ComponentOverwrite) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ComponentOverwriteList) DeepCopyInto(out *ComponentOverwriteList) { + { + in := &in + *out = make(ComponentOverwriteList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwriteList. +func (in ComponentOverwriteList) DeepCopy() ComponentOverwriteList { + if in == nil { + return nil + } + out := new(ComponentOverwriteList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwriteReference) DeepCopyInto(out *ComponentOverwriteReference) { + *out = *in + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwriteReference. +func (in *ComponentOverwriteReference) DeepCopy() *ComponentOverwriteReference { + if in == nil { + return nil + } + out := new(ComponentOverwriteReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwrites) DeepCopyInto(out *ComponentOverwrites) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Overwrites != nil { + in, out := &in.Overwrites, &out.Overwrites + *out = make(ComponentOverwriteList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwrites. +func (in *ComponentOverwrites) DeepCopy() *ComponentOverwrites { + if in == nil { + return nil + } + out := new(ComponentOverwrites) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ComponentOverwrites) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwritesList) DeepCopyInto(out *ComponentOverwritesList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ComponentOverwrites, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwritesList. +func (in *ComponentOverwritesList) DeepCopy() *ComponentOverwritesList { + if in == nil { + return nil + } + out := new(ComponentOverwritesList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ComponentOverwritesList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + if in.Codes != nil { + in, out := &in.Codes, &out.Codes + *out = make([]ErrorCode, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigMapReference) DeepCopyInto(out *ConfigMapReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapReference. +func (in *ConfigMapReference) DeepCopy() *ConfigMapReference { + if in == nil { + return nil + } + out := new(ConfigMapReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Context) DeepCopyInto(out *Context) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]v1.LocalObjectReference, len(*in)) + copy(*out, *in) + } + if in.Configurations != nil { + in, out := &in.Configurations, &out.Configurations + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Context. +func (in *Context) DeepCopy() *Context { + if in == nil { + return nil + } + out := new(Context) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Context) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContextList) DeepCopyInto(out *ContextList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Context, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContextList. +func (in *ContextList) DeepCopy() *ContextList { + if in == nil { + return nil + } + out := new(ContextList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ContextList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataExport) DeepCopyInto(out *DataExport) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataExport. +func (in *DataExport) DeepCopy() *DataExport { + if in == nil { + return nil + } + out := new(DataExport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataImport) DeepCopyInto(out *DataImport) { + *out = *in + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(SecretReference) + **out = **in + } + if in.ConfigMapRef != nil { + in, out := &in.ConfigMapRef, &out.ConfigMapRef + *out = new(ConfigMapReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataImport. +func (in *DataImport) DeepCopy() *DataImport { + if in == nil { + return nil + } + out := new(DataImport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataObject) DeepCopyInto(out *DataObject) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Data.DeepCopyInto(&out.Data) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataObject. +func (in *DataObject) DeepCopy() *DataObject { + if in == nil { + return nil + } + out := new(DataObject) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DataObject) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataObjectList) DeepCopyInto(out *DataObjectList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DataObject, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataObjectList. +func (in *DataObjectList) DeepCopy() *DataObjectList { + if in == nil { + return nil + } + out := new(DataObjectList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DataObjectList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Default) DeepCopyInto(out *Default) { + *out = *in + in.Value.DeepCopyInto(&out.Value) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Default. +func (in *Default) DeepCopy() *Default { + if in == nil { + return nil + } + out := new(Default) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItem) DeepCopyInto(out *DeployItem) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItem. +func (in *DeployItem) DeepCopy() *DeployItem { + if in == nil { + return nil + } + out := new(DeployItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeployItem) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemList) DeepCopyInto(out *DeployItemList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DeployItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemList. +func (in *DeployItemList) DeepCopy() *DeployItemList { + if in == nil { + return nil + } + out := new(DeployItemList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeployItemList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemSpec) DeepCopyInto(out *DeployItemSpec) { + *out = *in + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(ObjectReference) + **out = **in + } + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemSpec. +func (in *DeployItemSpec) DeepCopy() *DeployItemSpec { + if in == nil { + return nil + } + out := new(DeployItemSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemStatus) DeepCopyInto(out *DeployItemStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.LastReconcileTime != nil { + in, out := &in.LastReconcileTime, &out.LastReconcileTime + *out = (*in).DeepCopy() + } + out.Deployer = in.Deployer + if in.ProviderStatus != nil { + in, out := &in.ProviderStatus, &out.ProviderStatus + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.ExportReference != nil { + in, out := &in.ExportReference, &out.ExportReference + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemStatus. +func (in *DeployItemStatus) DeepCopy() *DeployItemStatus { + if in == nil { + return nil + } + out := new(DeployItemStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemTemplate) DeepCopyInto(out *DeployItemTemplate) { + *out = *in + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(ObjectReference) + **out = **in + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.DependsOn != nil { + in, out := &in.DependsOn, &out.DependsOn + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemTemplate. +func (in *DeployItemTemplate) DeepCopy() *DeployItemTemplate { + if in == nil { + return nil + } + out := new(DeployItemTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in DeployItemTemplateList) DeepCopyInto(out *DeployItemTemplateList) { + { + in := &in + *out = make(DeployItemTemplateList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemTemplateList. +func (in DeployItemTemplateList) DeepCopy() DeployItemTemplateList { + if in == nil { + return nil + } + out := new(DeployItemTemplateList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerInformation) DeepCopyInto(out *DeployerInformation) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerInformation. +func (in *DeployerInformation) DeepCopy() *DeployerInformation { + if in == nil { + return nil + } + out := new(DeployerInformation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerInstallationTemplate) DeepCopyInto(out *DeployerInstallationTemplate) { + *out = *in + if in.ComponentDescriptor != nil { + in, out := &in.ComponentDescriptor, &out.ComponentDescriptor + *out = new(ComponentDescriptorDefinition) + (*in).DeepCopyInto(*out) + } + in.Blueprint.DeepCopyInto(&out.Blueprint) + in.Imports.DeepCopyInto(&out.Imports) + if in.ImportDataMappings != nil { + in, out := &in.ImportDataMappings, &out.ImportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerInstallationTemplate. +func (in *DeployerInstallationTemplate) DeepCopy() *DeployerInstallationTemplate { + if in == nil { + return nil + } + out := new(DeployerInstallationTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerRegistration) DeepCopyInto(out *DeployerRegistration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerRegistration. +func (in *DeployerRegistration) DeepCopy() *DeployerRegistration { + if in == nil { + return nil + } + out := new(DeployerRegistration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeployerRegistration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerRegistrationList) DeepCopyInto(out *DeployerRegistrationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DeployerRegistration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerRegistrationList. +func (in *DeployerRegistrationList) DeepCopy() *DeployerRegistrationList { + if in == nil { + return nil + } + out := new(DeployerRegistrationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeployerRegistrationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerRegistrationSpec) DeepCopyInto(out *DeployerRegistrationSpec) { + *out = *in + if in.DeployItemTypes != nil { + in, out := &in.DeployItemTypes, &out.DeployItemTypes + *out = make([]DeployItemType, len(*in)) + copy(*out, *in) + } + in.InstallationTemplate.DeepCopyInto(&out.InstallationTemplate) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerRegistrationSpec. +func (in *DeployerRegistrationSpec) DeepCopy() *DeployerRegistrationSpec { + if in == nil { + return nil + } + out := new(DeployerRegistrationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Duration) DeepCopyInto(out *Duration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Duration. +func (in *Duration) DeepCopy() *Duration { + if in == nil { + return nil + } + out := new(Duration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Environment) DeepCopyInto(out *Environment) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Environment. +func (in *Environment) DeepCopy() *Environment { + if in == nil { + return nil + } + out := new(Environment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Environment) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvironmentList) DeepCopyInto(out *EnvironmentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Environment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentList. +func (in *EnvironmentList) DeepCopy() *EnvironmentList { + if in == nil { + return nil + } + out := new(EnvironmentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EnvironmentList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvironmentSpec) DeepCopyInto(out *EnvironmentSpec) { + *out = *in + in.HostTarget.DeepCopyInto(&out.HostTarget) + in.LandscaperClusterRestConfig.DeepCopyInto(&out.LandscaperClusterRestConfig) + if in.TargetSelectors != nil { + in, out := &in.TargetSelectors, &out.TargetSelectors + *out = make([]TargetSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentSpec. +func (in *EnvironmentSpec) DeepCopy() *EnvironmentSpec { + if in == nil { + return nil + } + out := new(EnvironmentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Error) DeepCopyInto(out *Error) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + if in.Codes != nil { + in, out := &in.Codes, &out.Codes + *out = make([]ErrorCode, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Error. +func (in *Error) DeepCopy() *Error { + if in == nil { + return nil + } + out := new(Error) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Execution) DeepCopyInto(out *Execution) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Execution. +func (in *Execution) DeepCopy() *Execution { + if in == nil { + return nil + } + out := new(Execution) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Execution) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionGeneration) DeepCopyInto(out *ExecutionGeneration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionGeneration. +func (in *ExecutionGeneration) DeepCopy() *ExecutionGeneration { + if in == nil { + return nil + } + out := new(ExecutionGeneration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionList) DeepCopyInto(out *ExecutionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Execution, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionList. +func (in *ExecutionList) DeepCopy() *ExecutionList { + if in == nil { + return nil + } + out := new(ExecutionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ExecutionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionSpec) DeepCopyInto(out *ExecutionSpec) { + *out = *in + if in.DeployItems != nil { + in, out := &in.DeployItems, &out.DeployItems + *out = make(DeployItemTemplateList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionSpec. +func (in *ExecutionSpec) DeepCopy() *ExecutionSpec { + if in == nil { + return nil + } + out := new(ExecutionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionStatus) DeepCopyInto(out *ExecutionStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.ExportReference != nil { + in, out := &in.ExportReference, &out.ExportReference + *out = new(ObjectReference) + **out = **in + } + if in.DeployItemReferences != nil { + in, out := &in.DeployItemReferences, &out.DeployItemReferences + *out = make([]VersionedNamedObjectReference, len(*in)) + copy(*out, *in) + } + if in.ExecutionGenerations != nil { + in, out := &in.ExecutionGenerations, &out.ExecutionGenerations + *out = make([]ExecutionGeneration, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionStatus. +func (in *ExecutionStatus) DeepCopy() *ExecutionStatus { + if in == nil { + return nil + } + out := new(ExecutionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExportDefinition) DeepCopyInto(out *ExportDefinition) { + *out = *in + in.FieldValueDefinition.DeepCopyInto(&out.FieldValueDefinition) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportDefinition. +func (in *ExportDefinition) DeepCopy() *ExportDefinition { + if in == nil { + return nil + } + out := new(ExportDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ExportDefinitionList) DeepCopyInto(out *ExportDefinitionList) { + { + in := &in + *out = make(ExportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportDefinitionList. +func (in ExportDefinitionList) DeepCopy() ExportDefinitionList { + if in == nil { + return nil + } + out := new(ExportDefinitionList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FieldValueDefinition) DeepCopyInto(out *FieldValueDefinition) { + *out = *in + if in.Schema != nil { + in, out := &in.Schema, &out.Schema + *out = new(JSONSchemaDefinition) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FieldValueDefinition. +func (in *FieldValueDefinition) DeepCopy() *FieldValueDefinition { + if in == nil { + return nil + } + out := new(FieldValueDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImportDefinition) DeepCopyInto(out *ImportDefinition) { + *out = *in + in.FieldValueDefinition.DeepCopyInto(&out.FieldValueDefinition) + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = new(bool) + **out = **in + } + in.Default.DeepCopyInto(&out.Default) + if in.ConditionalImports != nil { + in, out := &in.ConditionalImports, &out.ConditionalImports + *out = make(ImportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportDefinition. +func (in *ImportDefinition) DeepCopy() *ImportDefinition { + if in == nil { + return nil + } + out := new(ImportDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ImportDefinitionList) DeepCopyInto(out *ImportDefinitionList) { + { + in := &in + *out = make(ImportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportDefinitionList. +func (in ImportDefinitionList) DeepCopy() ImportDefinitionList { + if in == nil { + return nil + } + out := new(ImportDefinitionList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImportStatus) DeepCopyInto(out *ImportStatus) { + *out = *in + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]TargetImportStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ComponentDescriptorRef != nil { + in, out := &in.ComponentDescriptorRef, &out.ComponentDescriptorRef + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.ComponentDescriptors != nil { + in, out := &in.ComponentDescriptors, &out.ComponentDescriptors + *out = make([]CDImportStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SourceRef != nil { + in, out := &in.SourceRef, &out.SourceRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportStatus. +func (in *ImportStatus) DeepCopy() *ImportStatus { + if in == nil { + return nil + } + out := new(ImportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InlineBlueprint) DeepCopyInto(out *InlineBlueprint) { + *out = *in + in.Filesystem.DeepCopyInto(&out.Filesystem) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InlineBlueprint. +func (in *InlineBlueprint) DeepCopy() *InlineBlueprint { + if in == nil { + return nil + } + out := new(InlineBlueprint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Installation) DeepCopyInto(out *Installation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Installation. +func (in *Installation) DeepCopy() *Installation { + if in == nil { + return nil + } + out := new(Installation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Installation) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationExports) DeepCopyInto(out *InstallationExports) { + *out = *in + if in.Data != nil { + in, out := &in.Data, &out.Data + *out = make([]DataExport, len(*in)) + copy(*out, *in) + } + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]TargetExport, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationExports. +func (in *InstallationExports) DeepCopy() *InstallationExports { + if in == nil { + return nil + } + out := new(InstallationExports) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationImports) DeepCopyInto(out *InstallationImports) { + *out = *in + if in.Data != nil { + in, out := &in.Data, &out.Data + *out = make([]DataImport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]TargetImport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ComponentDescriptors != nil { + in, out := &in.ComponentDescriptors, &out.ComponentDescriptors + *out = make([]ComponentDescriptorImport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationImports. +func (in *InstallationImports) DeepCopy() *InstallationImports { + if in == nil { + return nil + } + out := new(InstallationImports) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationList) DeepCopyInto(out *InstallationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Installation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationList. +func (in *InstallationList) DeepCopy() *InstallationList { + if in == nil { + return nil + } + out := new(InstallationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationSpec) DeepCopyInto(out *InstallationSpec) { + *out = *in + if in.ComponentDescriptor != nil { + in, out := &in.ComponentDescriptor, &out.ComponentDescriptor + *out = new(ComponentDescriptorDefinition) + (*in).DeepCopyInto(*out) + } + in.Blueprint.DeepCopyInto(&out.Blueprint) + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + in.Imports.DeepCopyInto(&out.Imports) + if in.ImportDataMappings != nil { + in, out := &in.ImportDataMappings, &out.ImportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + in.Exports.DeepCopyInto(&out.Exports) + if in.ExportDataMappings != nil { + in, out := &in.ExportDataMappings, &out.ExportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationSpec. +func (in *InstallationSpec) DeepCopy() *InstallationSpec { + if in == nil { + return nil + } + out := new(InstallationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationStatus) DeepCopyInto(out *InstallationStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.Imports != nil { + in, out := &in.Imports, &out.Imports + *out = make([]ImportStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.InstallationReferences != nil { + in, out := &in.InstallationReferences, &out.InstallationReferences + *out = make([]NamedObjectReference, len(*in)) + copy(*out, *in) + } + if in.ExecutionReference != nil { + in, out := &in.ExecutionReference, &out.ExecutionReference + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationStatus. +func (in *InstallationStatus) DeepCopy() *InstallationStatus { + if in == nil { + return nil + } + out := new(InstallationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationTemplate) DeepCopyInto(out *InstallationTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Blueprint.DeepCopyInto(&out.Blueprint) + in.Imports.DeepCopyInto(&out.Imports) + if in.ImportDataMappings != nil { + in, out := &in.ImportDataMappings, &out.ImportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + in.Exports.DeepCopyInto(&out.Exports) + if in.ExportDataMappings != nil { + in, out := &in.ExportDataMappings, &out.ExportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationTemplate. +func (in *InstallationTemplate) DeepCopy() *InstallationTemplate { + if in == nil { + return nil + } + out := new(InstallationTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallationTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationTemplateBlueprintDefinition) DeepCopyInto(out *InstallationTemplateBlueprintDefinition) { + *out = *in + in.Filesystem.DeepCopyInto(&out.Filesystem) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationTemplateBlueprintDefinition. +func (in *InstallationTemplateBlueprintDefinition) DeepCopy() *InstallationTemplateBlueprintDefinition { + if in == nil { + return nil + } + out := new(InstallationTemplateBlueprintDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in InstallationTemplateList) DeepCopyInto(out *InstallationTemplateList) { + { + in := &in + *out = make(InstallationTemplateList, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstallationTemplate) + (*in).DeepCopyInto(*out) + } + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationTemplateList. +func (in InstallationTemplateList) DeepCopy() InstallationTemplateList { + if in == nil { + return nil + } + out := new(InstallationTemplateList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JSONSchemaDefinition) DeepCopyInto(out *JSONSchemaDefinition) { + *out = *in + if in.RawMessage != nil { + in, out := &in.RawMessage, &out.RawMessage + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSchemaDefinition. +func (in *JSONSchemaDefinition) DeepCopy() *JSONSchemaDefinition { + if in == nil { + return nil + } + out := new(JSONSchemaDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubernetesClusterTargetConfig) DeepCopyInto(out *KubernetesClusterTargetConfig) { + *out = *in + in.Kubeconfig.DeepCopyInto(&out.Kubeconfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesClusterTargetConfig. +func (in *KubernetesClusterTargetConfig) DeepCopy() *KubernetesClusterTargetConfig { + if in == nil { + return nil + } + out := new(KubernetesClusterTargetConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamedObjectReference) DeepCopyInto(out *NamedObjectReference) { + *out = *in + out.Reference = in.Reference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedObjectReference. +func (in *NamedObjectReference) DeepCopy() *NamedObjectReference { + if in == nil { + return nil + } + out := new(NamedObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectReference) DeepCopyInto(out *ObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference. +func (in *ObjectReference) DeepCopy() *ObjectReference { + if in == nil { + return nil + } + out := new(ObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteBlueprintReference) DeepCopyInto(out *RemoteBlueprintReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteBlueprintReference. +func (in *RemoteBlueprintReference) DeepCopy() *RemoteBlueprintReference { + if in == nil { + return nil + } + out := new(RemoteBlueprintReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Requirement) DeepCopyInto(out *Requirement) { + *out = *in + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Requirement. +func (in *Requirement) DeepCopy() *Requirement { + if in == nil { + return nil + } + out := new(Requirement) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceReference) DeepCopyInto(out *ResourceReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceReference. +func (in *ResourceReference) DeepCopy() *ResourceReference { + if in == nil { + return nil + } + out := new(ResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretLabelSelectorRef) DeepCopyInto(out *SecretLabelSelectorRef) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretLabelSelectorRef. +func (in *SecretLabelSelectorRef) DeepCopy() *SecretLabelSelectorRef { + if in == nil { + return nil + } + out := new(SecretLabelSelectorRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretReference) DeepCopyInto(out *SecretReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference. +func (in *SecretReference) DeepCopy() *SecretReference { + if in == nil { + return nil + } + out := new(SecretReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StaticDataSource) DeepCopyInto(out *StaticDataSource) { + *out = *in + in.Value.DeepCopyInto(&out.Value) + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + *out = new(StaticDataValueFrom) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StaticDataSource. +func (in *StaticDataSource) DeepCopy() *StaticDataSource { + if in == nil { + return nil + } + out := new(StaticDataSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StaticDataValueFrom) DeepCopyInto(out *StaticDataValueFrom) { + *out = *in + if in.SecretKeyRef != nil { + in, out := &in.SecretKeyRef, &out.SecretKeyRef + *out = new(v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.SecretLabelSelector != nil { + in, out := &in.SecretLabelSelector, &out.SecretLabelSelector + *out = new(SecretLabelSelectorRef) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StaticDataValueFrom. +func (in *StaticDataValueFrom) DeepCopy() *StaticDataValueFrom { + if in == nil { + return nil + } + out := new(StaticDataValueFrom) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubinstallationTemplate) DeepCopyInto(out *SubinstallationTemplate) { + *out = *in + if in.InstallationTemplate != nil { + in, out := &in.InstallationTemplate, &out.InstallationTemplate + *out = new(InstallationTemplate) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubinstallationTemplate. +func (in *SubinstallationTemplate) DeepCopy() *SubinstallationTemplate { + if in == nil { + return nil + } + out := new(SubinstallationTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in SubinstallationTemplateList) DeepCopyInto(out *SubinstallationTemplateList) { + { + in := &in + *out = make(SubinstallationTemplateList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubinstallationTemplateList. +func (in SubinstallationTemplateList) DeepCopy() SubinstallationTemplateList { + if in == nil { + return nil + } + out := new(SubinstallationTemplateList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TLSClientConfig) DeepCopyInto(out *TLSClientConfig) { + *out = *in + if in.CAData != nil { + in, out := &in.CAData, &out.CAData + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.NextProtos != nil { + in, out := &in.NextProtos, &out.NextProtos + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSClientConfig. +func (in *TLSClientConfig) DeepCopy() *TLSClientConfig { + if in == nil { + return nil + } + out := new(TLSClientConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Target) DeepCopyInto(out *Target) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Target. +func (in *Target) DeepCopy() *Target { + if in == nil { + return nil + } + out := new(Target) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Target) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetExport) DeepCopyInto(out *TargetExport) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetExport. +func (in *TargetExport) DeepCopy() *TargetExport { + if in == nil { + return nil + } + out := new(TargetExport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetImport) DeepCopyInto(out *TargetImport) { + *out = *in + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetImport. +func (in *TargetImport) DeepCopy() *TargetImport { + if in == nil { + return nil + } + out := new(TargetImport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetImportStatus) DeepCopyInto(out *TargetImportStatus) { + *out = *in + if in.SourceRef != nil { + in, out := &in.SourceRef, &out.SourceRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetImportStatus. +func (in *TargetImportStatus) DeepCopy() *TargetImportStatus { + if in == nil { + return nil + } + out := new(TargetImportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetList) DeepCopyInto(out *TargetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Target, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetList. +func (in *TargetList) DeepCopy() *TargetList { + if in == nil { + return nil + } + out := new(TargetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TargetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetSelector) DeepCopyInto(out *TargetSelector) { + *out = *in + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make([]Requirement, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make([]Requirement, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetSelector. +func (in *TargetSelector) DeepCopy() *TargetSelector { + if in == nil { + return nil + } + out := new(TargetSelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetSpec) DeepCopyInto(out *TargetSpec) { + *out = *in + in.Configuration.DeepCopyInto(&out.Configuration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetSpec. +func (in *TargetSpec) DeepCopy() *TargetSpec { + if in == nil { + return nil + } + out := new(TargetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetTemplate) DeepCopyInto(out *TargetTemplate) { + *out = *in + in.TargetSpec.DeepCopyInto(&out.TargetSpec) + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetTemplate. +func (in *TargetTemplate) DeepCopy() *TargetTemplate { + if in == nil { + return nil + } + out := new(TargetTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateExecutor) DeepCopyInto(out *TemplateExecutor) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateExecutor. +func (in *TemplateExecutor) DeepCopy() *TemplateExecutor { + if in == nil { + return nil + } + out := new(TemplateExecutor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TypedObjectReference) DeepCopyInto(out *TypedObjectReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedObjectReference. +func (in *TypedObjectReference) DeepCopy() *TypedObjectReference { + if in == nil { + return nil + } + out := new(TypedObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ValueRef) DeepCopyInto(out *ValueRef) { + *out = *in + if in.StrVal != nil { + in, out := &in.StrVal, &out.StrVal + *out = new(string) + **out = **in + } + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(SecretReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValueRef. +func (in *ValueRef) DeepCopy() *ValueRef { + if in == nil { + return nil + } + out := new(ValueRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VersionedNamedObjectReference) DeepCopyInto(out *VersionedNamedObjectReference) { + *out = *in + out.Reference = in.Reference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedNamedObjectReference. +func (in *VersionedNamedObjectReference) DeepCopy() *VersionedNamedObjectReference { + if in == nil { + return nil + } + out := new(VersionedNamedObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VersionedObjectReference) DeepCopyInto(out *VersionedObjectReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedObjectReference. +func (in *VersionedObjectReference) DeepCopy() *VersionedObjectReference { + if in == nil { + return nil + } + out := new(VersionedObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VersionedResourceReference) DeepCopyInto(out *VersionedResourceReference) { + *out = *in + out.ResourceReference = in.ResourceReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedResourceReference. +func (in *VersionedResourceReference) DeepCopy() *VersionedResourceReference { + if in == nil { + return nil + } + out := new(VersionedResourceReference) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.defaults.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.defaults.go new file mode 100644 index 000000000..fe72db3b7 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,66 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&Blueprint{}, func(obj interface{}) { SetObjectDefaults_Blueprint(obj.(*Blueprint)) }) + scheme.AddTypeDefaultingFunc(&DeployItem{}, func(obj interface{}) { SetObjectDefaults_DeployItem(obj.(*DeployItem)) }) + scheme.AddTypeDefaultingFunc(&DeployItemList{}, func(obj interface{}) { SetObjectDefaults_DeployItemList(obj.(*DeployItemList)) }) + scheme.AddTypeDefaultingFunc(&Execution{}, func(obj interface{}) { SetObjectDefaults_Execution(obj.(*Execution)) }) + scheme.AddTypeDefaultingFunc(&ExecutionList{}, func(obj interface{}) { SetObjectDefaults_ExecutionList(obj.(*ExecutionList)) }) + scheme.AddTypeDefaultingFunc(&Installation{}, func(obj interface{}) { SetObjectDefaults_Installation(obj.(*Installation)) }) + scheme.AddTypeDefaultingFunc(&InstallationList{}, func(obj interface{}) { SetObjectDefaults_InstallationList(obj.(*InstallationList)) }) + return nil +} + +func SetObjectDefaults_Blueprint(in *Blueprint) { + SetDefaults_Blueprint(in) +} + +func SetObjectDefaults_DeployItem(in *DeployItem) { + SetDefaults_DeployItem(in) +} + +func SetObjectDefaults_DeployItemList(in *DeployItemList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_DeployItem(a) + } +} + +func SetObjectDefaults_Execution(in *Execution) { + SetDefaults_Execution(in) +} + +func SetObjectDefaults_ExecutionList(in *ExecutionList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_Execution(a) + } +} + +func SetObjectDefaults_Installation(in *Installation) { + SetDefaults_Installation(in) +} + +func SetObjectDefaults_InstallationList(in *InstallationList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_Installation(a) + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/core/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/core/zz_generated.deepcopy.go new file mode 100644 index 000000000..456c8d9c6 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/core/zz_generated.deepcopy.go @@ -0,0 +1,2319 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package core + +import ( + json "encoding/json" + + v2 "github.com/gardener/component-spec/bindings-go/apis/v2" + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AnyJSON) DeepCopyInto(out *AnyJSON) { + *out = *in + if in.RawMessage != nil { + in, out := &in.RawMessage, &out.RawMessage + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnyJSON. +func (in *AnyJSON) DeepCopy() *AnyJSON { + if in == nil { + return nil + } + out := new(AnyJSON) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Blueprint) DeepCopyInto(out *Blueprint) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.LocalTypes != nil { + in, out := &in.LocalTypes, &out.LocalTypes + *out = make(map[string]JSONSchemaDefinition, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Imports != nil { + in, out := &in.Imports, &out.Imports + *out = make(ImportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Exports != nil { + in, out := &in.Exports, &out.Exports + *out = make(ExportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Subinstallations != nil { + in, out := &in.Subinstallations, &out.Subinstallations + *out = make(SubinstallationTemplateList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SubinstallationExecutions != nil { + in, out := &in.SubinstallationExecutions, &out.SubinstallationExecutions + *out = make([]TemplateExecutor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DeployExecutions != nil { + in, out := &in.DeployExecutions, &out.DeployExecutions + *out = make([]TemplateExecutor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ExportExecutions != nil { + in, out := &in.ExportExecutions, &out.ExportExecutions + *out = make([]TemplateExecutor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Blueprint. +func (in *Blueprint) DeepCopy() *Blueprint { + if in == nil { + return nil + } + out := new(Blueprint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Blueprint) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlueprintDefinition) DeepCopyInto(out *BlueprintDefinition) { + *out = *in + if in.Reference != nil { + in, out := &in.Reference, &out.Reference + *out = new(RemoteBlueprintReference) + **out = **in + } + if in.Inline != nil { + in, out := &in.Inline, &out.Inline + *out = new(InlineBlueprint) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlueprintDefinition. +func (in *BlueprintDefinition) DeepCopy() *BlueprintDefinition { + if in == nil { + return nil + } + out := new(BlueprintDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlueprintStaticDataSource) DeepCopyInto(out *BlueprintStaticDataSource) { + *out = *in + in.Value.DeepCopyInto(&out.Value) + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + *out = new(StaticDataValueFrom) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlueprintStaticDataSource. +func (in *BlueprintStaticDataSource) DeepCopy() *BlueprintStaticDataSource { + if in == nil { + return nil + } + out := new(BlueprintStaticDataSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlueprintStaticDataValueFrom) DeepCopyInto(out *BlueprintStaticDataValueFrom) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlueprintStaticDataValueFrom. +func (in *BlueprintStaticDataValueFrom) DeepCopy() *BlueprintStaticDataValueFrom { + if in == nil { + return nil + } + out := new(BlueprintStaticDataValueFrom) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CDImportStatus) DeepCopyInto(out *CDImportStatus) { + *out = *in + if in.ComponentDescriptorRef != nil { + in, out := &in.ComponentDescriptorRef, &out.ComponentDescriptorRef + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.SourceRef != nil { + in, out := &in.SourceRef, &out.SourceRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDImportStatus. +func (in *CDImportStatus) DeepCopy() *CDImportStatus { + if in == nil { + return nil + } + out := new(CDImportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterRestConfig) DeepCopyInto(out *ClusterRestConfig) { + *out = *in + in.TLSClientConfig.DeepCopyInto(&out.TLSClientConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRestConfig. +func (in *ClusterRestConfig) DeepCopy() *ClusterRestConfig { + if in == nil { + return nil + } + out := new(ClusterRestConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptorDefinition) DeepCopyInto(out *ComponentDescriptorDefinition) { + *out = *in + if in.Reference != nil { + in, out := &in.Reference, &out.Reference + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.Inline != nil { + in, out := &in.Inline, &out.Inline + *out = new(v2.ComponentDescriptor) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptorDefinition. +func (in *ComponentDescriptorDefinition) DeepCopy() *ComponentDescriptorDefinition { + if in == nil { + return nil + } + out := new(ComponentDescriptorDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptorImport) DeepCopyInto(out *ComponentDescriptorImport) { + *out = *in + if in.Ref != nil { + in, out := &in.Ref, &out.Ref + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(SecretReference) + **out = **in + } + if in.ConfigMapRef != nil { + in, out := &in.ConfigMapRef, &out.ConfigMapRef + *out = new(ConfigMapReference) + **out = **in + } + if in.List != nil { + in, out := &in.List, &out.List + *out = make([]ComponentDescriptorImportData, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptorImport. +func (in *ComponentDescriptorImport) DeepCopy() *ComponentDescriptorImport { + if in == nil { + return nil + } + out := new(ComponentDescriptorImport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptorImportData) DeepCopyInto(out *ComponentDescriptorImportData) { + *out = *in + if in.Ref != nil { + in, out := &in.Ref, &out.Ref + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(SecretReference) + **out = **in + } + if in.ConfigMapRef != nil { + in, out := &in.ConfigMapRef, &out.ConfigMapRef + *out = new(ConfigMapReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptorImportData. +func (in *ComponentDescriptorImportData) DeepCopy() *ComponentDescriptorImportData { + if in == nil { + return nil + } + out := new(ComponentDescriptorImportData) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentDescriptorReference) DeepCopyInto(out *ComponentDescriptorReference) { + *out = *in + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentDescriptorReference. +func (in *ComponentDescriptorReference) DeepCopy() *ComponentDescriptorReference { + if in == nil { + return nil + } + out := new(ComponentDescriptorReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwrite) DeepCopyInto(out *ComponentOverwrite) { + *out = *in + in.Component.DeepCopyInto(&out.Component) + in.Target.DeepCopyInto(&out.Target) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwrite. +func (in *ComponentOverwrite) DeepCopy() *ComponentOverwrite { + if in == nil { + return nil + } + out := new(ComponentOverwrite) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ComponentOverwriteList) DeepCopyInto(out *ComponentOverwriteList) { + { + in := &in + *out = make(ComponentOverwriteList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwriteList. +func (in ComponentOverwriteList) DeepCopy() ComponentOverwriteList { + if in == nil { + return nil + } + out := new(ComponentOverwriteList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwriteReference) DeepCopyInto(out *ComponentOverwriteReference) { + *out = *in + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwriteReference. +func (in *ComponentOverwriteReference) DeepCopy() *ComponentOverwriteReference { + if in == nil { + return nil + } + out := new(ComponentOverwriteReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwrites) DeepCopyInto(out *ComponentOverwrites) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Overwrites != nil { + in, out := &in.Overwrites, &out.Overwrites + *out = make(ComponentOverwriteList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwrites. +func (in *ComponentOverwrites) DeepCopy() *ComponentOverwrites { + if in == nil { + return nil + } + out := new(ComponentOverwrites) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ComponentOverwrites) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentOverwritesList) DeepCopyInto(out *ComponentOverwritesList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ComponentOverwrites, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentOverwritesList. +func (in *ComponentOverwritesList) DeepCopy() *ComponentOverwritesList { + if in == nil { + return nil + } + out := new(ComponentOverwritesList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ComponentOverwritesList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + if in.Codes != nil { + in, out := &in.Codes, &out.Codes + *out = make([]ErrorCode, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigMapReference) DeepCopyInto(out *ConfigMapReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapReference. +func (in *ConfigMapReference) DeepCopy() *ConfigMapReference { + if in == nil { + return nil + } + out := new(ConfigMapReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Context) DeepCopyInto(out *Context) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.RepositoryContext != nil { + in, out := &in.RepositoryContext, &out.RepositoryContext + *out = (*in).DeepCopy() + } + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]v1.LocalObjectReference, len(*in)) + copy(*out, *in) + } + if in.Configurations != nil { + in, out := &in.Configurations, &out.Configurations + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Context. +func (in *Context) DeepCopy() *Context { + if in == nil { + return nil + } + out := new(Context) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Context) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContextList) DeepCopyInto(out *ContextList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Context, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContextList. +func (in *ContextList) DeepCopy() *ContextList { + if in == nil { + return nil + } + out := new(ContextList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ContextList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataExport) DeepCopyInto(out *DataExport) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataExport. +func (in *DataExport) DeepCopy() *DataExport { + if in == nil { + return nil + } + out := new(DataExport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataImport) DeepCopyInto(out *DataImport) { + *out = *in + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(SecretReference) + **out = **in + } + if in.ConfigMapRef != nil { + in, out := &in.ConfigMapRef, &out.ConfigMapRef + *out = new(ConfigMapReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataImport. +func (in *DataImport) DeepCopy() *DataImport { + if in == nil { + return nil + } + out := new(DataImport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataObject) DeepCopyInto(out *DataObject) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Data.DeepCopyInto(&out.Data) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataObject. +func (in *DataObject) DeepCopy() *DataObject { + if in == nil { + return nil + } + out := new(DataObject) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DataObject) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataObjectList) DeepCopyInto(out *DataObjectList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DataObject, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataObjectList. +func (in *DataObjectList) DeepCopy() *DataObjectList { + if in == nil { + return nil + } + out := new(DataObjectList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DataObjectList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Default) DeepCopyInto(out *Default) { + *out = *in + in.Value.DeepCopyInto(&out.Value) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Default. +func (in *Default) DeepCopy() *Default { + if in == nil { + return nil + } + out := new(Default) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItem) DeepCopyInto(out *DeployItem) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItem. +func (in *DeployItem) DeepCopy() *DeployItem { + if in == nil { + return nil + } + out := new(DeployItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeployItem) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemList) DeepCopyInto(out *DeployItemList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DeployItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemList. +func (in *DeployItemList) DeepCopy() *DeployItemList { + if in == nil { + return nil + } + out := new(DeployItemList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeployItemList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemSpec) DeepCopyInto(out *DeployItemSpec) { + *out = *in + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(ObjectReference) + **out = **in + } + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemSpec. +func (in *DeployItemSpec) DeepCopy() *DeployItemSpec { + if in == nil { + return nil + } + out := new(DeployItemSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemStatus) DeepCopyInto(out *DeployItemStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.LastReconcileTime != nil { + in, out := &in.LastReconcileTime, &out.LastReconcileTime + *out = (*in).DeepCopy() + } + out.Deployer = in.Deployer + if in.ProviderStatus != nil { + in, out := &in.ProviderStatus, &out.ProviderStatus + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.ExportReference != nil { + in, out := &in.ExportReference, &out.ExportReference + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemStatus. +func (in *DeployItemStatus) DeepCopy() *DeployItemStatus { + if in == nil { + return nil + } + out := new(DeployItemStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployItemTemplate) DeepCopyInto(out *DeployItemTemplate) { + *out = *in + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(ObjectReference) + **out = **in + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.DependsOn != nil { + in, out := &in.DependsOn, &out.DependsOn + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemTemplate. +func (in *DeployItemTemplate) DeepCopy() *DeployItemTemplate { + if in == nil { + return nil + } + out := new(DeployItemTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in DeployItemTemplateList) DeepCopyInto(out *DeployItemTemplateList) { + { + in := &in + *out = make(DeployItemTemplateList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployItemTemplateList. +func (in DeployItemTemplateList) DeepCopy() DeployItemTemplateList { + if in == nil { + return nil + } + out := new(DeployItemTemplateList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerInformation) DeepCopyInto(out *DeployerInformation) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerInformation. +func (in *DeployerInformation) DeepCopy() *DeployerInformation { + if in == nil { + return nil + } + out := new(DeployerInformation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerInstallationTemplate) DeepCopyInto(out *DeployerInstallationTemplate) { + *out = *in + if in.ComponentDescriptor != nil { + in, out := &in.ComponentDescriptor, &out.ComponentDescriptor + *out = new(ComponentDescriptorDefinition) + (*in).DeepCopyInto(*out) + } + in.Blueprint.DeepCopyInto(&out.Blueprint) + in.Imports.DeepCopyInto(&out.Imports) + if in.ImportDataMappings != nil { + in, out := &in.ImportDataMappings, &out.ImportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerInstallationTemplate. +func (in *DeployerInstallationTemplate) DeepCopy() *DeployerInstallationTemplate { + if in == nil { + return nil + } + out := new(DeployerInstallationTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerRegistration) DeepCopyInto(out *DeployerRegistration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerRegistration. +func (in *DeployerRegistration) DeepCopy() *DeployerRegistration { + if in == nil { + return nil + } + out := new(DeployerRegistration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeployerRegistration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerRegistrationList) DeepCopyInto(out *DeployerRegistrationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DeployerRegistration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerRegistrationList. +func (in *DeployerRegistrationList) DeepCopy() *DeployerRegistrationList { + if in == nil { + return nil + } + out := new(DeployerRegistrationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeployerRegistrationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployerRegistrationSpec) DeepCopyInto(out *DeployerRegistrationSpec) { + *out = *in + if in.DeployItemTypes != nil { + in, out := &in.DeployItemTypes, &out.DeployItemTypes + *out = make([]DeployItemType, len(*in)) + copy(*out, *in) + } + in.InstallationTemplate.DeepCopyInto(&out.InstallationTemplate) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployerRegistrationSpec. +func (in *DeployerRegistrationSpec) DeepCopy() *DeployerRegistrationSpec { + if in == nil { + return nil + } + out := new(DeployerRegistrationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Duration) DeepCopyInto(out *Duration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Duration. +func (in *Duration) DeepCopy() *Duration { + if in == nil { + return nil + } + out := new(Duration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Environment) DeepCopyInto(out *Environment) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Environment. +func (in *Environment) DeepCopy() *Environment { + if in == nil { + return nil + } + out := new(Environment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Environment) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvironmentList) DeepCopyInto(out *EnvironmentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Environment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentList. +func (in *EnvironmentList) DeepCopy() *EnvironmentList { + if in == nil { + return nil + } + out := new(EnvironmentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EnvironmentList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvironmentSpec) DeepCopyInto(out *EnvironmentSpec) { + *out = *in + in.HostTarget.DeepCopyInto(&out.HostTarget) + in.LandscaperClusterRestConfig.DeepCopyInto(&out.LandscaperClusterRestConfig) + if in.TargetSelectors != nil { + in, out := &in.TargetSelectors, &out.TargetSelectors + *out = make([]TargetSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentSpec. +func (in *EnvironmentSpec) DeepCopy() *EnvironmentSpec { + if in == nil { + return nil + } + out := new(EnvironmentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Error) DeepCopyInto(out *Error) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + if in.Codes != nil { + in, out := &in.Codes, &out.Codes + *out = make([]ErrorCode, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Error. +func (in *Error) DeepCopy() *Error { + if in == nil { + return nil + } + out := new(Error) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Execution) DeepCopyInto(out *Execution) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Execution. +func (in *Execution) DeepCopy() *Execution { + if in == nil { + return nil + } + out := new(Execution) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Execution) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionGeneration) DeepCopyInto(out *ExecutionGeneration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionGeneration. +func (in *ExecutionGeneration) DeepCopy() *ExecutionGeneration { + if in == nil { + return nil + } + out := new(ExecutionGeneration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionList) DeepCopyInto(out *ExecutionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Execution, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionList. +func (in *ExecutionList) DeepCopy() *ExecutionList { + if in == nil { + return nil + } + out := new(ExecutionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ExecutionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionSpec) DeepCopyInto(out *ExecutionSpec) { + *out = *in + if in.DeployItems != nil { + in, out := &in.DeployItems, &out.DeployItems + *out = make(DeployItemTemplateList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionSpec. +func (in *ExecutionSpec) DeepCopy() *ExecutionSpec { + if in == nil { + return nil + } + out := new(ExecutionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecutionStatus) DeepCopyInto(out *ExecutionStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.ExportReference != nil { + in, out := &in.ExportReference, &out.ExportReference + *out = new(ObjectReference) + **out = **in + } + if in.DeployItemReferences != nil { + in, out := &in.DeployItemReferences, &out.DeployItemReferences + *out = make([]VersionedNamedObjectReference, len(*in)) + copy(*out, *in) + } + if in.ExecutionGenerations != nil { + in, out := &in.ExecutionGenerations, &out.ExecutionGenerations + *out = make([]ExecutionGeneration, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionStatus. +func (in *ExecutionStatus) DeepCopy() *ExecutionStatus { + if in == nil { + return nil + } + out := new(ExecutionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExportDefinition) DeepCopyInto(out *ExportDefinition) { + *out = *in + in.FieldValueDefinition.DeepCopyInto(&out.FieldValueDefinition) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportDefinition. +func (in *ExportDefinition) DeepCopy() *ExportDefinition { + if in == nil { + return nil + } + out := new(ExportDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ExportDefinitionList) DeepCopyInto(out *ExportDefinitionList) { + { + in := &in + *out = make(ExportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportDefinitionList. +func (in ExportDefinitionList) DeepCopy() ExportDefinitionList { + if in == nil { + return nil + } + out := new(ExportDefinitionList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FieldValueDefinition) DeepCopyInto(out *FieldValueDefinition) { + *out = *in + if in.Schema != nil { + in, out := &in.Schema, &out.Schema + *out = new(JSONSchemaDefinition) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FieldValueDefinition. +func (in *FieldValueDefinition) DeepCopy() *FieldValueDefinition { + if in == nil { + return nil + } + out := new(FieldValueDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImportDefinition) DeepCopyInto(out *ImportDefinition) { + *out = *in + in.FieldValueDefinition.DeepCopyInto(&out.FieldValueDefinition) + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = new(bool) + **out = **in + } + in.Default.DeepCopyInto(&out.Default) + if in.ConditionalImports != nil { + in, out := &in.ConditionalImports, &out.ConditionalImports + *out = make([]ImportDefinition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportDefinition. +func (in *ImportDefinition) DeepCopy() *ImportDefinition { + if in == nil { + return nil + } + out := new(ImportDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ImportDefinitionList) DeepCopyInto(out *ImportDefinitionList) { + { + in := &in + *out = make(ImportDefinitionList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportDefinitionList. +func (in ImportDefinitionList) DeepCopy() ImportDefinitionList { + if in == nil { + return nil + } + out := new(ImportDefinitionList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImportStatus) DeepCopyInto(out *ImportStatus) { + *out = *in + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]TargetImportStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ComponentDescriptorRef != nil { + in, out := &in.ComponentDescriptorRef, &out.ComponentDescriptorRef + *out = new(ComponentDescriptorReference) + (*in).DeepCopyInto(*out) + } + if in.ComponentDescriptors != nil { + in, out := &in.ComponentDescriptors, &out.ComponentDescriptors + *out = make([]CDImportStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SourceRef != nil { + in, out := &in.SourceRef, &out.SourceRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportStatus. +func (in *ImportStatus) DeepCopy() *ImportStatus { + if in == nil { + return nil + } + out := new(ImportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InlineBlueprint) DeepCopyInto(out *InlineBlueprint) { + *out = *in + in.Filesystem.DeepCopyInto(&out.Filesystem) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InlineBlueprint. +func (in *InlineBlueprint) DeepCopy() *InlineBlueprint { + if in == nil { + return nil + } + out := new(InlineBlueprint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Installation) DeepCopyInto(out *Installation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Installation. +func (in *Installation) DeepCopy() *Installation { + if in == nil { + return nil + } + out := new(Installation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Installation) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationExports) DeepCopyInto(out *InstallationExports) { + *out = *in + if in.Data != nil { + in, out := &in.Data, &out.Data + *out = make([]DataExport, len(*in)) + copy(*out, *in) + } + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]TargetExport, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationExports. +func (in *InstallationExports) DeepCopy() *InstallationExports { + if in == nil { + return nil + } + out := new(InstallationExports) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationImports) DeepCopyInto(out *InstallationImports) { + *out = *in + if in.Data != nil { + in, out := &in.Data, &out.Data + *out = make([]DataImport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]TargetImport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ComponentDescriptors != nil { + in, out := &in.ComponentDescriptors, &out.ComponentDescriptors + *out = make([]ComponentDescriptorImport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationImports. +func (in *InstallationImports) DeepCopy() *InstallationImports { + if in == nil { + return nil + } + out := new(InstallationImports) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationList) DeepCopyInto(out *InstallationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Installation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationList. +func (in *InstallationList) DeepCopy() *InstallationList { + if in == nil { + return nil + } + out := new(InstallationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationSpec) DeepCopyInto(out *InstallationSpec) { + *out = *in + if in.ComponentDescriptor != nil { + in, out := &in.ComponentDescriptor, &out.ComponentDescriptor + *out = new(ComponentDescriptorDefinition) + (*in).DeepCopyInto(*out) + } + in.Blueprint.DeepCopyInto(&out.Blueprint) + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + in.Imports.DeepCopyInto(&out.Imports) + if in.ImportDataMappings != nil { + in, out := &in.ImportDataMappings, &out.ImportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + in.Exports.DeepCopyInto(&out.Exports) + if in.ExportDataMappings != nil { + in, out := &in.ExportDataMappings, &out.ExportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationSpec. +func (in *InstallationSpec) DeepCopy() *InstallationSpec { + if in == nil { + return nil + } + out := new(InstallationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationStatus) DeepCopyInto(out *InstallationStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastError != nil { + in, out := &in.LastError, &out.LastError + *out = new(Error) + (*in).DeepCopyInto(*out) + } + if in.Imports != nil { + in, out := &in.Imports, &out.Imports + *out = make([]ImportStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.InstallationReferences != nil { + in, out := &in.InstallationReferences, &out.InstallationReferences + *out = make([]NamedObjectReference, len(*in)) + copy(*out, *in) + } + if in.ExecutionReference != nil { + in, out := &in.ExecutionReference, &out.ExecutionReference + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationStatus. +func (in *InstallationStatus) DeepCopy() *InstallationStatus { + if in == nil { + return nil + } + out := new(InstallationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationTemplate) DeepCopyInto(out *InstallationTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Blueprint.DeepCopyInto(&out.Blueprint) + in.Imports.DeepCopyInto(&out.Imports) + if in.ImportDataMappings != nil { + in, out := &in.ImportDataMappings, &out.ImportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + in.Exports.DeepCopyInto(&out.Exports) + if in.ExportDataMappings != nil { + in, out := &in.ExportDataMappings, &out.ExportDataMappings + *out = make(map[string]AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationTemplate. +func (in *InstallationTemplate) DeepCopy() *InstallationTemplate { + if in == nil { + return nil + } + out := new(InstallationTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallationTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallationTemplateBlueprintDefinition) DeepCopyInto(out *InstallationTemplateBlueprintDefinition) { + *out = *in + in.Filesystem.DeepCopyInto(&out.Filesystem) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationTemplateBlueprintDefinition. +func (in *InstallationTemplateBlueprintDefinition) DeepCopy() *InstallationTemplateBlueprintDefinition { + if in == nil { + return nil + } + out := new(InstallationTemplateBlueprintDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in InstallationTemplateList) DeepCopyInto(out *InstallationTemplateList) { + { + in := &in + *out = make(InstallationTemplateList, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(InstallationTemplate) + (*in).DeepCopyInto(*out) + } + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallationTemplateList. +func (in InstallationTemplateList) DeepCopy() InstallationTemplateList { + if in == nil { + return nil + } + out := new(InstallationTemplateList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JSONSchemaDefinition) DeepCopyInto(out *JSONSchemaDefinition) { + *out = *in + if in.RawMessage != nil { + in, out := &in.RawMessage, &out.RawMessage + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSchemaDefinition. +func (in *JSONSchemaDefinition) DeepCopy() *JSONSchemaDefinition { + if in == nil { + return nil + } + out := new(JSONSchemaDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamedObjectReference) DeepCopyInto(out *NamedObjectReference) { + *out = *in + out.Reference = in.Reference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedObjectReference. +func (in *NamedObjectReference) DeepCopy() *NamedObjectReference { + if in == nil { + return nil + } + out := new(NamedObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectReference) DeepCopyInto(out *ObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference. +func (in *ObjectReference) DeepCopy() *ObjectReference { + if in == nil { + return nil + } + out := new(ObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteBlueprintReference) DeepCopyInto(out *RemoteBlueprintReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteBlueprintReference. +func (in *RemoteBlueprintReference) DeepCopy() *RemoteBlueprintReference { + if in == nil { + return nil + } + out := new(RemoteBlueprintReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Requirement) DeepCopyInto(out *Requirement) { + *out = *in + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Requirement. +func (in *Requirement) DeepCopy() *Requirement { + if in == nil { + return nil + } + out := new(Requirement) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceReference) DeepCopyInto(out *ResourceReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceReference. +func (in *ResourceReference) DeepCopy() *ResourceReference { + if in == nil { + return nil + } + out := new(ResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretLabelSelectorRef) DeepCopyInto(out *SecretLabelSelectorRef) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretLabelSelectorRef. +func (in *SecretLabelSelectorRef) DeepCopy() *SecretLabelSelectorRef { + if in == nil { + return nil + } + out := new(SecretLabelSelectorRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretReference) DeepCopyInto(out *SecretReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference. +func (in *SecretReference) DeepCopy() *SecretReference { + if in == nil { + return nil + } + out := new(SecretReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StaticDataSource) DeepCopyInto(out *StaticDataSource) { + *out = *in + in.Value.DeepCopyInto(&out.Value) + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + *out = new(StaticDataValueFrom) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StaticDataSource. +func (in *StaticDataSource) DeepCopy() *StaticDataSource { + if in == nil { + return nil + } + out := new(StaticDataSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StaticDataValueFrom) DeepCopyInto(out *StaticDataValueFrom) { + *out = *in + if in.SecretKeyRef != nil { + in, out := &in.SecretKeyRef, &out.SecretKeyRef + *out = new(v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.SecretLabelSelector != nil { + in, out := &in.SecretLabelSelector, &out.SecretLabelSelector + *out = new(SecretLabelSelectorRef) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StaticDataValueFrom. +func (in *StaticDataValueFrom) DeepCopy() *StaticDataValueFrom { + if in == nil { + return nil + } + out := new(StaticDataValueFrom) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubinstallationTemplate) DeepCopyInto(out *SubinstallationTemplate) { + *out = *in + if in.InstallationTemplate != nil { + in, out := &in.InstallationTemplate, &out.InstallationTemplate + *out = new(InstallationTemplate) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubinstallationTemplate. +func (in *SubinstallationTemplate) DeepCopy() *SubinstallationTemplate { + if in == nil { + return nil + } + out := new(SubinstallationTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in SubinstallationTemplateList) DeepCopyInto(out *SubinstallationTemplateList) { + { + in := &in + *out = make(SubinstallationTemplateList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubinstallationTemplateList. +func (in SubinstallationTemplateList) DeepCopy() SubinstallationTemplateList { + if in == nil { + return nil + } + out := new(SubinstallationTemplateList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TLSClientConfig) DeepCopyInto(out *TLSClientConfig) { + *out = *in + if in.CAData != nil { + in, out := &in.CAData, &out.CAData + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.NextProtos != nil { + in, out := &in.NextProtos, &out.NextProtos + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSClientConfig. +func (in *TLSClientConfig) DeepCopy() *TLSClientConfig { + if in == nil { + return nil + } + out := new(TLSClientConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Target) DeepCopyInto(out *Target) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Target. +func (in *Target) DeepCopy() *Target { + if in == nil { + return nil + } + out := new(Target) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Target) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetExport) DeepCopyInto(out *TargetExport) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetExport. +func (in *TargetExport) DeepCopy() *TargetExport { + if in == nil { + return nil + } + out := new(TargetExport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetImport) DeepCopyInto(out *TargetImport) { + *out = *in + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetImport. +func (in *TargetImport) DeepCopy() *TargetImport { + if in == nil { + return nil + } + out := new(TargetImport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetImportStatus) DeepCopyInto(out *TargetImportStatus) { + *out = *in + if in.SourceRef != nil { + in, out := &in.SourceRef, &out.SourceRef + *out = new(ObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetImportStatus. +func (in *TargetImportStatus) DeepCopy() *TargetImportStatus { + if in == nil { + return nil + } + out := new(TargetImportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetList) DeepCopyInto(out *TargetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Target, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetList. +func (in *TargetList) DeepCopy() *TargetList { + if in == nil { + return nil + } + out := new(TargetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TargetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetSelector) DeepCopyInto(out *TargetSelector) { + *out = *in + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make([]Requirement, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make([]Requirement, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetSelector. +func (in *TargetSelector) DeepCopy() *TargetSelector { + if in == nil { + return nil + } + out := new(TargetSelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetSpec) DeepCopyInto(out *TargetSpec) { + *out = *in + in.Configuration.DeepCopyInto(&out.Configuration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetSpec. +func (in *TargetSpec) DeepCopy() *TargetSpec { + if in == nil { + return nil + } + out := new(TargetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetTemplate) DeepCopyInto(out *TargetTemplate) { + *out = *in + in.TargetSpec.DeepCopyInto(&out.TargetSpec) + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetTemplate. +func (in *TargetTemplate) DeepCopy() *TargetTemplate { + if in == nil { + return nil + } + out := new(TargetTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateExecutor) DeepCopyInto(out *TemplateExecutor) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateExecutor. +func (in *TemplateExecutor) DeepCopy() *TemplateExecutor { + if in == nil { + return nil + } + out := new(TemplateExecutor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TypedObjectReference) DeepCopyInto(out *TypedObjectReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedObjectReference. +func (in *TypedObjectReference) DeepCopy() *TypedObjectReference { + if in == nil { + return nil + } + out := new(TypedObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VersionedNamedObjectReference) DeepCopyInto(out *VersionedNamedObjectReference) { + *out = *in + out.Reference = in.Reference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedNamedObjectReference. +func (in *VersionedNamedObjectReference) DeepCopy() *VersionedNamedObjectReference { + if in == nil { + return nil + } + out := new(VersionedNamedObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VersionedObjectReference) DeepCopyInto(out *VersionedObjectReference) { + *out = *in + out.ObjectReference = in.ObjectReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedObjectReference. +func (in *VersionedObjectReference) DeepCopy() *VersionedObjectReference { + if in == nil { + return nil + } + out := new(VersionedObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VersionedResourceReference) DeepCopyInto(out *VersionedResourceReference) { + *out = *in + out.ResourceReference = in.ResourceReference + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedResourceReference. +func (in *VersionedResourceReference) DeepCopy() *VersionedResourceReference { + if in == nil { + return nil + } + out := new(VersionedResourceReference) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/constants.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/constants.go new file mode 100644 index 000000000..c3fd42af5 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/constants.go @@ -0,0 +1,178 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package container + +import ( + "path/filepath" + + corev1 "k8s.io/api/core/v1" +) + +// ContainerDeployerOperationForceCleanupAnnotation is the name of the annotation that triggers the force deletion of the deploy item. +// Force deletion means that the delete container is skipped and all other resources are cleaned up. +const ContainerDeployerOperationForceCleanupAnnotation = "container.deployer.landscaper.gardener.cloud/force-cleanup" + +// ContainerDeployerFinalizer is the finalizer that is set by the container deployer +const ContainerDeployerFinalizer = "container.deployer.landscaper.gardener.cloud/finalizer" + +// ContainerDeployerIDLabel is the unique id of the deployer managing the deploy item. +const ContainerDeployerIDLabel = "container.deployer.landscaper.gardener.cloud/deployer-id" + +// ContainerDeployerNameLabel is the name of the label that is used to identify managed pods. +const ContainerDeployerNameLabel = "container.deployer.landscaper.gardener.cloud/name" + +// ContainerDeployerTypeLabel is a label that is used to identify secrets that contain the state of a container. +const ContainerDeployerTypeLabel = "container.deployer.landscaper.gardener.cloud/type" + +// ContainerDeployerDeployItemNameLabel is the name of the label that is used to identify the deploy item of a pod. +const ContainerDeployerDeployItemNameLabel = "deployitem.container.deployer.landscaper.gardener.cloud/name" + +// ContainerDeployerDeployItemNamespaceLabel is the name of the label that is used to identify the deploy item of a pod. +const ContainerDeployerDeployItemNamespaceLabel = "deployitem.container.deployer.landscaper.gardener.cloud/namespace" + +// ContainerDeployerDeployItemGenerationLabel is the name of the label that indicates the deploy item generation. +const ContainerDeployerDeployItemGenerationLabel = "deployitem.container.deployer.landscaper.gardener.cloud/generation" + +// InitContainerConditionType defines the condition for the current init container +const InitContainerConditionType = "InitContainer" + +// WaitContainerConditionType defines the condition of the current wait container +const WaitContainerConditionType = "WaitContainer" + +// OperationName is the name of the env var that specifies the current operation that the image should execute +const OperationName = "OPERATION" + +// OperationType defines the value of a Operation that is propagated to the container. +type OperationType string + +// OperationReconcile is the value of the Operation env var that defines a reconcile operation. +const OperationReconcile OperationType = "RECONCILE" + +// OperationDelete is the value of the Operation env var that defines a delete operation. +const OperationDelete OperationType = "DELETE" + +// BasePath is the base path inside a container that contains the container deployer specific data. +const BasePath = "/data/ls" + +// SharedBasePath is the base path inside the container that is shared between the main and ls containers +var SharedBasePath = filepath.Join(BasePath, "shared") + +// ImportsPathName is the name of the env var that points to the imports file. +const ImportsPathName = "IMPORTS_PATH" + +// ImportsFilename is the name of the file that contains the import values as json. +const ImportsFilename = "import.json" + +// ImportsPath is the path to the imports file. +var ImportsPath = filepath.Join(SharedBasePath, "imports", ImportsFilename) + +// ExportsPathName is the name of the env var that points to the exports file. +const ExportsPathName = "EXPORTS_PATH" + +// ExportsPath is the path to the export file. +var ExportsPath = filepath.Join(SharedBasePath, "exports", "values") + +// ComponentDescriptorPathName is the name of the env var that points to the component descriptor. +const ComponentDescriptorPathName = "COMPONENT_DESCRIPTOR_PATH" + +// ComponentDescriptorPath is the path to the component descriptor file. +var ComponentDescriptorPath = filepath.Join(SharedBasePath, "component_descriptor.json") + +// ContentPathName is the name of the env var that points to the blob content of the definition. +const ContentPathName = "CONTENT_PATH" + +// ContentPath is the path to the content directory. +var ContentPath = filepath.Join(SharedBasePath, "content") + +// StatePathName is the name of the env var that points to the directory where the state can be stored. +const StatePathName = "STATE_PATH" + +// StatePath is the path to the state directory. +var StatePath = filepath.Join(SharedBasePath, "state") + +// ConfigurationPathName is the name of the env var that points to the provider configuration file. +const ConfigurationPathName = "CONFIGURATION_PATH" + +// ConfigurationFilename is the name of the file that contains the provider configuration as json. +const ConfigurationFilename = "configuration.json" + +// ConfigurationPath is the path to the configuration file. +var ConfigurationPath = filepath.Join(BasePath, "internal", ConfigurationFilename) + +// RegistrySecretBasePath is the path to all OCI pull secrets +var RegistrySecretBasePath = filepath.Join(BasePath, "registry_secrets") + +// RegistrySecretBasePathName is the environment variable pointing to the file system location of all OCI pull secrets +const RegistrySecretBasePathName = "REGISTRY_SECRETS_DIR" + +// PodName is the name of the env var that contains the name of the pod. +const PodName = "POD_NAME" + +// PodNamespaceName is the name of the env var that contains the namespace of the pod. +const PodNamespaceName = "POD_NAMESPACE" + +// DeployItemName is the name of the env var that contains name of the source DeployItem. +const DeployItemName = "DEPLOY_ITEM_NAME" + +// DeployItemNamespaceName is the name of the env var that contains namespace of the source DeployItem. +const DeployItemNamespaceName = "DEPLOY_ITEM_NAMESPACE" + +// MainContainerName is the name of the container running the user workload. +const MainContainerName = "main" + +// InitContainerName is the name of the container running the init container. +const InitContainerName = "init" + +// WaitContainerName is the name of the container running the sidecar container. +const WaitContainerName = "wait" + +// ContainerDeployerStateUUIDAnnotation is a annotation that is used to group chunks +// that are stored in the secrets. +const ContainerDeployerStateUUIDAnnotation = "container.deployer.landscaper.gardener.cloud/uuid" + +// ContainerDeployerStateNumAnnotation is a annotation that is used to define the order of chunks +// that are stored in the secrets. +const ContainerDeployerStateNumAnnotation = "container.deployer.landscaper.gardener.cloud/num" + +var ( + DefaultEnvVars = []corev1.EnvVar{ + { + Name: ImportsPathName, + Value: ImportsPath, + }, + { + Name: ExportsPathName, + Value: ExportsPath, + }, + { + Name: ComponentDescriptorPathName, + Value: ComponentDescriptorPath, + }, + { + Name: ContentPathName, + Value: ContentPath, + }, + { + Name: StatePathName, + Value: StatePath, + }, + { + Name: PodName, + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.name", + }, + }, + }, + { + Name: PodNamespaceName, + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.namespace", + }, + }, + }, + } +) diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/doc.go new file mode 100644 index 000000000..d5ce1ca8f --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/doc.go @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=container.deployer.landscaper.gardener.cloud +package container diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/register.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/register.go new file mode 100644 index 000000000..774dbe8a4 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/register.go @@ -0,0 +1,42 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package container + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the name of the Garden API group. +const GroupName = "container.deployer.landscaper.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &ProviderStatus{}, + &ProviderConfiguration{}, + &Configuration{}, + ) + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/types_config.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/types_config.go new file mode 100644 index 000000000..97f8ca970 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/types_config.go @@ -0,0 +1,103 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package container + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/gardener/landscaper/apis/config" + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Configuration is the container deployer configuration that configures the controller +type Configuration struct { + metav1.TypeMeta `json:",inline"` + + // Identity identity describes the unique identity of the deployer. + // +optional + Identity string `json:"identity,omitempty"` + + // OCI configures the oci client of the controller + // +optional + OCI *config.OCIConfiguration `json:"oci,omitempty"` + + // TargetSelector describes all selectors the deployer should depend on. + TargetSelector []lsv1alpha1.TargetSelector `json:"targetSelector,omitempty"` + + // Namespace defines the namespace where the pods should be executed. + Namespace string `json:"namespace"` + + // DefaultImage configures the default images that is used if the DeployItem + // does not specify one. + DefaultImage ContainerSpec `json:"defaultImage"` + + // InitContainerImage defines the image that is used to init the container. + // This container bootstraps the necessary directories and files. + InitContainer ContainerSpec `json:"initContainer"` + + // SidecarContainerImage defines the image that is used as a + // sidecar to the defined main container. + // The sidecar container is responsible to collect the exports and the state of the main container. + WaitContainer ContainerSpec `json:"waitContainer"` + + // GarbageCollection configures the container deployer garbage collector. + GarbageCollection GarbageCollection `json:"garbageCollection"` + + // DebugOptions configure additional debug options. + DebugOptions *DebugOptions `json:"debug,omitempty"` +} + +// ContainerSpec defines a container specification +type ContainerSpec struct { + // Docker image name. + // More info: https://kubernetes.io/docs/concepts/containers/images + // The image will be defaulted by the container deployer to the configured default. + Image string `json:"image,omitempty"` + // Entrypoint array. Not executed within a shell. + // The docker image's ENTRYPOINT is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Command []string `json:"command,omitempty"` + // Arguments to the entrypoint. + // The docker image's CMD is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Args []string `json:"args,omitempty"` + // Image pull policy. + // One of Always, Never, IfNotPresent. + // Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + // Cannot be updated. + // More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + // +optional + ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` +} + +// GarbageCollection defines the container deployer garbage collection configuration. +type GarbageCollection struct { + // Disable disables the garbage collector and the resources clean-up. + Disable bool `json:"disable"` + // Worker defines the number of parallel garbage collection routines. + // Defaults to 5. + Worker int `json:"worker"` +} + +// DebugOptions defines optional debug options. +type DebugOptions struct { + // KeepPod will only remove the finalizer on the pod but will not delete the pod. + KeepPod bool `json:"keepPod,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/types_provider.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/types_provider.go new file mode 100644 index 000000000..6118f16cf --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/types_provider.go @@ -0,0 +1,114 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package container + +import ( + "encoding/json" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cr "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ProviderConfiguration is the container deployer configuration that is expected in a DeployItem +type ProviderConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // Docker image name. + // More info: https://kubernetes.io/docs/concepts/containers/images + // The image will be defaulted by the container deployer to the configured default. + // +optional + Image string `json:"image,omitempty"` + // Entrypoint array. Not executed within a shell. + // The docker image's ENTRYPOINT is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Command []string `json:"command,omitempty"` + // Arguments to the entrypoint. + // The docker image's CMD is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Args []string `json:"args,omitempty"` + // ImportValues contains the import values for the container. + // +optional + ImportValues json.RawMessage `json:"importValues,omitempty"` + // Blueprint is the resolved reference to the Blueprint definition + // +optional + Blueprint *lsv1alpha1.BlueprintDefinition `json:"blueprint,omitempty"` + // ComponentDescriptor is the resolved reference to the ComponentDescriptor defnition + // +optional + ComponentDescriptor *lsv1alpha1.ComponentDescriptorDefinition `json:"componentDescriptor,omitempty"` + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints and component descriptors from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []lsv1alpha1.ObjectReference `json:"registryPullSecrets,omitempty"` + // ContinuousReconcile contains the schedule for continuous reconciliation. + // +optional + ContinuousReconcile *cr.ContinuousReconcileSpec `json:"continuousReconcile,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// ProviderStatus is the container provider specific status +type ProviderStatus struct { + metav1.TypeMeta `json:",inline"` + // LastOperation defines the last run operation of the pod. + // The operation can be either reconcile or deletion. + LastOperation string `json:"lastOperation"` + // PodStatus indicated the status of the executed pod. + PodStatus *PodStatus `json:"podStatus,omitempty"` +} + +// PodStatus describes the status of a pod with its init, wait and main container +type PodStatus struct { + // PodName is the name of the created pod. + PodName string `json:"podName"` + // LastRun is the time when the pod was executed the last time. + LastRun *metav1.Time `json:"lastRun,omitempty"` + // ContainerStatus contains the status of the pod that + // executes the configured container. + ContainerStatus ContainerStatus `json:"containerStatus"` + // InitContainerStatus contains the status of the init container. + InitContainerStatus ContainerStatus `json:"initContainerStatus"` + // WaitContainerStatus contains the status of the wait container. + WaitContainerStatus ContainerStatus `json:"waitContainerStatus"` +} + +// ContainerStatus describes the status of a pod with its init, wait and main container. +type ContainerStatus struct { + // A human readable message indicating details about why the pod is in this condition. + // +optional + Message string `json:"message,omitempty"` + // A brief CamelCase message indicating details about why the pod is in this state. + // e.g. 'Evicted' + // +optional + Reason string `json:"reason,omitempty"` + // Details about the container's current condition. + // +optional + State corev1.ContainerState `json:"state,omitempty"` + // The image the container is running. + // More info: https://kubernetes.io/docs/concepts/containers/images + Image string `json:"image"` + // ImageID of the container's image. + ImageID string `json:"imageID"` + // ExitCode of the main container. + // +optional + ExitCode *int32 `json:"exitCode,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/defaults.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/defaults.go new file mode 100644 index 000000000..c8bad0ac5 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/defaults.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_Configuration sets the defaults for the container deployer configuration. +func SetDefaults_Configuration(obj *Configuration) { + if len(obj.Namespace) == 0 { + obj.Namespace = metav1.NamespaceDefault + } + if len(obj.DefaultImage.Image) == 0 { + obj.DefaultImage.Image = "ubuntu:18.04" + } + SetDefaults_GarbageCollection(&obj.GarbageCollection) +} + +// SetDefaults_GarbageCollection sets the defaults for the container deployer configuration. +func SetDefaults_GarbageCollection(obj *GarbageCollection) { + if obj.Worker <= 0 { + obj.Worker = 5 + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/doc.go new file mode 100644 index 000000000..76966f2bd --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/doc.go @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=github.com/gardener/landscaper/apis/deployer/container +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=container.deployer.landscaper.gardener.cloud +package v1alpha1 diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/register.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/register.go new file mode 100644 index 000000000..1908f16bf --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/register.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the name of the Garden API group. +const GroupName = "container.deployer.landscaper.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs) + localSchemeBuilder = &SchemeBuilder + AddToScheme = SchemeBuilder.AddToScheme +) + +func init() { + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &ProviderStatus{}, + &ProviderConfiguration{}, + &Configuration{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/types_config.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/types_config.go new file mode 100644 index 000000000..018d4138f --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/types_config.go @@ -0,0 +1,105 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/gardener/landscaper/apis/config" + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Configuration is the container deployer configuration that configures the controller +type Configuration struct { + metav1.TypeMeta `json:",inline"` + + // Identity identity describes the unique identity of the deployer. + // +optional + Identity string `json:"identity,omitempty"` + + // OCI configures the oci client of the controller + // +optional + OCI *config.OCIConfiguration `json:"oci,omitempty"` + + // Namespace defines the namespace where the pods should be executed. + // Defaults to default + // +optional + Namespace string `json:"namespace"` + + // TargetSelector describes all selectors the deployer should depend on. + TargetSelector []lsv1alpha1.TargetSelector `json:"targetSelector,omitempty"` + + // DefaultImage configures the default images that is used if the DeployItem + // does not specify one. + DefaultImage ContainerSpec `json:"defaultImage"` + + // InitContainerImage defines the image that is used to init the container. + // This container bootstraps the necessary directories and files. + InitContainer ContainerSpec `json:"initContainer"` + + // SidecarContainerImage defines the image that is used as a + // sidecar to the defined main container. + // The sidecar container is responsible to collect the exports and the state of the main container. + WaitContainer ContainerSpec `json:"waitContainer"` + + // GarbageCollection configures the container deployer garbage collector. + GarbageCollection GarbageCollection `json:"garbageCollection"` + + // DebugOptions configure additional debug options. + DebugOptions *DebugOptions `json:"debug,omitempty"` +} + +// ContainerSpec defines a container specification +type ContainerSpec struct { + // Docker image name. + // More info: https://kubernetes.io/docs/concepts/containers/images + // The image will be defaulted by the container deployer to the configured default. + Image string `json:"image,omitempty"` + // Entrypoint array. Not executed within a shell. + // The docker image's ENTRYPOINT is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Command []string `json:"command,omitempty"` + // Arguments to the entrypoint. + // The docker image's CMD is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Args []string `json:"args,omitempty"` + // Image pull policy. + // One of Always, Never, IfNotPresent. + // Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + // Cannot be updated. + // More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + // +optional + ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` +} + +// GarbageCollection defines the container deployer garbage collection configuration. +type GarbageCollection struct { + // Disable disables the garbage collector and the resources clean-up. + Disable bool `json:"disable"` + // Worker defines the number of parallel garbage collection routines. + // Defaults to 5. + Worker int `json:"worker"` +} + +// DebugOptions defines optional debug options. +type DebugOptions struct { + // KeepPod will only remove the finalizer on the pod but will not delete the pod. + KeepPod bool `json:"keepPod,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/types_provider.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/types_provider.go new file mode 100644 index 000000000..68da37767 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/types_provider.go @@ -0,0 +1,115 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "encoding/json" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cr "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ProviderConfiguration is the container deployer configuration that is expected in a DeployItem +type ProviderConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // Docker image name. + // More info: https://kubernetes.io/docs/concepts/containers/images + // The image will be defaulted by the container deployer to the configured default. + // +optional + Image string `json:"image,omitempty"` + // Entrypoint array. Not executed within a shell. + // The docker image's ENTRYPOINT is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Command []string `json:"command,omitempty"` + // Arguments to the entrypoint. + // The docker image's CMD is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Args []string `json:"args,omitempty"` + // ImportValues contains the import values for the container. + // +optional + ImportValues json.RawMessage `json:"importValues,omitempty"` + // Blueprint is the resolved reference to the Blueprint definition + // +optional + Blueprint *lsv1alpha1.BlueprintDefinition `json:"blueprint,omitempty"` + // ComponentDescriptor is the resolved reference to the ComponentDescriptor defnition + // +optional + ComponentDescriptor *lsv1alpha1.ComponentDescriptorDefinition `json:"componentDescriptor,omitempty"` + // RegistryPullSecrets defines a list of registry credentials that are used to + // pull blueprints and component descriptors from the respective registry. + // For more info see: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + // Note that the type information is used to determine the secret key and the type of the secret. + // +optional + RegistryPullSecrets []lsv1alpha1.ObjectReference `json:"registryPullSecrets,omitempty"` + // ContinuousReconcile contains the schedule for continuous reconciliation. + // +optional + ContinuousReconcile *cr.ContinuousReconcileSpec `json:"continuousReconcile,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ProviderStatus is the container provider specific status +type ProviderStatus struct { + metav1.TypeMeta `json:",inline"` + // LastOperation defines the last run operation of the pod. + // The operation can be either reconcile or deletion. + LastOperation string `json:"lastOperation"` + // PodStatus indicated the status of the executed pod. + PodStatus *PodStatus `json:"podStatus,omitempty"` +} + +// PodStatus describes the status of a pod with its init, wait and main container +type PodStatus struct { + // PodName is the name of the created pod. + PodName string `json:"podName"` + // LastRun is the time when the pod was executed the last time. + LastRun *metav1.Time `json:"lastRun,omitempty"` + // ContainerStatus contains the status of the pod that + // executes the configured container. + ContainerStatus ContainerStatus `json:"containerStatus"` + // InitContainerStatus contains the status of the init container. + InitContainerStatus ContainerStatus `json:"initContainerStatus"` + // WaitContainerStatus contains the status of the wait container. + WaitContainerStatus ContainerStatus `json:"waitContainerStatus"` +} + +// ContainerStatus describes the status of a pod with its init, wait and main container. +type ContainerStatus struct { + // A human readable message indicating details about why the pod is in this condition. + // +optional + Message string `json:"message,omitempty"` + // A brief CamelCase message indicating details about why the pod is in this state. + // e.g. 'Evicted' + // +optional + Reason string `json:"reason,omitempty"` + // Details about the container's current condition. + // +optional + State corev1.ContainerState `json:"state,omitempty"` + // The image the container is running. + // More info: https://kubernetes.io/docs/concepts/containers/images + Image string `json:"image"` + // ImageID of the container's image. + ImageID string `json:"imageID"` + // ExitCode of the main container. + // +optional + ExitCode *int32 `json:"exitCode,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.conversion.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000..3409cf002 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,362 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + unsafe "unsafe" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + + config "github.com/gardener/landscaper/apis/config" + corev1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + container "github.com/gardener/landscaper/apis/deployer/container" + continuousreconcile "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*Configuration)(nil), (*container.Configuration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Configuration_To_container_Configuration(a.(*Configuration), b.(*container.Configuration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*container.Configuration)(nil), (*Configuration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_container_Configuration_To_v1alpha1_Configuration(a.(*container.Configuration), b.(*Configuration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ContainerSpec)(nil), (*container.ContainerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ContainerSpec_To_container_ContainerSpec(a.(*ContainerSpec), b.(*container.ContainerSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*container.ContainerSpec)(nil), (*ContainerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_container_ContainerSpec_To_v1alpha1_ContainerSpec(a.(*container.ContainerSpec), b.(*ContainerSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ContainerStatus)(nil), (*container.ContainerStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ContainerStatus_To_container_ContainerStatus(a.(*ContainerStatus), b.(*container.ContainerStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*container.ContainerStatus)(nil), (*ContainerStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_container_ContainerStatus_To_v1alpha1_ContainerStatus(a.(*container.ContainerStatus), b.(*ContainerStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DebugOptions)(nil), (*container.DebugOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DebugOptions_To_container_DebugOptions(a.(*DebugOptions), b.(*container.DebugOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*container.DebugOptions)(nil), (*DebugOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_container_DebugOptions_To_v1alpha1_DebugOptions(a.(*container.DebugOptions), b.(*DebugOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GarbageCollection)(nil), (*container.GarbageCollection)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GarbageCollection_To_container_GarbageCollection(a.(*GarbageCollection), b.(*container.GarbageCollection), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*container.GarbageCollection)(nil), (*GarbageCollection)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_container_GarbageCollection_To_v1alpha1_GarbageCollection(a.(*container.GarbageCollection), b.(*GarbageCollection), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PodStatus)(nil), (*container.PodStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PodStatus_To_container_PodStatus(a.(*PodStatus), b.(*container.PodStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*container.PodStatus)(nil), (*PodStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_container_PodStatus_To_v1alpha1_PodStatus(a.(*container.PodStatus), b.(*PodStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ProviderConfiguration)(nil), (*container.ProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ProviderConfiguration_To_container_ProviderConfiguration(a.(*ProviderConfiguration), b.(*container.ProviderConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*container.ProviderConfiguration)(nil), (*ProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_container_ProviderConfiguration_To_v1alpha1_ProviderConfiguration(a.(*container.ProviderConfiguration), b.(*ProviderConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ProviderStatus)(nil), (*container.ProviderStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ProviderStatus_To_container_ProviderStatus(a.(*ProviderStatus), b.(*container.ProviderStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*container.ProviderStatus)(nil), (*ProviderStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_container_ProviderStatus_To_v1alpha1_ProviderStatus(a.(*container.ProviderStatus), b.(*ProviderStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_Configuration_To_container_Configuration(in *Configuration, out *container.Configuration, s conversion.Scope) error { + out.Identity = in.Identity + out.OCI = (*config.OCIConfiguration)(unsafe.Pointer(in.OCI)) + out.Namespace = in.Namespace + out.TargetSelector = *(*[]corev1alpha1.TargetSelector)(unsafe.Pointer(&in.TargetSelector)) + if err := Convert_v1alpha1_ContainerSpec_To_container_ContainerSpec(&in.DefaultImage, &out.DefaultImage, s); err != nil { + return err + } + if err := Convert_v1alpha1_ContainerSpec_To_container_ContainerSpec(&in.InitContainer, &out.InitContainer, s); err != nil { + return err + } + if err := Convert_v1alpha1_ContainerSpec_To_container_ContainerSpec(&in.WaitContainer, &out.WaitContainer, s); err != nil { + return err + } + if err := Convert_v1alpha1_GarbageCollection_To_container_GarbageCollection(&in.GarbageCollection, &out.GarbageCollection, s); err != nil { + return err + } + out.DebugOptions = (*container.DebugOptions)(unsafe.Pointer(in.DebugOptions)) + return nil +} + +// Convert_v1alpha1_Configuration_To_container_Configuration is an autogenerated conversion function. +func Convert_v1alpha1_Configuration_To_container_Configuration(in *Configuration, out *container.Configuration, s conversion.Scope) error { + return autoConvert_v1alpha1_Configuration_To_container_Configuration(in, out, s) +} + +func autoConvert_container_Configuration_To_v1alpha1_Configuration(in *container.Configuration, out *Configuration, s conversion.Scope) error { + out.Identity = in.Identity + out.OCI = (*config.OCIConfiguration)(unsafe.Pointer(in.OCI)) + out.TargetSelector = *(*[]corev1alpha1.TargetSelector)(unsafe.Pointer(&in.TargetSelector)) + out.Namespace = in.Namespace + if err := Convert_container_ContainerSpec_To_v1alpha1_ContainerSpec(&in.DefaultImage, &out.DefaultImage, s); err != nil { + return err + } + if err := Convert_container_ContainerSpec_To_v1alpha1_ContainerSpec(&in.InitContainer, &out.InitContainer, s); err != nil { + return err + } + if err := Convert_container_ContainerSpec_To_v1alpha1_ContainerSpec(&in.WaitContainer, &out.WaitContainer, s); err != nil { + return err + } + if err := Convert_container_GarbageCollection_To_v1alpha1_GarbageCollection(&in.GarbageCollection, &out.GarbageCollection, s); err != nil { + return err + } + out.DebugOptions = (*DebugOptions)(unsafe.Pointer(in.DebugOptions)) + return nil +} + +// Convert_container_Configuration_To_v1alpha1_Configuration is an autogenerated conversion function. +func Convert_container_Configuration_To_v1alpha1_Configuration(in *container.Configuration, out *Configuration, s conversion.Scope) error { + return autoConvert_container_Configuration_To_v1alpha1_Configuration(in, out, s) +} + +func autoConvert_v1alpha1_ContainerSpec_To_container_ContainerSpec(in *ContainerSpec, out *container.ContainerSpec, s conversion.Scope) error { + out.Image = in.Image + out.Command = *(*[]string)(unsafe.Pointer(&in.Command)) + out.Args = *(*[]string)(unsafe.Pointer(&in.Args)) + out.ImagePullPolicy = v1.PullPolicy(in.ImagePullPolicy) + return nil +} + +// Convert_v1alpha1_ContainerSpec_To_container_ContainerSpec is an autogenerated conversion function. +func Convert_v1alpha1_ContainerSpec_To_container_ContainerSpec(in *ContainerSpec, out *container.ContainerSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ContainerSpec_To_container_ContainerSpec(in, out, s) +} + +func autoConvert_container_ContainerSpec_To_v1alpha1_ContainerSpec(in *container.ContainerSpec, out *ContainerSpec, s conversion.Scope) error { + out.Image = in.Image + out.Command = *(*[]string)(unsafe.Pointer(&in.Command)) + out.Args = *(*[]string)(unsafe.Pointer(&in.Args)) + out.ImagePullPolicy = v1.PullPolicy(in.ImagePullPolicy) + return nil +} + +// Convert_container_ContainerSpec_To_v1alpha1_ContainerSpec is an autogenerated conversion function. +func Convert_container_ContainerSpec_To_v1alpha1_ContainerSpec(in *container.ContainerSpec, out *ContainerSpec, s conversion.Scope) error { + return autoConvert_container_ContainerSpec_To_v1alpha1_ContainerSpec(in, out, s) +} + +func autoConvert_v1alpha1_ContainerStatus_To_container_ContainerStatus(in *ContainerStatus, out *container.ContainerStatus, s conversion.Scope) error { + out.Message = in.Message + out.Reason = in.Reason + out.State = in.State + out.Image = in.Image + out.ImageID = in.ImageID + out.ExitCode = (*int32)(unsafe.Pointer(in.ExitCode)) + return nil +} + +// Convert_v1alpha1_ContainerStatus_To_container_ContainerStatus is an autogenerated conversion function. +func Convert_v1alpha1_ContainerStatus_To_container_ContainerStatus(in *ContainerStatus, out *container.ContainerStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ContainerStatus_To_container_ContainerStatus(in, out, s) +} + +func autoConvert_container_ContainerStatus_To_v1alpha1_ContainerStatus(in *container.ContainerStatus, out *ContainerStatus, s conversion.Scope) error { + out.Message = in.Message + out.Reason = in.Reason + out.State = in.State + out.Image = in.Image + out.ImageID = in.ImageID + out.ExitCode = (*int32)(unsafe.Pointer(in.ExitCode)) + return nil +} + +// Convert_container_ContainerStatus_To_v1alpha1_ContainerStatus is an autogenerated conversion function. +func Convert_container_ContainerStatus_To_v1alpha1_ContainerStatus(in *container.ContainerStatus, out *ContainerStatus, s conversion.Scope) error { + return autoConvert_container_ContainerStatus_To_v1alpha1_ContainerStatus(in, out, s) +} + +func autoConvert_v1alpha1_DebugOptions_To_container_DebugOptions(in *DebugOptions, out *container.DebugOptions, s conversion.Scope) error { + out.KeepPod = in.KeepPod + return nil +} + +// Convert_v1alpha1_DebugOptions_To_container_DebugOptions is an autogenerated conversion function. +func Convert_v1alpha1_DebugOptions_To_container_DebugOptions(in *DebugOptions, out *container.DebugOptions, s conversion.Scope) error { + return autoConvert_v1alpha1_DebugOptions_To_container_DebugOptions(in, out, s) +} + +func autoConvert_container_DebugOptions_To_v1alpha1_DebugOptions(in *container.DebugOptions, out *DebugOptions, s conversion.Scope) error { + out.KeepPod = in.KeepPod + return nil +} + +// Convert_container_DebugOptions_To_v1alpha1_DebugOptions is an autogenerated conversion function. +func Convert_container_DebugOptions_To_v1alpha1_DebugOptions(in *container.DebugOptions, out *DebugOptions, s conversion.Scope) error { + return autoConvert_container_DebugOptions_To_v1alpha1_DebugOptions(in, out, s) +} + +func autoConvert_v1alpha1_GarbageCollection_To_container_GarbageCollection(in *GarbageCollection, out *container.GarbageCollection, s conversion.Scope) error { + out.Disable = in.Disable + out.Worker = in.Worker + return nil +} + +// Convert_v1alpha1_GarbageCollection_To_container_GarbageCollection is an autogenerated conversion function. +func Convert_v1alpha1_GarbageCollection_To_container_GarbageCollection(in *GarbageCollection, out *container.GarbageCollection, s conversion.Scope) error { + return autoConvert_v1alpha1_GarbageCollection_To_container_GarbageCollection(in, out, s) +} + +func autoConvert_container_GarbageCollection_To_v1alpha1_GarbageCollection(in *container.GarbageCollection, out *GarbageCollection, s conversion.Scope) error { + out.Disable = in.Disable + out.Worker = in.Worker + return nil +} + +// Convert_container_GarbageCollection_To_v1alpha1_GarbageCollection is an autogenerated conversion function. +func Convert_container_GarbageCollection_To_v1alpha1_GarbageCollection(in *container.GarbageCollection, out *GarbageCollection, s conversion.Scope) error { + return autoConvert_container_GarbageCollection_To_v1alpha1_GarbageCollection(in, out, s) +} + +func autoConvert_v1alpha1_PodStatus_To_container_PodStatus(in *PodStatus, out *container.PodStatus, s conversion.Scope) error { + out.PodName = in.PodName + out.LastRun = (*metav1.Time)(unsafe.Pointer(in.LastRun)) + if err := Convert_v1alpha1_ContainerStatus_To_container_ContainerStatus(&in.ContainerStatus, &out.ContainerStatus, s); err != nil { + return err + } + if err := Convert_v1alpha1_ContainerStatus_To_container_ContainerStatus(&in.InitContainerStatus, &out.InitContainerStatus, s); err != nil { + return err + } + if err := Convert_v1alpha1_ContainerStatus_To_container_ContainerStatus(&in.WaitContainerStatus, &out.WaitContainerStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_PodStatus_To_container_PodStatus is an autogenerated conversion function. +func Convert_v1alpha1_PodStatus_To_container_PodStatus(in *PodStatus, out *container.PodStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_PodStatus_To_container_PodStatus(in, out, s) +} + +func autoConvert_container_PodStatus_To_v1alpha1_PodStatus(in *container.PodStatus, out *PodStatus, s conversion.Scope) error { + out.PodName = in.PodName + out.LastRun = (*metav1.Time)(unsafe.Pointer(in.LastRun)) + if err := Convert_container_ContainerStatus_To_v1alpha1_ContainerStatus(&in.ContainerStatus, &out.ContainerStatus, s); err != nil { + return err + } + if err := Convert_container_ContainerStatus_To_v1alpha1_ContainerStatus(&in.InitContainerStatus, &out.InitContainerStatus, s); err != nil { + return err + } + if err := Convert_container_ContainerStatus_To_v1alpha1_ContainerStatus(&in.WaitContainerStatus, &out.WaitContainerStatus, s); err != nil { + return err + } + return nil +} + +// Convert_container_PodStatus_To_v1alpha1_PodStatus is an autogenerated conversion function. +func Convert_container_PodStatus_To_v1alpha1_PodStatus(in *container.PodStatus, out *PodStatus, s conversion.Scope) error { + return autoConvert_container_PodStatus_To_v1alpha1_PodStatus(in, out, s) +} + +func autoConvert_v1alpha1_ProviderConfiguration_To_container_ProviderConfiguration(in *ProviderConfiguration, out *container.ProviderConfiguration, s conversion.Scope) error { + out.Image = in.Image + out.Command = *(*[]string)(unsafe.Pointer(&in.Command)) + out.Args = *(*[]string)(unsafe.Pointer(&in.Args)) + out.ImportValues = *(*json.RawMessage)(unsafe.Pointer(&in.ImportValues)) + out.Blueprint = (*corev1alpha1.BlueprintDefinition)(unsafe.Pointer(in.Blueprint)) + out.ComponentDescriptor = (*corev1alpha1.ComponentDescriptorDefinition)(unsafe.Pointer(in.ComponentDescriptor)) + out.RegistryPullSecrets = *(*[]corev1alpha1.ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + out.ContinuousReconcile = (*continuousreconcile.ContinuousReconcileSpec)(unsafe.Pointer(in.ContinuousReconcile)) + return nil +} + +// Convert_v1alpha1_ProviderConfiguration_To_container_ProviderConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_ProviderConfiguration_To_container_ProviderConfiguration(in *ProviderConfiguration, out *container.ProviderConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_ProviderConfiguration_To_container_ProviderConfiguration(in, out, s) +} + +func autoConvert_container_ProviderConfiguration_To_v1alpha1_ProviderConfiguration(in *container.ProviderConfiguration, out *ProviderConfiguration, s conversion.Scope) error { + out.Image = in.Image + out.Command = *(*[]string)(unsafe.Pointer(&in.Command)) + out.Args = *(*[]string)(unsafe.Pointer(&in.Args)) + out.ImportValues = *(*json.RawMessage)(unsafe.Pointer(&in.ImportValues)) + out.Blueprint = (*corev1alpha1.BlueprintDefinition)(unsafe.Pointer(in.Blueprint)) + out.ComponentDescriptor = (*corev1alpha1.ComponentDescriptorDefinition)(unsafe.Pointer(in.ComponentDescriptor)) + out.RegistryPullSecrets = *(*[]corev1alpha1.ObjectReference)(unsafe.Pointer(&in.RegistryPullSecrets)) + out.ContinuousReconcile = (*continuousreconcile.ContinuousReconcileSpec)(unsafe.Pointer(in.ContinuousReconcile)) + return nil +} + +// Convert_container_ProviderConfiguration_To_v1alpha1_ProviderConfiguration is an autogenerated conversion function. +func Convert_container_ProviderConfiguration_To_v1alpha1_ProviderConfiguration(in *container.ProviderConfiguration, out *ProviderConfiguration, s conversion.Scope) error { + return autoConvert_container_ProviderConfiguration_To_v1alpha1_ProviderConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_ProviderStatus_To_container_ProviderStatus(in *ProviderStatus, out *container.ProviderStatus, s conversion.Scope) error { + out.LastOperation = in.LastOperation + out.PodStatus = (*container.PodStatus)(unsafe.Pointer(in.PodStatus)) + return nil +} + +// Convert_v1alpha1_ProviderStatus_To_container_ProviderStatus is an autogenerated conversion function. +func Convert_v1alpha1_ProviderStatus_To_container_ProviderStatus(in *ProviderStatus, out *container.ProviderStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ProviderStatus_To_container_ProviderStatus(in, out, s) +} + +func autoConvert_container_ProviderStatus_To_v1alpha1_ProviderStatus(in *container.ProviderStatus, out *ProviderStatus, s conversion.Scope) error { + out.LastOperation = in.LastOperation + out.PodStatus = (*PodStatus)(unsafe.Pointer(in.PodStatus)) + return nil +} + +// Convert_container_ProviderStatus_To_v1alpha1_ProviderStatus is an autogenerated conversion function. +func Convert_container_ProviderStatus_To_v1alpha1_ProviderStatus(in *container.ProviderStatus, out *ProviderStatus, s conversion.Scope) error { + return autoConvert_container_ProviderStatus_To_v1alpha1_ProviderStatus(in, out, s) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..95f3eeddb --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,260 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + + runtime "k8s.io/apimachinery/pkg/runtime" + + config "github.com/gardener/landscaper/apis/config" + corev1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + continuousreconcile "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Configuration) DeepCopyInto(out *Configuration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.OCI != nil { + in, out := &in.OCI, &out.OCI + *out = new(config.OCIConfiguration) + (*in).DeepCopyInto(*out) + } + if in.TargetSelector != nil { + in, out := &in.TargetSelector, &out.TargetSelector + *out = make([]corev1alpha1.TargetSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.DefaultImage.DeepCopyInto(&out.DefaultImage) + in.InitContainer.DeepCopyInto(&out.InitContainer) + in.WaitContainer.DeepCopyInto(&out.WaitContainer) + out.GarbageCollection = in.GarbageCollection + if in.DebugOptions != nil { + in, out := &in.DebugOptions, &out.DebugOptions + *out = new(DebugOptions) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Configuration. +func (in *Configuration) DeepCopy() *Configuration { + if in == nil { + return nil + } + out := new(Configuration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Configuration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerSpec) DeepCopyInto(out *ContainerSpec) { + *out = *in + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerSpec. +func (in *ContainerSpec) DeepCopy() *ContainerSpec { + if in == nil { + return nil + } + out := new(ContainerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerStatus) DeepCopyInto(out *ContainerStatus) { + *out = *in + in.State.DeepCopyInto(&out.State) + if in.ExitCode != nil { + in, out := &in.ExitCode, &out.ExitCode + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerStatus. +func (in *ContainerStatus) DeepCopy() *ContainerStatus { + if in == nil { + return nil + } + out := new(ContainerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DebugOptions) DeepCopyInto(out *DebugOptions) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DebugOptions. +func (in *DebugOptions) DeepCopy() *DebugOptions { + if in == nil { + return nil + } + out := new(DebugOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GarbageCollection) DeepCopyInto(out *GarbageCollection) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GarbageCollection. +func (in *GarbageCollection) DeepCopy() *GarbageCollection { + if in == nil { + return nil + } + out := new(GarbageCollection) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodStatus) DeepCopyInto(out *PodStatus) { + *out = *in + if in.LastRun != nil { + in, out := &in.LastRun, &out.LastRun + *out = (*in).DeepCopy() + } + in.ContainerStatus.DeepCopyInto(&out.ContainerStatus) + in.InitContainerStatus.DeepCopyInto(&out.InitContainerStatus) + in.WaitContainerStatus.DeepCopyInto(&out.WaitContainerStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodStatus. +func (in *PodStatus) DeepCopy() *PodStatus { + if in == nil { + return nil + } + out := new(PodStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderConfiguration) DeepCopyInto(out *ProviderConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ImportValues != nil { + in, out := &in.ImportValues, &out.ImportValues + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + if in.Blueprint != nil { + in, out := &in.Blueprint, &out.Blueprint + *out = new(corev1alpha1.BlueprintDefinition) + (*in).DeepCopyInto(*out) + } + if in.ComponentDescriptor != nil { + in, out := &in.ComponentDescriptor, &out.ComponentDescriptor + *out = new(corev1alpha1.ComponentDescriptorDefinition) + (*in).DeepCopyInto(*out) + } + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]corev1alpha1.ObjectReference, len(*in)) + copy(*out, *in) + } + if in.ContinuousReconcile != nil { + in, out := &in.ContinuousReconcile, &out.ContinuousReconcile + *out = new(continuousreconcile.ContinuousReconcileSpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfiguration. +func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration { + if in == nil { + return nil + } + out := new(ProviderConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProviderConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderStatus) DeepCopyInto(out *ProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.PodStatus != nil { + in, out := &in.PodStatus, &out.PodStatus + *out = new(PodStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderStatus. +func (in *ProviderStatus) DeepCopy() *ProviderStatus { + if in == nil { + return nil + } + out := new(ProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.defaults.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.defaults.go new file mode 100644 index 000000000..47b1fb0dd --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,28 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&Configuration{}, func(obj interface{}) { SetObjectDefaults_Configuration(obj.(*Configuration)) }) + return nil +} + +func SetObjectDefaults_Configuration(in *Configuration) { + SetDefaults_Configuration(in) + SetDefaults_GarbageCollection(&in.GarbageCollection) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/zz_generated.deepcopy.go new file mode 100644 index 000000000..7540f4c0e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/container/zz_generated.deepcopy.go @@ -0,0 +1,260 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package container + +import ( + json "encoding/json" + + runtime "k8s.io/apimachinery/pkg/runtime" + + config "github.com/gardener/landscaper/apis/config" + v1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + continuousreconcile "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Configuration) DeepCopyInto(out *Configuration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.OCI != nil { + in, out := &in.OCI, &out.OCI + *out = new(config.OCIConfiguration) + (*in).DeepCopyInto(*out) + } + if in.TargetSelector != nil { + in, out := &in.TargetSelector, &out.TargetSelector + *out = make([]v1alpha1.TargetSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.DefaultImage.DeepCopyInto(&out.DefaultImage) + in.InitContainer.DeepCopyInto(&out.InitContainer) + in.WaitContainer.DeepCopyInto(&out.WaitContainer) + out.GarbageCollection = in.GarbageCollection + if in.DebugOptions != nil { + in, out := &in.DebugOptions, &out.DebugOptions + *out = new(DebugOptions) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Configuration. +func (in *Configuration) DeepCopy() *Configuration { + if in == nil { + return nil + } + out := new(Configuration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Configuration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerSpec) DeepCopyInto(out *ContainerSpec) { + *out = *in + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerSpec. +func (in *ContainerSpec) DeepCopy() *ContainerSpec { + if in == nil { + return nil + } + out := new(ContainerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerStatus) DeepCopyInto(out *ContainerStatus) { + *out = *in + in.State.DeepCopyInto(&out.State) + if in.ExitCode != nil { + in, out := &in.ExitCode, &out.ExitCode + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerStatus. +func (in *ContainerStatus) DeepCopy() *ContainerStatus { + if in == nil { + return nil + } + out := new(ContainerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DebugOptions) DeepCopyInto(out *DebugOptions) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DebugOptions. +func (in *DebugOptions) DeepCopy() *DebugOptions { + if in == nil { + return nil + } + out := new(DebugOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GarbageCollection) DeepCopyInto(out *GarbageCollection) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GarbageCollection. +func (in *GarbageCollection) DeepCopy() *GarbageCollection { + if in == nil { + return nil + } + out := new(GarbageCollection) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodStatus) DeepCopyInto(out *PodStatus) { + *out = *in + if in.LastRun != nil { + in, out := &in.LastRun, &out.LastRun + *out = (*in).DeepCopy() + } + in.ContainerStatus.DeepCopyInto(&out.ContainerStatus) + in.InitContainerStatus.DeepCopyInto(&out.InitContainerStatus) + in.WaitContainerStatus.DeepCopyInto(&out.WaitContainerStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodStatus. +func (in *PodStatus) DeepCopy() *PodStatus { + if in == nil { + return nil + } + out := new(PodStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderConfiguration) DeepCopyInto(out *ProviderConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ImportValues != nil { + in, out := &in.ImportValues, &out.ImportValues + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + if in.Blueprint != nil { + in, out := &in.Blueprint, &out.Blueprint + *out = new(v1alpha1.BlueprintDefinition) + (*in).DeepCopyInto(*out) + } + if in.ComponentDescriptor != nil { + in, out := &in.ComponentDescriptor, &out.ComponentDescriptor + *out = new(v1alpha1.ComponentDescriptorDefinition) + (*in).DeepCopyInto(*out) + } + if in.RegistryPullSecrets != nil { + in, out := &in.RegistryPullSecrets, &out.RegistryPullSecrets + *out = make([]v1alpha1.ObjectReference, len(*in)) + copy(*out, *in) + } + if in.ContinuousReconcile != nil { + in, out := &in.ContinuousReconcile, &out.ContinuousReconcile + *out = new(continuousreconcile.ContinuousReconcileSpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfiguration. +func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration { + if in == nil { + return nil + } + out := new(ProviderConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProviderConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderStatus) DeepCopyInto(out *ProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.PodStatus != nil { + in, out := &in.PodStatus, &out.PodStatus + *out = new(PodStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderStatus. +func (in *ProviderStatus) DeepCopy() *ProviderStatus { + if in == nil { + return nil + } + out := new(ProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/doc.go new file mode 100644 index 000000000..695e3e42f --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/doc.go @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=helm.deployer.landscaper.gardener.cloud +package helm diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/register.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/register.go new file mode 100644 index 000000000..b7595cfb3 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/register.go @@ -0,0 +1,42 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package helm + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the name of the Garden API group. +const GroupName = "helm.deployer.landscaper.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &ProviderStatus{}, + &ProviderConfiguration{}, + &Configuration{}, + ) + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/types_config.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/types_config.go new file mode 100644 index 000000000..50897696e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/types_config.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package helm + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/gardener/landscaper/apis/config" + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Configuration is the helm deployer configuration that configures the controller +type Configuration struct { + metav1.TypeMeta `json:",inline"` + // Identity identity describes the unique identity of the deployer. + // +optional + Identity string `json:"identity,omitempty"` + // OCI configures the oci client of the controller + OCI *config.OCIConfiguration `json:"oci,omitempty"` + // TargetSelector describes all selectors the deployer should depend on. + TargetSelector []lsv1alpha1.TargetSelector `json:"targetSelector,omitempty"` + // Export defines the export configuration. + Export ExportConfiguration `json:"export,omitempty"` +} + +// ExportConfiguration defines the export configuration for the deployer. +type ExportConfiguration struct { + // DefaultTimeout configures the default timeout for all exports without a explicit export timeout defined. + // +optional + DefaultTimeout *lsv1alpha1.Duration `json:"defaultTimeout,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/types_provider.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/types_provider.go new file mode 100644 index 000000000..6b35e99e0 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/types_provider.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package helm + +import ( + "encoding/json" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/gardener/landscaper/apis/deployer/utils/managedresource" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cr "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" + + lscore "github.com/gardener/landscaper/apis/core" + health "github.com/gardener/landscaper/apis/deployer/utils/readinesschecks" +) + +const HelmChartRepoCredentialsKey = "helmChartRepoCredentials" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ProviderConfiguration is the helm deployer configuration that is expected in a DeployItem +type ProviderConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // Kubeconfig is the base64 encoded kubeconfig file. + // By default the configured target is used to deploy the resources + // +optional + Kubeconfig string `json:"kubeconfig"` + + // ReadinessChecks configures the readiness checks. + // +optional + ReadinessChecks health.ReadinessCheckConfiguration `json:"readinessChecks,omitempty"` + + // DeleteTimeout is the time to wait before giving up on a resource to be deleted. + // Defaults to 180s. + // +optional + DeleteTimeout *lscore.Duration `json:"deleteTimeout,omitempty"` + + // UpdateStrategy defines the strategy how the manifests are updated in the cluster. + // Defaults to "update". + // +optional + UpdateStrategy UpdateStrategy `json:"updateStrategy,omitempty"` + + // Chart defines helm chart to be templated and applied. + Chart Chart `json:"chart"` + + // Name is the release name of the chart + Name string `json:"name"` + + // Namespace is the release namespace of the chart + Namespace string `json:"namespace"` + + // CreateNamespace configures the deployer to create the release namespace if not present. + // The behavior is similar to the "helm install --create-namespace" + CreateNamespace bool `json:"createNamespace"` + + // Values are the values that are used for templating. + Values json.RawMessage `json:"values,omitempty"` + + // ExportsFromManifests describe the exports from the templated manifests that should be exported by the helm deployer. + // +optional + // DEPRECATED + ExportsFromManifests []managedresource.Export `json:"exportsFromManifests,omitempty"` + + // Exports describe the exports from the templated manifests that should be exported by the helm deployer. + // +optional + Exports *managedresource.Exports `json:"exports,omitempty"` + + // ContinuousReconcile contains the schedule for continuous reconciliation. + // +optional + ContinuousReconcile *cr.ContinuousReconcileSpec `json:"continuousReconcile,omitempty"` + + // HelmDeployment indicates that helm is used as complete deployment mechanism and not only helm templating. + // Default is true. + // +optional + HelmDeployment *bool `json:"helmDeployment,omitempty"` + + // HelmDeploymentConfig contains settings for helm operations. Only relevant if HelmDeployment is true. + // +optional + HelmDeploymentConfig *HelmDeploymentConfiguration `json:"helmDeploymentConfig,omitempty"` +} + +// UpdateStrategy defines the strategy that is used to apply resources to the cluster. +type UpdateStrategy string + +const ( + UpdateStrategyUpdate UpdateStrategy = "update" + UpdateStrategyPatch UpdateStrategy = "patch" +) + +// Chart defines the helm chart to render and apply. +type Chart struct { + // Ref defines the reference to a helm chart in a oci repository. + // +optional + Ref string `json:"ref,omitempty"` + // FromResource fetches the chart based on the resource's access method. + // The resource is defined as part of a component descriptor which is necessary to also handle + // local artifacts. + // +optional + FromResource *RemoteChartReference `json:"fromResource,omitempty"` + // Archive defines a compressed tarred helm chart as base64 encoded string. + // +optional + Archive *ArchiveAccess `json:"archive,omitempty"` + // HelmChartRepo defines a reference to a chart in a helm chart repo. + // +optional + HelmChartRepo *HelmChartRepo `json:"helmChartRepo,omitempty"` +} + +// HelmChartRepo defines a reference to a chart in a helm chart repo +type HelmChartRepo struct { + HelmChartRepoUrl string `json:"helmChartRepoUrl,omitempty"` + HelmChartName string `json:"helmChartName,omitempty"` + HelmChartVersion string `json:"helmChartVersion,omitempty"` +} + +// RemoteChartReference defines a reference to a remote Helm chart through a Component-Descriptor +type RemoteChartReference struct { + lsv1alpha1.ComponentDescriptorDefinition `json:",inline"` + // ResourceName is the name of the Helm chart as defined by a component descriptor. + ResourceName string `json:"resourceName"` +} + +// ArchiveAccess defines the access for a helm chart as compressed archive. +type ArchiveAccess struct { + // Raw defines a compressed tarred helm chart as base64 encoded string. + // +optional + Raw string `json:"raw,omitempty"` + // Remote defines the remote access for a helm chart as compressed archive. + // +optional + Remote *RemoteArchiveAccess `json:"remote,omitempty"` +} + +// RemoteArchiveAccess defines the remote access for a helm chart as compressed archive. +type RemoteArchiveAccess struct { + // URL defines a compressed tarred helm chart that is fetched from a url. + // +optional + URL string `json:"url,omitempty"` +} + +// HelmDeploymentConfiguration defines settings for a helm deployment. +type HelmDeploymentConfiguration struct { + Install map[string]lscore.AnyJSON `json:"install,omitempty"` + Upgrade map[string]lscore.AnyJSON `json:"upgrade,omitempty"` + Uninstall map[string]lscore.AnyJSON `json:"uninstall,omitempty"` +} + +// HelmInstallConfiguration defines settings for a helm install operation. +type HelmInstallConfiguration struct { + Atomic bool `json:"atomic,omitempty"` + // Timeout is the timeout for the operation in minutes. + // +optional + Timeout *lsv1alpha1.Duration `json:"timeout,omitempty"` +} + +// HelmUpgradeConfiguration defines settings for a helm upgrade operation. +type HelmUpgradeConfiguration = HelmInstallConfiguration + +// HelmUninstallConfiguration defines settings for a helm uninstall operation. +type HelmUninstallConfiguration struct { + // Timeout is the timeout for the operation in minutes. + // +optional + Timeout *lsv1alpha1.Duration `json:"timeout,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ProviderStatus is the helm provider specific status +type ProviderStatus struct { + metav1.TypeMeta `json:",inline"` + + // ManagedResources contains all kubernetes resources that are deployed by the helm deployer. + ManagedResources managedresource.ManagedResourceStatusList `json:"managedResources,omitempty"` +} + +// HelmChartRepoCredentials contains the credentials to access hepl chart repos +type HelmChartRepoCredentials struct { + Auths []Auth `json:"auths,omitempty"` +} + +// Auth contains authentication info for one helm chart repo +type Auth struct { + // URL contains URL of helm chart repo + URL string `json:"url,omitempty"` + // CustomCAData allows you to add a custom CA, which is useful if your server speaks HTTPS with a self- + // signed certificate. The added certificate must be in PEM format and base64 encoded. + // +optional + CustomCAData string `json:"customCAData,omitempty"` + // AuthHeader contains the value that will be set in the "Authorization" header when fetching the Chart, e.g. + // "Basic dX...3dvcmQ=". + AuthHeader string `json:"authHeader,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/defaults.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/defaults.go new file mode 100644 index 000000000..322eba7b4 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/defaults.go @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "time" + + "k8s.io/apimachinery/pkg/runtime" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_ProviderConfiguration sets the defaults for the helm deployer provider configuration. +func SetDefaults_ProviderConfiguration(obj *ProviderConfiguration) { + if len(obj.UpdateStrategy) == 0 { + obj.UpdateStrategy = UpdateStrategyUpdate + } + if obj.ReadinessChecks.Timeout == nil { + obj.ReadinessChecks.Timeout = &lsv1alpha1.Duration{Duration: 3 * time.Minute} + } + if obj.DeleteTimeout == nil { + obj.DeleteTimeout = &lsv1alpha1.Duration{Duration: 3 * time.Minute} + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/doc.go new file mode 100644 index 000000000..c35688a6d --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/doc.go @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=github.com/gardener/landscaper/apis/deployer/helm +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=helm.deployer.landscaper.gardener.cloud +package v1alpha1 diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/register.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/register.go new file mode 100644 index 000000000..c8c2f71f0 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/register.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the name of the Garden API group. +const GroupName = "helm.deployer.landscaper.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs) + localSchemeBuilder = &SchemeBuilder + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to Schema. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &ProviderStatus{}, + &ProviderConfiguration{}, + &Configuration{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/types_config.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/types_config.go new file mode 100644 index 000000000..9db5bc9a9 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/types_config.go @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/gardener/landscaper/apis/config" + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// ManagedInstanceLabel describes label that is added to every helm deployer managed resource +// to define its corresponding instance. +const ManagedInstanceLabel = "helm.deployer.landscaper.gardener.cloud/instance" + +// ManagedDeployItemLabel describes label that is added to every helm deployer managed resource +// to define its source deploy item. +const ManagedDeployItemLabel = "helm.deployer.landscaper.gardener.cloud/deployitem" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Configuration is the helm deployer configuration that configures the controller +type Configuration struct { + metav1.TypeMeta `json:",inline"` + // Identity identity describes the unique identity of the deployer. + // +optional + Identity string `json:"identity,omitempty"` + // OCI configures the oci client of the controller + OCI *config.OCIConfiguration `json:"oci,omitempty"` + // TargetSelector describes all selectors the deployer should depend on. + TargetSelector []lsv1alpha1.TargetSelector `json:"targetSelector,omitempty"` + // Export defines the export configuration. + Export ExportConfiguration `json:"export,omitempty"` +} + +// ExportConfiguration defines the export configuration for the deployer. +type ExportConfiguration struct { + // DefaultTimeout configures the default timeout for all exports without a explicit export timeout defined. + // +optional + DefaultTimeout *lsv1alpha1.Duration `json:"defaultTimeout,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/types_provider.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/types_provider.go new file mode 100644 index 000000000..51ac9b60a --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/types_provider.go @@ -0,0 +1,193 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + "encoding/json" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/gardener/landscaper/apis/deployer/utils/managedresource" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + cr "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" + health "github.com/gardener/landscaper/apis/deployer/utils/readinesschecks" +) + +const HelmChartRepoCredentialsKey = "helmChartRepoCredentials" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ProviderConfiguration is the helm deployer configuration that is expected in a DeployItem +type ProviderConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // Kubeconfig is the base64 encoded kubeconfig file. + // By default the configured target is used to deploy the resources + // +optional + Kubeconfig string `json:"kubeconfig"` + + // UpdateStrategy defines the strategy how the manifests are updated in the cluster. + // Defaults to "update". + // +optional + UpdateStrategy UpdateStrategy `json:"updateStrategy,omitempty"` + + // ReadinessChecks configures the readiness checks. + // +optional + ReadinessChecks health.ReadinessCheckConfiguration `json:"readinessChecks,omitempty"` + + // DeleteTimeout is the time to wait before giving up on a resource to be deleted. + // Defaults to 180s. + // +optional + DeleteTimeout *lsv1alpha1.Duration `json:"deleteTimeout,omitempty"` + + // Chart defines helm chart to be templated and applied. + Chart Chart `json:"chart"` + + // Name is the release name of the chart + Name string `json:"name"` + + // Namespace is the release namespace of the chart + Namespace string `json:"namespace"` + + // CreateNamespace configures the deployer to create the release namespace if not present. + // The behavior is similar to the "helm install --create-namespace" + CreateNamespace bool `json:"createNamespace"` + + // Values are the values that are used for templating. + Values json.RawMessage `json:"values,omitempty"` + + // ExportsFromManifests describe the exports from the templated manifests that should be exported by the helm deployer. + // +optional + // DEPRECATED + ExportsFromManifests []managedresource.Export `json:"exportsFromManifests,omitempty"` + + // Exports describe the exports from the templated manifests that should be exported by the helm deployer. + // +optional + Exports *managedresource.Exports `json:"exports,omitempty"` + + // ContinuousReconcile contains the schedule for continuous reconciliation. + // +optional + ContinuousReconcile *cr.ContinuousReconcileSpec `json:"continuousReconcile,omitempty"` + + // HelmDeployment indicates that helm is used as complete deployment mechanism and not only helm templating. + // Default is true. + // +optional + HelmDeployment *bool `json:"helmDeployment,omitempty"` + + // HelmDeploymentConfig contains settings for helm operations. Only relevant if HelmDeployment is true. + // +optional + HelmDeploymentConfig *HelmDeploymentConfiguration `json:"helmDeploymentConfig,omitempty"` +} + +// UpdateStrategy defines the strategy that is used to apply resources to the cluster. +type UpdateStrategy string + +const ( + UpdateStrategyUpdate UpdateStrategy = "update" + UpdateStrategyPatch UpdateStrategy = "patch" +) + +// Chart defines the helm chart to render and apply. +type Chart struct { + // Ref defines the reference to a helm chart in a oci repository. + // +optional + Ref string `json:"ref,omitempty"` + // FromResource fetches the chart based on the resource's access method. + // The resource is defined as part of a component descriptor which is necessary to also handle + // local artifacts. + // +optional + FromResource *RemoteChartReference `json:"fromResource,omitempty"` + // Archive defines a compressed tarred helm chart as base64 encoded string. + // +optional + Archive *ArchiveAccess `json:"archive,omitempty"` + // HelmChartRepo defines a reference to a chart in a helm chart repo. + // +optional + HelmChartRepo *HelmChartRepo `json:"helmChartRepo,omitempty"` +} + +// HelmChartRepo defines a reference to a chart in a helm chart repo +type HelmChartRepo struct { + HelmChartRepoUrl string `json:"helmChartRepoUrl,omitempty"` + HelmChartName string `json:"helmChartName,omitempty"` + HelmChartVersion string `json:"helmChartVersion,omitempty"` +} + +// RemoteChartReference defines a reference to a remote Helm chart through a Component-Descriptor +type RemoteChartReference struct { + lsv1alpha1.ComponentDescriptorDefinition `json:",inline"` + // ResourceName is the name of the Helm chart as defined by a component descriptor. + ResourceName string `json:"resourceName"` +} + +// ArchiveAccess defines the access for a helm chart as compressed archive. +type ArchiveAccess struct { + // Raw defines a compressed tarred helm chart as base64 encoded string. + // +optional + Raw string `json:"raw,omitempty"` + // Remote defines the remote access for a helm chart as compressed archive. + // +optional + Remote *RemoteArchiveAccess `json:"remote,omitempty"` +} + +// RemoteArchiveAccess defines the remote access for a helm chart as compressed archive. +type RemoteArchiveAccess struct { + // URL defines a compressed tarred helm chart that is fetched from a url. + // +optional + URL string `json:"url,omitempty"` +} + +// HelmDeploymentConfiguration defines settings for a helm deployment. +type HelmDeploymentConfiguration struct { + Install map[string]lsv1alpha1.AnyJSON `json:"install,omitempty"` + Upgrade map[string]lsv1alpha1.AnyJSON `json:"upgrade,omitempty"` + Uninstall map[string]lsv1alpha1.AnyJSON `json:"uninstall,omitempty"` +} + +// HelmInstallConfiguration defines settings for a helm install operation. +type HelmInstallConfiguration struct { + Atomic bool `json:"atomic,omitempty"` + // Timeout is the timeout for the operation in minutes. + // +optional + Timeout *lsv1alpha1.Duration `json:"timeout,omitempty"` +} + +// HelmUpgradeConfiguration defines settings for a helm upgrade operation. +type HelmUpgradeConfiguration = HelmInstallConfiguration + +// HelmUninstallConfiguration defines settings for a helm uninstall operation. +type HelmUninstallConfiguration struct { + // Timeout is the timeout for the operation in minutes. + // +optional + Timeout *lsv1alpha1.Duration `json:"timeout,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ProviderStatus is the helm provider specific status +type ProviderStatus struct { + metav1.TypeMeta `json:",inline"` + + // ManagedResources contains all kubernetes resources that are deployed by the helm deployer. + ManagedResources managedresource.ManagedResourceStatusList `json:"managedResources,omitempty"` +} + +// HelmChartRepoCredentials contains the credentials to access hepl chart repos +type HelmChartRepoCredentials struct { + Auths []Auth `json:"auths,omitempty"` +} + +// Auth contains authentication info for one helm chart repo +type Auth struct { + // URL contains URL of helm chart repo + URL string `json:"url,omitempty"` + // CustomCAData allows you to add a custom CA, which is useful if your server speaks HTTPS with a self- + // signed certificate. The added certificate must be in PEM format and base64 encoded. + // +optional + CustomCAData string `json:"customCAData,omitempty"` + // AuthHeader contains the value that will be set in the "Authorization" header when fetching the Chart, e.g. + // "Basic dX...3dvcmQ=". + AuthHeader string `json:"authHeader,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.conversion.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000..daa23488b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,520 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + + config "github.com/gardener/landscaper/apis/config" + core "github.com/gardener/landscaper/apis/core" + corev1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + helm "github.com/gardener/landscaper/apis/deployer/helm" + continuousreconcile "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" + managedresource "github.com/gardener/landscaper/apis/deployer/utils/managedresource" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*ArchiveAccess)(nil), (*helm.ArchiveAccess)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ArchiveAccess_To_helm_ArchiveAccess(a.(*ArchiveAccess), b.(*helm.ArchiveAccess), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.ArchiveAccess)(nil), (*ArchiveAccess)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_ArchiveAccess_To_v1alpha1_ArchiveAccess(a.(*helm.ArchiveAccess), b.(*ArchiveAccess), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Auth)(nil), (*helm.Auth)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Auth_To_helm_Auth(a.(*Auth), b.(*helm.Auth), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.Auth)(nil), (*Auth)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_Auth_To_v1alpha1_Auth(a.(*helm.Auth), b.(*Auth), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Chart)(nil), (*helm.Chart)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Chart_To_helm_Chart(a.(*Chart), b.(*helm.Chart), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.Chart)(nil), (*Chart)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_Chart_To_v1alpha1_Chart(a.(*helm.Chart), b.(*Chart), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Configuration)(nil), (*helm.Configuration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Configuration_To_helm_Configuration(a.(*Configuration), b.(*helm.Configuration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.Configuration)(nil), (*Configuration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_Configuration_To_v1alpha1_Configuration(a.(*helm.Configuration), b.(*Configuration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExportConfiguration)(nil), (*helm.ExportConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ExportConfiguration_To_helm_ExportConfiguration(a.(*ExportConfiguration), b.(*helm.ExportConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.ExportConfiguration)(nil), (*ExportConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_ExportConfiguration_To_v1alpha1_ExportConfiguration(a.(*helm.ExportConfiguration), b.(*ExportConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*HelmChartRepo)(nil), (*helm.HelmChartRepo)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_HelmChartRepo_To_helm_HelmChartRepo(a.(*HelmChartRepo), b.(*helm.HelmChartRepo), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.HelmChartRepo)(nil), (*HelmChartRepo)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_HelmChartRepo_To_v1alpha1_HelmChartRepo(a.(*helm.HelmChartRepo), b.(*HelmChartRepo), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*HelmChartRepoCredentials)(nil), (*helm.HelmChartRepoCredentials)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_HelmChartRepoCredentials_To_helm_HelmChartRepoCredentials(a.(*HelmChartRepoCredentials), b.(*helm.HelmChartRepoCredentials), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.HelmChartRepoCredentials)(nil), (*HelmChartRepoCredentials)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_HelmChartRepoCredentials_To_v1alpha1_HelmChartRepoCredentials(a.(*helm.HelmChartRepoCredentials), b.(*HelmChartRepoCredentials), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*HelmDeploymentConfiguration)(nil), (*helm.HelmDeploymentConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_HelmDeploymentConfiguration_To_helm_HelmDeploymentConfiguration(a.(*HelmDeploymentConfiguration), b.(*helm.HelmDeploymentConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.HelmDeploymentConfiguration)(nil), (*HelmDeploymentConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_HelmDeploymentConfiguration_To_v1alpha1_HelmDeploymentConfiguration(a.(*helm.HelmDeploymentConfiguration), b.(*HelmDeploymentConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*HelmInstallConfiguration)(nil), (*helm.HelmInstallConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_HelmInstallConfiguration_To_helm_HelmInstallConfiguration(a.(*HelmInstallConfiguration), b.(*helm.HelmInstallConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.HelmInstallConfiguration)(nil), (*HelmInstallConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_HelmInstallConfiguration_To_v1alpha1_HelmInstallConfiguration(a.(*helm.HelmInstallConfiguration), b.(*HelmInstallConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*HelmUninstallConfiguration)(nil), (*helm.HelmUninstallConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_HelmUninstallConfiguration_To_helm_HelmUninstallConfiguration(a.(*HelmUninstallConfiguration), b.(*helm.HelmUninstallConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.HelmUninstallConfiguration)(nil), (*HelmUninstallConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_HelmUninstallConfiguration_To_v1alpha1_HelmUninstallConfiguration(a.(*helm.HelmUninstallConfiguration), b.(*HelmUninstallConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ProviderConfiguration)(nil), (*helm.ProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ProviderConfiguration_To_helm_ProviderConfiguration(a.(*ProviderConfiguration), b.(*helm.ProviderConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.ProviderConfiguration)(nil), (*ProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_ProviderConfiguration_To_v1alpha1_ProviderConfiguration(a.(*helm.ProviderConfiguration), b.(*ProviderConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ProviderStatus)(nil), (*helm.ProviderStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ProviderStatus_To_helm_ProviderStatus(a.(*ProviderStatus), b.(*helm.ProviderStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.ProviderStatus)(nil), (*ProviderStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_ProviderStatus_To_v1alpha1_ProviderStatus(a.(*helm.ProviderStatus), b.(*ProviderStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RemoteArchiveAccess)(nil), (*helm.RemoteArchiveAccess)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RemoteArchiveAccess_To_helm_RemoteArchiveAccess(a.(*RemoteArchiveAccess), b.(*helm.RemoteArchiveAccess), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.RemoteArchiveAccess)(nil), (*RemoteArchiveAccess)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_RemoteArchiveAccess_To_v1alpha1_RemoteArchiveAccess(a.(*helm.RemoteArchiveAccess), b.(*RemoteArchiveAccess), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RemoteChartReference)(nil), (*helm.RemoteChartReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RemoteChartReference_To_helm_RemoteChartReference(a.(*RemoteChartReference), b.(*helm.RemoteChartReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*helm.RemoteChartReference)(nil), (*RemoteChartReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_helm_RemoteChartReference_To_v1alpha1_RemoteChartReference(a.(*helm.RemoteChartReference), b.(*RemoteChartReference), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_ArchiveAccess_To_helm_ArchiveAccess(in *ArchiveAccess, out *helm.ArchiveAccess, s conversion.Scope) error { + out.Raw = in.Raw + out.Remote = (*helm.RemoteArchiveAccess)(unsafe.Pointer(in.Remote)) + return nil +} + +// Convert_v1alpha1_ArchiveAccess_To_helm_ArchiveAccess is an autogenerated conversion function. +func Convert_v1alpha1_ArchiveAccess_To_helm_ArchiveAccess(in *ArchiveAccess, out *helm.ArchiveAccess, s conversion.Scope) error { + return autoConvert_v1alpha1_ArchiveAccess_To_helm_ArchiveAccess(in, out, s) +} + +func autoConvert_helm_ArchiveAccess_To_v1alpha1_ArchiveAccess(in *helm.ArchiveAccess, out *ArchiveAccess, s conversion.Scope) error { + out.Raw = in.Raw + out.Remote = (*RemoteArchiveAccess)(unsafe.Pointer(in.Remote)) + return nil +} + +// Convert_helm_ArchiveAccess_To_v1alpha1_ArchiveAccess is an autogenerated conversion function. +func Convert_helm_ArchiveAccess_To_v1alpha1_ArchiveAccess(in *helm.ArchiveAccess, out *ArchiveAccess, s conversion.Scope) error { + return autoConvert_helm_ArchiveAccess_To_v1alpha1_ArchiveAccess(in, out, s) +} + +func autoConvert_v1alpha1_Auth_To_helm_Auth(in *Auth, out *helm.Auth, s conversion.Scope) error { + out.URL = in.URL + out.CustomCAData = in.CustomCAData + out.AuthHeader = in.AuthHeader + return nil +} + +// Convert_v1alpha1_Auth_To_helm_Auth is an autogenerated conversion function. +func Convert_v1alpha1_Auth_To_helm_Auth(in *Auth, out *helm.Auth, s conversion.Scope) error { + return autoConvert_v1alpha1_Auth_To_helm_Auth(in, out, s) +} + +func autoConvert_helm_Auth_To_v1alpha1_Auth(in *helm.Auth, out *Auth, s conversion.Scope) error { + out.URL = in.URL + out.CustomCAData = in.CustomCAData + out.AuthHeader = in.AuthHeader + return nil +} + +// Convert_helm_Auth_To_v1alpha1_Auth is an autogenerated conversion function. +func Convert_helm_Auth_To_v1alpha1_Auth(in *helm.Auth, out *Auth, s conversion.Scope) error { + return autoConvert_helm_Auth_To_v1alpha1_Auth(in, out, s) +} + +func autoConvert_v1alpha1_Chart_To_helm_Chart(in *Chart, out *helm.Chart, s conversion.Scope) error { + out.Ref = in.Ref + out.FromResource = (*helm.RemoteChartReference)(unsafe.Pointer(in.FromResource)) + out.Archive = (*helm.ArchiveAccess)(unsafe.Pointer(in.Archive)) + out.HelmChartRepo = (*helm.HelmChartRepo)(unsafe.Pointer(in.HelmChartRepo)) + return nil +} + +// Convert_v1alpha1_Chart_To_helm_Chart is an autogenerated conversion function. +func Convert_v1alpha1_Chart_To_helm_Chart(in *Chart, out *helm.Chart, s conversion.Scope) error { + return autoConvert_v1alpha1_Chart_To_helm_Chart(in, out, s) +} + +func autoConvert_helm_Chart_To_v1alpha1_Chart(in *helm.Chart, out *Chart, s conversion.Scope) error { + out.Ref = in.Ref + out.FromResource = (*RemoteChartReference)(unsafe.Pointer(in.FromResource)) + out.Archive = (*ArchiveAccess)(unsafe.Pointer(in.Archive)) + out.HelmChartRepo = (*HelmChartRepo)(unsafe.Pointer(in.HelmChartRepo)) + return nil +} + +// Convert_helm_Chart_To_v1alpha1_Chart is an autogenerated conversion function. +func Convert_helm_Chart_To_v1alpha1_Chart(in *helm.Chart, out *Chart, s conversion.Scope) error { + return autoConvert_helm_Chart_To_v1alpha1_Chart(in, out, s) +} + +func autoConvert_v1alpha1_Configuration_To_helm_Configuration(in *Configuration, out *helm.Configuration, s conversion.Scope) error { + out.Identity = in.Identity + out.OCI = (*config.OCIConfiguration)(unsafe.Pointer(in.OCI)) + out.TargetSelector = *(*[]corev1alpha1.TargetSelector)(unsafe.Pointer(&in.TargetSelector)) + if err := Convert_v1alpha1_ExportConfiguration_To_helm_ExportConfiguration(&in.Export, &out.Export, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Configuration_To_helm_Configuration is an autogenerated conversion function. +func Convert_v1alpha1_Configuration_To_helm_Configuration(in *Configuration, out *helm.Configuration, s conversion.Scope) error { + return autoConvert_v1alpha1_Configuration_To_helm_Configuration(in, out, s) +} + +func autoConvert_helm_Configuration_To_v1alpha1_Configuration(in *helm.Configuration, out *Configuration, s conversion.Scope) error { + out.Identity = in.Identity + out.OCI = (*config.OCIConfiguration)(unsafe.Pointer(in.OCI)) + out.TargetSelector = *(*[]corev1alpha1.TargetSelector)(unsafe.Pointer(&in.TargetSelector)) + if err := Convert_helm_ExportConfiguration_To_v1alpha1_ExportConfiguration(&in.Export, &out.Export, s); err != nil { + return err + } + return nil +} + +// Convert_helm_Configuration_To_v1alpha1_Configuration is an autogenerated conversion function. +func Convert_helm_Configuration_To_v1alpha1_Configuration(in *helm.Configuration, out *Configuration, s conversion.Scope) error { + return autoConvert_helm_Configuration_To_v1alpha1_Configuration(in, out, s) +} + +func autoConvert_v1alpha1_ExportConfiguration_To_helm_ExportConfiguration(in *ExportConfiguration, out *helm.ExportConfiguration, s conversion.Scope) error { + out.DefaultTimeout = (*corev1alpha1.Duration)(unsafe.Pointer(in.DefaultTimeout)) + return nil +} + +// Convert_v1alpha1_ExportConfiguration_To_helm_ExportConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_ExportConfiguration_To_helm_ExportConfiguration(in *ExportConfiguration, out *helm.ExportConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_ExportConfiguration_To_helm_ExportConfiguration(in, out, s) +} + +func autoConvert_helm_ExportConfiguration_To_v1alpha1_ExportConfiguration(in *helm.ExportConfiguration, out *ExportConfiguration, s conversion.Scope) error { + out.DefaultTimeout = (*corev1alpha1.Duration)(unsafe.Pointer(in.DefaultTimeout)) + return nil +} + +// Convert_helm_ExportConfiguration_To_v1alpha1_ExportConfiguration is an autogenerated conversion function. +func Convert_helm_ExportConfiguration_To_v1alpha1_ExportConfiguration(in *helm.ExportConfiguration, out *ExportConfiguration, s conversion.Scope) error { + return autoConvert_helm_ExportConfiguration_To_v1alpha1_ExportConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_HelmChartRepo_To_helm_HelmChartRepo(in *HelmChartRepo, out *helm.HelmChartRepo, s conversion.Scope) error { + out.HelmChartRepoUrl = in.HelmChartRepoUrl + out.HelmChartName = in.HelmChartName + out.HelmChartVersion = in.HelmChartVersion + return nil +} + +// Convert_v1alpha1_HelmChartRepo_To_helm_HelmChartRepo is an autogenerated conversion function. +func Convert_v1alpha1_HelmChartRepo_To_helm_HelmChartRepo(in *HelmChartRepo, out *helm.HelmChartRepo, s conversion.Scope) error { + return autoConvert_v1alpha1_HelmChartRepo_To_helm_HelmChartRepo(in, out, s) +} + +func autoConvert_helm_HelmChartRepo_To_v1alpha1_HelmChartRepo(in *helm.HelmChartRepo, out *HelmChartRepo, s conversion.Scope) error { + out.HelmChartRepoUrl = in.HelmChartRepoUrl + out.HelmChartName = in.HelmChartName + out.HelmChartVersion = in.HelmChartVersion + return nil +} + +// Convert_helm_HelmChartRepo_To_v1alpha1_HelmChartRepo is an autogenerated conversion function. +func Convert_helm_HelmChartRepo_To_v1alpha1_HelmChartRepo(in *helm.HelmChartRepo, out *HelmChartRepo, s conversion.Scope) error { + return autoConvert_helm_HelmChartRepo_To_v1alpha1_HelmChartRepo(in, out, s) +} + +func autoConvert_v1alpha1_HelmChartRepoCredentials_To_helm_HelmChartRepoCredentials(in *HelmChartRepoCredentials, out *helm.HelmChartRepoCredentials, s conversion.Scope) error { + out.Auths = *(*[]helm.Auth)(unsafe.Pointer(&in.Auths)) + return nil +} + +// Convert_v1alpha1_HelmChartRepoCredentials_To_helm_HelmChartRepoCredentials is an autogenerated conversion function. +func Convert_v1alpha1_HelmChartRepoCredentials_To_helm_HelmChartRepoCredentials(in *HelmChartRepoCredentials, out *helm.HelmChartRepoCredentials, s conversion.Scope) error { + return autoConvert_v1alpha1_HelmChartRepoCredentials_To_helm_HelmChartRepoCredentials(in, out, s) +} + +func autoConvert_helm_HelmChartRepoCredentials_To_v1alpha1_HelmChartRepoCredentials(in *helm.HelmChartRepoCredentials, out *HelmChartRepoCredentials, s conversion.Scope) error { + out.Auths = *(*[]Auth)(unsafe.Pointer(&in.Auths)) + return nil +} + +// Convert_helm_HelmChartRepoCredentials_To_v1alpha1_HelmChartRepoCredentials is an autogenerated conversion function. +func Convert_helm_HelmChartRepoCredentials_To_v1alpha1_HelmChartRepoCredentials(in *helm.HelmChartRepoCredentials, out *HelmChartRepoCredentials, s conversion.Scope) error { + return autoConvert_helm_HelmChartRepoCredentials_To_v1alpha1_HelmChartRepoCredentials(in, out, s) +} + +func autoConvert_v1alpha1_HelmDeploymentConfiguration_To_helm_HelmDeploymentConfiguration(in *HelmDeploymentConfiguration, out *helm.HelmDeploymentConfiguration, s conversion.Scope) error { + out.Install = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.Install)) + out.Upgrade = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.Upgrade)) + out.Uninstall = *(*map[string]core.AnyJSON)(unsafe.Pointer(&in.Uninstall)) + return nil +} + +// Convert_v1alpha1_HelmDeploymentConfiguration_To_helm_HelmDeploymentConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_HelmDeploymentConfiguration_To_helm_HelmDeploymentConfiguration(in *HelmDeploymentConfiguration, out *helm.HelmDeploymentConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_HelmDeploymentConfiguration_To_helm_HelmDeploymentConfiguration(in, out, s) +} + +func autoConvert_helm_HelmDeploymentConfiguration_To_v1alpha1_HelmDeploymentConfiguration(in *helm.HelmDeploymentConfiguration, out *HelmDeploymentConfiguration, s conversion.Scope) error { + out.Install = *(*map[string]corev1alpha1.AnyJSON)(unsafe.Pointer(&in.Install)) + out.Upgrade = *(*map[string]corev1alpha1.AnyJSON)(unsafe.Pointer(&in.Upgrade)) + out.Uninstall = *(*map[string]corev1alpha1.AnyJSON)(unsafe.Pointer(&in.Uninstall)) + return nil +} + +// Convert_helm_HelmDeploymentConfiguration_To_v1alpha1_HelmDeploymentConfiguration is an autogenerated conversion function. +func Convert_helm_HelmDeploymentConfiguration_To_v1alpha1_HelmDeploymentConfiguration(in *helm.HelmDeploymentConfiguration, out *HelmDeploymentConfiguration, s conversion.Scope) error { + return autoConvert_helm_HelmDeploymentConfiguration_To_v1alpha1_HelmDeploymentConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_HelmInstallConfiguration_To_helm_HelmInstallConfiguration(in *HelmInstallConfiguration, out *helm.HelmInstallConfiguration, s conversion.Scope) error { + out.Atomic = in.Atomic + out.Timeout = (*corev1alpha1.Duration)(unsafe.Pointer(in.Timeout)) + return nil +} + +// Convert_v1alpha1_HelmInstallConfiguration_To_helm_HelmInstallConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_HelmInstallConfiguration_To_helm_HelmInstallConfiguration(in *HelmInstallConfiguration, out *helm.HelmInstallConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_HelmInstallConfiguration_To_helm_HelmInstallConfiguration(in, out, s) +} + +func autoConvert_helm_HelmInstallConfiguration_To_v1alpha1_HelmInstallConfiguration(in *helm.HelmInstallConfiguration, out *HelmInstallConfiguration, s conversion.Scope) error { + out.Atomic = in.Atomic + out.Timeout = (*corev1alpha1.Duration)(unsafe.Pointer(in.Timeout)) + return nil +} + +// Convert_helm_HelmInstallConfiguration_To_v1alpha1_HelmInstallConfiguration is an autogenerated conversion function. +func Convert_helm_HelmInstallConfiguration_To_v1alpha1_HelmInstallConfiguration(in *helm.HelmInstallConfiguration, out *HelmInstallConfiguration, s conversion.Scope) error { + return autoConvert_helm_HelmInstallConfiguration_To_v1alpha1_HelmInstallConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_HelmUninstallConfiguration_To_helm_HelmUninstallConfiguration(in *HelmUninstallConfiguration, out *helm.HelmUninstallConfiguration, s conversion.Scope) error { + out.Timeout = (*corev1alpha1.Duration)(unsafe.Pointer(in.Timeout)) + return nil +} + +// Convert_v1alpha1_HelmUninstallConfiguration_To_helm_HelmUninstallConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_HelmUninstallConfiguration_To_helm_HelmUninstallConfiguration(in *HelmUninstallConfiguration, out *helm.HelmUninstallConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_HelmUninstallConfiguration_To_helm_HelmUninstallConfiguration(in, out, s) +} + +func autoConvert_helm_HelmUninstallConfiguration_To_v1alpha1_HelmUninstallConfiguration(in *helm.HelmUninstallConfiguration, out *HelmUninstallConfiguration, s conversion.Scope) error { + out.Timeout = (*corev1alpha1.Duration)(unsafe.Pointer(in.Timeout)) + return nil +} + +// Convert_helm_HelmUninstallConfiguration_To_v1alpha1_HelmUninstallConfiguration is an autogenerated conversion function. +func Convert_helm_HelmUninstallConfiguration_To_v1alpha1_HelmUninstallConfiguration(in *helm.HelmUninstallConfiguration, out *HelmUninstallConfiguration, s conversion.Scope) error { + return autoConvert_helm_HelmUninstallConfiguration_To_v1alpha1_HelmUninstallConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_ProviderConfiguration_To_helm_ProviderConfiguration(in *ProviderConfiguration, out *helm.ProviderConfiguration, s conversion.Scope) error { + out.Kubeconfig = in.Kubeconfig + out.UpdateStrategy = helm.UpdateStrategy(in.UpdateStrategy) + out.ReadinessChecks = in.ReadinessChecks + out.DeleteTimeout = (*core.Duration)(unsafe.Pointer(in.DeleteTimeout)) + if err := Convert_v1alpha1_Chart_To_helm_Chart(&in.Chart, &out.Chart, s); err != nil { + return err + } + out.Name = in.Name + out.Namespace = in.Namespace + out.CreateNamespace = in.CreateNamespace + out.Values = *(*json.RawMessage)(unsafe.Pointer(&in.Values)) + out.ExportsFromManifests = *(*[]managedresource.Export)(unsafe.Pointer(&in.ExportsFromManifests)) + out.Exports = (*managedresource.Exports)(unsafe.Pointer(in.Exports)) + out.ContinuousReconcile = (*continuousreconcile.ContinuousReconcileSpec)(unsafe.Pointer(in.ContinuousReconcile)) + out.HelmDeployment = (*bool)(unsafe.Pointer(in.HelmDeployment)) + out.HelmDeploymentConfig = (*helm.HelmDeploymentConfiguration)(unsafe.Pointer(in.HelmDeploymentConfig)) + return nil +} + +// Convert_v1alpha1_ProviderConfiguration_To_helm_ProviderConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_ProviderConfiguration_To_helm_ProviderConfiguration(in *ProviderConfiguration, out *helm.ProviderConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_ProviderConfiguration_To_helm_ProviderConfiguration(in, out, s) +} + +func autoConvert_helm_ProviderConfiguration_To_v1alpha1_ProviderConfiguration(in *helm.ProviderConfiguration, out *ProviderConfiguration, s conversion.Scope) error { + out.Kubeconfig = in.Kubeconfig + out.ReadinessChecks = in.ReadinessChecks + out.DeleteTimeout = (*corev1alpha1.Duration)(unsafe.Pointer(in.DeleteTimeout)) + out.UpdateStrategy = UpdateStrategy(in.UpdateStrategy) + if err := Convert_helm_Chart_To_v1alpha1_Chart(&in.Chart, &out.Chart, s); err != nil { + return err + } + out.Name = in.Name + out.Namespace = in.Namespace + out.CreateNamespace = in.CreateNamespace + out.Values = *(*json.RawMessage)(unsafe.Pointer(&in.Values)) + out.ExportsFromManifests = *(*[]managedresource.Export)(unsafe.Pointer(&in.ExportsFromManifests)) + out.Exports = (*managedresource.Exports)(unsafe.Pointer(in.Exports)) + out.ContinuousReconcile = (*continuousreconcile.ContinuousReconcileSpec)(unsafe.Pointer(in.ContinuousReconcile)) + out.HelmDeployment = (*bool)(unsafe.Pointer(in.HelmDeployment)) + out.HelmDeploymentConfig = (*HelmDeploymentConfiguration)(unsafe.Pointer(in.HelmDeploymentConfig)) + return nil +} + +// Convert_helm_ProviderConfiguration_To_v1alpha1_ProviderConfiguration is an autogenerated conversion function. +func Convert_helm_ProviderConfiguration_To_v1alpha1_ProviderConfiguration(in *helm.ProviderConfiguration, out *ProviderConfiguration, s conversion.Scope) error { + return autoConvert_helm_ProviderConfiguration_To_v1alpha1_ProviderConfiguration(in, out, s) +} + +func autoConvert_v1alpha1_ProviderStatus_To_helm_ProviderStatus(in *ProviderStatus, out *helm.ProviderStatus, s conversion.Scope) error { + out.ManagedResources = *(*managedresource.ManagedResourceStatusList)(unsafe.Pointer(&in.ManagedResources)) + return nil +} + +// Convert_v1alpha1_ProviderStatus_To_helm_ProviderStatus is an autogenerated conversion function. +func Convert_v1alpha1_ProviderStatus_To_helm_ProviderStatus(in *ProviderStatus, out *helm.ProviderStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ProviderStatus_To_helm_ProviderStatus(in, out, s) +} + +func autoConvert_helm_ProviderStatus_To_v1alpha1_ProviderStatus(in *helm.ProviderStatus, out *ProviderStatus, s conversion.Scope) error { + out.ManagedResources = *(*managedresource.ManagedResourceStatusList)(unsafe.Pointer(&in.ManagedResources)) + return nil +} + +// Convert_helm_ProviderStatus_To_v1alpha1_ProviderStatus is an autogenerated conversion function. +func Convert_helm_ProviderStatus_To_v1alpha1_ProviderStatus(in *helm.ProviderStatus, out *ProviderStatus, s conversion.Scope) error { + return autoConvert_helm_ProviderStatus_To_v1alpha1_ProviderStatus(in, out, s) +} + +func autoConvert_v1alpha1_RemoteArchiveAccess_To_helm_RemoteArchiveAccess(in *RemoteArchiveAccess, out *helm.RemoteArchiveAccess, s conversion.Scope) error { + out.URL = in.URL + return nil +} + +// Convert_v1alpha1_RemoteArchiveAccess_To_helm_RemoteArchiveAccess is an autogenerated conversion function. +func Convert_v1alpha1_RemoteArchiveAccess_To_helm_RemoteArchiveAccess(in *RemoteArchiveAccess, out *helm.RemoteArchiveAccess, s conversion.Scope) error { + return autoConvert_v1alpha1_RemoteArchiveAccess_To_helm_RemoteArchiveAccess(in, out, s) +} + +func autoConvert_helm_RemoteArchiveAccess_To_v1alpha1_RemoteArchiveAccess(in *helm.RemoteArchiveAccess, out *RemoteArchiveAccess, s conversion.Scope) error { + out.URL = in.URL + return nil +} + +// Convert_helm_RemoteArchiveAccess_To_v1alpha1_RemoteArchiveAccess is an autogenerated conversion function. +func Convert_helm_RemoteArchiveAccess_To_v1alpha1_RemoteArchiveAccess(in *helm.RemoteArchiveAccess, out *RemoteArchiveAccess, s conversion.Scope) error { + return autoConvert_helm_RemoteArchiveAccess_To_v1alpha1_RemoteArchiveAccess(in, out, s) +} + +func autoConvert_v1alpha1_RemoteChartReference_To_helm_RemoteChartReference(in *RemoteChartReference, out *helm.RemoteChartReference, s conversion.Scope) error { + out.ComponentDescriptorDefinition = in.ComponentDescriptorDefinition + out.ResourceName = in.ResourceName + return nil +} + +// Convert_v1alpha1_RemoteChartReference_To_helm_RemoteChartReference is an autogenerated conversion function. +func Convert_v1alpha1_RemoteChartReference_To_helm_RemoteChartReference(in *RemoteChartReference, out *helm.RemoteChartReference, s conversion.Scope) error { + return autoConvert_v1alpha1_RemoteChartReference_To_helm_RemoteChartReference(in, out, s) +} + +func autoConvert_helm_RemoteChartReference_To_v1alpha1_RemoteChartReference(in *helm.RemoteChartReference, out *RemoteChartReference, s conversion.Scope) error { + out.ComponentDescriptorDefinition = in.ComponentDescriptorDefinition + out.ResourceName = in.ResourceName + return nil +} + +// Convert_helm_RemoteChartReference_To_v1alpha1_RemoteChartReference is an autogenerated conversion function. +func Convert_helm_RemoteChartReference_To_v1alpha1_RemoteChartReference(in *helm.RemoteChartReference, out *RemoteChartReference, s conversion.Scope) error { + return autoConvert_helm_RemoteChartReference_To_v1alpha1_RemoteChartReference(in, out, s) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..0a8e7fee9 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,392 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + + runtime "k8s.io/apimachinery/pkg/runtime" + + config "github.com/gardener/landscaper/apis/config" + corev1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + continuousreconcile "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" + managedresource "github.com/gardener/landscaper/apis/deployer/utils/managedresource" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ArchiveAccess) DeepCopyInto(out *ArchiveAccess) { + *out = *in + if in.Remote != nil { + in, out := &in.Remote, &out.Remote + *out = new(RemoteArchiveAccess) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArchiveAccess. +func (in *ArchiveAccess) DeepCopy() *ArchiveAccess { + if in == nil { + return nil + } + out := new(ArchiveAccess) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Auth) DeepCopyInto(out *Auth) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Auth. +func (in *Auth) DeepCopy() *Auth { + if in == nil { + return nil + } + out := new(Auth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Chart) DeepCopyInto(out *Chart) { + *out = *in + if in.FromResource != nil { + in, out := &in.FromResource, &out.FromResource + *out = new(RemoteChartReference) + (*in).DeepCopyInto(*out) + } + if in.Archive != nil { + in, out := &in.Archive, &out.Archive + *out = new(ArchiveAccess) + (*in).DeepCopyInto(*out) + } + if in.HelmChartRepo != nil { + in, out := &in.HelmChartRepo, &out.HelmChartRepo + *out = new(HelmChartRepo) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Chart. +func (in *Chart) DeepCopy() *Chart { + if in == nil { + return nil + } + out := new(Chart) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Configuration) DeepCopyInto(out *Configuration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.OCI != nil { + in, out := &in.OCI, &out.OCI + *out = new(config.OCIConfiguration) + (*in).DeepCopyInto(*out) + } + if in.TargetSelector != nil { + in, out := &in.TargetSelector, &out.TargetSelector + *out = make([]corev1alpha1.TargetSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Export.DeepCopyInto(&out.Export) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Configuration. +func (in *Configuration) DeepCopy() *Configuration { + if in == nil { + return nil + } + out := new(Configuration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Configuration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExportConfiguration) DeepCopyInto(out *ExportConfiguration) { + *out = *in + if in.DefaultTimeout != nil { + in, out := &in.DefaultTimeout, &out.DefaultTimeout + *out = new(corev1alpha1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportConfiguration. +func (in *ExportConfiguration) DeepCopy() *ExportConfiguration { + if in == nil { + return nil + } + out := new(ExportConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmChartRepo) DeepCopyInto(out *HelmChartRepo) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartRepo. +func (in *HelmChartRepo) DeepCopy() *HelmChartRepo { + if in == nil { + return nil + } + out := new(HelmChartRepo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmChartRepoCredentials) DeepCopyInto(out *HelmChartRepoCredentials) { + *out = *in + if in.Auths != nil { + in, out := &in.Auths, &out.Auths + *out = make([]Auth, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartRepoCredentials. +func (in *HelmChartRepoCredentials) DeepCopy() *HelmChartRepoCredentials { + if in == nil { + return nil + } + out := new(HelmChartRepoCredentials) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmDeploymentConfiguration) DeepCopyInto(out *HelmDeploymentConfiguration) { + *out = *in + if in.Install != nil { + in, out := &in.Install, &out.Install + *out = make(map[string]corev1alpha1.AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Upgrade != nil { + in, out := &in.Upgrade, &out.Upgrade + *out = make(map[string]corev1alpha1.AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Uninstall != nil { + in, out := &in.Uninstall, &out.Uninstall + *out = make(map[string]corev1alpha1.AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmDeploymentConfiguration. +func (in *HelmDeploymentConfiguration) DeepCopy() *HelmDeploymentConfiguration { + if in == nil { + return nil + } + out := new(HelmDeploymentConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmInstallConfiguration) DeepCopyInto(out *HelmInstallConfiguration) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(corev1alpha1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmInstallConfiguration. +func (in *HelmInstallConfiguration) DeepCopy() *HelmInstallConfiguration { + if in == nil { + return nil + } + out := new(HelmInstallConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmUninstallConfiguration) DeepCopyInto(out *HelmUninstallConfiguration) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(corev1alpha1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmUninstallConfiguration. +func (in *HelmUninstallConfiguration) DeepCopy() *HelmUninstallConfiguration { + if in == nil { + return nil + } + out := new(HelmUninstallConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderConfiguration) DeepCopyInto(out *ProviderConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ReadinessChecks.DeepCopyInto(&out.ReadinessChecks) + if in.DeleteTimeout != nil { + in, out := &in.DeleteTimeout, &out.DeleteTimeout + *out = new(corev1alpha1.Duration) + **out = **in + } + in.Chart.DeepCopyInto(&out.Chart) + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + if in.ExportsFromManifests != nil { + in, out := &in.ExportsFromManifests, &out.ExportsFromManifests + *out = make([]managedresource.Export, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Exports != nil { + in, out := &in.Exports, &out.Exports + *out = new(managedresource.Exports) + (*in).DeepCopyInto(*out) + } + if in.ContinuousReconcile != nil { + in, out := &in.ContinuousReconcile, &out.ContinuousReconcile + *out = new(continuousreconcile.ContinuousReconcileSpec) + (*in).DeepCopyInto(*out) + } + if in.HelmDeployment != nil { + in, out := &in.HelmDeployment, &out.HelmDeployment + *out = new(bool) + **out = **in + } + if in.HelmDeploymentConfig != nil { + in, out := &in.HelmDeploymentConfig, &out.HelmDeploymentConfig + *out = new(HelmDeploymentConfiguration) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfiguration. +func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration { + if in == nil { + return nil + } + out := new(ProviderConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProviderConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderStatus) DeepCopyInto(out *ProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.ManagedResources != nil { + in, out := &in.ManagedResources, &out.ManagedResources + *out = make(managedresource.ManagedResourceStatusList, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderStatus. +func (in *ProviderStatus) DeepCopy() *ProviderStatus { + if in == nil { + return nil + } + out := new(ProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteArchiveAccess) DeepCopyInto(out *RemoteArchiveAccess) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteArchiveAccess. +func (in *RemoteArchiveAccess) DeepCopy() *RemoteArchiveAccess { + if in == nil { + return nil + } + out := new(RemoteArchiveAccess) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteChartReference) DeepCopyInto(out *RemoteChartReference) { + *out = *in + in.ComponentDescriptorDefinition.DeepCopyInto(&out.ComponentDescriptorDefinition) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteChartReference. +func (in *RemoteChartReference) DeepCopy() *RemoteChartReference { + if in == nil { + return nil + } + out := new(RemoteChartReference) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.defaults.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.defaults.go new file mode 100644 index 000000000..691cd0788 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,27 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&ProviderConfiguration{}, func(obj interface{}) { SetObjectDefaults_ProviderConfiguration(obj.(*ProviderConfiguration)) }) + return nil +} + +func SetObjectDefaults_ProviderConfiguration(in *ProviderConfiguration) { + SetDefaults_ProviderConfiguration(in) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/zz_generated.deepcopy.go new file mode 100644 index 000000000..f51e942cf --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/helm/zz_generated.deepcopy.go @@ -0,0 +1,393 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package helm + +import ( + json "encoding/json" + + runtime "k8s.io/apimachinery/pkg/runtime" + + config "github.com/gardener/landscaper/apis/config" + core "github.com/gardener/landscaper/apis/core" + v1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + continuousreconcile "github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile" + managedresource "github.com/gardener/landscaper/apis/deployer/utils/managedresource" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ArchiveAccess) DeepCopyInto(out *ArchiveAccess) { + *out = *in + if in.Remote != nil { + in, out := &in.Remote, &out.Remote + *out = new(RemoteArchiveAccess) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArchiveAccess. +func (in *ArchiveAccess) DeepCopy() *ArchiveAccess { + if in == nil { + return nil + } + out := new(ArchiveAccess) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Auth) DeepCopyInto(out *Auth) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Auth. +func (in *Auth) DeepCopy() *Auth { + if in == nil { + return nil + } + out := new(Auth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Chart) DeepCopyInto(out *Chart) { + *out = *in + if in.FromResource != nil { + in, out := &in.FromResource, &out.FromResource + *out = new(RemoteChartReference) + (*in).DeepCopyInto(*out) + } + if in.Archive != nil { + in, out := &in.Archive, &out.Archive + *out = new(ArchiveAccess) + (*in).DeepCopyInto(*out) + } + if in.HelmChartRepo != nil { + in, out := &in.HelmChartRepo, &out.HelmChartRepo + *out = new(HelmChartRepo) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Chart. +func (in *Chart) DeepCopy() *Chart { + if in == nil { + return nil + } + out := new(Chart) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Configuration) DeepCopyInto(out *Configuration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.OCI != nil { + in, out := &in.OCI, &out.OCI + *out = new(config.OCIConfiguration) + (*in).DeepCopyInto(*out) + } + if in.TargetSelector != nil { + in, out := &in.TargetSelector, &out.TargetSelector + *out = make([]v1alpha1.TargetSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Export.DeepCopyInto(&out.Export) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Configuration. +func (in *Configuration) DeepCopy() *Configuration { + if in == nil { + return nil + } + out := new(Configuration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Configuration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExportConfiguration) DeepCopyInto(out *ExportConfiguration) { + *out = *in + if in.DefaultTimeout != nil { + in, out := &in.DefaultTimeout, &out.DefaultTimeout + *out = new(v1alpha1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportConfiguration. +func (in *ExportConfiguration) DeepCopy() *ExportConfiguration { + if in == nil { + return nil + } + out := new(ExportConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmChartRepo) DeepCopyInto(out *HelmChartRepo) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartRepo. +func (in *HelmChartRepo) DeepCopy() *HelmChartRepo { + if in == nil { + return nil + } + out := new(HelmChartRepo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmChartRepoCredentials) DeepCopyInto(out *HelmChartRepoCredentials) { + *out = *in + if in.Auths != nil { + in, out := &in.Auths, &out.Auths + *out = make([]Auth, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartRepoCredentials. +func (in *HelmChartRepoCredentials) DeepCopy() *HelmChartRepoCredentials { + if in == nil { + return nil + } + out := new(HelmChartRepoCredentials) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmDeploymentConfiguration) DeepCopyInto(out *HelmDeploymentConfiguration) { + *out = *in + if in.Install != nil { + in, out := &in.Install, &out.Install + *out = make(map[string]core.AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Upgrade != nil { + in, out := &in.Upgrade, &out.Upgrade + *out = make(map[string]core.AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Uninstall != nil { + in, out := &in.Uninstall, &out.Uninstall + *out = make(map[string]core.AnyJSON, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmDeploymentConfiguration. +func (in *HelmDeploymentConfiguration) DeepCopy() *HelmDeploymentConfiguration { + if in == nil { + return nil + } + out := new(HelmDeploymentConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmInstallConfiguration) DeepCopyInto(out *HelmInstallConfiguration) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(v1alpha1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmInstallConfiguration. +func (in *HelmInstallConfiguration) DeepCopy() *HelmInstallConfiguration { + if in == nil { + return nil + } + out := new(HelmInstallConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmUninstallConfiguration) DeepCopyInto(out *HelmUninstallConfiguration) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(v1alpha1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmUninstallConfiguration. +func (in *HelmUninstallConfiguration) DeepCopy() *HelmUninstallConfiguration { + if in == nil { + return nil + } + out := new(HelmUninstallConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderConfiguration) DeepCopyInto(out *ProviderConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ReadinessChecks.DeepCopyInto(&out.ReadinessChecks) + if in.DeleteTimeout != nil { + in, out := &in.DeleteTimeout, &out.DeleteTimeout + *out = new(core.Duration) + **out = **in + } + in.Chart.DeepCopyInto(&out.Chart) + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + if in.ExportsFromManifests != nil { + in, out := &in.ExportsFromManifests, &out.ExportsFromManifests + *out = make([]managedresource.Export, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Exports != nil { + in, out := &in.Exports, &out.Exports + *out = new(managedresource.Exports) + (*in).DeepCopyInto(*out) + } + if in.ContinuousReconcile != nil { + in, out := &in.ContinuousReconcile, &out.ContinuousReconcile + *out = new(continuousreconcile.ContinuousReconcileSpec) + (*in).DeepCopyInto(*out) + } + if in.HelmDeployment != nil { + in, out := &in.HelmDeployment, &out.HelmDeployment + *out = new(bool) + **out = **in + } + if in.HelmDeploymentConfig != nil { + in, out := &in.HelmDeploymentConfig, &out.HelmDeploymentConfig + *out = new(HelmDeploymentConfiguration) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfiguration. +func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration { + if in == nil { + return nil + } + out := new(ProviderConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProviderConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderStatus) DeepCopyInto(out *ProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.ManagedResources != nil { + in, out := &in.ManagedResources, &out.ManagedResources + *out = make(managedresource.ManagedResourceStatusList, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderStatus. +func (in *ProviderStatus) DeepCopy() *ProviderStatus { + if in == nil { + return nil + } + out := new(ProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProviderStatus) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteArchiveAccess) DeepCopyInto(out *RemoteArchiveAccess) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteArchiveAccess. +func (in *RemoteArchiveAccess) DeepCopy() *RemoteArchiveAccess { + if in == nil { + return nil + } + out := new(RemoteArchiveAccess) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteChartReference) DeepCopyInto(out *RemoteChartReference) { + *out = *in + in.ComponentDescriptorDefinition.DeepCopyInto(&out.ComponentDescriptorDefinition) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteChartReference. +func (in *RemoteChartReference) DeepCopy() *RemoteChartReference { + if in == nil { + return nil + } + out := new(RemoteChartReference) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/doc.go new file mode 100644 index 000000000..fb35dcba7 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/doc.go @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package continuousreconcile contains types for continuous reconciliation specification. +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true + +package continuousreconcile diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/types.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/types.go new file mode 100644 index 000000000..2dfbcec81 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/types.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package continuousreconcile + +import ( + "strings" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// ContinuousReconcileSpec represents the specification of a continuous reconcile schedule. +type ContinuousReconcileSpec struct { + // Cron is a standard crontab specification of the reconciliation schedule. + // Either Cron or Every has to be specified. + // +optional + Cron string `json:"cron,omitempty"` + + // Every specifies a delay after which the reconcile should happen. + // Either Cron or Every has to be specified. + // +optional + Every *lsv1alpha1.Duration `json:"every,omitempty"` +} + +func (crs ContinuousReconcileSpec) String() string { + var sb strings.Builder + sb.WriteString("{") + if len(crs.Cron) != 0 { + sb.WriteString("Cron: \"") + sb.WriteString(crs.Cron) + sb.WriteString("\"") + if crs.Every != nil && crs.Every.Duration != 0 { + sb.WriteString(", ") + } + } + if crs.Every != nil && crs.Every.Duration != 0 { + sb.WriteString("Every: \"") + sb.WriteString(crs.Every.String()) + sb.WriteString("\"") + } + sb.WriteString("}") + return sb.String() +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/zz_generated.deepcopy.go new file mode 100644 index 000000000..da95c76a6 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/continuousreconcile/zz_generated.deepcopy.go @@ -0,0 +1,36 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package continuousreconcile + +import ( + v1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContinuousReconcileSpec) DeepCopyInto(out *ContinuousReconcileSpec) { + *out = *in + if in.Every != nil { + in, out := &in.Every, &out.Every + *out = new(v1alpha1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContinuousReconcileSpec. +func (in *ContinuousReconcileSpec) DeepCopy() *ContinuousReconcileSpec { + if in == nil { + return nil + } + out := new(ContinuousReconcileSpec) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/doc.go new file mode 100644 index 000000000..063b08956 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/doc.go @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true + +package managedresource diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/types.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/types.go new file mode 100644 index 000000000..d4a8ed129 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/types.go @@ -0,0 +1,115 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package managedresource + +import ( + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// ManifestPolicy defines the strategy how a mnifest should be managed +// by the deployer. +type ManifestPolicy string + +const ( + // ManagePolicy is the default policy where the resource is + // created, updated and deleted and it occupies already managed resources + ManagePolicy ManifestPolicy = "manage" + // FallbackPolicy defines a policy where the resource is created, updated and deleted + // but only if not already managed by someone else (check for annotation with landscaper identity, deployitem name + namespace) + FallbackPolicy ManifestPolicy = "fallback" + // KeepPolicy defines a policy where the resource is only created and updated but not deleted. + // It is not deleted when the whole deploy item is nor when the resource is not defined anymore. + KeepPolicy ManifestPolicy = "keep" + // IgnorePolicy defines a policy where the resource is completely ignored by the deployer. + IgnorePolicy ManifestPolicy = "ignore" +) + +// Manifest defines a manifest that is managed by the deployer. +type Manifest struct { + // Policy defines the manage policy for that resource. + Policy ManifestPolicy `json:"policy,omitempty"` + // Manifest defines the raw k8s manifest. + Manifest *runtime.RawExtension `json:"manifest,omitempty"` +} + +// ManagedResourceStatusList describes a list of managed resource statuses. +type ManagedResourceStatusList []ManagedResourceStatus + +// ObjectReferenceList converts a ManagedResourceStatusList to a list of typed objet references. +func (mr ManagedResourceStatusList) ObjectReferenceList() []corev1.ObjectReference { + list := make([]corev1.ObjectReference, len(mr)) + for i, res := range mr { + list[i] = res.Resource + } + return list +} + +// TypedObjectReferenceList converts a ManagedResourceStatusList to a list of typed objet references. +func (mr ManagedResourceStatusList) TypedObjectReferenceList() []lsv1alpha1.TypedObjectReference { + list := make([]lsv1alpha1.TypedObjectReference, len(mr)) + for i, res := range mr { + list[i] = lsv1alpha1.TypedObjectReference{ + APIVersion: res.Resource.APIVersion, + Kind: res.Resource.Kind, + ObjectReference: lsv1alpha1.ObjectReference{ + Name: res.Resource.Name, + Namespace: res.Resource.Namespace, + }, + } + } + return list +} + +// ManagedResourceStatus describes the managed resource and their metadata. +type ManagedResourceStatus struct { + // Policy defines the manage policy for that resource. + Policy ManifestPolicy `json:"policy,omitempty"` + // Resources describes the managed kubernetes resource. + Resource corev1.ObjectReference `json:"resource"` +} + +// Exports describes one export that is read from a resource. +type Exports struct { + // DefaultTimeout defines the default timeout for all exports + // that the exporter waits for the value in the jsonpath to occur. + DefaultTimeout *lsv1alpha1.Duration `json:"defaultTimeout,omitempty"` + Exports []Export `json:"exports,omitempty"` +} + +// Export describes one export that is read from a resource. +type Export struct { + // Timeout defines the timeout that the exporter waits for the value in the jsonpath to occur. + Timeout *lsv1alpha1.Duration `json:"timeout,omitempty"` + // Key is the key that the value from JSONPath is exported to. + Key string `json:"key"` + + // JSONPath is the jsonpath to look for a value. + // The JSONPath root is the referenced resource + JSONPath string `json:"jsonPath"` + + // FromResource specifies the name of the resource where the value should be read. + FromResource *lsv1alpha1.TypedObjectReference `json:"fromResource,omitempty"` + + // FromObjectReference describes that the jsonpath points to a object reference where the actual value is read from. + // This is helpful if for example a deployed resource referenced a secret and that exported value is in that secret. + FromObjectReference *FromObjectReference `json:"fromObjectRef,omitempty"` +} + +// FromObjectReference describes that the jsonpath points to a object reference where the actual value is read from. +// This is helpful if for example a deployed resource referenced a secret and that exported value is in that secret. +type FromObjectReference struct { + // APIVersion is the group and version for the resource being referenced. + // If APIVersion is not specified, the specified Kind must be in the core API group. + // For any other third-party types, APIVersion is required. + APIVersion string `json:"apiVersion"` + // Kind is the type of resource being referenced + Kind string `json:"kind"` + // JSONPath is the jsonpath to look for a value. + // The JSONPath root is the referenced resource + JSONPath string `json:"jsonPath"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/zz_generated.deepcopy.go new file mode 100644 index 000000000..2223b8879 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/managedresource/zz_generated.deepcopy.go @@ -0,0 +1,150 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package managedresource + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + + v1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Export) DeepCopyInto(out *Export) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(v1alpha1.Duration) + **out = **in + } + if in.FromResource != nil { + in, out := &in.FromResource, &out.FromResource + *out = new(v1alpha1.TypedObjectReference) + **out = **in + } + if in.FromObjectReference != nil { + in, out := &in.FromObjectReference, &out.FromObjectReference + *out = new(FromObjectReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Export. +func (in *Export) DeepCopy() *Export { + if in == nil { + return nil + } + out := new(Export) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Exports) DeepCopyInto(out *Exports) { + *out = *in + if in.DefaultTimeout != nil { + in, out := &in.DefaultTimeout, &out.DefaultTimeout + *out = new(v1alpha1.Duration) + **out = **in + } + if in.Exports != nil { + in, out := &in.Exports, &out.Exports + *out = make([]Export, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Exports. +func (in *Exports) DeepCopy() *Exports { + if in == nil { + return nil + } + out := new(Exports) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FromObjectReference) DeepCopyInto(out *FromObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FromObjectReference. +func (in *FromObjectReference) DeepCopy() *FromObjectReference { + if in == nil { + return nil + } + out := new(FromObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ManagedResourceStatus) DeepCopyInto(out *ManagedResourceStatus) { + *out = *in + out.Resource = in.Resource + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedResourceStatus. +func (in *ManagedResourceStatus) DeepCopy() *ManagedResourceStatus { + if in == nil { + return nil + } + out := new(ManagedResourceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ManagedResourceStatusList) DeepCopyInto(out *ManagedResourceStatusList) { + { + in := &in + *out = make(ManagedResourceStatusList, len(*in)) + copy(*out, *in) + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedResourceStatusList. +func (in ManagedResourceStatusList) DeepCopy() ManagedResourceStatusList { + if in == nil { + return nil + } + out := new(ManagedResourceStatusList) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Manifest) DeepCopyInto(out *Manifest) { + *out = *in + if in.Manifest != nil { + in, out := &in.Manifest, &out.Manifest + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Manifest. +func (in *Manifest) DeepCopy() *Manifest { + if in == nil { + return nil + } + out := new(Manifest) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/doc.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/doc.go new file mode 100644 index 000000000..ee2246b14 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/doc.go @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +// Package core is the internal version of the API. +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true + +package readinesschecks diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/types_healthchecks.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/types_healthchecks.go new file mode 100644 index 000000000..6bc3015f9 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/types_healthchecks.go @@ -0,0 +1,70 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package readinesschecks + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// ReadinessCheckConfiguration contains the configuration for readiness checks. +type ReadinessCheckConfiguration struct { + // DisableDefault allows to disable the default readiness checks. + // +optional + DisableDefault bool `json:"disableDefault,omitempty"` + // Timeout is the time to wait before giving up on a resource to be ready. + // Defaults to 180s. + // +optional + Timeout *lsv1alpha1.Duration `json:"timeout,omitempty"` + // CustomReadinessChecks is a set of custom readiness check configurations + // +optional + CustomReadinessChecks []CustomReadinessCheckConfiguration `json:"custom,omitempty"` +} + +// CustomReadinessCheckConfiguration contains the configuration for a custom readiness check +type CustomReadinessCheckConfiguration struct { + // Name is the name of the ReadinessCheck + Name string `json:"name"` + // Timeout is the value after which a readiness check should time out + Timeout *lsv1alpha1.Duration `json:"timeout,omitempty"` + // Disabled deactivates this custom ReadinessCheck + // +optional + Disabled bool `json:"disabled,omitempty"` + // Resource is the resource for which the readiness check should be applied, used for single resources that can be identified by namespace and name + // +optional + Resource []lsv1alpha1.TypedObjectReference `json:"resourceSelector,omitempty"` + // Labels are the labels used to identify multiple resources that can be identified by a unique set of labels + // +optional + LabelSelector *LabelSelectorSpec `json:"labelSelector,omitempty"` + // Requirements is the actual readiness check which compares an object's property to a value + Requirements []RequirementSpec `json:"requirements"` +} + +// LabelSelectorSpec contains paramters used to select objects by their labels +type LabelSelectorSpec struct { + // APIVersion is the API version of the object to be selected by labels + APIVersion string `json:"apiVersion"` + // Kind is the Kind of the object to be selected by labels + Kind string `json:"kind"` + // Labels are the labels used to identify multiple resources of the given kind + Labels map[string]string `json:"matchLabels"` +} + +// RequirementSpec contains the requirements an object must meet to pass the custom readiness check +type RequirementSpec struct { + // JsonPath is the path of the field of the Kubernetes object to be checked (without braces) + JsonPath string `json:"jsonPath"` + // Operator is the operator that should be used for the check + // can be any of these Kubernetes selection operators: + // DoesNotExist, Exists, Equals, DoubleEquals, NotEquals, In, NotIn + Operator selection.Operator `json:"operator"` + // In huge majority of cases we have at most one value here. + // It is generally faster to operate on a single-element slice + // than on a single-element map, so we have a slice here. + // +optional + Value []runtime.RawExtension `json:"values,omitempty"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/zz_generated.deepcopy.go b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/zz_generated.deepcopy.go new file mode 100644 index 000000000..960432e36 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/deployer/utils/readinesschecks/zz_generated.deepcopy.go @@ -0,0 +1,129 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file + +SPDX-License-Identifier: Apache-2.0 +*/ +// Code generated by deepcopy-gen. DO NOT EDIT. + +package readinesschecks + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + + v1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomReadinessCheckConfiguration) DeepCopyInto(out *CustomReadinessCheckConfiguration) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(v1alpha1.Duration) + **out = **in + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = make([]v1alpha1.TypedObjectReference, len(*in)) + copy(*out, *in) + } + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + *out = new(LabelSelectorSpec) + (*in).DeepCopyInto(*out) + } + if in.Requirements != nil { + in, out := &in.Requirements, &out.Requirements + *out = make([]RequirementSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomReadinessCheckConfiguration. +func (in *CustomReadinessCheckConfiguration) DeepCopy() *CustomReadinessCheckConfiguration { + if in == nil { + return nil + } + out := new(CustomReadinessCheckConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LabelSelectorSpec) DeepCopyInto(out *LabelSelectorSpec) { + *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelSelectorSpec. +func (in *LabelSelectorSpec) DeepCopy() *LabelSelectorSpec { + if in == nil { + return nil + } + out := new(LabelSelectorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReadinessCheckConfiguration) DeepCopyInto(out *ReadinessCheckConfiguration) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(v1alpha1.Duration) + **out = **in + } + if in.CustomReadinessChecks != nil { + in, out := &in.CustomReadinessChecks, &out.CustomReadinessChecks + *out = make([]CustomReadinessCheckConfiguration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReadinessCheckConfiguration. +func (in *ReadinessCheckConfiguration) DeepCopy() *ReadinessCheckConfiguration { + if in == nil { + return nil + } + out := new(ReadinessCheckConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequirementSpec) DeepCopyInto(out *RequirementSpec) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = make([]runtime.RawExtension, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequirementSpec. +func (in *RequirementSpec) DeepCopy() *RequirementSpec { + if in == nil { + return nil + } + out := new(RequirementSpec) + in.DeepCopyInto(out) + return out +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/mediatype/constants.go b/integration-test/vendor/github.com/gardener/landscaper/apis/mediatype/constants.go new file mode 100644 index 000000000..924505c9c --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/mediatype/constants.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package mediatype + +const ( + // BlueprintType is the name of the blueprint type in a component descriptor. + BlueprintType = "landscaper.gardener.cloud/blueprint" + + // OldBlueprintType is the old name of the blueprint type in a component descriptor. + OldBlueprintType = "blueprint" + + // BlueprintArtifactsMediaTypeV0 is the reserved media type for a blueprint that is stored as its own artifact. + // This is the legacy deprecated artifact media type that was used for the layer and the config type. + // Use BlueprintArtifactsConfigMediaTypeV1 or BlueprintArtifactsLayerMediaTypeV1 instead. + // DEPRECATED + BlueprintArtifactsMediaTypeV0 = "application/vnd.gardener.landscaper.blueprint.v1+tar+gzip" + + // BlueprintArtifactsConfigMediaTypeV1 is the config reserved media type for a blueprint that is stored as its own artifact. + // This describes the config media type of the blueprint artifact. + // The suffix can be yaml or json whereas yaml is the default. + BlueprintArtifactsConfigMediaTypeV1 = "application/vnd.gardener.landscaper.blueprint.config.v1" + + // BlueprintArtifactsLayerMediaTypeV1 is the reserved layer media type for a blueprint that is stored as its own artifact. + // This describes the layer media type of the blueprint artifact as well as the media type of a localOciBlob. + // Optionally the compression can be added as "+gzip" + BlueprintArtifactsLayerMediaTypeV1 = "application/vnd.gardener.landscaper.blueprint.layer.v1.tar" + + // JSONSchemaArtifactsMediaTypeV0 is the reserved media type for a jsonschema that is stored as layer in an oci artifact. + // This is the legacy deprecated artifact media type use JSONSchemaArtifactsMediaTypeV1 instead. + // DEPRECATED + JSONSchemaArtifactsMediaTypeV0 = "application/vnd.gardener.landscaper.jsonscheme.v1+json" + + // JSONSchemaArtifactsMediaTypeV1 is the reserved media type for a jsonschema that is stored as layer in an oci artifact. + // This is the legacy deprecated artifact media type. + JSONSchemaArtifactsMediaTypeV1 = "application/vnd.gardener.landscaper.jsonschema.layer.v1.json" + + // GZipCompression is the identifier for a gzip compressed file. + GZipCompression = "gzip" + + // MediaTypeGZip defines the media type for a gzipped file + MediaTypeGZip = "application/gzip" +) + +// DefaultMediaTypeConversions defines the default conversions for landscaper media types. +func DefaultMediaTypeConversions(mediaType string) (convertedType string, converted bool, err error) { + switch mediaType { + case BlueprintArtifactsMediaTypeV0: + return NewBuilder(BlueprintArtifactsLayerMediaTypeV1).Compression(GZipCompression).String(), true, nil + case JSONSchemaArtifactsMediaTypeV0: + return JSONSchemaArtifactsMediaTypeV1, true, nil + } + return "", false, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/mediatype/mediatype.go b/integration-test/vendor/github.com/gardener/landscaper/apis/mediatype/mediatype.go new file mode 100644 index 000000000..1af4902c5 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/mediatype/mediatype.go @@ -0,0 +1,224 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package mediatype + +import ( + "errors" + "fmt" + "strings" +) + +var InvalidTypeError = errors.New("INVALID_MEDIA_TYPE") + +type MediaTypeFormat string + +const ( + DefaultFormat MediaTypeFormat = "" + OCIConfigFormat MediaTypeFormat = "ociConfig" + OCILayerFormat MediaTypeFormat = "ociLayer" +) + +// MediaType describes a media type (formerly known as MIME type) defined by the IANA in THE RFC 2045. +// In addition oci specific media types as defined in +// https://github.com/opencontainers/artifacts/blob/master/artifact-authors.md#defining-layermediatypes are parsed. +type MediaType struct { + // Orig contains the complete original type + Orig string + // Format describes the specific format of the media type + Format MediaTypeFormat + // Type contain the parsed type without suffix. + Type string + // Suffix contains the suffix of a media that is given after the "+"-char + Suffix *string + + // Only valid for oci types + + // Version describes the config or layer version. + Version *string + // FileFormat contains only the file format. + // This is part of the Type if the mediatype is not a ConfigType. + // If it is a ConfigType the FileFormat is not part of the type. + FileFormat *string + // CompressionFormat contains the optional compression format. + CompressionFormat *string +} + +// String returns the string using the parsed type file and compression. +func (t MediaType) String() string { + s := t.Type + if t.CompressionFormat != nil && t.Suffix == nil { + t.Suffix = t.CompressionFormat + } + if t.Suffix != nil { + s = s + "+" + *t.Suffix + } + return s +} + +// HasSuffix checks if the media type contains the given suffix. +// if the given format is empty this functions only validates if a format is given +func (t MediaType) HasSuffix(suffix string) bool { + if t.Suffix == nil { + return false + } + if len(suffix) == 0 { + return true + } + return *t.Suffix == suffix +} + +// IsCompressed checks if the media type is compressed with the given format. +// if the given format is empty this functions only validates if a compression is given +func (t MediaType) IsCompressed(format string) bool { + if t.CompressionFormat == nil { + + // try to parse the compression from the suffix or tree + if t.Suffix == nil { + return false + } + + return *t.Suffix == format + } + if len(format) == 0 { + return true + } + return *t.CompressionFormat == format +} + +// HasFileFormat checks if the media type contains the given file format. +// if the given format is empty this functions only validates if a format is given +func (t MediaType) HasFileFormat(format string) bool { + if t.FileFormat == nil { + return false + } + if len(format) == 0 { + return true + } + return *t.FileFormat == format +} + +// ConversionFunc describes a conversion func for a media type +type ConversionFunc func(mediaType string) (convertedType string, converted bool, err error) + +// Parse parses a config and layer media type according to the oci spec. +// Config: +// [registration-tree].[org|company|entity].[objectType].[optional-subType].config.[version]+[optional-configFormat] +// Layers: +// [registration-tree].[org|company|entity].[layerType].[optional-layerSubType].layer.[version].[fileFormat]+[optional-compressionFormat] +// Layers also allow any IANA media type +// +// https://github.com/opencontainers/artifacts/blob/master/artifact-authors.md#defining-layermediatypes +// +// This method is highly landscaper specific and can also handle legacy types that are automatically converted. +func Parse(mediaType string, conversions ...ConversionFunc) (MediaType, error) { + for _, conversion := range append(conversions, DefaultMediaTypeConversions) { + converted, ok, err := conversion(mediaType) + if err != nil { + return MediaType{}, fmt.Errorf("error during conversion: %w", err) + } + if ok { + mediaType = converted + } + } + + splitType := strings.Split(mediaType, "/") + if len(splitType) != 2 { + return MediaType{}, InvalidTypeError + } + mt := MediaType{ + Orig: mediaType, + Type: mediaType, + } + t := splitType[0] + tree := splitType[1] + + if suffixIndex := strings.Index(mediaType, "+"); suffixIndex > -1 { + mt.Suffix = strPtr(mediaType[suffixIndex+1:]) + mt.Type = mediaType[:suffixIndex] + tree = mediaType[len(mediaType)-len(tree) : suffixIndex] + } + + if t != "application" { + mt.Type = mediaType + mt.FileFormat = strPtr(tree) + return mt, nil + } + + // try to detect config or layer type + splitType = strings.Split(tree, ".") + + + if len(splitType) > 2 && splitType[len(splitType)-2] == "config" { + mt.Format = OCIConfigFormat + mt.FileFormat = mt.Suffix + mt.Version = strPtr(splitType[len(splitType)-1]) + } else if len(splitType) > 3 && splitType[len(splitType)-3] == "layer" { + mt.Format = OCILayerFormat + mt.FileFormat = strPtr(splitType[len(splitType)-1]) + mt.Version = strPtr(splitType[len(splitType)-2]) + } + + return mt, nil +} + +// Builder is a media type builder +type Builder struct { + Type MediaType +} + +// NewBuilder creates a new media type builder. +func NewBuilder(t string) *Builder { + return &Builder{ + MediaType{ + Orig: "", + Type: t, + Format: DefaultFormat, + Version: nil, + FileFormat: nil, + CompressionFormat: nil, + }, + } +} + +// Compression sets the compression format +func (b *Builder) Compression(comp string) *Builder { + b.Type.CompressionFormat = &comp + b.Type.Suffix = &comp + return b +} + +// FileFormat sets the file format of the media type. +// Will be automatically parsed from the type if it is not a config type. +func (b *Builder) FileFormat(format string) *Builder { + b.Type.FileFormat = &format + b.Type.Suffix = &format + return b +} + +// IsConfigType configures the media type as oci config. +func (b *Builder) IsConfigType() *Builder { + b.Type.Format = OCIConfigFormat + return b +} + +// IsLayerType configures the media type as oci layer. +func (b *Builder) IsLayerType() *Builder { + b.Type.Format = OCILayerFormat + return b +} + +// Build builds the mediatype +func (b *Builder) Build() MediaType { + return b.Type +} + +// String returns the media type as string +func (b *Builder) String() string { + return b.Build().String() +} + +func strPtr(s string) *string { + return &s +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/apis/schema/schema.go b/integration-test/vendor/github.com/gardener/landscaper/apis/schema/schema.go new file mode 100644 index 000000000..f37d69584 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/apis/schema/schema.go @@ -0,0 +1,96 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package schema + +// ResourceScope is an enum defining the different scopes available to a custom resource +type ResourceScope string + +const ( + ClusterScoped ResourceScope = "Cluster" + NamespaceScoped ResourceScope = "Namespaced" +) + +// CustomResourceDefinitions defines a list of definitions from the same api group and version. +type CustomResourceDefinitions struct { + // Group is the apigroup of the CRD. + Group string + // Version defines the version of the CRD. + Version string + + // OutputDir defines the optional output directory where the crd should be written to. + // Be aware that this path is relative to the apis directory. + // If this is empty it will be written to the default CRD location. + //+optional + OutputDir string + + Definitions []CustomResourceDefinition +} + +// CustomResourceDefinition defines a template for custom resource definition. +// It defines a subset of https://github.com/kubernetes/apiextensions-apiserver/blob/master/pkg/apis/apiextensions/v1/types.go#L41 +// for one version. +type CustomResourceDefinition struct { + Names CustomResourceDefinitionNames + // Scope of the crd + Scope ResourceScope + Served bool + Storage bool + Deprecated bool + SubresourceStatus bool + AdditionalPrinterColumns []CustomResourceColumnDefinition +} + +// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition +type CustomResourceDefinitionNames struct { + // plural is the plural name of the resource to serve. + // The custom resources are served under `/apis///.../`. + // Must match the name of the CustomResourceDefinition (in the form `.`). + // Must be all lowercase. + Plural string `json:"plural" protobuf:"bytes,1,opt,name=plural"` + // singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased `kind`. + // +optional + Singular string `json:"singular,omitempty" protobuf:"bytes,2,opt,name=singular"` + // shortNames are short names for the resource, exposed in API discovery documents, + // and used by clients to support invocations like `kubectl get `. + // It must be all lowercase. + // +optional + ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,3,opt,name=shortNames"` + // kind is the serialized kind of the resource. It is normally CamelCase and singular. + // Custom resource instances will use this value as the `kind` attribute in API calls. + Kind string `json:"kind" protobuf:"bytes,4,opt,name=kind"` + // listKind is the serialized kind of the list for this resource. Defaults to "`kind`List". + // +optional + ListKind string `json:"listKind,omitempty" protobuf:"bytes,5,opt,name=listKind"` + // categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). + // This is published in API discovery documents, and used by clients to support invocations like + // `kubectl get all`. + // +optional + Categories []string `json:"categories,omitempty" protobuf:"bytes,6,rep,name=categories"` +} + +// CustomResourceColumnDefinition specifies a column for server side printing. +type CustomResourceColumnDefinition struct { + // name is a human readable name for the column. + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + // type is an OpenAPI type definition for this column. + // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + Type string `json:"type" protobuf:"bytes,2,opt,name=type"` + // format is an optional OpenAPI type definition for this column. The 'name' format is applied + // to the primary identifier column to assist in clients identifying column is the resource name. + // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + // +optional + Format string `json:"format,omitempty" protobuf:"bytes,3,opt,name=format"` + // description is a human readable description of this column. + // +optional + Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"` + // priority is an integer defining the relative importance of this column compared to others. Lower + // numbers are considered higher priority. Columns that may be omitted in limited space scenarios + // should be given a priority greater than 0. + // +optional + Priority int32 `json:"priority,omitempty" protobuf:"bytes,5,opt,name=priority"` + // jsonPath is a simple JSON path (i.e. with array notation) which is evaluated against + // each custom resource to produce the value for this column. + JSONPath string `json:"jsonPath" protobuf:"bytes,6,opt,name=jsonPath"` +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/controller-utils/LICENSE b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/LICENSE new file mode 100644 index 000000000..5431dc12a --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/LICENSE @@ -0,0 +1 @@ +LICENSES/Apache-2.0.txt \ No newline at end of file diff --git a/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/kubernetes/docs.go b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/kubernetes/docs.go new file mode 100644 index 000000000..b440015d1 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/kubernetes/docs.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mockgen -destination=./mock/client_mock.go sigs.k8s.io/controller-runtime/pkg/client Client,StatusWriter + +package kubernetes diff --git a/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/kubernetes/kubernetes.go b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/kubernetes/kubernetes.go new file mode 100644 index 000000000..2a5053df5 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/kubernetes/kubernetes.go @@ -0,0 +1,646 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package kubernetes + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "path/filepath" + "time" + + "github.com/go-logr/logr" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/wait" + yamlutil "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/yaml" + + "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +// image err reasons +// defined in https://github.com/kubernetes/kubernetes/blob/cea1d4e20b4a7886d8ff65f34c6d4f95efcb4742/pkg/kubelet/images/types.go + +// ErrImagePull - General image pull error +const ErrImagePull = "ErrImagePull" + +// ErrImagePullBackOff - Container image pull failed, kubelet is backing off image pull +const ErrImagePullBackOff = "ImagePullBackOff" + +// ErrImageNeverPull - Required Image is absent on host and PullPolicy is NeverPullImage +const ErrImageNeverPull = "ErrImageNeverPull" + +// ErrRegistryUnavailable - Get http error when pulling image from registry +const ErrRegistryUnavailable = "RegistryUnavailable" + +// ErrInvalidImageName - Unable to parse the image name. +const ErrInvalidImageName = "ErrInvalidImageName" + +// CreateOrUpdate creates or updates the given object in the Kubernetes +// cluster. The object's desired state must be reconciled with the existing +// state inside the passed in callback MutateFn. +// It also correctly handles objects that have the generateName attribute set. +// +// The MutateFn is called regardless of creating or updating an object. +// +// It returns the executed operation and an error. +func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn) (controllerutil.OperationResult, error) { + + // check if the name key has to be generated + accessor, err := meta.Accessor(obj) + if err != nil { + return controllerutil.OperationResultNone, err + } + key := client.ObjectKey{Namespace: accessor.GetNamespace(), Name: accessor.GetName()} + + if accessor.GetName() == "" && accessor.GetGenerateName() != "" { + if err := Mutate(f, key, obj); err != nil { + return controllerutil.OperationResultNone, err + } + if err := c.Create(ctx, obj); err != nil { + return controllerutil.OperationResultNone, err + } + return controllerutil.OperationResultCreated, nil + } + + return controllerutil.CreateOrUpdate(ctx, c, obj, f) +} + +// AddServiceAccountAuth adds the authentication information of a service account to a rest config. +// It also waits for the secret with the token to be created. +func AddServiceAccountAuth(ctx context.Context, kubeClient client.Client, sa *corev1.ServiceAccount, config *rest.Config) error { + saKey := ObjectKeyFromObject(sa) + // wait for k8s to generate the service account secret + err := wait.PollImmediate(10*time.Second, 5*time.Minute, func() (done bool, err error) { + if err := kubeClient.Get(ctx, saKey, sa); err != nil { + return false, nil + } + return len(sa.Secrets) != 0, nil + }) + if err != nil { + return err + } + + secret := &corev1.Secret{} + if err := kubeClient.Get(ctx, ObjectKey(sa.Secrets[0].Name, sa.Namespace), secret); err != nil { + return fmt.Errorf("unable to get service account %q secret: %w", sa.Name, err) + } + + if token, ok := secret.Data[corev1.ServiceAccountTokenKey]; ok { + config.BearerToken = string(token) + return nil + + } + return fmt.Errorf("no token for authentication was present in the secret %q", secret.Name) +} + +// ResolveSecrets finds and returns the secrets referenced by secretRefs +func ResolveSecrets(ctx context.Context, client client.Client, secretRefs []v1alpha1.ObjectReference) ([]corev1.Secret, error) { + secrets := make([]corev1.Secret, len(secretRefs)) + for i, secretRef := range secretRefs { + secret := corev1.Secret{} + // todo: check for cache + if err := client.Get(ctx, secretRef.NamespacedName(), &secret); err != nil { + return nil, err + } + secrets[i] = secret + } + return secrets, nil +} + +// Mutate wraps a MutateFn and applies validation to its result +func Mutate(f controllerutil.MutateFn, key client.ObjectKey, obj client.Object) error { + if err := f(); err != nil { + return err + } + if newKey := client.ObjectKeyFromObject(obj); key != newKey { + return fmt.Errorf("MutateFn cannot Mutate object name and/or object namespace") + } + return nil +} + +// ObjectKey creates a namespaced name (client.ObjectKey) for a given name and namespace. +func ObjectKey(name, namespace string) types.NamespacedName { + return types.NamespacedName{ + Namespace: namespace, + Name: name, + } +} + +// ObjectKeyFromObject creates a namespaced name for a given object. +func ObjectKeyFromObject(obj metav1.Object) types.NamespacedName { + return types.NamespacedName{ + Name: obj.GetName(), + Namespace: obj.GetNamespace(), + } +} + +// ReconcileRequestFromObject creates a namespaced name for a given object. +func ReconcileRequestFromObject(obj client.Object) reconcile.Request { + return reconcile.Request{ + NamespacedName: ObjectKeyFromObject(obj), + } +} + +// GetStatusForContainer returns the container status for a specific container +func GetStatusForContainer(containerStatus []corev1.ContainerStatus, name string) (corev1.ContainerStatus, error) { + for _, status := range containerStatus { + if status.Name == name { + return status, nil + } + } + return corev1.ContainerStatus{}, errors.New("container not found") +} + +// OwnerOfGVK validates whether a instance of the given gvk is referenced +func OwnerOfGVK(ownerRefs []metav1.OwnerReference, gvk schema.GroupVersionKind) (string, bool) { + for _, ownerRef := range ownerRefs { + gv, err := schema.ParseGroupVersion(ownerRef.APIVersion) + if err != nil { + continue + } + if gv.Group == gvk.Group && ownerRef.Kind == gvk.Kind { + return ownerRef.Name, true + } + } + return "", false +} + +// GetOwner returns the owner reference of a object. +// If multiple owners are defined, the controlling owner is returned. +func GetOwner(objMeta metav1.ObjectMeta) *metav1.OwnerReference { + return GetMainOwnerFromOwnerReferences(objMeta.GetOwnerReferences()) +} + +// GetMainOwnerFromOwnerReferences returns the main owner from a list of owner references. +// If the list contains only a single reference, that one is returned. +// If multiple owners are defined, the controlling owner is returned. +// If there are multiple references and no controlling one, nil is returned. +func GetMainOwnerFromOwnerReferences(owners []metav1.OwnerReference) *metav1.OwnerReference { + if len(owners) == 1 { + return &owners[0] + } + for _, ownerRef := range owners { + if ownerRef.Controller != nil && *ownerRef.Controller { + return &ownerRef + } + } + return nil +} + +// TypedObjectReferenceFromObject creates a typed object reference from a object. +func TypedObjectReferenceFromObject(obj runtime.Object, scheme *runtime.Scheme) (*v1alpha1.TypedObjectReference, error) { + metaObj, err := meta.Accessor(obj) + if err != nil { + return nil, err + } + + gvk, err := apiutil.GVKForObject(obj, scheme) + if err != nil { + return nil, err + } + + return &v1alpha1.TypedObjectReference{ + APIVersion: gvk.GroupVersion().String(), + Kind: gvk.Kind, + ObjectReference: v1alpha1.ObjectReference{ + Name: metaObj.GetName(), + Namespace: metaObj.GetNamespace(), + }, + }, nil +} + +// TypedObjectReferenceFromUnstructuredObject creates a typed object reference from an unstructured object. +func TypedObjectReferenceFromUnstructuredObject(obj *unstructured.Unstructured) *v1alpha1.TypedObjectReference { + return &v1alpha1.TypedObjectReference{ + APIVersion: obj.GroupVersionKind().GroupVersion().String(), + Kind: obj.GetKind(), + ObjectReference: v1alpha1.ObjectReference{ + Name: obj.GetName(), + Namespace: obj.GetNamespace(), + }, + } +} + +// CoreObjectReferenceFromUnstructuredObject creates a core object reference from an unstructured object. +func CoreObjectReferenceFromUnstructuredObject(obj *unstructured.Unstructured) *corev1.ObjectReference { + return &corev1.ObjectReference{ + APIVersion: obj.GroupVersionKind().GroupVersion().String(), + Kind: obj.GetKind(), + Name: obj.GetName(), + Namespace: obj.GetNamespace(), + UID: obj.GetUID(), + } +} + +// ObjectFromTypedObjectReference creates an unstructured object from a typed object reference. +func ObjectFromTypedObjectReference(ref *v1alpha1.TypedObjectReference) *unstructured.Unstructured { + return &unstructured.Unstructured{ + Object: map[string]interface{}{ + "apiVersion": ref.APIVersion, + "kind": ref.Kind, + "metadata": map[string]interface{}{ + "name": ref.Name, + "namespace": ref.Namespace, + }, + }, + } +} + +// ObjectFromCoreObjectReference creates an unstructured object from a core object reference. +func ObjectFromCoreObjectReference(ref *corev1.ObjectReference) *unstructured.Unstructured { + return &unstructured.Unstructured{ + Object: map[string]interface{}{ + "apiVersion": ref.APIVersion, + "kind": ref.Kind, + "metadata": map[string]interface{}{ + "name": ref.Name, + "namespace": ref.Namespace, + }, + }, + } +} + +// HasFinalizer checks if the object constains a finalizer with the given name. +func HasFinalizer(obj metav1.Object, finalizer string) bool { + for _, f := range obj.GetFinalizers() { + if f == finalizer { + return true + } + } + return false +} + +// SetMetaDataLabel sets the label and value +func SetMetaDataLabel(obj metav1.Object, lab string, value string) { + labels := obj.GetLabels() + if labels == nil { + labels = make(map[string]string) + } + labels[lab] = value + obj.SetLabels(labels) +} + +// HasLabel checks if the objects has a label +func HasLabel(obj metav1.Object, lab string) bool { + labels := obj.GetLabels() + if labels == nil { + return false + } + _, ok := labels[lab] + return ok +} + +// HasLabelWithValue checks if the objects has a label with a value +func HasLabelWithValue(obj metav1.Object, lab string, value string) bool { + labels := obj.GetLabels() + if labels == nil { + return false + } + val, ok := labels[lab] + if !ok { + return false + } + return val == value +} + +// ConvertToRawExtension converts a object to a raw extension. +// The type of the object is automatically set given the scheme. +func ConvertToRawExtension(from runtime.Object, scheme *runtime.Scheme) (*runtime.RawExtension, error) { + // set the apiversion and kind + if err := InjectTypeInformation(from, scheme); err != nil { + return nil, err + } + + fromBytes, err := json.Marshal(from) + if err != nil { + return nil, err + } + + ext := &runtime.RawExtension{ + Raw: fromBytes, + Object: from, + } + return ext, nil +} + +// InjectTypeInformation injects the group version kind into a runtime object. +// This is needed as this information gets lost when a struct is decoded. +func InjectTypeInformation(obj runtime.Object, scheme *runtime.Scheme) error { + // set the apiversion and kind + gvk, err := apiutil.GVKForObject(obj, scheme) + if err != nil { + return fmt.Errorf("unable to to get gvk for provider configuration: %w", err) + } + obj.GetObjectKind().SetGroupVersionKind(gvk) + return nil +} + +// GenerateKubeconfigBytes generates a kubernetes kubeconfig config object from a rest config +// and encodes it as yaml. +func GenerateKubeconfigBytes(restConfig *rest.Config) ([]byte, error) { + clientConfig, err := GenerateKubeconfig(restConfig) + if err != nil { + return nil, err + } + return clientcmd.Write(clientConfig) +} + +// GenerateKubeconfigJSONBytes generates a kubernetes kubeconfig config object from a rest config +// and encodes it as json. +func GenerateKubeconfigJSONBytes(restConfig *rest.Config) ([]byte, error) { + clientConfig, err := GenerateKubeconfig(restConfig) + if err != nil { + return nil, err + } + data, err := clientcmd.Write(clientConfig) + if err != nil { + return nil, err + } + return yaml.YAMLToJSON(data) +} + +// GenerateKubeconfig generates a kubernetes kubeconfig config object from a rest config +func GenerateKubeconfig(restConfig *rest.Config) (clientcmdapi.Config, error) { + const defaultID = "default" + + var ( + caData = restConfig.TLSClientConfig.CAData + certData = restConfig.TLSClientConfig.CertData + keyData = restConfig.TLSClientConfig.KeyData + + bearerToken = restConfig.BearerToken + ) + if len(restConfig.TLSClientConfig.CAFile) != 0 { + data, err := ioutil.ReadFile(restConfig.TLSClientConfig.CAFile) + if err != nil { + return clientcmdapi.Config{}, fmt.Errorf("unable to read ca from %q: %w", restConfig.TLSClientConfig.CAFile, err) + } + caData = data + } + if len(restConfig.TLSClientConfig.CertFile) != 0 { + data, err := ioutil.ReadFile(restConfig.TLSClientConfig.CertFile) + if err != nil { + return clientcmdapi.Config{}, fmt.Errorf("unable to read cert from %q: %w", restConfig.TLSClientConfig.CertFile, err) + } + certData = data + } + if len(restConfig.TLSClientConfig.KeyFile) != 0 { + data, err := ioutil.ReadFile(restConfig.TLSClientConfig.KeyFile) + if err != nil { + return clientcmdapi.Config{}, fmt.Errorf("unable to read key from %q: %w", restConfig.TLSClientConfig.KeyFile, err) + } + keyData = data + } + if len(restConfig.BearerTokenFile) != 0 { + data, err := ioutil.ReadFile(restConfig.BearerTokenFile) + if err != nil { + return clientcmdapi.Config{}, fmt.Errorf("unable to read bearer token from %q: %w", restConfig.BearerTokenFile, err) + } + bearerToken = string(data) + } + + cfg := clientcmdapi.Config{ + APIVersion: "v1", + Kind: "Config", + CurrentContext: defaultID, + Contexts: map[string]*clientcmdapi.Context{ + defaultID: { + Cluster: defaultID, + AuthInfo: defaultID, + }, + }, + AuthInfos: map[string]*clientcmdapi.AuthInfo{ + defaultID: { + Token: bearerToken, + + Username: restConfig.Username, + Password: restConfig.Password, + + ClientCertificateData: certData, + ClientKeyData: keyData, + }, + }, + Clusters: map[string]*clientcmdapi.Cluster{ + defaultID: { + Server: restConfig.Host + restConfig.APIPath, + CertificateAuthorityData: caData, + InsecureSkipTLSVerify: restConfig.Insecure, + }, + }, + } + return cfg, nil +} + +// ParseFiles parses a map of filename->data into unstructured yaml objects. +func ParseFiles(log logr.Logger, files map[string]string) ([]*unstructured.Unstructured, error) { + objects := make([]*unstructured.Unstructured, 0) + for name, content := range files { + if _, file := filepath.Split(name); file == "NOTES.txt" { + continue + } + decodedObjects, err := DecodeObjects(log, name, []byte(content)) + if err != nil { + return nil, fmt.Errorf("unable to decode files for %q: %w", name, err) + } + objects = append(objects, decodedObjects...) + } + return objects, nil +} + +// ParseFilesToRawExtension parses a map of filename->data into unstructured yaml objects. +func ParseFilesToRawExtension(log logr.Logger, files map[string]string) ([]*runtime.RawExtension, error) { + objects := make([]*runtime.RawExtension, 0) + for name, content := range files { + if _, file := filepath.Split(name); file == "NOTES.txt" { + continue + } + decodedObjects, err := DecodeObjectsToRawExtension(log, name, []byte(content)) + if err != nil { + return nil, fmt.Errorf("unable to decode files for %q: %w", name, err) + } + objects = append(objects, decodedObjects...) + } + return objects, nil +} + +// DecodeObjects decodes raw data that can be a multiyaml file into unstructured kubernetes objects. +func DecodeObjects(log logr.Logger, name string, data []byte) ([]*unstructured.Unstructured, error) { + var ( + decoder = yamlutil.NewYAMLOrJSONDecoder(bytes.NewReader(data), 1024) + decodedObj map[string]interface{} + objects = make([]*unstructured.Unstructured, 0) + ) + + for i := 0; true; i++ { + if err := decoder.Decode(&decodedObj); err != nil { + if err == io.EOF { + break + } + log.Error(err, fmt.Sprintf("unable to decode resource %d of file %q", i, name)) + continue + } + if decodedObj == nil { + continue + } + obj := &unstructured.Unstructured{Object: decodedObj} + // ignore the obj if no group version is defined + if len(obj.GetAPIVersion()) == 0 { + continue + } + objects = append(objects, obj.DeepCopy()) + } + return objects, nil +} + +// DecodeObjectsToRawExtension decodes raw data that can be a multiyaml file into unstructured kubernetes objects. +func DecodeObjectsToRawExtension(log logr.Logger, name string, data []byte) ([]*runtime.RawExtension, error) { + var ( + decoder = yamlutil.NewYAMLOrJSONDecoder(bytes.NewReader(data), 1024) + objects = make([]*runtime.RawExtension, 0) + ) + + for i := 0; true; i++ { + obj := &runtime.RawExtension{} + if err := decoder.Decode(&obj); err != nil { + if err == io.EOF { + break + } + log.Error(err, fmt.Sprintf("unable to decode resource %d of file %q", i, name)) + continue + } + if obj == nil || obj.Raw == nil { + continue + } + // ignore the obj if no group version is defined + var typeMeta runtime.TypeMeta + if err := json.Unmarshal(obj.Raw, &typeMeta); err != nil { + log.Error(err, fmt.Sprintf("unable to parse type meta %d of file %q to runtime object", i, name)) + continue + } + if typeMeta.GetObjectKind().GroupVersionKind().Empty() { + continue + } + objects = append(objects, obj.DeepCopy()) + } + return objects, nil +} + +// DeleteAndWaitForObjectDeleted deletes an object and waits for the object to be deleted. +func DeleteAndWaitForObjectDeleted(ctx context.Context, kubeClient client.Client, timeout time.Duration, obj client.Object) error { + if err := kubeClient.Delete(ctx, obj); err != nil { + gvk := obj.GetObjectKind().GroupVersionKind().String() + return fmt.Errorf("unable to delete %s %s/%s: %w", gvk, obj.GetName(), obj.GetNamespace(), err) + } + + pollCtx, cancel := context.WithTimeout(ctx, timeout) + defer cancel() + delCondFunc := GenerateDeleteObjectConditionFunc(ctx, kubeClient, obj) + return wait.PollImmediateUntil(5*time.Second, delCondFunc, pollCtx.Done()) +} + +// GenerateDeleteObjectConditionFunc creates a condition function to validate the deletion of objects. +func GenerateDeleteObjectConditionFunc(ctx context.Context, kubeClient client.Client, obj client.Object) wait.ConditionFunc { + return func() (done bool, err error) { + key := ObjectKey(obj.GetName(), obj.GetNamespace()) + if err := kubeClient.Get(ctx, key, obj); err != nil { + if apierrors.IsNotFound(err) { + return true, nil + } + return false, err + } + return false, nil + } +} + +// SetRequiredNestedFieldsFromObj sets the immutable or the fields that are required +// when updating un object. e.g: the ClusterIP of a service. +func SetRequiredNestedFieldsFromObj(currObj, obj *unstructured.Unstructured) error { + currObjGK := currObj.GroupVersionKind().GroupKind() + objGK := obj.GroupVersionKind().GroupKind() + + if currObjGK != objGK { + return fmt.Errorf("objects do not have the same GoupKind: %s/%s", currObjGK, objGK) + } + + switch currObjGK.String() { + case "Job.batch": + selector, found, err := unstructured.NestedMap(currObj.Object, "spec", "selector") + if err != nil { + return err + } + if found { + if err := unstructured.SetNestedMap(obj.Object, selector, "spec", "selector"); err != nil { + return err + } + } + labels, found, err := unstructured.NestedMap(currObj.Object, "spec", "template", "metadata", "labels") + if err != nil { + return err + } + if found { + if err := unstructured.SetNestedMap(obj.Object, labels, "spec", "template", "metadata", "labels"); err != nil { + return err + } + } + case "Service": + clusterIP, found, err := unstructured.NestedString(currObj.Object, "spec", "clusterIP") + if err != nil { + return err + } + if found { + if err := unstructured.SetNestedField(obj.Object, clusterIP, "spec", "clusterIP"); err != nil { + return err + } + } + case "ServiceAccount": + secrets, found, err := unstructured.NestedSlice(obj.Object, "secrets") + if err != nil { + return err + } + + if !found || len(secrets) == 0 { + secrets, found, err = unstructured.NestedSlice(currObj.Object, "secrets") + if err != nil { + return err + } + if found && len(secrets) > 0 { + if err := unstructured.SetNestedSlice(obj.Object, secrets, "secrets"); err != nil { + return err + } + } + } + } + + resourceVersion, found, err := unstructured.NestedString(currObj.Object, "metadata", "resourceVersion") + if err != nil { + return err + } + if found { + if err := unstructured.SetNestedField(obj.Object, resourceVersion, "metadata", "resourceVersion"); err != nil { + return err + } + } + + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/config.go b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/config.go new file mode 100644 index 000000000..5e615bb99 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/config.go @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package logger + +import ( + flag "github.com/spf13/pflag" + "go.uber.org/zap" +) + +type Config struct { + flagset *flag.FlagSet + + Development bool + Cli bool + Verbosity int + DisableStacktrace bool + DisableCaller bool + DisableTimestamp bool +} + +func InitFlags(flagset *flag.FlagSet) { + if flagset == nil { + flagset = flag.CommandLine + } + fs := flag.NewFlagSet("log", flag.ExitOnError) + + fs.BoolVar(&configFromFlags.Development, "dev", false, "enable development logging which result in console encoding, enabled stacktrace and enabled caller") + fs.BoolVar(&configFromFlags.Cli, "cli", false, "logger runs as cli logger. enables cli logging") + fs.IntVarP(&configFromFlags.Verbosity, "verbosity", "v", 1, "number for the log level verbosity") + fs.BoolVar(&configFromFlags.DisableStacktrace, "disable-stacktrace", true, "disable the stacktrace of error logs") + fs.BoolVar(&configFromFlags.DisableCaller, "disable-caller", true, "disable the caller of logs") + fs.BoolVar(&configFromFlags.DisableTimestamp, "disable-timestamp", true, "disable timestamp output") + + configFromFlags.flagset = fs + flagset.AddFlagSet(configFromFlags.flagset) +} + +// SetDisableStacktrace dis- or enables the stackstrace according to the provided flag if the flag was provided +func (c *Config) SetDisableStacktrace(zapCfg *zap.Config) { + if c.flagset == nil || c.flagset.Changed("disable-stacktrace") { + zapCfg.DisableStacktrace = c.DisableStacktrace + } +} + +// SetDisableCaller dis- or enables the caller according to the provided flag if the flag was provided +func (c *Config) SetDisableCaller(zapCfg *zap.Config) { + if c.flagset == nil || c.flagset.Changed("disable-caller") { + zapCfg.DisableCaller = c.DisableCaller + } +} + +// SetTimestamp dis- or enables the logging of timestamps according to the provided flag if the flag was provided +func (c *Config) SetTimestamp(zapCfg *zap.Config) { + if c.flagset == nil || c.flagset.Changed("disable-timestamp") { + if c.DisableTimestamp { + zapCfg.EncoderConfig.TimeKey = "" + } else { + zapCfg.EncoderConfig.TimeKey = "ts" + } + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/helper.go b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/helper.go new file mode 100644 index 000000000..9d7db7691 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/helper.go @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package logger + +import "fmt" + +func Logf(logFunc func(msg string, keysAndValues ...interface{}), format string, a ...interface{}) { + message := fmt.Sprintf(format, a...) + logFunc(message) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/logger.go b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/logger.go new file mode 100644 index 000000000..814fb784b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/controller-utils/pkg/logger/logger.go @@ -0,0 +1,131 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package logger + +import ( + "github.com/go-logr/logr" + "github.com/go-logr/zapr" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +var ( + Log logr.Logger + configFromFlags = Config{} +) + +var encoderConfig = zapcore.EncoderConfig{ + TimeKey: "ts", + LevelKey: "level", + NameKey: "logger", + CallerKey: "caller", + MessageKey: "msg", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.LowercaseLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.SecondsDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, +} + +var cliEncoderConfig = zapcore.EncoderConfig{ + TimeKey: "", + LevelKey: "level", + NameKey: "logger", + CallerKey: "caller", + MessageKey: "msg", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.LowercaseColorLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.SecondsDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, +} + +var defaultConfig = zap.Config{ + Level: zap.NewAtomicLevelAt(zap.InfoLevel), + Development: true, + Encoding: "console", + DisableStacktrace: false, + DisableCaller: false, + EncoderConfig: encoderConfig, + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, +} + +var cliConfig = zap.Config{ + Level: zap.NewAtomicLevelAt(zap.InfoLevel), + Development: false, + Encoding: "console", + DisableStacktrace: false, + DisableCaller: true, + EncoderConfig: cliEncoderConfig, + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, +} + +var productionConfig = zap.Config{ + Level: zap.NewAtomicLevelAt(zap.InfoLevel), + Development: false, + DisableStacktrace: true, + DisableCaller: true, + Encoding: "json", + EncoderConfig: encoderConfig, + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, +} + +func New(config *Config) (logr.Logger, error) { + if config == nil { + config = &configFromFlags + } + zapCfg := determineZapConfig(config) + + level := int8(0 - config.Verbosity) + zapCfg.Level = zap.NewAtomicLevelAt(zapcore.Level(level)) + + zapLog, err := zapCfg.Build(zap.AddCallerSkip(1)) + if err != nil { + return nil, err + } + return zapr.NewLogger(zapLog), nil +} + +func SetLogger(log logr.Logger) { + Log = log +} + +// NewCliLogger creates a new logger for cli usage. +// CLI usage means that by default: +// - the default dev config +// - encoding is console +// - timestamps are disabled (can be still activated by the cli flag) +// - level are color encoded +func NewCliLogger() (logr.Logger, error) { + config := &configFromFlags + config.Cli = true + return New(config) +} + +func determineZapConfig(loggerConfig *Config) zap.Config { + var zapConfig zap.Config + if loggerConfig.Development { + zapConfig = defaultConfig + } else if loggerConfig.Cli { + zapConfig = cliConfig + if loggerConfig.Development { + zapConfig.Development = true + loggerConfig.DisableCaller = false + } + } else { + zapConfig = productionConfig + } + + loggerConfig.SetDisableCaller(&zapConfig) + loggerConfig.SetDisableStacktrace(&zapConfig) + loggerConfig.SetTimestamp(&zapConfig) + + return zapConfig +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/api/types.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/api/types.go new file mode 100644 index 000000000..11c056a0e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/api/types.go @@ -0,0 +1,103 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package api + +import ( + "errors" + "fmt" + + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + kubernetescheme "k8s.io/client-go/kubernetes/scheme" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" + + configinstall "github.com/gardener/landscaper/apis/config/install" + coreinstall "github.com/gardener/landscaper/apis/core/install" +) + +var ( + // LandscaperScheme is the scheme used in the landscaper cluster. + LandscaperScheme = runtime.NewScheme() + // ConfigScheme is the scheme used for configurations. + ConfigScheme = runtime.NewScheme() + // Scheme is the scheme used in the landscaper cluster and for configurations. + Scheme = runtime.NewScheme() + // Decoder is a decoder for the landscaper and landscaper config scheme. + Decoder runtime.Decoder +) + +func init() { + coreinstall.Install(LandscaperScheme) + utilruntime.Must(kubernetescheme.AddToScheme(LandscaperScheme)) + configinstall.Install(ConfigScheme) + + coreinstall.Install(Scheme) + utilruntime.Must(kubernetescheme.AddToScheme(Scheme)) + configinstall.Install(Scheme) + Decoder = NewDecoder(Scheme) +} + +// NewDecoder creates a new universal decoder. +func NewDecoder(scheme *runtime.Scheme) runtime.Decoder { + return &UniversalInternalVersionDecoder{ + scheme: scheme, + decoder: serializer.NewCodecFactory(scheme).UniversalDecoder(), + } +} + +// UniversalInternalVersionDecoder is a decoder that can decode kubernetes-like versioned resources. +// The universal decoder does automatically use the internal type to perform conversion +// which is a missing feature in the kubernetes codec factory. +type UniversalInternalVersionDecoder struct { + scheme *runtime.Scheme + decoder runtime.Decoder +} + +var _ runtime.Decoder = &UniversalInternalVersionDecoder{} + +// todo: implement shortcut for actual.gvk == into.gvk +func (d *UniversalInternalVersionDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) { + if into == nil && defaults == nil { + return nil, nil, errors.New("no default group version kind nor a object are defined") + } + + if into == nil && defaults != nil { + var err error + into, err = d.scheme.New(*defaults) + if err != nil { + return nil, nil, err + } + } + + if _, isUnstructured := into.(*unstructured.Unstructured); isUnstructured { + return d.decoder.Decode(data, defaults, into) + } + + gvk, err := apiutil.GVKForObject(into, d.scheme) + if err != nil { + return nil, nil, err + } + + internalGVK := gvk + internalGVK.Version = runtime.APIVersionInternal + if !d.scheme.Recognizes(internalGVK) { + return d.decoder.Decode(data, defaults, into) + } + + // decode to internal type + internalObj, _, err := d.decoder.Decode(data, &internalGVK, nil) + if err != nil { + return nil, nil, fmt.Errorf("unable to decode to internal type: %w", err) + } + + if err := d.scheme.Convert(internalObj, into, nil); err != nil { + return nil, nil, err + } + + return into, &gvk, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/jsonschema/reference.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/jsonschema/reference.go new file mode 100644 index 000000000..a3e186262 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/jsonschema/reference.go @@ -0,0 +1,343 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package jsonschema + +import ( + "bytes" + "compress/gzip" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/url" + "path/filepath" + "strings" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/ctf" + "github.com/mandelsoft/vfs/pkg/vfs" + "github.com/xeipuuv/gojsonschema" + "k8s.io/apimachinery/pkg/util/validation/field" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "github.com/gardener/landscaper/apis/mediatype" + "github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils" +) + +// ReferenceContext describes the context of the current reference. +type ReferenceContext struct { + // LocalTypes is a map of blueprint locally defined types. + // It is a map of schema name to schema definition + LocalTypes map[string]lsv1alpha1.JSONSchemaDefinition + // BlueprintFs is the virtual filesystem that is used to resolve "blueprint" refs + BlueprintFs vfs.FileSystem + // ComponentDescriptor contains the current blueprint's component descriptor. + ComponentDescriptor *cdv2.ComponentDescriptor + // ComponentResolver is a object that can resolve component descriptors. + ComponentResolver ctf.ComponentResolver + // RepositoryContext can be used to overwrite the effective repository context of the component descriptor. + // If not set, the effective repository context of the ComponentDescriptor will be used. + RepositoryContext *cdv2.UnstructuredTypedObject +} + +type ReferenceResolver struct { + *ReferenceContext +} + +func NewReferenceResolver(refCtx *ReferenceContext) *ReferenceResolver { + if refCtx == nil { + refCtx = &ReferenceContext{} + } + return &ReferenceResolver{refCtx} +} + +// Resolve walks through the given json schema and recursively resolves all references which use one of +// the "local", "blueprint", or "cd" schemes. +func (rr *ReferenceResolver) Resolve(schemaBytes []byte) (interface{}, error) { + data, err := decodeJSON(schemaBytes) + if err != nil { + return nil, err + } + return rr.resolve(data, field.NewPath(""), nil) +} + +func (rr *ReferenceResolver) resolve(data interface{}, currentPath *field.Path, alreadyResolved stringSet) (interface{}, error) { + switch typedData := data.(type) { + case map[string]interface{}: + return rr.resolveMap(typedData, currentPath, newStringSet(alreadyResolved)) + case []interface{}: + return rr.resolveList(typedData, currentPath, newStringSet(alreadyResolved)) + } + return data, nil +} + +// resolveMap is a helper function which can recursively resolve a map +func (rr *ReferenceResolver) resolveMap(data map[string]interface{}, currentPath *field.Path, alreadyResolved stringSet) (interface{}, error) { + isRef, uri, err := checkForReference(data, currentPath) + if err != nil { + return err, nil + } + + if isRef { + // current map is a reference + sub, err := rr.resolveReference(uri, currentPath, alreadyResolved) + if err != nil { + return nil, fmt.Errorf("error resolving reference at %s: %w", currentPath.Child(gojsonschema.KEY_REF).String(), err) + } + return sub, nil + } + + // current map is not a reference + // iterate over entries and resolve each of them + res := map[string]interface{}{} + for k, v := range data { + subPath := currentPath.Child(k) + sub, err := rr.resolve(v, subPath, alreadyResolved) + if err != nil { + return nil, err + } + res[k] = sub + } + return res, nil +} + +// checkForReference checks whether a given map is a valid reference +// If it is a reference, it returns true and the URL of the reference. +// Otherwise, it returns false and an empty string. +func checkForReference(data map[string]interface{}, currentPath *field.Path) (bool, string, error) { + value, ok := data[gojsonschema.KEY_REF] + if !ok { + // no reference + return false, "", nil + } + typedValue, ok := value.(string) + if !ok { + return true, "", fmt.Errorf("invalid reference value at %s: expected string, got %v", currentPath.Child(gojsonschema.KEY_REF).String(), value) + } + return true, typedValue, nil +} + +// resolveList is a helper function which can recursively resolve a list +func (rr *ReferenceResolver) resolveList(data []interface{}, currentPath *field.Path, alreadyResolved stringSet) (interface{}, error) { + resList := make([]interface{}, len(data)) + for i, e := range data { + sub, err := rr.resolve(e, currentPath.Index(i), alreadyResolved) + if err != nil { + return nil, err + } + resList[i] = sub + } + return resList, nil +} + +// resolveReference resolves a reference +func (rr *ReferenceResolver) resolveReference(s string, currentPath *field.Path, alreadyResolved stringSet) (interface{}, error) { + uri, err := url.Parse(s) + if err != nil { + return nil, fmt.Errorf("invalid url: %w", err) + } + refID := absoluteRef(rr.ComponentDescriptor, s) + if alreadyResolved.contains(refID) { + return nil, fmt.Errorf("cyclic references detected: reference %q from component %s:%s is part of a cycle", s, rr.ComponentDescriptor.Name, rr.ComponentDescriptor.Version) + } + alreadyResolved.add(refID) + switch uri.Scheme { + case "local": + return rr.handleLocalReference(uri, currentPath, alreadyResolved) + case "blueprint": + return rr.handleBlueprintReference(uri, currentPath, alreadyResolved) + case "cd": + return rr.handleComponentDescriptorReference(uri, currentPath, alreadyResolved) + } + + // unknown reference scheme + // rebuild reference because it is replaced in calling method + return map[string]interface{}{ + gojsonschema.KEY_REF: s, + }, nil +} + +func (rr *ReferenceResolver) handleLocalReference(uri *url.URL, currentPath *field.Path, alreadyResolved stringSet) (interface{}, error) { + if len(uri.Path) != 0 { + return nil, errors.New("a path is not supported for local resources") + } + schema, ok := rr.LocalTypes[uri.Host] + if !ok { + return nil, fmt.Errorf("type %s is not defined in local types", uri.Host) + } + data, err := decodeJSON(schema.RawMessage) + if err != nil { + return nil, fmt.Errorf("error unmarshalling json into go struct: %w", err) + } + res, err := rr.resolve(data, currentPath, alreadyResolved) + if err != nil { + return nil, err + } + return resolveFragment(uri, res) +} + +func (rr *ReferenceResolver) handleBlueprintReference(uri *url.URL, currentPath *field.Path, alreadyResolved stringSet) (interface{}, error) { + if rr.BlueprintFs == nil { + return nil, errors.New("no filesystem defined to read a local schema") + } + filePath := filepath.Join(uri.Host, uri.Path) + schemaBytes, err := vfs.ReadFile(rr.BlueprintFs, filePath) + if err != nil { + return nil, fmt.Errorf("unable to read local schema from %s: %w", filePath, err) + } + data, err := decodeJSON(schemaBytes) + if err != nil { + return nil, fmt.Errorf("error unmarshalling json into go struct: %w", err) + } + res, err := rr.resolve(data, currentPath, alreadyResolved) + if err != nil { + return nil, err + } + return resolveFragment(uri, res) +} + +func (rr *ReferenceResolver) handleComponentDescriptorReference(uri *url.URL, currentPath *field.Path, alreadyResolved stringSet) (interface{}, error) { + if rr.ComponentDescriptor == nil { + return nil, errors.New("no component descriptor defined to resolve the ref") + } + if rr.ComponentResolver == nil { + return nil, errors.New("no component reference resolver defined to resolve the ref") + } + cdUri, err := cdutils.ParseURI(uri.String()) + if err != nil { + return nil, err + } + repositoryContext := rr.RepositoryContext + if repositoryContext == nil { + repositoryContext = rr.ComponentDescriptor.GetEffectiveRepositoryContext() + } + cd, res, err := cdUri.GetResource(rr.ComponentDescriptor, rr.ComponentResolver, repositoryContext) + if err != nil { + return nil, err + } + + // get the blob resolver for the specific component + ctx := context.Background() + defer ctx.Done() + repositoryContext = rr.RepositoryContext + if repositoryContext == nil { + repositoryContext = cd.GetEffectiveRepositoryContext() + } + _, blobResolver, err := rr.ComponentResolver.ResolveWithBlobResolver(ctx, repositoryContext, cd.GetName(), cd.GetVersion()) + if err != nil { + return nil, fmt.Errorf("unable to fetch component descriptor %s:%s for %q: %w", cd.GetName(), cd.GetVersion(), uri.String(), err) + } + + var JSONSchemaBuf bytes.Buffer + info, err := blobResolver.Resolve(ctx, res, &JSONSchemaBuf) + if err != nil { + return nil, fmt.Errorf("unable to fetch jsonschema for '%s': %w", uri.String(), err) + } + + mt, err := mediatype.Parse(info.MediaType) + if err != nil { + return nil, fmt.Errorf("unable to parse media type %q: %w", info.MediaType, err) + } + if mt.Type != mediatype.JSONSchemaArtifactsMediaTypeV1 { + return nil, fmt.Errorf("unknown media type %s expected %s", info.MediaType, mediatype.JSONSchemaArtifactsMediaTypeV1) + } + + result := JSONSchemaBuf.Bytes() + + if mt.IsCompressed(mediatype.GZipCompression) { + var decompJSONSchemaBuf bytes.Buffer + r, err := gzip.NewReader(&JSONSchemaBuf) + if err != nil { + return nil, fmt.Errorf("unable to decompress jsonschema: %w", err) + } + if _, err := io.Copy(&decompJSONSchemaBuf, r); err != nil { + return nil, fmt.Errorf("unable to decompress jsonschema: %w", err) + } + result = decompJSONSchemaBuf.Bytes() + } + + data, err := decodeJSON(result) + if err != nil { + return nil, fmt.Errorf("error unmarshalling json into go struct: %w", err) + } + + resolved, err := NewReferenceResolver(&ReferenceContext{ + LocalTypes: nil, + BlueprintFs: nil, + ComponentDescriptor: cd, + ComponentResolver: rr.ComponentResolver, + RepositoryContext: rr.RepositoryContext, + }).resolve(data, currentPath, alreadyResolved) + if err != nil { + return nil, err + } + return resolveFragment(uri, resolved) +} + +// decodeJSON decodes a json string into go structs +func decodeJSON(rawData []byte) (interface{}, error) { + decoder := json.NewDecoder(bytes.NewReader(rawData)) + decoder.UseNumber() + var data interface{} + err := decoder.Decode(&data) + if err != nil { + return nil, err + } + return data, nil +} + +// resolveFragment is used to resolve references which don't refer to a complete resource, but to a specific path within it +func resolveFragment(uri *url.URL, data interface{}) (interface{}, error) { + if len(uri.Fragment) == 0 { + return data, nil + } + fragment := strings.TrimPrefix(uri.Fragment, "/") + fragment = strings.TrimSuffix(fragment, "/") + frags := strings.Split(fragment, "/") + path := field.NewPath("") + current := data + for _, f := range frags { + elem, ok := current.(map[string]interface{}) + if !ok { + return data, fmt.Errorf("unable to resolve fragment %s: element at %q is no object", uri.Fragment, path.String()) + } + current, ok = elem[f] + if !ok { + return data, fmt.Errorf("error resolving fragment %s: element at %q doesn't have a field %q", uri.Fragment, path.String(), f) + } + path = path.Child(f) + } + return current, nil +} + +// auxiliary type +type stringSet map[string]struct{} + +func (s stringSet) contains(key string) bool { + _, ok := s[key] + return ok +} + +func (s stringSet) add(key string) { + s[key] = struct{}{} +} + +// absoluteRef prefixes a given refstring with name and version of the component descriptor where it came from +// this transforms the relative references into an absolute identifier +func absoluteRef(cd *cdv2.ComponentDescriptor, ref string) string { + if cd == nil { + return ref + } + return fmt.Sprintf("%s:%s::%s", cd.Name, cd.Version, ref) +} + +func newStringSet(old stringSet) stringSet { + res := stringSet{} + for k := range old { + res.add(k) + } + return res +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/jsonschema/validate.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/jsonschema/validate.go new file mode 100644 index 000000000..17eaad899 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/jsonschema/validate.go @@ -0,0 +1,95 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package jsonschema + +import ( + "errors" + + "github.com/xeipuuv/gojsonschema" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +type Validator struct { + Context *ReferenceContext + Schema *gojsonschema.Schema +} + +// NewValidator returns a new Validator with the given reference context. +func NewValidator(context *ReferenceContext) *Validator { + return &Validator{ + Context: context, + } +} + +// ValidateSchema validates a jsonschema schema definition. +func ValidateSchema(schemaBytes []byte) error { + _, err := gojsonschema.NewSchemaLoader().Compile(gojsonschema.NewBytesLoader(schemaBytes)) + return err +} + +// ValidateSchemaWithLoader validates a jsonschema schema definition by using the given loader. +func ValidateSchemaWithLoader(loader gojsonschema.JSONLoader) error { + _, err := gojsonschema.NewSchemaLoader().Compile(loader) + return err +} + +func ValidateGoStruct(schemaBytes []byte, data interface{}, context *ReferenceContext) error { + return validate(schemaBytes, gojsonschema.NewGoLoader(data), context) +} + +func ValidateBytes(schemaBytes []byte, data []byte, context *ReferenceContext) error { + return validate(schemaBytes, gojsonschema.NewBytesLoader(data), context) +} + +func validate(schemaBytes []byte, documentLoader gojsonschema.JSONLoader, context *ReferenceContext) error { + v := NewValidator(context) + err := v.CompileSchema(schemaBytes) + if err != nil { + return err + } + return v.validate(documentLoader) +} + +// CompileSchema compiles the given schema and sets it as schema for the validator +func (v *Validator) CompileSchema(schemaBytes []byte) error { + ref := NewReferenceResolver(v.Context) + resolved, err := ref.Resolve(schemaBytes) + if err != nil { + return err + } + schema, err := gojsonschema.NewSchemaLoader().Compile(gojsonschema.NewGoLoader(resolved)) + if err != nil { + return err + } + v.Schema = schema + return nil +} + +func (v *Validator) ValidateGoStruct(data interface{}) error { + return v.validate(gojsonschema.NewGoLoader(data)) +} + +func (v *Validator) ValidateBytes(data []byte) error { + return v.validate(gojsonschema.NewBytesLoader(data)) +} + +func (v *Validator) validate(documentLoader gojsonschema.JSONLoader) error { + if v.Schema == nil { + return errors.New("internal error: schema has not been compiled") + } + res, err := v.Schema.Validate(documentLoader) + if err != nil { + return err + } + + if !res.Valid() { + var allErrs field.ErrorList + for _, err := range res.Errors() { + allErrs = append(allErrs, field.Invalid(field.NewPath(err.Field()), err.Value(), err.Description())) + } + return allErrs.ToAggregate() + } + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/blueprint.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/blueprint.go new file mode 100644 index 000000000..fc4721913 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/blueprint.go @@ -0,0 +1,69 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package componentsregistry + +import ( + "context" + "fmt" + "io" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/ctf" + + "github.com/gardener/landscaper/apis/mediatype" + + "github.com/gardener/component-cli/ociclient" +) + +// BlueprintResolver is a blob resolver that can resolve +// blueprints that are defined as their independent oci artifact. +type BlueprintResolver struct { + ociClient ociclient.Client +} + +var _ ctf.TypedBlobResolver = &BlueprintResolver{} + +func (b BlueprintResolver) CanResolve(res cdv2.Resource) bool { + if res.GetType() != mediatype.BlueprintType && res.GetType() != mediatype.OldBlueprintType { + return false + } + return res.Access != nil && res.Access.GetType() == cdv2.OCIRegistryType +} + +func (b *BlueprintResolver) Info(ctx context.Context, res cdv2.Resource) (*ctf.BlobInfo, error) { + return b.resolve(ctx, res, nil) +} + +func (b *BlueprintResolver) Resolve(ctx context.Context, res cdv2.Resource, writer io.Writer) (*ctf.BlobInfo, error) { + return b.resolve(ctx, res, writer) +} + +func (b *BlueprintResolver) resolve(ctx context.Context, res cdv2.Resource, writer io.Writer) (*ctf.BlobInfo, error) { + ociArtifactAccess := &cdv2.OCIRegistryAccess{} + if err := cdv2.NewCodec(nil, nil, nil).Decode(res.Access.Raw, ociArtifactAccess); err != nil { + return nil, fmt.Errorf("unable to decode access to type '%s': %w", res.Access.GetType(), err) + } + + manifest, err := b.ociClient.GetManifest(ctx, ociArtifactAccess.ImageReference) + if err != nil { + return nil, fmt.Errorf("unable to fetch manifest for oci artifact %s: %w", ociArtifactAccess.ImageReference, err) + } + if len(manifest.Layers) != 1 { + return nil, fmt.Errorf("expected blueprint oci artifacts to habe exactly o1 layer but got %d", len(manifest.Layers)) + } + blueprintLayer := manifest.Layers[0] + + if writer != nil { + if err := b.ociClient.Fetch(ctx, ociArtifactAccess.ImageReference, blueprintLayer, writer); err != nil { + return nil, err + } + } + + return &ctf.BlobInfo{ + MediaType: blueprintLayer.MediaType, + Digest: blueprintLayer.Digest.String(), + Size: blueprintLayer.Size, + }, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils/uri.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils/uri.go new file mode 100644 index 000000000..01480bedb --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils/uri.go @@ -0,0 +1,202 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package cdutils + +import ( + "context" + "errors" + "fmt" + "net/url" + "path" + "strings" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/ctf" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +const Scheme = "cd" + +const PathDelimiter = "/" + +// path keywords +const ( + ComponentReferences = "componentReferences" + Resources = "resources" +) + +// MaxURICharLength is teh maximum length that is supported for a uri. +const MaxURICharLength = 2083 + +type Path struct { + Keyword string + Value string +} + +// URI defines a component descriptor resource selector URI +type URI struct { + Raw string + Path []Path + Fragment string +} + +// ParseURI parses a component descriptor access uri of the format: +// cd://////... +func ParseURI(cdURI string) (*URI, error) { + if len(cdURI) > MaxURICharLength { + return nil, fmt.Errorf("too long uri, got %d but expected max %d", len(cdURI), MaxURICharLength) + } + u, err := url.Parse(cdURI) + if err != nil { + return nil, err + } + uriPath := path.Join(u.Host, u.Path) + + if u.Scheme != Scheme { + return nil, fmt.Errorf("scheme must be %s but given %s", Scheme, u.Scheme) + } + + // parse key value pairs from path + splitPath := strings.Split(uriPath, PathDelimiter) + if len(splitPath) == 0 { + return nil, errors.New("a path must be defined") + } + if len(splitPath)%2 != 0 { + return nil, errors.New("even number of path arguments expected") + } + + cdPath := make([]Path, len(splitPath)/2) + for i := 0; i < len(splitPath)/2; i++ { + cdPath[i] = Path{ + Keyword: splitPath[i*2], + Value: splitPath[i*2+1], + } + } + + return &URI{ + Raw: cdURI, + Path: cdPath, + Fragment: u.Fragment, + }, nil +} + +// Get resolves to a resource or component descriptor specified by the URI. +// It also returns the resource kind. +func (u *URI) Get(cd *cdv2.ComponentDescriptor, compResolver ctf.ComponentResolver, repositoryContext *cdv2.UnstructuredTypedObject) (lsv1alpha1.ComponentDescriptorKind, interface{}, error) { + var ( + ctx = context.Background() + component = cd + ) + defer ctx.Done() + for i, elem := range u.Path { + isLast := len(u.Path) == i+1 + switch elem.Keyword { + case ComponentReferences: + refs, err := cd.GetComponentReferencesByName(elem.Value) + if err != nil || len(refs) == 0 { + return "", nil, fmt.Errorf("component %s cannot be found", elem.Value) + } + + ref := refs[0] + component, err = compResolver.Resolve(ctx, repositoryContext, ref.ComponentName, ref.Version) + if err != nil { + return "", nil, fmt.Errorf("component %s cannot be found", elem.Value) + } + if isLast { + return lsv1alpha1.ComponentResourceKind, component, nil + } + case Resources: + res, err := component.GetResourcesByName(elem.Value) + if err != nil { + return "", nil, fmt.Errorf("local resource %s cannot be found", elem.Value) + } + if !isLast { + return "", nil, fmt.Errorf("the selector seems to contain more path segements after a external resource") + } + return lsv1alpha1.ResourceKind, res[0], nil + default: + return "", nil, fmt.Errorf("unknown keyword %s", elem.Keyword) + } + } + return lsv1alpha1.ComponentResourceKind, component, nil +} + +// GetComponent resolves to the component descriptor specified by the URI. +// If a resource is specified, the component descriptor of the resource is returned. +func (u *URI) GetComponent(cd *cdv2.ComponentDescriptor, compResolver ctf.ComponentResolver, repositoryContext *cdv2.UnstructuredTypedObject) (*cdv2.ComponentDescriptor, error) { + var ( + ctx = context.Background() + component = cd + ) + defer ctx.Done() + for i, elem := range u.Path { + isLast := len(u.Path) == i+1 + switch elem.Keyword { + case ComponentReferences: + refs, err := cd.GetComponentReferencesByName(elem.Value) + if err != nil || len(refs) == 0 { + return nil, fmt.Errorf("component %s cannot be found", elem.Value) + } + ref := refs[0] + component, err = compResolver.Resolve(ctx, repositoryContext, ref.ComponentName, ref.Version) + if err != nil { + return nil, fmt.Errorf("component %s cannot be found", elem.Value) + } + if isLast { + return component, nil + } + case Resources: + if !isLast { + return nil, fmt.Errorf("the selector seems to contain more path segements after a resource") + } + return component, nil + default: + return nil, fmt.Errorf("unknown keyword %s", elem.Keyword) + } + } + return component, nil +} + +// GetResource resolves to a resource specified by the URI. +// It also returns the resource kind. +func (u *URI) GetResource(cd *cdv2.ComponentDescriptor, compResolver ctf.ComponentResolver, repositoryContext *cdv2.UnstructuredTypedObject) (*cdv2.ComponentDescriptor, cdv2.Resource, error) { + var ( + ctx = context.Background() + component = cd + ) + defer ctx.Done() + for i, elem := range u.Path { + isLast := len(u.Path) == i+1 + switch elem.Keyword { + case ComponentReferences: + refs, err := cd.GetComponentReferencesByName(elem.Value) + if err != nil || len(refs) == 0 { + return nil, cdv2.Resource{}, fmt.Errorf("component %s cannot be found", elem.Value) + } + + ref := refs[0] + component, err = compResolver.Resolve(ctx, repositoryContext, ref.ComponentName, ref.Version) + if err != nil { + return nil, cdv2.Resource{}, fmt.Errorf("component %s cannot be found", elem.Value) + } + if isLast { + return nil, cdv2.Resource{}, fmt.Errorf("the selector seems to target a component desscriptor but a resource is requested") + } + case Resources: + res, err := component.GetResourcesByName(elem.Value) + if err != nil { + return nil, cdv2.Resource{}, fmt.Errorf("local resource %s cannot be found", elem.Value) + } + if !isLast { + return nil, cdv2.Resource{}, fmt.Errorf("the selector seems to contain more path segements after a external resource") + } + return component, res[0], nil + default: + return nil, cdv2.Resource{}, fmt.Errorf("unknown keyword %s", elem.Keyword) + } + } + return nil, cdv2.Resource{}, fmt.Errorf("unable to find resource %q", u.Raw) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils/utils.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils/utils.go new file mode 100644 index 000000000..08a664d50 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/cdutils/utils.go @@ -0,0 +1,84 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package cdutils + +import ( + "context" + "errors" + "fmt" + "io" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/ctf" +) + +// BlobResolverFunc describes a helper blob resolver that implements the ctf.BlobResolver interface. +type BlobResolverFunc struct { + info func(ctx context.Context, res cdv2.Resource) (*ctf.BlobInfo, error) + resolve func(ctx context.Context, res cdv2.Resource, writer io.Writer) (*ctf.BlobInfo, error) + canResolve func(resource cdv2.Resource) bool +} + +// NewBlobResolverFunc creates a new generic blob resolver with a minimal resolve function. +func NewBlobResolverFunc(resolve func(ctx context.Context, res cdv2.Resource, writer io.Writer) (*ctf.BlobInfo, error)) *BlobResolverFunc { + return &BlobResolverFunc{ + resolve: resolve, + } +} + +func (b *BlobResolverFunc) WithInfo(f func(ctx context.Context, res cdv2.Resource) (*ctf.BlobInfo, error)) *BlobResolverFunc { + b.info = f + return b +} + +func (b *BlobResolverFunc) WithCanResolve(f func(resource cdv2.Resource) bool) *BlobResolverFunc { + b.canResolve = f + return b +} + +func (b BlobResolverFunc) CanResolve(resource cdv2.Resource) bool { + if b.canResolve == nil { + return true + } + return b.canResolve(resource) +} + +func (b BlobResolverFunc) Info(ctx context.Context, res cdv2.Resource) (*ctf.BlobInfo, error) { + if b.info == nil { + return b.resolve(ctx, res, nil) + } + return b.info(ctx, res) +} + +func (b BlobResolverFunc) Resolve(ctx context.Context, res cdv2.Resource, writer io.Writer) (*ctf.BlobInfo, error) { + return b.resolve(ctx, res, writer) +} + +var _ ctf.TypedBlobResolver = &BlobResolverFunc{} + +// ResolveToComponentDescriptorList transitively resolves all referenced components of a component descriptor and +// return a list containing all resolved component descriptors. +func ResolveToComponentDescriptorList(ctx context.Context, client ctf.ComponentResolver, cd cdv2.ComponentDescriptor, repositoryContext *cdv2.UnstructuredTypedObject) (cdv2.ComponentDescriptorList, error) { + cdList := cdv2.ComponentDescriptorList{} + cdList.Metadata = cd.Metadata + if len(cd.RepositoryContexts) == 0 { + return cdList, errors.New("component descriptor must at least contain one repository context with a base url") + } + cdList.Components = []cdv2.ComponentDescriptor{cd} + + for _, compRef := range cd.ComponentReferences { + resolvedComponent, err := client.Resolve(ctx, repositoryContext, compRef.ComponentName, compRef.Version) + if err != nil { + return cdList, fmt.Errorf("unable to resolve component descriptor for %s with version %s: %w", compRef.Name, compRef.Version, err) + } + cdList.Components = append(cdList.Components, *resolvedComponent) + resolvedComponentReferences, err := ResolveToComponentDescriptorList(ctx, client, *resolvedComponent, repositoryContext) + if err != nil { + return cdList, fmt.Errorf("unable to resolve component references for component descriptor %s with version %s: %w", compRef.Name, compRef.Version, err) + } + cdList.Components = append(cdList.Components, resolvedComponentReferences.Components...) + } + return cdList, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/doc.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/doc.go new file mode 100644 index 000000000..9838ac148 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mockgen -destination=./mock/resolver_mock.go github.com/gardener/component-spec/bindings-go/ctf ComponentResolver + +package componentsregistry diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/local.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/local.go new file mode 100644 index 000000000..884aba52e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/local.go @@ -0,0 +1,351 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package componentsregistry + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/codec" + "github.com/gardener/component-spec/bindings-go/ctf" + "github.com/go-logr/logr" + "github.com/mandelsoft/vfs/pkg/osfs" + "github.com/mandelsoft/vfs/pkg/projectionfs" + "github.com/mandelsoft/vfs/pkg/vfs" + "github.com/opencontainers/go-digest" + + "github.com/gardener/landscaper/pkg/utils/tar" +) + +// LocalRepositoryType defines the local repository context type. +const LocalRepositoryType = "local" + +// FilesystemBlobType is the access type of a blob that is located in a filesystem. +const FilesystemBlobType = "filesystemBlob" + +// LocalRepository describes a local repository +type LocalRepository struct { + cdv2.ObjectType + BaseURL string `json:"baseUrl"` +} + +// NewLocalRepository creates a new local repository +func NewLocalRepository(baseUrl string) *LocalRepository { + return &LocalRepository{ + ObjectType: cdv2.ObjectType{ + Type: LocalRepositoryType, + }, + BaseURL: baseUrl, + } +} + +// NewFilesystemBlobAccess creates a new localFilesystemBlob accessor. +func NewFilesystemBlobAccess(path string) *FilesystemBlobAccess { + return &FilesystemBlobAccess{ + ObjectType: cdv2.ObjectType{ + Type: FilesystemBlobType, + }, + Path: path, + } +} + +// FilesystemBlobAccess describes the access for a blob on the filesystem. +type FilesystemBlobAccess struct { + cdv2.ObjectType `json:",inline"` + // Path to the file on the filesystem + Path string `json:"filename"` +} + +func (a FilesystemBlobAccess) GetData() ([]byte, error) { + return json.Marshal(a) +} + +func (a *FilesystemBlobAccess) SetData(bytes []byte) error { + var newAccess FilesystemBlobAccess + if err := json.Unmarshal(bytes, &newAccess); err != nil { + return err + } + a.Path = newAccess.Path + return nil +} + +// localClient is a component descriptor repository implementation +// that resolves component references stored locally. +// A ComponentDescriptor is resolved by traversing the given paths and decode every found file as component descriptor. +// todo: build cache to not read every file with every resolve attempt. +type localClient struct { + log logr.Logger + fs vfs.FileSystem +} + +// NewLocalClient creates a new local registry from a root. +func NewLocalClient(log logr.Logger, rootPath string) (TypedRegistry, error) { + fs, err := projectionfs.New(osfs.New(), rootPath) + if err != nil { + return nil, err + } + return &localClient{ + log: log, + fs: fs, + }, nil +} + +// Type return the oci registry type that can be handled by this ociClient +func (c *localClient) Type() string { + return LocalRepositoryType +} + +// Resolve resolves a reference and returns the component descriptor. +func (c *localClient) Resolve(_ context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, error) { + if repoCtx.GetType() != LocalRepositoryType { + return nil, fmt.Errorf("unsupported type %s expected %s", repoCtx.GetType(), LocalRepositoryType) + } + + cd, _, err := c.searchInFs(name, version) + if err != nil { + return nil, err + } + return cd, nil +} + +// ResolveWithBlobResolver resolves a reference and returns the component descriptor. +func (c *localClient) ResolveWithBlobResolver(_ context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, ctf.BlobResolver, error) { + if repoCtx.GetType() != LocalRepositoryType { + return nil, nil, fmt.Errorf("unsupported type %s expected %s", repoCtx.GetType(), LocalRepositoryType) + } + + cd, localFilesystemBlobResolver, err := c.searchInFs(name, version) + if err != nil { + return nil, nil, err + } + fsBlobResolver := &FilesystemBlobResolver{ + BaseFilesystemBlobResolver: BaseFilesystemBlobResolver{fs: c.fs}, + } + aggBlobResolver, err := ctf.NewAggregatedBlobResolver(localFilesystemBlobResolver, fsBlobResolver) + return cd, aggBlobResolver, err +} + +func (c *localClient) searchInFs(name, version string) (*cdv2.ComponentDescriptor, ctf.BlobResolver, error) { + foundErr := errors.New("comp found") + var cd *cdv2.ComponentDescriptor + var resolver ctf.BlobResolver + err := vfs.Walk(c.fs, "/", func(path string, info os.FileInfo, err error) error { + // ignore errors + if err != nil { + c.log.V(3).Info(err.Error()) + return nil + } + + if info.IsDir() { + return nil + } + + if info.Name() != ctf.ComponentDescriptorFileName { + return nil + } + + data, err := vfs.ReadFile(c.fs, path) + if err != nil { + return err + } + + tmpCD := &cdv2.ComponentDescriptor{} + if err := codec.Decode(data, tmpCD); err != nil { + return fmt.Errorf("unable to decode component descriptor file %s: %w", path, err) + } + + if tmpCD.GetName() == name && tmpCD.GetVersion() == version { + cd = tmpCD + + fs, err := projectionfs.New(c.fs, filepath.Dir(path)) + if err != nil { + return err + } + resolver = NewLocalFilesystemBlobResolver(fs) + return foundErr + } + return nil + }) + if err == nil { + return nil, nil, cdv2.NotFound + } + if err != foundErr { + return nil, nil, err + } + if cd == nil { + return nil, nil, cdv2.NotFound + } + return cd, resolver, nil +} + +// FilesystemBlobResolver implements the BlobResolver interface for +// "filesystemBlob" access types. +type FilesystemBlobResolver struct { + BaseFilesystemBlobResolver +} + +func (ca *FilesystemBlobResolver) CanResolve(resource cdv2.Resource) bool { + return resource.Access != nil && resource.Access.GetType() == FilesystemBlobType +} + +func (ca *FilesystemBlobResolver) Info(ctx context.Context, res cdv2.Resource) (*ctf.BlobInfo, error) { + info, file, err := ca.resolve(ctx, res) + if err != nil { + return nil, err + } + if file != nil { + if err := file.Close(); err != nil { + return nil, err + } + } + return info, nil +} + +// Resolve fetches the blob for a given resource and writes it to the given tar. +func (ca *FilesystemBlobResolver) Resolve(ctx context.Context, res cdv2.Resource, writer io.Writer) (*ctf.BlobInfo, error) { + info, file, err := ca.resolve(ctx, res) + if err != nil { + return nil, err + } + if _, err := io.Copy(writer, file); err != nil { + return nil, err + } + if err := file.Close(); err != nil { + return nil, err + } + return info, nil +} + +func (ca *FilesystemBlobResolver) resolve(_ context.Context, res cdv2.Resource) (*ctf.BlobInfo, io.ReadCloser, error) { + if res.Access == nil || res.Access.GetType() != FilesystemBlobType { + return nil, nil, ctf.UnsupportedResolveType + } + fsAccess := &FilesystemBlobAccess{} + if err := cdv2.NewCodec(nil, nil, nil).Decode(res.Access.Raw, fsAccess); err != nil { + return nil, nil, fmt.Errorf("unable to decode access to type '%s': %w", res.Access.GetType(), err) + } + + info, file, err := ca.ResolveFromFs(fsAccess.Path) + if err != nil { + return nil, nil, err + } + info.MediaType = res.Type + return info, file, nil +} + +// LocalFilesystemBlobResolver implements the BlobResolver interface for +// "localFilesystemBlob" access types. +type LocalFilesystemBlobResolver struct { + BaseFilesystemBlobResolver +} + +// NewLocalFilesystemBlobResolver creates a new local filesystem blob resolver. +func NewLocalFilesystemBlobResolver(fs vfs.FileSystem) *LocalFilesystemBlobResolver { + return &LocalFilesystemBlobResolver{ + BaseFilesystemBlobResolver: BaseFilesystemBlobResolver{fs: fs}, + } +} + +func (ca *LocalFilesystemBlobResolver) CanResolve(resource cdv2.Resource) bool { + return resource.Access != nil && resource.Access.GetType() == cdv2.LocalFilesystemBlobType +} + +func (ca *LocalFilesystemBlobResolver) Info(_ context.Context, res cdv2.Resource) (*ctf.BlobInfo, error) { + info, file, err := ca.resolve(res) + if err != nil { + return nil, err + } + if file != nil { + if err := file.Close(); err != nil { + return nil, err + } + } + return info, nil +} + +// Resolve fetches the blob for a given resource and writes it to the given tar. +func (ca *LocalFilesystemBlobResolver) Resolve(_ context.Context, res cdv2.Resource, writer io.Writer) (*ctf.BlobInfo, error) { + info, file, err := ca.resolve(res) + if err != nil { + return nil, err + } + if _, err := io.Copy(writer, file); err != nil { + return nil, err + } + if err := file.Close(); err != nil { + return nil, err + } + return info, nil +} + +func (ca *LocalFilesystemBlobResolver) resolve(res cdv2.Resource) (*ctf.BlobInfo, io.ReadCloser, error) { + if res.Access == nil || res.Access.GetType() != cdv2.LocalFilesystemBlobType { + return nil, nil, ctf.UnsupportedResolveType + } + localFSAccess := &cdv2.LocalFilesystemBlobAccess{} + if err := cdv2.NewCodec(nil, nil, nil).Decode(res.Access.Raw, localFSAccess); err != nil { + return nil, nil, fmt.Errorf("unable to decode access to type '%s': %w", res.Access.GetType(), err) + } + blobpath := ctf.BlobPath(localFSAccess.Filename) + + info, file, err := ca.ResolveFromFs(blobpath) + if err != nil { + return nil, nil, err + } + info.MediaType = res.Type + if len(localFSAccess.MediaType) != 0 { + info.MediaType = localFSAccess.MediaType + } + return info, file, nil +} + +// BaseFilesystemBlobResolver implements a common method for filesystem. +type BaseFilesystemBlobResolver struct { + fs vfs.FileSystem +} + +// ResolveFromFs resolves a blob from a given path. +func (res *BaseFilesystemBlobResolver) ResolveFromFs(blobpath string) (*ctf.BlobInfo, io.ReadCloser, error) { + info, err := res.fs.Stat(blobpath) + if err != nil { + return nil, nil, fmt.Errorf("unable to get fileinfo for %s: %w", blobpath, err) + } + if info.IsDir() { + var data bytes.Buffer + if err := tar.BuildTarGzip(res.fs, blobpath, &data); err != nil { + return nil, nil, fmt.Errorf("unable to build tar gz: %w", err) + } + return &ctf.BlobInfo{ + MediaType: "", + Digest: digest.FromBytes(data.Bytes()).String(), + Size: int64(data.Len()), + }, ioutil.NopCloser(&data), nil + } + file, err := res.fs.Open(blobpath) + if err != nil { + return nil, nil, fmt.Errorf("unable to open blob from %s", blobpath) + } + + dig, err := digest.FromReader(file) + if err != nil { + return nil, nil, fmt.Errorf("unable to generate dig from %s: %w", blobpath, err) + } + if _, err := file.Seek(0, io.SeekStart); err != nil { + return nil, nil, fmt.Errorf("unable to reset file reader: %w", err) + } + return &ctf.BlobInfo{ + MediaType: "", + Digest: dig.String(), + Size: info.Size(), + }, file, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/manager.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/manager.go new file mode 100644 index 000000000..77e968e66 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/manager.go @@ -0,0 +1,90 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package componentsregistry + +import ( + "context" + "fmt" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/ctf" + "github.com/go-logr/logr" + + "github.com/gardener/component-cli/ociclient/cache" + + "github.com/gardener/landscaper/apis/config" + "github.com/gardener/landscaper/pkg/utils" +) + +// TypedRegistry describes a registry that can handle the given type. +type TypedRegistry interface { + ctf.ComponentResolver + Type() string +} + +type Manager struct { + registries map[string]ctf.ComponentResolver + sharedCache cache.Cache +} + +var _ ctf.ComponentResolver = &Manager{} + +// New creates a ociClient that can handle multiple clients. +// The manager can handle a shared cache that is injected into the registries. +func New(sharedCache cache.Cache, clients ...TypedRegistry) (*Manager, error) { + m := &Manager{ + sharedCache: sharedCache, + } + if err := m.Set(clients...); err != nil { + return nil, err + } + return m, nil +} + +// Set adds registries to the manager. +func (m *Manager) Set(registries ...TypedRegistry) error { + if m.registries == nil { + m.registries = map[string]ctf.ComponentResolver{} + } + for _, registry := range registries { + m.registries[registry.Type()] = registry + } + return nil +} + +// SharedCache returns the shared cache for all managed registries. +// Returns nil if there is no shared cache. +func (m *Manager) SharedCache() cache.Cache { + return m.sharedCache +} + +func (m *Manager) Resolve(ctx context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, error) { + client, ok := m.registries[repoCtx.GetType()] + if !ok { + return nil, fmt.Errorf("unknown repository type %s", repoCtx.GetType()) + } + return client.Resolve(ctx, repoCtx, name, version) +} + +func (m *Manager) ResolveWithBlobResolver(ctx context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, ctf.BlobResolver, error) { + client, ok := m.registries[repoCtx.GetType()] + if !ok { + return nil, nil, fmt.Errorf("unknown repository type %s", repoCtx.GetType()) + } + return client.ResolveWithBlobResolver(ctx, repoCtx, name, version) +} + +// SetupManagerFromConfig returns a new Manager instance initialized with the given OCI configuration +func SetupManagerFromConfig(log logr.Logger, config *config.OCIConfiguration, cacheIdentifier string) (*Manager, error) { + var sharedCache cache.Cache + if config != nil && config.Cache != nil { + var err error + sharedCache, err = cache.NewCache(log, utils.ToOCICacheOptions(config.Cache, cacheIdentifier)...) + if err != nil { + return nil, err + } + } + return New(sharedCache) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/oci.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/oci.go new file mode 100644 index 000000000..cc315c678 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/landscaper/registry/components/oci.go @@ -0,0 +1,146 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package componentsregistry + +import ( + "context" + "fmt" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/codec" + "github.com/gardener/component-spec/bindings-go/ctf" + cdoci "github.com/gardener/component-spec/bindings-go/oci" + "github.com/go-logr/logr" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "github.com/gardener/landscaper/pkg/utils" + + "github.com/gardener/landscaper/apis/config" + + "github.com/gardener/component-cli/ociclient" + "github.com/gardener/component-cli/ociclient/cache" +) + +// NewOCIRegistry creates a new oci registry from a oci config. +func NewOCIRegistry(log logr.Logger, config *config.OCIConfiguration, cache cache.Cache, predefinedComponentDescriptors ...*cdv2.ComponentDescriptor) (TypedRegistry, error) { + client, err := ociclient.NewClient(log, utils.WithConfiguration(config), ociclient.WithCache(cache)) + if err != nil { + return nil, err + } + + return NewOCIRegistryWithOCIClient(log, client, predefinedComponentDescriptors...) +} + +// NewOCIRegistryWithOCIClient creates a new oci registry with a oci ociClient +// If supplied, it parses and stores predefined component descriptors. +func NewOCIRegistryWithOCIClient(log logr.Logger, client ociclient.Client, predefinedComponentDescriptors ...*cdv2.ComponentDescriptor) (TypedRegistry, error) { + cache, err := newPredefinedComponentCache(predefinedComponentDescriptors...) + if err != nil { + return nil, err + } + res := cdoci.NewResolver(client).WithCache(cache).WithLog(log) + return &ociClient{ + cache: cache, + ociClient: client, + Resolver: *res, + }, nil +} + +// ociClient wraps the central oci resolver and adds the supported resolve types. +type ociClient struct { + cache *predefinedComponentCache + ociClient ociclient.Client + cdoci.Resolver +} + +// Type return the oci registry type that can be handled by this ociClient +func (r *ociClient) Type() string { + return cdv2.OCIRegistryType +} + +// predefinedComponentCache describes the cache for predefined components. +type predefinedComponentCache struct { + components []*cdv2.ComponentDescriptor +} + +var _ cdoci.Cache = &predefinedComponentCache{} + +func newPredefinedComponentCache(predefinedComponentDescriptors ...*cdv2.ComponentDescriptor) (*predefinedComponentCache, error) { + pcc := &predefinedComponentCache{ + components: make([]*cdv2.ComponentDescriptor, 0), + } + for _, cd := range predefinedComponentDescriptors { + if cd == nil { + continue + } + pcc.components = append(pcc.components, cd) + + var extractCdFromLabel func(*[]*cdv2.ComponentDescriptor, *cdv2.ComponentDescriptor) error + extractCdFromLabel = func(cdList *[]*cdv2.ComponentDescriptor, cd1 *cdv2.ComponentDescriptor) error { + for _, cdRef := range cd1.ComponentReferences { + if label, exists := cdRef.Labels.Get(lsv1alpha1.InlineComponentDescriptorLabel); exists { + var cdFromLabel cdv2.ComponentDescriptor + if err := codec.Decode(label, &cdFromLabel); err != nil { + return err + } + *cdList = append(*cdList, &cdFromLabel) + err := extractCdFromLabel(cdList, &cdFromLabel) + return err + } + } + return nil + } + err := extractCdFromLabel(&pcc.components, cd) + if err != nil { + return nil, err + } + } + return pcc, nil +} + +func (p predefinedComponentCache) Get(_ context.Context, repoCtx cdv2.OCIRegistryRepository, name, version string) (*cdv2.ComponentDescriptor, error) { + for _, cd := range p.components { + if cdv2.TypedObjectEqual(&repoCtx, cd.GetEffectiveRepositoryContext()) && name == cd.Name && version == cd.Version { + return cd.DeepCopy(), nil + } + } + return nil, ctf.NotFoundError +} + +func (p predefinedComponentCache) Store(_ context.Context, _ *cdv2.ComponentDescriptor) error { + // noop as we currently do not cache anything + return nil +} + +// resolveFromPredefined returns the respective component descriptor, if it exists within the cache +func (r *ociClient) resolveFromPredefined(repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, ctf.BlobResolver) { + for _, cd := range r.cache.components { + if repoCtx == cd.GetEffectiveRepositoryContext() && name == cd.Name && version == cd.Version { + //TODO: add a resolver for local blobs + return cd, &BlueprintResolver{ociClient: r.ociClient} + } + } + return nil, nil +} + +// ResolveWithBlobResolver wraps the component-spec component resolver by mocking the blobresolver for cached component descriptors. +// It also injects a blueprint oci artifact specific resolver. +func (r *ociClient) ResolveWithBlobResolver(ctx context.Context, repoCtx cdv2.Repository, name, version string) (*cdv2.ComponentDescriptor, ctf.BlobResolver, error) { + //return cached component descriptor, if available + if cd, blobResolver := r.resolveFromPredefined(repoCtx, name, version); cd != nil { + return cd, blobResolver, nil + } + // resolve remote component descriptor + cd, blobResolver, err := r.Resolver.ResolveWithBlobResolver(ctx, repoCtx, name, version) + if err != nil { + return nil, nil, err + } + // automatically add blueprint resolver + aggBlobResolver, err := ctf.AggregateBlobResolvers(blobResolver, &BlueprintResolver{ociClient: r.ociClient}) + if err != nil { + return nil, nil, fmt.Errorf("unable to add blueprint resolver") + } + return cd, aggBlobResolver, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/builders.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/builders.go new file mode 100644 index 000000000..8c4a40f25 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/builders.go @@ -0,0 +1,244 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "encoding/json" + "errors" + "fmt" + + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + kutil "github.com/gardener/landscaper/controller-utils/pkg/kubernetes" + "github.com/gardener/landscaper/pkg/api" +) + +// DeployItemBuilder is a helper struct to build deploy items +type DeployItemBuilder struct { + scheme *runtime.Scheme + ObjectKey *lsv1alpha1.ObjectReference + Type string + ProviderConfiguration runtime.Object + target *lsv1alpha1.ObjectReference + annotations map[string]string + Context string +} + +// NewDeployItemBuilder creates a new deploy item builder +func NewDeployItemBuilder(tType string) *DeployItemBuilder { + return &DeployItemBuilder{ + Type: tType, + } +} + +// DeepCopy creates a deep copy of the builder and its options. +// Note that the scheme is not deep copied. +func (b *DeployItemBuilder) DeepCopy() *DeployItemBuilder { + newBldr := NewDeployItemBuilder(b.Type). + Scheme(b.scheme) + if b.ProviderConfiguration != nil { + newBldr.ProviderConfig(b.ProviderConfiguration.DeepCopyObject()) + } + if b.target != nil { + newBldr.TargetFromObjectRef(b.target.DeepCopy()) + } + if b.ObjectKey != nil { + newBldr.Key(b.ObjectKey.Namespace, b.ObjectKey.Name) + } + if b.annotations != nil { + for key, val := range b.annotations { + newBldr.AddAnnotation(key, val) + } + } + return newBldr +} + +// Scheme sets the deployitem scheme that is used for the provider config +func (b *DeployItemBuilder) Scheme(scheme *runtime.Scheme) *DeployItemBuilder { + b.scheme = scheme + return b +} + +// ProviderConfig sets the deployitem provider configuration. +func (b *DeployItemBuilder) ProviderConfig(obj runtime.Object) *DeployItemBuilder { + b.ProviderConfiguration = obj + return b +} + +// TargetFromObjectRef sets the deployitem's target. +func (b *DeployItemBuilder) TargetFromObjectRef(tgt *lsv1alpha1.ObjectReference) *DeployItemBuilder { + b.target = tgt + return b +} + +// TargetFromObjectKey sets the deployitem's target from a client key. +func (b *DeployItemBuilder) TargetFromObjectKey(tgt client.ObjectKey) *DeployItemBuilder { + b.target = &lsv1alpha1.ObjectReference{ + Name: tgt.Name, + Namespace: tgt.Namespace, + } + return b +} + +// Target sets the deployitem's target from a name and namespace +func (b *DeployItemBuilder) Target(namespace, name string) *DeployItemBuilder { + b.target = &lsv1alpha1.ObjectReference{ + Name: name, + Namespace: namespace, + } + return b +} + +// Key sets the deployitem's namespace and name. +func (b *DeployItemBuilder) Key(namespace, name string) *DeployItemBuilder { + b.ObjectKey = &lsv1alpha1.ObjectReference{ + Name: name, + Namespace: namespace, + } + return b +} + +// AddAnnotation sets a annotation for the deployitem +func (b *DeployItemBuilder) AddAnnotation(key, val string) *DeployItemBuilder { + if b.annotations == nil { + b.annotations = map[string]string{} + } + b.annotations[key] = val + return b +} + +// WithContext sets the Landscaper Context to use for the deployitem. +// If not set explicitly, the default context will be used. +func (b *DeployItemBuilder) WithContext(name string) *DeployItemBuilder { + b.Context = name + return b +} + +// Build creates the deploy items using the given options. +func (b *DeployItemBuilder) Build() (*lsv1alpha1.DeployItem, error) { + b.applyDefaults() + if err := b.Validate(); err != nil { + return nil, err + } + + ext, err := kutil.ConvertToRawExtension(b.ProviderConfiguration, b.scheme) + if err != nil { + return nil, err + } + + di := &lsv1alpha1.DeployItem{} + di.Spec.Type = lsv1alpha1.DeployItemType(b.Type) + di.Spec.Target = b.target + di.Spec.Configuration = ext + di.Spec.Context = b.Context + + if b.ObjectKey != nil { + di.Namespace = b.ObjectKey.Namespace + di.Name = b.ObjectKey.Name + } + if b.annotations != nil { + di.SetAnnotations(b.annotations) + } + + if len(di.Spec.Context) == 0 { + di.Spec.Context = lsv1alpha1.DefaultContextName + } + + return di, nil +} + +func (b *DeployItemBuilder) applyDefaults() { + if b.scheme == nil { + b.scheme = api.Scheme + } +} + +func (b *DeployItemBuilder) Validate() error { + if len(b.Type) == 0 { + return errors.New("a type has to be defined") + } + if b.ProviderConfiguration == nil { + return errors.New("a provider configuration has to be defined") + } + return nil +} + +// TargetBuilder is a helper struct to build targets +type TargetBuilder struct { + Type string + ObjectKey *lsv1alpha1.ObjectReference + Configuration interface{} + annotations map[string]string +} + +// NewTargetBuilder creates a new target builder +func NewTargetBuilder(tType string) *TargetBuilder { + return &TargetBuilder{ + Type: tType, + } +} + +// DeepCopy creates a deep copy of the builder and its options. +// Note that the scheme is not deep copied. +func (b *TargetBuilder) DeepCopy() *TargetBuilder { + newBldr := NewTargetBuilder(b.Type). + Config(b.Configuration) + + if b.ObjectKey != nil { + newBldr.Key(b.ObjectKey.Namespace, b.ObjectKey.Name) + } + if b.annotations != nil { + for key, val := range b.annotations { + newBldr.AddAnnotation(key, val) + } + } + return newBldr +} + +// Key sets the deployitem's namespace and name. +func (b *TargetBuilder) Key(namespace, name string) *TargetBuilder { + b.ObjectKey = &lsv1alpha1.ObjectReference{ + Name: name, + Namespace: namespace, + } + return b +} + +// AddAnnotation sets a annotation for the deployitem +func (b *TargetBuilder) AddAnnotation(key, val string) *TargetBuilder { + if b.annotations == nil { + b.annotations = map[string]string{} + } + b.annotations[key] = val + return b +} + +// Config sets the target config that is used for the provider config +func (b *TargetBuilder) Config(obj interface{}) *TargetBuilder { + b.Configuration = obj + return b +} + +// Build creates the target using the given options. +func (b *TargetBuilder) Build() (*lsv1alpha1.Target, error) { + configBytes, err := json.Marshal(b.Configuration) + if err != nil { + return nil, fmt.Errorf("unable to decode target config: %w", err) + } + + target := &lsv1alpha1.Target{} + target.Spec.Type = lsv1alpha1.TargetType(b.Type) + target.Spec.Configuration = lsv1alpha1.NewAnyJSON(configBytes) + if b.ObjectKey != nil { + target.Namespace = b.ObjectKey.Namespace + target.Name = b.ObjectKey.Name + } + if b.annotations != nil { + target.SetAnnotations(b.annotations) + } + return target, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/context_aware_writer.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/context_aware_writer.go new file mode 100644 index 000000000..444d806b4 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/context_aware_writer.go @@ -0,0 +1,36 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "context" + "io" +) + +// ContextAwareWriter wraps a context and an io writer. +// When the context is cancelled, the write function will return early before calling write on the io writer. +type ContextAwareWriter struct { + // ctx is the wrapping context + ctx context.Context + // writer is the underlying io writer + writer io.Writer +} + +// Write will check the wrapping context for errors. +// If the context doesn't return any error, the underlying io writer is called. +func (w *ContextAwareWriter) Write(p []byte) (n int, err error) { + if err := w.ctx.Err(); err != nil { + return 0, err + } + return w.writer.Write(p) +} + +// NewContextAwareWriter creates a new context aware writer. +func NewContextAwareWriter(ctx context.Context, writer io.Writer) io.Writer { + return &ContextAwareWriter{ + ctx: ctx, + writer: writer, + } +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/controllerconfig.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/controllerconfig.go new file mode 100644 index 000000000..17ee1a752 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/controllerconfig.go @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "sigs.k8s.io/controller-runtime/pkg/controller" + + "github.com/gardener/landscaper/apis/config" +) + +// ConvertCommonControllerConfigToControllerOptions converts the landscaper CommonControllerConfig to controller.Options. +func ConvertCommonControllerConfigToControllerOptions(cfg config.CommonControllerConfig) controller.Options { + opts := controller.Options{ + MaxConcurrentReconciles: cfg.Workers, + } + if cfg.CacheSyncTimeout != nil { + opts.CacheSyncTimeout = cfg.CacheSyncTimeout.Duration + } + return opts +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/cyclicdependencies.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/cyclicdependencies.go new file mode 100644 index 000000000..9c39c8d2c --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/cyclicdependencies.go @@ -0,0 +1,357 @@ +// SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "strings" + + "k8s.io/apimachinery/pkg/util/sets" +) + +type DependencyCycle struct { + origin *dependencyCycleElement + last *dependencyCycleElement + size int +} + +type dependencyCycleElement struct { + name string // name of the importing entity + importNames sets.String // names of the imports which cause the dependency + dependsOn *dependencyCycleElement // where the import comes from +} + +// copy copies the given element. The dependsOn pointer is set to nil and not copied. +func (dce *dependencyCycleElement) copy() *dependencyCycleElement { + res := &dependencyCycleElement{ + name: dce.name, + } + res.importNames = copyStringSet(dce.importNames) + return res +} + +// NewDependencyCycle starts a new dependency cycle. It must be initialized with one element. +// Internally, it works like a linked list, except that it is expected to form a cycle at some point. +func NewDependencyCycle(templateName string) *DependencyCycle { + dc := &DependencyCycle{ + origin: &dependencyCycleElement{ + name: templateName, + }, + } + dc.last = dc.origin + return dc +} + +// Add adds a new dependency to the cycle. It returns a bool indicating whether the cycle is closed: +// it is true if the given name matches the name of the origin element of the cycle. +// No-op if the cycle is already closed. +func (dc *DependencyCycle) Add(templateName string, importNames sets.String) bool { + if dc.IsClosed() { + // cycle is already closed, can't add to it + return true + } + + dc.last.importNames = importNames + if templateName == dc.origin.name { + dc.last.dependsOn = dc.origin + return true + } + dc.last.dependsOn = &dependencyCycleElement{ + name: templateName, + } + dc.last = dc.last.dependsOn + dc.size++ + return false +} + +// Copy copies the dependency cycle. +func (dc *DependencyCycle) Copy() *DependencyCycle { + res := &DependencyCycle{} + res.origin = dc.origin.copy() + res.size = dc.size + originCurrent := dc.origin.dependsOn + newLast := res.origin + for originCurrent != nil { + newLast.dependsOn = originCurrent.copy() + originCurrent = originCurrent.dependsOn + newLast = newLast.dependsOn + if originCurrent == dc.origin { + // end of closed cycle reached + break + } + } + if originCurrent == nil { + // only set last if the cycle is not closed + res.last = newLast + } + return res +} + +// IsClosed returns whether the cycle is closed. +func (dc *DependencyCycle) IsClosed() bool { + return dc.last == nil +} + +// Size returns the number of elements in this cycle. +// Note that closing the cycle - by adding its origin element to it - does not increase the size. +func (dc *DependencyCycle) Size() int { + return dc.size +} + +// List returns the names of all templates which are part of this cycle. +func (dc *DependencyCycle) List() []string { + current := dc.origin + res := make([]string, 0, dc.size) + for current != nil { + res = append(res, current.name) + current = current.dependsOn + if current == dc.origin { + break + } + } + return res +} + +// Has returns true if the given name is part of the cycle. +func (dc *DependencyCycle) Has(name string) bool { + current := dc.origin + for current != nil { + if current.name == name { + return true + } + current = current.dependsOn + if current == dc.origin { + break + } + } + return false +} + +// Last returns the name of the last element of the cycle. +// If the cycle is closed, it returns an empty string. +func (dc *DependencyCycle) Last() string { + if dc.last != nil { + return dc.last.name + } + return "" +} + +// Origin returns the name of the origin element of the cycle. +func (dc *DependencyCycle) Origin() string { + return dc.origin.name +} + +// Close adds an element which has the same name as the origin, closing the cycle. +// Returns the cycle for chaining +func (dc *DependencyCycle) Close(importNames sets.String) *DependencyCycle { + if !dc.IsClosed() { + dc.Add(dc.origin.name, importNames) + } + return dc +} + +type RelationshipTuple struct { + Exporting string + Importing string +} + +// ImportRelationships maps tuples of entities to the set of im-/exports which connect them +type ImportRelationships map[RelationshipTuple]sets.String + +func (ir ImportRelationships) Get(exporting, importing string) (sets.String, bool) { + tmp := RelationshipTuple{ + Exporting: exporting, + Importing: importing, + } + imps, ok := ir[tmp] + return imps, ok +} + +func (ir ImportRelationships) Add(exporting, importing, imp string) ImportRelationships { + tmp := RelationshipTuple{ + Exporting: exporting, + Importing: importing, + } + if _, ok := ir[tmp]; !ok { + ir[tmp] = sets.NewString() + } + ir[tmp].Insert(imp) + return ir +} + +// Equal returns true if both objects describe the same cycle +// meaning the same template names in the same order. +// Cycles which are not closed are only equal if they have the same origin, +// for closed cycles, this doesn't matter. +// If only one of the cycles is closed, they are considered to be not equal. +// The actual cycle must not be nil, if the given cycle is nil, they are considered to be not equal. +func (dc *DependencyCycle) Equal(other *DependencyCycle) bool { + if other == nil { + // we assume that dc is not nil + return false + } + otherOrigin := other.origin + if dc.IsClosed() { + if !other.IsClosed() { + return false + } + if dc.origin.name != otherOrigin.name { + // find matching element, if any, in case of different origins + for tmp := otherOrigin.dependsOn; tmp != otherOrigin; tmp = tmp.dependsOn { + if tmp.name == dc.origin.name { + // found matching element + otherOrigin = tmp + break + } + } + } + } else { + if other.IsClosed() { + return false + } + } + if dc.origin.name != otherOrigin.name { + // no matching origin found, cycles cannot be equal + return false + } + for thisCurrent, otherCurrent := dc.origin.dependsOn, otherOrigin.dependsOn; thisCurrent != dc.origin && otherCurrent != otherOrigin; thisCurrent, otherCurrent = thisCurrent.dependsOn, otherCurrent.dependsOn { + if thisCurrent.name != otherCurrent.name { + return false + } + if thisCurrent.importNames != nil { + if !thisCurrent.importNames.Equal(otherCurrent.importNames) { + return false + } + } else { + if otherCurrent.importNames != nil { + return false + } + } + } + return true +} + +func (dc *DependencyCycle) String() string { + return dc.StringWithSeparator(" -> ", " -", "-> ", "[", ", ", "]") +} + +func (dc *DependencyCycle) StringWithSeparator(sep, sepBeforeImports, sepAfterImports, importStart, importSep, importEnd string) string { + var sb strings.Builder + current := dc.origin + for current != nil { + sb.WriteString(current.name) + if current.dependsOn != nil { + if current.importNames != nil { + sb.WriteString(sepBeforeImports) + sb.WriteString(importStart) + sb.WriteString(strings.Join(current.importNames.List(), importSep)) + sb.WriteString(importEnd) + sb.WriteString(sepAfterImports) + } else { + sb.WriteString(sep) + } + } + current = current.dependsOn + if current == dc.origin { + sb.WriteString(current.name) + break + } + } + return sb.String() +} + +// DetermineCyclicDependencyDetails takes a list of installation templates which all depend on each other in a cyclic manner +// and a mapping from template names to the names of the templates they depend on. +// Optionally, the import relationships (which two elements are connected by which imports) can be given. +// It returns a list of found cycles. +func DetermineCyclicDependencyDetails(elements sets.String, dependencies map[string]sets.String, impRel ImportRelationships) []*DependencyCycle { + res := []*DependencyCycle{} + elemList := elements.List() + + // All cycles which contain elem will be found with a call to determineCycles(nil, elem, ...) + // To also find all cycles which don't contain elem, we remove elem from the set of elements and then repeat the process + for i := 0; i < len(elemList); i++ { + res = append(res, determineCycles(nil, elemList[i], sets.NewString().Insert(elemList[i+1:]...), dependencies, impRel)...) + } + + return res +} + +// determineCycles tries to add another element to the given cycle. +// The arguments are: +// - cycle: the current cycle. May be nil, then a new one will be created. +// - current: the current element. +// - elements: the set of potential elements. It is expected to contain only elements which are not already part of the cycle. +// - dependencies: a mapping from elements to all elements they depend on +// - impRel: optional mapping from im-/export relationships to the im-/exports causing the relationship +func determineCycles(cycle *DependencyCycle, current string, elements sets.String, dependencies map[string]sets.String, impRel ImportRelationships) []*DependencyCycle { + res := []*DependencyCycle{} + if len(current) == 0 { + return res + } + if cycle == nil { + cycle = NewDependencyCycle(current) + } else { + // fetch connecting imports, if given + var imps sets.String + if impRel != nil { + imps, _ = impRel.Get(current, cycle.Last()) + } + + // add current element to cycle + if cycle.Add(current, imps) { + // cycle is closed + // this case should not occur, since it would be catched before by the check below + res = append(res, cycle) + return res + } + } + + // check if we can close the cycle + if dependencies[current].Has(cycle.Origin()) { + // the current element, which was just added to the cycle, depends on the origin of the cycle + // => add the origin again to close the cycle and add it to the result + var imps sets.String + if impRel != nil { + imps, _ = impRel.Get(cycle.Origin(), current) + } + res = append(res, cycle.Copy().Close(imps)) + } + + for elem := range elements { + if dependencies[current].Has(elem) { + // we want to ignore all elements which are already part of the cycle + // so let's build a new element list and remove the element we just added to the cycle + newElements := copyStringSetWithoutElement(elements, current) + // recursion + // copy cycle to not alter the original + res = append(res, determineCycles(cycle.Copy(), elem, newElements, dependencies, impRel)...) + } + } + return res +} + +func copyStringSet(set sets.String) sets.String { + if set == nil { + return nil + } + res := sets.NewString() + for elem := range set { + res.Insert(elem) + } + return res +} +func copyStringSetWithoutElement(set sets.String, element string) sets.String { + if set == nil { + return nil + } + res := sets.NewString() + for elem := range set { + if elem == element { + continue + } + res.Insert(elem) + } + return res +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/miscellaneous.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/miscellaneous.go new file mode 100644 index 000000000..a2985933c --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/miscellaneous.go @@ -0,0 +1,137 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "encoding/json" + "io" + "io/fs" + "os" + "path/filepath" + + "github.com/mandelsoft/vfs/pkg/vfs" + "sigs.k8s.io/yaml" +) + +// MergeMaps takes two maps , and merges them. If defines a value with a key +// already existing in the map, the value for that key will be overwritten. +func MergeMaps(a, b map[string]interface{}) map[string]interface{} { + if a == nil { + return b + } + if b == nil { + return a + } + var values = map[string]interface{}{} + + for i, v := range b { + existing, ok := a[i] + values[i] = v + + switch elem := v.(type) { + case map[string]interface{}: + if ok { + if extMap, ok := existing.(map[string]interface{}); ok { + values[i] = MergeMaps(extMap, elem) + } + } + default: + values[i] = v + } + } + + for i, v := range a { + if _, ok := values[i]; !ok { + values[i] = v + } + } + + return values +} + +// JSONSerializeToGenericObject converts a typed struct to an generic interface using json serialization. +func JSONSerializeToGenericObject(in interface{}) (interface{}, error) { + data, err := json.Marshal(in) + if err != nil { + return nil, err + } + var val interface{} + if err := json.Unmarshal(data, &val); err != nil { + return nil, err + } + return val, nil +} + +// StringIsOneOf checks whether in is one of s. +func StringIsOneOf(in string, s ...string) bool { + for _, search := range s { + if search == in { + return true + } + } + return false +} + +// GetSizeOfDirectory returns the size of all files in a root directory. +func GetSizeOfDirectory(filesystem vfs.FileSystem, root string) (int64, error) { + var size int64 + err := vfs.Walk(filesystem, root, func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + size = size + info.Size() + return nil + }) + if err != nil { + return 0, err + } + return size, nil +} + +// CopyFS copies all files and directories of a filesystem to another. +func CopyFS(src, dst vfs.FileSystem, srcPath, dstPath string) error { + return vfs.Walk(src, srcPath, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + dstFilePath := filepath.Join(dstPath, path) + if info.IsDir() { + if err := dst.MkdirAll(dstFilePath, info.Mode()); err != nil { + return err + } + return nil + } + + file, err := src.OpenFile(path, os.O_RDONLY, info.Mode()) + if err != nil { + return err + } + defer file.Close() + + dstFile, err := dst.Create(dstFilePath) + if err != nil { + return err + } + defer dstFile.Close() + + if _, err := io.Copy(dstFile, file); err != nil { + return err + } + return nil + }) +} + +// YAMLReadFromFile reads a file from a filesystem and decodes it into the given obj +// using YAMl/JSON decoder. +func YAMLReadFromFile(fs vfs.FileSystem, path string, obj interface{}) error { + data, err := vfs.ReadFile(fs, path) + if err != nil { + return err + } + return yaml.Unmarshal(data, obj) +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/ociconfig.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/ociconfig.go new file mode 100644 index 000000000..1c87c1e94 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/ociconfig.go @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "crypto/tls" + "net/http" + + "github.com/gardener/component-cli/ociclient" + "github.com/gardener/component-cli/ociclient/cache" + + "github.com/gardener/landscaper/apis/config" +) + +// WithConfigurationStruct applies external oci configuration as internal options. +type WithConfigurationStruct config.OCIConfiguration + +func (c *WithConfigurationStruct) ApplyOption(options *ociclient.Options) { + if c == nil { + return + } + if len(c.ConfigFiles) != 0 { + options.Paths = c.ConfigFiles + } + if c.Cache != nil { + options.CacheConfig = &cache.Options{ + InMemoryOverlay: c.Cache.UseInMemoryOverlay, + BasePath: c.Cache.Path, + } + } + options.AllowPlainHttp = c.AllowPlainHttp + if c.InsecureSkipVerify { + tlsConfig := &tls.Config{ + InsecureSkipVerify: true, + } + options.HTTPClient = &http.Client{Transport: &http.Transport{TLSClientConfig: tlsConfig}} + } +} + +// WithConfiguration applies external oci configuration as internal options. +func WithConfiguration(cfg *config.OCIConfiguration) *WithConfigurationStruct { + if cfg == nil { + return nil + } + wc := WithConfigurationStruct(*cfg) + return &wc +} + +// ToOCICacheOptions converts a landscaper cache configuration to the cache internal config +func ToOCICacheOptions(cfg *config.OCICacheConfiguration, uid string) []cache.Option { + cacheOpts := make([]cache.Option, 0) + if cfg != nil { + if len(cfg.Path) != 0 { + cacheOpts = append(cacheOpts, cache.WithBasePath(cfg.Path)) + } + cacheOpts = append(cacheOpts, cache.WithInMemoryOverlay(cfg.UseInMemoryOverlay)) + } + cacheOpts = append(cacheOpts, cache.WithUID(uid)) + return cacheOpts +} diff --git a/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/tar/tar.go b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/tar/tar.go new file mode 100644 index 000000000..e9a80f3ae --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscaper/pkg/utils/tar/tar.go @@ -0,0 +1,203 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package tar + +import ( + "archive/tar" + "bytes" + "compress/gzip" + "context" + "io" + "io/ioutil" + "os" + "path/filepath" + + "github.com/gardener/component-cli/ociclient" + "github.com/gardener/component-cli/ociclient/cache" + "github.com/mandelsoft/vfs/pkg/vfs" + "github.com/opencontainers/go-digest" + ocispecv1 "github.com/opencontainers/image-spec/specs-go/v1" +) + +// BuildTarGzip creates a new compressed tar based on a filesystem and a path. +// The tar is written to the given io.Writer. +func BuildTarGzip(fs vfs.FileSystem, root string, buf io.Writer) error { + zr := gzip.NewWriter(buf) + if err := BuildTar(fs, root, zr); err != nil { + return err + } + return zr.Close() +} + +// BuildTar creates a new tar based on a filesystem and a path. +// The tar is written to the given io.Writer. +func BuildTar(fs vfs.FileSystem, root string, buf io.Writer) error { + tw := tar.NewWriter(buf) + err := vfs.Walk(fs, root, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() && len(info.Name()) == 0 { + return nil + } + relPath, err := filepath.Rel(root, path) + if err != nil { + return err + } + if relPath == "." { + return nil + } + + header, err := tar.FileInfoHeader(info, relPath) + if err != nil { + return err + } + + header.Name = relPath + if err := tw.WriteHeader(header); err != nil { + return err + } + + if info.IsDir() { + return nil + } + + data, err := fs.Open(path) + if err != nil { + return err + } + if _, err := io.Copy(tw, data); err != nil { + return err + } + return nil + }) + if err != nil { + return err + } + if err := tw.Close(); err != nil { + return err + } + + return nil +} + +// ExtractTarOptions describes optional untar options. +type ExtractTarOptions struct { + Path string + Overwrite bool +} + +// ApplyOptions applies all tar options to the current options. +func (opts *ExtractTarOptions) ApplyOptions(options []ExtractTarOption) { + for _, opt := range options { + opt.ApplyOption(opts) + } +} + +// ExtractTarOption defines a interface to apply tar options. +type ExtractTarOption interface { + ApplyOption(opts *ExtractTarOptions) +} + +// ToPath configures the path where should be exported to. +type ToPath string + +func (p ToPath) ApplyOption(opts *ExtractTarOptions) { + opts.Path = string(p) +} + +// Overwrite configures if files/directories should be overwritten while untar. +type Overwrite bool + +func (o Overwrite) ApplyOption(opts *ExtractTarOptions) { + opts.Overwrite = bool(o) +} + +// ExtractTar extracts the content of a tar to the given filesystem with the given root base path +func ExtractTar(ctx context.Context, tarStream io.Reader, fs vfs.FileSystem, opts ...ExtractTarOption) error { + options := &ExtractTarOptions{} + options.ApplyOptions(opts) + + tarReader := tar.NewReader(tarStream) + for { + if ctx.Err() != nil { + return ctx.Err() + } + header, err := tarReader.Next() + if err != nil { + if err == io.EOF { + return nil + } + return err + } + + path := header.Name + if len(options.Path) != 0 { + path = filepath.Join(options.Path, path) + } + + switch header.Typeflag { + case tar.TypeDir: + if err := fs.MkdirAll(path, os.ModePerm); err != nil { + return err + } + case tar.TypeReg: + file, err := fs.Create(path) + if err != nil { + if !(os.IsExist(err) && options.Overwrite) { + return err + } + // overwrite the file + file, err = fs.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(header.Mode)) + if err != nil { + return err + } + } + + if _, err := io.Copy(file, tarReader); err != nil { + if err := file.Close(); err != nil { + return err + } + return err + } + + if err := file.Close(); err != nil { + return err + } + } + } +} + +// ExtractTarGzip extracts the content of a tar to the given filesystem with the given root base path +func ExtractTarGzip(ctx context.Context, gzipStream io.Reader, fs vfs.FileSystem, opts ...ExtractTarOption) error { + uncompStream, err := gzip.NewReader(gzipStream) + if err != nil { + return err + } + return ExtractTar(ctx, uncompStream, fs, opts...) +} + +// BuildTarGzipLayer tar and gzips the given path and adds the layer to the cache. +// It returns the newly creates ocispec Description for the tar. +func BuildTarGzipLayer(cache cache.Cache, fs vfs.FileSystem, path string, annotations map[string]string) (ocispecv1.Descriptor, error) { + + var blob bytes.Buffer + if err := BuildTarGzip(fs, path, &blob); err != nil { + return ocispecv1.Descriptor{}, err + } + + desc := ocispecv1.Descriptor{ + MediaType: ociclient.MediaTypeTarGzip, + Digest: digest.FromBytes(blob.Bytes()), + Size: int64(blob.Len()), + Annotations: annotations, + } + + if err := cache.Add(desc, ioutil.NopCloser(&blob)); err != nil { + return ocispecv1.Descriptor{}, err + } + + return desc, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/LICENSE b/integration-test/vendor/github.com/gardener/landscapercli/LICENSE new file mode 100644 index 000000000..f49a4e16e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/LICENSE @@ -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. \ No newline at end of file diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/create.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/create.go new file mode 100644 index 000000000..a7c9b6aad --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/create.go @@ -0,0 +1,422 @@ +package installations + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "os" + "path/filepath" + + "github.com/gardener/component-cli/ociclient" + ociopts "github.com/gardener/component-cli/ociclient/options" + "github.com/gardener/component-cli/pkg/commands/constants" + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + "github.com/gardener/component-spec/bindings-go/ctf" + cdoci "github.com/gardener/component-spec/bindings-go/oci" + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "github.com/gardener/landscaper/pkg/api" + lsjsonschema "github.com/gardener/landscaper/pkg/landscaper/jsonschema" + componentsregistry "github.com/gardener/landscaper/pkg/landscaper/registry/components" + "github.com/gardener/landscaper/pkg/utils/tar" + "github.com/go-logr/logr" + "github.com/mandelsoft/vfs/pkg/memoryfs" + "github.com/mandelsoft/vfs/pkg/osfs" + "github.com/mandelsoft/vfs/pkg/vfs" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + yamlv3 "gopkg.in/yaml.v3" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/serializer" + "sigs.k8s.io/yaml" + + "github.com/gardener/landscapercli/pkg/logger" + "github.com/gardener/landscapercli/pkg/util" +) + +type createOpts struct { + // baseURL is the oci registry where the component is stored. + baseURL string + // componentName is the unique name of the component in the registry. + componentName string + // version is the component version in the oci registry. + version string + // OciOptions contains all exposed options to configure the oci client. + OciOptions ociopts.Options + + //outputPath is the path to write the installation.yaml to + outputPath string + + // name of the blueprint resource in the component descriptor (optional if only one blueprint resource is specified in the component descriptor) + blueprintResourceName string + name string + renderSchemaInfo bool +} + +func NewCreateCommand(ctx context.Context) *cobra.Command { + opts := &createOpts{} + cmd := &cobra.Command{ + Use: "create [baseURL] [componentName] [componentVersion]", + Args: cobra.ExactArgs(3), + Aliases: []string{"c"}, + Example: "landscaper-cli installations create my-registry:5000 github.com/my-component v0.1.0", + Short: "create an installation template for a component which is stored in an OCI registry", + Run: func(cmd *cobra.Command, args []string) { + if err := opts.Complete(args); err != nil { + cmd.PrintErr(err.Error()) + os.Exit(1) + } + + if err := opts.run(ctx, cmd, logger.Log, osfs.New()); err != nil { + cmd.PrintErr(err.Error()) + os.Exit(1) + } + }, + } + + cmd.SetOut(os.Stdout) + + opts.AddFlags(cmd.Flags()) + + return cmd +} + +func (o *createOpts) run(ctx context.Context, cmd *cobra.Command, log logr.Logger, fs vfs.FileSystem) error { + repoCtx := cdv2.NewOCIRegistryRepository(o.baseURL, "") + ociRef, err := cdoci.OCIRef(*repoCtx, o.componentName, o.version) + if err != nil { + return fmt.Errorf("invalid component reference: %w", err) + } + + ociClient, _, err := o.OciOptions.Build(log, fs) + if err != nil { + return fmt.Errorf("unable to build oci client: %s", err.Error()) + } + + cdresolver := cdoci.NewResolver(ociClient) + cd, blobResolver, err := cdresolver.ResolveWithBlobResolver(ctx, repoCtx, o.componentName, o.version) + if err != nil { + return fmt.Errorf("unable to to fetch component descriptor %s: %w", ociRef, err) + } + + blueprintRes, err := util.GetBlueprintResource(cd, o.blueprintResourceName) + if err != nil { + return err + } + + data, err := resolveBlueprint(ctx, *blueprintRes, ociClient, blobResolver) + if err != nil { + return fmt.Errorf("cannot resolve blueprint: %w", err) + } + + memFS := memoryfs.New() + if err := tar.ExtractTarGzip(ctx, data, memFS, tar.ToPath("/")); err != nil { + return fmt.Errorf("cannot extract blueprint blob: %w", err) + } + + blueprintData, err := vfs.ReadFile(memFS, lsv1alpha1.BlueprintFileName) + if err != nil { + return fmt.Errorf("cannot read %s: %w", lsv1alpha1.BlueprintFileName, err) + } + + blueprint := &lsv1alpha1.Blueprint{} + if _, _, err := serializer.NewCodecFactory(api.LandscaperScheme).UniversalDecoder().Decode(blueprintData, nil, blueprint); err != nil { + return fmt.Errorf("cannot decode blueprint: %w", err) + } + + installation := buildInstallation(o.name, cd, *blueprintRes, blueprint) + + var marshaledYaml []byte + if o.renderSchemaInfo { + ociRegistry, err := componentsregistry.NewOCIRegistryWithOCIClient(log, ociClient) + if err != nil { + return fmt.Errorf("cannot build oci registry: %w", err) + } + + referenceContext := lsjsonschema.ReferenceContext{ + LocalTypes: blueprint.LocalTypes, + BlueprintFs: memFS, + ComponentDescriptor: cd, + ComponentResolver: ociRegistry, + } + jsonschemaResolver := lsjsonschema.NewReferenceResolver(&referenceContext) + + commentedYaml, err := annotateInstallationWithSchemaComments(installation, blueprint, jsonschemaResolver) + if err != nil { + return fmt.Errorf("cannot add JSON schema comment: %w", err) + } + + marshaledYaml, err = util.MarshalYaml(commentedYaml) + if err != nil { + return fmt.Errorf("cannot marshal installation yaml: %w", err) + } + } else { + marshaledYaml, err = yaml.Marshal(installation) + if err != nil { + return fmt.Errorf("cannot marshal installation yaml: %w", err) + } + } + + if o.outputPath == "" { + cmd.Println(string(marshaledYaml)) + } else { + f, err := os.Create(o.outputPath) + if err != nil { + return fmt.Errorf("error creating file %s: %w", o.outputPath, err) + } + if _, err = f.Write(marshaledYaml); err != nil { + return fmt.Errorf("error writing file %s: %w", o.outputPath, err) + } + cmd.Printf("Wrote installation to %s", o.outputPath) + } + + return nil +} + +func (o *createOpts) Complete(args []string) error { + o.baseURL = args[0] + o.componentName = args[1] + o.version = args[2] + + cliHomeDir, err := constants.CliHomeDir() + if err != nil { + return err + } + o.OciOptions.CacheDir = filepath.Join(cliHomeDir, "components") + if err := os.MkdirAll(o.OciOptions.CacheDir, os.ModePerm); err != nil { + return fmt.Errorf("unable to create cache directory %s: %w", o.OciOptions.CacheDir, err) + } + + if len(o.baseURL) == 0 { + return errors.New("the base url must be defined") + } + if len(o.componentName) == 0 { + return errors.New("a component name must be defined") + } + if len(o.version) == 0 { + return errors.New("a component's Version must be defined") + } + return nil +} + +func annotateInstallationWithSchemaComments(installation *lsv1alpha1.Installation, blueprint *lsv1alpha1.Blueprint, referenceResolver *lsjsonschema.ReferenceResolver) (*yamlv3.Node, error) { + out, err := yaml.Marshal(installation) + if err != nil { + return nil, fmt.Errorf("cannot marshal installation yaml: %w", err) + } + + commentedInstallationYaml := &yamlv3.Node{} + if err := yamlv3.Unmarshal(out, commentedInstallationYaml); err != nil { + return nil, fmt.Errorf("cannot unmarshal installation yaml: %w", err) + } + + if err := addImportSchemaComments(commentedInstallationYaml, blueprint, referenceResolver); err != nil { + return nil, fmt.Errorf("cannot add schema comments for imports: %w", err) + } + + if err := addExportSchemaComments(commentedInstallationYaml, blueprint, referenceResolver); err != nil { + return nil, fmt.Errorf("cannot add schema comments for exports: %w", err) + } + + return commentedInstallationYaml, nil +} + +func resolveBlueprint(ctx context.Context, blueprintRes cdv2.Resource, ociClient ociclient.Client, blobResolver ctf.BlobResolver) (*bytes.Buffer, error) { + var data bytes.Buffer + if blueprintRes.Access.GetType() == cdv2.OCIRegistryType { + ref, ok := blueprintRes.Access.Object["imageReference"].(string) + if !ok { + return nil, fmt.Errorf("cannot parse imageReference to string") + } + + manifest, err := ociClient.GetManifest(ctx, ref) + if err != nil { + return nil, fmt.Errorf("cannot get manifest: %w", err) + } + + if err := ociClient.Fetch(ctx, ref, manifest.Layers[0], &data); err != nil { + return nil, fmt.Errorf("cannot get manifest layer: %w", err) + } + } else { + if _, err := blobResolver.Resolve(ctx, blueprintRes, &data); err != nil { + return nil, fmt.Errorf("unable to to resolve blob of blueprint resource: %w", err) + } + } + + return &data, nil +} + +func addExportSchemaComments(commentedInstallationYaml *yamlv3.Node, blueprint *lsv1alpha1.Blueprint, schemaResolver *lsjsonschema.ReferenceResolver) error { + _, exportsDataValueNode := util.FindNodeByPath(commentedInstallationYaml, "spec.exports.data") + if exportsDataValueNode != nil { + + for _, dataImportNode := range exportsDataValueNode.Content { + n1, n2 := util.FindNodeByPath(dataImportNode, "name") + exportName := n2.Value + + var expdef lsv1alpha1.ExportDefinition + for _, bpexp := range blueprint.Exports { + if bpexp.Name == exportName { + expdef = bpexp + break + } + } + + schema, err := schemaResolver.Resolve(expdef.Schema.RawMessage) + if err != nil { + return fmt.Errorf("unable to resolve jsonschema for export definition %s: %w", expdef.Name, err) + } + + marshaledShema, err := json.MarshalIndent(schema, "", " ") + if err != nil { + return fmt.Errorf("unable to marshal json schema: %w", err) + } + + n1.HeadComment = "JSON schema\n" + string(marshaledShema) + } + } + + _, exportTargetsValueNode := util.FindNodeByPath(commentedInstallationYaml, "spec.exports.targets") + if exportTargetsValueNode != nil { + for _, targetExportNode := range exportTargetsValueNode.Content { + n1, n2 := util.FindNodeByPath(targetExportNode, "name") + targetName := n2.Value + + var expdef lsv1alpha1.ExportDefinition + for _, bpexp := range blueprint.Exports { + if bpexp.Name == targetName { + expdef = bpexp + break + } + } + n1.HeadComment = "Target type: " + expdef.TargetType + } + } + + return nil +} + +func addImportSchemaComments(commentedInstallationYaml *yamlv3.Node, blueprint *lsv1alpha1.Blueprint, schemaResolver *lsjsonschema.ReferenceResolver) error { + _, importDataValueNode := util.FindNodeByPath(commentedInstallationYaml, "spec.imports.data") + if importDataValueNode != nil { + for _, dataImportNode := range importDataValueNode.Content { + n1, n2 := util.FindNodeByPath(dataImportNode, "name") + importName := n2.Value + + var impdef lsv1alpha1.ImportDefinition + for _, bpimp := range blueprint.Imports { + if bpimp.Name == importName { + impdef = bpimp + break + } + } + + schema, err := schemaResolver.Resolve(impdef.Schema.RawMessage) + if err != nil { + return fmt.Errorf("unable to resolve jsonschema for import definition %s: %w", impdef.Name, err) + } + + marshaledShema, err := json.MarshalIndent(schema, "", " ") + if err != nil { + return fmt.Errorf("unable to marshal json schema: %w", err) + } + n1.HeadComment = "JSON schema\n" + string(marshaledShema) + } + } + + _, targetsValueNode := util.FindNodeByPath(commentedInstallationYaml, "spec.imports.targets") + if targetsValueNode != nil { + for _, targetImportNode := range targetsValueNode.Content { + n1, n2 := util.FindNodeByPath(targetImportNode, "name") + targetName := n2.Value + + var impdef lsv1alpha1.ImportDefinition + for _, bpimp := range blueprint.Imports { + if bpimp.Name == targetName { + impdef = bpimp + break + } + } + n1.HeadComment = "Target type: " + impdef.TargetType + } + } + + return nil +} + +func (o *createOpts) AddFlags(fs *pflag.FlagSet) { + fs.StringVar(&o.name, "name", "my-installation", "name of the installation") + fs.BoolVar(&o.renderSchemaInfo, "render-schema-info", true, "render schema information of the component's imports and exports as comments into the installation") + fs.StringVar(&o.blueprintResourceName, "blueprint-resource-name", "", "name of the blueprint resource in the component descriptor (optional if only one blueprint resource is specified in the component descriptor)") + fs.StringVarP(&o.outputPath, "output-file", "o", "", "file path for the resulting installation yaml") + o.OciOptions.AddFlags(fs) +} + +func buildInstallation(name string, cd *cdv2.ComponentDescriptor, blueprintRes cdv2.Resource, blueprint *lsv1alpha1.Blueprint) *lsv1alpha1.Installation { + dataImports := []lsv1alpha1.DataImport{} + targetImports := []lsv1alpha1.TargetImport{} + for _, imp := range blueprint.Imports { + if imp.TargetType != "" { + targetImport := lsv1alpha1.TargetImport{ + Name: imp.Name, + } + targetImports = append(targetImports, targetImport) + } else { + dataImport := lsv1alpha1.DataImport{ + Name: imp.Name, + } + dataImports = append(dataImports, dataImport) + } + } + + dataExports := []lsv1alpha1.DataExport{} + targetExports := []lsv1alpha1.TargetExport{} + for _, exp := range blueprint.Exports { + if exp.TargetType != "" { + targetExport := lsv1alpha1.TargetExport{ + Name: exp.Name, + } + targetExports = append(targetExports, targetExport) + } else { + dataExport := lsv1alpha1.DataExport{ + Name: exp.Name, + } + dataExports = append(dataExports, dataExport) + } + } + + obj := &lsv1alpha1.Installation{ + TypeMeta: metav1.TypeMeta{ + APIVersion: lsv1alpha1.SchemeGroupVersion.String(), + Kind: "Installation", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: lsv1alpha1.InstallationSpec{ + ComponentDescriptor: &lsv1alpha1.ComponentDescriptorDefinition{ + Reference: &lsv1alpha1.ComponentDescriptorReference{ + RepositoryContext: cd.GetEffectiveRepositoryContext(), + ComponentName: cd.ObjectMeta.Name, + Version: cd.ObjectMeta.Version, + }, + }, + Blueprint: lsv1alpha1.BlueprintDefinition{ + Reference: &lsv1alpha1.RemoteBlueprintReference{ + ResourceName: blueprintRes.Name, + }, + }, + Imports: lsv1alpha1.InstallationImports{ + Data: dataImports, + Targets: targetImports, + }, + Exports: lsv1alpha1.InstallationExports{ + Data: dataExports, + Targets: targetExports, + }, + }, + } + + return obj +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/force_delete.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/force_delete.go new file mode 100644 index 000000000..5c0f49ded --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/force_delete.go @@ -0,0 +1,194 @@ +package installations + +import ( + "context" + "fmt" + "os" + "time" + + "k8s.io/apimachinery/pkg/util/wait" + + inspect "github.com/gardener/landscapercli/cmd/installations/inspect" + + "github.com/go-logr/logr" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/gardener/landscapercli/pkg/logger" + "github.com/gardener/landscapercli/pkg/util" +) + +type forceDeleteOptions struct { + kubeconfig string + installationName string + namespace string + k8sClient client.Client +} + +func NewForceDeleteCommand(ctx context.Context) *cobra.Command { + opts := &forceDeleteOptions{} + cmd := &cobra.Command{ + Use: "force-delete [installation-name] [--namespace namespace] [--kubeconfig kubeconfig.yaml]", + Aliases: []string{"fd"}, + Args: cobra.MaximumNArgs(1), + Example: "landscaper-cli installations force-delete", + Short: "Deletes an installations and the depending executions and deployItems in cluster and namespace of the " + + "current kubectl cluster context. Concerning the deployed software no guarantees could be given if it is " + + "uninstalled or not.", + Run: func(cmd *cobra.Command, args []string) { + if err := opts.validateArgs(args); err != nil { + cmd.PrintErr(err.Error()) + os.Exit(1) + } + + if err := opts.run(ctx, cmd, logger.Log); err != nil { + cmd.PrintErr(err.Error()) + os.Exit(1) + } + cmd.Println("All objects deleted") + }, + } + + cmd.SetOut(os.Stdout) + + opts.AddFlags(cmd.Flags()) + + return cmd +} + +func (o *forceDeleteOptions) run(ctx context.Context, cmd *cobra.Command, log logr.Logger) error { + k8sClient, namespace, err := util.BuildKubeClientFromConfigOrCurrentClusterContext(o.kubeconfig, scheme) + if err != nil { + return fmt.Errorf("cannot build k8s client from config or current cluster context: %w", err) + } + o.k8sClient = k8sClient + + if namespace != "" && o.namespace == "" { + o.namespace = namespace + } + + if o.namespace == "" { + return fmt.Errorf("namespace was not defined. Use --namespace to specify a namespace") + } + + if o.installationName == "" { + return fmt.Errorf("installationName was not defined.") + } + + collector := inspect.Collector{ + K8sClient: k8sClient, + } + installationTrees, err := collector.CollectInstallationsInCluster(o.installationName, o.namespace) + if err != nil { + return fmt.Errorf("cannot collect installations etc.: %w", err) + } + + return o.deleteInstallationTrees(ctx, installationTrees) +} + +func (o *forceDeleteOptions) deleteInstallationTrees(ctx context.Context, installationTrees []*inspect.InstallationTree) error { + for _, installationTree := range installationTrees { + if err := o.deleteObject(ctx, installationTree.Installation, "installation"); err != nil { + return err + } + + if err := o.deleteInstallationTrees(ctx, installationTree.SubInstallations); err != nil { + return err + } + + if err := o.deleteExecutionTree(ctx, installationTree.Execution); err != nil { + return err + } + + if err := o.removeFinalizer(ctx, installationTree.Installation, "installation"); err != nil { + return err + } + } + return nil +} + +func (o *forceDeleteOptions) deleteExecutionTree(ctx context.Context, executionTree *inspect.ExecutionTree) error { + if executionTree == nil || executionTree.Execution == nil { + return nil + } + + if err := o.deleteObject(ctx, executionTree.Execution, "execution"); err != nil { + return err + } + + for _, di := range executionTree.DeployItems { + if err := o.deleteObject(ctx, di.DeployItem, "deployItem"); err != nil { + return err + } + if err := o.removeFinalizer(ctx, di.DeployItem, "deployItem"); err != nil { + return err + } + } + + if err := o.removeFinalizer(ctx, executionTree.Execution, "execution"); err != nil { + return err + } + + return nil +} + +func (o *forceDeleteOptions) deleteObject(ctx context.Context, object client.Object, objectType string) error { + if err := o.k8sClient.Delete(ctx, object); err != nil { + if apierrors.IsNotFound(err) { + fmt.Printf("- already gone: %s %s\n", objectType, object.GetName()) + return nil + } + return fmt.Errorf("cannot delete %s %s: %w", objectType, object.GetName(), err) + } + + return nil +} + +func (o *forceDeleteOptions) removeFinalizer(ctx context.Context, object client.Object, objectType string) error { + var lastErr error = nil + + if err := wait.PollImmediate(time.Second, 10*time.Second, func() (done bool, err error) { + if err := o.k8sClient.Get(ctx, client.ObjectKeyFromObject(object), object); err != nil { + if apierrors.IsNotFound(err) { + return true, nil + } + lastErr = fmt.Errorf("cannot fetch %s %s: %w", objectType, object.GetName(), err) + preliminaryMessage := fmt.Sprintf("- cannot fetch %s %s - will retry", objectType, object.GetName()) + fmt.Println(preliminaryMessage) + return false, nil + } + + object.SetFinalizers(nil) + if err := o.k8sClient.Update(ctx, object); err != nil { + if apierrors.IsNotFound(err) { + return true, nil + } + lastErr = fmt.Errorf("cannot remove finalizers from %s %s: %w", objectType, object.GetName(), err) + preliminaryMessage := fmt.Sprintf("- cannot remove finalizers from %s %s - will retry", objectType, object.GetName()) + fmt.Println(preliminaryMessage) + return false, nil + } + + return true, nil + + }); err != nil { + return lastErr + } + + fmt.Printf("- deleted %s %s\n", objectType, object.GetName()) + return nil +} + +func (o *forceDeleteOptions) validateArgs(args []string) error { + if len(args) == 1 { + o.installationName = args[0] + } + return nil +} + +func (o *forceDeleteOptions) AddFlags(fs *pflag.FlagSet) { + fs.StringVar(&o.kubeconfig, "kubeconfig", "", "path to the kubeconfig for the cluster. Required if the cluster is not the same as the current-context of kubectl.") + fs.StringVarP(&o.namespace, "namespace", "n", "", "namespace of the installation. Required if --kubeconfig is used.") +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect.go new file mode 100644 index 000000000..856f54b9a --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect.go @@ -0,0 +1,188 @@ +package installations + +import ( + "context" + "encoding/json" + "fmt" + "os" + + inspect "github.com/gardener/landscapercli/cmd/installations/inspect" + + "github.com/go-logr/logr" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "sigs.k8s.io/yaml" + + "github.com/gardener/landscapercli/pkg/logger" + "github.com/gardener/landscapercli/pkg/util" +) + +type statusOptions struct { + kubeconfig string + installationName string + namespace string + omode string + + allNamespaces bool + detailMode bool + showExecutions bool + showOnlyFailed bool + + oyaml bool + ojson bool + owide bool +} + +const ( + OUTPUT_YAML = "yaml" + OUTPUT_JSON = "json" + OUTPUT_WIDE = "wide" +) + +func NewInspectCommand(ctx context.Context) *cobra.Command { + opts := &statusOptions{} + cmd := &cobra.Command{ + Use: "inspect [installation-name] [--namespace namespace] [--kubeconfig kubeconfig.yaml]", + Aliases: []string{"i", "status"}, + Args: cobra.MaximumNArgs(1), + Example: "landscaper-cli installations inspect", + Short: "Displays status information for all installations and depending executions and deployItems in cluster and namespace of the current kubectl cluster context. To display only one installation, specify the installation-name.", + Run: func(cmd *cobra.Command, args []string) { + if err := opts.validateArgs(args); err != nil { + cmd.PrintErr(err.Error()) + os.Exit(1) + } + + if err := opts.run(ctx, cmd, logger.Log); err != nil { + cmd.PrintErr(err.Error()) + os.Exit(1) + } + }, + } + + cmd.SetOut(os.Stdout) + + opts.AddFlags(cmd.Flags()) + + return cmd +} + +func (o *statusOptions) run(ctx context.Context, cmd *cobra.Command, log logr.Logger) error { + k8sClient, namespace, err := util.BuildKubeClientFromConfigOrCurrentClusterContext(o.kubeconfig, scheme) + if err != nil { + return fmt.Errorf("cannot build k8s client from config or current cluster context: %w", err) + } + + if namespace != "" && o.namespace == "" { + o.namespace = namespace + } + + if o.allNamespaces { + if len(o.installationName) != 0 { + return fmt.Errorf("the --all-namespaces option cannot be used when an installation name is provided") + } + o.namespace = "*" + } + if o.namespace == "" { + return fmt.Errorf("namespace was not defined. Use --namespace to specify a namespace") + } + + switch o.omode { + case OUTPUT_YAML: + o.oyaml = true + case OUTPUT_JSON: + o.ojson = true + case OUTPUT_WIDE: + o.owide = true + case "": + // this case occurs if the '-o' flag is not set at all + // We don't need to do anything here, but it shouldn't go into the default + // case, since that one is used to detect invalid arguments and throws an error. + default: + return fmt.Errorf("invalid option for '--output'/'-o' flag: %q", o.omode) + } + + // verify mode + if (o.oyaml || o.ojson || o.owide) && !xor(o.oyaml, o.ojson, o.owide) { + return fmt.Errorf("no more than one output mode may be set: yaml=%v, json=%v, wide=%v", o.oyaml, o.ojson, o.owide) + } + + collector := inspect.Collector{ + K8sClient: k8sClient, + } + installationTrees, err := collector.CollectInstallationsInCluster(o.installationName, o.namespace) + if err != nil { + return fmt.Errorf("cannot collect installation: %w", err) + } + + if o.oyaml { + marshaledInstallationTrees, err := yaml.Marshal(installationTrees) + if err != nil { + return fmt.Errorf("failed marshaling output to yaml: %w", err) + } + cmd.Print(string(marshaledInstallationTrees)) + return nil + } + + if o.ojson { + marshaledInstallationTrees, err := json.Marshal(installationTrees) + if err != nil { + return fmt.Errorf("failed marshaling output to json: %w", err) + } + cmd.Print(string(marshaledInstallationTrees)) + return nil + } + + transformer := inspect.Transformer{ + DetailedMode: o.detailMode, + ShowExecutions: o.showExecutions, + ShowOnlyFailed: o.showOnlyFailed, + ShowNamespaces: o.allNamespaces, + WideMode: o.owide, + } + + transformedTrees, err := transformer.TransformToPrintableTrees(installationTrees) + if err != nil { + return fmt.Errorf("error transforming CR to printable tree: %w", err) + } + output := inspect.PrintTrees(transformedTrees) + + cmd.Print(output.String()) + + return nil +} + +func (o *statusOptions) validateArgs(args []string) error { + if len(args) == 1 { + o.installationName = args[0] + } + return nil +} + +func (o *statusOptions) AddFlags(fs *pflag.FlagSet) { + fs.StringVar(&o.kubeconfig, "kubeconfig", "", "path to the kubeconfig for the cluster. Required if the cluster is not the same as the current-context of kubectl.") + fs.StringVarP(&o.namespace, "namespace", "n", "", "namespace of the installation. Required if --kubeconfig is used.") + fs.BoolVarP(&o.allNamespaces, "all-namespaces", "A", false, "if present, lists installations across all namespaces. No installation name may be given and any given namespace will be ignored.") + fs.BoolVarP(&o.detailMode, "show-details", "d", false, "show detailed information about installations, executions and deployitems. Similar to kubectl describe installation installation-name.") + fs.BoolVarP(&o.showExecutions, "show-executions", "e", false, "show the executions in the tree. By default, the executions are not shown.") + fs.BoolVarP(&o.showOnlyFailed, "show-failed", "f", false, "show only items that are in phase 'Failed'. It also prints parent elements to the failed items.") + fs.BoolVarP(&o.oyaml, "oyaml", "y", false, "output in yaml format. Equivalent to '-o yaml'.") + fs.BoolVarP(&o.ojson, "ojson", "j", false, "output in json format. Equivalent to '-o json'.") + fs.BoolVarP(&o.owide, "owide", "w", false, "output some additional information. Equivalent to '-o wide'.") + fs.StringVarP(&o.omode, "output", "o", "", fmt.Sprintf("how the output is formatted. Valid values are %s, %s, and %s.", OUTPUT_YAML, OUTPUT_JSON, OUTPUT_WIDE)) +} + +// xor returns true if exactly one of the given booleans is true +func xor(bools ...bool) bool { + isTrue := false + for _, b := range bools { + if b { + if isTrue { + // more than one boolean is true + return false + } + isTrue = true + } + } + return isTrue +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/collector.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/collector.go new file mode 100644 index 000000000..dc1f9d3a1 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/collector.go @@ -0,0 +1,122 @@ +package tree + +import ( + "context" + "fmt" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +//Collector is responsible for collecting CR (installations, executions, deployItems) from a cluster using the K8sClient. +type Collector struct { + K8sClient client.Client +} + +//CollectInstallationsInCluster collects a single installation (including all referenced executions and deployitems) +//or all installations if name is empty. +func (c *Collector) CollectInstallationsInCluster(name string, namespace string) ([]*InstallationTree, error) { + if name != "" { + installation, err := c.collectInstallationTree(name, namespace) + if err != nil { + return nil, fmt.Errorf("error resolving installation %s: %w", name, err) + } + return []*InstallationTree{installation}, nil + } + + instList := lsv1alpha1.InstallationList{} + installationTreeList := []*InstallationTree{} + + if namespace == "*" { + if err := c.K8sClient.List(context.TODO(), &instList); err != nil { + return nil, fmt.Errorf("cannot list installations across all namespaces: %w", err) + } + } else { + if err := c.K8sClient.List(context.TODO(), &instList, client.InNamespace(namespace)); err != nil { + return nil, fmt.Errorf("cannot list installations for namespace %s: %w", namespace, err) + } + } + for _, inst := range instList.Items { + if inst.OwnerReferences == nil { //filters for root installations (since subInstallations have a owner reference) + filledInst, err := c.collectInstallationTree(inst.Name, inst.Namespace) + if err != nil { + return nil, fmt.Errorf("cannot get installation details for %s: %w", inst.Name, err) + } + installationTreeList = append(installationTreeList, filledInst) + } + } + return installationTreeList, nil +} + +func (c *Collector) collectInstallationTree(name string, namespace string) (*InstallationTree, error) { + key := client.ObjectKey{Name: name, Namespace: namespace} + inst := lsv1alpha1.Installation{} + err := c.K8sClient.Get(context.TODO(), key, &inst) + if err != nil { + return nil, fmt.Errorf("cannot get installation %s: %w", name, err) + } + + tree := InstallationTree{ + Installation: &inst, + } + + //resolve all sub installations + for _, subInst := range inst.Status.InstallationReferences { + subInstTree, err := c.collectInstallationTree(subInst.Reference.Name, namespace) + if err != nil { + return nil, fmt.Errorf("cannot get installation %s: %w", subInst.Reference.Name, err) + } + tree.SubInstallations = append(tree.SubInstallations, subInstTree) + } + + //resolve executions + execution := inst.Status.ExecutionReference + if execution != nil { + subExecution, err := c.collectExecutionTree(execution.Name, execution.Namespace) + if err != nil { + return nil, fmt.Errorf("cannot get execution %s: %w", execution.Name, err) + } + tree.Execution = subExecution + } + + return &tree, nil +} + +func (c *Collector) collectExecutionTree(name string, namespace string) (*ExecutionTree, error) { + key := client.ObjectKey{Name: name, Namespace: namespace} + exec := lsv1alpha1.Execution{} + err := c.K8sClient.Get(context.TODO(), key, &exec) + if err != nil { + return nil, fmt.Errorf("cannot get execution %s: %w", name, err) + } + + tree := ExecutionTree{ + Execution: &exec, + } + + //resolve deployItems + for _, deployItem := range exec.Status.DeployItemReferences { + deployItemTree, err := c.collectDeployItemTree(deployItem.Reference.Name, deployItem.Reference.Namespace) + if err != nil { + return nil, fmt.Errorf("cannot get deployitem %s: %w", deployItem.Reference.Name, err) + } + tree.DeployItems = append(tree.DeployItems, deployItemTree) + } + + return &tree, nil +} + +func (c *Collector) collectDeployItemTree(name string, namespace string) (*DeployItemLeaf, error) { + key := client.ObjectKey{Name: name, Namespace: namespace} + depItem := lsv1alpha1.DeployItem{} + err := c.K8sClient.Get(context.TODO(), key, &depItem) + if err != nil { + return nil, fmt.Errorf("cannot get deployitem %s: %w", name, err) + } + + tree := DeployItemLeaf{ + DeployItem: &depItem, + } + + return &tree, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/printer.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/printer.go new file mode 100644 index 000000000..343abdd9e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/printer.go @@ -0,0 +1,113 @@ +package tree + +import ( + "fmt" + "strings" +) + +const ( + emptySpace = " " + middleItem = "├── " + continueItem = "│ " + lastItem = "└── " +) + +const terminalWidth = 120 + +//PrintableTreeNode contains the structure for a printable tree. +type PrintableTreeNode struct { + Headline string + WideData string // will be displayed in '-o wide' mode + Description string + Childs []*PrintableTreeNode +} + +func (node *PrintableTreeNode) print(output *strings.Builder, preFix string, isLast bool, rootLevel bool) { + itemFormatHeading := middleItem + if isLast { + itemFormatHeading = lastItem + } + if rootLevel { + itemFormatHeading = "" + } + itemFormatDescription := continueItem + if rootLevel { + itemFormatDescription = emptySpace + } + + if node.Headline != "" { + fmt.Fprintf(output, "%s%s%s\n", preFix, itemFormatHeading, node.Headline) + if node.WideData != "" { + wData := node.WideData + if node.Description != "" { + // add separator if -d flag is set + wData = fmt.Sprintf("%s%s", wData, "\n----------") + } + fmt.Fprintf(output, "%s", formatDescription(preFix, itemFormatDescription, wData, isLast, true)) + } + if node.Description != "" { + fmt.Fprintf(output, "%s", formatDescription(preFix, itemFormatDescription, node.Description, isLast, false)) + } + preFix = addEmptySpaceOrContinueItem(preFix, isLast) + } + + for i, subNode := range node.Childs { + subNode.print(output, preFix, i == len(node.Childs)-1, false) + } +} + +//PrintTrees turns the given PrintableTreeNodes into a formated tree as strings.Builder. +func PrintTrees(nodes []PrintableTreeNode) strings.Builder { + output := strings.Builder{} + for _, node := range nodes { + node.print(&output, "", true, true) + output.WriteString("\n") + } + return output +} + +func formatDescription(preFix string, itemFormatDescription string, nodeDescription string, isLast, increaseIndent bool) string { + if isLast { + itemFormatDescription = emptySpace + } + + //break to long lines + lines := strings.Split(nodeDescription, "\n") + linesFixedLength := []string{} + for _, line := range lines { + if len(line) > terminalWidth { + for i := 0; i < len(line); i += terminalWidth { + endIndex := i + terminalWidth + if endIndex > len(line) { + endIndex = len(line) + } + if increaseIndent && i > 0 { + // indent broken lines by two spaces + linesFixedLength = append(linesFixedLength, fmt.Sprintf(" %s", line[i:endIndex])) + } else { + linesFixedLength = append(linesFixedLength, line[i:endIndex]) + } + } + } else { + linesFixedLength = append(linesFixedLength, line) + } + } + + //add prefix and new line + for i, line := range linesFixedLength { + linesFixedLength[i] = fmt.Sprintf("%s%s%s\n", preFix, itemFormatDescription, line) + } + + return strings.Join(linesFixedLength, "") +} + +func addEmptySpaces(s string) string { + return s + emptySpace +} + +func addEmptySpaceOrContinueItem(s string, isLast bool) string { + if isLast { + return addEmptySpaces(s) + } + return s + continueItem +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/transformer.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/transformer.go new file mode 100644 index 000000000..e59db9440 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/transformer.go @@ -0,0 +1,237 @@ +package tree + +import ( + "encoding/json" + "fmt" + "strings" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + containerv1alpha1 "github.com/gardener/landscaper/apis/deployer/container/v1alpha1" + helmv1alpha1 "github.com/gardener/landscaper/apis/deployer/helm/v1alpha1" + "sigs.k8s.io/yaml" +) + +//Transformer can transform from []*InstallationTree to printable []PrintableTreeNodes with different transformation options. +type Transformer struct { + DetailedMode bool + ShowExecutions bool + ShowOnlyFailed bool + ShowNamespaces bool + WideMode bool +} + +//TransformToPrintableTrees transform a []*InstallationTree to []PrintableTreeNodes for the Printer. +func (t Transformer) TransformToPrintableTrees(installationTrees []*InstallationTree) ([]PrintableTreeNode, error) { + var printableTrees []PrintableTreeNode + + for _, installationTree := range installationTrees { + if t.ShowOnlyFailed { + installationTree = installationTree.filterForFailedInstallation() + } + + transformedInstallaltion, err := t.transformInstallation(installationTree) + if err != nil { + return nil, fmt.Errorf("error in installation %s: %w", installationTree.Installation.Name, err) + } + + printableTrees = append(printableTrees, *transformedInstallaltion) + } + return printableTrees, nil +} + +func (t Transformer) transformInstallation(installationTree *InstallationTree) (*PrintableTreeNode, error) { + printableNode := PrintableTreeNode{} + if installationTree == nil { + return &printableNode, nil + } + + installationTree.Installation.SetManagedFields(nil) + + namespaceInfo := "" + if t.ShowNamespaces { + namespaceInfo = fmt.Sprintf("%s/", installationTree.Installation.Namespace) + } + + printableNode.Headline = fmt.Sprintf("[%s] Installation %s%s", + formatStatus(string(installationTree.Installation.Status.Phase)), namespaceInfo, installationTree.Installation.Name) + + if t.WideMode { + wide := strings.Builder{} + cd := "inline" + if installationTree.Installation.Spec.ComponentDescriptor.Reference != nil { + cd = fmt.Sprintf("%s:%s", installationTree.Installation.Spec.ComponentDescriptor.Reference.ComponentName, installationTree.Installation.Spec.ComponentDescriptor.Reference.Version) + } + wide.WriteString(fmt.Sprintf("Component Descriptor: %s\n", cd)) + bp := "inline" + if installationTree.Installation.Spec.Blueprint.Reference != nil { + bp = installationTree.Installation.Spec.Blueprint.Reference.ResourceName + } + wide.WriteString(fmt.Sprintf("Blueprint: %s", bp)) + printableNode.WideData = wide.String() + } + + if t.DetailedMode { + marshaledInstallation, err := yaml.Marshal(installationTree.Installation) + if err != nil { + return nil, fmt.Errorf("failed marshaling installation %s: %w", installationTree.Installation.Name, err) + } + printableNode.Description = string(marshaledInstallation) + + } else if installationTree.Installation.Status.LastError != nil { + printableNode.Description = fmt.Sprintf("Last error: %s", installationTree.Installation.Status.LastError.Message) + } + + if len(installationTree.SubInstallations) > 0 { + for _, inst := range installationTree.SubInstallations { + transformedInstalaltion, err := t.transformInstallation(inst) + if err != nil { + return nil, fmt.Errorf("error in subinstallation %s: %w", installationTree.Installation.Name, err) + } + printableNode.Childs = append(printableNode.Childs, transformedInstalaltion) + } + } + + if installationTree.Execution != nil { + transformedExecution, err := t.transformExecution(installationTree.Execution) + if err != nil { + return nil, fmt.Errorf("error in installation %s: %w", installationTree.Installation.Name, err) + } + printableNode.Childs = append(printableNode.Childs, transformedExecution) + + } + + return &printableNode, nil +} + +func (t Transformer) transformExecution(executionTree *ExecutionTree) (*PrintableTreeNode, error) { + printableNode := PrintableTreeNode{} + if executionTree == nil { + return &printableNode, nil + } + + executionTree.Execution.SetManagedFields(nil) + + if t.ShowExecutions || t.DetailedMode { + printableNode.Headline = fmt.Sprintf("[%s] Execution %s", + formatStatus(string(executionTree.Execution.Status.Phase)), executionTree.Execution.Name) + } + + if t.DetailedMode { + marshaledExecution, err := yaml.Marshal(executionTree.Execution) + if err != nil { + return nil, fmt.Errorf("failed marshaling Execution %s: %w", executionTree.Execution.Name, err) + } + printableNode.Description = string(marshaledExecution) + } + + if len(executionTree.DeployItems) > 0 { + for _, depItem := range executionTree.DeployItems { + transformedDeployItem, err := t.transformDeployItem(depItem) + if err != nil { + return nil, fmt.Errorf("error in Execution %s: %w", executionTree.Execution.Name, err) + } + printableNode.Childs = append(printableNode.Childs, transformedDeployItem) + } + } + + return &printableNode, nil +} + +func (t Transformer) transformDeployItem(deployItem *DeployItemLeaf) (*PrintableTreeNode, error) { + printableNode := PrintableTreeNode{} + if deployItem == nil { + return &printableNode, nil + } + + deployItem.DeployItem.SetManagedFields(nil) + + printableNode.Headline = fmt.Sprintf("[%s] DeployItem %s", + formatStatus(string(deployItem.DeployItem.Status.Phase)), deployItem.DeployItem.Name) + + if t.WideMode { + wide := strings.Builder{} + diType := deployItem.DeployItem.Spec.Type + wide.WriteString(fmt.Sprintf("Type: %s", diType)) + switch diType { + case "landscaper.gardener.cloud/helm": + // print helm chart location + wide.WriteString("\n") + config := &helmv1alpha1.ProviderConfiguration{} + err := json.Unmarshal(deployItem.DeployItem.Spec.Configuration.Raw, config) + if err != nil { + wide.WriteString("unable to parse helm config") + } else { + chartLocation := "" + if len(config.Chart.Ref) != 0 { + chartLocation = config.Chart.Ref + } else if config.Chart.Archive != nil { + if len(config.Chart.Archive.Raw) != 0 { + chartLocation = "inline (archive)" + } else if config.Chart.Archive.Remote != nil { + chartLocation = fmt.Sprintf("%s (archive)", config.Chart.Archive.Remote.URL) + } + } else if config.Chart.FromResource != nil { + cd := "inline component descriptor" + if config.Chart.FromResource.Reference != nil { + cd = fmt.Sprintf("%s:%s", config.Chart.FromResource.Reference.ComponentName, config.Chart.FromResource.Reference.Version) + } + chartLocation = fmt.Sprintf("resource %q from %s", config.Chart.FromResource.ResourceName, cd) + } + if len(chartLocation) == 0 { + chartLocation = "unknown" + } + wide.WriteString("Chart: ") + wide.WriteString(chartLocation) + } + case "landscaper.gardener.cloud/container": + // print container image and command + wide.WriteString("\n") + config := &containerv1alpha1.ProviderConfiguration{} + err := json.Unmarshal(deployItem.DeployItem.Spec.Configuration.Raw, config) + if err != nil { + wide.WriteString("unable to parse container config") + } else { + wide.WriteString("Image: ") + wide.WriteString(config.Image) + if len(config.Command) != 0 { + wide.WriteString("\nCommand:") + for _, e := range config.Command { + wide.WriteString(fmt.Sprintf(" %q", e)) + } + } + if len(config.Args) != 0 { + wide.WriteString("\nArgs:") + for _, e := range config.Args { + wide.WriteString(fmt.Sprintf(" %q", e)) + } + } + } + } + printableNode.WideData = wide.String() + } + + if t.DetailedMode { + marshaledExecution, err := yaml.Marshal(deployItem.DeployItem) + if err != nil { + return nil, fmt.Errorf("failed marshaling DeployItem %s: %w", deployItem.DeployItem.Name, err) + } + printableNode.Description = string(marshaledExecution) + } else if deployItem.DeployItem.Status.LastError != nil { + printableNode.Description = fmt.Sprintf("Last error: %s", deployItem.DeployItem.Status.LastError.Message) + } + + return &printableNode, nil +} + +func formatStatus(status string) string { + if status == string(lsv1alpha1.ComponentPhaseSucceeded) { + return "✅ " + status + } + if status == string(lsv1alpha1.ComponentPhaseProgressing) { + return "🏗️ " + status + } + if status == string(lsv1alpha1.ComponentPhaseFailed) { + return "❌ " + status + } + return status +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/tree.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/tree.go new file mode 100644 index 000000000..417bffcd2 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/inspect/tree.go @@ -0,0 +1,67 @@ +package tree + +import ( + "github.com/gardener/landscaper/apis/core/v1alpha1" + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +//InstallationTree contains the Installation and the references to Sub-Installations and the Execution. +type InstallationTree struct { + SubInstallations []*InstallationTree `json:"subInstallations,omitempty"` + Execution *ExecutionTree `json:"execution,omitempty"` + Installation *lsv1alpha1.Installation `json:"installation,omitempty"` +} + +func (i *InstallationTree) filterForFailedInstallation() *InstallationTree { + filteredSubInstallations := []*InstallationTree{} + for _, subInstallation := range i.SubInstallations { + if filteredSubInstallation := subInstallation.filterForFailedInstallation(); filteredSubInstallation != nil { + filteredSubInstallations = append(filteredSubInstallations, filteredSubInstallation) + } + } + i.SubInstallations = filteredSubInstallations + + if i.Execution != nil { + i.Execution = i.Execution.filterForFailedExecution() + } + + if len(filteredSubInstallations) > 0 || i.Execution != nil || i.Installation.Status.Phase == v1alpha1.ComponentPhaseFailed { + return i + } + return nil + +} + +//ExecutionTree contains the Execution and the references to all DeployItems. +type ExecutionTree struct { + DeployItems []*DeployItemLeaf `json:"deployItems,omitempty"` + Execution *lsv1alpha1.Execution `json:"execution,omitempty"` +} + +func (e *ExecutionTree) filterForFailedExecution() *ExecutionTree { + filteredDeployItems := []*DeployItemLeaf{} + for _, depItem := range e.DeployItems { + if filteredDeployItem := depItem.filterForFailedDeployItem(); filteredDeployItem != nil { + filteredDeployItems = append(filteredDeployItems, filteredDeployItem) + } + } + + e.DeployItems = filteredDeployItems + + if len(filteredDeployItems) > 0 || e.Execution.Status.Phase == v1alpha1.ExecutionPhaseFailed { + return e + } + return nil +} + +//DeployItemLeaf contains a DeployItem. +type DeployItemLeaf struct { + DeployItem *lsv1alpha1.DeployItem `json:"deployItem,omitempty"` +} + +func (d *DeployItemLeaf) filterForFailedDeployItem() *DeployItemLeaf { + if d.DeployItem.Status.Phase == v1alpha1.ExecutionPhaseFailed { + return d + } + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/installations.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/installations.go new file mode 100644 index 000000000..19239f603 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/installations.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package installations + +import ( + "context" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/runtime" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" +) + +var ( + scheme = runtime.NewScheme() +) + +func init() { + _ = clientgoscheme.AddToScheme(scheme) + _ = lsv1alpha1.AddToScheme(scheme) +} + +// NewInstallationsCommand creates a new installations command. +func NewInstallationsCommand(ctx context.Context) *cobra.Command { + cmd := &cobra.Command{ + Use: "installations", + Aliases: []string{"inst", "installation", "i"}, + Short: "commands to interact with installations", + } + + cmd.AddCommand(NewCreateCommand(ctx)) + cmd.AddCommand(NewSetImportParametersCommand(ctx)) + cmd.AddCommand(NewInspectCommand(ctx)) + cmd.AddCommand(NewForceDeleteCommand(ctx)) + + return cmd +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/set_import_parameters.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/set_import_parameters.go new file mode 100644 index 000000000..8dab2a9d0 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/installations/set_import_parameters.go @@ -0,0 +1,166 @@ +package installations + +import ( + "context" + "fmt" + "io/ioutil" + "os" + "strconv" + "strings" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "github.com/gardener/landscaper/pkg/api" + "k8s.io/apimachinery/pkg/runtime/serializer" + "sigs.k8s.io/yaml" + + "github.com/go-logr/logr" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + + "github.com/gardener/landscapercli/pkg/logger" +) + +type importParametersOptions struct { + installationPath string + + //input parameters that should be used for the import values + importParameters map[string]string + + //outputPath is the path to write the installation.yaml to + outputPath string +} + +//NewSetImportParametersCommand sets input parameters from an installation to hardcoded values (as importDataMappings) +func NewSetImportParametersCommand(ctx context.Context) *cobra.Command { + opts := &importParametersOptions{} + cmd := &cobra.Command{ + Use: "set-import-parameters [path to installation.yaml] [key1=value1] [key2=value2]", + Aliases: []string{"sip"}, + Short: "Set import parameters for an installation. Quote values containing spaces in double quotation marks.", + Example: `landscaper-cli installations set-import-parameters .yaml importName1="string value with spaces" importName2=42`, + Args: cobra.MinimumNArgs(2), + Run: func(cmd *cobra.Command, args []string) { + if err := opts.validateArguments(args); err != nil { + cmd.PrintErr(err.Error()) + os.Exit(1) + } + + if err := opts.run(ctx, logger.Log, cmd); err != nil { + cmd.PrintErr(err.Error()) + os.Exit(1) + } + }, + } + cmd.SetOut(os.Stdout) + + opts.AddFlags(cmd.Flags()) + + return cmd +} + +func (o *importParametersOptions) validateArguments(args []string) error { + o.installationPath = args[0] + + o.importParameters = make(map[string]string) + for _, v := range args[1:] { + keyValue := strings.SplitN(v, "=", 2) + if len(keyValue) != 2 { + return fmt.Errorf("cannot split the import parameter %s at the = character.\nDid you enquote the value if it contains spaces?", keyValue) + } + o.importParameters[keyValue[0]] = keyValue[1] + } + return nil +} + +func (o *importParametersOptions) run(ctx context.Context, log logr.Logger, cmd *cobra.Command) error { + installation := lsv1alpha1.Installation{} + + err := readInstallationFromFile(o, &installation) + if err != nil { + return err + } + + err = replaceImportsWithImportParameters(&installation, o) + if err != nil { + return fmt.Errorf("error setting the import parameters: %w", err) + } + + marshaledYaml, err := yaml.Marshal(installation) + if err != nil { + return fmt.Errorf("cannot marshal yaml: %w", err) + } + outputPath := o.installationPath + if o.outputPath != "" { + outputPath = o.outputPath + } + f, err := os.Create(outputPath) + if err != nil { + return fmt.Errorf("error creating file %s: %w", outputPath, err) + } + _, err = f.Write(marshaledYaml) + if err != nil { + return fmt.Errorf("error writing file %s: %w", outputPath, err) + } + + cmd.Printf("Wrote installation to %s", o.outputPath) + return nil +} + +func (o *importParametersOptions) AddFlags(fs *pflag.FlagSet) { + fs.StringVarP(&o.outputPath, "output-file", "o", "", "file path for the resulting installation yaml (default: overwrite the given installation file)") +} + +func replaceImportsWithImportParameters(installation *lsv1alpha1.Installation, o *importParametersOptions) error { + validImportDataMappings := make(map[string]lsv1alpha1.AnyJSON) + + //find all imports.data that are specified in importParameters + for _, importData := range installation.Spec.Imports.Data { + if importParameter, ok := o.importParameters[importData.Name]; ok { + validImportDataMappings[importData.Name] = createJSONRawMessageValueWithStringOrNumericType(importParameter) + } + } + + //check for any not used importParameters + for k := range o.importParameters { + if _, ok := validImportDataMappings[k]; !ok { + return fmt.Errorf(`import parameter '%s' not found in the installation`, k) + } + } + + //modify the installation + for importName, importDataMappingValue := range validImportDataMappings { + if installation.Spec.ImportDataMappings == nil { + installation.Spec.ImportDataMappings = make(map[string]lsv1alpha1.AnyJSON) + } + //add to importDataMappings + installation.Spec.ImportDataMappings[importName] = importDataMappingValue + + //remove from imports.data + for i, importData := range installation.Spec.Imports.Data { + if importData.Name == importName { + installation.Spec.Imports.Data = append(installation.Spec.Imports.Data[:i], installation.Spec.Imports.Data[i+1:]...) + } + } + } + + return nil +} + +func createJSONRawMessageValueWithStringOrNumericType(parameter string) lsv1alpha1.AnyJSON { + if _, err := strconv.ParseFloat(parameter, 64); err == nil { + return lsv1alpha1.AnyJSON{RawMessage: []byte(parameter)} + } + return lsv1alpha1.AnyJSON{RawMessage: []byte(fmt.Sprintf(`"%s"`, parameter))} + +} + +func readInstallationFromFile(o *importParametersOptions, installation *lsv1alpha1.Installation) error { + installationFileData, err := ioutil.ReadFile(o.installationPath) + if err != nil { + return err + } + if _, _, err := serializer.NewCodecFactory(api.LandscaperScheme).UniversalDecoder().Decode(installationFileData, nil, installation); err != nil { + return err + } + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/install.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/install.go new file mode 100644 index 000000000..1f622dc3c --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/install.go @@ -0,0 +1,381 @@ +package quickstart + +import ( + "context" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "os" + "path" + "strings" + + "sigs.k8s.io/yaml" + + "github.com/gardener/landscapercli/pkg/version" + + "github.com/go-logr/logr" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + corev1 "k8s.io/api/core/v1" + k8sErrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/clientcmd" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/gardener/landscapercli/pkg/logger" + "github.com/gardener/landscapercli/pkg/util" +) + +const ( + defaultNamespace = "landscaper" +) + +type installOptions struct { + // CLI flags + kubeconfigPath string + namespace string + instOCIRegistry bool + instRegistryIngress bool + landscaperValuesPath string + landscaperChartVersion string + registryUsername string + registryPassword string + + // set during execution + registryIngressHost string + landscaperValues landscaperValues +} + +type landscaperValues struct { + Landscaper landscaperconfig `json:"landscaper"` +} + +type landscaperconfig struct { + Landscaper landscaper `json:"landscaper"` +} + +type landscaper struct { + RegistryConfig registryConfig `json:"registryConfig"` +} + +type registryConfig struct { + AllowPlainHttpRegistries bool `json:"allowPlainHttpRegistries"` + Secrets secrets `json:"secrets"` +} + +type secrets struct { + Defaults defaults `json:"default"` +} + +type defaults struct { + Auths map[string]interface{} `json:"auths"` +} + +func NewInstallCommand(ctx context.Context) *cobra.Command { + opts := &installOptions{} + cmd := &cobra.Command{ + Use: "install --kubeconfig [kubconfig.yaml] --landscaper-values [landscaper-values.yaml] --namespace landscaper --install-oci-registry --install-registry-ingress --registry-username testuser --registry-password some-pw", + Aliases: []string{"i"}, + Short: "command to install Landscaper (including Container, Helm, and Manifest deployers) in a target cluster. An OCI registry for testing can be optionally installed", + Example: "landscaper-cli quickstart install --kubeconfig ./kubconfig.yaml --landscaper-values ./landscaper-values.yaml --namespace landscaper --install-oci-registry --install-registry-ingress --registry-username testuser --registry-password some-pw", + Run: func(cmd *cobra.Command, args []string) { + if err := opts.Complete(args); err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + + if err := opts.run(ctx, logger.Log); err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + }, + } + + opts.AddFlags(cmd.Flags()) + + return cmd +} + +func (o *installOptions) AddFlags(fs *pflag.FlagSet) { + fs.StringVar(&o.kubeconfigPath, "kubeconfig", "", "path to the kubeconfig of the target cluster") + fs.StringVar(&o.namespace, "namespace", defaultNamespace, "namespace where Landscaper and the OCI registry will get installed") + fs.StringVar(&o.landscaperValuesPath, "landscaper-values", "", "path to values.yaml for the Landscaper Helm installation") + fs.BoolVar(&o.instOCIRegistry, "install-oci-registry", false, "install an OCI registry in the target cluster") + fs.BoolVar(&o.instRegistryIngress, "install-registry-ingress", false, `install an ingress for accessing the OCI registry. +the credentials must be provided via the flags "--registry-username" and "--registry-password". +the Landscaper instance will then be automatically configured with these credentials. +prerequisites (!): + - the target cluster must be a Gardener Shoot (TLS is provided via the Gardener cert manager) + - a nginx ingress controller must be deployed in the target cluster + - the command "htpasswd" must be installed on your local machine`) + fs.StringVar(&o.landscaperChartVersion, "landscaper-chart-version", version.LandscaperChartVersion, + "use a custom Landscaper chart version (corresponds to Landscaper Github release with the same version number)") + fs.StringVar(&o.registryUsername, "registry-username", "", "username for authenticating at the OCI registry") + fs.StringVar(&o.registryPassword, "registry-password", "", "password for authenticating at the OCI registry") +} + +func (o *installOptions) ReadLandscaperValues() error { + content, err := ioutil.ReadFile(o.landscaperValuesPath) + if err != nil { + return fmt.Errorf("cannot read file: %w", err) + } + + unmarshaledContent := landscaperValues{} + if err := yaml.Unmarshal(content, &unmarshaledContent); err != nil { + return fmt.Errorf("cannot unmarshall file content: %w", err) + } + + if unmarshaledContent.Landscaper.Landscaper.RegistryConfig.Secrets.Defaults.Auths == nil { + unmarshaledContent.Landscaper.Landscaper.RegistryConfig.Secrets.Defaults.Auths = map[string]interface{}{} + } + + o.landscaperValues = unmarshaledContent + + return nil +} + +func (o *installOptions) run(ctx context.Context, log logr.Logger) error { + cfg, err := clientcmd.BuildConfigFromFlags("", o.kubeconfigPath) + if err != nil { + return fmt.Errorf("cannot parse K8s config: %w", err) + } + + k8sClient, err := client.New(cfg, client.Options{ + Scheme: scheme, + }) + if err != nil { + return fmt.Errorf("cannot build K8s client: %w", err) + } + + if o.instOCIRegistry && o.instRegistryIngress { + registryIngressHost := strings.Replace(cfg.Host, "https://api", "o.ingress", 1) + if len(registryIngressHost) > 64 { + return fmt.Errorf("no TLS certificate could be created because domain exceeds 64 characters: " + registryIngressHost) + } + o.registryIngressHost = registryIngressHost + } + + if o.landscaperValuesPath != "" { + if err := o.ReadLandscaperValues(); err != nil { + return fmt.Errorf("cannot read landscaper values: %w", err) + } + } + + if err := o.checkConfiguration(); err != nil { + return fmt.Errorf("invalid configuration: %w", err) + } + + if err := o.createNamespace(ctx, k8sClient); err != nil { + return err + } + + if o.instOCIRegistry { + if err := o.installOCIRegistry(ctx, k8sClient); err != nil { + return fmt.Errorf("cannot install OCI registry: %w", err) + } + } + + if err := o.installLandscaper(ctx); err != nil { + return fmt.Errorf("cannot install landscaper: %w", err) + } + + if o.instOCIRegistry { + if o.instRegistryIngress { + fmt.Println("The OCI registry can be accessed via the URL https://" + o.registryIngressHost) + fmt.Println("It might take some minutes until the TLS certificate is created") + } else { + fmt.Println("The OCI registry can be accessed via kubectl port-forward 5000:5000") + } + } + + return nil +} + +func (o *installOptions) createNamespace(ctx context.Context, k8sClient client.Client) error { + fmt.Printf("Creating namespace %s\n", o.namespace) + + ns := &corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: o.namespace, + }, + } + if err := k8sClient.Create(ctx, ns, &client.CreateOptions{}); err != nil { + if k8sErrors.IsAlreadyExists(err) { + fmt.Printf("Namespace %s already exists...Skipping\n\n", o.namespace) + } else { + return fmt.Errorf("cannot create namespace: %w", err) + } + } else { + fmt.Printf("Namespace creation succeeded!\n\n") + } + + return nil +} + +func (o *installOptions) checkConfiguration() error { + // check that the credentials for the OCI registry we will create are not set in the values from the user + if o.instOCIRegistry && o.instRegistryIngress { + registryAuths := o.landscaperValues.Landscaper.Landscaper.RegistryConfig.Secrets.Defaults.Auths + _, ok := registryAuths[o.registryIngressHost] + if ok { + return fmt.Errorf("registry credentials for %s are already set in the provided Landscaper values. please remove them from your configuration as they will get configured automatically", o.registryIngressHost) + } + } + + allowHttpRegistries := o.landscaperValues.Landscaper.Landscaper.RegistryConfig.AllowPlainHttpRegistries + allowHttpRegistriesPath := "landscaper.landscaper.registryConfig.allowPlainHttpRegistries" + + // if OCI registry is exposed via ingress, allowHttpRegistries must be false + if o.instOCIRegistry && o.instRegistryIngress && allowHttpRegistries { + return fmt.Errorf("%s must be set to false when installing Landscaper together with the OCI registry with ingress access", allowHttpRegistriesPath) + } + + // if OCI registry is cluster-internal, allowHttpRegistries must be true + if o.instOCIRegistry && !o.instRegistryIngress && !allowHttpRegistries { + return fmt.Errorf("%s must be set to true when installing Landscaper together with the OCI registry without ingress access", allowHttpRegistriesPath) + } + + return nil +} + +func (o *installOptions) Complete(args []string) error { + if !o.instOCIRegistry && o.instRegistryIngress { + return fmt.Errorf("you can only set --install-registry-ingress to true together with --install-oci-registry") + } + + if o.instOCIRegistry { + if o.instRegistryIngress { + if o.registryUsername == "" { + return fmt.Errorf("username must be provided if --install-registry-ingress is set to true") + } + if o.registryPassword == "" { + return fmt.Errorf("password must be provided if --install-registry-ingress is set to true") + } + } + } + return nil +} + +func (o *installOptions) installLandscaper(ctx context.Context) error { + fmt.Println("Installing Landscaper") + + tempDir, err := ioutil.TempDir(".", "landscaper-chart-tmp-*") + if err != nil { + return err + } + defer func() { + if err := os.RemoveAll(tempDir); err != nil { + fmt.Printf("cannot remove temporary directory %s: %s", tempDir, err.Error()) + } + }() + + landscaperChartURI := fmt.Sprintf("oci://eu.gcr.io/gardener-project/landscaper/charts/landscaper --untar --version %s", o.landscaperChartVersion) + pullCmd := fmt.Sprintf("helm pull %s -d %s", landscaperChartURI, tempDir) + if err := util.ExecCommandBlocking(pullCmd); err != nil { + return err + } + + fileInfos, err := ioutil.ReadDir(tempDir) + if err != nil { + return err + } + + if len(fileInfos) != 1 { + return errors.New("found more than 1 item in temp directory for Helm Chart export") + } + chartPath := path.Join(tempDir, fileInfos[0].Name()) + + landscaperValuesOverride := fmt.Sprintf(` +landscaper: + landscaper: + deployers: + - container + - helm + - manifest + deployerManagement: + namespace: %s + agent: + namespace: %s +`, o.namespace, o.namespace) + + if o.instRegistryIngress { + // when installing the ingress, we must add the registry credentials to the Landscaper values file + // also, we must keep any other set of credentials that might have been configured for another registry + + credentials := fmt.Sprintf("%s:%s", o.registryUsername, o.registryPassword) + encodedCredentials := base64.StdEncoding.EncodeToString([]byte(credentials)) + + if o.landscaperValues.Landscaper.Landscaper.RegistryConfig.Secrets.Defaults.Auths == nil { + o.landscaperValues.Landscaper.Landscaper.RegistryConfig.Secrets.Defaults.Auths = map[string]interface{}{} + } + registryAuths := o.landscaperValues.Landscaper.Landscaper.RegistryConfig.Secrets.Defaults.Auths + registryAuths[o.registryIngressHost] = map[string]interface{}{ + "auth": encodedCredentials, + } + + marshaledRegistryAuths, err := json.Marshal(registryAuths) + if err != nil { + return fmt.Errorf("cannot marshal registry auths: %w", err) + } + + landscaperValuesOverride = fmt.Sprintf(`%s + registryConfig: + secrets: + default: { + "auths": %s + } +`, landscaperValuesOverride, string(marshaledRegistryAuths)) + } + + tmpFile, err := ioutil.TempFile(".", "landscaper-values-override-") + if err != nil { + return fmt.Errorf("cannot create temporary file: %w", err) + } + defer func() { + if err := os.Remove(tmpFile.Name()); err != nil { + fmt.Printf("cannot remove temporary file %s: %s\n", tmpFile.Name(), err.Error()) + } + }() + + if err := ioutil.WriteFile(tmpFile.Name(), []byte(landscaperValuesOverride), os.ModePerm); err != nil { + return fmt.Errorf("cannot write to file: %w", err) + } + + installCommand := fmt.Sprintf( + "helm upgrade --install --namespace %s landscaper %s --kubeconfig %s -f %s -f %s", + o.namespace, + chartPath, + o.kubeconfigPath, + o.landscaperValuesPath, + tmpFile.Name(), + ) + + if err := util.ExecCommandBlocking(installCommand); err != nil { + return err + } + + fmt.Printf("Landscaper installation succeeded!\n\n") + return nil +} + +func (o *installOptions) installOCIRegistry(ctx context.Context, k8sClient client.Client) error { + fmt.Println("Installing OCI registry") + + ociRegistryOpts := &ociRegistryOpts{ + namespace: o.namespace, + installIngress: o.instRegistryIngress, + ingressHost: o.registryIngressHost, + username: o.registryUsername, + password: o.registryPassword, + } + ociRegistry := NewOCIRegistry(ociRegistryOpts, k8sClient) + + if err := ociRegistry.install(ctx); err != nil { + return err + } + + fmt.Print("OCI registry installation succeeded!\n\n") + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/oci_registry.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/oci_registry.go new file mode 100644 index 000000000..b0082007b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/oci_registry.go @@ -0,0 +1,346 @@ +package quickstart + +import ( + "context" + "fmt" + "os/exec" + + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1" + k8sErrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ociRegistry struct { + k8sClient client.Client + opts ociRegistryOpts +} + +type ociRegistryOpts struct { + namespace string + installIngress bool + ingressHost string + username string + password string + + // set during execution + ingressAuthData []byte +} + +func NewOCIRegistry(opts *ociRegistryOpts, k8sClient client.Client) *ociRegistry { + obj := &ociRegistry{ + k8sClient: k8sClient, + opts: *opts, + } + return obj +} + +func (r *ociRegistry) install(ctx context.Context) error { + if r.opts.installIngress { + cmd := exec.Command("htpasswd", "-n", "-b", r.opts.username, r.opts.password) + ingressAuthData, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to encrypt ingress credentials: %w", err) + } + r.opts.ingressAuthData = ingressAuthData + } + + deployment, pvc, service, authSecret, ingress, _ := r.createK8sObjects() + + fmt.Printf("Creating deployment %s in namespace %s\n", deployment.Name, r.opts.namespace) + if err := r.k8sClient.Create(ctx, deployment, &client.CreateOptions{}); err != nil { + if k8sErrors.IsAlreadyExists(err) { + fmt.Println("Deployment already exists...Skipping") + } else { + return err + } + } + + fmt.Printf("Creating persitent volume claim %s in namespace %s\n", pvc.Name, r.opts.namespace) + if err := r.k8sClient.Create(ctx, pvc, &client.CreateOptions{}); err != nil { + if k8sErrors.IsAlreadyExists(err) { + fmt.Println("Persitent Volume Claim already exists...Skipping") + } else { + return err + } + } + + fmt.Printf("Creating service %s in namespace %s\n", service.Name, r.opts.namespace) + if err := r.k8sClient.Create(ctx, service, &client.CreateOptions{}); err != nil { + if k8sErrors.IsAlreadyExists(err) { + fmt.Println("Service already exists...Skipping") + } else { + return err + } + } + + if r.opts.installIngress { + fmt.Printf("Creating ingress authentication secret %s in namespace %s\n", authSecret.Name, r.opts.namespace) + if err := r.k8sClient.Create(ctx, authSecret, &client.CreateOptions{}); err != nil { + if k8sErrors.IsAlreadyExists(err) { + fmt.Println("Secret already exists...Skipping") + } else { + return err + } + } + + fmt.Printf("Creating ingress %s in namespace %s\n", ingress.Name, r.opts.namespace) + if err := r.k8sClient.Create(ctx, ingress, &client.CreateOptions{}); err != nil { + if k8sErrors.IsAlreadyExists(err) { + fmt.Println("Ingress already exists...Skipping") + } else { + return err + } + } + } + + return nil +} + +func (r *ociRegistry) uninstall(ctx context.Context) error { + deployment, pvc, service, authSecret, ingress, oldIngress := r.createK8sObjects() + + fmt.Printf("Deleting deployment %s in namespace %s\n", deployment.Name, r.opts.namespace) + if err := r.k8sClient.Delete(ctx, deployment, &client.DeleteOptions{}); err != nil { + if k8sErrors.IsNotFound(err) { + fmt.Println("Deployment not found...Skipping") + } else { + return err + } + } + + fmt.Printf("Deleting persitent volume claim %s in namespace %s\n", pvc.Name, r.opts.namespace) + if err := r.k8sClient.Delete(ctx, pvc, &client.DeleteOptions{}); err != nil { + if k8sErrors.IsNotFound(err) { + fmt.Println("PersistentVolumeClaim not found...Skipping") + } else { + return err + } + } + + fmt.Printf("Deleting service %s in namespace %s\n", service.Name, r.opts.namespace) + if err := r.k8sClient.Delete(ctx, service, &client.DeleteOptions{}); err != nil { + if k8sErrors.IsNotFound(err) { + fmt.Println("Service not found...Skipping") + } else { + return err + } + } + + fmt.Printf("Deleting ingress %s in namespace %s\n", ingress.Name, r.opts.namespace) + if err := r.k8sClient.Delete(ctx, ingress, &client.DeleteOptions{}); err != nil { + if k8sErrors.IsNotFound(err) { + fmt.Println("Ingress not found...Skipping") + } else { + fmt.Printf("Deleting old ingress %s in namespace %s\n", ingress.Name, r.opts.namespace) + err2 := r.k8sClient.Delete(ctx, oldIngress, &client.DeleteOptions{}) + if k8sErrors.IsNotFound(err2) { + fmt.Println("Old ingress not found...Skipping") + } else { + return err + } + } + } + + fmt.Printf("Deleting ingress authentication secret %s in namespace %s\n", authSecret.Name, r.opts.namespace) + if err := r.k8sClient.Delete(ctx, authSecret, &client.DeleteOptions{}); err != nil { + if k8sErrors.IsNotFound(err) { + fmt.Println("Ingress authentication secret not found...Skipping") + } else { + return err + } + } + + tlsSecretName := ingress.Spec.TLS[0].SecretName + fmt.Printf("Deleting ingress tls secret %s in namespace %s\n", tlsSecretName, r.opts.namespace) + tlsSecret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: tlsSecretName, + Namespace: r.opts.namespace, + }, + } + if err := r.k8sClient.Delete(ctx, tlsSecret, &client.DeleteOptions{}); err != nil { + if k8sErrors.IsNotFound(err) { + fmt.Println("Ingress tls secret not found...Skipping") + } else { + return err + } + } + + return nil +} + +func (r *ociRegistry) createK8sObjects() (*appsv1.Deployment, *corev1.PersistentVolumeClaim, *corev1.Service, *corev1.Secret, *networking.Ingress, *v1beta1.Ingress) { + const ( + appName = "oci-registry" + pvcName = appName + "-data" + pvcSize = "5Gi" + authSecretName = appName + "-auth" + tlsSecretName = appName + "-tls" + containerPort = 5000 + ) + + labels := map[string]string{ + "app": appName, + } + + deployment := &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: appName, + Namespace: r.opts.namespace, + Labels: labels, + }, + Spec: appsv1.DeploymentSpec{ + Selector: &metav1.LabelSelector{ + MatchLabels: labels, + }, + Template: corev1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: labels, + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + { + Name: "registry", + Image: "registry:2", + ImagePullPolicy: corev1.PullIfNotPresent, + Ports: []corev1.ContainerPort{ + { + ContainerPort: containerPort, + }, + }, + VolumeMounts: []corev1.VolumeMount{ + { + Name: "registry-data", + MountPath: "/var/lib/registry", + }, + }, + }, + }, + Volumes: []corev1.Volume{ + { + Name: "registry-data", + VolumeSource: corev1.VolumeSource{ + PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ + ClaimName: pvcName, + }, + }, + }, + }, + }, + }, + }, + } + + pvc := &corev1.PersistentVolumeClaim{ + ObjectMeta: metav1.ObjectMeta{ + Name: pvcName, + Namespace: r.opts.namespace, + Labels: labels, + }, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{ + corev1.ReadWriteOnce, + }, + Resources: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceStorage: resource.MustParse(pvcSize), + }, + }, + }, + } + + service := &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: appName, + Namespace: r.opts.namespace, + Labels: labels, + }, + Spec: corev1.ServiceSpec{ + Type: corev1.ServiceTypeClusterIP, + Selector: labels, + Ports: []corev1.ServicePort{ + { + Port: containerPort, + Protocol: corev1.ProtocolTCP, + }, + }, + }, + } + + authSecret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: authSecretName, + Namespace: r.opts.namespace, + Labels: labels, + }, + StringData: map[string]string{ + "auth": string(r.opts.ingressAuthData), + }, + Type: corev1.SecretTypeOpaque, + } + + pathType := networking.PathTypePrefix + ingress := &networking.Ingress{ + ObjectMeta: metav1.ObjectMeta{ + Name: appName, + Namespace: r.opts.namespace, + Labels: labels, + Annotations: map[string]string{ + "cert.gardener.cloud/purpose": "managed", + "dns.gardener.cloud/class": "garden", + "dns.gardener.cloud/dnsnames": r.opts.ingressHost, + "nginx.ingress.kubernetes.io/auth-type": "basic", + "nginx.ingress.kubernetes.io/auth-secret": authSecretName, + "nginx.ingress.kubernetes.io/auth-realm": "Authentication Required", + "nginx.ingress.kubernetes.io/proxy-body-size": "100m", + }, + }, + Spec: networking.IngressSpec{ + TLS: []networking.IngressTLS{ + { + Hosts: []string{ + r.opts.ingressHost, + }, + SecretName: tlsSecretName, // gardener will create a secret with this name + }, + }, + Rules: []networking.IngressRule{ + { + Host: r.opts.ingressHost, + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ + { + Path: "/", + PathType: &pathType, + Backend: networking.IngressBackend{ + Service: &networking.IngressServiceBackend{ + Name: appName, + Port: networking.ServiceBackendPort{ + Number: containerPort, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + oldIngress := &v1beta1.Ingress{ + ObjectMeta: metav1.ObjectMeta{ + Name: appName, + Namespace: r.opts.namespace, + }, + } + + return deployment, pvc, service, authSecret, ingress, oldIngress +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/quickstart.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/quickstart.go new file mode 100644 index 000000000..c72a33148 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/quickstart.go @@ -0,0 +1,32 @@ +package quickstart + +import ( + "context" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/runtime" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" +) + +var ( + scheme = runtime.NewScheme() +) + +func init() { + _ = clientgoscheme.AddToScheme(scheme) + _ = lsv1alpha1.AddToScheme(scheme) +} + +func NewQuickstartCommand(ctx context.Context) *cobra.Command { + cmd := &cobra.Command{ + Use: "quickstart", + Aliases: []string{"qs"}, + Short: "useful commands for getting quickly up and running with Landscaper", + } + + cmd.AddCommand(NewInstallCommand(ctx)) + cmd.AddCommand(NewUninstallCommand(ctx)) + + return cmd +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/uninstall.go b/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/uninstall.go new file mode 100644 index 000000000..ee29e79e4 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/cmd/quickstart/uninstall.go @@ -0,0 +1,181 @@ +package quickstart + +import ( + "context" + "fmt" + "os" + "strings" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + + "github.com/go-logr/logr" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + corev1 "k8s.io/api/core/v1" + k8sErrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/client-go/tools/clientcmd" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/gardener/landscaper/apis/core/v1alpha1" + + "github.com/gardener/landscapercli/pkg/logger" + "github.com/gardener/landscapercli/pkg/util" +) + +type uninstallOptions struct { + kubeconfigPath string + namespace string + deleteNamespace bool +} + +func NewUninstallCommand(ctx context.Context) *cobra.Command { + opts := &uninstallOptions{} + cmd := &cobra.Command{ + Use: "uninstall --kubeconfig [kubconfig.yaml] --delete-namespace", + Aliases: []string{"u"}, + Short: "command to uninstall Landscaper and OCI registry (from the install command) in a target cluster", + Example: "landscaper-cli quickstart uninstall --kubeconfig ./kubconfig.yaml --namespace landscaper --delete-namespace", + Run: func(cmd *cobra.Command, args []string) { + if err := opts.Complete(args); err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + + if err := opts.run(ctx, logger.Log); err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + }, + } + + opts.AddFlags(cmd.Flags()) + + return cmd +} + +func (o *uninstallOptions) run(ctx context.Context, log logr.Logger) error { + cfg, err := clientcmd.BuildConfigFromFlags("", o.kubeconfigPath) + if err != nil { + return fmt.Errorf("cannot parse K8s config: %w", err) + } + + k8sClient, err := client.New(cfg, client.Options{ + Scheme: scheme, + }) + if err != nil { + return fmt.Errorf("cannot build K8s client: %w", err) + } + + key := client.ObjectKey{ + Name: o.namespace, + } + ns := corev1.Namespace{} + if err := k8sClient.Get(ctx, key, &ns); err != nil { + if k8sErrors.IsNotFound(err) { + fmt.Printf("Cannot find namespace %s\n", o.namespace) + return nil + } + return fmt.Errorf("cannot get namespace: %w", err) + } + + fmt.Println("Uninstall OCI Registry") + if err := o.uninstallOCIRegistry(ctx, k8sClient); err != nil { + return fmt.Errorf("cannot uninstall OCI registry: %w", err) + } + fmt.Print("OCI registry uninstall succeeded!\n\n") + + fmt.Println("Uninstall Landscaper") + if err := o.uninstallLandscaper(ctx, k8sClient); err != nil { + return fmt.Errorf("cannot uninstall landscaper: %w", err) + } + fmt.Println("Landscaper uninstall succeeded!") + + return nil +} + +func (o *uninstallOptions) Complete(args []string) error { + return nil +} + +func (o *uninstallOptions) AddFlags(fs *pflag.FlagSet) { + fs.StringVar(&o.kubeconfigPath, "kubeconfig", "", "path to the kubeconfig of the target cluster") + fs.StringVar(&o.namespace, "namespace", defaultNamespace, "namespace where Landscaper and the OCI registry are installed") + fs.BoolVar(&o.deleteNamespace, "delete-namespace", false, "deletes the namespace (otherwise secrets, service accounts etc. of the landscaper installation in the namespace are not removed)") +} + +func (o *uninstallOptions) uninstallOCIRegistry(ctx context.Context, k8sClient client.Client) error { + ociRegistryOpts := &ociRegistryOpts{ + namespace: o.namespace, + } + ociRegistry := NewOCIRegistry(ociRegistryOpts, k8sClient) + return ociRegistry.uninstall(ctx) +} + +func (o *uninstallOptions) uninstallLandscaper(ctx context.Context, k8sClient client.Client) error { + fmt.Println("Removing deployer registrations") + deployerRegistrations := v1alpha1.DeployerRegistrationList{} + if err := k8sClient.List(ctx, &deployerRegistrations); err != nil { + return err + } + + for _, registration := range deployerRegistrations.Items { + if err := k8sClient.Delete(ctx, ®istration); err != nil { + return err + } + } + + if err := waitForRegistrationsRemoved(ctx, k8sClient); err != nil { + return err + } + + err := util.ExecCommandBlocking(fmt.Sprintf("helm delete --namespace %s landscaper --kubeconfig %s", o.namespace, o.kubeconfigPath)) + if err != nil { + if strings.Contains(err.Error(), "not found") { + // Ignore error if the release that should be deleted was not found ;) + fmt.Println("Release not found...Skipping") + } else { + return err + } + } + + if o.deleteNamespace { + fmt.Println("Removing namespace") + namespace := corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{Name: o.namespace}, + } + + if err := k8sClient.Delete(ctx, &namespace); err != nil { + return err + } + } + + return nil +} + +func waitForRegistrationsRemoved(ctx context.Context, k8sClient client.Client) error { + timeoutCtx, cancel := context.WithTimeout(ctx, 4*time.Minute) + defer cancel() + + err := wait.PollImmediateUntil(10*time.Second, func() (done bool, err error) { + fmt.Println("waiting for deployer registrations removed") + + deployerRegistrations := v1alpha1.DeployerRegistrationList{} + if err := k8sClient.List(ctx, &deployerRegistrations); err != nil { + return false, err + } + + if len(deployerRegistrations.Items) == 0 { + return true, nil + } + + return false, nil + }, timeoutCtx.Done()) + + if err != nil { + return fmt.Errorf("error while waiting for deployer registrations being removed: %w", err) + } + + return nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/config.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/config.go new file mode 100644 index 000000000..5e615bb99 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/config.go @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package logger + +import ( + flag "github.com/spf13/pflag" + "go.uber.org/zap" +) + +type Config struct { + flagset *flag.FlagSet + + Development bool + Cli bool + Verbosity int + DisableStacktrace bool + DisableCaller bool + DisableTimestamp bool +} + +func InitFlags(flagset *flag.FlagSet) { + if flagset == nil { + flagset = flag.CommandLine + } + fs := flag.NewFlagSet("log", flag.ExitOnError) + + fs.BoolVar(&configFromFlags.Development, "dev", false, "enable development logging which result in console encoding, enabled stacktrace and enabled caller") + fs.BoolVar(&configFromFlags.Cli, "cli", false, "logger runs as cli logger. enables cli logging") + fs.IntVarP(&configFromFlags.Verbosity, "verbosity", "v", 1, "number for the log level verbosity") + fs.BoolVar(&configFromFlags.DisableStacktrace, "disable-stacktrace", true, "disable the stacktrace of error logs") + fs.BoolVar(&configFromFlags.DisableCaller, "disable-caller", true, "disable the caller of logs") + fs.BoolVar(&configFromFlags.DisableTimestamp, "disable-timestamp", true, "disable timestamp output") + + configFromFlags.flagset = fs + flagset.AddFlagSet(configFromFlags.flagset) +} + +// SetDisableStacktrace dis- or enables the stackstrace according to the provided flag if the flag was provided +func (c *Config) SetDisableStacktrace(zapCfg *zap.Config) { + if c.flagset == nil || c.flagset.Changed("disable-stacktrace") { + zapCfg.DisableStacktrace = c.DisableStacktrace + } +} + +// SetDisableCaller dis- or enables the caller according to the provided flag if the flag was provided +func (c *Config) SetDisableCaller(zapCfg *zap.Config) { + if c.flagset == nil || c.flagset.Changed("disable-caller") { + zapCfg.DisableCaller = c.DisableCaller + } +} + +// SetTimestamp dis- or enables the logging of timestamps according to the provided flag if the flag was provided +func (c *Config) SetTimestamp(zapCfg *zap.Config) { + if c.flagset == nil || c.flagset.Changed("disable-timestamp") { + if c.DisableTimestamp { + zapCfg.EncoderConfig.TimeKey = "" + } else { + zapCfg.EncoderConfig.TimeKey = "ts" + } + } +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/helper.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/helper.go new file mode 100644 index 000000000..9d7db7691 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/helper.go @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package logger + +import "fmt" + +func Logf(logFunc func(msg string, keysAndValues ...interface{}), format string, a ...interface{}) { + message := fmt.Sprintf(format, a...) + logFunc(message) +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/logger.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/logger.go new file mode 100644 index 000000000..814fb784b --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/logger/logger.go @@ -0,0 +1,131 @@ +// SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package logger + +import ( + "github.com/go-logr/logr" + "github.com/go-logr/zapr" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +var ( + Log logr.Logger + configFromFlags = Config{} +) + +var encoderConfig = zapcore.EncoderConfig{ + TimeKey: "ts", + LevelKey: "level", + NameKey: "logger", + CallerKey: "caller", + MessageKey: "msg", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.LowercaseLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.SecondsDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, +} + +var cliEncoderConfig = zapcore.EncoderConfig{ + TimeKey: "", + LevelKey: "level", + NameKey: "logger", + CallerKey: "caller", + MessageKey: "msg", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.LowercaseColorLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.SecondsDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, +} + +var defaultConfig = zap.Config{ + Level: zap.NewAtomicLevelAt(zap.InfoLevel), + Development: true, + Encoding: "console", + DisableStacktrace: false, + DisableCaller: false, + EncoderConfig: encoderConfig, + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, +} + +var cliConfig = zap.Config{ + Level: zap.NewAtomicLevelAt(zap.InfoLevel), + Development: false, + Encoding: "console", + DisableStacktrace: false, + DisableCaller: true, + EncoderConfig: cliEncoderConfig, + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, +} + +var productionConfig = zap.Config{ + Level: zap.NewAtomicLevelAt(zap.InfoLevel), + Development: false, + DisableStacktrace: true, + DisableCaller: true, + Encoding: "json", + EncoderConfig: encoderConfig, + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, +} + +func New(config *Config) (logr.Logger, error) { + if config == nil { + config = &configFromFlags + } + zapCfg := determineZapConfig(config) + + level := int8(0 - config.Verbosity) + zapCfg.Level = zap.NewAtomicLevelAt(zapcore.Level(level)) + + zapLog, err := zapCfg.Build(zap.AddCallerSkip(1)) + if err != nil { + return nil, err + } + return zapr.NewLogger(zapLog), nil +} + +func SetLogger(log logr.Logger) { + Log = log +} + +// NewCliLogger creates a new logger for cli usage. +// CLI usage means that by default: +// - the default dev config +// - encoding is console +// - timestamps are disabled (can be still activated by the cli flag) +// - level are color encoded +func NewCliLogger() (logr.Logger, error) { + config := &configFromFlags + config.Cli = true + return New(config) +} + +func determineZapConfig(loggerConfig *Config) zap.Config { + var zapConfig zap.Config + if loggerConfig.Development { + zapConfig = defaultConfig + } else if loggerConfig.Cli { + zapConfig = cliConfig + if loggerConfig.Development { + zapConfig.Development = true + loggerConfig.DisableCaller = false + } + } else { + zapConfig = productionConfig + } + + loggerConfig.SetDisableCaller(&zapConfig) + loggerConfig.SetDisableStacktrace(&zapConfig) + loggerConfig.SetTimestamp(&zapConfig) + + return zapConfig +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/cmd.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/cmd.go new file mode 100644 index 000000000..d84c0e530 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/cmd.go @@ -0,0 +1,86 @@ +package util + +import ( + "bytes" + "fmt" + "os" + "os/exec" + "strings" +) + +// ExecCommandBlocking executes a command and wait for its completion. +func ExecCommandBlocking(command string) error { + fmt.Printf("Executing: %s\n", command) + + arr := strings.Split(command, " ") + + if arr[0] == "helm" { + helmPath := os.Getenv("HELM_EXECUTABLE") + if helmPath != "" { + arr[0] = helmPath + fmt.Printf("Using helm binary: %s\n", arr[0]) + } + } + + cmd := exec.Command(arr[0], arr[1:]...) + cmd.Env = []string{"HELM_EXPERIMENTAL_OCI=1", "HOME=" + os.Getenv("HOME"), "PATH=" + os.Getenv("PATH")} + out, err := cmd.CombinedOutput() + outStr := string(out) + + if err != nil { + return fmt.Errorf("failed with error: %s:\n%s\n", err, outStr) + } + fmt.Println("Executed sucessfully!") + + return nil +} + +type CmdResult struct { + Error error + Stdout string + StdErr string +} + +// ExecCommandNonBlocking executes a command without without blocking. Returns a Cmd that can be used to stop the command. +// When the command has stopped or failed, the result is written into the channel resultCh. +func ExecCommandNonBlocking(command string, resultCh chan<- CmdResult) (*exec.Cmd, error) { + fmt.Printf("Executing: %s\n", command) + + arr := strings.Split(command, " ") + + if arr[0] == "helm" { + helmPath := os.Getenv("HELM_EXECUTABLE") + if helmPath != "" { + arr[0] = helmPath + fmt.Printf("Using helm binary: %s\n", arr[0]) + } + } + + outbuf := bytes.Buffer{} + errbuf := bytes.Buffer{} + + cmd := exec.Command(arr[0], arr[1:]...) + cmd.Env = []string{"HELM_EXPERIMENTAL_OCI=1", "HOME=" + os.Getenv("HOME"), "PATH=" + os.Getenv("PATH")} + cmd.Stderr = &outbuf + cmd.Stdout = &errbuf + + err := cmd.Start() + if err != nil { + fmt.Printf("Failed with error: %s:\n", err) + return nil, err + } + fmt.Println("Started sucessfully!") + + go func() { + exitErr := cmd.Wait() + res := CmdResult{ + Error: exitErr, + Stdout: outbuf.String(), + StdErr: outbuf.String(), + } + resultCh <- res + close(resultCh) + }() + + return cmd, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/const.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/const.go new file mode 100644 index 000000000..1a5de0003 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/const.go @@ -0,0 +1,9 @@ +package util + +const ( + // LogLevelDebug : Log level constants for debug level. Larger numbers represent less important logs. + LogLevelDebug = 1 + + // LogLevelWarning : Log level constants for warning level. Larger numbers represent less important logs. + LogLevelWarning = -1 +) diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/file.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/file.go new file mode 100644 index 000000000..a4e5c4a74 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/file.go @@ -0,0 +1,26 @@ +package util + +import ( + "io" + "os" +) + +func IsDirectoryEmpty(path string) (bool, error) { + f, err := os.Open(path) + if err != nil { + return false, err + } + + defer f.Close() + + _, err = f.Readdirnames(1) + if err != nil { + if err == io.EOF { + return true, nil + } + + return false, err + } + + return false, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/k8sclient.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/k8sclient.go new file mode 100644 index 000000000..854f32dde --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/k8sclient.go @@ -0,0 +1,68 @@ +package util + +import ( + "fmt" + + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + "k8s.io/client-go/tools/clientcmd" + + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" +) + +//GetK8sClientFromCurrentConfiguredCluster returns a k8sClient and a namespace from the current context of the kubectl program. +func GetK8sClientFromCurrentConfiguredCluster() (client.Client, string, error) { + rules := clientcmd.NewDefaultClientConfigLoadingRules() + rules.DefaultClientConfig = &clientcmd.DefaultClientConfig + + overrides := &clientcmd.ConfigOverrides{ClusterDefaults: clientcmd.ClusterDefaults} + clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides) + cfg, err := clientConfig.ClientConfig() + + if err != nil { + return nil, "", fmt.Errorf("cannot build k8s config %w", err) + } + namespace, _, err := clientConfig.Namespace() + if err != nil { + return nil, "", fmt.Errorf("error extracting namespace from current k8s context. %w", err) + } + + scheme := runtime.NewScheme() + _ = clientgoscheme.AddToScheme(scheme) + _ = lsv1alpha1.AddToScheme(scheme) + k8sClient, err := client.New(cfg, client.Options{ + Scheme: scheme, + }) + if err != nil { + return nil, "", fmt.Errorf("cannot build K8s client: %w", err) + } + + return k8sClient, namespace, nil +} + +func BuildKubeClientFromConfigOrCurrentClusterContext(kubeconfig string, scheme *runtime.Scheme) (client.Client, string, error) { + var err error + namespace := "" + var k8sClient client.Client + if kubeconfig != "" { + cfg, err := clientcmd.BuildConfigFromFlags("", kubeconfig) + if err != nil { + return nil, namespace, fmt.Errorf("cannot parse K8s config: %w", err) + } + k8sClient, err = client.New(cfg, client.Options{ + Scheme: scheme, + }) + if err != nil { + return nil, namespace, fmt.Errorf("cannot build K8s client: %w", err) + } + } else { + k8sClient, namespace, err = GetK8sClientFromCurrentConfiguredCluster() + if err != nil { + return nil, namespace, fmt.Errorf("cannot build K8s client from current cluster config: %w", err) + } + } + + return k8sClient, namespace, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/paths.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/paths.go new file mode 100644 index 000000000..98991f844 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/paths.go @@ -0,0 +1,38 @@ +package util + +import ( + "path/filepath" + + "github.com/gardener/landscaper/apis/core/v1alpha1" +) + +const ( + BlueprintDirectoryName = "blueprint" + BlueprintFileName = v1alpha1.BlueprintFileName + ComponentDescriptorFileName = "component-descriptor.yaml" + ResourcesFileName = "resources.yaml" +) + +func BlueprintDirectoryPath(componentPath string) string { + return filepath.Join(componentPath, BlueprintDirectoryName) +} + +func BlueprintFilePath(componentPath string) string { + return filepath.Join(componentPath, BlueprintDirectoryName, BlueprintFileName) +} + +func ComponentDescriptorFilePath(componentPath string) string { + return filepath.Join(componentPath, ComponentDescriptorFileName) +} + +func ResourcesFilePath(componentPath string) string { + return filepath.Join(componentPath, ResourcesFileName) +} + +func ExecutionFilePath(componentPath, executionName string) string { + return filepath.Join(componentPath, BlueprintDirectoryName, ExecutionFileName(executionName)) +} + +func ExecutionFileName(executionName string) string { + return "deploy-execution-" + executionName + ".yaml" +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/util.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/util.go new file mode 100644 index 000000000..0e07447db --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/util.go @@ -0,0 +1,282 @@ +package util + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "time" + + cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2" + lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1" + "github.com/gardener/landscaper/apis/mediatype" + corev1 "k8s.io/api/core/v1" + k8sErrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/pointer" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// CheckConditionPeriodically checks the success of a function peridically. Returns timeout(bool) to indicate the success of the function +// and propagates possible errors of the function. +func CheckConditionPeriodically(conditionFunc func() (bool, error), sleepTime time.Duration, maxRetries int) (bool, error) { + retries := 0 + for { + fmt.Printf("Checking condition... retries: %d\n", retries) + + ok, err := conditionFunc() + if err != nil { + return false, err + } + + if ok { + break + } + + if retries >= maxRetries { + return true, nil + } + retries++ + + time.Sleep(sleepTime) + } + return false, nil +} + +// CheckAndWaitUntilAllPodsAreReady checks and wait until all pods have the ready condition set to true. Returns an error on failure +// or if timeout (sleepTime and maxRetries is reached). Returns a boolean indicating if all pods have the ready condition true on return. +func CheckAndWaitUntilAllPodsAreReady(k8sClient client.Client, namespace string, sleepTime time.Duration, maxRetries int) (bool, error) { + conditionFunc := func() (bool, error) { + podList := corev1.PodList{} + err := k8sClient.List(context.TODO(), &podList, client.InNamespace(namespace)) + if err != nil { + return false, fmt.Errorf("cannot list pods: %w", err) + } + + numberOfRunningPods := 0 + for _, pod := range podList.Items { + if pod.Status.Phase == corev1.PodSucceeded { + numberOfRunningPods++ + } else { + for _, condition := range pod.Status.Conditions { + if condition.Type == corev1.PodReady { + if condition.Status == corev1.ConditionTrue { + numberOfRunningPods++ + break + } + } + } + } + } + + return numberOfRunningPods == len(podList.Items), nil + } + + return CheckConditionPeriodically(conditionFunc, sleepTime, maxRetries) +} + +// CheckAndWaitUntilLandscaperInstallationSucceeded checks and wait until the installation is on status succeeded. Returns an error on failure +// or if timeout (sleepTime and maxRetries is reached). Returns a boolean indicating if the installation succeeded. +func CheckAndWaitUntilLandscaperInstallationSucceeded(k8sClient client.Client, key types.NamespacedName, sleepTime time.Duration, maxRetries int) (bool, error) { + conditionFunc := func() (bool, error) { + inst := &lsv1alpha1.Installation{} + err := k8sClient.Get(context.TODO(), key, inst) + if err != nil { + return false, fmt.Errorf("cannot get installation: %w", err) + } + + return inst.Status.Phase == lsv1alpha1.ComponentPhaseSucceeded, nil + } + + return CheckConditionPeriodically(conditionFunc, sleepTime, maxRetries) +} + +// CheckAndWaitUntilObjectNotExistAnymore periodically checks and wait until the object does not exist anymore. Returns an error on failure +// or if timeout (sleepTime and maxRetries is reached). Returns a boolean indicating if the object remains on return. +func CheckAndWaitUntilObjectNotExistAnymore(k8sClient client.Client, objKey types.NamespacedName, obj client.Object, sleepTime time.Duration, maxRetries int) (bool, error) { + conditionFunc := func() (bool, error) { + err := k8sClient.Get(context.TODO(), objKey, obj) + if err != nil { + if k8sErrors.IsNotFound(err) { + return true, nil + } + return false, err + } + return false, nil + } + + return CheckConditionPeriodically(conditionFunc, sleepTime, maxRetries) +} + +// CheckAndWaitUntilNoInstallationsInNamespaceExists periodically checks and wait until no installation in the namespace remains. Returns an error on failure +// or if timeout (sleepTime and maxRetries is reached). Returns a boolean indicating if no installations remains on return. +func CheckAndWaitUntilNoInstallationsInNamespaceExists(k8sClient client.Client, namespace string, sleepTime time.Duration, maxRetries int) (bool, error) { + conditionFunc := func() (bool, error) { + ctx := context.TODO() + + installationList := &lsv1alpha1.InstallationList{} + err := k8sClient.List(ctx, installationList, &client.ListOptions{Namespace: namespace}) + if err != nil { + return false, err + } + + return len(installationList.Items) == 0, nil + } + + return CheckConditionPeriodically(conditionFunc, sleepTime, maxRetries) +} + +// DeleteNamespace deletes a namespace (if it exists). First, a graceful delete will be tried with a timeout. +// On timeout, the namespace will be deleted forcefully by removing the finalizers on the Landscaper CRs. +func DeleteNamespace(k8sClient client.Client, namespace string, sleepTime time.Duration, maxRetries int) error { + ns := &corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: namespace, + }, + } + err := k8sClient.Get(context.TODO(), client.ObjectKey{Name: namespace}, ns) + if err != nil { + if k8sErrors.IsNotFound(err) { + return nil + } + return fmt.Errorf("error getting namespace %s: %w", namespace, err) + } + + timeout, err := gracefullyDeleteNamespace(k8sClient, namespace, sleepTime, maxRetries) + if err != nil { + return fmt.Errorf("deleting namespace gracefully failed: %w", err) + } + if timeout { + return fmt.Errorf("Deleting namespace gracefully timed out") + } + return nil +} + +// gracefully try to delete all Landscaper installations in a namespace, then delete the namespace itself +func gracefullyDeleteNamespace(k8sClient client.Client, namespace string, sleepTime time.Duration, maxRetries int) (bool, error) { + ctx := context.TODO() + + installationList := lsv1alpha1.InstallationList{} + if err := k8sClient.List(ctx, &installationList, &client.ListOptions{Namespace: namespace}); err != nil { + return false, err + } + for _, installation := range installationList.Items { + fmt.Println("Deleting installation:", installation.Name) + if err := k8sClient.Delete(ctx, &installation, &client.DeleteOptions{}); err != nil { + return false, fmt.Errorf("cannot delete installation: %w", err) + } + } + + timeout, err := CheckAndWaitUntilNoInstallationsInNamespaceExists(k8sClient, namespace, sleepTime, maxRetries) + if err != nil { + return false, err + } + if timeout { + return timeout, nil + } + + podList := corev1.PodList{} + if err := k8sClient.List(ctx, &podList, &client.ListOptions{Namespace: namespace}); err != nil { + return false, err + } + + if len(podList.Items) > 0 { + for i := range podList.Items { + next := &podList.Items[i] + + if len(next.GetFinalizers()) > 0 { + return false, fmt.Errorf("there still exists pods with finalizer in namespace %s though all installations were deleted: %w", namespace, err) + } + } + } + + ns := &corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: namespace, + }, + } + fmt.Println("Deleting namespace:", namespace) + err = k8sClient.Delete(ctx, ns, &client.DeleteOptions{}) + if err != nil { + return false, fmt.Errorf("cannot delete namespace: %w", err) + } + + timeout, err = CheckAndWaitUntilObjectNotExistAnymore(k8sClient, client.ObjectKey{Name: namespace}, ns, sleepTime, maxRetries) + if err != nil { + return false, fmt.Errorf("error while waiting for namespace to be deleted: %w", err) + } + if timeout { + return true, nil + } + + return false, nil +} + +func BuildKubernetesClusterTarget(name, namespace, kubeconfigPath string) (*lsv1alpha1.Target, error) { + kubeconfigContent, err := ioutil.ReadFile(kubeconfigPath) + if err != nil { + return nil, fmt.Errorf("cannot read kubeconfig: %w", err) + } + + config := lsv1alpha1.KubernetesClusterTargetConfig{ + Kubeconfig: lsv1alpha1.ValueRef{ + StrVal: pointer.StringPtr(string(kubeconfigContent)), + }, + } + + marshalledConfig, err := json.Marshal(config) + if err != nil { + return nil, fmt.Errorf("%w", err) + } + + target := &lsv1alpha1.Target{ + TypeMeta: metav1.TypeMeta{ + APIVersion: lsv1alpha1.SchemeGroupVersion.String(), + Kind: "Target", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + Spec: lsv1alpha1.TargetSpec{ + Type: lsv1alpha1.KubernetesClusterTargetType, + Configuration: lsv1alpha1.AnyJSON{ + RawMessage: marshalledConfig, + }, + }, + } + + return target, nil +} + +func GetBlueprintResource(cd *cdv2.ComponentDescriptor, blueprintResourceName string) (*cdv2.Resource, error) { + blueprintResources := map[string]cdv2.Resource{} + for _, resource := range cd.ComponentSpec.Resources { + if resource.IdentityObjectMeta.Type == mediatype.BlueprintType || resource.IdentityObjectMeta.Type == mediatype.OldBlueprintType { + blueprintResources[resource.Name] = resource + } + } + + var blueprintRes cdv2.Resource + numberOfBlueprints := len(blueprintResources) + if numberOfBlueprints == 0 { + return nil, fmt.Errorf("no blueprint resources defined in the component descriptor") + } else if numberOfBlueprints == 1 && blueprintResourceName == "" { + // access the only blueprint in the map. the flag blueprint-resource-name is ignored in this case. + for _, entry := range blueprintResources { + blueprintRes = entry + } + } else { + if blueprintResourceName == "" { + return nil, fmt.Errorf("the blueprint resource name must be defined since multiple blueprint resources exist in the component descriptor") + } + ok := false + blueprintRes, ok = blueprintResources[blueprintResourceName] + if !ok { + return nil, fmt.Errorf("blueprint %s is not defined as a resource in the component descriptor", blueprintResourceName) + } + } + + return &blueprintRes, nil +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/yaml.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/yaml.go new file mode 100644 index 000000000..e049e8d46 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/util/yaml.go @@ -0,0 +1,66 @@ +package util + +import ( + "bytes" + "strings" + + yamlv3 "gopkg.in/yaml.v3" +) + +func MarshalYaml(node *yamlv3.Node) ([]byte, error) { + buf := bytes.Buffer{} + enc := yamlv3.NewEncoder(&buf) + enc.SetIndent(2) + err := enc.Encode(node) + if err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func FindNodeByPath(node *yamlv3.Node, path string) (*yamlv3.Node, *yamlv3.Node) { + if node == nil || path == "" { + return nil, nil + } + + var keyNode, valueNode *yamlv3.Node + if node.Kind == yamlv3.DocumentNode { + valueNode = node.Content[0] + } else { + valueNode = node + } + splittedPath := strings.Split(path, ".") + + for _, p := range splittedPath { + keyNode, valueNode = findNode(valueNode.Content, p) + if keyNode == nil && valueNode == nil { + break + } + } + + return keyNode, valueNode +} + +func findNode(nodes []*yamlv3.Node, name string) (*yamlv3.Node, *yamlv3.Node) { + if nodes == nil { + return nil, nil + } + + var keyNode, valueNode *yamlv3.Node + for i, node := range nodes { + if node.Value == name { + keyNode = node + if i < len(nodes)-1 { + valueNode = nodes[i+1] + } + } else if node.Kind == yamlv3.SequenceNode || node.Kind == yamlv3.MappingNode { + keyNode, valueNode = findNode(node.Content, name) + } + + if keyNode != nil && valueNode != nil { + break + } + } + + return keyNode, valueNode +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/version/version.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/version/version.go new file mode 100644 index 000000000..c19d327d3 --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/version/version.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors. +// +// SPDX-License-Identifier: Apache-2.0 + +package version + +import ( + "fmt" + "runtime" + "strings" + + apimachineryversion "k8s.io/apimachinery/pkg/version" +) + +var ( + gitCommit string + gitTreeState string + buildDate = "" +) + +// GetInterface returns the overall codebase version. It's for detecting +// what code a binary was built from. +// These variables typically come from -ldflags settings and in +// their absence fallback to the settings in pkg/version/base.go +func Get() apimachineryversion.Info { + var ( + version = strings.Split(LandscaperCliVersion, ".") + gitMajor string + gitMinor string + ) + + if len(version) >= 2 { + gitMajor = version[0] + gitMinor = version[1] + } + + return apimachineryversion.Info{ + Major: gitMajor, + Minor: gitMinor, + GitVersion: LandscaperCliVersion, + GitCommit: gitCommit, + GitTreeState: gitTreeState, + BuildDate: buildDate, + GoVersion: runtime.Version(), + Compiler: runtime.Compiler, + Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), + } +} diff --git a/integration-test/vendor/github.com/gardener/landscapercli/pkg/version/version_info.go b/integration-test/vendor/github.com/gardener/landscapercli/pkg/version/version_info.go new file mode 100644 index 000000000..f2676997e --- /dev/null +++ b/integration-test/vendor/github.com/gardener/landscapercli/pkg/version/version_info.go @@ -0,0 +1,8 @@ +package version + +var ( + LandscaperCliVersion = "" + LandscaperGitVersion = "v0.17.0" + LandscaperChartVersion = "v0.17.0" + ComponentCliVersion = "" +) diff --git a/integration-test/vendor/github.com/ghodss/yaml/.gitignore b/integration-test/vendor/github.com/ghodss/yaml/.gitignore new file mode 100644 index 000000000..e256a31e0 --- /dev/null +++ b/integration-test/vendor/github.com/ghodss/yaml/.gitignore @@ -0,0 +1,20 @@ +# OSX leaves these everywhere on SMB shares +._* + +# Eclipse files +.classpath +.project +.settings/** + +# Emacs save files +*~ + +# Vim-related files +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +*.un~ +Session.vim +.netrwhist + +# Go test binaries +*.test diff --git a/integration-test/vendor/github.com/ghodss/yaml/.travis.yml b/integration-test/vendor/github.com/ghodss/yaml/.travis.yml new file mode 100644 index 000000000..0e9d6edc0 --- /dev/null +++ b/integration-test/vendor/github.com/ghodss/yaml/.travis.yml @@ -0,0 +1,7 @@ +language: go +go: + - 1.3 + - 1.4 +script: + - go test + - go build diff --git a/integration-test/vendor/github.com/ghodss/yaml/LICENSE b/integration-test/vendor/github.com/ghodss/yaml/LICENSE new file mode 100644 index 000000000..7805d36de --- /dev/null +++ b/integration-test/vendor/github.com/ghodss/yaml/LICENSE @@ -0,0 +1,50 @@ +The MIT License (MIT) + +Copyright (c) 2014 Sam Ghods + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/integration-test/vendor/github.com/ghodss/yaml/README.md b/integration-test/vendor/github.com/ghodss/yaml/README.md new file mode 100644 index 000000000..0200f75b4 --- /dev/null +++ b/integration-test/vendor/github.com/ghodss/yaml/README.md @@ -0,0 +1,121 @@ +# YAML marshaling and unmarshaling support for Go + +[![Build Status](https://travis-ci.org/ghodss/yaml.svg)](https://travis-ci.org/ghodss/yaml) + +## Introduction + +A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs. + +In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/). + +## Compatibility + +This package uses [go-yaml](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility). + +## Caveats + +**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example: + +``` +BAD: + exampleKey: !!binary gIGC + +GOOD: + exampleKey: gIGC +... and decode the base64 data in your code. +``` + +**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys. + +## Installation and usage + +To install, run: + +``` +$ go get github.com/ghodss/yaml +``` + +And import using: + +``` +import "github.com/ghodss/yaml" +``` + +Usage is very similar to the JSON library: + +```go +package main + +import ( + "fmt" + + "github.com/ghodss/yaml" +) + +type Person struct { + Name string `json:"name"` // Affects YAML field names too. + Age int `json:"age"` +} + +func main() { + // Marshal a Person struct to YAML. + p := Person{"John", 30} + y, err := yaml.Marshal(p) + if err != nil { + fmt.Printf("err: %v\n", err) + return + } + fmt.Println(string(y)) + /* Output: + age: 30 + name: John + */ + + // Unmarshal the YAML back into a Person struct. + var p2 Person + err = yaml.Unmarshal(y, &p2) + if err != nil { + fmt.Printf("err: %v\n", err) + return + } + fmt.Println(p2) + /* Output: + {John 30} + */ +} +``` + +`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available: + +```go +package main + +import ( + "fmt" + + "github.com/ghodss/yaml" +) + +func main() { + j := []byte(`{"name": "John", "age": 30}`) + y, err := yaml.JSONToYAML(j) + if err != nil { + fmt.Printf("err: %v\n", err) + return + } + fmt.Println(string(y)) + /* Output: + name: John + age: 30 + */ + j2, err := yaml.YAMLToJSON(y) + if err != nil { + fmt.Printf("err: %v\n", err) + return + } + fmt.Println(string(j2)) + /* Output: + {"age":30,"name":"John"} + */ +} +``` diff --git a/integration-test/vendor/github.com/ghodss/yaml/fields.go b/integration-test/vendor/github.com/ghodss/yaml/fields.go new file mode 100644 index 000000000..586007402 --- /dev/null +++ b/integration-test/vendor/github.com/ghodss/yaml/fields.go @@ -0,0 +1,501 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +package yaml + +import ( + "bytes" + "encoding" + "encoding/json" + "reflect" + "sort" + "strings" + "sync" + "unicode" + "unicode/utf8" +) + +// indirect walks down v allocating pointers as needed, +// until it gets to a non-pointer. +// if it encounters an Unmarshaler, indirect stops and returns that. +// if decodingNull is true, indirect stops at the last pointer so it can be set to nil. +func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { + // If v is a named type and is addressable, + // start with its address, so that if the type has pointer methods, + // we find them. + if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + v = v.Addr() + } + for { + // Load value from interface, but only if the result will be + // usefully addressable. + if v.Kind() == reflect.Interface && !v.IsNil() { + e := v.Elem() + if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { + v = e + continue + } + } + + if v.Kind() != reflect.Ptr { + break + } + + if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { + break + } + if v.IsNil() { + if v.CanSet() { + v.Set(reflect.New(v.Type().Elem())) + } else { + v = reflect.New(v.Type().Elem()) + } + } + if v.Type().NumMethod() > 0 { + if u, ok := v.Interface().(json.Unmarshaler); ok { + return u, nil, reflect.Value{} + } + if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { + return nil, u, reflect.Value{} + } + } + v = v.Elem() + } + return nil, nil, v +} + +// A field represents a single field found in a struct. +type field struct { + name string + nameBytes []byte // []byte(name) + equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent + + tag bool + index []int + typ reflect.Type + omitEmpty bool + quoted bool +} + +func fillField(f field) field { + f.nameBytes = []byte(f.name) + f.equalFold = foldFunc(f.nameBytes) + return f +} + +// byName sorts field by name, breaking ties with depth, +// then breaking ties with "name came from json tag", then +// breaking ties with index sequence. +type byName []field + +func (x byName) Len() int { return len(x) } + +func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byName) Less(i, j int) bool { + if x[i].name != x[j].name { + return x[i].name < x[j].name + } + if len(x[i].index) != len(x[j].index) { + return len(x[i].index) < len(x[j].index) + } + if x[i].tag != x[j].tag { + return x[i].tag + } + return byIndex(x).Less(i, j) +} + +// byIndex sorts field by index sequence. +type byIndex []field + +func (x byIndex) Len() int { return len(x) } + +func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byIndex) Less(i, j int) bool { + for k, xik := range x[i].index { + if k >= len(x[j].index) { + return false + } + if xik != x[j].index[k] { + return xik < x[j].index[k] + } + } + return len(x[i].index) < len(x[j].index) +} + +// typeFields returns a list of fields that JSON should recognize for the given type. +// The algorithm is breadth-first search over the set of structs to include - the top struct +// and then any reachable anonymous structs. +func typeFields(t reflect.Type) []field { + // Anonymous fields to explore at the current level and the next. + current := []field{} + next := []field{{typ: t}} + + // Count of queued names for current level and the next. + count := map[reflect.Type]int{} + nextCount := map[reflect.Type]int{} + + // Types already visited at an earlier level. + visited := map[reflect.Type]bool{} + + // Fields found. + var fields []field + + for len(next) > 0 { + current, next = next, current[:0] + count, nextCount = nextCount, map[reflect.Type]int{} + + for _, f := range current { + if visited[f.typ] { + continue + } + visited[f.typ] = true + + // Scan f.typ for fields to include. + for i := 0; i < f.typ.NumField(); i++ { + sf := f.typ.Field(i) + if sf.PkgPath != "" { // unexported + continue + } + tag := sf.Tag.Get("json") + if tag == "-" { + continue + } + name, opts := parseTag(tag) + if !isValidTag(name) { + name = "" + } + index := make([]int, len(f.index)+1) + copy(index, f.index) + index[len(f.index)] = i + + ft := sf.Type + if ft.Name() == "" && ft.Kind() == reflect.Ptr { + // Follow pointer. + ft = ft.Elem() + } + + // Record found field and index sequence. + if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct { + tagged := name != "" + if name == "" { + name = sf.Name + } + fields = append(fields, fillField(field{ + name: name, + tag: tagged, + index: index, + typ: ft, + omitEmpty: opts.Contains("omitempty"), + quoted: opts.Contains("string"), + })) + if count[f.typ] > 1 { + // If there were multiple instances, add a second, + // so that the annihilation code will see a duplicate. + // It only cares about the distinction between 1 or 2, + // so don't bother generating any more copies. + fields = append(fields, fields[len(fields)-1]) + } + continue + } + + // Record new anonymous struct to explore in next round. + nextCount[ft]++ + if nextCount[ft] == 1 { + next = append(next, fillField(field{name: ft.Name(), index: index, typ: ft})) + } + } + } + } + + sort.Sort(byName(fields)) + + // Delete all fields that are hidden by the Go rules for embedded fields, + // except that fields with JSON tags are promoted. + + // The fields are sorted in primary order of name, secondary order + // of field index length. Loop over names; for each name, delete + // hidden fields by choosing the one dominant field that survives. + out := fields[:0] + for advance, i := 0, 0; i < len(fields); i += advance { + // One iteration per name. + // Find the sequence of fields with the name of this first field. + fi := fields[i] + name := fi.name + for advance = 1; i+advance < len(fields); advance++ { + fj := fields[i+advance] + if fj.name != name { + break + } + } + if advance == 1 { // Only one field with this name + out = append(out, fi) + continue + } + dominant, ok := dominantField(fields[i : i+advance]) + if ok { + out = append(out, dominant) + } + } + + fields = out + sort.Sort(byIndex(fields)) + + return fields +} + +// dominantField looks through the fields, all of which are known to +// have the same name, to find the single field that dominates the +// others using Go's embedding rules, modified by the presence of +// JSON tags. If there are multiple top-level fields, the boolean +// will be false: This condition is an error in Go and we skip all +// the fields. +func dominantField(fields []field) (field, bool) { + // The fields are sorted in increasing index-length order. The winner + // must therefore be one with the shortest index length. Drop all + // longer entries, which is easy: just truncate the slice. + length := len(fields[0].index) + tagged := -1 // Index of first tagged field. + for i, f := range fields { + if len(f.index) > length { + fields = fields[:i] + break + } + if f.tag { + if tagged >= 0 { + // Multiple tagged fields at the same level: conflict. + // Return no field. + return field{}, false + } + tagged = i + } + } + if tagged >= 0 { + return fields[tagged], true + } + // All remaining fields have the same length. If there's more than one, + // we have a conflict (two fields named "X" at the same level) and we + // return no field. + if len(fields) > 1 { + return field{}, false + } + return fields[0], true +} + +var fieldCache struct { + sync.RWMutex + m map[reflect.Type][]field +} + +// cachedTypeFields is like typeFields but uses a cache to avoid repeated work. +func cachedTypeFields(t reflect.Type) []field { + fieldCache.RLock() + f := fieldCache.m[t] + fieldCache.RUnlock() + if f != nil { + return f + } + + // Compute fields without lock. + // Might duplicate effort but won't hold other computations back. + f = typeFields(t) + if f == nil { + f = []field{} + } + + fieldCache.Lock() + if fieldCache.m == nil { + fieldCache.m = map[reflect.Type][]field{} + } + fieldCache.m[t] = f + fieldCache.Unlock() + return f +} + +func isValidTag(s string) bool { + if s == "" { + return false + } + for _, c := range s { + switch { + case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): + // Backslash and quote chars are reserved, but + // otherwise any punctuation chars are allowed + // in a tag name. + default: + if !unicode.IsLetter(c) && !unicode.IsDigit(c) { + return false + } + } + } + return true +} + +const ( + caseMask = ^byte(0x20) // Mask to ignore case in ASCII. + kelvin = '\u212a' + smallLongEss = '\u017f' +) + +// foldFunc returns one of four different case folding equivalence +// functions, from most general (and slow) to fastest: +// +// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 +// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') +// 3) asciiEqualFold, no special, but includes non-letters (including _) +// 4) simpleLetterEqualFold, no specials, no non-letters. +// +// The letters S and K are special because they map to 3 runes, not just 2: +// * S maps to s and to U+017F 'ſ' Latin small letter long s +// * k maps to K and to U+212A 'K' Kelvin sign +// See http://play.golang.org/p/tTxjOc0OGo +// +// The returned function is specialized for matching against s and +// should only be given s. It's not curried for performance reasons. +func foldFunc(s []byte) func(s, t []byte) bool { + nonLetter := false + special := false // special letter + for _, b := range s { + if b >= utf8.RuneSelf { + return bytes.EqualFold + } + upper := b & caseMask + if upper < 'A' || upper > 'Z' { + nonLetter = true + } else if upper == 'K' || upper == 'S' { + // See above for why these letters are special. + special = true + } + } + if special { + return equalFoldRight + } + if nonLetter { + return asciiEqualFold + } + return simpleLetterEqualFold +} + +// equalFoldRight is a specialization of bytes.EqualFold when s is +// known to be all ASCII (including punctuation), but contains an 's', +// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. +// See comments on foldFunc. +func equalFoldRight(s, t []byte) bool { + for _, sb := range s { + if len(t) == 0 { + return false + } + tb := t[0] + if tb < utf8.RuneSelf { + if sb != tb { + sbUpper := sb & caseMask + if 'A' <= sbUpper && sbUpper <= 'Z' { + if sbUpper != tb&caseMask { + return false + } + } else { + return false + } + } + t = t[1:] + continue + } + // sb is ASCII and t is not. t must be either kelvin + // sign or long s; sb must be s, S, k, or K. + tr, size := utf8.DecodeRune(t) + switch sb { + case 's', 'S': + if tr != smallLongEss { + return false + } + case 'k', 'K': + if tr != kelvin { + return false + } + default: + return false + } + t = t[size:] + + } + if len(t) > 0 { + return false + } + return true +} + +// asciiEqualFold is a specialization of bytes.EqualFold for use when +// s is all ASCII (but may contain non-letters) and contains no +// special-folding letters. +// See comments on foldFunc. +func asciiEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, sb := range s { + tb := t[i] + if sb == tb { + continue + } + if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') { + if sb&caseMask != tb&caseMask { + return false + } + } else { + return false + } + } + return true +} + +// simpleLetterEqualFold is a specialization of bytes.EqualFold for +// use when s is all ASCII letters (no underscores, etc) and also +// doesn't contain 'k', 'K', 's', or 'S'. +// See comments on foldFunc. +func simpleLetterEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, b := range s { + if b&caseMask != t[i]&caseMask { + return false + } + } + return true +} + +// tagOptions is the string following a comma in a struct field's "json" +// tag, or the empty string. It does not include the leading comma. +type tagOptions string + +// parseTag splits a struct field's json tag into its name and +// comma-separated options. +func parseTag(tag string) (string, tagOptions) { + if idx := strings.Index(tag, ","); idx != -1 { + return tag[:idx], tagOptions(tag[idx+1:]) + } + return tag, tagOptions("") +} + +// Contains reports whether a comma-separated list of options +// contains a particular substr flag. substr must be surrounded by a +// string boundary or commas. +func (o tagOptions) Contains(optionName string) bool { + if len(o) == 0 { + return false + } + s := string(o) + for s != "" { + var next string + i := strings.Index(s, ",") + if i >= 0 { + s, next = s[:i], s[i+1:] + } + if s == optionName { + return true + } + s = next + } + return false +} diff --git a/integration-test/vendor/github.com/ghodss/yaml/yaml.go b/integration-test/vendor/github.com/ghodss/yaml/yaml.go new file mode 100644 index 000000000..4fb4054a8 --- /dev/null +++ b/integration-test/vendor/github.com/ghodss/yaml/yaml.go @@ -0,0 +1,277 @@ +package yaml + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strconv" + + "gopkg.in/yaml.v2" +) + +// Marshals the object into JSON then converts JSON to YAML and returns the +// YAML. +func Marshal(o interface{}) ([]byte, error) { + j, err := json.Marshal(o) + if err != nil { + return nil, fmt.Errorf("error marshaling into JSON: %v", err) + } + + y, err := JSONToYAML(j) + if err != nil { + return nil, fmt.Errorf("error converting JSON to YAML: %v", err) + } + + return y, nil +} + +// Converts YAML to JSON then uses JSON to unmarshal into an object. +func Unmarshal(y []byte, o interface{}) error { + vo := reflect.ValueOf(o) + j, err := yamlToJSON(y, &vo) + if err != nil { + return fmt.Errorf("error converting YAML to JSON: %v", err) + } + + err = json.Unmarshal(j, o) + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %v", err) + } + + return nil +} + +// Convert JSON to YAML. +func JSONToYAML(j []byte) ([]byte, error) { + // Convert the JSON to an object. + var jsonObj interface{} + // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the + // Go JSON library doesn't try to pick the right number type (int, float, + // etc.) when unmarshalling to interface{}, it just picks float64 + // universally. go-yaml does go through the effort of picking the right + // number type, so we can preserve number type throughout this process. + err := yaml.Unmarshal(j, &jsonObj) + if err != nil { + return nil, err + } + + // Marshal this object into YAML. + return yaml.Marshal(jsonObj) +} + +// Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through +// this method should be a no-op. +// +// Things YAML can do that are not supported by JSON: +// * In YAML you can have binary and null keys in your maps. These are invalid +// in JSON. (int and float keys are converted to strings.) +// * Binary data in YAML with the !!binary tag is not supported. If you want to +// use binary data with this library, encode the data as base64 as usual but do +// not use the !!binary tag in your YAML. This will ensure the original base64 +// encoded data makes it all the way through to the JSON. +func YAMLToJSON(y []byte) ([]byte, error) { + return yamlToJSON(y, nil) +} + +func yamlToJSON(y []byte, jsonTarget *reflect.Value) ([]byte, error) { + // Convert the YAML to an object. + var yamlObj interface{} + err := yaml.Unmarshal(y, &yamlObj) + if err != nil { + return nil, err + } + + // YAML objects are not completely compatible with JSON objects (e.g. you + // can have non-string keys in YAML). So, convert the YAML-compatible object + // to a JSON-compatible object, failing with an error if irrecoverable + // incompatibilties happen along the way. + jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget) + if err != nil { + return nil, err + } + + // Convert this object to JSON and return the data. + return json.Marshal(jsonObj) +} + +func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) { + var err error + + // Resolve jsonTarget to a concrete value (i.e. not a pointer or an + // interface). We pass decodingNull as false because we're not actually + // decoding into the value, we're just checking if the ultimate target is a + // string. + if jsonTarget != nil { + ju, tu, pv := indirect(*jsonTarget, false) + // We have a JSON or Text Umarshaler at this level, so we can't be trying + // to decode into a string. + if ju != nil || tu != nil { + jsonTarget = nil + } else { + jsonTarget = &pv + } + } + + // If yamlObj is a number or a boolean, check if jsonTarget is a string - + // if so, coerce. Else return normal. + // If yamlObj is a map or array, find the field that each key is + // unmarshaling to, and when you recurse pass the reflect.Value for that + // field back into this function. + switch typedYAMLObj := yamlObj.(type) { + case map[interface{}]interface{}: + // JSON does not support arbitrary keys in a map, so we must convert + // these keys to strings. + // + // From my reading of go-yaml v2 (specifically the resolve function), + // keys can only have the types string, int, int64, float64, binary + // (unsupported), or null (unsupported). + strMap := make(map[string]interface{}) + for k, v := range typedYAMLObj { + // Resolve the key to a string first. + var keyString string + switch typedKey := k.(type) { + case string: + keyString = typedKey + case int: + keyString = strconv.Itoa(typedKey) + case int64: + // go-yaml will only return an int64 as a key if the system + // architecture is 32-bit and the key's value is between 32-bit + // and 64-bit. Otherwise the key type will simply be int. + keyString = strconv.FormatInt(typedKey, 10) + case float64: + // Stolen from go-yaml to use the same conversion to string as + // the go-yaml library uses to convert float to string when + // Marshaling. + s := strconv.FormatFloat(typedKey, 'g', -1, 32) + switch s { + case "+Inf": + s = ".inf" + case "-Inf": + s = "-.inf" + case "NaN": + s = ".nan" + } + keyString = s + case bool: + if typedKey { + keyString = "true" + } else { + keyString = "false" + } + default: + return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v", + reflect.TypeOf(k), k, v) + } + + // jsonTarget should be a struct or a map. If it's a struct, find + // the field it's going to map to and pass its reflect.Value. If + // it's a map, find the element type of the map and pass the + // reflect.Value created from that type. If it's neither, just pass + // nil - JSON conversion will error for us if it's a real issue. + if jsonTarget != nil { + t := *jsonTarget + if t.Kind() == reflect.Struct { + keyBytes := []byte(keyString) + // Find the field that the JSON library would use. + var f *field + fields := cachedTypeFields(t.Type()) + for i := range fields { + ff := &fields[i] + if bytes.Equal(ff.nameBytes, keyBytes) { + f = ff + break + } + // Do case-insensitive comparison. + if f == nil && ff.equalFold(ff.nameBytes, keyBytes) { + f = ff + } + } + if f != nil { + // Find the reflect.Value of the most preferential + // struct field. + jtf := t.Field(f.index[0]) + strMap[keyString], err = convertToJSONableObject(v, &jtf) + if err != nil { + return nil, err + } + continue + } + } else if t.Kind() == reflect.Map { + // Create a zero value of the map's element type to use as + // the JSON target. + jtv := reflect.Zero(t.Type().Elem()) + strMap[keyString], err = convertToJSONableObject(v, &jtv) + if err != nil { + return nil, err + } + continue + } + } + strMap[keyString], err = convertToJSONableObject(v, nil) + if err != nil { + return nil, err + } + } + return strMap, nil + case []interface{}: + // We need to recurse into arrays in case there are any + // map[interface{}]interface{}'s inside and to convert any + // numbers to strings. + + // If jsonTarget is a slice (which it really should be), find the + // thing it's going to map to. If it's not a slice, just pass nil + // - JSON conversion will error for us if it's a real issue. + var jsonSliceElemValue *reflect.Value + if jsonTarget != nil { + t := *jsonTarget + if t.Kind() == reflect.Slice { + // By default slices point to nil, but we need a reflect.Value + // pointing to a value of the slice type, so we create one here. + ev := reflect.Indirect(reflect.New(t.Type().Elem())) + jsonSliceElemValue = &ev + } + } + + // Make and use a new array. + arr := make([]interface{}, len(typedYAMLObj)) + for i, v := range typedYAMLObj { + arr[i], err = convertToJSONableObject(v, jsonSliceElemValue) + if err != nil { + return nil, err + } + } + return arr, nil + default: + // If the target type is a string and the YAML type is a number, + // convert the YAML type to a string. + if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String { + // Based on my reading of go-yaml, it may return int, int64, + // float64, or uint64. + var s string + switch typedVal := typedYAMLObj.(type) { + case int: + s = strconv.FormatInt(int64(typedVal), 10) + case int64: + s = strconv.FormatInt(typedVal, 10) + case float64: + s = strconv.FormatFloat(typedVal, 'g', -1, 32) + case uint64: + s = strconv.FormatUint(typedVal, 10) + case bool: + if typedVal { + s = "true" + } else { + s = "false" + } + } + if len(s) > 0 { + yamlObj = interface{}(s) + } + } + return yamlObj, nil + } + + return nil, nil +} diff --git a/integration-test/vendor/github.com/go-logr/logr/LICENSE b/integration-test/vendor/github.com/go-logr/logr/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/logr/LICENSE @@ -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. diff --git a/integration-test/vendor/github.com/go-logr/logr/README.md b/integration-test/vendor/github.com/go-logr/logr/README.md new file mode 100644 index 000000000..e9b5520a1 --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/logr/README.md @@ -0,0 +1,183 @@ +# A more minimal logging API for Go + +Before you consider this package, please read [this blog post by the +inimitable Dave Cheney][warning-makes-no-sense]. I really appreciate what +he has to say, and it largely aligns with my own experiences. Too many +choices of levels means inconsistent logs. + +This package offers a purely abstract interface, based on these ideas but with +a few twists. Code can depend on just this interface and have the actual +logging implementation be injected from callers. Ideally only `main()` knows +what logging implementation is being used. + +# Differences from Dave's ideas + +The main differences are: + +1) Dave basically proposes doing away with the notion of a logging API in favor +of `fmt.Printf()`. I disagree, especially when you consider things like output +locations, timestamps, file and line decorations, and structured logging. I +restrict the API to just 2 types of logs: info and error. + +Info logs are things you want to tell the user which are not errors. Error +logs are, well, errors. If your code receives an `error` from a subordinate +function call and is logging that `error` *and not returning it*, use error +logs. + +2) Verbosity-levels on info logs. This gives developers a chance to indicate +arbitrary grades of importance for info logs, without assigning names with +semantic meaning such as "warning", "trace", and "debug". Superficially this +may feel very similar, but the primary difference is the lack of semantics. +Because verbosity is a numerical value, it's safe to assume that an app running +with higher verbosity means more (and less important) logs will be generated. + +This is a BETA grade API. + +There are implementations for the following logging libraries: + +- **github.com/google/glog**: [glogr](https://github.com/go-logr/glogr) +- **k8s.io/klog**: [klogr](https://git.k8s.io/klog/klogr) +- **go.uber.org/zap**: [zapr](https://github.com/go-logr/zapr) +- **log** (the Go standard library logger): + [stdr](https://github.com/go-logr/stdr) +- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr) +- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend) +- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr) + +# FAQ + +## Conceptual + +## Why structured logging? + +- **Structured logs are more easily queriable**: Since you've got + key-value pairs, it's much easier to query your structured logs for + particular values by filtering on the contents of a particular key -- + think searching request logs for error codes, Kubernetes reconcilers for + the name and namespace of the reconciled object, etc + +- **Structured logging makes it easier to have cross-referencable logs**: + Similarly to searchability, if you maintain conventions around your + keys, it becomes easy to gather all log lines related to a particular + concept. + +- **Structured logs allow better dimensions of filtering**: if you have + structure to your logs, you've got more precise control over how much + information is logged -- you might choose in a particular configuration + to log certain keys but not others, only log lines where a certain key + matches a certain value, etc, instead of just having v-levels and names + to key off of. + +- **Structured logs better represent structured data**: sometimes, the + data that you want to log is inherently structured (think tuple-link + objects). Structured logs allow you to preserve that structure when + outputting. + +## Why V-levels? + +**V-levels give operators an easy way to control the chattiness of log +operations**. V-levels provide a way for a given package to distinguish +the relative importance or verbosity of a given log message. Then, if +a particular logger or package is logging too many messages, the user +of the package can simply change the v-levels for that library. + +## Why not more named levels, like Warning? + +Read [Dave Cheney's post][warning-makes-no-sense]. Then read [Differences +from Dave's ideas](#differences-from-daves-ideas). + +## Why not allow format strings, too? + +**Format strings negate many of the benefits of structured logs**: + +- They're not easily searchable without resorting to fuzzy searching, + regular expressions, etc + +- They don't store structured data well, since contents are flattened into + a string + +- They're not cross-referencable + +- They don't compress easily, since the message is not constant + +(unless you turn positional parameters into key-value pairs with numerical +keys, at which point you've gotten key-value logging with meaningless +keys) + +## Practical + +## Why key-value pairs, and not a map? + +Key-value pairs are *much* easier to optimize, especially around +allocations. Zap (a structured logger that inspired logr's interface) has +[performance measurements](https://github.com/uber-go/zap#performance) +that show this quite nicely. + +While the interface ends up being a little less obvious, you get +potentially better performance, plus avoid making users type +`map[string]string{}` every time they want to log. + +## What if my V-levels differ between libraries? + +That's fine. Control your V-levels on a per-logger basis, and use the +`WithName` function to pass different loggers to different libraries. + +Generally, you should take care to ensure that you have relatively +consistent V-levels within a given logger, however, as this makes deciding +on what verbosity of logs to request easier. + +## But I *really* want to use a format string! + +That's not actually a question. Assuming your question is "how do +I convert my mental model of logging with format strings to logging with +constant messages": + +1. figure out what the error actually is, as you'd write in a TL;DR style, + and use that as a message + +2. For every place you'd write a format specifier, look to the word before + it, and add that as a key value pair + +For instance, consider the following examples (all taken from spots in the +Kubernetes codebase): + +- `klog.V(4).Infof("Client is returning errors: code %v, error %v", + responseCode, err)` becomes `logger.Error(err, "client returned an + error", "code", responseCode)` + +- `klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", + seconds, retries, url)` becomes `logger.V(4).Info("got a retry-after + response when requesting url", "attempt", retries, "after + seconds", seconds, "url", url)` + +If you *really* must use a format string, place it as a key value, and +call `fmt.Sprintf` yourself -- for instance, `log.Printf("unable to +reflect over type %T")` becomes `logger.Info("unable to reflect over +type", "type", fmt.Sprintf("%T"))`. In general though, the cases where +this is necessary should be few and far between. + +## How do I choose my V-levels? + +This is basically the only hard constraint: increase V-levels to denote +more verbose or more debug-y logs. + +Otherwise, you can start out with `0` as "you always want to see this", +`1` as "common logging that you might *possibly* want to turn off", and +`10` as "I would like to performance-test your log collection stack". + +Then gradually choose levels in between as you need them, working your way +down from 10 (for debug and trace style logs) and up from 1 (for chattier +info-type logs). + +## How do I choose my keys + +- make your keys human-readable +- constant keys are generally a good idea +- be consistent across your codebase +- keys should naturally match parts of the message string + +While key names are mostly unrestricted (and spaces are acceptable), +it's generally a good idea to stick to printable ascii characters, or at +least match the general character set of your log lines. + +[warning-makes-no-sense]: http://dave.cheney.net/2015/11/05/lets-talk-about-logging diff --git a/integration-test/vendor/github.com/go-logr/logr/discard.go b/integration-test/vendor/github.com/go-logr/logr/discard.go new file mode 100644 index 000000000..2bafb13d1 --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/logr/discard.go @@ -0,0 +1,51 @@ +/* +Copyright 2020 The logr Authors. + +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 logr + +// Discard returns a valid Logger that discards all messages logged to it. +// It can be used whenever the caller is not interested in the logs. +func Discard() Logger { + return DiscardLogger{} +} + +// DiscardLogger is a Logger that discards all messages. +type DiscardLogger struct{} + +func (l DiscardLogger) Enabled() bool { + return false +} + +func (l DiscardLogger) Info(msg string, keysAndValues ...interface{}) { +} + +func (l DiscardLogger) Error(err error, msg string, keysAndValues ...interface{}) { +} + +func (l DiscardLogger) V(level int) Logger { + return l +} + +func (l DiscardLogger) WithValues(keysAndValues ...interface{}) Logger { + return l +} + +func (l DiscardLogger) WithName(name string) Logger { + return l +} + +// Verify that it actually implements the interface +var _ Logger = DiscardLogger{} diff --git a/integration-test/vendor/github.com/go-logr/logr/logr.go b/integration-test/vendor/github.com/go-logr/logr/logr.go new file mode 100644 index 000000000..842428bd3 --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/logr/logr.go @@ -0,0 +1,266 @@ +/* +Copyright 2019 The logr Authors. + +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. +*/ + +// This design derives from Dave Cheney's blog: +// http://dave.cheney.net/2015/11/05/lets-talk-about-logging +// +// This is a BETA grade API. Until there is a significant 2nd implementation, +// I don't really know how it will change. + +// Package logr defines abstract interfaces for logging. Packages can depend on +// these interfaces and callers can implement logging in whatever way is +// appropriate. +// +// Usage +// +// Logging is done using a Logger. Loggers can have name prefixes and named +// values attached, so that all log messages logged with that Logger have some +// base context associated. +// +// The term "key" is used to refer to the name associated with a particular +// value, to disambiguate it from the general Logger name. +// +// For instance, suppose we're trying to reconcile the state of an object, and +// we want to log that we've made some decision. +// +// With the traditional log package, we might write: +// log.Printf("decided to set field foo to value %q for object %s/%s", +// targetValue, object.Namespace, object.Name) +// +// With logr's structured logging, we'd write: +// // elsewhere in the file, set up the logger to log with the prefix of +// // "reconcilers", and the named value target-type=Foo, for extra context. +// log := mainLogger.WithName("reconcilers").WithValues("target-type", "Foo") +// +// // later on... +// log.Info("setting foo on object", "value", targetValue, "object", object) +// +// Depending on our logging implementation, we could then make logging decisions +// based on field values (like only logging such events for objects in a certain +// namespace), or copy the structured information into a structured log store. +// +// For logging errors, Logger has a method called Error. Suppose we wanted to +// log an error while reconciling. With the traditional log package, we might +// write: +// log.Errorf("unable to reconcile object %s/%s: %v", object.Namespace, object.Name, err) +// +// With logr, we'd instead write: +// // assuming the above setup for log +// log.Error(err, "unable to reconcile object", "object", object) +// +// This functions similarly to: +// log.Info("unable to reconcile object", "error", err, "object", object) +// +// However, it ensures that a standard key for the error value ("error") is used +// across all error logging. Furthermore, certain implementations may choose to +// attach additional information (such as stack traces) on calls to Error, so +// it's preferred to use Error to log errors. +// +// Parts of a log line +// +// Each log message from a Logger has four types of context: +// logger name, log verbosity, log message, and the named values. +// +// The Logger name consists of a series of name "segments" added by successive +// calls to WithName. These name segments will be joined in some way by the +// underlying implementation. It is strongly recommended that name segments +// contain simple identifiers (letters, digits, and hyphen), and do not contain +// characters that could muddle the log output or confuse the joining operation +// (e.g. whitespace, commas, periods, slashes, brackets, quotes, etc). +// +// Log verbosity represents how little a log matters. Level zero, the default, +// matters most. Increasing levels matter less and less. Try to avoid lots of +// different verbosity levels, and instead provide useful keys, logger names, +// and log messages for users to filter on. It's illegal to pass a log level +// below zero. +// +// The log message consists of a constant message attached to the log line. +// This should generally be a simple description of what's occurring, and should +// never be a format string. +// +// Variable information can then be attached using named values (key/value +// pairs). Keys are arbitrary strings, while values may be any Go value. +// +// Key Naming Conventions +// +// Keys are not strictly required to conform to any specification or regex, but +// it is recommended that they: +// * be human-readable and meaningful (not auto-generated or simple ordinals) +// * be constant (not dependent on input data) +// * contain only printable characters +// * not contain whitespace or punctuation +// +// These guidelines help ensure that log data is processed properly regardless +// of the log implementation. For example, log implementations will try to +// output JSON data or will store data for later database (e.g. SQL) queries. +// +// While users are generally free to use key names of their choice, it's +// generally best to avoid using the following keys, as they're frequently used +// by implementations: +// +// * `"caller"`: the calling information (file/line) of a particular log line. +// * `"error"`: the underlying error value in the `Error` method. +// * `"level"`: the log level. +// * `"logger"`: the name of the associated logger. +// * `"msg"`: the log message. +// * `"stacktrace"`: the stack trace associated with a particular log line or +// error (often from the `Error` message). +// * `"ts"`: the timestamp for a log line. +// +// Implementations are encouraged to make use of these keys to represent the +// above concepts, when necessary (for example, in a pure-JSON output form, it +// would be necessary to represent at least message and timestamp as ordinary +// named values). +// +// Implementations may choose to give callers access to the underlying +// logging implementation. The recommended pattern for this is: +// // Underlier exposes access to the underlying logging implementation. +// // Since callers only have a logr.Logger, they have to know which +// // implementation is in use, so this interface is less of an abstraction +// // and more of way to test type conversion. +// type Underlier interface { +// GetUnderlying() +// } +package logr + +import ( + "context" +) + +// TODO: consider adding back in format strings if they're really needed +// TODO: consider other bits of zap/zapcore functionality like ObjectMarshaller (for arbitrary objects) +// TODO: consider other bits of glog functionality like Flush, OutputStats + +// Logger represents the ability to log messages, both errors and not. +type Logger interface { + // Enabled tests whether this Logger is enabled. For example, commandline + // flags might be used to set the logging verbosity and disable some info + // logs. + Enabled() bool + + // Info logs a non-error message with the given key/value pairs as context. + // + // The msg argument should be used to add some constant description to + // the log line. The key/value pairs can then be used to add additional + // variable information. The key/value pairs should alternate string + // keys and arbitrary values. + Info(msg string, keysAndValues ...interface{}) + + // Error logs an error, with the given message and key/value pairs as context. + // It functions similarly to calling Info with the "error" named value, but may + // have unique behavior, and should be preferred for logging errors (see the + // package documentations for more information). + // + // The msg field should be used to add context to any underlying error, + // while the err field should be used to attach the actual error that + // triggered this log line, if present. + Error(err error, msg string, keysAndValues ...interface{}) + + // V returns an Logger value for a specific verbosity level, relative to + // this Logger. In other words, V values are additive. V higher verbosity + // level means a log message is less important. It's illegal to pass a log + // level less than zero. + V(level int) Logger + + // WithValues adds some key-value pairs of context to a logger. + // See Info for documentation on how key/value pairs work. + WithValues(keysAndValues ...interface{}) Logger + + // WithName adds a new element to the logger's name. + // Successive calls with WithName continue to append + // suffixes to the logger's name. It's strongly recommended + // that name segments contain only letters, digits, and hyphens + // (see the package documentation for more information). + WithName(name string) Logger +} + +// InfoLogger provides compatibility with code that relies on the v0.1.0 +// interface. +// +// Deprecated: InfoLogger is an artifact of early versions of this API. New +// users should never use it and existing users should use Logger instead. This +// will be removed in a future release. +type InfoLogger = Logger + +type contextKey struct{} + +// FromContext returns a Logger constructed from ctx or nil if no +// logger details are found. +func FromContext(ctx context.Context) Logger { + if v, ok := ctx.Value(contextKey{}).(Logger); ok { + return v + } + + return nil +} + +// FromContextOrDiscard returns a Logger constructed from ctx or a Logger +// that discards all messages if no logger details are found. +func FromContextOrDiscard(ctx context.Context) Logger { + if v, ok := ctx.Value(contextKey{}).(Logger); ok { + return v + } + + return Discard() +} + +// NewContext returns a new context derived from ctx that embeds the Logger. +func NewContext(ctx context.Context, l Logger) context.Context { + return context.WithValue(ctx, contextKey{}, l) +} + +// CallDepthLogger represents a Logger that knows how to climb the call stack +// to identify the original call site and can offset the depth by a specified +// number of frames. This is useful for users who have helper functions +// between the "real" call site and the actual calls to Logger methods. +// Implementations that log information about the call site (such as file, +// function, or line) would otherwise log information about the intermediate +// helper functions. +// +// This is an optional interface and implementations are not required to +// support it. +type CallDepthLogger interface { + Logger + + // WithCallDepth returns a Logger that will offset the call stack by the + // specified number of frames when logging call site information. If depth + // is 0 the attribution should be to the direct caller of this method. If + // depth is 1 the attribution should skip 1 call frame, and so on. + // Successive calls to this are additive. + WithCallDepth(depth int) Logger +} + +// WithCallDepth returns a Logger that will offset the call stack by the +// specified number of frames when logging call site information, if possible. +// This is useful for users who have helper functions between the "real" call +// site and the actual calls to Logger methods. If depth is 0 the attribution +// should be to the direct caller of this function. If depth is 1 the +// attribution should skip 1 call frame, and so on. Successive calls to this +// are additive. +// +// If the underlying log implementation supports the CallDepthLogger interface, +// the WithCallDepth method will be called and the result returned. If the +// implementation does not support CallDepthLogger, the original Logger will be +// returned. +// +// Callers which care about whether this was supported or not should test for +// CallDepthLogger support themselves. +func WithCallDepth(logger Logger, depth int) Logger { + if decorator, ok := logger.(CallDepthLogger); ok { + return decorator.WithCallDepth(depth) + } + return logger +} diff --git a/integration-test/vendor/github.com/go-logr/zapr/.gitignore b/integration-test/vendor/github.com/go-logr/zapr/.gitignore new file mode 100644 index 000000000..5ba77727f --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/zapr/.gitignore @@ -0,0 +1,3 @@ +*~ +*.swp +/vendor diff --git a/integration-test/vendor/github.com/go-logr/zapr/Gopkg.lock b/integration-test/vendor/github.com/go-logr/zapr/Gopkg.lock new file mode 100644 index 000000000..8da0a8f76 --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/zapr/Gopkg.lock @@ -0,0 +1,52 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + digest = "1:edd2fa4578eb086265db78a9201d15e76b298dfd0d5c379da83e9c61712cf6df" + name = "github.com/go-logr/logr" + packages = ["."] + pruneopts = "UT" + revision = "9fb12b3b21c5415d16ac18dc5cd42c1cfdd40c4e" + version = "v0.1.0" + +[[projects]] + digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d" + name = "go.uber.org/atomic" + packages = ["."] + pruneopts = "UT" + revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" + version = "v1.3.2" + +[[projects]] + digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a" + name = "go.uber.org/multierr" + packages = ["."] + pruneopts = "UT" + revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a" + version = "v1.1.0" + +[[projects]] + digest = "1:9580b1b079114140ade8cec957685344d14f00119e0241f6b369633cb346eeb3" + name = "go.uber.org/zap" + packages = [ + ".", + "buffer", + "internal/bufferpool", + "internal/color", + "internal/exit", + "zapcore", + ] + pruneopts = "UT" + revision = "eeedf312bc6c57391d84767a4cd413f02a917974" + version = "v1.8.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + input-imports = [ + "github.com/go-logr/logr", + "go.uber.org/zap", + "go.uber.org/zap/zapcore", + ] + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/integration-test/vendor/github.com/go-logr/zapr/Gopkg.toml b/integration-test/vendor/github.com/go-logr/zapr/Gopkg.toml new file mode 100644 index 000000000..ae475d72e --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/zapr/Gopkg.toml @@ -0,0 +1,38 @@ +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" +# +# [prune] +# non-go = false +# go-tests = true +# unused-packages = true + + +[[constraint]] + name = "github.com/go-logr/logr" + version = "0.1.0" + +[[constraint]] + name = "go.uber.org/zap" + version = "1.8.0" + +[prune] + go-tests = true + unused-packages = true diff --git a/integration-test/vendor/github.com/go-logr/zapr/LICENSE b/integration-test/vendor/github.com/go-logr/zapr/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/zapr/LICENSE @@ -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. diff --git a/integration-test/vendor/github.com/go-logr/zapr/README.md b/integration-test/vendor/github.com/go-logr/zapr/README.md new file mode 100644 index 000000000..548470ee1 --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/zapr/README.md @@ -0,0 +1,45 @@ +Zapr :zap: +========== + +A [logr](https://github.com/go-logr/logr) implementation using +[Zap](https://github.com/uber-go/zap). + +Usage +----- + +```go +import ( + "fmt" + + "go.uber.org/zap" + "github.com/go-logr/logr" + "github.com/go-logr/zapr" +) + +func main() { + var log logr.Logger + + zapLog, err := zap.NewDevelopment() + if err != nil { + panic(fmt.Sprintf("who watches the watchmen (%v)?", err)) + } + log = zapr.NewLogger(zapLog) + + log.Info("Logr in action!", "the answer", 42) +} +``` + +Implementation Details +---------------------- + +For the most part, concepts in Zap correspond directly with those in logr. + +Unlike Zap, all fields *must* be in the form of suggared fields -- +it's illegal to pass a strongly-typed Zap field in a key position to any +of the logging methods (`Log`, `Error`). + +Levels in logr correspond to custom debug levels in Zap. Any given level +in logr is represents by its inverse in Zap (`zapLevel = -1*logrLevel`). + +For example `V(2)` is equivalent to log level -2 in Zap, while `V(1)` is +equivalent to Zap's `DebugLevel`. diff --git a/integration-test/vendor/github.com/go-logr/zapr/zapr.go b/integration-test/vendor/github.com/go-logr/zapr/zapr.go new file mode 100644 index 000000000..0969a4a47 --- /dev/null +++ b/integration-test/vendor/github.com/go-logr/zapr/zapr.go @@ -0,0 +1,186 @@ +/* +Copyright 2019 The logr Authors. + +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. +*/ + +// Copyright 2018 Solly Ross +// +// 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 zapr defines an implementation of the github.com/go-logr/logr +// interfaces built on top of Zap (go.uber.org/zap). +// +// Usage +// +// A new logr.Logger can be constructed from an existing zap.Logger using +// the NewLogger function: +// +// log := zapr.NewLogger(someZapLogger) +// +// Implementation Details +// +// For the most part, concepts in Zap correspond directly with those in +// logr. +// +// Unlike Zap, all fields *must* be in the form of sugared fields -- +// it's illegal to pass a strongly-typed Zap field in a key position +// to any of the log methods. +// +// Levels in logr correspond to custom debug levels in Zap. Any given level +// in logr is represents by its inverse in zap (`zapLevel = -1*logrLevel`). +// For example V(2) is equivalent to log level -2 in Zap, while V(1) is +// equivalent to Zap's DebugLevel. +package zapr + +import ( + "github.com/go-logr/logr" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// NB: right now, we always use the equivalent of sugared logging. +// This is necessary, since logr doesn't define non-suggared types, +// and using zap-specific non-suggared types would make uses tied +// directly to Zap. + +// zapLogger is a logr.Logger that uses Zap to log. The level has already been +// converted to a Zap level, which is to say that `logrLevel = -1*zapLevel`. +type zapLogger struct { + // NB: this looks very similar to zap.SugaredLogger, but + // deals with our desire to have multiple verbosity levels. + l *zap.Logger + lvl zapcore.Level +} + +// handleFields converts a bunch of arbitrary key-value pairs into Zap fields. It takes +// additional pre-converted Zap fields, for use with automatically attached fields, like +// `error`. +func handleFields(l *zap.Logger, args []interface{}, additional ...zap.Field) []zap.Field { + // a slightly modified version of zap.SugaredLogger.sweetenFields + if len(args) == 0 { + // fast-return if we have no suggared fields. + return additional + } + + // unlike Zap, we can be pretty sure users aren't passing structured + // fields (since logr has no concept of that), so guess that we need a + // little less space. + fields := make([]zap.Field, 0, len(args)/2+len(additional)) + for i := 0; i < len(args); { + // check just in case for strongly-typed Zap fields, which is illegal (since + // it breaks implementation agnosticism), so we can give a better error message. + if _, ok := args[i].(zap.Field); ok { + l.DPanic("strongly-typed Zap Field passed to logr", zap.Any("zap field", args[i])) + break + } + + // make sure this isn't a mismatched key + if i == len(args)-1 { + l.DPanic("odd number of arguments passed as key-value pairs for logging", zap.Any("ignored key", args[i])) + break + } + + // process a key-value pair, + // ensuring that the key is a string + key, val := args[i], args[i+1] + keyStr, isString := key.(string) + if !isString { + // if the key isn't a string, DPanic and stop logging + l.DPanic("non-string key argument passed to logging, ignoring all later arguments", zap.Any("invalid key", key)) + break + } + + fields = append(fields, zap.Any(keyStr, val)) + i += 2 + } + + return append(fields, additional...) +} + +func (zl *zapLogger) Enabled() bool { + return zl.l.Core().Enabled(zl.lvl) +} + +func (zl *zapLogger) Info(msg string, keysAndVals ...interface{}) { + if checkedEntry := zl.l.Check(zl.lvl, msg); checkedEntry != nil { + checkedEntry.Write(handleFields(zl.l, keysAndVals)...) + } +} + +func (zl *zapLogger) Error(err error, msg string, keysAndVals ...interface{}) { + if checkedEntry := zl.l.Check(zap.ErrorLevel, msg); checkedEntry != nil { + checkedEntry.Write(handleFields(zl.l, keysAndVals, zap.Error(err))...) + } +} + +func (zl *zapLogger) V(level int) logr.Logger { + return &zapLogger{ + lvl: zl.lvl - zapcore.Level(level), + l: zl.l, + } +} + +func (zl *zapLogger) WithValues(keysAndValues ...interface{}) logr.Logger { + newLogger := zl.l.With(handleFields(zl.l, keysAndValues)...) + return newLoggerWithExtraSkip(newLogger, 0) +} + +func (zl *zapLogger) WithName(name string) logr.Logger { + newLogger := zl.l.Named(name) + return newLoggerWithExtraSkip(newLogger, 0) +} + +func (zl *zapLogger) WithCallDepth(depth int) logr.Logger { + return newLoggerWithExtraSkip(zl.l, depth) +} + +// Underlier exposes access to the underlying logging implementation. Since +// callers only have a logr.Logger, they have to know which implementation is +// in use, so this interface is less of an abstraction and more of way to test +// type conversion. +type Underlier interface { + GetUnderlying() *zap.Logger +} + +func (zl *zapLogger) GetUnderlying() *zap.Logger { + return zl.l +} + +// newLoggerWithExtraSkip allows creation of loggers with variable levels of callstack skipping +func newLoggerWithExtraSkip(l *zap.Logger, callerSkip int) logr.Logger { + log := l.WithOptions(zap.AddCallerSkip(callerSkip)) + return &zapLogger{ + l: log, + lvl: zap.InfoLevel, + } +} + +// NewLogger creates a new logr.Logger using the given Zap Logger to log. +func NewLogger(l *zap.Logger) logr.Logger { + // creates a new logger skipping one level of callstack + return newLoggerWithExtraSkip(l, 1) +} + +var _ logr.Logger = &zapLogger{} +var _ logr.CallDepthLogger = &zapLogger{} diff --git a/integration-test/vendor/github.com/gogo/protobuf/AUTHORS b/integration-test/vendor/github.com/gogo/protobuf/AUTHORS new file mode 100644 index 000000000..3d97fc7a2 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/AUTHORS @@ -0,0 +1,15 @@ +# This is the official list of GoGo authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS file, which +# lists people. For example, employees are listed in CONTRIBUTORS, +# but not in AUTHORS, because the employer holds the copyright. + +# Names should be added to this file as one of +# Organization's name +# Individual's name +# Individual's name + +# Please keep the list sorted. + +Sendgrid, Inc +Vastech SA (PTY) LTD +Walter Schulze diff --git a/integration-test/vendor/github.com/gogo/protobuf/CONTRIBUTORS b/integration-test/vendor/github.com/gogo/protobuf/CONTRIBUTORS new file mode 100644 index 000000000..1b4f6c208 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/CONTRIBUTORS @@ -0,0 +1,23 @@ +Anton Povarov +Brian Goff +Clayton Coleman +Denis Smirnov +DongYun Kang +Dwayne Schultz +Georg Apitz +Gustav Paul +Johan Brandhorst +John Shahid +John Tuley +Laurent +Patrick Lee +Peter Edge +Roger Johansson +Sam Nguyen +Sergio Arbeo +Stephen J Day +Tamir Duberstein +Todd Eisenberger +Tormod Erevik Lea +Vyacheslav Kim +Walter Schulze diff --git a/integration-test/vendor/github.com/gogo/protobuf/LICENSE b/integration-test/vendor/github.com/gogo/protobuf/LICENSE new file mode 100644 index 000000000..f57de90da --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/LICENSE @@ -0,0 +1,35 @@ +Copyright (c) 2013, The GoGo Authors. All rights reserved. + +Protocol Buffers for Go with Gadgets + +Go support for Protocol Buffers - Google's data interchange format + +Copyright 2010 The Go Authors. All rights reserved. +https://github.com/golang/protobuf + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/Makefile b/integration-test/vendor/github.com/gogo/protobuf/proto/Makefile new file mode 100644 index 000000000..00d65f327 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/Makefile @@ -0,0 +1,43 @@ +# Go support for Protocol Buffers - Google's data interchange format +# +# Copyright 2010 The Go Authors. All rights reserved. +# https://github.com/golang/protobuf +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +install: + go install + +test: install generate-test-pbs + go test + + +generate-test-pbs: + make install + make -C test_proto + make -C proto3_proto + make diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/clone.go b/integration-test/vendor/github.com/gogo/protobuf/proto/clone.go new file mode 100644 index 000000000..a26b046d9 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/clone.go @@ -0,0 +1,258 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2011 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Protocol buffer deep copy and merge. +// TODO: RawMessage. + +package proto + +import ( + "fmt" + "log" + "reflect" + "strings" +) + +// Clone returns a deep copy of a protocol buffer. +func Clone(src Message) Message { + in := reflect.ValueOf(src) + if in.IsNil() { + return src + } + out := reflect.New(in.Type().Elem()) + dst := out.Interface().(Message) + Merge(dst, src) + return dst +} + +// Merger is the interface representing objects that can merge messages of the same type. +type Merger interface { + // Merge merges src into this message. + // Required and optional fields that are set in src will be set to that value in dst. + // Elements of repeated fields will be appended. + // + // Merge may panic if called with a different argument type than the receiver. + Merge(src Message) +} + +// generatedMerger is the custom merge method that generated protos will have. +// We must add this method since a generate Merge method will conflict with +// many existing protos that have a Merge data field already defined. +type generatedMerger interface { + XXX_Merge(src Message) +} + +// Merge merges src into dst. +// Required and optional fields that are set in src will be set to that value in dst. +// Elements of repeated fields will be appended. +// Merge panics if src and dst are not the same type, or if dst is nil. +func Merge(dst, src Message) { + if m, ok := dst.(Merger); ok { + m.Merge(src) + return + } + + in := reflect.ValueOf(src) + out := reflect.ValueOf(dst) + if out.IsNil() { + panic("proto: nil destination") + } + if in.Type() != out.Type() { + panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) + } + if in.IsNil() { + return // Merge from nil src is a noop + } + if m, ok := dst.(generatedMerger); ok { + m.XXX_Merge(src) + return + } + mergeStruct(out.Elem(), in.Elem()) +} + +func mergeStruct(out, in reflect.Value) { + sprop := GetProperties(in.Type()) + for i := 0; i < in.NumField(); i++ { + f := in.Type().Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) + } + + if emIn, ok := in.Addr().Interface().(extensionsBytes); ok { + emOut := out.Addr().Interface().(extensionsBytes) + bIn := emIn.GetExtensions() + bOut := emOut.GetExtensions() + *bOut = append(*bOut, *bIn...) + } else if emIn, err := extendable(in.Addr().Interface()); err == nil { + emOut, _ := extendable(out.Addr().Interface()) + mIn, muIn := emIn.extensionsRead() + if mIn != nil { + mOut := emOut.extensionsWrite() + muIn.Lock() + mergeExtension(mOut, mIn) + muIn.Unlock() + } + } + + uf := in.FieldByName("XXX_unrecognized") + if !uf.IsValid() { + return + } + uin := uf.Bytes() + if len(uin) > 0 { + out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) + } +} + +// mergeAny performs a merge between two values of the same type. +// viaPtr indicates whether the values were indirected through a pointer (implying proto2). +// prop is set if this is a struct field (it may be nil). +func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { + if in.Type() == protoMessageType { + if !in.IsNil() { + if out.IsNil() { + out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) + } else { + Merge(out.Interface().(Message), in.Interface().(Message)) + } + } + return + } + switch in.Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, + reflect.String, reflect.Uint32, reflect.Uint64: + if !viaPtr && isProto3Zero(in) { + return + } + out.Set(in) + case reflect.Interface: + // Probably a oneof field; copy non-nil values. + if in.IsNil() { + return + } + // Allocate destination if it is not set, or set to a different type. + // Otherwise we will merge as normal. + if out.IsNil() || out.Elem().Type() != in.Elem().Type() { + out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) + } + mergeAny(out.Elem(), in.Elem(), false, nil) + case reflect.Map: + if in.Len() == 0 { + return + } + if out.IsNil() { + out.Set(reflect.MakeMap(in.Type())) + } + // For maps with value types of *T or []byte we need to deep copy each value. + elemKind := in.Type().Elem().Kind() + for _, key := range in.MapKeys() { + var val reflect.Value + switch elemKind { + case reflect.Ptr: + val = reflect.New(in.Type().Elem().Elem()) + mergeAny(val, in.MapIndex(key), false, nil) + case reflect.Slice: + val = in.MapIndex(key) + val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) + default: + val = in.MapIndex(key) + } + out.SetMapIndex(key, val) + } + case reflect.Ptr: + if in.IsNil() { + return + } + if out.IsNil() { + out.Set(reflect.New(in.Elem().Type())) + } + mergeAny(out.Elem(), in.Elem(), true, nil) + case reflect.Slice: + if in.IsNil() { + return + } + if in.Type().Elem().Kind() == reflect.Uint8 { + // []byte is a scalar bytes field, not a repeated field. + + // Edge case: if this is in a proto3 message, a zero length + // bytes field is considered the zero value, and should not + // be merged. + if prop != nil && prop.proto3 && in.Len() == 0 { + return + } + + // Make a deep copy. + // Append to []byte{} instead of []byte(nil) so that we never end up + // with a nil result. + out.SetBytes(append([]byte{}, in.Bytes()...)) + return + } + n := in.Len() + if out.IsNil() { + out.Set(reflect.MakeSlice(in.Type(), 0, n)) + } + switch in.Type().Elem().Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, + reflect.String, reflect.Uint32, reflect.Uint64: + out.Set(reflect.AppendSlice(out, in)) + default: + for i := 0; i < n; i++ { + x := reflect.Indirect(reflect.New(in.Type().Elem())) + mergeAny(x, in.Index(i), false, nil) + out.Set(reflect.Append(out, x)) + } + } + case reflect.Struct: + mergeStruct(out, in) + default: + // unknown type, so not a protocol buffer + log.Printf("proto: don't know how to copy %v", in) + } +} + +func mergeExtension(out, in map[int32]Extension) { + for extNum, eIn := range in { + eOut := Extension{desc: eIn.desc} + if eIn.value != nil { + v := reflect.New(reflect.TypeOf(eIn.value)).Elem() + mergeAny(v, reflect.ValueOf(eIn.value), false, nil) + eOut.value = v.Interface() + } + if eIn.enc != nil { + eOut.enc = make([]byte, len(eIn.enc)) + copy(eOut.enc, eIn.enc) + } + + out[extNum] = eOut + } +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/custom_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/custom_gogo.go new file mode 100644 index 000000000..24552483c --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/custom_gogo.go @@ -0,0 +1,39 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import "reflect" + +type custom interface { + Marshal() ([]byte, error) + Unmarshal(data []byte) error + Size() int +} + +var customType = reflect.TypeOf((*custom)(nil)).Elem() diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/decode.go b/integration-test/vendor/github.com/gogo/protobuf/proto/decode.go new file mode 100644 index 000000000..63b0f08be --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/decode.go @@ -0,0 +1,427 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Routines for decoding protocol buffer data to construct in-memory representations. + */ + +import ( + "errors" + "fmt" + "io" +) + +// errOverflow is returned when an integer is too large to be represented. +var errOverflow = errors.New("proto: integer overflow") + +// ErrInternalBadWireType is returned by generated code when an incorrect +// wire type is encountered. It does not get returned to user code. +var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") + +// DecodeVarint reads a varint-encoded integer from the slice. +// It returns the integer and the number of bytes consumed, or +// zero if there is not enough. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func DecodeVarint(buf []byte) (x uint64, n int) { + for shift := uint(0); shift < 64; shift += 7 { + if n >= len(buf) { + return 0, 0 + } + b := uint64(buf[n]) + n++ + x |= (b & 0x7F) << shift + if (b & 0x80) == 0 { + return x, n + } + } + + // The number is too large to represent in a 64-bit value. + return 0, 0 +} + +func (p *Buffer) decodeVarintSlow() (x uint64, err error) { + i := p.index + l := len(p.buf) + + for shift := uint(0); shift < 64; shift += 7 { + if i >= l { + err = io.ErrUnexpectedEOF + return + } + b := p.buf[i] + i++ + x |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + p.index = i + return + } + } + + // The number is too large to represent in a 64-bit value. + err = errOverflow + return +} + +// DecodeVarint reads a varint-encoded integer from the Buffer. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func (p *Buffer) DecodeVarint() (x uint64, err error) { + i := p.index + buf := p.buf + + if i >= len(buf) { + return 0, io.ErrUnexpectedEOF + } else if buf[i] < 0x80 { + p.index++ + return uint64(buf[i]), nil + } else if len(buf)-i < 10 { + return p.decodeVarintSlow() + } + + var b uint64 + // we already checked the first byte + x = uint64(buf[i]) - 0x80 + i++ + + b = uint64(buf[i]) + i++ + x += b << 7 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 7 + + b = uint64(buf[i]) + i++ + x += b << 14 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 14 + + b = uint64(buf[i]) + i++ + x += b << 21 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 21 + + b = uint64(buf[i]) + i++ + x += b << 28 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 28 + + b = uint64(buf[i]) + i++ + x += b << 35 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 35 + + b = uint64(buf[i]) + i++ + x += b << 42 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 42 + + b = uint64(buf[i]) + i++ + x += b << 49 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 49 + + b = uint64(buf[i]) + i++ + x += b << 56 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 56 + + b = uint64(buf[i]) + i++ + x += b << 63 + if b&0x80 == 0 { + goto done + } + + return 0, errOverflow + +done: + p.index = i + return x, nil +} + +// DecodeFixed64 reads a 64-bit integer from the Buffer. +// This is the format for the +// fixed64, sfixed64, and double protocol buffer types. +func (p *Buffer) DecodeFixed64() (x uint64, err error) { + // x, err already 0 + i := p.index + 8 + if i < 0 || i > len(p.buf) { + err = io.ErrUnexpectedEOF + return + } + p.index = i + + x = uint64(p.buf[i-8]) + x |= uint64(p.buf[i-7]) << 8 + x |= uint64(p.buf[i-6]) << 16 + x |= uint64(p.buf[i-5]) << 24 + x |= uint64(p.buf[i-4]) << 32 + x |= uint64(p.buf[i-3]) << 40 + x |= uint64(p.buf[i-2]) << 48 + x |= uint64(p.buf[i-1]) << 56 + return +} + +// DecodeFixed32 reads a 32-bit integer from the Buffer. +// This is the format for the +// fixed32, sfixed32, and float protocol buffer types. +func (p *Buffer) DecodeFixed32() (x uint64, err error) { + // x, err already 0 + i := p.index + 4 + if i < 0 || i > len(p.buf) { + err = io.ErrUnexpectedEOF + return + } + p.index = i + + x = uint64(p.buf[i-4]) + x |= uint64(p.buf[i-3]) << 8 + x |= uint64(p.buf[i-2]) << 16 + x |= uint64(p.buf[i-1]) << 24 + return +} + +// DecodeZigzag64 reads a zigzag-encoded 64-bit integer +// from the Buffer. +// This is the format used for the sint64 protocol buffer type. +func (p *Buffer) DecodeZigzag64() (x uint64, err error) { + x, err = p.DecodeVarint() + if err != nil { + return + } + x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) + return +} + +// DecodeZigzag32 reads a zigzag-encoded 32-bit integer +// from the Buffer. +// This is the format used for the sint32 protocol buffer type. +func (p *Buffer) DecodeZigzag32() (x uint64, err error) { + x, err = p.DecodeVarint() + if err != nil { + return + } + x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) + return +} + +// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. +// This is the format used for the bytes protocol buffer +// type and for embedded messages. +func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { + n, err := p.DecodeVarint() + if err != nil { + return nil, err + } + + nb := int(n) + if nb < 0 { + return nil, fmt.Errorf("proto: bad byte length %d", nb) + } + end := p.index + nb + if end < p.index || end > len(p.buf) { + return nil, io.ErrUnexpectedEOF + } + + if !alloc { + // todo: check if can get more uses of alloc=false + buf = p.buf[p.index:end] + p.index += nb + return + } + + buf = make([]byte, nb) + copy(buf, p.buf[p.index:]) + p.index += nb + return +} + +// DecodeStringBytes reads an encoded string from the Buffer. +// This is the format used for the proto2 string type. +func (p *Buffer) DecodeStringBytes() (s string, err error) { + buf, err := p.DecodeRawBytes(false) + if err != nil { + return + } + return string(buf), nil +} + +// Unmarshaler is the interface representing objects that can +// unmarshal themselves. The argument points to data that may be +// overwritten, so implementations should not keep references to the +// buffer. +// Unmarshal implementations should not clear the receiver. +// Any unmarshaled data should be merged into the receiver. +// Callers of Unmarshal that do not want to retain existing data +// should Reset the receiver before calling Unmarshal. +type Unmarshaler interface { + Unmarshal([]byte) error +} + +// newUnmarshaler is the interface representing objects that can +// unmarshal themselves. The semantics are identical to Unmarshaler. +// +// This exists to support protoc-gen-go generated messages. +// The proto package will stop type-asserting to this interface in the future. +// +// DO NOT DEPEND ON THIS. +type newUnmarshaler interface { + XXX_Unmarshal([]byte) error +} + +// Unmarshal parses the protocol buffer representation in buf and places the +// decoded result in pb. If the struct underlying pb does not match +// the data in buf, the results can be unpredictable. +// +// Unmarshal resets pb before starting to unmarshal, so any +// existing data in pb is always removed. Use UnmarshalMerge +// to preserve and append to existing data. +func Unmarshal(buf []byte, pb Message) error { + pb.Reset() + if u, ok := pb.(newUnmarshaler); ok { + return u.XXX_Unmarshal(buf) + } + if u, ok := pb.(Unmarshaler); ok { + return u.Unmarshal(buf) + } + return NewBuffer(buf).Unmarshal(pb) +} + +// UnmarshalMerge parses the protocol buffer representation in buf and +// writes the decoded result to pb. If the struct underlying pb does not match +// the data in buf, the results can be unpredictable. +// +// UnmarshalMerge merges into existing data in pb. +// Most code should use Unmarshal instead. +func UnmarshalMerge(buf []byte, pb Message) error { + if u, ok := pb.(newUnmarshaler); ok { + return u.XXX_Unmarshal(buf) + } + if u, ok := pb.(Unmarshaler); ok { + // NOTE: The history of proto have unfortunately been inconsistent + // whether Unmarshaler should or should not implicitly clear itself. + // Some implementations do, most do not. + // Thus, calling this here may or may not do what people want. + // + // See https://github.com/golang/protobuf/issues/424 + return u.Unmarshal(buf) + } + return NewBuffer(buf).Unmarshal(pb) +} + +// DecodeMessage reads a count-delimited message from the Buffer. +func (p *Buffer) DecodeMessage(pb Message) error { + enc, err := p.DecodeRawBytes(false) + if err != nil { + return err + } + return NewBuffer(enc).Unmarshal(pb) +} + +// DecodeGroup reads a tag-delimited group from the Buffer. +// StartGroup tag is already consumed. This function consumes +// EndGroup tag. +func (p *Buffer) DecodeGroup(pb Message) error { + b := p.buf[p.index:] + x, y := findEndGroup(b) + if x < 0 { + return io.ErrUnexpectedEOF + } + err := Unmarshal(b[:x], pb) + p.index += y + return err +} + +// Unmarshal parses the protocol buffer representation in the +// Buffer and places the decoded result in pb. If the struct +// underlying pb does not match the data in the buffer, the results can be +// unpredictable. +// +// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. +func (p *Buffer) Unmarshal(pb Message) error { + // If the object can unmarshal itself, let it. + if u, ok := pb.(newUnmarshaler); ok { + err := u.XXX_Unmarshal(p.buf[p.index:]) + p.index = len(p.buf) + return err + } + if u, ok := pb.(Unmarshaler); ok { + // NOTE: The history of proto have unfortunately been inconsistent + // whether Unmarshaler should or should not implicitly clear itself. + // Some implementations do, most do not. + // Thus, calling this here may or may not do what people want. + // + // See https://github.com/golang/protobuf/issues/424 + err := u.Unmarshal(p.buf[p.index:]) + p.index = len(p.buf) + return err + } + + // Slow workaround for messages that aren't Unmarshalers. + // This includes some hand-coded .pb.go files and + // bootstrap protos. + // TODO: fix all of those and then add Unmarshal to + // the Message interface. Then: + // The cast above and code below can be deleted. + // The old unmarshaler can be deleted. + // Clients can call Unmarshal directly (can already do that, actually). + var info InternalMessageInfo + err := info.Unmarshal(pb, p.buf[p.index:]) + p.index = len(p.buf) + return err +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/deprecated.go b/integration-test/vendor/github.com/gogo/protobuf/proto/deprecated.go new file mode 100644 index 000000000..35b882c09 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/deprecated.go @@ -0,0 +1,63 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import "errors" + +// Deprecated: do not use. +type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } + +// Deprecated: do not use. +func GetStats() Stats { return Stats{} } + +// Deprecated: do not use. +func MarshalMessageSet(interface{}) ([]byte, error) { + return nil, errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func UnmarshalMessageSet([]byte, interface{}) error { + return errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func MarshalMessageSetJSON(interface{}) ([]byte, error) { + return nil, errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func UnmarshalMessageSetJSON([]byte, interface{}) error { + return errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func RegisterMessageSetType(Message, int32, string) {} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/discard.go b/integration-test/vendor/github.com/gogo/protobuf/proto/discard.go new file mode 100644 index 000000000..fe1bd7d90 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/discard.go @@ -0,0 +1,350 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2017 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" + "strings" + "sync" + "sync/atomic" +) + +type generatedDiscarder interface { + XXX_DiscardUnknown() +} + +// DiscardUnknown recursively discards all unknown fields from this message +// and all embedded messages. +// +// When unmarshaling a message with unrecognized fields, the tags and values +// of such fields are preserved in the Message. This allows a later call to +// marshal to be able to produce a message that continues to have those +// unrecognized fields. To avoid this, DiscardUnknown is used to +// explicitly clear the unknown fields after unmarshaling. +// +// For proto2 messages, the unknown fields of message extensions are only +// discarded from messages that have been accessed via GetExtension. +func DiscardUnknown(m Message) { + if m, ok := m.(generatedDiscarder); ok { + m.XXX_DiscardUnknown() + return + } + // TODO: Dynamically populate a InternalMessageInfo for legacy messages, + // but the master branch has no implementation for InternalMessageInfo, + // so it would be more work to replicate that approach. + discardLegacy(m) +} + +// DiscardUnknown recursively discards all unknown fields. +func (a *InternalMessageInfo) DiscardUnknown(m Message) { + di := atomicLoadDiscardInfo(&a.discard) + if di == nil { + di = getDiscardInfo(reflect.TypeOf(m).Elem()) + atomicStoreDiscardInfo(&a.discard, di) + } + di.discard(toPointer(&m)) +} + +type discardInfo struct { + typ reflect.Type + + initialized int32 // 0: only typ is valid, 1: everything is valid + lock sync.Mutex + + fields []discardFieldInfo + unrecognized field +} + +type discardFieldInfo struct { + field field // Offset of field, guaranteed to be valid + discard func(src pointer) +} + +var ( + discardInfoMap = map[reflect.Type]*discardInfo{} + discardInfoLock sync.Mutex +) + +func getDiscardInfo(t reflect.Type) *discardInfo { + discardInfoLock.Lock() + defer discardInfoLock.Unlock() + di := discardInfoMap[t] + if di == nil { + di = &discardInfo{typ: t} + discardInfoMap[t] = di + } + return di +} + +func (di *discardInfo) discard(src pointer) { + if src.isNil() { + return // Nothing to do. + } + + if atomic.LoadInt32(&di.initialized) == 0 { + di.computeDiscardInfo() + } + + for _, fi := range di.fields { + sfp := src.offset(fi.field) + fi.discard(sfp) + } + + // For proto2 messages, only discard unknown fields in message extensions + // that have been accessed via GetExtension. + if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { + // Ignore lock since DiscardUnknown is not concurrency safe. + emm, _ := em.extensionsRead() + for _, mx := range emm { + if m, ok := mx.value.(Message); ok { + DiscardUnknown(m) + } + } + } + + if di.unrecognized.IsValid() { + *src.offset(di.unrecognized).toBytes() = nil + } +} + +func (di *discardInfo) computeDiscardInfo() { + di.lock.Lock() + defer di.lock.Unlock() + if di.initialized != 0 { + return + } + t := di.typ + n := t.NumField() + + for i := 0; i < n; i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + + dfi := discardFieldInfo{field: toField(&f)} + tf := f.Type + + // Unwrap tf to get its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name)) + } + + switch tf.Kind() { + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) + case isSlice: // E.g., []*pb.T + discardInfo := getDiscardInfo(tf) + dfi.discard = func(src pointer) { + sps := src.getPointerSlice() + for _, sp := range sps { + if !sp.isNil() { + discardInfo.discard(sp) + } + } + } + default: // E.g., *pb.T + discardInfo := getDiscardInfo(tf) + dfi.discard = func(src pointer) { + sp := src.getPointer() + if !sp.isNil() { + discardInfo.discard(sp) + } + } + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name)) + default: // E.g., map[K]V + if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T) + dfi.discard = func(src pointer) { + sm := src.asPointerTo(tf).Elem() + if sm.Len() == 0 { + return + } + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + DiscardUnknown(val.Interface().(Message)) + } + } + } else { + dfi.discard = func(pointer) {} // Noop + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name)) + default: // E.g., interface{} + // TODO: Make this faster? + dfi.discard = func(src pointer) { + su := src.asPointerTo(tf).Elem() + if !su.IsNil() { + sv := su.Elem().Elem().Field(0) + if sv.Kind() == reflect.Ptr && sv.IsNil() { + return + } + switch sv.Type().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + DiscardUnknown(sv.Interface().(Message)) + } + } + } + } + default: + continue + } + di.fields = append(di.fields, dfi) + } + + di.unrecognized = invalidField + if f, ok := t.FieldByName("XXX_unrecognized"); ok { + if f.Type != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + di.unrecognized = toField(&f) + } + + atomic.StoreInt32(&di.initialized, 1) +} + +func discardLegacy(m Message) { + v := reflect.ValueOf(m) + if v.Kind() != reflect.Ptr || v.IsNil() { + return + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return + } + t := v.Type() + + for i := 0; i < v.NumField(); i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + vf := v.Field(i) + tf := f.Type + + // Unwrap tf to get its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) + } + + switch tf.Kind() { + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) + case isSlice: // E.g., []*pb.T + for j := 0; j < vf.Len(); j++ { + discardLegacy(vf.Index(j).Interface().(Message)) + } + default: // E.g., *pb.T + discardLegacy(vf.Interface().(Message)) + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) + default: // E.g., map[K]V + tv := vf.Type().Elem() + if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) + for _, key := range vf.MapKeys() { + val := vf.MapIndex(key) + discardLegacy(val.Interface().(Message)) + } + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) + default: // E.g., test_proto.isCommunique_Union interface + if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { + vf = vf.Elem() // E.g., *test_proto.Communique_Msg + if !vf.IsNil() { + vf = vf.Elem() // E.g., test_proto.Communique_Msg + vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value + if vf.Kind() == reflect.Ptr { + discardLegacy(vf.Interface().(Message)) + } + } + } + } + } + } + + if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { + if vf.Type() != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + vf.Set(reflect.ValueOf([]byte(nil))) + } + + // For proto2 messages, only discard unknown fields in message extensions + // that have been accessed via GetExtension. + if em, err := extendable(m); err == nil { + // Ignore lock since discardLegacy is not concurrency safe. + emm, _ := em.extensionsRead() + for _, mx := range emm { + if m, ok := mx.value.(Message); ok { + discardLegacy(m) + } + } + } +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/duration.go b/integration-test/vendor/github.com/gogo/protobuf/proto/duration.go new file mode 100644 index 000000000..93464c91c --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/duration.go @@ -0,0 +1,100 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +// This file implements conversions between google.protobuf.Duration +// and time.Duration. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Range of a Duration in seconds, as specified in + // google/protobuf/duration.proto. This is about 10,000 years in seconds. + maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) + minSeconds = -maxSeconds +) + +// validateDuration determines whether the Duration is valid according to the +// definition in google/protobuf/duration.proto. A valid Duration +// may still be too large to fit into a time.Duration (the range of Duration +// is about 10,000 years, and the range of time.Duration is about 290). +func validateDuration(d *duration) error { + if d == nil { + return errors.New("duration: nil Duration") + } + if d.Seconds < minSeconds || d.Seconds > maxSeconds { + return fmt.Errorf("duration: %#v: seconds out of range", d) + } + if d.Nanos <= -1e9 || d.Nanos >= 1e9 { + return fmt.Errorf("duration: %#v: nanos out of range", d) + } + // Seconds and Nanos must have the same sign, unless d.Nanos is zero. + if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { + return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) + } + return nil +} + +// DurationFromProto converts a Duration to a time.Duration. DurationFromProto +// returns an error if the Duration is invalid or is too large to be +// represented in a time.Duration. +func durationFromProto(p *duration) (time.Duration, error) { + if err := validateDuration(p); err != nil { + return 0, err + } + d := time.Duration(p.Seconds) * time.Second + if int64(d/time.Second) != p.Seconds { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + if p.Nanos != 0 { + d += time.Duration(p.Nanos) + if (d < 0) != (p.Nanos < 0) { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + } + return d, nil +} + +// DurationProto converts a time.Duration to a Duration. +func durationProto(d time.Duration) *duration { + nanos := d.Nanoseconds() + secs := nanos / 1e9 + nanos -= secs * 1e9 + return &duration{ + Seconds: secs, + Nanos: int32(nanos), + } +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/duration_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/duration_gogo.go new file mode 100644 index 000000000..e748e1730 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/duration_gogo.go @@ -0,0 +1,49 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "reflect" + "time" +) + +var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem() + +type duration struct { + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` +} + +func (m *duration) Reset() { *m = duration{} } +func (*duration) ProtoMessage() {} +func (*duration) String() string { return "duration" } + +func init() { + RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/encode.go b/integration-test/vendor/github.com/gogo/protobuf/proto/encode.go new file mode 100644 index 000000000..9581ccd30 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/encode.go @@ -0,0 +1,205 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Routines for encoding data into the wire format for protocol buffers. + */ + +import ( + "errors" + "reflect" +) + +var ( + // errRepeatedHasNil is the error returned if Marshal is called with + // a struct with a repeated field containing a nil element. + errRepeatedHasNil = errors.New("proto: repeated field has nil element") + + // errOneofHasNil is the error returned if Marshal is called with + // a struct with a oneof field containing a nil element. + errOneofHasNil = errors.New("proto: oneof field has nil value") + + // ErrNil is the error returned if Marshal is called with nil. + ErrNil = errors.New("proto: Marshal called with nil") + + // ErrTooLarge is the error returned if Marshal is called with a + // message that encodes to >2GB. + ErrTooLarge = errors.New("proto: message encodes to over 2 GB") +) + +// The fundamental encoders that put bytes on the wire. +// Those that take integer types all accept uint64 and are +// therefore of type valueEncoder. + +const maxVarintBytes = 10 // maximum length of a varint + +// EncodeVarint returns the varint encoding of x. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +// Not used by the package itself, but helpful to clients +// wishing to use the same encoding. +func EncodeVarint(x uint64) []byte { + var buf [maxVarintBytes]byte + var n int + for n = 0; x > 127; n++ { + buf[n] = 0x80 | uint8(x&0x7F) + x >>= 7 + } + buf[n] = uint8(x) + n++ + return buf[0:n] +} + +// EncodeVarint writes a varint-encoded integer to the Buffer. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func (p *Buffer) EncodeVarint(x uint64) error { + for x >= 1<<7 { + p.buf = append(p.buf, uint8(x&0x7f|0x80)) + x >>= 7 + } + p.buf = append(p.buf, uint8(x)) + return nil +} + +// SizeVarint returns the varint encoding size of an integer. +func SizeVarint(x uint64) int { + switch { + case x < 1<<7: + return 1 + case x < 1<<14: + return 2 + case x < 1<<21: + return 3 + case x < 1<<28: + return 4 + case x < 1<<35: + return 5 + case x < 1<<42: + return 6 + case x < 1<<49: + return 7 + case x < 1<<56: + return 8 + case x < 1<<63: + return 9 + } + return 10 +} + +// EncodeFixed64 writes a 64-bit integer to the Buffer. +// This is the format for the +// fixed64, sfixed64, and double protocol buffer types. +func (p *Buffer) EncodeFixed64(x uint64) error { + p.buf = append(p.buf, + uint8(x), + uint8(x>>8), + uint8(x>>16), + uint8(x>>24), + uint8(x>>32), + uint8(x>>40), + uint8(x>>48), + uint8(x>>56)) + return nil +} + +// EncodeFixed32 writes a 32-bit integer to the Buffer. +// This is the format for the +// fixed32, sfixed32, and float protocol buffer types. +func (p *Buffer) EncodeFixed32(x uint64) error { + p.buf = append(p.buf, + uint8(x), + uint8(x>>8), + uint8(x>>16), + uint8(x>>24)) + return nil +} + +// EncodeZigzag64 writes a zigzag-encoded 64-bit integer +// to the Buffer. +// This is the format used for the sint64 protocol buffer type. +func (p *Buffer) EncodeZigzag64(x uint64) error { + // use signed number to get arithmetic right shift. + return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} + +// EncodeZigzag32 writes a zigzag-encoded 32-bit integer +// to the Buffer. +// This is the format used for the sint32 protocol buffer type. +func (p *Buffer) EncodeZigzag32(x uint64) error { + // use signed number to get arithmetic right shift. + return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) +} + +// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. +// This is the format used for the bytes protocol buffer +// type and for embedded messages. +func (p *Buffer) EncodeRawBytes(b []byte) error { + p.EncodeVarint(uint64(len(b))) + p.buf = append(p.buf, b...) + return nil +} + +// EncodeStringBytes writes an encoded string to the Buffer. +// This is the format used for the proto2 string type. +func (p *Buffer) EncodeStringBytes(s string) error { + p.EncodeVarint(uint64(len(s))) + p.buf = append(p.buf, s...) + return nil +} + +// Marshaler is the interface representing objects that can marshal themselves. +type Marshaler interface { + Marshal() ([]byte, error) +} + +// EncodeMessage writes the protocol buffer to the Buffer, +// prefixed by a varint-encoded length. +func (p *Buffer) EncodeMessage(pb Message) error { + siz := Size(pb) + sizVar := SizeVarint(uint64(siz)) + p.grow(siz + sizVar) + p.EncodeVarint(uint64(siz)) + return p.Marshal(pb) +} + +// All protocol buffer fields are nillable, but be careful. +func isNil(v reflect.Value) bool { + switch v.Kind() { + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return v.IsNil() + } + return false +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/encode_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/encode_gogo.go new file mode 100644 index 000000000..0f5fb173e --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/encode_gogo.go @@ -0,0 +1,33 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +func NewRequiredNotSetError(field string) *RequiredNotSetError { + return &RequiredNotSetError{field} +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/equal.go b/integration-test/vendor/github.com/gogo/protobuf/proto/equal.go new file mode 100644 index 000000000..d4db5a1c1 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/equal.go @@ -0,0 +1,300 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2011 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Protocol buffer comparison. + +package proto + +import ( + "bytes" + "log" + "reflect" + "strings" +) + +/* +Equal returns true iff protocol buffers a and b are equal. +The arguments must both be pointers to protocol buffer structs. + +Equality is defined in this way: + - Two messages are equal iff they are the same type, + corresponding fields are equal, unknown field sets + are equal, and extensions sets are equal. + - Two set scalar fields are equal iff their values are equal. + If the fields are of a floating-point type, remember that + NaN != x for all x, including NaN. If the message is defined + in a proto3 .proto file, fields are not "set"; specifically, + zero length proto3 "bytes" fields are equal (nil == {}). + - Two repeated fields are equal iff their lengths are the same, + and their corresponding elements are equal. Note a "bytes" field, + although represented by []byte, is not a repeated field and the + rule for the scalar fields described above applies. + - Two unset fields are equal. + - Two unknown field sets are equal if their current + encoded state is equal. + - Two extension sets are equal iff they have corresponding + elements that are pairwise equal. + - Two map fields are equal iff their lengths are the same, + and they contain the same set of elements. Zero-length map + fields are equal. + - Every other combination of things are not equal. + +The return value is undefined if a and b are not protocol buffers. +*/ +func Equal(a, b Message) bool { + if a == nil || b == nil { + return a == b + } + v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) + if v1.Type() != v2.Type() { + return false + } + if v1.Kind() == reflect.Ptr { + if v1.IsNil() { + return v2.IsNil() + } + if v2.IsNil() { + return false + } + v1, v2 = v1.Elem(), v2.Elem() + } + if v1.Kind() != reflect.Struct { + return false + } + return equalStruct(v1, v2) +} + +// v1 and v2 are known to have the same type. +func equalStruct(v1, v2 reflect.Value) bool { + sprop := GetProperties(v1.Type()) + for i := 0; i < v1.NumField(); i++ { + f := v1.Type().Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + f1, f2 := v1.Field(i), v2.Field(i) + if f.Type.Kind() == reflect.Ptr { + if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { + // both unset + continue + } else if n1 != n2 { + // set/unset mismatch + return false + } + f1, f2 = f1.Elem(), f2.Elem() + } + if !equalAny(f1, f2, sprop.Prop[i]) { + return false + } + } + + if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { + em2 := v2.FieldByName("XXX_InternalExtensions") + if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { + return false + } + } + + if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { + em2 := v2.FieldByName("XXX_extensions") + if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { + return false + } + } + + uf := v1.FieldByName("XXX_unrecognized") + if !uf.IsValid() { + return true + } + + u1 := uf.Bytes() + u2 := v2.FieldByName("XXX_unrecognized").Bytes() + return bytes.Equal(u1, u2) +} + +// v1 and v2 are known to have the same type. +// prop may be nil. +func equalAny(v1, v2 reflect.Value, prop *Properties) bool { + if v1.Type() == protoMessageType { + m1, _ := v1.Interface().(Message) + m2, _ := v2.Interface().(Message) + return Equal(m1, m2) + } + switch v1.Kind() { + case reflect.Bool: + return v1.Bool() == v2.Bool() + case reflect.Float32, reflect.Float64: + return v1.Float() == v2.Float() + case reflect.Int32, reflect.Int64: + return v1.Int() == v2.Int() + case reflect.Interface: + // Probably a oneof field; compare the inner values. + n1, n2 := v1.IsNil(), v2.IsNil() + if n1 || n2 { + return n1 == n2 + } + e1, e2 := v1.Elem(), v2.Elem() + if e1.Type() != e2.Type() { + return false + } + return equalAny(e1, e2, nil) + case reflect.Map: + if v1.Len() != v2.Len() { + return false + } + for _, key := range v1.MapKeys() { + val2 := v2.MapIndex(key) + if !val2.IsValid() { + // This key was not found in the second map. + return false + } + if !equalAny(v1.MapIndex(key), val2, nil) { + return false + } + } + return true + case reflect.Ptr: + // Maps may have nil values in them, so check for nil. + if v1.IsNil() && v2.IsNil() { + return true + } + if v1.IsNil() != v2.IsNil() { + return false + } + return equalAny(v1.Elem(), v2.Elem(), prop) + case reflect.Slice: + if v1.Type().Elem().Kind() == reflect.Uint8 { + // short circuit: []byte + + // Edge case: if this is in a proto3 message, a zero length + // bytes field is considered the zero value. + if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { + return true + } + if v1.IsNil() != v2.IsNil() { + return false + } + return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) + } + + if v1.Len() != v2.Len() { + return false + } + for i := 0; i < v1.Len(); i++ { + if !equalAny(v1.Index(i), v2.Index(i), prop) { + return false + } + } + return true + case reflect.String: + return v1.Interface().(string) == v2.Interface().(string) + case reflect.Struct: + return equalStruct(v1, v2) + case reflect.Uint32, reflect.Uint64: + return v1.Uint() == v2.Uint() + } + + // unknown type, so not a protocol buffer + log.Printf("proto: don't know how to compare %v", v1) + return false +} + +// base is the struct type that the extensions are based on. +// x1 and x2 are InternalExtensions. +func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { + em1, _ := x1.extensionsRead() + em2, _ := x2.extensionsRead() + return equalExtMap(base, em1, em2) +} + +func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { + if len(em1) != len(em2) { + return false + } + + for extNum, e1 := range em1 { + e2, ok := em2[extNum] + if !ok { + return false + } + + m1, m2 := e1.value, e2.value + + if m1 == nil && m2 == nil { + // Both have only encoded form. + if bytes.Equal(e1.enc, e2.enc) { + continue + } + // The bytes are different, but the extensions might still be + // equal. We need to decode them to compare. + } + + if m1 != nil && m2 != nil { + // Both are unencoded. + if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + return false + } + continue + } + + // At least one is encoded. To do a semantically correct comparison + // we need to unmarshal them first. + var desc *ExtensionDesc + if m := extensionMaps[base]; m != nil { + desc = m[extNum] + } + if desc == nil { + // If both have only encoded form and the bytes are the same, + // it is handled above. We get here when the bytes are different. + // We don't know how to decode it, so just compare them as byte + // slices. + log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) + return false + } + var err error + if m1 == nil { + m1, err = decodeExtension(e1.enc, desc) + } + if m2 == nil && err == nil { + m2, err = decodeExtension(e2.enc, desc) + } + if err != nil { + // The encoded form is invalid. + log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) + return false + } + if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + return false + } + } + + return true +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/extensions.go b/integration-test/vendor/github.com/gogo/protobuf/proto/extensions.go new file mode 100644 index 000000000..341c6f57f --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/extensions.go @@ -0,0 +1,605 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Types and routines for supporting protocol buffer extensions. + */ + +import ( + "errors" + "fmt" + "io" + "reflect" + "strconv" + "sync" +) + +// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. +var ErrMissingExtension = errors.New("proto: missing extension") + +// ExtensionRange represents a range of message extensions for a protocol buffer. +// Used in code generated by the protocol compiler. +type ExtensionRange struct { + Start, End int32 // both inclusive +} + +// extendableProto is an interface implemented by any protocol buffer generated by the current +// proto compiler that may be extended. +type extendableProto interface { + Message + ExtensionRangeArray() []ExtensionRange + extensionsWrite() map[int32]Extension + extensionsRead() (map[int32]Extension, sync.Locker) +} + +// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous +// version of the proto compiler that may be extended. +type extendableProtoV1 interface { + Message + ExtensionRangeArray() []ExtensionRange + ExtensionMap() map[int32]Extension +} + +// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. +type extensionAdapter struct { + extendableProtoV1 +} + +func (e extensionAdapter) extensionsWrite() map[int32]Extension { + return e.ExtensionMap() +} + +func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { + return e.ExtensionMap(), notLocker{} +} + +// notLocker is a sync.Locker whose Lock and Unlock methods are nops. +type notLocker struct{} + +func (n notLocker) Lock() {} +func (n notLocker) Unlock() {} + +// extendable returns the extendableProto interface for the given generated proto message. +// If the proto message has the old extension format, it returns a wrapper that implements +// the extendableProto interface. +func extendable(p interface{}) (extendableProto, error) { + switch p := p.(type) { + case extendableProto: + if isNilPtr(p) { + return nil, fmt.Errorf("proto: nil %T is not extendable", p) + } + return p, nil + case extendableProtoV1: + if isNilPtr(p) { + return nil, fmt.Errorf("proto: nil %T is not extendable", p) + } + return extensionAdapter{p}, nil + case extensionsBytes: + return slowExtensionAdapter{p}, nil + } + // Don't allocate a specific error containing %T: + // this is the hot path for Clone and MarshalText. + return nil, errNotExtendable +} + +var errNotExtendable = errors.New("proto: not an extendable proto.Message") + +func isNilPtr(x interface{}) bool { + v := reflect.ValueOf(x) + return v.Kind() == reflect.Ptr && v.IsNil() +} + +// XXX_InternalExtensions is an internal representation of proto extensions. +// +// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, +// thus gaining the unexported 'extensions' method, which can be called only from the proto package. +// +// The methods of XXX_InternalExtensions are not concurrency safe in general, +// but calls to logically read-only methods such as has and get may be executed concurrently. +type XXX_InternalExtensions struct { + // The struct must be indirect so that if a user inadvertently copies a + // generated message and its embedded XXX_InternalExtensions, they + // avoid the mayhem of a copied mutex. + // + // The mutex serializes all logically read-only operations to p.extensionMap. + // It is up to the client to ensure that write operations to p.extensionMap are + // mutually exclusive with other accesses. + p *struct { + mu sync.Mutex + extensionMap map[int32]Extension + } +} + +// extensionsWrite returns the extension map, creating it on first use. +func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { + if e.p == nil { + e.p = new(struct { + mu sync.Mutex + extensionMap map[int32]Extension + }) + e.p.extensionMap = make(map[int32]Extension) + } + return e.p.extensionMap +} + +// extensionsRead returns the extensions map for read-only use. It may be nil. +// The caller must hold the returned mutex's lock when accessing Elements within the map. +func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { + if e.p == nil { + return nil, nil + } + return e.p.extensionMap, &e.p.mu +} + +// ExtensionDesc represents an extension specification. +// Used in generated code from the protocol compiler. +type ExtensionDesc struct { + ExtendedType Message // nil pointer to the type that is being extended + ExtensionType interface{} // nil pointer to the extension type + Field int32 // field number + Name string // fully-qualified name of extension, for text formatting + Tag string // protobuf tag style + Filename string // name of the file in which the extension is defined +} + +func (ed *ExtensionDesc) repeated() bool { + t := reflect.TypeOf(ed.ExtensionType) + return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 +} + +// Extension represents an extension in a message. +type Extension struct { + // When an extension is stored in a message using SetExtension + // only desc and value are set. When the message is marshaled + // enc will be set to the encoded form of the message. + // + // When a message is unmarshaled and contains extensions, each + // extension will have only enc set. When such an extension is + // accessed using GetExtension (or GetExtensions) desc and value + // will be set. + desc *ExtensionDesc + value interface{} + enc []byte +} + +// SetRawExtension is for testing only. +func SetRawExtension(base Message, id int32, b []byte) { + if ebase, ok := base.(extensionsBytes); ok { + clearExtension(base, id) + ext := ebase.GetExtensions() + *ext = append(*ext, b...) + return + } + epb, err := extendable(base) + if err != nil { + return + } + extmap := epb.extensionsWrite() + extmap[id] = Extension{enc: b} +} + +// isExtensionField returns true iff the given field number is in an extension range. +func isExtensionField(pb extendableProto, field int32) bool { + for _, er := range pb.ExtensionRangeArray() { + if er.Start <= field && field <= er.End { + return true + } + } + return false +} + +// checkExtensionTypes checks that the given extension is valid for pb. +func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { + var pbi interface{} = pb + // Check the extended type. + if ea, ok := pbi.(extensionAdapter); ok { + pbi = ea.extendableProtoV1 + } + if ea, ok := pbi.(slowExtensionAdapter); ok { + pbi = ea.extensionsBytes + } + if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { + return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) + } + // Check the range. + if !isExtensionField(pb, extension.Field) { + return errors.New("proto: bad extension number; not in declared ranges") + } + return nil +} + +// extPropKey is sufficient to uniquely identify an extension. +type extPropKey struct { + base reflect.Type + field int32 +} + +var extProp = struct { + sync.RWMutex + m map[extPropKey]*Properties +}{ + m: make(map[extPropKey]*Properties), +} + +func extensionProperties(ed *ExtensionDesc) *Properties { + key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} + + extProp.RLock() + if prop, ok := extProp.m[key]; ok { + extProp.RUnlock() + return prop + } + extProp.RUnlock() + + extProp.Lock() + defer extProp.Unlock() + // Check again. + if prop, ok := extProp.m[key]; ok { + return prop + } + + prop := new(Properties) + prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) + extProp.m[key] = prop + return prop +} + +// HasExtension returns whether the given extension is present in pb. +func HasExtension(pb Message, extension *ExtensionDesc) bool { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + buf := *ext + o := 0 + for o < len(buf) { + tag, n := DecodeVarint(buf[o:]) + fieldNum := int32(tag >> 3) + if int32(fieldNum) == extension.Field { + return true + } + wireType := int(tag & 0x7) + o += n + l, err := size(buf[o:], wireType) + if err != nil { + return false + } + o += l + } + return false + } + // TODO: Check types, field numbers, etc.? + epb, err := extendable(pb) + if err != nil { + return false + } + extmap, mu := epb.extensionsRead() + if extmap == nil { + return false + } + mu.Lock() + _, ok := extmap[extension.Field] + mu.Unlock() + return ok +} + +// ClearExtension removes the given extension from pb. +func ClearExtension(pb Message, extension *ExtensionDesc) { + clearExtension(pb, extension.Field) +} + +func clearExtension(pb Message, fieldNum int32) { + if epb, ok := pb.(extensionsBytes); ok { + offset := 0 + for offset != -1 { + offset = deleteExtension(epb, fieldNum, offset) + } + return + } + epb, err := extendable(pb) + if err != nil { + return + } + // TODO: Check types, field numbers, etc.? + extmap := epb.extensionsWrite() + delete(extmap, fieldNum) +} + +// GetExtension retrieves a proto2 extended field from pb. +// +// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), +// then GetExtension parses the encoded field and returns a Go value of the specified type. +// If the field is not present, then the default value is returned (if one is specified), +// otherwise ErrMissingExtension is reported. +// +// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), +// then GetExtension returns the raw encoded bytes of the field extension. +func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + return decodeExtensionFromBytes(extension, *ext) + } + + epb, err := extendable(pb) + if err != nil { + return nil, err + } + + if extension.ExtendedType != nil { + // can only check type if this is a complete descriptor + if cerr := checkExtensionTypes(epb, extension); cerr != nil { + return nil, cerr + } + } + + emap, mu := epb.extensionsRead() + if emap == nil { + return defaultExtensionValue(extension) + } + mu.Lock() + defer mu.Unlock() + e, ok := emap[extension.Field] + if !ok { + // defaultExtensionValue returns the default value or + // ErrMissingExtension if there is no default. + return defaultExtensionValue(extension) + } + + if e.value != nil { + // Already decoded. Check the descriptor, though. + if e.desc != extension { + // This shouldn't happen. If it does, it means that + // GetExtension was called twice with two different + // descriptors with the same field number. + return nil, errors.New("proto: descriptor conflict") + } + return e.value, nil + } + + if extension.ExtensionType == nil { + // incomplete descriptor + return e.enc, nil + } + + v, err := decodeExtension(e.enc, extension) + if err != nil { + return nil, err + } + + // Remember the decoded version and drop the encoded version. + // That way it is safe to mutate what we return. + e.value = v + e.desc = extension + e.enc = nil + emap[extension.Field] = e + return e.value, nil +} + +// defaultExtensionValue returns the default value for extension. +// If no default for an extension is defined ErrMissingExtension is returned. +func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { + if extension.ExtensionType == nil { + // incomplete descriptor, so no default + return nil, ErrMissingExtension + } + + t := reflect.TypeOf(extension.ExtensionType) + props := extensionProperties(extension) + + sf, _, err := fieldDefault(t, props) + if err != nil { + return nil, err + } + + if sf == nil || sf.value == nil { + // There is no default value. + return nil, ErrMissingExtension + } + + if t.Kind() != reflect.Ptr { + // We do not need to return a Ptr, we can directly return sf.value. + return sf.value, nil + } + + // We need to return an interface{} that is a pointer to sf.value. + value := reflect.New(t).Elem() + value.Set(reflect.New(value.Type().Elem())) + if sf.kind == reflect.Int32 { + // We may have an int32 or an enum, but the underlying data is int32. + // Since we can't set an int32 into a non int32 reflect.value directly + // set it as a int32. + value.Elem().SetInt(int64(sf.value.(int32))) + } else { + value.Elem().Set(reflect.ValueOf(sf.value)) + } + return value.Interface(), nil +} + +// decodeExtension decodes an extension encoded in b. +func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { + t := reflect.TypeOf(extension.ExtensionType) + unmarshal := typeUnmarshaler(t, extension.Tag) + + // t is a pointer to a struct, pointer to basic type or a slice. + // Allocate space to store the pointer/slice. + value := reflect.New(t).Elem() + + var err error + for { + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + wire := int(x) & 7 + + b, err = unmarshal(b, valToPointer(value.Addr()), wire) + if err != nil { + return nil, err + } + + if len(b) == 0 { + break + } + } + return value.Interface(), nil +} + +// GetExtensions returns a slice of the extensions present in pb that are also listed in es. +// The returned slice has the same length as es; missing extensions will appear as nil elements. +func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { + epb, err := extendable(pb) + if err != nil { + return nil, err + } + extensions = make([]interface{}, len(es)) + for i, e := range es { + extensions[i], err = GetExtension(epb, e) + if err == ErrMissingExtension { + err = nil + } + if err != nil { + return + } + } + return +} + +// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. +// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing +// just the Field field, which defines the extension's field number. +func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { + epb, err := extendable(pb) + if err != nil { + return nil, err + } + registeredExtensions := RegisteredExtensions(pb) + + emap, mu := epb.extensionsRead() + if emap == nil { + return nil, nil + } + mu.Lock() + defer mu.Unlock() + extensions := make([]*ExtensionDesc, 0, len(emap)) + for extid, e := range emap { + desc := e.desc + if desc == nil { + desc = registeredExtensions[extid] + if desc == nil { + desc = &ExtensionDesc{Field: extid} + } + } + + extensions = append(extensions, desc) + } + return extensions, nil +} + +// SetExtension sets the specified extension of pb to the specified value. +func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { + if epb, ok := pb.(extensionsBytes); ok { + ClearExtension(pb, extension) + newb, err := encodeExtension(extension, value) + if err != nil { + return err + } + bb := epb.GetExtensions() + *bb = append(*bb, newb...) + return nil + } + epb, err := extendable(pb) + if err != nil { + return err + } + if err := checkExtensionTypes(epb, extension); err != nil { + return err + } + typ := reflect.TypeOf(extension.ExtensionType) + if typ != reflect.TypeOf(value) { + return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType) + } + // nil extension values need to be caught early, because the + // encoder can't distinguish an ErrNil due to a nil extension + // from an ErrNil due to a missing field. Extensions are + // always optional, so the encoder would just swallow the error + // and drop all the extensions from the encoded message. + if reflect.ValueOf(value).IsNil() { + return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) + } + + extmap := epb.extensionsWrite() + extmap[extension.Field] = Extension{desc: extension, value: value} + return nil +} + +// ClearAllExtensions clears all extensions from pb. +func ClearAllExtensions(pb Message) { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + *ext = []byte{} + return + } + epb, err := extendable(pb) + if err != nil { + return + } + m := epb.extensionsWrite() + for k := range m { + delete(m, k) + } +} + +// A global registry of extensions. +// The generated code will register the generated descriptors by calling RegisterExtension. + +var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) + +// RegisterExtension is called from the generated code. +func RegisterExtension(desc *ExtensionDesc) { + st := reflect.TypeOf(desc.ExtendedType).Elem() + m := extensionMaps[st] + if m == nil { + m = make(map[int32]*ExtensionDesc) + extensionMaps[st] = m + } + if _, ok := m[desc.Field]; ok { + panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) + } + m[desc.Field] = desc +} + +// RegisteredExtensions returns a map of the registered extensions of a +// protocol buffer struct, indexed by the extension number. +// The argument pb should be a nil pointer to the struct type. +func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { + return extensionMaps[reflect.TypeOf(pb).Elem()] +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go new file mode 100644 index 000000000..6f1ae120e --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go @@ -0,0 +1,389 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "bytes" + "errors" + "fmt" + "io" + "reflect" + "sort" + "strings" + "sync" +) + +type extensionsBytes interface { + Message + ExtensionRangeArray() []ExtensionRange + GetExtensions() *[]byte +} + +type slowExtensionAdapter struct { + extensionsBytes +} + +func (s slowExtensionAdapter) extensionsWrite() map[int32]Extension { + panic("Please report a bug to github.com/gogo/protobuf if you see this message: Writing extensions is not supported for extensions stored in a byte slice field.") +} + +func (s slowExtensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { + b := s.GetExtensions() + m, err := BytesToExtensionsMap(*b) + if err != nil { + panic(err) + } + return m, notLocker{} +} + +func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { + if reflect.ValueOf(pb).IsNil() { + return ifnotset + } + value, err := GetExtension(pb, extension) + if err != nil { + return ifnotset + } + if value == nil { + return ifnotset + } + if value.(*bool) == nil { + return ifnotset + } + return *(value.(*bool)) +} + +func (this *Extension) Equal(that *Extension) bool { + if err := this.Encode(); err != nil { + return false + } + if err := that.Encode(); err != nil { + return false + } + return bytes.Equal(this.enc, that.enc) +} + +func (this *Extension) Compare(that *Extension) int { + if err := this.Encode(); err != nil { + return 1 + } + if err := that.Encode(); err != nil { + return -1 + } + return bytes.Compare(this.enc, that.enc) +} + +func SizeOfInternalExtension(m extendableProto) (n int) { + info := getMarshalInfo(reflect.TypeOf(m)) + return info.sizeV1Extensions(m.extensionsWrite()) +} + +type sortableMapElem struct { + field int32 + ext Extension +} + +func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { + s := make(sortableExtensions, 0, len(m)) + for k, v := range m { + s = append(s, &sortableMapElem{field: k, ext: v}) + } + return s +} + +type sortableExtensions []*sortableMapElem + +func (this sortableExtensions) Len() int { return len(this) } + +func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } + +func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } + +func (this sortableExtensions) String() string { + sort.Sort(this) + ss := make([]string, len(this)) + for i := range this { + ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) + } + return "map[" + strings.Join(ss, ",") + "]" +} + +func StringFromInternalExtension(m extendableProto) string { + return StringFromExtensionsMap(m.extensionsWrite()) +} + +func StringFromExtensionsMap(m map[int32]Extension) string { + return newSortableExtensionsFromMap(m).String() +} + +func StringFromExtensionsBytes(ext []byte) string { + m, err := BytesToExtensionsMap(ext) + if err != nil { + panic(err) + } + return StringFromExtensionsMap(m) +} + +func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { + return EncodeExtensionMap(m.extensionsWrite(), data) +} + +func EncodeInternalExtensionBackwards(m extendableProto, data []byte) (n int, err error) { + return EncodeExtensionMapBackwards(m.extensionsWrite(), data) +} + +func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { + o := 0 + for _, e := range m { + if err := e.Encode(); err != nil { + return 0, err + } + n := copy(data[o:], e.enc) + if n != len(e.enc) { + return 0, io.ErrShortBuffer + } + o += n + } + return o, nil +} + +func EncodeExtensionMapBackwards(m map[int32]Extension, data []byte) (n int, err error) { + o := 0 + end := len(data) + for _, e := range m { + if err := e.Encode(); err != nil { + return 0, err + } + n := copy(data[end-len(e.enc):], e.enc) + if n != len(e.enc) { + return 0, io.ErrShortBuffer + } + end -= n + o += n + } + return o, nil +} + +func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { + e := m[id] + if err := e.Encode(); err != nil { + return nil, err + } + return e.enc, nil +} + +func size(buf []byte, wire int) (int, error) { + switch wire { + case WireVarint: + _, n := DecodeVarint(buf) + return n, nil + case WireFixed64: + return 8, nil + case WireBytes: + v, n := DecodeVarint(buf) + return int(v) + n, nil + case WireFixed32: + return 4, nil + case WireStartGroup: + offset := 0 + for { + u, n := DecodeVarint(buf[offset:]) + fwire := int(u & 0x7) + offset += n + if fwire == WireEndGroup { + return offset, nil + } + s, err := size(buf[offset:], wire) + if err != nil { + return 0, err + } + offset += s + } + } + return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) +} + +func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { + m := make(map[int32]Extension) + i := 0 + for i < len(buf) { + tag, n := DecodeVarint(buf[i:]) + if n <= 0 { + return nil, fmt.Errorf("unable to decode varint") + } + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + l, err := size(buf[i+n:], wireType) + if err != nil { + return nil, err + } + end := i + int(l) + n + m[int32(fieldNum)] = Extension{enc: buf[i:end]} + i = end + } + return m, nil +} + +func NewExtension(e []byte) Extension { + ee := Extension{enc: make([]byte, len(e))} + copy(ee.enc, e) + return ee +} + +func AppendExtension(e Message, tag int32, buf []byte) { + if ee, eok := e.(extensionsBytes); eok { + ext := ee.GetExtensions() + *ext = append(*ext, buf...) + return + } + if ee, eok := e.(extendableProto); eok { + m := ee.extensionsWrite() + ext := m[int32(tag)] // may be missing + ext.enc = append(ext.enc, buf...) + m[int32(tag)] = ext + } +} + +func encodeExtension(extension *ExtensionDesc, value interface{}) ([]byte, error) { + u := getMarshalInfo(reflect.TypeOf(extension.ExtendedType)) + ei := u.getExtElemInfo(extension) + v := value + p := toAddrPointer(&v, ei.isptr) + siz := ei.sizer(p, SizeVarint(ei.wiretag)) + buf := make([]byte, 0, siz) + return ei.marshaler(buf, p, ei.wiretag, false) +} + +func decodeExtensionFromBytes(extension *ExtensionDesc, buf []byte) (interface{}, error) { + o := 0 + for o < len(buf) { + tag, n := DecodeVarint((buf)[o:]) + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + if o+n > len(buf) { + return nil, fmt.Errorf("unable to decode extension") + } + l, err := size((buf)[o+n:], wireType) + if err != nil { + return nil, err + } + if int32(fieldNum) == extension.Field { + if o+n+l > len(buf) { + return nil, fmt.Errorf("unable to decode extension") + } + v, err := decodeExtension((buf)[o:o+n+l], extension) + if err != nil { + return nil, err + } + return v, nil + } + o += n + l + } + return defaultExtensionValue(extension) +} + +func (this *Extension) Encode() error { + if this.enc == nil { + var err error + this.enc, err = encodeExtension(this.desc, this.value) + if err != nil { + return err + } + } + return nil +} + +func (this Extension) GoString() string { + if err := this.Encode(); err != nil { + return fmt.Sprintf("error encoding extension: %v", err) + } + return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) +} + +func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { + typ := reflect.TypeOf(pb).Elem() + ext, ok := extensionMaps[typ] + if !ok { + return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) + } + desc, ok := ext[fieldNum] + if !ok { + return errors.New("proto: bad extension number; not in declared ranges") + } + return SetExtension(pb, desc, value) +} + +func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { + typ := reflect.TypeOf(pb).Elem() + ext, ok := extensionMaps[typ] + if !ok { + return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) + } + desc, ok := ext[fieldNum] + if !ok { + return nil, fmt.Errorf("unregistered field number %d", fieldNum) + } + return GetExtension(pb, desc) +} + +func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { + x := &XXX_InternalExtensions{ + p: new(struct { + mu sync.Mutex + extensionMap map[int32]Extension + }), + } + x.p.extensionMap = m + return *x +} + +func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { + pb := extendable.(extendableProto) + return pb.extensionsWrite() +} + +func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { + ext := pb.GetExtensions() + for offset < len(*ext) { + tag, n1 := DecodeVarint((*ext)[offset:]) + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + n2, err := size((*ext)[offset+n1:], wireType) + if err != nil { + panic(err) + } + newOffset := offset + n1 + n2 + if fieldNum == theFieldNum { + *ext = append((*ext)[:offset], (*ext)[newOffset:]...) + return offset + } + offset = newOffset + } + return -1 +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/lib.go b/integration-test/vendor/github.com/gogo/protobuf/proto/lib.go new file mode 100644 index 000000000..80db1c155 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/lib.go @@ -0,0 +1,973 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* +Package proto converts data structures to and from the wire format of +protocol buffers. It works in concert with the Go source code generated +for .proto files by the protocol compiler. + +A summary of the properties of the protocol buffer interface +for a protocol buffer variable v: + + - Names are turned from camel_case to CamelCase for export. + - There are no methods on v to set fields; just treat + them as structure fields. + - There are getters that return a field's value if set, + and return the field's default value if unset. + The getters work even if the receiver is a nil message. + - The zero value for a struct is its correct initialization state. + All desired fields must be set before marshaling. + - A Reset() method will restore a protobuf struct to its zero state. + - Non-repeated fields are pointers to the values; nil means unset. + That is, optional or required field int32 f becomes F *int32. + - Repeated fields are slices. + - Helper functions are available to aid the setting of fields. + msg.Foo = proto.String("hello") // set field + - Constants are defined to hold the default values of all fields that + have them. They have the form Default_StructName_FieldName. + Because the getter methods handle defaulted values, + direct use of these constants should be rare. + - Enums are given type names and maps from names to values. + Enum values are prefixed by the enclosing message's name, or by the + enum's type name if it is a top-level enum. Enum types have a String + method, and a Enum method to assist in message construction. + - Nested messages, groups and enums have type names prefixed with the name of + the surrounding message type. + - Extensions are given descriptor names that start with E_, + followed by an underscore-delimited list of the nested messages + that contain it (if any) followed by the CamelCased name of the + extension field itself. HasExtension, ClearExtension, GetExtension + and SetExtension are functions for manipulating extensions. + - Oneof field sets are given a single field in their message, + with distinguished wrapper types for each possible field value. + - Marshal and Unmarshal are functions to encode and decode the wire format. + +When the .proto file specifies `syntax="proto3"`, there are some differences: + + - Non-repeated fields of non-message type are values instead of pointers. + - Enum types do not get an Enum method. + +The simplest way to describe this is to see an example. +Given file test.proto, containing + + package example; + + enum FOO { X = 17; } + + message Test { + required string label = 1; + optional int32 type = 2 [default=77]; + repeated int64 reps = 3; + optional group OptionalGroup = 4 { + required string RequiredField = 5; + } + oneof union { + int32 number = 6; + string name = 7; + } + } + +The resulting file, test.pb.go, is: + + package example + + import proto "github.com/gogo/protobuf/proto" + import math "math" + + type FOO int32 + const ( + FOO_X FOO = 17 + ) + var FOO_name = map[int32]string{ + 17: "X", + } + var FOO_value = map[string]int32{ + "X": 17, + } + + func (x FOO) Enum() *FOO { + p := new(FOO) + *p = x + return p + } + func (x FOO) String() string { + return proto.EnumName(FOO_name, int32(x)) + } + func (x *FOO) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FOO_value, data) + if err != nil { + return err + } + *x = FOO(value) + return nil + } + + type Test struct { + Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` + Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` + Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` + Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` + // Types that are valid to be assigned to Union: + // *Test_Number + // *Test_Name + Union isTest_Union `protobuf_oneof:"union"` + XXX_unrecognized []byte `json:"-"` + } + func (m *Test) Reset() { *m = Test{} } + func (m *Test) String() string { return proto.CompactTextString(m) } + func (*Test) ProtoMessage() {} + + type isTest_Union interface { + isTest_Union() + } + + type Test_Number struct { + Number int32 `protobuf:"varint,6,opt,name=number"` + } + type Test_Name struct { + Name string `protobuf:"bytes,7,opt,name=name"` + } + + func (*Test_Number) isTest_Union() {} + func (*Test_Name) isTest_Union() {} + + func (m *Test) GetUnion() isTest_Union { + if m != nil { + return m.Union + } + return nil + } + const Default_Test_Type int32 = 77 + + func (m *Test) GetLabel() string { + if m != nil && m.Label != nil { + return *m.Label + } + return "" + } + + func (m *Test) GetType() int32 { + if m != nil && m.Type != nil { + return *m.Type + } + return Default_Test_Type + } + + func (m *Test) GetOptionalgroup() *Test_OptionalGroup { + if m != nil { + return m.Optionalgroup + } + return nil + } + + type Test_OptionalGroup struct { + RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` + } + func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } + func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } + + func (m *Test_OptionalGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" + } + + func (m *Test) GetNumber() int32 { + if x, ok := m.GetUnion().(*Test_Number); ok { + return x.Number + } + return 0 + } + + func (m *Test) GetName() string { + if x, ok := m.GetUnion().(*Test_Name); ok { + return x.Name + } + return "" + } + + func init() { + proto.RegisterEnum("example.FOO", FOO_name, FOO_value) + } + +To create and play with a Test object: + + package main + + import ( + "log" + + "github.com/gogo/protobuf/proto" + pb "./example.pb" + ) + + func main() { + test := &pb.Test{ + Label: proto.String("hello"), + Type: proto.Int32(17), + Reps: []int64{1, 2, 3}, + Optionalgroup: &pb.Test_OptionalGroup{ + RequiredField: proto.String("good bye"), + }, + Union: &pb.Test_Name{"fred"}, + } + data, err := proto.Marshal(test) + if err != nil { + log.Fatal("marshaling error: ", err) + } + newTest := &pb.Test{} + err = proto.Unmarshal(data, newTest) + if err != nil { + log.Fatal("unmarshaling error: ", err) + } + // Now test and newTest contain the same data. + if test.GetLabel() != newTest.GetLabel() { + log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) + } + // Use a type switch to determine which oneof was set. + switch u := test.Union.(type) { + case *pb.Test_Number: // u.Number contains the number. + case *pb.Test_Name: // u.Name contains the string. + } + // etc. + } +*/ +package proto + +import ( + "encoding/json" + "fmt" + "log" + "reflect" + "sort" + "strconv" + "sync" +) + +// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. +// Marshal reports this when a required field is not initialized. +// Unmarshal reports this when a required field is missing from the wire data. +type RequiredNotSetError struct{ field string } + +func (e *RequiredNotSetError) Error() string { + if e.field == "" { + return fmt.Sprintf("proto: required field not set") + } + return fmt.Sprintf("proto: required field %q not set", e.field) +} +func (e *RequiredNotSetError) RequiredNotSet() bool { + return true +} + +type invalidUTF8Error struct{ field string } + +func (e *invalidUTF8Error) Error() string { + if e.field == "" { + return "proto: invalid UTF-8 detected" + } + return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field) +} +func (e *invalidUTF8Error) InvalidUTF8() bool { + return true +} + +// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8. +// This error should not be exposed to the external API as such errors should +// be recreated with the field information. +var errInvalidUTF8 = &invalidUTF8Error{} + +// isNonFatal reports whether the error is either a RequiredNotSet error +// or a InvalidUTF8 error. +func isNonFatal(err error) bool { + if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() { + return true + } + if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() { + return true + } + return false +} + +type nonFatal struct{ E error } + +// Merge merges err into nf and reports whether it was successful. +// Otherwise it returns false for any fatal non-nil errors. +func (nf *nonFatal) Merge(err error) (ok bool) { + if err == nil { + return true // not an error + } + if !isNonFatal(err) { + return false // fatal error + } + if nf.E == nil { + nf.E = err // store first instance of non-fatal error + } + return true +} + +// Message is implemented by generated protocol buffer messages. +type Message interface { + Reset() + String() string + ProtoMessage() +} + +// A Buffer is a buffer manager for marshaling and unmarshaling +// protocol buffers. It may be reused between invocations to +// reduce memory usage. It is not necessary to use a Buffer; +// the global functions Marshal and Unmarshal create a +// temporary Buffer and are fine for most applications. +type Buffer struct { + buf []byte // encode/decode byte stream + index int // read point + + deterministic bool +} + +// NewBuffer allocates a new Buffer and initializes its internal data to +// the contents of the argument slice. +func NewBuffer(e []byte) *Buffer { + return &Buffer{buf: e} +} + +// Reset resets the Buffer, ready for marshaling a new protocol buffer. +func (p *Buffer) Reset() { + p.buf = p.buf[0:0] // for reading/writing + p.index = 0 // for reading +} + +// SetBuf replaces the internal buffer with the slice, +// ready for unmarshaling the contents of the slice. +func (p *Buffer) SetBuf(s []byte) { + p.buf = s + p.index = 0 +} + +// Bytes returns the contents of the Buffer. +func (p *Buffer) Bytes() []byte { return p.buf } + +// SetDeterministic sets whether to use deterministic serialization. +// +// Deterministic serialization guarantees that for a given binary, equal +// messages will always be serialized to the same bytes. This implies: +// +// - Repeated serialization of a message will return the same bytes. +// - Different processes of the same binary (which may be executing on +// different machines) will serialize equal messages to the same bytes. +// +// Note that the deterministic serialization is NOT canonical across +// languages. It is not guaranteed to remain stable over time. It is unstable +// across different builds with schema changes due to unknown fields. +// Users who need canonical serialization (e.g., persistent storage in a +// canonical form, fingerprinting, etc.) should define their own +// canonicalization specification and implement their own serializer rather +// than relying on this API. +// +// If deterministic serialization is requested, map entries will be sorted +// by keys in lexographical order. This is an implementation detail and +// subject to change. +func (p *Buffer) SetDeterministic(deterministic bool) { + p.deterministic = deterministic +} + +/* + * Helper routines for simplifying the creation of optional fields of basic type. + */ + +// Bool is a helper routine that allocates a new bool value +// to store v and returns a pointer to it. +func Bool(v bool) *bool { + return &v +} + +// Int32 is a helper routine that allocates a new int32 value +// to store v and returns a pointer to it. +func Int32(v int32) *int32 { + return &v +} + +// Int is a helper routine that allocates a new int32 value +// to store v and returns a pointer to it, but unlike Int32 +// its argument value is an int. +func Int(v int) *int32 { + p := new(int32) + *p = int32(v) + return p +} + +// Int64 is a helper routine that allocates a new int64 value +// to store v and returns a pointer to it. +func Int64(v int64) *int64 { + return &v +} + +// Float32 is a helper routine that allocates a new float32 value +// to store v and returns a pointer to it. +func Float32(v float32) *float32 { + return &v +} + +// Float64 is a helper routine that allocates a new float64 value +// to store v and returns a pointer to it. +func Float64(v float64) *float64 { + return &v +} + +// Uint32 is a helper routine that allocates a new uint32 value +// to store v and returns a pointer to it. +func Uint32(v uint32) *uint32 { + return &v +} + +// Uint64 is a helper routine that allocates a new uint64 value +// to store v and returns a pointer to it. +func Uint64(v uint64) *uint64 { + return &v +} + +// String is a helper routine that allocates a new string value +// to store v and returns a pointer to it. +func String(v string) *string { + return &v +} + +// EnumName is a helper function to simplify printing protocol buffer enums +// by name. Given an enum map and a value, it returns a useful string. +func EnumName(m map[int32]string, v int32) string { + s, ok := m[v] + if ok { + return s + } + return strconv.Itoa(int(v)) +} + +// UnmarshalJSONEnum is a helper function to simplify recovering enum int values +// from their JSON-encoded representation. Given a map from the enum's symbolic +// names to its int values, and a byte buffer containing the JSON-encoded +// value, it returns an int32 that can be cast to the enum type by the caller. +// +// The function can deal with both JSON representations, numeric and symbolic. +func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { + if data[0] == '"' { + // New style: enums are strings. + var repr string + if err := json.Unmarshal(data, &repr); err != nil { + return -1, err + } + val, ok := m[repr] + if !ok { + return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) + } + return val, nil + } + // Old style: enums are ints. + var val int32 + if err := json.Unmarshal(data, &val); err != nil { + return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) + } + return val, nil +} + +// DebugPrint dumps the encoded data in b in a debugging format with a header +// including the string s. Used in testing but made available for general debugging. +func (p *Buffer) DebugPrint(s string, b []byte) { + var u uint64 + + obuf := p.buf + sindex := p.index + p.buf = b + p.index = 0 + depth := 0 + + fmt.Printf("\n--- %s ---\n", s) + +out: + for { + for i := 0; i < depth; i++ { + fmt.Print(" ") + } + + index := p.index + if index == len(p.buf) { + break + } + + op, err := p.DecodeVarint() + if err != nil { + fmt.Printf("%3d: fetching op err %v\n", index, err) + break out + } + tag := op >> 3 + wire := op & 7 + + switch wire { + default: + fmt.Printf("%3d: t=%3d unknown wire=%d\n", + index, tag, wire) + break out + + case WireBytes: + var r []byte + + r, err = p.DecodeRawBytes(false) + if err != nil { + break out + } + fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) + if len(r) <= 6 { + for i := 0; i < len(r); i++ { + fmt.Printf(" %.2x", r[i]) + } + } else { + for i := 0; i < 3; i++ { + fmt.Printf(" %.2x", r[i]) + } + fmt.Printf(" ..") + for i := len(r) - 3; i < len(r); i++ { + fmt.Printf(" %.2x", r[i]) + } + } + fmt.Printf("\n") + + case WireFixed32: + u, err = p.DecodeFixed32() + if err != nil { + fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) + + case WireFixed64: + u, err = p.DecodeFixed64() + if err != nil { + fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) + + case WireVarint: + u, err = p.DecodeVarint() + if err != nil { + fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) + + case WireStartGroup: + fmt.Printf("%3d: t=%3d start\n", index, tag) + depth++ + + case WireEndGroup: + depth-- + fmt.Printf("%3d: t=%3d end\n", index, tag) + } + } + + if depth != 0 { + fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) + } + fmt.Printf("\n") + + p.buf = obuf + p.index = sindex +} + +// SetDefaults sets unset protocol buffer fields to their default values. +// It only modifies fields that are both unset and have defined defaults. +// It recursively sets default values in any non-nil sub-messages. +func SetDefaults(pb Message) { + setDefaults(reflect.ValueOf(pb), true, false) +} + +// v is a struct. +func setDefaults(v reflect.Value, recur, zeros bool) { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + + defaultMu.RLock() + dm, ok := defaults[v.Type()] + defaultMu.RUnlock() + if !ok { + dm = buildDefaultMessage(v.Type()) + defaultMu.Lock() + defaults[v.Type()] = dm + defaultMu.Unlock() + } + + for _, sf := range dm.scalars { + f := v.Field(sf.index) + if !f.IsNil() { + // field already set + continue + } + dv := sf.value + if dv == nil && !zeros { + // no explicit default, and don't want to set zeros + continue + } + fptr := f.Addr().Interface() // **T + // TODO: Consider batching the allocations we do here. + switch sf.kind { + case reflect.Bool: + b := new(bool) + if dv != nil { + *b = dv.(bool) + } + *(fptr.(**bool)) = b + case reflect.Float32: + f := new(float32) + if dv != nil { + *f = dv.(float32) + } + *(fptr.(**float32)) = f + case reflect.Float64: + f := new(float64) + if dv != nil { + *f = dv.(float64) + } + *(fptr.(**float64)) = f + case reflect.Int32: + // might be an enum + if ft := f.Type(); ft != int32PtrType { + // enum + f.Set(reflect.New(ft.Elem())) + if dv != nil { + f.Elem().SetInt(int64(dv.(int32))) + } + } else { + // int32 field + i := new(int32) + if dv != nil { + *i = dv.(int32) + } + *(fptr.(**int32)) = i + } + case reflect.Int64: + i := new(int64) + if dv != nil { + *i = dv.(int64) + } + *(fptr.(**int64)) = i + case reflect.String: + s := new(string) + if dv != nil { + *s = dv.(string) + } + *(fptr.(**string)) = s + case reflect.Uint8: + // exceptional case: []byte + var b []byte + if dv != nil { + db := dv.([]byte) + b = make([]byte, len(db)) + copy(b, db) + } else { + b = []byte{} + } + *(fptr.(*[]byte)) = b + case reflect.Uint32: + u := new(uint32) + if dv != nil { + *u = dv.(uint32) + } + *(fptr.(**uint32)) = u + case reflect.Uint64: + u := new(uint64) + if dv != nil { + *u = dv.(uint64) + } + *(fptr.(**uint64)) = u + default: + log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) + } + } + + for _, ni := range dm.nested { + f := v.Field(ni) + // f is *T or T or []*T or []T + switch f.Kind() { + case reflect.Struct: + setDefaults(f, recur, zeros) + + case reflect.Ptr: + if f.IsNil() { + continue + } + setDefaults(f, recur, zeros) + + case reflect.Slice: + for i := 0; i < f.Len(); i++ { + e := f.Index(i) + if e.Kind() == reflect.Ptr && e.IsNil() { + continue + } + setDefaults(e, recur, zeros) + } + + case reflect.Map: + for _, k := range f.MapKeys() { + e := f.MapIndex(k) + if e.IsNil() { + continue + } + setDefaults(e, recur, zeros) + } + } + } +} + +var ( + // defaults maps a protocol buffer struct type to a slice of the fields, + // with its scalar fields set to their proto-declared non-zero default values. + defaultMu sync.RWMutex + defaults = make(map[reflect.Type]defaultMessage) + + int32PtrType = reflect.TypeOf((*int32)(nil)) +) + +// defaultMessage represents information about the default values of a message. +type defaultMessage struct { + scalars []scalarField + nested []int // struct field index of nested messages +} + +type scalarField struct { + index int // struct field index + kind reflect.Kind // element type (the T in *T or []T) + value interface{} // the proto-declared default value, or nil +} + +// t is a struct type. +func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { + sprop := GetProperties(t) + for _, prop := range sprop.Prop { + fi, ok := sprop.decoderTags.get(prop.Tag) + if !ok { + // XXX_unrecognized + continue + } + ft := t.Field(fi).Type + + sf, nested, err := fieldDefault(ft, prop) + switch { + case err != nil: + log.Print(err) + case nested: + dm.nested = append(dm.nested, fi) + case sf != nil: + sf.index = fi + dm.scalars = append(dm.scalars, *sf) + } + } + + return dm +} + +// fieldDefault returns the scalarField for field type ft. +// sf will be nil if the field can not have a default. +// nestedMessage will be true if this is a nested message. +// Note that sf.index is not set on return. +func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { + var canHaveDefault bool + switch ft.Kind() { + case reflect.Struct: + nestedMessage = true // non-nullable + + case reflect.Ptr: + if ft.Elem().Kind() == reflect.Struct { + nestedMessage = true + } else { + canHaveDefault = true // proto2 scalar field + } + + case reflect.Slice: + switch ft.Elem().Kind() { + case reflect.Ptr, reflect.Struct: + nestedMessage = true // repeated message + case reflect.Uint8: + canHaveDefault = true // bytes field + } + + case reflect.Map: + if ft.Elem().Kind() == reflect.Ptr { + nestedMessage = true // map with message values + } + } + + if !canHaveDefault { + if nestedMessage { + return nil, true, nil + } + return nil, false, nil + } + + // We now know that ft is a pointer or slice. + sf = &scalarField{kind: ft.Elem().Kind()} + + // scalar fields without defaults + if !prop.HasDefault { + return sf, false, nil + } + + // a scalar field: either *T or []byte + switch ft.Elem().Kind() { + case reflect.Bool: + x, err := strconv.ParseBool(prop.Default) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) + } + sf.value = x + case reflect.Float32: + x, err := strconv.ParseFloat(prop.Default, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) + } + sf.value = float32(x) + case reflect.Float64: + x, err := strconv.ParseFloat(prop.Default, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) + } + sf.value = x + case reflect.Int32: + x, err := strconv.ParseInt(prop.Default, 10, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) + } + sf.value = int32(x) + case reflect.Int64: + x, err := strconv.ParseInt(prop.Default, 10, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) + } + sf.value = x + case reflect.String: + sf.value = prop.Default + case reflect.Uint8: + // []byte (not *uint8) + sf.value = []byte(prop.Default) + case reflect.Uint32: + x, err := strconv.ParseUint(prop.Default, 10, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) + } + sf.value = uint32(x) + case reflect.Uint64: + x, err := strconv.ParseUint(prop.Default, 10, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) + } + sf.value = x + default: + return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) + } + + return sf, false, nil +} + +// mapKeys returns a sort.Interface to be used for sorting the map keys. +// Map fields may have key types of non-float scalars, strings and enums. +func mapKeys(vs []reflect.Value) sort.Interface { + s := mapKeySorter{vs: vs} + + // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. + if len(vs) == 0 { + return s + } + switch vs[0].Kind() { + case reflect.Int32, reflect.Int64: + s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } + case reflect.Uint32, reflect.Uint64: + s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } + case reflect.Bool: + s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true + case reflect.String: + s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } + default: + panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) + } + + return s +} + +type mapKeySorter struct { + vs []reflect.Value + less func(a, b reflect.Value) bool +} + +func (s mapKeySorter) Len() int { return len(s.vs) } +func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } +func (s mapKeySorter) Less(i, j int) bool { + return s.less(s.vs[i], s.vs[j]) +} + +// isProto3Zero reports whether v is a zero proto3 value. +func isProto3Zero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Bool: + return !v.Bool() + case reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint32, reflect.Uint64: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.String: + return v.String() == "" + } + return false +} + +const ( + // ProtoPackageIsVersion3 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + GoGoProtoPackageIsVersion3 = true + + // ProtoPackageIsVersion2 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + GoGoProtoPackageIsVersion2 = true + + // ProtoPackageIsVersion1 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + GoGoProtoPackageIsVersion1 = true +) + +// InternalMessageInfo is a type used internally by generated .pb.go files. +// This type is not intended to be used by non-generated code. +// This type is not subject to any compatibility guarantee. +type InternalMessageInfo struct { + marshal *marshalInfo + unmarshal *unmarshalInfo + merge *mergeInfo + discard *discardInfo +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/lib_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/lib_gogo.go new file mode 100644 index 000000000..b3aa39190 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/lib_gogo.go @@ -0,0 +1,50 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "encoding/json" + "strconv" +) + +type Sizer interface { + Size() int +} + +type ProtoSizer interface { + ProtoSize() int +} + +func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { + s, ok := m[value] + if !ok { + s = strconv.Itoa(int(value)) + } + return json.Marshal(s) +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/message_set.go b/integration-test/vendor/github.com/gogo/protobuf/proto/message_set.go new file mode 100644 index 000000000..f48a75676 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/message_set.go @@ -0,0 +1,181 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Support for message sets. + */ + +import ( + "errors" +) + +// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. +// A message type ID is required for storing a protocol buffer in a message set. +var errNoMessageTypeID = errors.New("proto does not have a message type ID") + +// The first two types (_MessageSet_Item and messageSet) +// model what the protocol compiler produces for the following protocol message: +// message MessageSet { +// repeated group Item = 1 { +// required int32 type_id = 2; +// required string message = 3; +// }; +// } +// That is the MessageSet wire format. We can't use a proto to generate these +// because that would introduce a circular dependency between it and this package. + +type _MessageSet_Item struct { + TypeId *int32 `protobuf:"varint,2,req,name=type_id"` + Message []byte `protobuf:"bytes,3,req,name=message"` +} + +type messageSet struct { + Item []*_MessageSet_Item `protobuf:"group,1,rep"` + XXX_unrecognized []byte + // TODO: caching? +} + +// Make sure messageSet is a Message. +var _ Message = (*messageSet)(nil) + +// messageTypeIder is an interface satisfied by a protocol buffer type +// that may be stored in a MessageSet. +type messageTypeIder interface { + MessageTypeId() int32 +} + +func (ms *messageSet) find(pb Message) *_MessageSet_Item { + mti, ok := pb.(messageTypeIder) + if !ok { + return nil + } + id := mti.MessageTypeId() + for _, item := range ms.Item { + if *item.TypeId == id { + return item + } + } + return nil +} + +func (ms *messageSet) Has(pb Message) bool { + return ms.find(pb) != nil +} + +func (ms *messageSet) Unmarshal(pb Message) error { + if item := ms.find(pb); item != nil { + return Unmarshal(item.Message, pb) + } + if _, ok := pb.(messageTypeIder); !ok { + return errNoMessageTypeID + } + return nil // TODO: return error instead? +} + +func (ms *messageSet) Marshal(pb Message) error { + msg, err := Marshal(pb) + if err != nil { + return err + } + if item := ms.find(pb); item != nil { + // reuse existing item + item.Message = msg + return nil + } + + mti, ok := pb.(messageTypeIder) + if !ok { + return errNoMessageTypeID + } + + mtid := mti.MessageTypeId() + ms.Item = append(ms.Item, &_MessageSet_Item{ + TypeId: &mtid, + Message: msg, + }) + return nil +} + +func (ms *messageSet) Reset() { *ms = messageSet{} } +func (ms *messageSet) String() string { return CompactTextString(ms) } +func (*messageSet) ProtoMessage() {} + +// Support for the message_set_wire_format message option. + +func skipVarint(buf []byte) []byte { + i := 0 + for ; buf[i]&0x80 != 0; i++ { + } + return buf[i+1:] +} + +// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. +// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. +func unmarshalMessageSet(buf []byte, exts interface{}) error { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + m = exts.extensionsWrite() + case map[int32]Extension: + m = exts + default: + return errors.New("proto: not an extension map") + } + + ms := new(messageSet) + if err := Unmarshal(buf, ms); err != nil { + return err + } + for _, item := range ms.Item { + id := *item.TypeId + msg := item.Message + + // Restore wire type and field number varint, plus length varint. + // Be careful to preserve duplicate items. + b := EncodeVarint(uint64(id)<<3 | WireBytes) + if ext, ok := m[id]; ok { + // Existing data; rip off the tag and length varint + // so we join the new data correctly. + // We can assume that ext.enc is set because we are unmarshaling. + o := ext.enc[len(b):] // skip wire type and field number + _, n := DecodeVarint(o) // calculate length of length varint + o = o[n:] // skip length varint + msg = append(o, msg...) // join old data and new data + } + b = append(b, EncodeVarint(uint64(len(msg)))...) + b = append(b, msg...) + + m[id] = Extension{enc: b} + } + return nil +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go new file mode 100644 index 000000000..b6cad9083 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go @@ -0,0 +1,357 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build purego appengine js + +// This file contains an implementation of proto field accesses using package reflect. +// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can +// be used on App Engine. + +package proto + +import ( + "reflect" + "sync" +) + +const unsafeAllowed = false + +// A field identifies a field in a struct, accessible from a pointer. +// In this implementation, a field is identified by the sequence of field indices +// passed to reflect's FieldByIndex. +type field []int + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return f.Index +} + +// invalidField is an invalid field identifier. +var invalidField = field(nil) + +// zeroField is a noop when calling pointer.offset. +var zeroField = field([]int{}) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { return f != nil } + +// The pointer type is for the table-driven decoder. +// The implementation here uses a reflect.Value of pointer type to +// create a generic pointer. In pointer_unsafe.go we use unsafe +// instead of reflect to implement the same (but faster) interface. +type pointer struct { + v reflect.Value +} + +// toPointer converts an interface of pointer type to a pointer +// that points to the same target. +func toPointer(i *Message) pointer { + return pointer{v: reflect.ValueOf(*i)} +} + +// toAddrPointer converts an interface to a pointer that points to +// the interface data. +func toAddrPointer(i *interface{}, isptr bool) pointer { + v := reflect.ValueOf(*i) + u := reflect.New(v.Type()) + u.Elem().Set(v) + return pointer{v: u} +} + +// valToPointer converts v to a pointer. v must be of pointer type. +func valToPointer(v reflect.Value) pointer { + return pointer{v: v} +} + +// offset converts from a pointer to a structure to a pointer to +// one of its fields. +func (p pointer) offset(f field) pointer { + return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} +} + +func (p pointer) isNil() bool { + return p.v.IsNil() +} + +// grow updates the slice s in place to make it one element longer. +// s must be addressable. +// Returns the (addressable) new element. +func grow(s reflect.Value) reflect.Value { + n, m := s.Len(), s.Cap() + if n < m { + s.SetLen(n + 1) + } else { + s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) + } + return s.Index(n) +} + +func (p pointer) toInt64() *int64 { + return p.v.Interface().(*int64) +} +func (p pointer) toInt64Ptr() **int64 { + return p.v.Interface().(**int64) +} +func (p pointer) toInt64Slice() *[]int64 { + return p.v.Interface().(*[]int64) +} + +var int32ptr = reflect.TypeOf((*int32)(nil)) + +func (p pointer) toInt32() *int32 { + return p.v.Convert(int32ptr).Interface().(*int32) +} + +// The toInt32Ptr/Slice methods don't work because of enums. +// Instead, we must use set/get methods for the int32ptr/slice case. +/* + func (p pointer) toInt32Ptr() **int32 { + return p.v.Interface().(**int32) +} + func (p pointer) toInt32Slice() *[]int32 { + return p.v.Interface().(*[]int32) +} +*/ +func (p pointer) getInt32Ptr() *int32 { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + return p.v.Elem().Interface().(*int32) + } + // an enum + return p.v.Elem().Convert(int32PtrType).Interface().(*int32) +} +func (p pointer) setInt32Ptr(v int32) { + // Allocate value in a *int32. Possibly convert that to a *enum. + // Then assign it to a **int32 or **enum. + // Note: we can convert *int32 to *enum, but we can't convert + // **int32 to **enum! + p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) +} + +// getInt32Slice copies []int32 from p as a new slice. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) getInt32Slice() []int32 { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + return p.v.Elem().Interface().([]int32) + } + // an enum + // Allocate a []int32, then assign []enum's values into it. + // Note: we can't convert []enum to []int32. + slice := p.v.Elem() + s := make([]int32, slice.Len()) + for i := 0; i < slice.Len(); i++ { + s[i] = int32(slice.Index(i).Int()) + } + return s +} + +// setInt32Slice copies []int32 into p as a new slice. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) setInt32Slice(v []int32) { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + p.v.Elem().Set(reflect.ValueOf(v)) + return + } + // an enum + // Allocate a []enum, then assign []int32's values into it. + // Note: we can't convert []enum to []int32. + slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) + for i, x := range v { + slice.Index(i).SetInt(int64(x)) + } + p.v.Elem().Set(slice) +} +func (p pointer) appendInt32Slice(v int32) { + grow(p.v.Elem()).SetInt(int64(v)) +} + +func (p pointer) toUint64() *uint64 { + return p.v.Interface().(*uint64) +} +func (p pointer) toUint64Ptr() **uint64 { + return p.v.Interface().(**uint64) +} +func (p pointer) toUint64Slice() *[]uint64 { + return p.v.Interface().(*[]uint64) +} +func (p pointer) toUint32() *uint32 { + return p.v.Interface().(*uint32) +} +func (p pointer) toUint32Ptr() **uint32 { + return p.v.Interface().(**uint32) +} +func (p pointer) toUint32Slice() *[]uint32 { + return p.v.Interface().(*[]uint32) +} +func (p pointer) toBool() *bool { + return p.v.Interface().(*bool) +} +func (p pointer) toBoolPtr() **bool { + return p.v.Interface().(**bool) +} +func (p pointer) toBoolSlice() *[]bool { + return p.v.Interface().(*[]bool) +} +func (p pointer) toFloat64() *float64 { + return p.v.Interface().(*float64) +} +func (p pointer) toFloat64Ptr() **float64 { + return p.v.Interface().(**float64) +} +func (p pointer) toFloat64Slice() *[]float64 { + return p.v.Interface().(*[]float64) +} +func (p pointer) toFloat32() *float32 { + return p.v.Interface().(*float32) +} +func (p pointer) toFloat32Ptr() **float32 { + return p.v.Interface().(**float32) +} +func (p pointer) toFloat32Slice() *[]float32 { + return p.v.Interface().(*[]float32) +} +func (p pointer) toString() *string { + return p.v.Interface().(*string) +} +func (p pointer) toStringPtr() **string { + return p.v.Interface().(**string) +} +func (p pointer) toStringSlice() *[]string { + return p.v.Interface().(*[]string) +} +func (p pointer) toBytes() *[]byte { + return p.v.Interface().(*[]byte) +} +func (p pointer) toBytesSlice() *[][]byte { + return p.v.Interface().(*[][]byte) +} +func (p pointer) toExtensions() *XXX_InternalExtensions { + return p.v.Interface().(*XXX_InternalExtensions) +} +func (p pointer) toOldExtensions() *map[int32]Extension { + return p.v.Interface().(*map[int32]Extension) +} +func (p pointer) getPointer() pointer { + return pointer{v: p.v.Elem()} +} +func (p pointer) setPointer(q pointer) { + p.v.Elem().Set(q.v) +} +func (p pointer) appendPointer(q pointer) { + grow(p.v.Elem()).Set(q.v) +} + +// getPointerSlice copies []*T from p as a new []pointer. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) getPointerSlice() []pointer { + if p.v.IsNil() { + return nil + } + n := p.v.Elem().Len() + s := make([]pointer, n) + for i := 0; i < n; i++ { + s[i] = pointer{v: p.v.Elem().Index(i)} + } + return s +} + +// setPointerSlice copies []pointer into p as a new []*T. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) setPointerSlice(v []pointer) { + if v == nil { + p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) + return + } + s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) + for _, p := range v { + s = reflect.Append(s, p.v) + } + p.v.Elem().Set(s) +} + +// getInterfacePointer returns a pointer that points to the +// interface data of the interface pointed by p. +func (p pointer) getInterfacePointer() pointer { + if p.v.Elem().IsNil() { + return pointer{v: p.v.Elem()} + } + return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct +} + +func (p pointer) asPointerTo(t reflect.Type) reflect.Value { + // TODO: check that p.v.Type().Elem() == t? + return p.v +} + +func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} + +var atomicLock sync.Mutex diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go new file mode 100644 index 000000000..7ffd3c29d --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go @@ -0,0 +1,59 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build purego appengine js + +// This file contains an implementation of proto field accesses using package reflect. +// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can +// be used on App Engine. + +package proto + +import ( + "reflect" +) + +// TODO: untested, so probably incorrect. + +func (p pointer) getRef() pointer { + return pointer{v: p.v.Addr()} +} + +func (p pointer) appendRef(v pointer, typ reflect.Type) { + slice := p.getSlice(typ) + elem := v.asPointerTo(typ).Elem() + newSlice := reflect.Append(slice, elem) + slice.Set(newSlice) +} + +func (p pointer) getSlice(typ reflect.Type) reflect.Value { + sliceTyp := reflect.SliceOf(typ) + slice := p.asPointerTo(sliceTyp) + slice = slice.Elem() + return slice +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go new file mode 100644 index 000000000..d55a335d9 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go @@ -0,0 +1,308 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build !purego,!appengine,!js + +// This file contains the implementation of the proto field accesses using package unsafe. + +package proto + +import ( + "reflect" + "sync/atomic" + "unsafe" +) + +const unsafeAllowed = true + +// A field identifies a field in a struct, accessible from a pointer. +// In this implementation, a field is identified by its byte offset from the start of the struct. +type field uintptr + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return field(f.Offset) +} + +// invalidField is an invalid field identifier. +const invalidField = ^field(0) + +// zeroField is a noop when calling pointer.offset. +const zeroField = field(0) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { + return f != invalidField +} + +// The pointer type below is for the new table-driven encoder/decoder. +// The implementation here uses unsafe.Pointer to create a generic pointer. +// In pointer_reflect.go we use reflect instead of unsafe to implement +// the same (but slower) interface. +type pointer struct { + p unsafe.Pointer +} + +// size of pointer +var ptrSize = unsafe.Sizeof(uintptr(0)) + +// toPointer converts an interface of pointer type to a pointer +// that points to the same target. +func toPointer(i *Message) pointer { + // Super-tricky - read pointer out of data word of interface value. + // Saves ~25ns over the equivalent: + // return valToPointer(reflect.ValueOf(*i)) + return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} +} + +// toAddrPointer converts an interface to a pointer that points to +// the interface data. +func toAddrPointer(i *interface{}, isptr bool) pointer { + // Super-tricky - read or get the address of data word of interface value. + if isptr { + // The interface is of pointer type, thus it is a direct interface. + // The data word is the pointer data itself. We take its address. + return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} + } + // The interface is not of pointer type. The data word is the pointer + // to the data. + return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} +} + +// valToPointer converts v to a pointer. v must be of pointer type. +func valToPointer(v reflect.Value) pointer { + return pointer{p: unsafe.Pointer(v.Pointer())} +} + +// offset converts from a pointer to a structure to a pointer to +// one of its fields. +func (p pointer) offset(f field) pointer { + // For safety, we should panic if !f.IsValid, however calling panic causes + // this to no longer be inlineable, which is a serious performance cost. + /* + if !f.IsValid() { + panic("invalid field") + } + */ + return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} +} + +func (p pointer) isNil() bool { + return p.p == nil +} + +func (p pointer) toInt64() *int64 { + return (*int64)(p.p) +} +func (p pointer) toInt64Ptr() **int64 { + return (**int64)(p.p) +} +func (p pointer) toInt64Slice() *[]int64 { + return (*[]int64)(p.p) +} +func (p pointer) toInt32() *int32 { + return (*int32)(p.p) +} + +// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. +/* + func (p pointer) toInt32Ptr() **int32 { + return (**int32)(p.p) + } + func (p pointer) toInt32Slice() *[]int32 { + return (*[]int32)(p.p) + } +*/ +func (p pointer) getInt32Ptr() *int32 { + return *(**int32)(p.p) +} +func (p pointer) setInt32Ptr(v int32) { + *(**int32)(p.p) = &v +} + +// getInt32Slice loads a []int32 from p. +// The value returned is aliased with the original slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) getInt32Slice() []int32 { + return *(*[]int32)(p.p) +} + +// setInt32Slice stores a []int32 to p. +// The value set is aliased with the input slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) setInt32Slice(v []int32) { + *(*[]int32)(p.p) = v +} + +// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? +func (p pointer) appendInt32Slice(v int32) { + s := (*[]int32)(p.p) + *s = append(*s, v) +} + +func (p pointer) toUint64() *uint64 { + return (*uint64)(p.p) +} +func (p pointer) toUint64Ptr() **uint64 { + return (**uint64)(p.p) +} +func (p pointer) toUint64Slice() *[]uint64 { + return (*[]uint64)(p.p) +} +func (p pointer) toUint32() *uint32 { + return (*uint32)(p.p) +} +func (p pointer) toUint32Ptr() **uint32 { + return (**uint32)(p.p) +} +func (p pointer) toUint32Slice() *[]uint32 { + return (*[]uint32)(p.p) +} +func (p pointer) toBool() *bool { + return (*bool)(p.p) +} +func (p pointer) toBoolPtr() **bool { + return (**bool)(p.p) +} +func (p pointer) toBoolSlice() *[]bool { + return (*[]bool)(p.p) +} +func (p pointer) toFloat64() *float64 { + return (*float64)(p.p) +} +func (p pointer) toFloat64Ptr() **float64 { + return (**float64)(p.p) +} +func (p pointer) toFloat64Slice() *[]float64 { + return (*[]float64)(p.p) +} +func (p pointer) toFloat32() *float32 { + return (*float32)(p.p) +} +func (p pointer) toFloat32Ptr() **float32 { + return (**float32)(p.p) +} +func (p pointer) toFloat32Slice() *[]float32 { + return (*[]float32)(p.p) +} +func (p pointer) toString() *string { + return (*string)(p.p) +} +func (p pointer) toStringPtr() **string { + return (**string)(p.p) +} +func (p pointer) toStringSlice() *[]string { + return (*[]string)(p.p) +} +func (p pointer) toBytes() *[]byte { + return (*[]byte)(p.p) +} +func (p pointer) toBytesSlice() *[][]byte { + return (*[][]byte)(p.p) +} +func (p pointer) toExtensions() *XXX_InternalExtensions { + return (*XXX_InternalExtensions)(p.p) +} +func (p pointer) toOldExtensions() *map[int32]Extension { + return (*map[int32]Extension)(p.p) +} + +// getPointerSlice loads []*T from p as a []pointer. +// The value returned is aliased with the original slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) getPointerSlice() []pointer { + // Super-tricky - p should point to a []*T where T is a + // message type. We load it as []pointer. + return *(*[]pointer)(p.p) +} + +// setPointerSlice stores []pointer into p as a []*T. +// The value set is aliased with the input slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) setPointerSlice(v []pointer) { + // Super-tricky - p should point to a []*T where T is a + // message type. We store it as []pointer. + *(*[]pointer)(p.p) = v +} + +// getPointer loads the pointer at p and returns it. +func (p pointer) getPointer() pointer { + return pointer{p: *(*unsafe.Pointer)(p.p)} +} + +// setPointer stores the pointer q at p. +func (p pointer) setPointer(q pointer) { + *(*unsafe.Pointer)(p.p) = q.p +} + +// append q to the slice pointed to by p. +func (p pointer) appendPointer(q pointer) { + s := (*[]unsafe.Pointer)(p.p) + *s = append(*s, q.p) +} + +// getInterfacePointer returns a pointer that points to the +// interface data of the interface pointed by p. +func (p pointer) getInterfacePointer() pointer { + // Super-tricky - read pointer out of data word of interface value. + return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} +} + +// asPointerTo returns a reflect.Value that is a pointer to an +// object of type t stored at p. +func (p pointer) asPointerTo(t reflect.Type) reflect.Value { + return reflect.NewAt(t, p.p) +} + +func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { + return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { + return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { + return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { + return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go new file mode 100644 index 000000000..aca8eed02 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go @@ -0,0 +1,56 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build !purego,!appengine,!js + +// This file contains the implementation of the proto field accesses using package unsafe. + +package proto + +import ( + "reflect" + "unsafe" +) + +func (p pointer) getRef() pointer { + return pointer{p: (unsafe.Pointer)(&p.p)} +} + +func (p pointer) appendRef(v pointer, typ reflect.Type) { + slice := p.getSlice(typ) + elem := v.asPointerTo(typ).Elem() + newSlice := reflect.Append(slice, elem) + slice.Set(newSlice) +} + +func (p pointer) getSlice(typ reflect.Type) reflect.Value { + sliceTyp := reflect.SliceOf(typ) + slice := p.asPointerTo(sliceTyp) + slice = slice.Elem() + return slice +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/properties.go b/integration-test/vendor/github.com/gogo/protobuf/proto/properties.go new file mode 100644 index 000000000..28da1475f --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/properties.go @@ -0,0 +1,610 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +/* + * Routines for encoding data into the wire format for protocol buffers. + */ + +import ( + "fmt" + "log" + "reflect" + "sort" + "strconv" + "strings" + "sync" +) + +const debug bool = false + +// Constants that identify the encoding of a value on the wire. +const ( + WireVarint = 0 + WireFixed64 = 1 + WireBytes = 2 + WireStartGroup = 3 + WireEndGroup = 4 + WireFixed32 = 5 +) + +// tagMap is an optimization over map[int]int for typical protocol buffer +// use-cases. Encoded protocol buffers are often in tag order with small tag +// numbers. +type tagMap struct { + fastTags []int + slowTags map[int]int +} + +// tagMapFastLimit is the upper bound on the tag number that will be stored in +// the tagMap slice rather than its map. +const tagMapFastLimit = 1024 + +func (p *tagMap) get(t int) (int, bool) { + if t > 0 && t < tagMapFastLimit { + if t >= len(p.fastTags) { + return 0, false + } + fi := p.fastTags[t] + return fi, fi >= 0 + } + fi, ok := p.slowTags[t] + return fi, ok +} + +func (p *tagMap) put(t int, fi int) { + if t > 0 && t < tagMapFastLimit { + for len(p.fastTags) < t+1 { + p.fastTags = append(p.fastTags, -1) + } + p.fastTags[t] = fi + return + } + if p.slowTags == nil { + p.slowTags = make(map[int]int) + } + p.slowTags[t] = fi +} + +// StructProperties represents properties for all the fields of a struct. +// decoderTags and decoderOrigNames should only be used by the decoder. +type StructProperties struct { + Prop []*Properties // properties for each field + reqCount int // required count + decoderTags tagMap // map from proto tag to struct field number + decoderOrigNames map[string]int // map from original name to struct field number + order []int // list of struct field numbers in tag order + + // OneofTypes contains information about the oneof fields in this message. + // It is keyed by the original name of a field. + OneofTypes map[string]*OneofProperties +} + +// OneofProperties represents information about a specific field in a oneof. +type OneofProperties struct { + Type reflect.Type // pointer to generated struct type for this oneof field + Field int // struct field number of the containing oneof in the message + Prop *Properties +} + +// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. +// See encode.go, (*Buffer).enc_struct. + +func (sp *StructProperties) Len() int { return len(sp.order) } +func (sp *StructProperties) Less(i, j int) bool { + return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag +} +func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } + +// Properties represents the protocol-specific behavior of a single struct field. +type Properties struct { + Name string // name of the field, for error messages + OrigName string // original name before protocol compiler (always set) + JSONName string // name to use for JSON; determined by protoc + Wire string + WireType int + Tag int + Required bool + Optional bool + Repeated bool + Packed bool // relevant for repeated primitives only + Enum string // set for enum types only + proto3 bool // whether this is known to be a proto3 field + oneof bool // whether this is a oneof field + + Default string // default value + HasDefault bool // whether an explicit default was provided + CustomType string + CastType string + StdTime bool + StdDuration bool + WktPointer bool + + stype reflect.Type // set for struct types only + ctype reflect.Type // set for custom types only + sprop *StructProperties // set for struct types only + + mtype reflect.Type // set for map types only + MapKeyProp *Properties // set for map types only + MapValProp *Properties // set for map types only +} + +// String formats the properties in the protobuf struct field tag style. +func (p *Properties) String() string { + s := p.Wire + s += "," + s += strconv.Itoa(p.Tag) + if p.Required { + s += ",req" + } + if p.Optional { + s += ",opt" + } + if p.Repeated { + s += ",rep" + } + if p.Packed { + s += ",packed" + } + s += ",name=" + p.OrigName + if p.JSONName != p.OrigName { + s += ",json=" + p.JSONName + } + if p.proto3 { + s += ",proto3" + } + if p.oneof { + s += ",oneof" + } + if len(p.Enum) > 0 { + s += ",enum=" + p.Enum + } + if p.HasDefault { + s += ",def=" + p.Default + } + return s +} + +// Parse populates p by parsing a string in the protobuf struct field tag style. +func (p *Properties) Parse(s string) { + // "bytes,49,opt,name=foo,def=hello!" + fields := strings.Split(s, ",") // breaks def=, but handled below. + if len(fields) < 2 { + log.Printf("proto: tag has too few fields: %q", s) + return + } + + p.Wire = fields[0] + switch p.Wire { + case "varint": + p.WireType = WireVarint + case "fixed32": + p.WireType = WireFixed32 + case "fixed64": + p.WireType = WireFixed64 + case "zigzag32": + p.WireType = WireVarint + case "zigzag64": + p.WireType = WireVarint + case "bytes", "group": + p.WireType = WireBytes + // no numeric converter for non-numeric types + default: + log.Printf("proto: tag has unknown wire type: %q", s) + return + } + + var err error + p.Tag, err = strconv.Atoi(fields[1]) + if err != nil { + return + } + +outer: + for i := 2; i < len(fields); i++ { + f := fields[i] + switch { + case f == "req": + p.Required = true + case f == "opt": + p.Optional = true + case f == "rep": + p.Repeated = true + case f == "packed": + p.Packed = true + case strings.HasPrefix(f, "name="): + p.OrigName = f[5:] + case strings.HasPrefix(f, "json="): + p.JSONName = f[5:] + case strings.HasPrefix(f, "enum="): + p.Enum = f[5:] + case f == "proto3": + p.proto3 = true + case f == "oneof": + p.oneof = true + case strings.HasPrefix(f, "def="): + p.HasDefault = true + p.Default = f[4:] // rest of string + if i+1 < len(fields) { + // Commas aren't escaped, and def is always last. + p.Default += "," + strings.Join(fields[i+1:], ",") + break outer + } + case strings.HasPrefix(f, "embedded="): + p.OrigName = strings.Split(f, "=")[1] + case strings.HasPrefix(f, "customtype="): + p.CustomType = strings.Split(f, "=")[1] + case strings.HasPrefix(f, "casttype="): + p.CastType = strings.Split(f, "=")[1] + case f == "stdtime": + p.StdTime = true + case f == "stdduration": + p.StdDuration = true + case f == "wktptr": + p.WktPointer = true + } + } +} + +var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() + +// setFieldProps initializes the field properties for submessages and maps. +func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { + isMap := typ.Kind() == reflect.Map + if len(p.CustomType) > 0 && !isMap { + p.ctype = typ + p.setTag(lockGetProp) + return + } + if p.StdTime && !isMap { + p.setTag(lockGetProp) + return + } + if p.StdDuration && !isMap { + p.setTag(lockGetProp) + return + } + if p.WktPointer && !isMap { + p.setTag(lockGetProp) + return + } + switch t1 := typ; t1.Kind() { + case reflect.Struct: + p.stype = typ + case reflect.Ptr: + if t1.Elem().Kind() == reflect.Struct { + p.stype = t1.Elem() + } + case reflect.Slice: + switch t2 := t1.Elem(); t2.Kind() { + case reflect.Ptr: + switch t3 := t2.Elem(); t3.Kind() { + case reflect.Struct: + p.stype = t3 + } + case reflect.Struct: + p.stype = t2 + } + + case reflect.Map: + + p.mtype = t1 + p.MapKeyProp = &Properties{} + p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) + p.MapValProp = &Properties{} + vtype := p.mtype.Elem() + if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { + // The value type is not a message (*T) or bytes ([]byte), + // so we need encoders for the pointer to this type. + vtype = reflect.PtrTo(vtype) + } + + p.MapValProp.CustomType = p.CustomType + p.MapValProp.StdDuration = p.StdDuration + p.MapValProp.StdTime = p.StdTime + p.MapValProp.WktPointer = p.WktPointer + p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) + } + p.setTag(lockGetProp) +} + +func (p *Properties) setTag(lockGetProp bool) { + if p.stype != nil { + if lockGetProp { + p.sprop = GetProperties(p.stype) + } else { + p.sprop = getPropertiesLocked(p.stype) + } + } +} + +var ( + marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() +) + +// Init populates the properties from a protocol buffer struct tag. +func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { + p.init(typ, name, tag, f, true) +} + +func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { + // "bytes,49,opt,def=hello!" + p.Name = name + p.OrigName = name + if tag == "" { + return + } + p.Parse(tag) + p.setFieldProps(typ, f, lockGetProp) +} + +var ( + propertiesMu sync.RWMutex + propertiesMap = make(map[reflect.Type]*StructProperties) +) + +// GetProperties returns the list of properties for the type represented by t. +// t must represent a generated struct type of a protocol message. +func GetProperties(t reflect.Type) *StructProperties { + if t.Kind() != reflect.Struct { + panic("proto: type must have kind struct") + } + + // Most calls to GetProperties in a long-running program will be + // retrieving details for types we have seen before. + propertiesMu.RLock() + sprop, ok := propertiesMap[t] + propertiesMu.RUnlock() + if ok { + return sprop + } + + propertiesMu.Lock() + sprop = getPropertiesLocked(t) + propertiesMu.Unlock() + return sprop +} + +type ( + oneofFuncsIface interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + } + oneofWrappersIface interface { + XXX_OneofWrappers() []interface{} + } +) + +// getPropertiesLocked requires that propertiesMu is held. +func getPropertiesLocked(t reflect.Type) *StructProperties { + if prop, ok := propertiesMap[t]; ok { + return prop + } + + prop := new(StructProperties) + // in case of recursive protos, fill this in now. + propertiesMap[t] = prop + + // build properties + prop.Prop = make([]*Properties, t.NumField()) + prop.order = make([]int, t.NumField()) + + isOneofMessage := false + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + p := new(Properties) + name := f.Name + p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) + + oneof := f.Tag.Get("protobuf_oneof") // special case + if oneof != "" { + isOneofMessage = true + // Oneof fields don't use the traditional protobuf tag. + p.OrigName = oneof + } + prop.Prop[i] = p + prop.order[i] = i + if debug { + print(i, " ", f.Name, " ", t.String(), " ") + if p.Tag > 0 { + print(p.String()) + } + print("\n") + } + } + + // Re-order prop.order. + sort.Sort(prop) + + if isOneofMessage { + var oots []interface{} + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oots = m.XXX_OneofFuncs() + case oneofWrappersIface: + oots = m.XXX_OneofWrappers() + } + if len(oots) > 0 { + // Interpret oneof metadata. + prop.OneofTypes = make(map[string]*OneofProperties) + for _, oot := range oots { + oop := &OneofProperties{ + Type: reflect.ValueOf(oot).Type(), // *T + Prop: new(Properties), + } + sft := oop.Type.Elem().Field(0) + oop.Prop.Name = sft.Name + oop.Prop.Parse(sft.Tag.Get("protobuf")) + // There will be exactly one interface field that + // this new value is assignable to. + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if f.Type.Kind() != reflect.Interface { + continue + } + if !oop.Type.AssignableTo(f.Type) { + continue + } + oop.Field = i + break + } + prop.OneofTypes[oop.Prop.OrigName] = oop + } + } + } + + // build required counts + // build tags + reqCount := 0 + prop.decoderOrigNames = make(map[string]int) + for i, p := range prop.Prop { + if strings.HasPrefix(p.Name, "XXX_") { + // Internal fields should not appear in tags/origNames maps. + // They are handled specially when encoding and decoding. + continue + } + if p.Required { + reqCount++ + } + prop.decoderTags.put(p.Tag, i) + prop.decoderOrigNames[p.OrigName] = i + } + prop.reqCount = reqCount + + return prop +} + +// A global registry of enum types. +// The generated code will register the generated maps by calling RegisterEnum. + +var enumValueMaps = make(map[string]map[string]int32) +var enumStringMaps = make(map[string]map[int32]string) + +// RegisterEnum is called from the generated code to install the enum descriptor +// maps into the global table to aid parsing text format protocol buffers. +func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { + if _, ok := enumValueMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumValueMaps[typeName] = valueMap + if _, ok := enumStringMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumStringMaps[typeName] = unusedNameMap +} + +// EnumValueMap returns the mapping from names to integers of the +// enum type enumType, or a nil if not found. +func EnumValueMap(enumType string) map[string]int32 { + return enumValueMaps[enumType] +} + +// A registry of all linked message types. +// The string is a fully-qualified proto name ("pkg.Message"). +var ( + protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers + protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types + revProtoTypes = make(map[reflect.Type]string) +) + +// RegisterType is called from generated code and maps from the fully qualified +// proto name to the type (pointer to struct) of the protocol buffer. +func RegisterType(x Message, name string) { + if _, ok := protoTypedNils[name]; ok { + // TODO: Some day, make this a panic. + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { + // Generated code always calls RegisterType with nil x. + // This check is just for extra safety. + protoTypedNils[name] = x + } else { + protoTypedNils[name] = reflect.Zero(t).Interface().(Message) + } + revProtoTypes[t] = name +} + +// RegisterMapType is called from generated code and maps from the fully qualified +// proto name to the native map type of the proto map definition. +func RegisterMapType(x interface{}, name string) { + if reflect.TypeOf(x).Kind() != reflect.Map { + panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) + } + if _, ok := protoMapTypes[name]; ok { + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + protoMapTypes[name] = t + revProtoTypes[t] = name +} + +// MessageName returns the fully-qualified proto name for the given message type. +func MessageName(x Message) string { + type xname interface { + XXX_MessageName() string + } + if m, ok := x.(xname); ok { + return m.XXX_MessageName() + } + return revProtoTypes[reflect.TypeOf(x)] +} + +// MessageType returns the message type (pointer to struct) for a named message. +// The type is not guaranteed to implement proto.Message if the name refers to a +// map entry. +func MessageType(name string) reflect.Type { + if t, ok := protoTypedNils[name]; ok { + return reflect.TypeOf(t) + } + return protoMapTypes[name] +} + +// A registry of all linked proto files. +var ( + protoFiles = make(map[string][]byte) // file name => fileDescriptor +) + +// RegisterFile is called from generated code and maps from the +// full file name of a .proto file to its compressed FileDescriptorProto. +func RegisterFile(filename string, fileDescriptor []byte) { + protoFiles[filename] = fileDescriptor +} + +// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. +func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/properties_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/properties_gogo.go new file mode 100644 index 000000000..40ea3dd93 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/properties_gogo.go @@ -0,0 +1,36 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "reflect" +) + +var sizerType = reflect.TypeOf((*Sizer)(nil)).Elem() +var protosizerType = reflect.TypeOf((*ProtoSizer)(nil)).Elem() diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/skip_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/skip_gogo.go new file mode 100644 index 000000000..5a5fd93f7 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/skip_gogo.go @@ -0,0 +1,119 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "io" +) + +func Skip(data []byte) (n int, err error) { + l := len(data) + index := 0 + for index < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + index++ + if data[index-1] < 0x80 { + break + } + } + return index, nil + case 1: + index += 8 + return index, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + index += length + return index, nil + case 3: + for { + var innerWire uint64 + var start int = index + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := Skip(data[start:]) + if err != nil { + return 0, err + } + index = start + next + } + return index, nil + case 4: + return index, nil + case 5: + index += 4 + return index, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/table_marshal.go b/integration-test/vendor/github.com/gogo/protobuf/proto/table_marshal.go new file mode 100644 index 000000000..f8babdefa --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/table_marshal.go @@ -0,0 +1,3009 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "errors" + "fmt" + "math" + "reflect" + "sort" + "strconv" + "strings" + "sync" + "sync/atomic" + "unicode/utf8" +) + +// a sizer takes a pointer to a field and the size of its tag, computes the size of +// the encoded data. +type sizer func(pointer, int) int + +// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), +// marshals the field to the end of the slice, returns the slice and error (if any). +type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) + +// marshalInfo is the information used for marshaling a message. +type marshalInfo struct { + typ reflect.Type + fields []*marshalFieldInfo + unrecognized field // offset of XXX_unrecognized + extensions field // offset of XXX_InternalExtensions + v1extensions field // offset of XXX_extensions + sizecache field // offset of XXX_sizecache + initialized int32 // 0 -- only typ is set, 1 -- fully initialized + messageset bool // uses message set wire format + hasmarshaler bool // has custom marshaler + sync.RWMutex // protect extElems map, also for initialization + extElems map[int32]*marshalElemInfo // info of extension elements + + hassizer bool // has custom sizer + hasprotosizer bool // has custom protosizer + + bytesExtensions field // offset of XXX_extensions where the field type is []byte +} + +// marshalFieldInfo is the information used for marshaling a field of a message. +type marshalFieldInfo struct { + field field + wiretag uint64 // tag in wire format + tagsize int // size of tag in wire format + sizer sizer + marshaler marshaler + isPointer bool + required bool // field is required + name string // name of the field, for error reporting + oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements +} + +// marshalElemInfo is the information used for marshaling an extension or oneof element. +type marshalElemInfo struct { + wiretag uint64 // tag in wire format + tagsize int // size of tag in wire format + sizer sizer + marshaler marshaler + isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) +} + +var ( + marshalInfoMap = map[reflect.Type]*marshalInfo{} + marshalInfoLock sync.Mutex + + uint8SliceType = reflect.TypeOf(([]uint8)(nil)).Kind() +) + +// getMarshalInfo returns the information to marshal a given type of message. +// The info it returns may not necessarily initialized. +// t is the type of the message (NOT the pointer to it). +func getMarshalInfo(t reflect.Type) *marshalInfo { + marshalInfoLock.Lock() + u, ok := marshalInfoMap[t] + if !ok { + u = &marshalInfo{typ: t} + marshalInfoMap[t] = u + } + marshalInfoLock.Unlock() + return u +} + +// Size is the entry point from generated code, +// and should be ONLY called by generated code. +// It computes the size of encoded data of msg. +// a is a pointer to a place to store cached marshal info. +func (a *InternalMessageInfo) Size(msg Message) int { + u := getMessageMarshalInfo(msg, a) + ptr := toPointer(&msg) + if ptr.isNil() { + // We get here if msg is a typed nil ((*SomeMessage)(nil)), + // so it satisfies the interface, and msg == nil wouldn't + // catch it. We don't want crash in this case. + return 0 + } + return u.size(ptr) +} + +// Marshal is the entry point from generated code, +// and should be ONLY called by generated code. +// It marshals msg to the end of b. +// a is a pointer to a place to store cached marshal info. +func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { + u := getMessageMarshalInfo(msg, a) + ptr := toPointer(&msg) + if ptr.isNil() { + // We get here if msg is a typed nil ((*SomeMessage)(nil)), + // so it satisfies the interface, and msg == nil wouldn't + // catch it. We don't want crash in this case. + return b, ErrNil + } + return u.marshal(b, ptr, deterministic) +} + +func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { + // u := a.marshal, but atomically. + // We use an atomic here to ensure memory consistency. + u := atomicLoadMarshalInfo(&a.marshal) + if u == nil { + // Get marshal information from type of message. + t := reflect.ValueOf(msg).Type() + if t.Kind() != reflect.Ptr { + panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) + } + u = getMarshalInfo(t.Elem()) + // Store it in the cache for later users. + // a.marshal = u, but atomically. + atomicStoreMarshalInfo(&a.marshal, u) + } + return u +} + +// size is the main function to compute the size of the encoded data of a message. +// ptr is the pointer to the message. +func (u *marshalInfo) size(ptr pointer) int { + if atomic.LoadInt32(&u.initialized) == 0 { + u.computeMarshalInfo() + } + + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if u.hasmarshaler { + // Uses the message's Size method if available + if u.hassizer { + s := ptr.asPointerTo(u.typ).Interface().(Sizer) + return s.Size() + } + // Uses the message's ProtoSize method if available + if u.hasprotosizer { + s := ptr.asPointerTo(u.typ).Interface().(ProtoSizer) + return s.ProtoSize() + } + + m := ptr.asPointerTo(u.typ).Interface().(Marshaler) + b, _ := m.Marshal() + return len(b) + } + + n := 0 + for _, f := range u.fields { + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { + // nil pointer always marshals to nothing + continue + } + n += f.sizer(ptr.offset(f.field), f.tagsize) + } + if u.extensions.IsValid() { + e := ptr.offset(u.extensions).toExtensions() + if u.messageset { + n += u.sizeMessageSet(e) + } else { + n += u.sizeExtensions(e) + } + } + if u.v1extensions.IsValid() { + m := *ptr.offset(u.v1extensions).toOldExtensions() + n += u.sizeV1Extensions(m) + } + if u.bytesExtensions.IsValid() { + s := *ptr.offset(u.bytesExtensions).toBytes() + n += len(s) + } + if u.unrecognized.IsValid() { + s := *ptr.offset(u.unrecognized).toBytes() + n += len(s) + } + + // cache the result for use in marshal + if u.sizecache.IsValid() { + atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) + } + return n +} + +// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), +// fall back to compute the size. +func (u *marshalInfo) cachedsize(ptr pointer) int { + if u.sizecache.IsValid() { + return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) + } + return u.size(ptr) +} + +// marshal is the main function to marshal a message. It takes a byte slice and appends +// the encoded data to the end of the slice, returns the slice and error (if any). +// ptr is the pointer to the message. +// If deterministic is true, map is marshaled in deterministic order. +func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { + if atomic.LoadInt32(&u.initialized) == 0 { + u.computeMarshalInfo() + } + + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if u.hasmarshaler { + m := ptr.asPointerTo(u.typ).Interface().(Marshaler) + b1, err := m.Marshal() + b = append(b, b1...) + return b, err + } + + var err, errLater error + // The old marshaler encodes extensions at beginning. + if u.extensions.IsValid() { + e := ptr.offset(u.extensions).toExtensions() + if u.messageset { + b, err = u.appendMessageSet(b, e, deterministic) + } else { + b, err = u.appendExtensions(b, e, deterministic) + } + if err != nil { + return b, err + } + } + if u.v1extensions.IsValid() { + m := *ptr.offset(u.v1extensions).toOldExtensions() + b, err = u.appendV1Extensions(b, m, deterministic) + if err != nil { + return b, err + } + } + if u.bytesExtensions.IsValid() { + s := *ptr.offset(u.bytesExtensions).toBytes() + b = append(b, s...) + } + for _, f := range u.fields { + if f.required { + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { + // Required field is not set. + // We record the error but keep going, to give a complete marshaling. + if errLater == nil { + errLater = &RequiredNotSetError{f.name} + } + continue + } + } + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { + // nil pointer always marshals to nothing + continue + } + b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) + if err != nil { + if err1, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errLater == nil { + errLater = &RequiredNotSetError{f.name + "." + err1.field} + } + continue + } + if err == errRepeatedHasNil { + err = errors.New("proto: repeated field " + f.name + " has nil element") + } + if err == errInvalidUTF8 { + if errLater == nil { + fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name + errLater = &invalidUTF8Error{fullName} + } + continue + } + return b, err + } + } + if u.unrecognized.IsValid() { + s := *ptr.offset(u.unrecognized).toBytes() + b = append(b, s...) + } + return b, errLater +} + +// computeMarshalInfo initializes the marshal info. +func (u *marshalInfo) computeMarshalInfo() { + u.Lock() + defer u.Unlock() + if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock + return + } + + t := u.typ + u.unrecognized = invalidField + u.extensions = invalidField + u.v1extensions = invalidField + u.bytesExtensions = invalidField + u.sizecache = invalidField + isOneofMessage := false + + if reflect.PtrTo(t).Implements(sizerType) { + u.hassizer = true + } + if reflect.PtrTo(t).Implements(protosizerType) { + u.hasprotosizer = true + } + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + if reflect.PtrTo(t).Implements(marshalerType) { + u.hasmarshaler = true + atomic.StoreInt32(&u.initialized, 1) + return + } + + n := t.NumField() + + // deal with XXX fields first + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if f.Tag.Get("protobuf_oneof") != "" { + isOneofMessage = true + } + if !strings.HasPrefix(f.Name, "XXX_") { + continue + } + switch f.Name { + case "XXX_sizecache": + u.sizecache = toField(&f) + case "XXX_unrecognized": + u.unrecognized = toField(&f) + case "XXX_InternalExtensions": + u.extensions = toField(&f) + u.messageset = f.Tag.Get("protobuf_messageset") == "1" + case "XXX_extensions": + if f.Type.Kind() == reflect.Map { + u.v1extensions = toField(&f) + } else { + u.bytesExtensions = toField(&f) + } + case "XXX_NoUnkeyedLiteral": + // nothing to do + default: + panic("unknown XXX field: " + f.Name) + } + n-- + } + + // get oneof implementers + var oneofImplementers []interface{} + // gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler + if isOneofMessage { + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oneofImplementers = m.XXX_OneofFuncs() + case oneofWrappersIface: + oneofImplementers = m.XXX_OneofWrappers() + } + } + + // normal fields + fields := make([]marshalFieldInfo, n) // batch allocation + u.fields = make([]*marshalFieldInfo, 0, n) + for i, j := 0, 0; i < t.NumField(); i++ { + f := t.Field(i) + + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + field := &fields[j] + j++ + field.name = f.Name + u.fields = append(u.fields, field) + if f.Tag.Get("protobuf_oneof") != "" { + field.computeOneofFieldInfo(&f, oneofImplementers) + continue + } + if f.Tag.Get("protobuf") == "" { + // field has no tag (not in generated message), ignore it + u.fields = u.fields[:len(u.fields)-1] + j-- + continue + } + field.computeMarshalFieldInfo(&f) + } + + // fields are marshaled in tag order on the wire. + sort.Sort(byTag(u.fields)) + + atomic.StoreInt32(&u.initialized, 1) +} + +// helper for sorting fields by tag +type byTag []*marshalFieldInfo + +func (a byTag) Len() int { return len(a) } +func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } + +// getExtElemInfo returns the information to marshal an extension element. +// The info it returns is initialized. +func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { + // get from cache first + u.RLock() + e, ok := u.extElems[desc.Field] + u.RUnlock() + if ok { + return e + } + + t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct + tags := strings.Split(desc.Tag, ",") + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + sizr, marshalr := typeMarshaler(t, tags, false, false) + e = &marshalElemInfo{ + wiretag: uint64(tag)<<3 | wt, + tagsize: SizeVarint(uint64(tag) << 3), + sizer: sizr, + marshaler: marshalr, + isptr: t.Kind() == reflect.Ptr, + } + + // update cache + u.Lock() + if u.extElems == nil { + u.extElems = make(map[int32]*marshalElemInfo) + } + u.extElems[desc.Field] = e + u.Unlock() + return e +} + +// computeMarshalFieldInfo fills up the information to marshal a field. +func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { + // parse protobuf tag of the field. + // tag has format of "bytes,49,opt,name=foo,def=hello!" + tags := strings.Split(f.Tag.Get("protobuf"), ",") + if tags[0] == "" { + return + } + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + if tags[2] == "req" { + fi.required = true + } + fi.setTag(f, tag, wt) + fi.setMarshaler(f, tags) +} + +func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { + fi.field = toField(f) + fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. + fi.isPointer = true + fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) + fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) + + ityp := f.Type // interface type + for _, o := range oneofImplementers { + t := reflect.TypeOf(o) + if !t.Implements(ityp) { + continue + } + sf := t.Elem().Field(0) // oneof implementer is a struct with a single field + tags := strings.Split(sf.Tag.Get("protobuf"), ",") + tag, err := strconv.Atoi(tags[1]) + if err != nil { + panic("tag is not an integer") + } + wt := wiretype(tags[0]) + sizr, marshalr := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value + fi.oneofElems[t.Elem()] = &marshalElemInfo{ + wiretag: uint64(tag)<<3 | wt, + tagsize: SizeVarint(uint64(tag) << 3), + sizer: sizr, + marshaler: marshalr, + } + } +} + +// wiretype returns the wire encoding of the type. +func wiretype(encoding string) uint64 { + switch encoding { + case "fixed32": + return WireFixed32 + case "fixed64": + return WireFixed64 + case "varint", "zigzag32", "zigzag64": + return WireVarint + case "bytes": + return WireBytes + case "group": + return WireStartGroup + } + panic("unknown wire type " + encoding) +} + +// setTag fills up the tag (in wire format) and its size in the info of a field. +func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { + fi.field = toField(f) + fi.wiretag = uint64(tag)<<3 | wt + fi.tagsize = SizeVarint(uint64(tag) << 3) +} + +// setMarshaler fills up the sizer and marshaler in the info of a field. +func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { + switch f.Type.Kind() { + case reflect.Map: + // map field + fi.isPointer = true + fi.sizer, fi.marshaler = makeMapMarshaler(f) + return + case reflect.Ptr, reflect.Slice: + fi.isPointer = true + } + fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) +} + +// typeMarshaler returns the sizer and marshaler of a given field. +// t is the type of the field. +// tags is the generated "protobuf" tag of the field. +// If nozero is true, zero value is not marshaled to the wire. +// If oneof is true, it is a oneof field. +func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { + encoding := tags[0] + + pointer := false + slice := false + if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { + slice = true + t = t.Elem() + } + if t.Kind() == reflect.Ptr { + pointer = true + t = t.Elem() + } + + packed := false + proto3 := false + ctype := false + isTime := false + isDuration := false + isWktPointer := false + validateUTF8 := true + for i := 2; i < len(tags); i++ { + if tags[i] == "packed" { + packed = true + } + if tags[i] == "proto3" { + proto3 = true + } + if strings.HasPrefix(tags[i], "customtype=") { + ctype = true + } + if tags[i] == "stdtime" { + isTime = true + } + if tags[i] == "stdduration" { + isDuration = true + } + if tags[i] == "wktptr" { + isWktPointer = true + } + } + validateUTF8 = validateUTF8 && proto3 + if !proto3 && !pointer && !slice { + nozero = false + } + + if ctype { + if reflect.PtrTo(t).Implements(customType) { + if slice { + return makeMessageRefSliceMarshaler(getMarshalInfo(t)) + } + if pointer { + return makeCustomPtrMarshaler(getMarshalInfo(t)) + } + return makeCustomMarshaler(getMarshalInfo(t)) + } else { + panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) + } + } + + if isTime { + if pointer { + if slice { + return makeTimePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeTimePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeTimeSliceMarshaler(getMarshalInfo(t)) + } + return makeTimeMarshaler(getMarshalInfo(t)) + } + + if isDuration { + if pointer { + if slice { + return makeDurationPtrSliceMarshaler(getMarshalInfo(t)) + } + return makeDurationPtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeDurationSliceMarshaler(getMarshalInfo(t)) + } + return makeDurationMarshaler(getMarshalInfo(t)) + } + + if isWktPointer { + switch t.Kind() { + case reflect.Float64: + if pointer { + if slice { + return makeStdDoubleValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdDoubleValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdDoubleValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdDoubleValueMarshaler(getMarshalInfo(t)) + case reflect.Float32: + if pointer { + if slice { + return makeStdFloatValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdFloatValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdFloatValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdFloatValueMarshaler(getMarshalInfo(t)) + case reflect.Int64: + if pointer { + if slice { + return makeStdInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdInt64ValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdInt64ValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdInt64ValueMarshaler(getMarshalInfo(t)) + case reflect.Uint64: + if pointer { + if slice { + return makeStdUInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdUInt64ValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdUInt64ValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdUInt64ValueMarshaler(getMarshalInfo(t)) + case reflect.Int32: + if pointer { + if slice { + return makeStdInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdInt32ValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdInt32ValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdInt32ValueMarshaler(getMarshalInfo(t)) + case reflect.Uint32: + if pointer { + if slice { + return makeStdUInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdUInt32ValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdUInt32ValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdUInt32ValueMarshaler(getMarshalInfo(t)) + case reflect.Bool: + if pointer { + if slice { + return makeStdBoolValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdBoolValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdBoolValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdBoolValueMarshaler(getMarshalInfo(t)) + case reflect.String: + if pointer { + if slice { + return makeStdStringValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdStringValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdStringValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdStringValueMarshaler(getMarshalInfo(t)) + case uint8SliceType: + if pointer { + if slice { + return makeStdBytesValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdBytesValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdBytesValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdBytesValueMarshaler(getMarshalInfo(t)) + default: + panic(fmt.Sprintf("unknown wktpointer type %#v", t)) + } + } + + switch t.Kind() { + case reflect.Bool: + if pointer { + return sizeBoolPtr, appendBoolPtr + } + if slice { + if packed { + return sizeBoolPackedSlice, appendBoolPackedSlice + } + return sizeBoolSlice, appendBoolSlice + } + if nozero { + return sizeBoolValueNoZero, appendBoolValueNoZero + } + return sizeBoolValue, appendBoolValue + case reflect.Uint32: + switch encoding { + case "fixed32": + if pointer { + return sizeFixed32Ptr, appendFixed32Ptr + } + if slice { + if packed { + return sizeFixed32PackedSlice, appendFixed32PackedSlice + } + return sizeFixed32Slice, appendFixed32Slice + } + if nozero { + return sizeFixed32ValueNoZero, appendFixed32ValueNoZero + } + return sizeFixed32Value, appendFixed32Value + case "varint": + if pointer { + return sizeVarint32Ptr, appendVarint32Ptr + } + if slice { + if packed { + return sizeVarint32PackedSlice, appendVarint32PackedSlice + } + return sizeVarint32Slice, appendVarint32Slice + } + if nozero { + return sizeVarint32ValueNoZero, appendVarint32ValueNoZero + } + return sizeVarint32Value, appendVarint32Value + } + case reflect.Int32: + switch encoding { + case "fixed32": + if pointer { + return sizeFixedS32Ptr, appendFixedS32Ptr + } + if slice { + if packed { + return sizeFixedS32PackedSlice, appendFixedS32PackedSlice + } + return sizeFixedS32Slice, appendFixedS32Slice + } + if nozero { + return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero + } + return sizeFixedS32Value, appendFixedS32Value + case "varint": + if pointer { + return sizeVarintS32Ptr, appendVarintS32Ptr + } + if slice { + if packed { + return sizeVarintS32PackedSlice, appendVarintS32PackedSlice + } + return sizeVarintS32Slice, appendVarintS32Slice + } + if nozero { + return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero + } + return sizeVarintS32Value, appendVarintS32Value + case "zigzag32": + if pointer { + return sizeZigzag32Ptr, appendZigzag32Ptr + } + if slice { + if packed { + return sizeZigzag32PackedSlice, appendZigzag32PackedSlice + } + return sizeZigzag32Slice, appendZigzag32Slice + } + if nozero { + return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero + } + return sizeZigzag32Value, appendZigzag32Value + } + case reflect.Uint64: + switch encoding { + case "fixed64": + if pointer { + return sizeFixed64Ptr, appendFixed64Ptr + } + if slice { + if packed { + return sizeFixed64PackedSlice, appendFixed64PackedSlice + } + return sizeFixed64Slice, appendFixed64Slice + } + if nozero { + return sizeFixed64ValueNoZero, appendFixed64ValueNoZero + } + return sizeFixed64Value, appendFixed64Value + case "varint": + if pointer { + return sizeVarint64Ptr, appendVarint64Ptr + } + if slice { + if packed { + return sizeVarint64PackedSlice, appendVarint64PackedSlice + } + return sizeVarint64Slice, appendVarint64Slice + } + if nozero { + return sizeVarint64ValueNoZero, appendVarint64ValueNoZero + } + return sizeVarint64Value, appendVarint64Value + } + case reflect.Int64: + switch encoding { + case "fixed64": + if pointer { + return sizeFixedS64Ptr, appendFixedS64Ptr + } + if slice { + if packed { + return sizeFixedS64PackedSlice, appendFixedS64PackedSlice + } + return sizeFixedS64Slice, appendFixedS64Slice + } + if nozero { + return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero + } + return sizeFixedS64Value, appendFixedS64Value + case "varint": + if pointer { + return sizeVarintS64Ptr, appendVarintS64Ptr + } + if slice { + if packed { + return sizeVarintS64PackedSlice, appendVarintS64PackedSlice + } + return sizeVarintS64Slice, appendVarintS64Slice + } + if nozero { + return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero + } + return sizeVarintS64Value, appendVarintS64Value + case "zigzag64": + if pointer { + return sizeZigzag64Ptr, appendZigzag64Ptr + } + if slice { + if packed { + return sizeZigzag64PackedSlice, appendZigzag64PackedSlice + } + return sizeZigzag64Slice, appendZigzag64Slice + } + if nozero { + return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero + } + return sizeZigzag64Value, appendZigzag64Value + } + case reflect.Float32: + if pointer { + return sizeFloat32Ptr, appendFloat32Ptr + } + if slice { + if packed { + return sizeFloat32PackedSlice, appendFloat32PackedSlice + } + return sizeFloat32Slice, appendFloat32Slice + } + if nozero { + return sizeFloat32ValueNoZero, appendFloat32ValueNoZero + } + return sizeFloat32Value, appendFloat32Value + case reflect.Float64: + if pointer { + return sizeFloat64Ptr, appendFloat64Ptr + } + if slice { + if packed { + return sizeFloat64PackedSlice, appendFloat64PackedSlice + } + return sizeFloat64Slice, appendFloat64Slice + } + if nozero { + return sizeFloat64ValueNoZero, appendFloat64ValueNoZero + } + return sizeFloat64Value, appendFloat64Value + case reflect.String: + if validateUTF8 { + if pointer { + return sizeStringPtr, appendUTF8StringPtr + } + if slice { + return sizeStringSlice, appendUTF8StringSlice + } + if nozero { + return sizeStringValueNoZero, appendUTF8StringValueNoZero + } + return sizeStringValue, appendUTF8StringValue + } + if pointer { + return sizeStringPtr, appendStringPtr + } + if slice { + return sizeStringSlice, appendStringSlice + } + if nozero { + return sizeStringValueNoZero, appendStringValueNoZero + } + return sizeStringValue, appendStringValue + case reflect.Slice: + if slice { + return sizeBytesSlice, appendBytesSlice + } + if oneof { + // Oneof bytes field may also have "proto3" tag. + // We want to marshal it as a oneof field. Do this + // check before the proto3 check. + return sizeBytesOneof, appendBytesOneof + } + if proto3 { + return sizeBytes3, appendBytes3 + } + return sizeBytes, appendBytes + case reflect.Struct: + switch encoding { + case "group": + if slice { + return makeGroupSliceMarshaler(getMarshalInfo(t)) + } + return makeGroupMarshaler(getMarshalInfo(t)) + case "bytes": + if pointer { + if slice { + return makeMessageSliceMarshaler(getMarshalInfo(t)) + } + return makeMessageMarshaler(getMarshalInfo(t)) + } else { + if slice { + return makeMessageRefSliceMarshaler(getMarshalInfo(t)) + } + return makeMessageRefMarshaler(getMarshalInfo(t)) + } + } + } + panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) +} + +// Below are functions to size/marshal a specific type of a field. +// They are stored in the field's info, and called by function pointers. +// They have type sizer or marshaler. + +func sizeFixed32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFixed32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFixed32Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + return (4 + tagsize) * len(s) +} +func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFixedS32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFixedS32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFixedS32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + return (4 + tagsize) * len(s) +} +func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFloat32Value(_ pointer, tagsize int) int { + return 4 + tagsize +} +func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { + v := math.Float32bits(*ptr.toFloat32()) + if v == 0 { + return 0 + } + return 4 + tagsize +} +func sizeFloat32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toFloat32Ptr() + if p == nil { + return 0 + } + return 4 + tagsize +} +func sizeFloat32Slice(ptr pointer, tagsize int) int { + s := *ptr.toFloat32Slice() + return (4 + tagsize) * len(s) +} +func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toFloat32Slice() + if len(s) == 0 { + return 0 + } + return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize +} +func sizeFixed64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFixed64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFixed64Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + return (8 + tagsize) * len(s) +} +func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeFixedS64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFixedS64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFixedS64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + return (8 + tagsize) * len(s) +} +func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeFloat64Value(_ pointer, tagsize int) int { + return 8 + tagsize +} +func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { + v := math.Float64bits(*ptr.toFloat64()) + if v == 0 { + return 0 + } + return 8 + tagsize +} +func sizeFloat64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toFloat64Ptr() + if p == nil { + return 0 + } + return 8 + tagsize +} +func sizeFloat64Slice(ptr pointer, tagsize int) int { + s := *ptr.toFloat64Slice() + return (8 + tagsize) * len(s) +} +func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toFloat64Slice() + if len(s) == 0 { + return 0 + } + return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize +} +func sizeVarint32Value(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint32() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarint32Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint32Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarint32Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarintS32Value(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarintS32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarint64Value(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + return SizeVarint(v) + tagsize +} +func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toUint64() + if v == 0 { + return 0 + } + return SizeVarint(v) + tagsize +} +func sizeVarint64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toUint64Ptr() + if p == nil { + return 0 + } + return SizeVarint(*p) + tagsize +} +func sizeVarint64Slice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(v) + tagsize + } + return n +} +func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(v) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeVarintS64Value(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v)) + tagsize +} +func sizeVarintS64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + return SizeVarint(uint64(*p)) + tagsize +} +func sizeVarintS64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + tagsize + } + return n +} +func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeZigzag32Value(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt32() + if v == 0 { + return 0 + } + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32Ptr(ptr pointer, tagsize int) int { + p := ptr.getInt32Ptr() + if p == nil { + return 0 + } + v := *p + return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize +} +func sizeZigzag32Slice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize + } + return n +} +func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { + s := ptr.getInt32Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeZigzag64Value(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toInt64() + if v == 0 { + return 0 + } + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64Ptr(ptr pointer, tagsize int) int { + p := *ptr.toInt64Ptr() + if p == nil { + return 0 + } + v := *p + return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize +} +func sizeZigzag64Slice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize + } + return n +} +func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return 0 + } + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) + } + return n + SizeVarint(uint64(n)) + tagsize +} +func sizeBoolValue(_ pointer, tagsize int) int { + return 1 + tagsize +} +func sizeBoolValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toBool() + if !v { + return 0 + } + return 1 + tagsize +} +func sizeBoolPtr(ptr pointer, tagsize int) int { + p := *ptr.toBoolPtr() + if p == nil { + return 0 + } + return 1 + tagsize +} +func sizeBoolSlice(ptr pointer, tagsize int) int { + s := *ptr.toBoolSlice() + return (1 + tagsize) * len(s) +} +func sizeBoolPackedSlice(ptr pointer, tagsize int) int { + s := *ptr.toBoolSlice() + if len(s) == 0 { + return 0 + } + return len(s) + SizeVarint(uint64(len(s))) + tagsize +} +func sizeStringValue(ptr pointer, tagsize int) int { + v := *ptr.toString() + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringValueNoZero(ptr pointer, tagsize int) int { + v := *ptr.toString() + if v == "" { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringPtr(ptr pointer, tagsize int) int { + p := *ptr.toStringPtr() + if p == nil { + return 0 + } + v := *p + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeStringSlice(ptr pointer, tagsize int) int { + s := *ptr.toStringSlice() + n := 0 + for _, v := range s { + n += len(v) + SizeVarint(uint64(len(v))) + tagsize + } + return n +} +func sizeBytes(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + if v == nil { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytes3(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + if len(v) == 0 { + return 0 + } + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytesOneof(ptr pointer, tagsize int) int { + v := *ptr.toBytes() + return len(v) + SizeVarint(uint64(len(v))) + tagsize +} +func sizeBytesSlice(ptr pointer, tagsize int) int { + s := *ptr.toBytesSlice() + n := 0 + for _, v := range s { + n += len(v) + SizeVarint(uint64(len(v))) + tagsize + } + return n +} + +// appendFixed32 appends an encoded fixed32 to b. +func appendFixed32(b []byte, v uint32) []byte { + b = append(b, + byte(v), + byte(v>>8), + byte(v>>16), + byte(v>>24)) + return b +} + +// appendFixed64 appends an encoded fixed64 to b. +func appendFixed64(b []byte, v uint64) []byte { + b = append(b, + byte(v), + byte(v>>8), + byte(v>>16), + byte(v>>24), + byte(v>>32), + byte(v>>40), + byte(v>>48), + byte(v>>56)) + return b +} + +// appendVarint appends an encoded varint to b. +func appendVarint(b []byte, v uint64) []byte { + // TODO: make 1-byte (maybe 2-byte) case inline-able, once we + // have non-leaf inliner. + switch { + case v < 1<<7: + b = append(b, byte(v)) + case v < 1<<14: + b = append(b, + byte(v&0x7f|0x80), + byte(v>>7)) + case v < 1<<21: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte(v>>14)) + case v < 1<<28: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte(v>>21)) + case v < 1<<35: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte(v>>28)) + case v < 1<<42: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte(v>>35)) + case v < 1<<49: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte(v>>42)) + case v < 1<<56: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte(v>>49)) + case v < 1<<63: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte((v>>49)&0x7f|0x80), + byte(v>>56)) + default: + b = append(b, + byte(v&0x7f|0x80), + byte((v>>7)&0x7f|0x80), + byte((v>>14)&0x7f|0x80), + byte((v>>21)&0x7f|0x80), + byte((v>>28)&0x7f|0x80), + byte((v>>35)&0x7f|0x80), + byte((v>>42)&0x7f|0x80), + byte((v>>49)&0x7f|0x80), + byte((v>>56)&0x7f|0x80), + 1) + } + return b +} + +func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, *p) + return b, nil +} +func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + } + return b, nil +} +func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, v) + } + return b, nil +} +func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + return b, nil +} +func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + return b, nil +} +func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(*p)) + return b, nil +} +func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, uint32(v)) + } + return b, nil +} +func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, uint32(v)) + } + return b, nil +} +func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float32bits(*ptr.toFloat32()) + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float32bits(*ptr.toFloat32()) + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, v) + return b, nil +} +func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toFloat32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed32(b, math.Float32bits(*p)) + return b, nil +} +func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed32(b, math.Float32bits(v)) + } + return b, nil +} +func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(4*len(s))) + for _, v := range s { + b = appendFixed32(b, math.Float32bits(v)) + } + return b, nil +} +func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, *p) + return b, nil +} +func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + } + return b, nil +} +func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, v) + } + return b, nil +} +func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + return b, nil +} +func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + return b, nil +} +func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(*p)) + return b, nil +} +func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, uint64(v)) + } + return b, nil +} +func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, uint64(v)) + } + return b, nil +} +func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float64bits(*ptr.toFloat64()) + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := math.Float64bits(*ptr.toFloat64()) + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, v) + return b, nil +} +func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toFloat64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendFixed64(b, math.Float64bits(*p)) + return b, nil +} +func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendFixed64(b, math.Float64bits(v)) + } + return b, nil +} +func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toFloat64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(8*len(s))) + for _, v := range s { + b = appendFixed64(b, math.Float64bits(v)) + } + return b, nil +} +func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + return b, nil +} +func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toUint64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + return b, nil +} +func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toUint64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, *p) + return b, nil +} +func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, v) + } + return b, nil +} +func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toUint64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(v) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, v) + } + return b, nil +} +func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + return b, nil +} +func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(*p)) + return b, nil +} +func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v)) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v)) + } + return b, nil +} +func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt32() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := ptr.getInt32Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + v := *p + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + return b, nil +} +func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + } + return b, nil +} +func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := ptr.getInt32Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + } + return b, nil +} +func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toInt64() + if v == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toInt64Ptr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + v := *p + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + return b, nil +} +func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + } + return b, nil +} +func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toInt64Slice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + // compute size + n := 0 + for _, v := range s { + n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) + } + b = appendVarint(b, uint64(n)) + for _, v := range s { + b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) + } + return b, nil +} +func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBool() + b = appendVarint(b, wiretag) + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + return b, nil +} +func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBool() + if !v { + return b, nil + } + b = appendVarint(b, wiretag) + b = append(b, 1) + return b, nil +} + +func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toBoolPtr() + if p == nil { + return b, nil + } + b = appendVarint(b, wiretag) + if *p { + b = append(b, 1) + } else { + b = append(b, 0) + } + return b, nil +} +func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBoolSlice() + for _, v := range s { + b = appendVarint(b, wiretag) + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + } + return b, nil +} +func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBoolSlice() + if len(s) == 0 { + return b, nil + } + b = appendVarint(b, wiretag&^7|WireBytes) + b = appendVarint(b, uint64(len(s))) + for _, v := range s { + if v { + b = append(b, 1) + } else { + b = append(b, 0) + } + } + return b, nil +} +func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toString() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toString() + if v == "" { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + p := *ptr.toStringPtr() + if p == nil { + return b, nil + } + v := *p + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toStringSlice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + } + return b, nil +} +func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + var invalidUTF8 bool + v := *ptr.toString() + if !utf8.ValidString(v) { + invalidUTF8 = true + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + if invalidUTF8 { + return b, errInvalidUTF8 + } + return b, nil +} +func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + var invalidUTF8 bool + v := *ptr.toString() + if v == "" { + return b, nil + } + if !utf8.ValidString(v) { + invalidUTF8 = true + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + if invalidUTF8 { + return b, errInvalidUTF8 + } + return b, nil +} +func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + var invalidUTF8 bool + p := *ptr.toStringPtr() + if p == nil { + return b, nil + } + v := *p + if !utf8.ValidString(v) { + invalidUTF8 = true + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + if invalidUTF8 { + return b, errInvalidUTF8 + } + return b, nil +} +func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + var invalidUTF8 bool + s := *ptr.toStringSlice() + for _, v := range s { + if !utf8.ValidString(v) { + invalidUTF8 = true + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + } + if invalidUTF8 { + return b, errInvalidUTF8 + } + return b, nil +} +func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + if v == nil { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + if len(v) == 0 { + return b, nil + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + v := *ptr.toBytes() + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + return b, nil +} +func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { + s := *ptr.toBytesSlice() + for _, v := range s { + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(v))) + b = append(b, v...) + } + return b, nil +} + +// makeGroupMarshaler returns the sizer and marshaler for a group. +// u is the marshal info of the underlying message. +func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + p := ptr.getPointer() + if p.isNil() { + return 0 + } + return u.size(p) + 2*tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + p := ptr.getPointer() + if p.isNil() { + return b, nil + } + var err error + b = appendVarint(b, wiretag) // start group + b, err = u.marshal(b, p, deterministic) + b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group + return b, err + } +} + +// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. +// u is the marshal info of the underlying message. +func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getPointerSlice() + n := 0 + for _, v := range s { + if v.isNil() { + continue + } + n += u.size(v) + 2*tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getPointerSlice() + var err error + var nerr nonFatal + for _, v := range s { + if v.isNil() { + return b, errRepeatedHasNil + } + b = appendVarint(b, wiretag) // start group + b, err = u.marshal(b, v, deterministic) + b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group + if !nerr.Merge(err) { + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + return b, nerr.E + } +} + +// makeMessageMarshaler returns the sizer and marshaler for a message field. +// u is the marshal info of the message. +func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + p := ptr.getPointer() + if p.isNil() { + return 0 + } + siz := u.size(p) + return siz + SizeVarint(uint64(siz)) + tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + p := ptr.getPointer() + if p.isNil() { + return b, nil + } + b = appendVarint(b, wiretag) + siz := u.cachedsize(p) + b = appendVarint(b, uint64(siz)) + return u.marshal(b, p, deterministic) + } +} + +// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. +// u is the marshal info of the message. +func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getPointerSlice() + n := 0 + for _, v := range s { + if v.isNil() { + continue + } + siz := u.size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getPointerSlice() + var err error + var nerr nonFatal + for _, v := range s { + if v.isNil() { + return b, errRepeatedHasNil + } + b = appendVarint(b, wiretag) + siz := u.cachedsize(v) + b = appendVarint(b, uint64(siz)) + b, err = u.marshal(b, v, deterministic) + + if !nerr.Merge(err) { + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + return b, nerr.E + } +} + +// makeMapMarshaler returns the sizer and marshaler for a map field. +// f is the pointer to the reflect data structure of the field. +func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { + // figure out key and value type + t := f.Type + keyType := t.Key() + valType := t.Elem() + tags := strings.Split(f.Tag.Get("protobuf"), ",") + keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") + valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") + stdOptions := false + for _, t := range tags { + if strings.HasPrefix(t, "customtype=") { + valTags = append(valTags, t) + } + if t == "stdtime" { + valTags = append(valTags, t) + stdOptions = true + } + if t == "stdduration" { + valTags = append(valTags, t) + stdOptions = true + } + if t == "wktptr" { + valTags = append(valTags, t) + } + } + keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map + valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map + keyWireTag := 1<<3 | wiretype(keyTags[0]) + valWireTag := 2<<3 | wiretype(valTags[0]) + + // We create an interface to get the addresses of the map key and value. + // If value is pointer-typed, the interface is a direct interface, the + // idata itself is the value. Otherwise, the idata is the pointer to the + // value. + // Key cannot be pointer-typed. + valIsPtr := valType.Kind() == reflect.Ptr + + // If value is a message with nested maps, calling + // valSizer in marshal may be quadratic. We should use + // cached version in marshal (but not in size). + // If value is not message type, we don't have size cache, + // but it cannot be nested either. Just use valSizer. + valCachedSizer := valSizer + if valIsPtr && !stdOptions && valType.Elem().Kind() == reflect.Struct { + u := getMarshalInfo(valType.Elem()) + valCachedSizer = func(ptr pointer, tagsize int) int { + // Same as message sizer, but use cache. + p := ptr.getPointer() + if p.isNil() { + return 0 + } + siz := u.cachedsize(p) + return siz + SizeVarint(uint64(siz)) + tagsize + } + } + return func(ptr pointer, tagsize int) int { + m := ptr.asPointerTo(t).Elem() // the map + n := 0 + for _, k := range m.MapKeys() { + ki := k.Interface() + vi := m.MapIndex(k).Interface() + kaddr := toAddrPointer(&ki, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { + m := ptr.asPointerTo(t).Elem() // the map + var err error + keys := m.MapKeys() + if len(keys) > 1 && deterministic { + sort.Sort(mapKeys(keys)) + } + + var nerr nonFatal + for _, k := range keys { + ki := k.Interface() + vi := m.MapIndex(k).Interface() + kaddr := toAddrPointer(&ki, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + b = appendVarint(b, tag) + siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) + b = appendVarint(b, uint64(siz)) + b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) + if !nerr.Merge(err) { + return b, err + } + b, err = valMarshaler(b, vaddr, valWireTag, deterministic) + if err != ErrNil && !nerr.Merge(err) { // allow nil value in map + return b, err + } + } + return b, nerr.E + } +} + +// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. +// fi is the marshal info of the field. +// f is the pointer to the reflect data structure of the field. +func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { + // Oneof field is an interface. We need to get the actual data type on the fly. + t := f.Type + return func(ptr pointer, _ int) int { + p := ptr.getInterfacePointer() + if p.isNil() { + return 0 + } + v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct + telem := v.Type() + e := fi.oneofElems[telem] + return e.sizer(p, e.tagsize) + }, + func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { + p := ptr.getInterfacePointer() + if p.isNil() { + return b, nil + } + v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct + telem := v.Type() + if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { + return b, errOneofHasNil + } + e := fi.oneofElems[telem] + return e.marshaler(b, p, e.wiretag, deterministic) + } +} + +// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. +func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { + m, mu := ext.extensionsRead() + if m == nil { + return 0 + } + mu.Lock() + + n := 0 + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + n += len(e.enc) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, ei.tagsize) + } + mu.Unlock() + return n +} + +// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. +func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { + m, mu := ext.extensionsRead() + if m == nil { + return b, nil + } + mu.Lock() + defer mu.Unlock() + + var err error + var nerr nonFatal + + // Fast-path for common cases: zero or one extensions. + // Don't bother sorting the keys. + if len(m) <= 1 { + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if !nerr.Merge(err) { + return b, err + } + } + return b, nerr.E + } + + // Sort the keys to provide a deterministic encoding. + // Not sure this is required, but the old code does it. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + for _, k := range keys { + e := m[int32(k)] + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if !nerr.Merge(err) { + return b, err + } + } + return b, nerr.E +} + +// message set format is: +// message MessageSet { +// repeated group Item = 1 { +// required int32 type_id = 2; +// required string message = 3; +// }; +// } + +// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field +// in message set format (above). +func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { + m, mu := ext.extensionsRead() + if m == nil { + return 0 + } + mu.Lock() + + n := 0 + for id, e := range m { + n += 2 // start group, end group. tag = 1 (size=1) + n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + siz := len(msgWithLen) + n += siz + 1 // message, tag = 3 (size=1) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, 1) // message, tag = 3 (size=1) + } + mu.Unlock() + return n +} + +// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) +// to the end of byte slice b. +func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { + m, mu := ext.extensionsRead() + if m == nil { + return b, nil + } + mu.Lock() + defer mu.Unlock() + + var err error + var nerr nonFatal + + // Fast-path for common cases: zero or one extensions. + // Don't bother sorting the keys. + if len(m) <= 1 { + for id, e := range m { + b = append(b, 1<<3|WireStartGroup) + b = append(b, 2<<3|WireVarint) + b = appendVarint(b, uint64(id)) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + b = append(b, 3<<3|WireBytes) + b = append(b, msgWithLen...) + b = append(b, 1<<3|WireEndGroup) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) + if !nerr.Merge(err) { + return b, err + } + b = append(b, 1<<3|WireEndGroup) + } + return b, nerr.E + } + + // Sort the keys to provide a deterministic encoding. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + for _, id := range keys { + e := m[int32(id)] + b = append(b, 1<<3|WireStartGroup) + b = append(b, 2<<3|WireVarint) + b = appendVarint(b, uint64(id)) + + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint + b = append(b, 3<<3|WireBytes) + b = append(b, msgWithLen...) + b = append(b, 1<<3|WireEndGroup) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) + b = append(b, 1<<3|WireEndGroup) + if !nerr.Merge(err) { + return b, err + } + } + return b, nerr.E +} + +// sizeV1Extensions computes the size of encoded data for a V1-API extension field. +func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { + if m == nil { + return 0 + } + + n := 0 + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + n += len(e.enc) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + n += ei.sizer(p, ei.tagsize) + } + return n +} + +// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. +func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { + if m == nil { + return b, nil + } + + // Sort the keys to provide a deterministic encoding. + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + var err error + var nerr nonFatal + for _, k := range keys { + e := m[int32(k)] + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + b = append(b, e.enc...) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + ei := u.getExtElemInfo(e.desc) + v := e.value + p := toAddrPointer(&v, ei.isptr) + b, err = ei.marshaler(b, p, ei.wiretag, deterministic) + if !nerr.Merge(err) { + return b, err + } + } + return b, nerr.E +} + +// newMarshaler is the interface representing objects that can marshal themselves. +// +// This exists to support protoc-gen-go generated messages. +// The proto package will stop type-asserting to this interface in the future. +// +// DO NOT DEPEND ON THIS. +type newMarshaler interface { + XXX_Size() int + XXX_Marshal(b []byte, deterministic bool) ([]byte, error) +} + +// Size returns the encoded size of a protocol buffer message. +// This is the main entry point. +func Size(pb Message) int { + if m, ok := pb.(newMarshaler); ok { + return m.XXX_Size() + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + b, _ := m.Marshal() + return len(b) + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return 0 + } + var info InternalMessageInfo + return info.Size(pb) +} + +// Marshal takes a protocol buffer message +// and encodes it into the wire format, returning the data. +// This is the main entry point. +func Marshal(pb Message) ([]byte, error) { + if m, ok := pb.(newMarshaler); ok { + siz := m.XXX_Size() + b := make([]byte, 0, siz) + return m.XXX_Marshal(b, false) + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + return m.Marshal() + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return nil, ErrNil + } + var info InternalMessageInfo + siz := info.Size(pb) + b := make([]byte, 0, siz) + return info.Marshal(b, pb, false) +} + +// Marshal takes a protocol buffer message +// and encodes it into the wire format, writing the result to the +// Buffer. +// This is an alternative entry point. It is not necessary to use +// a Buffer for most applications. +func (p *Buffer) Marshal(pb Message) error { + var err error + if p.deterministic { + if _, ok := pb.(Marshaler); ok { + return fmt.Errorf("proto: deterministic not supported by the Marshal method of %T", pb) + } + } + if m, ok := pb.(newMarshaler); ok { + siz := m.XXX_Size() + p.grow(siz) // make sure buf has enough capacity + pp := p.buf[len(p.buf) : len(p.buf) : len(p.buf)+siz] + pp, err = m.XXX_Marshal(pp, p.deterministic) + p.buf = append(p.buf, pp...) + return err + } + if m, ok := pb.(Marshaler); ok { + // If the message can marshal itself, let it do it, for compatibility. + // NOTE: This is not efficient. + var b []byte + b, err = m.Marshal() + p.buf = append(p.buf, b...) + return err + } + // in case somehow we didn't generate the wrapper + if pb == nil { + return ErrNil + } + var info InternalMessageInfo + siz := info.Size(pb) + p.grow(siz) // make sure buf has enough capacity + p.buf, err = info.Marshal(p.buf, pb, p.deterministic) + return err +} + +// grow grows the buffer's capacity, if necessary, to guarantee space for +// another n bytes. After grow(n), at least n bytes can be written to the +// buffer without another allocation. +func (p *Buffer) grow(n int) { + need := len(p.buf) + n + if need <= cap(p.buf) { + return + } + newCap := len(p.buf) * 2 + if newCap < need { + newCap = need + } + p.buf = append(make([]byte, 0, newCap), p.buf...) +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go new file mode 100644 index 000000000..997f57c1e --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go @@ -0,0 +1,388 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "reflect" + "time" +) + +// makeMessageRefMarshaler differs a bit from makeMessageMarshaler +// It marshal a message T instead of a *T +func makeMessageRefMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + siz := u.size(ptr) + return siz + SizeVarint(uint64(siz)) + tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + b = appendVarint(b, wiretag) + siz := u.cachedsize(ptr) + b = appendVarint(b, uint64(siz)) + return u.marshal(b, ptr, deterministic) + } +} + +// makeMessageRefSliceMarshaler differs quite a lot from makeMessageSliceMarshaler +// It marshals a slice of messages []T instead of []*T +func makeMessageRefSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + e := elem.Interface() + v := toAddrPointer(&e, false) + siz := u.size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + var err, errreq error + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + e := elem.Interface() + v := toAddrPointer(&e, false) + b = appendVarint(b, wiretag) + siz := u.size(v) + b = appendVarint(b, uint64(siz)) + b, err = u.marshal(b, v, deterministic) + + if err != nil { + if _, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = err + } + continue + } + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + + return b, errreq + } +} + +func makeCustomPtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) + siz := m.Size() + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) + siz := m.Size() + buf, err := m.Marshal() + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + return b, nil + } +} + +func makeCustomMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + m := ptr.asPointerTo(u.typ).Interface().(custom) + siz := m.Size() + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + m := ptr.asPointerTo(u.typ).Interface().(custom) + siz := m.Size() + buf, err := m.Marshal() + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + return b, nil + } +} + +func makeTimeMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeTimePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeTimeSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(time.Time) + ts, err := timestampProto(t) + if err != nil { + return 0 + } + siz := Size(ts) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(time.Time) + ts, err := timestampProto(t) + if err != nil { + return nil, err + } + siz := Size(ts) + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeTimePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + siz := Size(ts) + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeDurationMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) + dur := durationProto(*d) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeDurationPtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) + dur := durationProto(*d) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeDurationSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(time.Duration) + dur := durationProto(d) + siz := Size(dur) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(time.Duration) + dur := durationProto(d) + siz := Size(dur) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeDurationPtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/table_merge.go b/integration-test/vendor/github.com/gogo/protobuf/proto/table_merge.go new file mode 100644 index 000000000..60dcf70d1 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/table_merge.go @@ -0,0 +1,676 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" + "strings" + "sync" + "sync/atomic" +) + +// Merge merges the src message into dst. +// This assumes that dst and src of the same type and are non-nil. +func (a *InternalMessageInfo) Merge(dst, src Message) { + mi := atomicLoadMergeInfo(&a.merge) + if mi == nil { + mi = getMergeInfo(reflect.TypeOf(dst).Elem()) + atomicStoreMergeInfo(&a.merge, mi) + } + mi.merge(toPointer(&dst), toPointer(&src)) +} + +type mergeInfo struct { + typ reflect.Type + + initialized int32 // 0: only typ is valid, 1: everything is valid + lock sync.Mutex + + fields []mergeFieldInfo + unrecognized field // Offset of XXX_unrecognized +} + +type mergeFieldInfo struct { + field field // Offset of field, guaranteed to be valid + + // isPointer reports whether the value in the field is a pointer. + // This is true for the following situations: + // * Pointer to struct + // * Pointer to basic type (proto2 only) + // * Slice (first value in slice header is a pointer) + // * String (first value in string header is a pointer) + isPointer bool + + // basicWidth reports the width of the field assuming that it is directly + // embedded in the struct (as is the case for basic types in proto3). + // The possible values are: + // 0: invalid + // 1: bool + // 4: int32, uint32, float32 + // 8: int64, uint64, float64 + basicWidth int + + // Where dst and src are pointers to the types being merged. + merge func(dst, src pointer) +} + +var ( + mergeInfoMap = map[reflect.Type]*mergeInfo{} + mergeInfoLock sync.Mutex +) + +func getMergeInfo(t reflect.Type) *mergeInfo { + mergeInfoLock.Lock() + defer mergeInfoLock.Unlock() + mi := mergeInfoMap[t] + if mi == nil { + mi = &mergeInfo{typ: t} + mergeInfoMap[t] = mi + } + return mi +} + +// merge merges src into dst assuming they are both of type *mi.typ. +func (mi *mergeInfo) merge(dst, src pointer) { + if dst.isNil() { + panic("proto: nil destination") + } + if src.isNil() { + return // Nothing to do. + } + + if atomic.LoadInt32(&mi.initialized) == 0 { + mi.computeMergeInfo() + } + + for _, fi := range mi.fields { + sfp := src.offset(fi.field) + + // As an optimization, we can avoid the merge function call cost + // if we know for sure that the source will have no effect + // by checking if it is the zero value. + if unsafeAllowed { + if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string + continue + } + if fi.basicWidth > 0 { + switch { + case fi.basicWidth == 1 && !*sfp.toBool(): + continue + case fi.basicWidth == 4 && *sfp.toUint32() == 0: + continue + case fi.basicWidth == 8 && *sfp.toUint64() == 0: + continue + } + } + } + + dfp := dst.offset(fi.field) + fi.merge(dfp, sfp) + } + + // TODO: Make this faster? + out := dst.asPointerTo(mi.typ).Elem() + in := src.asPointerTo(mi.typ).Elem() + if emIn, err := extendable(in.Addr().Interface()); err == nil { + emOut, _ := extendable(out.Addr().Interface()) + mIn, muIn := emIn.extensionsRead() + if mIn != nil { + mOut := emOut.extensionsWrite() + muIn.Lock() + mergeExtension(mOut, mIn) + muIn.Unlock() + } + } + + if mi.unrecognized.IsValid() { + if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { + *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) + } + } +} + +func (mi *mergeInfo) computeMergeInfo() { + mi.lock.Lock() + defer mi.lock.Unlock() + if mi.initialized != 0 { + return + } + t := mi.typ + n := t.NumField() + + props := GetProperties(t) + for i := 0; i < n; i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + + mfi := mergeFieldInfo{field: toField(&f)} + tf := f.Type + + // As an optimization, we can avoid the merge function call cost + // if we know for sure that the source will have no effect + // by checking if it is the zero value. + if unsafeAllowed { + switch tf.Kind() { + case reflect.Ptr, reflect.Slice, reflect.String: + // As a special case, we assume slices and strings are pointers + // since we know that the first field in the SliceSlice or + // StringHeader is a data pointer. + mfi.isPointer = true + case reflect.Bool: + mfi.basicWidth = 1 + case reflect.Int32, reflect.Uint32, reflect.Float32: + mfi.basicWidth = 4 + case reflect.Int64, reflect.Uint64, reflect.Float64: + mfi.basicWidth = 8 + } + } + + // Unwrap tf to get at its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic("both pointer and slice for basic type in " + tf.Name()) + } + + switch tf.Kind() { + case reflect.Int32: + switch { + case isSlice: // E.g., []int32 + mfi.merge = func(dst, src pointer) { + // NOTE: toInt32Slice is not defined (see pointer_reflect.go). + /* + sfsp := src.toInt32Slice() + if *sfsp != nil { + dfsp := dst.toInt32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []int64{} + } + } + */ + sfs := src.getInt32Slice() + if sfs != nil { + dfs := dst.getInt32Slice() + dfs = append(dfs, sfs...) + if dfs == nil { + dfs = []int32{} + } + dst.setInt32Slice(dfs) + } + } + case isPointer: // E.g., *int32 + mfi.merge = func(dst, src pointer) { + // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). + /* + sfpp := src.toInt32Ptr() + if *sfpp != nil { + dfpp := dst.toInt32Ptr() + if *dfpp == nil { + *dfpp = Int32(**sfpp) + } else { + **dfpp = **sfpp + } + } + */ + sfp := src.getInt32Ptr() + if sfp != nil { + dfp := dst.getInt32Ptr() + if dfp == nil { + dst.setInt32Ptr(*sfp) + } else { + *dfp = *sfp + } + } + } + default: // E.g., int32 + mfi.merge = func(dst, src pointer) { + if v := *src.toInt32(); v != 0 { + *dst.toInt32() = v + } + } + } + case reflect.Int64: + switch { + case isSlice: // E.g., []int64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toInt64Slice() + if *sfsp != nil { + dfsp := dst.toInt64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []int64{} + } + } + } + case isPointer: // E.g., *int64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toInt64Ptr() + if *sfpp != nil { + dfpp := dst.toInt64Ptr() + if *dfpp == nil { + *dfpp = Int64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., int64 + mfi.merge = func(dst, src pointer) { + if v := *src.toInt64(); v != 0 { + *dst.toInt64() = v + } + } + } + case reflect.Uint32: + switch { + case isSlice: // E.g., []uint32 + mfi.merge = func(dst, src pointer) { + sfsp := src.toUint32Slice() + if *sfsp != nil { + dfsp := dst.toUint32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []uint32{} + } + } + } + case isPointer: // E.g., *uint32 + mfi.merge = func(dst, src pointer) { + sfpp := src.toUint32Ptr() + if *sfpp != nil { + dfpp := dst.toUint32Ptr() + if *dfpp == nil { + *dfpp = Uint32(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., uint32 + mfi.merge = func(dst, src pointer) { + if v := *src.toUint32(); v != 0 { + *dst.toUint32() = v + } + } + } + case reflect.Uint64: + switch { + case isSlice: // E.g., []uint64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toUint64Slice() + if *sfsp != nil { + dfsp := dst.toUint64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []uint64{} + } + } + } + case isPointer: // E.g., *uint64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toUint64Ptr() + if *sfpp != nil { + dfpp := dst.toUint64Ptr() + if *dfpp == nil { + *dfpp = Uint64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., uint64 + mfi.merge = func(dst, src pointer) { + if v := *src.toUint64(); v != 0 { + *dst.toUint64() = v + } + } + } + case reflect.Float32: + switch { + case isSlice: // E.g., []float32 + mfi.merge = func(dst, src pointer) { + sfsp := src.toFloat32Slice() + if *sfsp != nil { + dfsp := dst.toFloat32Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []float32{} + } + } + } + case isPointer: // E.g., *float32 + mfi.merge = func(dst, src pointer) { + sfpp := src.toFloat32Ptr() + if *sfpp != nil { + dfpp := dst.toFloat32Ptr() + if *dfpp == nil { + *dfpp = Float32(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., float32 + mfi.merge = func(dst, src pointer) { + if v := *src.toFloat32(); v != 0 { + *dst.toFloat32() = v + } + } + } + case reflect.Float64: + switch { + case isSlice: // E.g., []float64 + mfi.merge = func(dst, src pointer) { + sfsp := src.toFloat64Slice() + if *sfsp != nil { + dfsp := dst.toFloat64Slice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []float64{} + } + } + } + case isPointer: // E.g., *float64 + mfi.merge = func(dst, src pointer) { + sfpp := src.toFloat64Ptr() + if *sfpp != nil { + dfpp := dst.toFloat64Ptr() + if *dfpp == nil { + *dfpp = Float64(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., float64 + mfi.merge = func(dst, src pointer) { + if v := *src.toFloat64(); v != 0 { + *dst.toFloat64() = v + } + } + } + case reflect.Bool: + switch { + case isSlice: // E.g., []bool + mfi.merge = func(dst, src pointer) { + sfsp := src.toBoolSlice() + if *sfsp != nil { + dfsp := dst.toBoolSlice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []bool{} + } + } + } + case isPointer: // E.g., *bool + mfi.merge = func(dst, src pointer) { + sfpp := src.toBoolPtr() + if *sfpp != nil { + dfpp := dst.toBoolPtr() + if *dfpp == nil { + *dfpp = Bool(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., bool + mfi.merge = func(dst, src pointer) { + if v := *src.toBool(); v { + *dst.toBool() = v + } + } + } + case reflect.String: + switch { + case isSlice: // E.g., []string + mfi.merge = func(dst, src pointer) { + sfsp := src.toStringSlice() + if *sfsp != nil { + dfsp := dst.toStringSlice() + *dfsp = append(*dfsp, *sfsp...) + if *dfsp == nil { + *dfsp = []string{} + } + } + } + case isPointer: // E.g., *string + mfi.merge = func(dst, src pointer) { + sfpp := src.toStringPtr() + if *sfpp != nil { + dfpp := dst.toStringPtr() + if *dfpp == nil { + *dfpp = String(**sfpp) + } else { + **dfpp = **sfpp + } + } + } + default: // E.g., string + mfi.merge = func(dst, src pointer) { + if v := *src.toString(); v != "" { + *dst.toString() = v + } + } + } + case reflect.Slice: + isProto3 := props.Prop[i].proto3 + switch { + case isPointer: + panic("bad pointer in byte slice case in " + tf.Name()) + case tf.Elem().Kind() != reflect.Uint8: + panic("bad element kind in byte slice case in " + tf.Name()) + case isSlice: // E.g., [][]byte + mfi.merge = func(dst, src pointer) { + sbsp := src.toBytesSlice() + if *sbsp != nil { + dbsp := dst.toBytesSlice() + for _, sb := range *sbsp { + if sb == nil { + *dbsp = append(*dbsp, nil) + } else { + *dbsp = append(*dbsp, append([]byte{}, sb...)) + } + } + if *dbsp == nil { + *dbsp = [][]byte{} + } + } + } + default: // E.g., []byte + mfi.merge = func(dst, src pointer) { + sbp := src.toBytes() + if *sbp != nil { + dbp := dst.toBytes() + if !isProto3 || len(*sbp) > 0 { + *dbp = append([]byte{}, *sbp...) + } + } + } + } + case reflect.Struct: + switch { + case isSlice && !isPointer: // E.g. []pb.T + mergeInfo := getMergeInfo(tf) + zero := reflect.Zero(tf) + mfi.merge = func(dst, src pointer) { + // TODO: Make this faster? + dstsp := dst.asPointerTo(f.Type) + dsts := dstsp.Elem() + srcs := src.asPointerTo(f.Type).Elem() + for i := 0; i < srcs.Len(); i++ { + dsts = reflect.Append(dsts, zero) + srcElement := srcs.Index(i).Addr() + dstElement := dsts.Index(dsts.Len() - 1).Addr() + mergeInfo.merge(valToPointer(dstElement), valToPointer(srcElement)) + } + if dsts.IsNil() { + dsts = reflect.MakeSlice(f.Type, 0, 0) + } + dstsp.Elem().Set(dsts) + } + case !isPointer: + mergeInfo := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + mergeInfo.merge(dst, src) + } + case isSlice: // E.g., []*pb.T + mergeInfo := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + sps := src.getPointerSlice() + if sps != nil { + dps := dst.getPointerSlice() + for _, sp := range sps { + var dp pointer + if !sp.isNil() { + dp = valToPointer(reflect.New(tf)) + mergeInfo.merge(dp, sp) + } + dps = append(dps, dp) + } + if dps == nil { + dps = []pointer{} + } + dst.setPointerSlice(dps) + } + } + default: // E.g., *pb.T + mergeInfo := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + sp := src.getPointer() + if !sp.isNil() { + dp := dst.getPointer() + if dp.isNil() { + dp = valToPointer(reflect.New(tf)) + dst.setPointer(dp) + } + mergeInfo.merge(dp, sp) + } + } + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic("bad pointer or slice in map case in " + tf.Name()) + default: // E.g., map[K]V + mfi.merge = func(dst, src pointer) { + sm := src.asPointerTo(tf).Elem() + if sm.Len() == 0 { + return + } + dm := dst.asPointerTo(tf).Elem() + if dm.IsNil() { + dm.Set(reflect.MakeMap(tf)) + } + + switch tf.Elem().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + val = reflect.ValueOf(Clone(val.Interface().(Message))) + dm.SetMapIndex(key, val) + } + case reflect.Slice: // E.g. Bytes type (e.g., []byte) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) + dm.SetMapIndex(key, val) + } + default: // Basic type (e.g., string) + for _, key := range sm.MapKeys() { + val := sm.MapIndex(key) + dm.SetMapIndex(key, val) + } + } + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic("bad pointer or slice in interface case in " + tf.Name()) + default: // E.g., interface{} + // TODO: Make this faster? + mfi.merge = func(dst, src pointer) { + su := src.asPointerTo(tf).Elem() + if !su.IsNil() { + du := dst.asPointerTo(tf).Elem() + typ := su.Elem().Type() + if du.IsNil() || du.Elem().Type() != typ { + du.Set(reflect.New(typ.Elem())) // Initialize interface if empty + } + sv := su.Elem().Elem().Field(0) + if sv.Kind() == reflect.Ptr && sv.IsNil() { + return + } + dv := du.Elem().Elem().Field(0) + if dv.Kind() == reflect.Ptr && dv.IsNil() { + dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty + } + switch sv.Type().Kind() { + case reflect.Ptr: // Proto struct (e.g., *T) + Merge(dv.Interface().(Message), sv.Interface().(Message)) + case reflect.Slice: // E.g. Bytes type (e.g., []byte) + dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) + default: // Basic type (e.g., string) + dv.Set(sv) + } + } + } + } + default: + panic(fmt.Sprintf("merger not found for type:%s", tf)) + } + mi.fields = append(mi.fields, mfi) + } + + mi.unrecognized = invalidField + if f, ok := t.FieldByName("XXX_unrecognized"); ok { + if f.Type != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + mi.unrecognized = toField(&f) + } + + atomic.StoreInt32(&mi.initialized, 1) +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go b/integration-test/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go new file mode 100644 index 000000000..937229386 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go @@ -0,0 +1,2249 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "errors" + "fmt" + "io" + "math" + "reflect" + "strconv" + "strings" + "sync" + "sync/atomic" + "unicode/utf8" +) + +// Unmarshal is the entry point from the generated .pb.go files. +// This function is not intended to be used by non-generated code. +// This function is not subject to any compatibility guarantee. +// msg contains a pointer to a protocol buffer struct. +// b is the data to be unmarshaled into the protocol buffer. +// a is a pointer to a place to store cached unmarshal information. +func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { + // Load the unmarshal information for this message type. + // The atomic load ensures memory consistency. + u := atomicLoadUnmarshalInfo(&a.unmarshal) + if u == nil { + // Slow path: find unmarshal info for msg, update a with it. + u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) + atomicStoreUnmarshalInfo(&a.unmarshal, u) + } + // Then do the unmarshaling. + err := u.unmarshal(toPointer(&msg), b) + return err +} + +type unmarshalInfo struct { + typ reflect.Type // type of the protobuf struct + + // 0 = only typ field is initialized + // 1 = completely initialized + initialized int32 + lock sync.Mutex // prevents double initialization + dense []unmarshalFieldInfo // fields indexed by tag # + sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # + reqFields []string // names of required fields + reqMask uint64 // 1< 0 { + // Read tag and wire type. + // Special case 1 and 2 byte varints. + var x uint64 + if b[0] < 128 { + x = uint64(b[0]) + b = b[1:] + } else if len(b) >= 2 && b[1] < 128 { + x = uint64(b[0]&0x7f) + uint64(b[1])<<7 + b = b[2:] + } else { + var n int + x, n = decodeVarint(b) + if n == 0 { + return io.ErrUnexpectedEOF + } + b = b[n:] + } + tag := x >> 3 + wire := int(x) & 7 + + // Dispatch on the tag to one of the unmarshal* functions below. + var f unmarshalFieldInfo + if tag < uint64(len(u.dense)) { + f = u.dense[tag] + } else { + f = u.sparse[tag] + } + if fn := f.unmarshal; fn != nil { + var err error + b, err = fn(b, m.offset(f.field), wire) + if err == nil { + reqMask |= f.reqMask + continue + } + if r, ok := err.(*RequiredNotSetError); ok { + // Remember this error, but keep parsing. We need to produce + // a full parse even if a required field is missing. + if errLater == nil { + errLater = r + } + reqMask |= f.reqMask + continue + } + if err != errInternalBadWireType { + if err == errInvalidUTF8 { + if errLater == nil { + fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name + errLater = &invalidUTF8Error{fullName} + } + continue + } + return err + } + // Fragments with bad wire type are treated as unknown fields. + } + + // Unknown tag. + if !u.unrecognized.IsValid() { + // Don't keep unrecognized data; just skip it. + var err error + b, err = skipField(b, wire) + if err != nil { + return err + } + continue + } + // Keep unrecognized data around. + // maybe in extensions, maybe in the unrecognized field. + z := m.offset(u.unrecognized).toBytes() + var emap map[int32]Extension + var e Extension + for _, r := range u.extensionRanges { + if uint64(r.Start) <= tag && tag <= uint64(r.End) { + if u.extensions.IsValid() { + mp := m.offset(u.extensions).toExtensions() + emap = mp.extensionsWrite() + e = emap[int32(tag)] + z = &e.enc + break + } + if u.oldExtensions.IsValid() { + p := m.offset(u.oldExtensions).toOldExtensions() + emap = *p + if emap == nil { + emap = map[int32]Extension{} + *p = emap + } + e = emap[int32(tag)] + z = &e.enc + break + } + if u.bytesExtensions.IsValid() { + z = m.offset(u.bytesExtensions).toBytes() + break + } + panic("no extensions field available") + } + } + // Use wire type to skip data. + var err error + b0 := b + b, err = skipField(b, wire) + if err != nil { + return err + } + *z = encodeVarint(*z, tag<<3|uint64(wire)) + *z = append(*z, b0[:len(b0)-len(b)]...) + + if emap != nil { + emap[int32(tag)] = e + } + } + if reqMask != u.reqMask && errLater == nil { + // A required field of this message is missing. + for _, n := range u.reqFields { + if reqMask&1 == 0 { + errLater = &RequiredNotSetError{n} + } + reqMask >>= 1 + } + } + return errLater +} + +// computeUnmarshalInfo fills in u with information for use +// in unmarshaling protocol buffers of type u.typ. +func (u *unmarshalInfo) computeUnmarshalInfo() { + u.lock.Lock() + defer u.lock.Unlock() + if u.initialized != 0 { + return + } + t := u.typ + n := t.NumField() + + // Set up the "not found" value for the unrecognized byte buffer. + // This is the default for proto3. + u.unrecognized = invalidField + u.extensions = invalidField + u.oldExtensions = invalidField + u.bytesExtensions = invalidField + + // List of the generated type and offset for each oneof field. + type oneofField struct { + ityp reflect.Type // interface type of oneof field + field field // offset in containing message + } + var oneofFields []oneofField + + for i := 0; i < n; i++ { + f := t.Field(i) + if f.Name == "XXX_unrecognized" { + // The byte slice used to hold unrecognized input is special. + if f.Type != reflect.TypeOf(([]byte)(nil)) { + panic("bad type for XXX_unrecognized field: " + f.Type.Name()) + } + u.unrecognized = toField(&f) + continue + } + if f.Name == "XXX_InternalExtensions" { + // Ditto here. + if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { + panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) + } + u.extensions = toField(&f) + if f.Tag.Get("protobuf_messageset") == "1" { + u.isMessageSet = true + } + continue + } + if f.Name == "XXX_extensions" { + // An older form of the extensions field. + if f.Type == reflect.TypeOf((map[int32]Extension)(nil)) { + u.oldExtensions = toField(&f) + continue + } else if f.Type == reflect.TypeOf(([]byte)(nil)) { + u.bytesExtensions = toField(&f) + continue + } + panic("bad type for XXX_extensions field: " + f.Type.Name()) + } + if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { + continue + } + + oneof := f.Tag.Get("protobuf_oneof") + if oneof != "" { + oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) + // The rest of oneof processing happens below. + continue + } + + tags := f.Tag.Get("protobuf") + tagArray := strings.Split(tags, ",") + if len(tagArray) < 2 { + panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) + } + tag, err := strconv.Atoi(tagArray[1]) + if err != nil { + panic("protobuf tag field not an integer: " + tagArray[1]) + } + + name := "" + for _, tag := range tagArray[3:] { + if strings.HasPrefix(tag, "name=") { + name = tag[5:] + } + } + + // Extract unmarshaling function from the field (its type and tags). + unmarshal := fieldUnmarshaler(&f) + + // Required field? + var reqMask uint64 + if tagArray[2] == "req" { + bit := len(u.reqFields) + u.reqFields = append(u.reqFields, name) + reqMask = uint64(1) << uint(bit) + // TODO: if we have more than 64 required fields, we end up + // not verifying that all required fields are present. + // Fix this, perhaps using a count of required fields? + } + + // Store the info in the correct slot in the message. + u.setTag(tag, toField(&f), unmarshal, reqMask, name) + } + + // Find any types associated with oneof fields. + // gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler + if len(oneofFields) > 0 { + var oneofImplementers []interface{} + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oneofImplementers = m.XXX_OneofFuncs() + case oneofWrappersIface: + oneofImplementers = m.XXX_OneofWrappers() + } + for _, v := range oneofImplementers { + tptr := reflect.TypeOf(v) // *Msg_X + typ := tptr.Elem() // Msg_X + + f := typ.Field(0) // oneof implementers have one field + baseUnmarshal := fieldUnmarshaler(&f) + tags := strings.Split(f.Tag.Get("protobuf"), ",") + fieldNum, err := strconv.Atoi(tags[1]) + if err != nil { + panic("protobuf tag field not an integer: " + tags[1]) + } + var name string + for _, tag := range tags { + if strings.HasPrefix(tag, "name=") { + name = strings.TrimPrefix(tag, "name=") + break + } + } + + // Find the oneof field that this struct implements. + // Might take O(n^2) to process all of the oneofs, but who cares. + for _, of := range oneofFields { + if tptr.Implements(of.ityp) { + // We have found the corresponding interface for this struct. + // That lets us know where this struct should be stored + // when we encounter it during unmarshaling. + unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) + u.setTag(fieldNum, of.field, unmarshal, 0, name) + } + } + + } + } + + // Get extension ranges, if any. + fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") + if fn.IsValid() { + if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() { + panic("a message with extensions, but no extensions field in " + t.Name()) + } + u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) + } + + // Explicitly disallow tag 0. This will ensure we flag an error + // when decoding a buffer of all zeros. Without this code, we + // would decode and skip an all-zero buffer of even length. + // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. + u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { + return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) + }, 0, "") + + // Set mask for required field check. + u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? + for len(u.dense) <= tag { + u.dense = append(u.dense, unmarshalFieldInfo{}) + } + u.dense[tag] = i + return + } + if u.sparse == nil { + u.sparse = map[uint64]unmarshalFieldInfo{} + } + u.sparse[uint64(tag)] = i +} + +// fieldUnmarshaler returns an unmarshaler for the given field. +func fieldUnmarshaler(f *reflect.StructField) unmarshaler { + if f.Type.Kind() == reflect.Map { + return makeUnmarshalMap(f) + } + return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) +} + +// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. +func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { + tagArray := strings.Split(tags, ",") + encoding := tagArray[0] + name := "unknown" + ctype := false + isTime := false + isDuration := false + isWktPointer := false + proto3 := false + validateUTF8 := true + for _, tag := range tagArray[3:] { + if strings.HasPrefix(tag, "name=") { + name = tag[5:] + } + if tag == "proto3" { + proto3 = true + } + if strings.HasPrefix(tag, "customtype=") { + ctype = true + } + if tag == "stdtime" { + isTime = true + } + if tag == "stdduration" { + isDuration = true + } + if tag == "wktptr" { + isWktPointer = true + } + } + validateUTF8 = validateUTF8 && proto3 + + // Figure out packaging (pointer, slice, or both) + slice := false + pointer := false + if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { + slice = true + t = t.Elem() + } + if t.Kind() == reflect.Ptr { + pointer = true + t = t.Elem() + } + + if ctype { + if reflect.PtrTo(t).Implements(customType) { + if slice { + return makeUnmarshalCustomSlice(getUnmarshalInfo(t), name) + } + if pointer { + return makeUnmarshalCustomPtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalCustom(getUnmarshalInfo(t), name) + } else { + panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) + } + } + + if isTime { + if pointer { + if slice { + return makeUnmarshalTimePtrSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalTimePtr(getUnmarshalInfo(t), name) + } + if slice { + return makeUnmarshalTimeSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalTime(getUnmarshalInfo(t), name) + } + + if isDuration { + if pointer { + if slice { + return makeUnmarshalDurationPtrSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalDurationPtr(getUnmarshalInfo(t), name) + } + if slice { + return makeUnmarshalDurationSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalDuration(getUnmarshalInfo(t), name) + } + + if isWktPointer { + switch t.Kind() { + case reflect.Float64: + if pointer { + if slice { + return makeStdDoubleValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdDoubleValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdDoubleValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdDoubleValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Float32: + if pointer { + if slice { + return makeStdFloatValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdFloatValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdFloatValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdFloatValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Int64: + if pointer { + if slice { + return makeStdInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdInt64ValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Uint64: + if pointer { + if slice { + return makeStdUInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdUInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdUInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdUInt64ValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Int32: + if pointer { + if slice { + return makeStdInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdInt32ValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Uint32: + if pointer { + if slice { + return makeStdUInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdUInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdUInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdUInt32ValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Bool: + if pointer { + if slice { + return makeStdBoolValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdBoolValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdBoolValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdBoolValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.String: + if pointer { + if slice { + return makeStdStringValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdStringValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdStringValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdStringValueUnmarshaler(getUnmarshalInfo(t), name) + case uint8SliceType: + if pointer { + if slice { + return makeStdBytesValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdBytesValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdBytesValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdBytesValueUnmarshaler(getUnmarshalInfo(t), name) + default: + panic(fmt.Sprintf("unknown wktpointer type %#v", t)) + } + } + + // We'll never have both pointer and slice for basic types. + if pointer && slice && t.Kind() != reflect.Struct { + panic("both pointer and slice for basic type in " + t.Name()) + } + + switch t.Kind() { + case reflect.Bool: + if pointer { + return unmarshalBoolPtr + } + if slice { + return unmarshalBoolSlice + } + return unmarshalBoolValue + case reflect.Int32: + switch encoding { + case "fixed32": + if pointer { + return unmarshalFixedS32Ptr + } + if slice { + return unmarshalFixedS32Slice + } + return unmarshalFixedS32Value + case "varint": + // this could be int32 or enum + if pointer { + return unmarshalInt32Ptr + } + if slice { + return unmarshalInt32Slice + } + return unmarshalInt32Value + case "zigzag32": + if pointer { + return unmarshalSint32Ptr + } + if slice { + return unmarshalSint32Slice + } + return unmarshalSint32Value + } + case reflect.Int64: + switch encoding { + case "fixed64": + if pointer { + return unmarshalFixedS64Ptr + } + if slice { + return unmarshalFixedS64Slice + } + return unmarshalFixedS64Value + case "varint": + if pointer { + return unmarshalInt64Ptr + } + if slice { + return unmarshalInt64Slice + } + return unmarshalInt64Value + case "zigzag64": + if pointer { + return unmarshalSint64Ptr + } + if slice { + return unmarshalSint64Slice + } + return unmarshalSint64Value + } + case reflect.Uint32: + switch encoding { + case "fixed32": + if pointer { + return unmarshalFixed32Ptr + } + if slice { + return unmarshalFixed32Slice + } + return unmarshalFixed32Value + case "varint": + if pointer { + return unmarshalUint32Ptr + } + if slice { + return unmarshalUint32Slice + } + return unmarshalUint32Value + } + case reflect.Uint64: + switch encoding { + case "fixed64": + if pointer { + return unmarshalFixed64Ptr + } + if slice { + return unmarshalFixed64Slice + } + return unmarshalFixed64Value + case "varint": + if pointer { + return unmarshalUint64Ptr + } + if slice { + return unmarshalUint64Slice + } + return unmarshalUint64Value + } + case reflect.Float32: + if pointer { + return unmarshalFloat32Ptr + } + if slice { + return unmarshalFloat32Slice + } + return unmarshalFloat32Value + case reflect.Float64: + if pointer { + return unmarshalFloat64Ptr + } + if slice { + return unmarshalFloat64Slice + } + return unmarshalFloat64Value + case reflect.Map: + panic("map type in typeUnmarshaler in " + t.Name()) + case reflect.Slice: + if pointer { + panic("bad pointer in slice case in " + t.Name()) + } + if slice { + return unmarshalBytesSlice + } + return unmarshalBytesValue + case reflect.String: + if validateUTF8 { + if pointer { + return unmarshalUTF8StringPtr + } + if slice { + return unmarshalUTF8StringSlice + } + return unmarshalUTF8StringValue + } + if pointer { + return unmarshalStringPtr + } + if slice { + return unmarshalStringSlice + } + return unmarshalStringValue + case reflect.Struct: + // message or group field + if !pointer { + switch encoding { + case "bytes": + if slice { + return makeUnmarshalMessageSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalMessage(getUnmarshalInfo(t), name) + } + } + switch encoding { + case "bytes": + if slice { + return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) + case "group": + if slice { + return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) + } + } + panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) +} + +// Below are all the unmarshalers for individual fields of various types. + +func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + *f.toInt64() = v + return b, nil +} + +func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + *f.toInt64Ptr() = &v + return b, nil +} + +func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + s := f.toInt64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x) + s := f.toInt64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + *f.toInt64() = v + return b, nil +} + +func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + *f.toInt64Ptr() = &v + return b, nil +} + +func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + s := f.toInt64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int64(x>>1) ^ int64(x)<<63>>63 + s := f.toInt64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + *f.toUint64() = v + return b, nil +} + +func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + *f.toUint64Ptr() = &v + return b, nil +} + +func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + s := f.toUint64Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint64(x) + s := f.toUint64Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + *f.toInt32() = v + return b, nil +} + +func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.setInt32Ptr(v) + return b, nil +} + +func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.appendInt32Slice(v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x) + f.appendInt32Slice(v) + return b, nil +} + +func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + *f.toInt32() = v + return b, nil +} + +func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.setInt32Ptr(v) + return b, nil +} + +func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.appendInt32Slice(v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := int32(x>>1) ^ int32(x)<<31>>31 + f.appendInt32Slice(v) + return b, nil +} + +func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + *f.toUint32() = v + return b, nil +} + +func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + *f.toUint32Ptr() = &v + return b, nil +} + +func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + s := f.toUint32Slice() + *s = append(*s, v) + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + v := uint32(x) + s := f.toUint32Slice() + *s = append(*s, v) + return b, nil +} + +func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + *f.toUint64() = v + return b[8:], nil +} + +func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + *f.toUint64Ptr() = &v + return b[8:], nil +} + +func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + s := f.toUint64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + s := f.toUint64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + *f.toInt64() = v + return b[8:], nil +} + +func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + *f.toInt64Ptr() = &v + return b[8:], nil +} + +func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + s := f.toInt64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 + s := f.toInt64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + *f.toUint32() = v + return b[4:], nil +} + +func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + *f.toUint32Ptr() = &v + return b[4:], nil +} + +func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + s := f.toUint32Slice() + *s = append(*s, v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 + s := f.toUint32Slice() + *s = append(*s, v) + return b[4:], nil +} + +func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + *f.toInt32() = v + return b[4:], nil +} + +func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.setInt32Ptr(v) + return b[4:], nil +} + +func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.appendInt32Slice(v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 + f.appendInt32Slice(v) + return b[4:], nil +} + +func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + // Note: any length varint is allowed, even though any sane + // encoder will use one byte. + // See https://github.com/golang/protobuf/issues/76 + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + // TODO: check if x>1? Tests seem to indicate no. + v := x != 0 + *f.toBool() = v + return b[n:], nil +} + +func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + *f.toBoolPtr() = &v + return b[n:], nil +} + +func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + x, n = decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + s := f.toBoolSlice() + *s = append(*s, v) + b = b[n:] + } + return res, nil + } + if w != WireVarint { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + v := x != 0 + s := f.toBoolSlice() + *s = append(*s, v) + return b[n:], nil +} + +func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + *f.toFloat64() = v + return b[8:], nil +} + +func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + *f.toFloat64Ptr() = &v + return b[8:], nil +} + +func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + s := f.toFloat64Slice() + *s = append(*s, v) + b = b[8:] + } + return res, nil + } + if w != WireFixed64 { + return b, errInternalBadWireType + } + if len(b) < 8 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) + s := f.toFloat64Slice() + *s = append(*s, v) + return b[8:], nil +} + +func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + *f.toFloat32() = v + return b[4:], nil +} + +func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + *f.toFloat32Ptr() = &v + return b[4:], nil +} + +func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { + if w == WireBytes { // packed + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + res := b[x:] + b = b[:x] + for len(b) > 0 { + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + s := f.toFloat32Slice() + *s = append(*s, v) + b = b[4:] + } + return res, nil + } + if w != WireFixed32 { + return b, errInternalBadWireType + } + if len(b) < 4 { + return nil, io.ErrUnexpectedEOF + } + v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) + s := f.toFloat32Slice() + *s = append(*s, v) + return b[4:], nil +} + +func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + *f.toString() = v + return b[x:], nil +} + +func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + *f.toStringPtr() = &v + return b[x:], nil +} + +func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + s := f.toStringSlice() + *s = append(*s, v) + return b[x:], nil +} + +func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + *f.toString() = v + if !utf8.ValidString(v) { + return b[x:], errInvalidUTF8 + } + return b[x:], nil +} + +func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + *f.toStringPtr() = &v + if !utf8.ValidString(v) { + return b[x:], errInvalidUTF8 + } + return b[x:], nil +} + +func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := string(b[:x]) + s := f.toStringSlice() + *s = append(*s, v) + if !utf8.ValidString(v) { + return b[x:], errInvalidUTF8 + } + return b[x:], nil +} + +var emptyBuf [0]byte + +func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // The use of append here is a trick which avoids the zeroing + // that would be required if we used a make/copy pair. + // We append to emptyBuf instead of nil because we want + // a non-nil result even when the length is 0. + v := append(emptyBuf[:], b[:x]...) + *f.toBytes() = v + return b[x:], nil +} + +func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := append(emptyBuf[:], b[:x]...) + s := f.toBytesSlice() + *s = append(*s, v) + return b[x:], nil +} + +func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // First read the message field to see if something is there. + // The semantics of multiple submessages are weird. Instead of + // the last one winning (as it is for all other fields), multiple + // submessages are merged. + v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[x:], err + } +} + +func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return b, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendPointer(v) + return b[x:], err + } +} + +func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireStartGroup { + return b, errInternalBadWireType + } + x, y := findEndGroup(b) + if x < 0 { + return nil, io.ErrUnexpectedEOF + } + v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[y:], err + } +} + +func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireStartGroup { + return b, errInternalBadWireType + } + x, y := findEndGroup(b) + if x < 0 { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendPointer(v) + return b[y:], err + } +} + +func makeUnmarshalMap(f *reflect.StructField) unmarshaler { + t := f.Type + kt := t.Key() + vt := t.Elem() + tagArray := strings.Split(f.Tag.Get("protobuf"), ",") + valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") + for _, t := range tagArray { + if strings.HasPrefix(t, "customtype=") { + valTags = append(valTags, t) + } + if t == "stdtime" { + valTags = append(valTags, t) + } + if t == "stdduration" { + valTags = append(valTags, t) + } + if t == "wktptr" { + valTags = append(valTags, t) + } + } + unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) + unmarshalVal := typeUnmarshaler(vt, strings.Join(valTags, ",")) + return func(b []byte, f pointer, w int) ([]byte, error) { + // The map entry is a submessage. Figure out how big it is. + if w != WireBytes { + return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + r := b[x:] // unused data to return + b = b[:x] // data for map entry + + // Note: we could use #keys * #values ~= 200 functions + // to do map decoding without reflection. Probably not worth it. + // Maps will be somewhat slow. Oh well. + + // Read key and value from data. + var nerr nonFatal + k := reflect.New(kt) + v := reflect.New(vt) + for len(b) > 0 { + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + wire := int(x) & 7 + b = b[n:] + + var err error + switch x >> 3 { + case 1: + b, err = unmarshalKey(b, valToPointer(k), wire) + case 2: + b, err = unmarshalVal(b, valToPointer(v), wire) + default: + err = errInternalBadWireType // skip unknown tag + } + + if nerr.Merge(err) { + continue + } + if err != errInternalBadWireType { + return nil, err + } + + // Skip past unknown fields. + b, err = skipField(b, wire) + if err != nil { + return nil, err + } + } + + // Get map, allocate if needed. + m := f.asPointerTo(t).Elem() // an addressable map[K]T + if m.IsNil() { + m.Set(reflect.MakeMap(t)) + } + + // Insert into map. + m.SetMapIndex(k.Elem(), v.Elem()) + + return r, nerr.E + } +} + +// makeUnmarshalOneof makes an unmarshaler for oneof fields. +// for: +// message Msg { +// oneof F { +// int64 X = 1; +// float64 Y = 2; +// } +// } +// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). +// ityp is the interface type of the oneof field (e.g. isMsg_F). +// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). +// Note that this function will be called once for each case in the oneof. +func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { + sf := typ.Field(0) + field0 := toField(&sf) + return func(b []byte, f pointer, w int) ([]byte, error) { + // Allocate holder for value. + v := reflect.New(typ) + + // Unmarshal data into holder. + // We unmarshal into the first field of the holder object. + var err error + var nerr nonFatal + b, err = unmarshal(b, valToPointer(v).offset(field0), w) + if !nerr.Merge(err) { + return nil, err + } + + // Write pointer to holder into target field. + f.asPointerTo(ityp).Elem().Set(v) + + return b, nerr.E + } +} + +// Error used by decode internally. +var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") + +// skipField skips past a field of type wire and returns the remaining bytes. +func skipField(b []byte, wire int) ([]byte, error) { + switch wire { + case WireVarint: + _, k := decodeVarint(b) + if k == 0 { + return b, io.ErrUnexpectedEOF + } + b = b[k:] + case WireFixed32: + if len(b) < 4 { + return b, io.ErrUnexpectedEOF + } + b = b[4:] + case WireFixed64: + if len(b) < 8 { + return b, io.ErrUnexpectedEOF + } + b = b[8:] + case WireBytes: + m, k := decodeVarint(b) + if k == 0 || uint64(len(b)-k) < m { + return b, io.ErrUnexpectedEOF + } + b = b[uint64(k)+m:] + case WireStartGroup: + _, i := findEndGroup(b) + if i == -1 { + return b, io.ErrUnexpectedEOF + } + b = b[i:] + default: + return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) + } + return b, nil +} + +// findEndGroup finds the index of the next EndGroup tag. +// Groups may be nested, so the "next" EndGroup tag is the first +// unpaired EndGroup. +// findEndGroup returns the indexes of the start and end of the EndGroup tag. +// Returns (-1,-1) if it can't find one. +func findEndGroup(b []byte) (int, int) { + depth := 1 + i := 0 + for { + x, n := decodeVarint(b[i:]) + if n == 0 { + return -1, -1 + } + j := i + i += n + switch x & 7 { + case WireVarint: + _, k := decodeVarint(b[i:]) + if k == 0 { + return -1, -1 + } + i += k + case WireFixed32: + if len(b)-4 < i { + return -1, -1 + } + i += 4 + case WireFixed64: + if len(b)-8 < i { + return -1, -1 + } + i += 8 + case WireBytes: + m, k := decodeVarint(b[i:]) + if k == 0 { + return -1, -1 + } + i += k + if uint64(len(b)-i) < m { + return -1, -1 + } + i += int(m) + case WireStartGroup: + depth++ + case WireEndGroup: + depth-- + if depth == 0 { + return j, i + } + default: + return -1, -1 + } + } +} + +// encodeVarint appends a varint-encoded integer to b and returns the result. +func encodeVarint(b []byte, x uint64) []byte { + for x >= 1<<7 { + b = append(b, byte(x&0x7f|0x80)) + x >>= 7 + } + return append(b, byte(x)) +} + +// decodeVarint reads a varint-encoded integer from b. +// Returns the decoded integer and the number of bytes read. +// If there is an error, it returns 0,0. +func decodeVarint(b []byte) (uint64, int) { + var x, y uint64 + if len(b) == 0 { + goto bad + } + x = uint64(b[0]) + if x < 0x80 { + return x, 1 + } + x -= 0x80 + + if len(b) <= 1 { + goto bad + } + y = uint64(b[1]) + x += y << 7 + if y < 0x80 { + return x, 2 + } + x -= 0x80 << 7 + + if len(b) <= 2 { + goto bad + } + y = uint64(b[2]) + x += y << 14 + if y < 0x80 { + return x, 3 + } + x -= 0x80 << 14 + + if len(b) <= 3 { + goto bad + } + y = uint64(b[3]) + x += y << 21 + if y < 0x80 { + return x, 4 + } + x -= 0x80 << 21 + + if len(b) <= 4 { + goto bad + } + y = uint64(b[4]) + x += y << 28 + if y < 0x80 { + return x, 5 + } + x -= 0x80 << 28 + + if len(b) <= 5 { + goto bad + } + y = uint64(b[5]) + x += y << 35 + if y < 0x80 { + return x, 6 + } + x -= 0x80 << 35 + + if len(b) <= 6 { + goto bad + } + y = uint64(b[6]) + x += y << 42 + if y < 0x80 { + return x, 7 + } + x -= 0x80 << 42 + + if len(b) <= 7 { + goto bad + } + y = uint64(b[7]) + x += y << 49 + if y < 0x80 { + return x, 8 + } + x -= 0x80 << 49 + + if len(b) <= 8 { + goto bad + } + y = uint64(b[8]) + x += y << 56 + if y < 0x80 { + return x, 9 + } + x -= 0x80 << 56 + + if len(b) <= 9 { + goto bad + } + y = uint64(b[9]) + x += y << 63 + if y < 2 { + return x, 10 + } + +bad: + return 0, 0 +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go new file mode 100644 index 000000000..00d6c7ad9 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go @@ -0,0 +1,385 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "io" + "reflect" +) + +func makeUnmarshalMessage(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // First read the message field to see if something is there. + // The semantics of multiple submessages are weird. Instead of + // the last one winning (as it is for all other fields), multiple + // submessages are merged. + v := f // gogo: changed from v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[x:], err + } +} + +func makeUnmarshalMessageSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendRef(v, sub.typ) // gogo: changed from f.appendPointer(v) + return b[x:], err + } +} + +func makeUnmarshalCustomPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.New(sub.typ)) + m := s.Interface().(custom) + if err := m.Unmarshal(b[:x]); err != nil { + return nil, err + } + return b[x:], nil + } +} + +func makeUnmarshalCustomSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := reflect.New(sub.typ) + c := m.Interface().(custom) + if err := c.Unmarshal(b[:x]); err != nil { + return nil, err + } + v := valToPointer(m) + f.appendRef(v, sub.typ) + return b[x:], nil + } +} + +func makeUnmarshalCustom(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + + m := f.asPointerTo(sub.typ).Interface().(custom) + if err := m.Unmarshal(b[:x]); err != nil { + return nil, err + } + return b[x:], nil + } +} + +func makeUnmarshalTime(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(t)) + return b[x:], nil + } +} + +func makeUnmarshalTimePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&t)) + return b[x:], nil + } +} + +func makeUnmarshalTimePtrSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&t)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalTimeSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(t)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalDurationPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&d)) + return b[x:], nil + } +} + +func makeUnmarshalDuration(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(d)) + return b[x:], nil + } +} + +func makeUnmarshalDurationPtrSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&d)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalDurationSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(d)) + slice.Set(newSlice) + return b[x:], nil + } +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/text.go b/integration-test/vendor/github.com/gogo/protobuf/proto/text.go new file mode 100644 index 000000000..87416afe9 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/text.go @@ -0,0 +1,930 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +// Functions for writing the text protocol buffer format. + +import ( + "bufio" + "bytes" + "encoding" + "errors" + "fmt" + "io" + "log" + "math" + "reflect" + "sort" + "strings" + "sync" + "time" +) + +var ( + newline = []byte("\n") + spaces = []byte(" ") + endBraceNewline = []byte("}\n") + backslashN = []byte{'\\', 'n'} + backslashR = []byte{'\\', 'r'} + backslashT = []byte{'\\', 't'} + backslashDQ = []byte{'\\', '"'} + backslashBS = []byte{'\\', '\\'} + posInf = []byte("inf") + negInf = []byte("-inf") + nan = []byte("nan") +) + +type writer interface { + io.Writer + WriteByte(byte) error +} + +// textWriter is an io.Writer that tracks its indentation level. +type textWriter struct { + ind int + complete bool // if the current position is a complete line + compact bool // whether to write out as a one-liner + w writer +} + +func (w *textWriter) WriteString(s string) (n int, err error) { + if !strings.Contains(s, "\n") { + if !w.compact && w.complete { + w.writeIndent() + } + w.complete = false + return io.WriteString(w.w, s) + } + // WriteString is typically called without newlines, so this + // codepath and its copy are rare. We copy to avoid + // duplicating all of Write's logic here. + return w.Write([]byte(s)) +} + +func (w *textWriter) Write(p []byte) (n int, err error) { + newlines := bytes.Count(p, newline) + if newlines == 0 { + if !w.compact && w.complete { + w.writeIndent() + } + n, err = w.w.Write(p) + w.complete = false + return n, err + } + + frags := bytes.SplitN(p, newline, newlines+1) + if w.compact { + for i, frag := range frags { + if i > 0 { + if err := w.w.WriteByte(' '); err != nil { + return n, err + } + n++ + } + nn, err := w.w.Write(frag) + n += nn + if err != nil { + return n, err + } + } + return n, nil + } + + for i, frag := range frags { + if w.complete { + w.writeIndent() + } + nn, err := w.w.Write(frag) + n += nn + if err != nil { + return n, err + } + if i+1 < len(frags) { + if err := w.w.WriteByte('\n'); err != nil { + return n, err + } + n++ + } + } + w.complete = len(frags[len(frags)-1]) == 0 + return n, nil +} + +func (w *textWriter) WriteByte(c byte) error { + if w.compact && c == '\n' { + c = ' ' + } + if !w.compact && w.complete { + w.writeIndent() + } + err := w.w.WriteByte(c) + w.complete = c == '\n' + return err +} + +func (w *textWriter) indent() { w.ind++ } + +func (w *textWriter) unindent() { + if w.ind == 0 { + log.Print("proto: textWriter unindented too far") + return + } + w.ind-- +} + +func writeName(w *textWriter, props *Properties) error { + if _, err := w.WriteString(props.OrigName); err != nil { + return err + } + if props.Wire != "group" { + return w.WriteByte(':') + } + return nil +} + +func requiresQuotes(u string) bool { + // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. + for _, ch := range u { + switch { + case ch == '.' || ch == '/' || ch == '_': + continue + case '0' <= ch && ch <= '9': + continue + case 'A' <= ch && ch <= 'Z': + continue + case 'a' <= ch && ch <= 'z': + continue + default: + return true + } + } + return false +} + +// isAny reports whether sv is a google.protobuf.Any message +func isAny(sv reflect.Value) bool { + type wkt interface { + XXX_WellKnownType() string + } + t, ok := sv.Addr().Interface().(wkt) + return ok && t.XXX_WellKnownType() == "Any" +} + +// writeProto3Any writes an expanded google.protobuf.Any message. +// +// It returns (false, nil) if sv value can't be unmarshaled (e.g. because +// required messages are not linked in). +// +// It returns (true, error) when sv was written in expanded format or an error +// was encountered. +func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { + turl := sv.FieldByName("TypeUrl") + val := sv.FieldByName("Value") + if !turl.IsValid() || !val.IsValid() { + return true, errors.New("proto: invalid google.protobuf.Any message") + } + + b, ok := val.Interface().([]byte) + if !ok { + return true, errors.New("proto: invalid google.protobuf.Any message") + } + + parts := strings.Split(turl.String(), "/") + mt := MessageType(parts[len(parts)-1]) + if mt == nil { + return false, nil + } + m := reflect.New(mt.Elem()) + if err := Unmarshal(b, m.Interface().(Message)); err != nil { + return false, nil + } + w.Write([]byte("[")) + u := turl.String() + if requiresQuotes(u) { + writeString(w, u) + } else { + w.Write([]byte(u)) + } + if w.compact { + w.Write([]byte("]:<")) + } else { + w.Write([]byte("]: <\n")) + w.ind++ + } + if err := tm.writeStruct(w, m.Elem()); err != nil { + return true, err + } + if w.compact { + w.Write([]byte("> ")) + } else { + w.ind-- + w.Write([]byte(">\n")) + } + return true, nil +} + +func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { + if tm.ExpandAny && isAny(sv) { + if canExpand, err := tm.writeProto3Any(w, sv); canExpand { + return err + } + } + st := sv.Type() + sprops := GetProperties(st) + for i := 0; i < sv.NumField(); i++ { + fv := sv.Field(i) + props := sprops.Prop[i] + name := st.Field(i).Name + + if name == "XXX_NoUnkeyedLiteral" { + continue + } + + if strings.HasPrefix(name, "XXX_") { + // There are two XXX_ fields: + // XXX_unrecognized []byte + // XXX_extensions map[int32]proto.Extension + // The first is handled here; + // the second is handled at the bottom of this function. + if name == "XXX_unrecognized" && !fv.IsNil() { + if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { + return err + } + } + continue + } + if fv.Kind() == reflect.Ptr && fv.IsNil() { + // Field not filled in. This could be an optional field or + // a required field that wasn't filled in. Either way, there + // isn't anything we can show for it. + continue + } + if fv.Kind() == reflect.Slice && fv.IsNil() { + // Repeated field that is empty, or a bytes field that is unused. + continue + } + + if props.Repeated && fv.Kind() == reflect.Slice { + // Repeated field. + for j := 0; j < fv.Len(); j++ { + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + v := fv.Index(j) + if v.Kind() == reflect.Ptr && v.IsNil() { + // A nil message in a repeated field is not valid, + // but we can handle that more gracefully than panicking. + if _, err := w.Write([]byte("\n")); err != nil { + return err + } + continue + } + if len(props.Enum) > 0 { + if err := tm.writeEnum(w, v, props); err != nil { + return err + } + } else if err := tm.writeAny(w, v, props); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + continue + } + if fv.Kind() == reflect.Map { + // Map fields are rendered as a repeated struct with key/value fields. + keys := fv.MapKeys() + sort.Sort(mapKeys(keys)) + for _, key := range keys { + val := fv.MapIndex(key) + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + // open struct + if err := w.WriteByte('<'); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + // key + if _, err := w.WriteString("key:"); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, key, props.MapKeyProp); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + // nil values aren't legal, but we can avoid panicking because of them. + if val.Kind() != reflect.Ptr || !val.IsNil() { + // value + if _, err := w.WriteString("value:"); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, val, props.MapValProp); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + // close struct + w.unindent() + if err := w.WriteByte('>'); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + continue + } + if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { + // empty bytes field + continue + } + if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { + // proto3 non-repeated scalar field; skip if zero value + if isProto3Zero(fv) { + continue + } + } + + if fv.Kind() == reflect.Interface { + // Check if it is a oneof. + if st.Field(i).Tag.Get("protobuf_oneof") != "" { + // fv is nil, or holds a pointer to generated struct. + // That generated struct has exactly one field, + // which has a protobuf struct tag. + if fv.IsNil() { + continue + } + inner := fv.Elem().Elem() // interface -> *T -> T + tag := inner.Type().Field(0).Tag.Get("protobuf") + props = new(Properties) // Overwrite the outer props var, but not its pointee. + props.Parse(tag) + // Write the value in the oneof, not the oneof itself. + fv = inner.Field(0) + + // Special case to cope with malformed messages gracefully: + // If the value in the oneof is a nil pointer, don't panic + // in writeAny. + if fv.Kind() == reflect.Ptr && fv.IsNil() { + // Use errors.New so writeAny won't render quotes. + msg := errors.New("/* nil */") + fv = reflect.ValueOf(&msg).Elem() + } + } + } + + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + + if len(props.Enum) > 0 { + if err := tm.writeEnum(w, fv, props); err != nil { + return err + } + } else if err := tm.writeAny(w, fv, props); err != nil { + return err + } + + if err := w.WriteByte('\n'); err != nil { + return err + } + } + + // Extensions (the XXX_extensions field). + pv := sv + if pv.CanAddr() { + pv = sv.Addr() + } else { + pv = reflect.New(sv.Type()) + pv.Elem().Set(sv) + } + if _, err := extendable(pv.Interface()); err == nil { + if err := tm.writeExtensions(w, pv); err != nil { + return err + } + } + + return nil +} + +var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() + +// writeAny writes an arbitrary field. +func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { + v = reflect.Indirect(v) + + if props != nil { + if len(props.CustomType) > 0 { + custom, ok := v.Interface().(Marshaler) + if ok { + data, err := custom.Marshal() + if err != nil { + return err + } + if err := writeString(w, string(data)); err != nil { + return err + } + return nil + } + } else if len(props.CastType) > 0 { + if _, ok := v.Interface().(interface { + String() string + }); ok { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + _, err := fmt.Fprintf(w, "%d", v.Interface()) + return err + } + } + } else if props.StdTime { + t, ok := v.Interface().(time.Time) + if !ok { + return fmt.Errorf("stdtime is not time.Time, but %T", v.Interface()) + } + tproto, err := timestampProto(t) + if err != nil { + return err + } + propsCopy := *props // Make a copy so that this is goroutine-safe + propsCopy.StdTime = false + err = tm.writeAny(w, reflect.ValueOf(tproto), &propsCopy) + return err + } else if props.StdDuration { + d, ok := v.Interface().(time.Duration) + if !ok { + return fmt.Errorf("stdtime is not time.Duration, but %T", v.Interface()) + } + dproto := durationProto(d) + propsCopy := *props // Make a copy so that this is goroutine-safe + propsCopy.StdDuration = false + err := tm.writeAny(w, reflect.ValueOf(dproto), &propsCopy) + return err + } + } + + // Floats have special cases. + if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { + x := v.Float() + var b []byte + switch { + case math.IsInf(x, 1): + b = posInf + case math.IsInf(x, -1): + b = negInf + case math.IsNaN(x): + b = nan + } + if b != nil { + _, err := w.Write(b) + return err + } + // Other values are handled below. + } + + // We don't attempt to serialise every possible value type; only those + // that can occur in protocol buffers. + switch v.Kind() { + case reflect.Slice: + // Should only be a []byte; repeated fields are handled in writeStruct. + if err := writeString(w, string(v.Bytes())); err != nil { + return err + } + case reflect.String: + if err := writeString(w, v.String()); err != nil { + return err + } + case reflect.Struct: + // Required/optional group/message. + var bra, ket byte = '<', '>' + if props != nil && props.Wire == "group" { + bra, ket = '{', '}' + } + if err := w.WriteByte(bra); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + if v.CanAddr() { + // Calling v.Interface on a struct causes the reflect package to + // copy the entire struct. This is racy with the new Marshaler + // since we atomically update the XXX_sizecache. + // + // Thus, we retrieve a pointer to the struct if possible to avoid + // a race since v.Interface on the pointer doesn't copy the struct. + // + // If v is not addressable, then we are not worried about a race + // since it implies that the binary Marshaler cannot possibly be + // mutating this value. + v = v.Addr() + } + if v.Type().Implements(textMarshalerType) { + text, err := v.Interface().(encoding.TextMarshaler).MarshalText() + if err != nil { + return err + } + if _, err = w.Write(text); err != nil { + return err + } + } else { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if err := tm.writeStruct(w, v); err != nil { + return err + } + } + w.unindent() + if err := w.WriteByte(ket); err != nil { + return err + } + default: + _, err := fmt.Fprint(w, v.Interface()) + return err + } + return nil +} + +// equivalent to C's isprint. +func isprint(c byte) bool { + return c >= 0x20 && c < 0x7f +} + +// writeString writes a string in the protocol buffer text format. +// It is similar to strconv.Quote except we don't use Go escape sequences, +// we treat the string as a byte sequence, and we use octal escapes. +// These differences are to maintain interoperability with the other +// languages' implementations of the text format. +func writeString(w *textWriter, s string) error { + // use WriteByte here to get any needed indent + if err := w.WriteByte('"'); err != nil { + return err + } + // Loop over the bytes, not the runes. + for i := 0; i < len(s); i++ { + var err error + // Divergence from C++: we don't escape apostrophes. + // There's no need to escape them, and the C++ parser + // copes with a naked apostrophe. + switch c := s[i]; c { + case '\n': + _, err = w.w.Write(backslashN) + case '\r': + _, err = w.w.Write(backslashR) + case '\t': + _, err = w.w.Write(backslashT) + case '"': + _, err = w.w.Write(backslashDQ) + case '\\': + _, err = w.w.Write(backslashBS) + default: + if isprint(c) { + err = w.w.WriteByte(c) + } else { + _, err = fmt.Fprintf(w.w, "\\%03o", c) + } + } + if err != nil { + return err + } + } + return w.WriteByte('"') +} + +func writeUnknownStruct(w *textWriter, data []byte) (err error) { + if !w.compact { + if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { + return err + } + } + b := NewBuffer(data) + for b.index < len(b.buf) { + x, err := b.DecodeVarint() + if err != nil { + _, ferr := fmt.Fprintf(w, "/* %v */\n", err) + return ferr + } + wire, tag := x&7, x>>3 + if wire == WireEndGroup { + w.unindent() + if _, werr := w.Write(endBraceNewline); werr != nil { + return werr + } + continue + } + if _, ferr := fmt.Fprint(w, tag); ferr != nil { + return ferr + } + if wire != WireStartGroup { + if err = w.WriteByte(':'); err != nil { + return err + } + } + if !w.compact || wire == WireStartGroup { + if err = w.WriteByte(' '); err != nil { + return err + } + } + switch wire { + case WireBytes: + buf, e := b.DecodeRawBytes(false) + if e == nil { + _, err = fmt.Fprintf(w, "%q", buf) + } else { + _, err = fmt.Fprintf(w, "/* %v */", e) + } + case WireFixed32: + x, err = b.DecodeFixed32() + err = writeUnknownInt(w, x, err) + case WireFixed64: + x, err = b.DecodeFixed64() + err = writeUnknownInt(w, x, err) + case WireStartGroup: + err = w.WriteByte('{') + w.indent() + case WireVarint: + x, err = b.DecodeVarint() + err = writeUnknownInt(w, x, err) + default: + _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) + } + if err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + return nil +} + +func writeUnknownInt(w *textWriter, x uint64, err error) error { + if err == nil { + _, err = fmt.Fprint(w, x) + } else { + _, err = fmt.Fprintf(w, "/* %v */", err) + } + return err +} + +type int32Slice []int32 + +func (s int32Slice) Len() int { return len(s) } +func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } +func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// writeExtensions writes all the extensions in pv. +// pv is assumed to be a pointer to a protocol message struct that is extendable. +func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { + emap := extensionMaps[pv.Type().Elem()] + e := pv.Interface().(Message) + + var m map[int32]Extension + var mu sync.Locker + if em, ok := e.(extensionsBytes); ok { + eb := em.GetExtensions() + var err error + m, err = BytesToExtensionsMap(*eb) + if err != nil { + return err + } + mu = notLocker{} + } else if _, ok := e.(extendableProto); ok { + ep, _ := extendable(e) + m, mu = ep.extensionsRead() + if m == nil { + return nil + } + } + + // Order the extensions by ID. + // This isn't strictly necessary, but it will give us + // canonical output, which will also make testing easier. + + mu.Lock() + ids := make([]int32, 0, len(m)) + for id := range m { + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) + mu.Unlock() + + for _, extNum := range ids { + ext := m[extNum] + var desc *ExtensionDesc + if emap != nil { + desc = emap[extNum] + } + if desc == nil { + // Unknown extension. + if err := writeUnknownStruct(w, ext.enc); err != nil { + return err + } + continue + } + + pb, err := GetExtension(e, desc) + if err != nil { + return fmt.Errorf("failed getting extension: %v", err) + } + + // Repeated extensions will appear as a slice. + if !desc.repeated() { + if err := tm.writeExtension(w, desc.Name, pb); err != nil { + return err + } + } else { + v := reflect.ValueOf(pb) + for i := 0; i < v.Len(); i++ { + if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { + return err + } + } + } + } + return nil +} + +func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { + if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + return nil +} + +func (w *textWriter) writeIndent() { + if !w.complete { + return + } + remain := w.ind * 2 + for remain > 0 { + n := remain + if n > len(spaces) { + n = len(spaces) + } + w.w.Write(spaces[:n]) + remain -= n + } + w.complete = false +} + +// TextMarshaler is a configurable text format marshaler. +type TextMarshaler struct { + Compact bool // use compact text format (one line). + ExpandAny bool // expand google.protobuf.Any messages of known types +} + +// Marshal writes a given protocol buffer in text format. +// The only errors returned are from w. +func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { + val := reflect.ValueOf(pb) + if pb == nil || val.IsNil() { + w.Write([]byte("")) + return nil + } + var bw *bufio.Writer + ww, ok := w.(writer) + if !ok { + bw = bufio.NewWriter(w) + ww = bw + } + aw := &textWriter{ + w: ww, + complete: true, + compact: tm.Compact, + } + + if etm, ok := pb.(encoding.TextMarshaler); ok { + text, err := etm.MarshalText() + if err != nil { + return err + } + if _, err = aw.Write(text); err != nil { + return err + } + if bw != nil { + return bw.Flush() + } + return nil + } + // Dereference the received pointer so we don't have outer < and >. + v := reflect.Indirect(val) + if err := tm.writeStruct(aw, v); err != nil { + return err + } + if bw != nil { + return bw.Flush() + } + return nil +} + +// Text is the same as Marshal, but returns the string directly. +func (tm *TextMarshaler) Text(pb Message) string { + var buf bytes.Buffer + tm.Marshal(&buf, pb) + return buf.String() +} + +var ( + defaultTextMarshaler = TextMarshaler{} + compactTextMarshaler = TextMarshaler{Compact: true} +) + +// TODO: consider removing some of the Marshal functions below. + +// MarshalText writes a given protocol buffer in text format. +// The only errors returned are from w. +func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } + +// MarshalTextString is the same as MarshalText, but returns the string directly. +func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } + +// CompactText writes a given protocol buffer in compact text format (one line). +func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } + +// CompactTextString is the same as CompactText, but returns the string directly. +func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/text_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/text_gogo.go new file mode 100644 index 000000000..1d6c6aa0e --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/text_gogo.go @@ -0,0 +1,57 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" +) + +func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { + m, ok := enumStringMaps[props.Enum] + if !ok { + if err := tm.writeAny(w, v, props); err != nil { + return err + } + } + key := int32(0) + if v.Kind() == reflect.Ptr { + key = int32(v.Elem().Int()) + } else { + key = int32(v.Int()) + } + s, ok := m[key] + if !ok { + if err := tm.writeAny(w, v, props); err != nil { + return err + } + } + _, err := fmt.Fprint(w, s) + return err +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/text_parser.go b/integration-test/vendor/github.com/gogo/protobuf/proto/text_parser.go new file mode 100644 index 000000000..f85c0cc81 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/text_parser.go @@ -0,0 +1,1018 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +// Functions for parsing the Text protocol buffer format. +// TODO: message sets. + +import ( + "encoding" + "errors" + "fmt" + "reflect" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +// Error string emitted when deserializing Any and fields are already set +const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" + +type ParseError struct { + Message string + Line int // 1-based line number + Offset int // 0-based byte offset from start of input +} + +func (p *ParseError) Error() string { + if p.Line == 1 { + // show offset only for first line + return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) + } + return fmt.Sprintf("line %d: %v", p.Line, p.Message) +} + +type token struct { + value string + err *ParseError + line int // line number + offset int // byte number from start of input, not start of line + unquoted string // the unquoted version of value, if it was a quoted string +} + +func (t *token) String() string { + if t.err == nil { + return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) + } + return fmt.Sprintf("parse error: %v", t.err) +} + +type textParser struct { + s string // remaining input + done bool // whether the parsing is finished (success or error) + backed bool // whether back() was called + offset, line int + cur token +} + +func newTextParser(s string) *textParser { + p := new(textParser) + p.s = s + p.line = 1 + p.cur.line = 1 + return p +} + +func (p *textParser) errorf(format string, a ...interface{}) *ParseError { + pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} + p.cur.err = pe + p.done = true + return pe +} + +// Numbers and identifiers are matched by [-+._A-Za-z0-9] +func isIdentOrNumberChar(c byte) bool { + switch { + case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': + return true + case '0' <= c && c <= '9': + return true + } + switch c { + case '-', '+', '.', '_': + return true + } + return false +} + +func isWhitespace(c byte) bool { + switch c { + case ' ', '\t', '\n', '\r': + return true + } + return false +} + +func isQuote(c byte) bool { + switch c { + case '"', '\'': + return true + } + return false +} + +func (p *textParser) skipWhitespace() { + i := 0 + for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { + if p.s[i] == '#' { + // comment; skip to end of line or input + for i < len(p.s) && p.s[i] != '\n' { + i++ + } + if i == len(p.s) { + break + } + } + if p.s[i] == '\n' { + p.line++ + } + i++ + } + p.offset += i + p.s = p.s[i:len(p.s)] + if len(p.s) == 0 { + p.done = true + } +} + +func (p *textParser) advance() { + // Skip whitespace + p.skipWhitespace() + if p.done { + return + } + + // Start of non-whitespace + p.cur.err = nil + p.cur.offset, p.cur.line = p.offset, p.line + p.cur.unquoted = "" + switch p.s[0] { + case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': + // Single symbol + p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] + case '"', '\'': + // Quoted string + i := 1 + for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { + if p.s[i] == '\\' && i+1 < len(p.s) { + // skip escaped char + i++ + } + i++ + } + if i >= len(p.s) || p.s[i] != p.s[0] { + p.errorf("unmatched quote") + return + } + unq, err := unquoteC(p.s[1:i], rune(p.s[0])) + if err != nil { + p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) + return + } + p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] + p.cur.unquoted = unq + default: + i := 0 + for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { + i++ + } + if i == 0 { + p.errorf("unexpected byte %#x", p.s[0]) + return + } + p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] + } + p.offset += len(p.cur.value) +} + +var ( + errBadUTF8 = errors.New("proto: bad UTF-8") +) + +func unquoteC(s string, quote rune) (string, error) { + // This is based on C++'s tokenizer.cc. + // Despite its name, this is *not* parsing C syntax. + // For instance, "\0" is an invalid quoted string. + + // Avoid allocation in trivial cases. + simple := true + for _, r := range s { + if r == '\\' || r == quote { + simple = false + break + } + } + if simple { + return s, nil + } + + buf := make([]byte, 0, 3*len(s)/2) + for len(s) > 0 { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", errBadUTF8 + } + s = s[n:] + if r != '\\' { + if r < utf8.RuneSelf { + buf = append(buf, byte(r)) + } else { + buf = append(buf, string(r)...) + } + continue + } + + ch, tail, err := unescape(s) + if err != nil { + return "", err + } + buf = append(buf, ch...) + s = tail + } + return string(buf), nil +} + +func unescape(s string) (ch string, tail string, err error) { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", "", errBadUTF8 + } + s = s[n:] + switch r { + case 'a': + return "\a", s, nil + case 'b': + return "\b", s, nil + case 'f': + return "\f", s, nil + case 'n': + return "\n", s, nil + case 'r': + return "\r", s, nil + case 't': + return "\t", s, nil + case 'v': + return "\v", s, nil + case '?': + return "?", s, nil // trigraph workaround + case '\'', '"', '\\': + return string(r), s, nil + case '0', '1', '2', '3', '4', '5', '6', '7': + if len(s) < 2 { + return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) + } + ss := string(r) + s[:2] + s = s[2:] + i, err := strconv.ParseUint(ss, 8, 8) + if err != nil { + return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) + } + return string([]byte{byte(i)}), s, nil + case 'x', 'X', 'u', 'U': + var n int + switch r { + case 'x', 'X': + n = 2 + case 'u': + n = 4 + case 'U': + n = 8 + } + if len(s) < n { + return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) + } + ss := s[:n] + s = s[n:] + i, err := strconv.ParseUint(ss, 16, 64) + if err != nil { + return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) + } + if r == 'x' || r == 'X' { + return string([]byte{byte(i)}), s, nil + } + if i > utf8.MaxRune { + return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) + } + return string(rune(i)), s, nil + } + return "", "", fmt.Errorf(`unknown escape \%c`, r) +} + +// Back off the parser by one token. Can only be done between calls to next(). +// It makes the next advance() a no-op. +func (p *textParser) back() { p.backed = true } + +// Advances the parser and returns the new current token. +func (p *textParser) next() *token { + if p.backed || p.done { + p.backed = false + return &p.cur + } + p.advance() + if p.done { + p.cur.value = "" + } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { + // Look for multiple quoted strings separated by whitespace, + // and concatenate them. + cat := p.cur + for { + p.skipWhitespace() + if p.done || !isQuote(p.s[0]) { + break + } + p.advance() + if p.cur.err != nil { + return &p.cur + } + cat.value += " " + p.cur.value + cat.unquoted += p.cur.unquoted + } + p.done = false // parser may have seen EOF, but we want to return cat + p.cur = cat + } + return &p.cur +} + +func (p *textParser) consumeToken(s string) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != s { + p.back() + return p.errorf("expected %q, found %q", s, tok.value) + } + return nil +} + +// Return a RequiredNotSetError indicating which required field was not set. +func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { + st := sv.Type() + sprops := GetProperties(st) + for i := 0; i < st.NumField(); i++ { + if !isNil(sv.Field(i)) { + continue + } + + props := sprops.Prop[i] + if props.Required { + return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} + } + } + return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen +} + +// Returns the index in the struct for the named field, as well as the parsed tag properties. +func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { + i, ok := sprops.decoderOrigNames[name] + if ok { + return i, sprops.Prop[i], true + } + return -1, nil, false +} + +// Consume a ':' from the input stream (if the next token is a colon), +// returning an error if a colon is needed but not present. +func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ":" { + // Colon is optional when the field is a group or message. + needColon := true + switch props.Wire { + case "group": + needColon = false + case "bytes": + // A "bytes" field is either a message, a string, or a repeated field; + // those three become *T, *string and []T respectively, so we can check for + // this field being a pointer to a non-string. + if typ.Kind() == reflect.Ptr { + // *T or *string + if typ.Elem().Kind() == reflect.String { + break + } + } else if typ.Kind() == reflect.Slice { + // []T or []*T + if typ.Elem().Kind() != reflect.Ptr { + break + } + } else if typ.Kind() == reflect.String { + // The proto3 exception is for a string field, + // which requires a colon. + break + } + needColon = false + } + if needColon { + return p.errorf("expected ':', found %q", tok.value) + } + p.back() + } + return nil +} + +func (p *textParser) readStruct(sv reflect.Value, terminator string) error { + st := sv.Type() + sprops := GetProperties(st) + reqCount := sprops.reqCount + var reqFieldErr error + fieldSet := make(map[string]bool) + // A struct is a sequence of "name: value", terminated by one of + // '>' or '}', or the end of the input. A name may also be + // "[extension]" or "[type/url]". + // + // The whole struct can also be an expanded Any message, like: + // [type/url] < ... struct contents ... > + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + if tok.value == "[" { + // Looks like an extension or an Any. + // + // TODO: Check whether we need to handle + // namespace rooted names (e.g. ".something.Foo"). + extName, err := p.consumeExtName() + if err != nil { + return err + } + + if s := strings.LastIndex(extName, "/"); s >= 0 { + // If it contains a slash, it's an Any type URL. + messageName := extName[s+1:] + mt := MessageType(messageName) + if mt == nil { + return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) + } + tok = p.next() + if tok.err != nil { + return tok.err + } + // consume an optional colon + if tok.value == ":" { + tok = p.next() + if tok.err != nil { + return tok.err + } + } + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + v := reflect.New(mt.Elem()) + if pe := p.readStruct(v.Elem(), terminator); pe != nil { + return pe + } + b, err := Marshal(v.Interface().(Message)) + if err != nil { + return p.errorf("failed to marshal message of type %q: %v", messageName, err) + } + if fieldSet["type_url"] { + return p.errorf(anyRepeatedlyUnpacked, "type_url") + } + if fieldSet["value"] { + return p.errorf(anyRepeatedlyUnpacked, "value") + } + sv.FieldByName("TypeUrl").SetString(extName) + sv.FieldByName("Value").SetBytes(b) + fieldSet["type_url"] = true + fieldSet["value"] = true + continue + } + + var desc *ExtensionDesc + // This could be faster, but it's functional. + // TODO: Do something smarter than a linear scan. + for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { + if d.Name == extName { + desc = d + break + } + } + if desc == nil { + return p.errorf("unrecognized extension %q", extName) + } + + props := &Properties{} + props.Parse(desc.Tag) + + typ := reflect.TypeOf(desc.ExtensionType) + if err := p.checkForColon(props, typ); err != nil { + return err + } + + rep := desc.repeated() + + // Read the extension structure, and set it in + // the value we're constructing. + var ext reflect.Value + if !rep { + ext = reflect.New(typ).Elem() + } else { + ext = reflect.New(typ.Elem()).Elem() + } + if err := p.readAny(ext, props); err != nil { + if _, ok := err.(*RequiredNotSetError); !ok { + return err + } + reqFieldErr = err + } + ep := sv.Addr().Interface().(Message) + if !rep { + SetExtension(ep, desc, ext.Interface()) + } else { + old, err := GetExtension(ep, desc) + var sl reflect.Value + if err == nil { + sl = reflect.ValueOf(old) // existing slice + } else { + sl = reflect.MakeSlice(typ, 0, 1) + } + sl = reflect.Append(sl, ext) + SetExtension(ep, desc, sl.Interface()) + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + continue + } + + // This is a normal, non-extension field. + name := tok.value + var dst reflect.Value + fi, props, ok := structFieldByName(sprops, name) + if ok { + dst = sv.Field(fi) + } else if oop, ok := sprops.OneofTypes[name]; ok { + // It is a oneof. + props = oop.Prop + nv := reflect.New(oop.Type.Elem()) + dst = nv.Elem().Field(0) + field := sv.Field(oop.Field) + if !field.IsNil() { + return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) + } + field.Set(nv) + } + if !dst.IsValid() { + return p.errorf("unknown field name %q in %v", name, st) + } + + if dst.Kind() == reflect.Map { + // Consume any colon. + if err := p.checkForColon(props, dst.Type()); err != nil { + return err + } + + // Construct the map if it doesn't already exist. + if dst.IsNil() { + dst.Set(reflect.MakeMap(dst.Type())) + } + key := reflect.New(dst.Type().Key()).Elem() + val := reflect.New(dst.Type().Elem()).Elem() + + // The map entry should be this sequence of tokens: + // < key : KEY value : VALUE > + // However, implementations may omit key or value, and technically + // we should support them in any order. See b/28924776 for a time + // this went wrong. + + tok := p.next() + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + switch tok.value { + case "key": + if err := p.consumeToken(":"); err != nil { + return err + } + if err := p.readAny(key, props.MapKeyProp); err != nil { + return err + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + case "value": + if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil { + return err + } + if err := p.readAny(val, props.MapValProp); err != nil { + return err + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + default: + p.back() + return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) + } + } + + dst.SetMapIndex(key, val) + continue + } + + // Check that it's not already set if it's not a repeated field. + if !props.Repeated && fieldSet[name] { + return p.errorf("non-repeated field %q was repeated", name) + } + + if err := p.checkForColon(props, dst.Type()); err != nil { + return err + } + + // Parse into the field. + fieldSet[name] = true + if err := p.readAny(dst, props); err != nil { + if _, ok := err.(*RequiredNotSetError); !ok { + return err + } + reqFieldErr = err + } + if props.Required { + reqCount-- + } + + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + + } + + if reqCount > 0 { + return p.missingRequiredFieldError(sv) + } + return reqFieldErr +} + +// consumeExtName consumes extension name or expanded Any type URL and the +// following ']'. It returns the name or URL consumed. +func (p *textParser) consumeExtName() (string, error) { + tok := p.next() + if tok.err != nil { + return "", tok.err + } + + // If extension name or type url is quoted, it's a single token. + if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { + name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) + if err != nil { + return "", err + } + return name, p.consumeToken("]") + } + + // Consume everything up to "]" + var parts []string + for tok.value != "]" { + parts = append(parts, tok.value) + tok = p.next() + if tok.err != nil { + return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) + } + if p.done && tok.value != "]" { + return "", p.errorf("unclosed type_url or extension name") + } + } + return strings.Join(parts, ""), nil +} + +// consumeOptionalSeparator consumes an optional semicolon or comma. +// It is used in readStruct to provide backward compatibility. +func (p *textParser) consumeOptionalSeparator() error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ";" && tok.value != "," { + p.back() + } + return nil +} + +func (p *textParser) readAny(v reflect.Value, props *Properties) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == "" { + return p.errorf("unexpected EOF") + } + if len(props.CustomType) > 0 { + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + tc := reflect.TypeOf(new(Marshaler)) + ok := t.Elem().Implements(tc.Elem()) + if ok { + fv := v + flen := fv.Len() + if flen == fv.Cap() { + nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1) + reflect.Copy(nav, fv) + fv.Set(nav) + } + fv.SetLen(flen + 1) + + // Read one. + p.back() + return p.readAny(fv.Index(flen), props) + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler) + err := custom.Unmarshal([]byte(tok.unquoted)) + if err != nil { + return p.errorf("%v %v: %v", err, v.Type(), tok.value) + } + v.Set(reflect.ValueOf(custom)) + } else { + custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler) + err := custom.Unmarshal([]byte(tok.unquoted)) + if err != nil { + return p.errorf("%v %v: %v", err, v.Type(), tok.value) + } + v.Set(reflect.Indirect(reflect.ValueOf(custom))) + } + return nil + } + if props.StdTime { + fv := v + p.back() + props.StdTime = false + tproto := ×tamp{} + err := p.readAny(reflect.ValueOf(tproto).Elem(), props) + props.StdTime = true + if err != nil { + return err + } + tim, err := timestampFromProto(tproto) + if err != nil { + return err + } + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + if t.Elem().Kind() == reflect.Ptr { + ts := fv.Interface().([]*time.Time) + ts = append(ts, &tim) + fv.Set(reflect.ValueOf(ts)) + return nil + } else { + ts := fv.Interface().([]time.Time) + ts = append(ts, tim) + fv.Set(reflect.ValueOf(ts)) + return nil + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + v.Set(reflect.ValueOf(&tim)) + } else { + v.Set(reflect.Indirect(reflect.ValueOf(&tim))) + } + return nil + } + if props.StdDuration { + fv := v + p.back() + props.StdDuration = false + dproto := &duration{} + err := p.readAny(reflect.ValueOf(dproto).Elem(), props) + props.StdDuration = true + if err != nil { + return err + } + dur, err := durationFromProto(dproto) + if err != nil { + return err + } + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + if t.Elem().Kind() == reflect.Ptr { + ds := fv.Interface().([]*time.Duration) + ds = append(ds, &dur) + fv.Set(reflect.ValueOf(ds)) + return nil + } else { + ds := fv.Interface().([]time.Duration) + ds = append(ds, dur) + fv.Set(reflect.ValueOf(ds)) + return nil + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + v.Set(reflect.ValueOf(&dur)) + } else { + v.Set(reflect.Indirect(reflect.ValueOf(&dur))) + } + return nil + } + switch fv := v; fv.Kind() { + case reflect.Slice: + at := v.Type() + if at.Elem().Kind() == reflect.Uint8 { + // Special case for []byte + if tok.value[0] != '"' && tok.value[0] != '\'' { + // Deliberately written out here, as the error after + // this switch statement would write "invalid []byte: ...", + // which is not as user-friendly. + return p.errorf("invalid string: %v", tok.value) + } + bytes := []byte(tok.unquoted) + fv.Set(reflect.ValueOf(bytes)) + return nil + } + // Repeated field. + if tok.value == "[" { + // Repeated field with list notation, like [1,2,3]. + for { + fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) + err := p.readAny(fv.Index(fv.Len()-1), props) + if err != nil { + return err + } + ntok := p.next() + if ntok.err != nil { + return ntok.err + } + if ntok.value == "]" { + break + } + if ntok.value != "," { + return p.errorf("Expected ']' or ',' found %q", ntok.value) + } + } + return nil + } + // One value of the repeated field. + p.back() + fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) + return p.readAny(fv.Index(fv.Len()-1), props) + case reflect.Bool: + // true/1/t/True or false/f/0/False. + switch tok.value { + case "true", "1", "t", "True": + fv.SetBool(true) + return nil + case "false", "0", "f", "False": + fv.SetBool(false) + return nil + } + case reflect.Float32, reflect.Float64: + v := tok.value + // Ignore 'f' for compatibility with output generated by C++, but don't + // remove 'f' when the value is "-inf" or "inf". + if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { + v = v[:len(v)-1] + } + if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { + fv.SetFloat(f) + return nil + } + case reflect.Int8: + if x, err := strconv.ParseInt(tok.value, 0, 8); err == nil { + fv.SetInt(x) + return nil + } + case reflect.Int16: + if x, err := strconv.ParseInt(tok.value, 0, 16); err == nil { + fv.SetInt(x) + return nil + } + case reflect.Int32: + if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { + fv.SetInt(x) + return nil + } + + if len(props.Enum) == 0 { + break + } + m, ok := enumValueMaps[props.Enum] + if !ok { + break + } + x, ok := m[tok.value] + if !ok { + break + } + fv.SetInt(int64(x)) + return nil + case reflect.Int64: + if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { + fv.SetInt(x) + return nil + } + + case reflect.Ptr: + // A basic field (indirected through pointer), or a repeated message/group + p.back() + fv.Set(reflect.New(fv.Type().Elem())) + return p.readAny(fv.Elem(), props) + case reflect.String: + if tok.value[0] == '"' || tok.value[0] == '\'' { + fv.SetString(tok.unquoted) + return nil + } + case reflect.Struct: + var terminator string + switch tok.value { + case "{": + terminator = "}" + case "<": + terminator = ">" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + // TODO: Handle nested messages which implement encoding.TextUnmarshaler. + return p.readStruct(fv, terminator) + case reflect.Uint8: + if x, err := strconv.ParseUint(tok.value, 0, 8); err == nil { + fv.SetUint(x) + return nil + } + case reflect.Uint16: + if x, err := strconv.ParseUint(tok.value, 0, 16); err == nil { + fv.SetUint(x) + return nil + } + case reflect.Uint32: + if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { + fv.SetUint(uint64(x)) + return nil + } + case reflect.Uint64: + if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { + fv.SetUint(x) + return nil + } + } + return p.errorf("invalid %v: %v", v.Type(), tok.value) +} + +// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb +// before starting to unmarshal, so any existing data in pb is always removed. +// If a required field is not set and no other error occurs, +// UnmarshalText returns *RequiredNotSetError. +func UnmarshalText(s string, pb Message) error { + if um, ok := pb.(encoding.TextUnmarshaler); ok { + return um.UnmarshalText([]byte(s)) + } + pb.Reset() + v := reflect.ValueOf(pb) + return newTextParser(s).readStruct(v.Elem(), "") +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/timestamp.go b/integration-test/vendor/github.com/gogo/protobuf/proto/timestamp.go new file mode 100644 index 000000000..9324f6542 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/timestamp.go @@ -0,0 +1,113 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +// This file implements operations on google.protobuf.Timestamp. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Seconds field of the earliest valid Timestamp. + // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + minValidSeconds = -62135596800 + // Seconds field just after the latest valid Timestamp. + // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + maxValidSeconds = 253402300800 +) + +// validateTimestamp determines whether a Timestamp is valid. +// A valid timestamp represents a time in the range +// [0001-01-01, 10000-01-01) and has a Nanos field +// in the range [0, 1e9). +// +// If the Timestamp is valid, validateTimestamp returns nil. +// Otherwise, it returns an error that describes +// the problem. +// +// Every valid Timestamp can be represented by a time.Time, but the converse is not true. +func validateTimestamp(ts *timestamp) error { + if ts == nil { + return errors.New("timestamp: nil Timestamp") + } + if ts.Seconds < minValidSeconds { + return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) + } + if ts.Seconds >= maxValidSeconds { + return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) + } + if ts.Nanos < 0 || ts.Nanos >= 1e9 { + return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) + } + return nil +} + +// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. +// It returns an error if the argument is invalid. +// +// Unlike most Go functions, if Timestamp returns an error, the first return value +// is not the zero time.Time. Instead, it is the value obtained from the +// time.Unix function when passed the contents of the Timestamp, in the UTC +// locale. This may or may not be a meaningful time; many invalid Timestamps +// do map to valid time.Times. +// +// A nil Timestamp returns an error. The first return value in that case is +// undefined. +func timestampFromProto(ts *timestamp) (time.Time, error) { + // Don't return the zero value on error, because corresponds to a valid + // timestamp. Instead return whatever time.Unix gives us. + var t time.Time + if ts == nil { + t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp + } else { + t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() + } + return t, validateTimestamp(ts) +} + +// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. +// It returns an error if the resulting Timestamp is invalid. +func timestampProto(t time.Time) (*timestamp, error) { + seconds := t.Unix() + nanos := int32(t.Sub(time.Unix(seconds, 0))) + ts := ×tamp{ + Seconds: seconds, + Nanos: nanos, + } + if err := validateTimestamp(ts); err != nil { + return nil, err + } + return ts, nil +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go new file mode 100644 index 000000000..38439fa99 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go @@ -0,0 +1,49 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "reflect" + "time" +) + +var timeType = reflect.TypeOf((*time.Time)(nil)).Elem() + +type timestamp struct { + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` +} + +func (m *timestamp) Reset() { *m = timestamp{} } +func (*timestamp) ProtoMessage() {} +func (*timestamp) String() string { return "timestamp" } + +func init() { + RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/wrappers.go b/integration-test/vendor/github.com/gogo/protobuf/proto/wrappers.go new file mode 100644 index 000000000..b175d1b64 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/wrappers.go @@ -0,0 +1,1888 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "io" + "reflect" +) + +func makeStdDoubleValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*float64) + v := &float64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*float64) + v := &float64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdDoubleValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) + v := &float64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) + v := &float64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdDoubleValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(float64) + v := &float64Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(float64) + v := &float64Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdDoubleValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*float64) + v := &float64Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*float64) + v := &float64Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdDoubleValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdDoubleValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdDoubleValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdDoubleValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdFloatValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*float32) + v := &float32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*float32) + v := &float32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdFloatValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) + v := &float32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) + v := &float32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdFloatValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(float32) + v := &float32Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(float32) + v := &float32Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdFloatValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*float32) + v := &float32Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*float32) + v := &float32Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdFloatValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdFloatValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdFloatValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdFloatValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*int64) + v := &int64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*int64) + v := &int64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) + v := &int64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) + v := &int64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(int64) + v := &int64Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(int64) + v := &int64Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*int64) + v := &int64Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*int64) + v := &int64Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdUInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*uint64) + v := &uint64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*uint64) + v := &uint64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdUInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) + v := &uint64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) + v := &uint64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdUInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(uint64) + v := &uint64Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(uint64) + v := &uint64Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdUInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*uint64) + v := &uint64Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*uint64) + v := &uint64Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdUInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdUInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdUInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdUInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*int32) + v := &int32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*int32) + v := &int32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) + v := &int32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) + v := &int32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(int32) + v := &int32Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(int32) + v := &int32Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*int32) + v := &int32Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*int32) + v := &int32Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdUInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*uint32) + v := &uint32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*uint32) + v := &uint32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdUInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) + v := &uint32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) + v := &uint32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdUInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(uint32) + v := &uint32Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(uint32) + v := &uint32Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdUInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*uint32) + v := &uint32Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*uint32) + v := &uint32Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdUInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdUInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdUInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdUInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdBoolValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*bool) + v := &boolValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*bool) + v := &boolValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdBoolValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) + v := &boolValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) + v := &boolValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdBoolValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(bool) + v := &boolValue{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(bool) + v := &boolValue{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdBoolValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*bool) + v := &boolValue{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*bool) + v := &boolValue{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdBoolValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &boolValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdBoolValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &boolValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdBoolValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &boolValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdBoolValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &boolValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdStringValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*string) + v := &stringValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*string) + v := &stringValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdStringValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) + v := &stringValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) + v := &stringValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdStringValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(string) + v := &stringValue{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(string) + v := &stringValue{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdStringValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*string) + v := &stringValue{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*string) + v := &stringValue{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdStringValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &stringValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdStringValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &stringValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdStringValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &stringValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdStringValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &stringValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdBytesValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*[]byte) + v := &bytesValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*[]byte) + v := &bytesValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdBytesValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) + v := &bytesValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) + v := &bytesValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdBytesValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().([]byte) + v := &bytesValue{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().([]byte) + v := &bytesValue{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdBytesValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*[]byte) + v := &bytesValue{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*[]byte) + v := &bytesValue{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdBytesValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &bytesValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdBytesValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &bytesValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdBytesValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &bytesValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdBytesValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &bytesValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go b/integration-test/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go new file mode 100644 index 000000000..c1cf7bf85 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go @@ -0,0 +1,113 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +type float64Value struct { + Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *float64Value) Reset() { *m = float64Value{} } +func (*float64Value) ProtoMessage() {} +func (*float64Value) String() string { return "float64" } + +type float32Value struct { + Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *float32Value) Reset() { *m = float32Value{} } +func (*float32Value) ProtoMessage() {} +func (*float32Value) String() string { return "float32" } + +type int64Value struct { + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *int64Value) Reset() { *m = int64Value{} } +func (*int64Value) ProtoMessage() {} +func (*int64Value) String() string { return "int64" } + +type uint64Value struct { + Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *uint64Value) Reset() { *m = uint64Value{} } +func (*uint64Value) ProtoMessage() {} +func (*uint64Value) String() string { return "uint64" } + +type int32Value struct { + Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *int32Value) Reset() { *m = int32Value{} } +func (*int32Value) ProtoMessage() {} +func (*int32Value) String() string { return "int32" } + +type uint32Value struct { + Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *uint32Value) Reset() { *m = uint32Value{} } +func (*uint32Value) ProtoMessage() {} +func (*uint32Value) String() string { return "uint32" } + +type boolValue struct { + Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *boolValue) Reset() { *m = boolValue{} } +func (*boolValue) ProtoMessage() {} +func (*boolValue) String() string { return "bool" } + +type stringValue struct { + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *stringValue) Reset() { *m = stringValue{} } +func (*stringValue) ProtoMessage() {} +func (*stringValue) String() string { return "string" } + +type bytesValue struct { + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *bytesValue) Reset() { *m = bytesValue{} } +func (*bytesValue) ProtoMessage() {} +func (*bytesValue) String() string { return "[]byte" } + +func init() { + RegisterType((*float64Value)(nil), "gogo.protobuf.proto.DoubleValue") + RegisterType((*float32Value)(nil), "gogo.protobuf.proto.FloatValue") + RegisterType((*int64Value)(nil), "gogo.protobuf.proto.Int64Value") + RegisterType((*uint64Value)(nil), "gogo.protobuf.proto.UInt64Value") + RegisterType((*int32Value)(nil), "gogo.protobuf.proto.Int32Value") + RegisterType((*uint32Value)(nil), "gogo.protobuf.proto.UInt32Value") + RegisterType((*boolValue)(nil), "gogo.protobuf.proto.BoolValue") + RegisterType((*stringValue)(nil), "gogo.protobuf.proto.StringValue") + RegisterType((*bytesValue)(nil), "gogo.protobuf.proto.BytesValue") +} diff --git a/integration-test/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go b/integration-test/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go new file mode 100644 index 000000000..ceadde6a5 --- /dev/null +++ b/integration-test/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go @@ -0,0 +1,101 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package sortkeys + +import ( + "sort" +) + +func Strings(l []string) { + sort.Strings(l) +} + +func Float64s(l []float64) { + sort.Float64s(l) +} + +func Float32s(l []float32) { + sort.Sort(Float32Slice(l)) +} + +func Int64s(l []int64) { + sort.Sort(Int64Slice(l)) +} + +func Int32s(l []int32) { + sort.Sort(Int32Slice(l)) +} + +func Uint64s(l []uint64) { + sort.Sort(Uint64Slice(l)) +} + +func Uint32s(l []uint32) { + sort.Sort(Uint32Slice(l)) +} + +func Bools(l []bool) { + sort.Sort(BoolSlice(l)) +} + +type BoolSlice []bool + +func (p BoolSlice) Len() int { return len(p) } +func (p BoolSlice) Less(i, j int) bool { return p[j] } +func (p BoolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Int64Slice []int64 + +func (p Int64Slice) Len() int { return len(p) } +func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Int32Slice []int32 + +func (p Int32Slice) Len() int { return len(p) } +func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Uint64Slice []uint64 + +func (p Uint64Slice) Len() int { return len(p) } +func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Uint32Slice []uint32 + +func (p Uint32Slice) Len() int { return len(p) } +func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Float32Slice []float32 + +func (p Float32Slice) Len() int { return len(p) } +func (p Float32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Float32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } diff --git a/integration-test/vendor/github.com/golang/groupcache/LICENSE b/integration-test/vendor/github.com/golang/groupcache/LICENSE new file mode 100644 index 000000000..37ec93a14 --- /dev/null +++ b/integration-test/vendor/github.com/golang/groupcache/LICENSE @@ -0,0 +1,191 @@ +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: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +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 +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. diff --git a/integration-test/vendor/github.com/golang/groupcache/lru/lru.go b/integration-test/vendor/github.com/golang/groupcache/lru/lru.go new file mode 100644 index 000000000..eac1c7664 --- /dev/null +++ b/integration-test/vendor/github.com/golang/groupcache/lru/lru.go @@ -0,0 +1,133 @@ +/* +Copyright 2013 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 lru implements an LRU cache. +package lru + +import "container/list" + +// Cache is an LRU cache. It is not safe for concurrent access. +type Cache struct { + // MaxEntries is the maximum number of cache entries before + // an item is evicted. Zero means no limit. + MaxEntries int + + // OnEvicted optionally specifies a callback function to be + // executed when an entry is purged from the cache. + OnEvicted func(key Key, value interface{}) + + ll *list.List + cache map[interface{}]*list.Element +} + +// A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators +type Key interface{} + +type entry struct { + key Key + value interface{} +} + +// New creates a new Cache. +// If maxEntries is zero, the cache has no limit and it's assumed +// that eviction is done by the caller. +func New(maxEntries int) *Cache { + return &Cache{ + MaxEntries: maxEntries, + ll: list.New(), + cache: make(map[interface{}]*list.Element), + } +} + +// Add adds a value to the cache. +func (c *Cache) Add(key Key, value interface{}) { + if c.cache == nil { + c.cache = make(map[interface{}]*list.Element) + c.ll = list.New() + } + if ee, ok := c.cache[key]; ok { + c.ll.MoveToFront(ee) + ee.Value.(*entry).value = value + return + } + ele := c.ll.PushFront(&entry{key, value}) + c.cache[key] = ele + if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries { + c.RemoveOldest() + } +} + +// Get looks up a key's value from the cache. +func (c *Cache) Get(key Key) (value interface{}, ok bool) { + if c.cache == nil { + return + } + if ele, hit := c.cache[key]; hit { + c.ll.MoveToFront(ele) + return ele.Value.(*entry).value, true + } + return +} + +// Remove removes the provided key from the cache. +func (c *Cache) Remove(key Key) { + if c.cache == nil { + return + } + if ele, hit := c.cache[key]; hit { + c.removeElement(ele) + } +} + +// RemoveOldest removes the oldest item from the cache. +func (c *Cache) RemoveOldest() { + if c.cache == nil { + return + } + ele := c.ll.Back() + if ele != nil { + c.removeElement(ele) + } +} + +func (c *Cache) removeElement(e *list.Element) { + c.ll.Remove(e) + kv := e.Value.(*entry) + delete(c.cache, kv.key) + if c.OnEvicted != nil { + c.OnEvicted(kv.key, kv.value) + } +} + +// Len returns the number of items in the cache. +func (c *Cache) Len() int { + if c.cache == nil { + return 0 + } + return c.ll.Len() +} + +// Clear purges all stored items from the cache. +func (c *Cache) Clear() { + if c.OnEvicted != nil { + for _, e := range c.cache { + kv := e.Value.(*entry) + c.OnEvicted(kv.key, kv.value) + } + } + c.ll = nil + c.cache = nil +} diff --git a/integration-test/vendor/github.com/golang/protobuf/AUTHORS b/integration-test/vendor/github.com/golang/protobuf/AUTHORS new file mode 100644 index 000000000..15167cd74 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/integration-test/vendor/github.com/golang/protobuf/CONTRIBUTORS b/integration-test/vendor/github.com/golang/protobuf/CONTRIBUTORS new file mode 100644 index 000000000..1c4577e96 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/integration-test/vendor/github.com/golang/protobuf/LICENSE b/integration-test/vendor/github.com/golang/protobuf/LICENSE new file mode 100644 index 000000000..0f646931a --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/LICENSE @@ -0,0 +1,28 @@ +Copyright 2010 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/buffer.go b/integration-test/vendor/github.com/golang/protobuf/proto/buffer.go new file mode 100644 index 000000000..e810e6fea --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/buffer.go @@ -0,0 +1,324 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "errors" + "fmt" + + "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + WireVarint = 0 + WireFixed32 = 5 + WireFixed64 = 1 + WireBytes = 2 + WireStartGroup = 3 + WireEndGroup = 4 +) + +// EncodeVarint returns the varint encoded bytes of v. +func EncodeVarint(v uint64) []byte { + return protowire.AppendVarint(nil, v) +} + +// SizeVarint returns the length of the varint encoded bytes of v. +// This is equal to len(EncodeVarint(v)). +func SizeVarint(v uint64) int { + return protowire.SizeVarint(v) +} + +// DecodeVarint parses a varint encoded integer from b, +// returning the integer value and the length of the varint. +// It returns (0, 0) if there is a parse error. +func DecodeVarint(b []byte) (uint64, int) { + v, n := protowire.ConsumeVarint(b) + if n < 0 { + return 0, 0 + } + return v, n +} + +// Buffer is a buffer for encoding and decoding the protobuf wire format. +// It may be reused between invocations to reduce memory usage. +type Buffer struct { + buf []byte + idx int + deterministic bool +} + +// NewBuffer allocates a new Buffer initialized with buf, +// where the contents of buf are considered the unread portion of the buffer. +func NewBuffer(buf []byte) *Buffer { + return &Buffer{buf: buf} +} + +// SetDeterministic specifies whether to use deterministic serialization. +// +// Deterministic serialization guarantees that for a given binary, equal +// messages will always be serialized to the same bytes. This implies: +// +// - Repeated serialization of a message will return the same bytes. +// - Different processes of the same binary (which may be executing on +// different machines) will serialize equal messages to the same bytes. +// +// Note that the deterministic serialization is NOT canonical across +// languages. It is not guaranteed to remain stable over time. It is unstable +// across different builds with schema changes due to unknown fields. +// Users who need canonical serialization (e.g., persistent storage in a +// canonical form, fingerprinting, etc.) should define their own +// canonicalization specification and implement their own serializer rather +// than relying on this API. +// +// If deterministic serialization is requested, map entries will be sorted +// by keys in lexographical order. This is an implementation detail and +// subject to change. +func (b *Buffer) SetDeterministic(deterministic bool) { + b.deterministic = deterministic +} + +// SetBuf sets buf as the internal buffer, +// where the contents of buf are considered the unread portion of the buffer. +func (b *Buffer) SetBuf(buf []byte) { + b.buf = buf + b.idx = 0 +} + +// Reset clears the internal buffer of all written and unread data. +func (b *Buffer) Reset() { + b.buf = b.buf[:0] + b.idx = 0 +} + +// Bytes returns the internal buffer. +func (b *Buffer) Bytes() []byte { + return b.buf +} + +// Unread returns the unread portion of the buffer. +func (b *Buffer) Unread() []byte { + return b.buf[b.idx:] +} + +// Marshal appends the wire-format encoding of m to the buffer. +func (b *Buffer) Marshal(m Message) error { + var err error + b.buf, err = marshalAppend(b.buf, m, b.deterministic) + return err +} + +// Unmarshal parses the wire-format message in the buffer and +// places the decoded results in m. +// It does not reset m before unmarshaling. +func (b *Buffer) Unmarshal(m Message) error { + err := UnmarshalMerge(b.Unread(), m) + b.idx = len(b.buf) + return err +} + +type unknownFields struct{ XXX_unrecognized protoimpl.UnknownFields } + +func (m *unknownFields) String() string { panic("not implemented") } +func (m *unknownFields) Reset() { panic("not implemented") } +func (m *unknownFields) ProtoMessage() { panic("not implemented") } + +// DebugPrint dumps the encoded bytes of b with a header and footer including s +// to stdout. This is only intended for debugging. +func (*Buffer) DebugPrint(s string, b []byte) { + m := MessageReflect(new(unknownFields)) + m.SetUnknown(b) + b, _ = prototext.MarshalOptions{AllowPartial: true, Indent: "\t"}.Marshal(m.Interface()) + fmt.Printf("==== %s ====\n%s==== %s ====\n", s, b, s) +} + +// EncodeVarint appends an unsigned varint encoding to the buffer. +func (b *Buffer) EncodeVarint(v uint64) error { + b.buf = protowire.AppendVarint(b.buf, v) + return nil +} + +// EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer. +func (b *Buffer) EncodeZigzag32(v uint64) error { + return b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) +} + +// EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer. +func (b *Buffer) EncodeZigzag64(v uint64) error { + return b.EncodeVarint(uint64((uint64(v) << 1) ^ uint64((int64(v) >> 63)))) +} + +// EncodeFixed32 appends a 32-bit little-endian integer to the buffer. +func (b *Buffer) EncodeFixed32(v uint64) error { + b.buf = protowire.AppendFixed32(b.buf, uint32(v)) + return nil +} + +// EncodeFixed64 appends a 64-bit little-endian integer to the buffer. +func (b *Buffer) EncodeFixed64(v uint64) error { + b.buf = protowire.AppendFixed64(b.buf, uint64(v)) + return nil +} + +// EncodeRawBytes appends a length-prefixed raw bytes to the buffer. +func (b *Buffer) EncodeRawBytes(v []byte) error { + b.buf = protowire.AppendBytes(b.buf, v) + return nil +} + +// EncodeStringBytes appends a length-prefixed raw bytes to the buffer. +// It does not validate whether v contains valid UTF-8. +func (b *Buffer) EncodeStringBytes(v string) error { + b.buf = protowire.AppendString(b.buf, v) + return nil +} + +// EncodeMessage appends a length-prefixed encoded message to the buffer. +func (b *Buffer) EncodeMessage(m Message) error { + var err error + b.buf = protowire.AppendVarint(b.buf, uint64(Size(m))) + b.buf, err = marshalAppend(b.buf, m, b.deterministic) + return err +} + +// DecodeVarint consumes an encoded unsigned varint from the buffer. +func (b *Buffer) DecodeVarint() (uint64, error) { + v, n := protowire.ConsumeVarint(b.buf[b.idx:]) + if n < 0 { + return 0, protowire.ParseError(n) + } + b.idx += n + return uint64(v), nil +} + +// DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer. +func (b *Buffer) DecodeZigzag32() (uint64, error) { + v, err := b.DecodeVarint() + if err != nil { + return 0, err + } + return uint64((uint32(v) >> 1) ^ uint32((int32(v&1)<<31)>>31)), nil +} + +// DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer. +func (b *Buffer) DecodeZigzag64() (uint64, error) { + v, err := b.DecodeVarint() + if err != nil { + return 0, err + } + return uint64((uint64(v) >> 1) ^ uint64((int64(v&1)<<63)>>63)), nil +} + +// DecodeFixed32 consumes a 32-bit little-endian integer from the buffer. +func (b *Buffer) DecodeFixed32() (uint64, error) { + v, n := protowire.ConsumeFixed32(b.buf[b.idx:]) + if n < 0 { + return 0, protowire.ParseError(n) + } + b.idx += n + return uint64(v), nil +} + +// DecodeFixed64 consumes a 64-bit little-endian integer from the buffer. +func (b *Buffer) DecodeFixed64() (uint64, error) { + v, n := protowire.ConsumeFixed64(b.buf[b.idx:]) + if n < 0 { + return 0, protowire.ParseError(n) + } + b.idx += n + return uint64(v), nil +} + +// DecodeRawBytes consumes a length-prefixed raw bytes from the buffer. +// If alloc is specified, it returns a copy the raw bytes +// rather than a sub-slice of the buffer. +func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) { + v, n := protowire.ConsumeBytes(b.buf[b.idx:]) + if n < 0 { + return nil, protowire.ParseError(n) + } + b.idx += n + if alloc { + v = append([]byte(nil), v...) + } + return v, nil +} + +// DecodeStringBytes consumes a length-prefixed raw bytes from the buffer. +// It does not validate whether the raw bytes contain valid UTF-8. +func (b *Buffer) DecodeStringBytes() (string, error) { + v, n := protowire.ConsumeString(b.buf[b.idx:]) + if n < 0 { + return "", protowire.ParseError(n) + } + b.idx += n + return v, nil +} + +// DecodeMessage consumes a length-prefixed message from the buffer. +// It does not reset m before unmarshaling. +func (b *Buffer) DecodeMessage(m Message) error { + v, err := b.DecodeRawBytes(false) + if err != nil { + return err + } + return UnmarshalMerge(v, m) +} + +// DecodeGroup consumes a message group from the buffer. +// It assumes that the start group marker has already been consumed and +// consumes all bytes until (and including the end group marker). +// It does not reset m before unmarshaling. +func (b *Buffer) DecodeGroup(m Message) error { + v, n, err := consumeGroup(b.buf[b.idx:]) + if err != nil { + return err + } + b.idx += n + return UnmarshalMerge(v, m) +} + +// consumeGroup parses b until it finds an end group marker, returning +// the raw bytes of the message (excluding the end group marker) and the +// the total length of the message (including the end group marker). +func consumeGroup(b []byte) ([]byte, int, error) { + b0 := b + depth := 1 // assume this follows a start group marker + for { + _, wtyp, tagLen := protowire.ConsumeTag(b) + if tagLen < 0 { + return nil, 0, protowire.ParseError(tagLen) + } + b = b[tagLen:] + + var valLen int + switch wtyp { + case protowire.VarintType: + _, valLen = protowire.ConsumeVarint(b) + case protowire.Fixed32Type: + _, valLen = protowire.ConsumeFixed32(b) + case protowire.Fixed64Type: + _, valLen = protowire.ConsumeFixed64(b) + case protowire.BytesType: + _, valLen = protowire.ConsumeBytes(b) + case protowire.StartGroupType: + depth++ + case protowire.EndGroupType: + depth-- + default: + return nil, 0, errors.New("proto: cannot parse reserved wire type") + } + if valLen < 0 { + return nil, 0, protowire.ParseError(valLen) + } + b = b[valLen:] + + if depth == 0 { + return b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil + } + } +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/defaults.go b/integration-test/vendor/github.com/golang/protobuf/proto/defaults.go new file mode 100644 index 000000000..d399bf069 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/defaults.go @@ -0,0 +1,63 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "google.golang.org/protobuf/reflect/protoreflect" +) + +// SetDefaults sets unpopulated scalar fields to their default values. +// Fields within a oneof are not set even if they have a default value. +// SetDefaults is recursively called upon any populated message fields. +func SetDefaults(m Message) { + if m != nil { + setDefaults(MessageReflect(m)) + } +} + +func setDefaults(m protoreflect.Message) { + fds := m.Descriptor().Fields() + for i := 0; i < fds.Len(); i++ { + fd := fds.Get(i) + if !m.Has(fd) { + if fd.HasDefault() && fd.ContainingOneof() == nil { + v := fd.Default() + if fd.Kind() == protoreflect.BytesKind { + v = protoreflect.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes + } + m.Set(fd, v) + } + continue + } + } + + m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + switch { + // Handle singular message. + case fd.Cardinality() != protoreflect.Repeated: + if fd.Message() != nil { + setDefaults(m.Get(fd).Message()) + } + // Handle list of messages. + case fd.IsList(): + if fd.Message() != nil { + ls := m.Get(fd).List() + for i := 0; i < ls.Len(); i++ { + setDefaults(ls.Get(i).Message()) + } + } + // Handle map of messages. + case fd.IsMap(): + if fd.MapValue().Message() != nil { + ms := m.Get(fd).Map() + ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { + setDefaults(v.Message()) + return true + }) + } + } + return true + }) +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/deprecated.go b/integration-test/vendor/github.com/golang/protobuf/proto/deprecated.go new file mode 100644 index 000000000..e8db57e09 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/deprecated.go @@ -0,0 +1,113 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "encoding/json" + "errors" + "fmt" + "strconv" + + protoV2 "google.golang.org/protobuf/proto" +) + +var ( + // Deprecated: No longer returned. + ErrNil = errors.New("proto: Marshal called with nil") + + // Deprecated: No longer returned. + ErrTooLarge = errors.New("proto: message encodes to over 2 GB") + + // Deprecated: No longer returned. + ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") +) + +// Deprecated: Do not use. +type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } + +// Deprecated: Do not use. +func GetStats() Stats { return Stats{} } + +// Deprecated: Do not use. +func MarshalMessageSet(interface{}) ([]byte, error) { + return nil, errors.New("proto: not implemented") +} + +// Deprecated: Do not use. +func UnmarshalMessageSet([]byte, interface{}) error { + return errors.New("proto: not implemented") +} + +// Deprecated: Do not use. +func MarshalMessageSetJSON(interface{}) ([]byte, error) { + return nil, errors.New("proto: not implemented") +} + +// Deprecated: Do not use. +func UnmarshalMessageSetJSON([]byte, interface{}) error { + return errors.New("proto: not implemented") +} + +// Deprecated: Do not use. +func RegisterMessageSetType(Message, int32, string) {} + +// Deprecated: Do not use. +func EnumName(m map[int32]string, v int32) string { + s, ok := m[v] + if ok { + return s + } + return strconv.Itoa(int(v)) +} + +// Deprecated: Do not use. +func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { + if data[0] == '"' { + // New style: enums are strings. + var repr string + if err := json.Unmarshal(data, &repr); err != nil { + return -1, err + } + val, ok := m[repr] + if !ok { + return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) + } + return val, nil + } + // Old style: enums are ints. + var val int32 + if err := json.Unmarshal(data, &val); err != nil { + return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) + } + return val, nil +} + +// Deprecated: Do not use; this type existed for intenal-use only. +type InternalMessageInfo struct{} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) DiscardUnknown(m Message) { + DiscardUnknown(m) +} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) Marshal(b []byte, m Message, deterministic bool) ([]byte, error) { + return protoV2.MarshalOptions{Deterministic: deterministic}.MarshalAppend(b, MessageV2(m)) +} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) Merge(dst, src Message) { + protoV2.Merge(MessageV2(dst), MessageV2(src)) +} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) Size(m Message) int { + return protoV2.Size(MessageV2(m)) +} + +// Deprecated: Do not use; this method existed for intenal-use only. +func (*InternalMessageInfo) Unmarshal(m Message, b []byte) error { + return protoV2.UnmarshalOptions{Merge: true}.Unmarshal(b, MessageV2(m)) +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/discard.go b/integration-test/vendor/github.com/golang/protobuf/proto/discard.go new file mode 100644 index 000000000..2187e877f --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/discard.go @@ -0,0 +1,58 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "google.golang.org/protobuf/reflect/protoreflect" +) + +// DiscardUnknown recursively discards all unknown fields from this message +// and all embedded messages. +// +// When unmarshaling a message with unrecognized fields, the tags and values +// of such fields are preserved in the Message. This allows a later call to +// marshal to be able to produce a message that continues to have those +// unrecognized fields. To avoid this, DiscardUnknown is used to +// explicitly clear the unknown fields after unmarshaling. +func DiscardUnknown(m Message) { + if m != nil { + discardUnknown(MessageReflect(m)) + } +} + +func discardUnknown(m protoreflect.Message) { + m.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool { + switch { + // Handle singular message. + case fd.Cardinality() != protoreflect.Repeated: + if fd.Message() != nil { + discardUnknown(m.Get(fd).Message()) + } + // Handle list of messages. + case fd.IsList(): + if fd.Message() != nil { + ls := m.Get(fd).List() + for i := 0; i < ls.Len(); i++ { + discardUnknown(ls.Get(i).Message()) + } + } + // Handle map of messages. + case fd.IsMap(): + if fd.MapValue().Message() != nil { + ms := m.Get(fd).Map() + ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { + discardUnknown(v.Message()) + return true + }) + } + } + return true + }) + + // Discard unknown fields. + if len(m.GetUnknown()) > 0 { + m.SetUnknown(nil) + } +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/extensions.go b/integration-test/vendor/github.com/golang/protobuf/proto/extensions.go new file mode 100644 index 000000000..42fc120c9 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/extensions.go @@ -0,0 +1,356 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "errors" + "fmt" + "reflect" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoiface" + "google.golang.org/protobuf/runtime/protoimpl" +) + +type ( + // ExtensionDesc represents an extension descriptor and + // is used to interact with an extension field in a message. + // + // Variables of this type are generated in code by protoc-gen-go. + ExtensionDesc = protoimpl.ExtensionInfo + + // ExtensionRange represents a range of message extensions. + // Used in code generated by protoc-gen-go. + ExtensionRange = protoiface.ExtensionRangeV1 + + // Deprecated: Do not use; this is an internal type. + Extension = protoimpl.ExtensionFieldV1 + + // Deprecated: Do not use; this is an internal type. + XXX_InternalExtensions = protoimpl.ExtensionFields +) + +// ErrMissingExtension reports whether the extension was not present. +var ErrMissingExtension = errors.New("proto: missing extension") + +var errNotExtendable = errors.New("proto: not an extendable proto.Message") + +// HasExtension reports whether the extension field is present in m +// either as an explicitly populated field or as an unknown field. +func HasExtension(m Message, xt *ExtensionDesc) (has bool) { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() { + return false + } + + // Check whether any populated known field matches the field number. + xtd := xt.TypeDescriptor() + if isValidExtension(mr.Descriptor(), xtd) { + has = mr.Has(xtd) + } else { + mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { + has = int32(fd.Number()) == xt.Field + return !has + }) + } + + // Check whether any unknown field matches the field number. + for b := mr.GetUnknown(); !has && len(b) > 0; { + num, _, n := protowire.ConsumeField(b) + has = int32(num) == xt.Field + b = b[n:] + } + return has +} + +// ClearExtension removes the extension field from m +// either as an explicitly populated field or as an unknown field. +func ClearExtension(m Message, xt *ExtensionDesc) { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() { + return + } + + xtd := xt.TypeDescriptor() + if isValidExtension(mr.Descriptor(), xtd) { + mr.Clear(xtd) + } else { + mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { + if int32(fd.Number()) == xt.Field { + mr.Clear(fd) + return false + } + return true + }) + } + clearUnknown(mr, fieldNum(xt.Field)) +} + +// ClearAllExtensions clears all extensions from m. +// This includes populated fields and unknown fields in the extension range. +func ClearAllExtensions(m Message) { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() { + return + } + + mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { + if fd.IsExtension() { + mr.Clear(fd) + } + return true + }) + clearUnknown(mr, mr.Descriptor().ExtensionRanges()) +} + +// GetExtension retrieves a proto2 extended field from m. +// +// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), +// then GetExtension parses the encoded field and returns a Go value of the specified type. +// If the field is not present, then the default value is returned (if one is specified), +// otherwise ErrMissingExtension is reported. +// +// If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil), +// then GetExtension returns the raw encoded bytes for the extension field. +func GetExtension(m Message, xt *ExtensionDesc) (interface{}, error) { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { + return nil, errNotExtendable + } + + // Retrieve the unknown fields for this extension field. + var bo protoreflect.RawFields + for bi := mr.GetUnknown(); len(bi) > 0; { + num, _, n := protowire.ConsumeField(bi) + if int32(num) == xt.Field { + bo = append(bo, bi[:n]...) + } + bi = bi[n:] + } + + // For type incomplete descriptors, only retrieve the unknown fields. + if xt.ExtensionType == nil { + return []byte(bo), nil + } + + // If the extension field only exists as unknown fields, unmarshal it. + // This is rarely done since proto.Unmarshal eagerly unmarshals extensions. + xtd := xt.TypeDescriptor() + if !isValidExtension(mr.Descriptor(), xtd) { + return nil, fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) + } + if !mr.Has(xtd) && len(bo) > 0 { + m2 := mr.New() + if err := (proto.UnmarshalOptions{ + Resolver: extensionResolver{xt}, + }.Unmarshal(bo, m2.Interface())); err != nil { + return nil, err + } + if m2.Has(xtd) { + mr.Set(xtd, m2.Get(xtd)) + clearUnknown(mr, fieldNum(xt.Field)) + } + } + + // Check whether the message has the extension field set or a default. + var pv protoreflect.Value + switch { + case mr.Has(xtd): + pv = mr.Get(xtd) + case xtd.HasDefault(): + pv = xtd.Default() + default: + return nil, ErrMissingExtension + } + + v := xt.InterfaceOf(pv) + rv := reflect.ValueOf(v) + if isScalarKind(rv.Kind()) { + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + v = rv2.Interface() + } + return v, nil +} + +// extensionResolver is a custom extension resolver that stores a single +// extension type that takes precedence over the global registry. +type extensionResolver struct{ xt protoreflect.ExtensionType } + +func (r extensionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { + if xtd := r.xt.TypeDescriptor(); xtd.FullName() == field { + return r.xt, nil + } + return protoregistry.GlobalTypes.FindExtensionByName(field) +} + +func (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { + if xtd := r.xt.TypeDescriptor(); xtd.ContainingMessage().FullName() == message && xtd.Number() == field { + return r.xt, nil + } + return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) +} + +// GetExtensions returns a list of the extensions values present in m, +// corresponding with the provided list of extension descriptors, xts. +// If an extension is missing in m, the corresponding value is nil. +func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() { + return nil, errNotExtendable + } + + vs := make([]interface{}, len(xts)) + for i, xt := range xts { + v, err := GetExtension(m, xt) + if err != nil { + if err == ErrMissingExtension { + continue + } + return vs, err + } + vs[i] = v + } + return vs, nil +} + +// SetExtension sets an extension field in m to the provided value. +func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { + return errNotExtendable + } + + rv := reflect.ValueOf(v) + if reflect.TypeOf(v) != reflect.TypeOf(xt.ExtensionType) { + return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", v, xt.ExtensionType) + } + if rv.Kind() == reflect.Ptr { + if rv.IsNil() { + return fmt.Errorf("proto: SetExtension called with nil value of type %T", v) + } + if isScalarKind(rv.Elem().Kind()) { + v = rv.Elem().Interface() + } + } + + xtd := xt.TypeDescriptor() + if !isValidExtension(mr.Descriptor(), xtd) { + return fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) + } + mr.Set(xtd, xt.ValueOf(v)) + clearUnknown(mr, fieldNum(xt.Field)) + return nil +} + +// SetRawExtension inserts b into the unknown fields of m. +// +// Deprecated: Use Message.ProtoReflect.SetUnknown instead. +func SetRawExtension(m Message, fnum int32, b []byte) { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() { + return + } + + // Verify that the raw field is valid. + for b0 := b; len(b0) > 0; { + num, _, n := protowire.ConsumeField(b0) + if int32(num) != fnum { + panic(fmt.Sprintf("mismatching field number: got %d, want %d", num, fnum)) + } + b0 = b0[n:] + } + + ClearExtension(m, &ExtensionDesc{Field: fnum}) + mr.SetUnknown(append(mr.GetUnknown(), b...)) +} + +// ExtensionDescs returns a list of extension descriptors found in m, +// containing descriptors for both populated extension fields in m and +// also unknown fields of m that are in the extension range. +// For the later case, an type incomplete descriptor is provided where only +// the ExtensionDesc.Field field is populated. +// The order of the extension descriptors is undefined. +func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { + return nil, errNotExtendable + } + + // Collect a set of known extension descriptors. + extDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc) + mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + if fd.IsExtension() { + xt := fd.(protoreflect.ExtensionTypeDescriptor) + if xd, ok := xt.Type().(*ExtensionDesc); ok { + extDescs[fd.Number()] = xd + } + } + return true + }) + + // Collect a set of unknown extension descriptors. + extRanges := mr.Descriptor().ExtensionRanges() + for b := mr.GetUnknown(); len(b) > 0; { + num, _, n := protowire.ConsumeField(b) + if extRanges.Has(num) && extDescs[num] == nil { + extDescs[num] = nil + } + b = b[n:] + } + + // Transpose the set of descriptors into a list. + var xts []*ExtensionDesc + for num, xt := range extDescs { + if xt == nil { + xt = &ExtensionDesc{Field: int32(num)} + } + xts = append(xts, xt) + } + return xts, nil +} + +// isValidExtension reports whether xtd is a valid extension descriptor for md. +func isValidExtension(md protoreflect.MessageDescriptor, xtd protoreflect.ExtensionTypeDescriptor) bool { + return xtd.ContainingMessage() == md && md.ExtensionRanges().Has(xtd.Number()) +} + +// isScalarKind reports whether k is a protobuf scalar kind (except bytes). +// This function exists for historical reasons since the representation of +// scalars differs between v1 and v2, where v1 uses *T and v2 uses T. +func isScalarKind(k reflect.Kind) bool { + switch k { + case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: + return true + default: + return false + } +} + +// clearUnknown removes unknown fields from m where remover.Has reports true. +func clearUnknown(m protoreflect.Message, remover interface { + Has(protoreflect.FieldNumber) bool +}) { + var bo protoreflect.RawFields + for bi := m.GetUnknown(); len(bi) > 0; { + num, _, n := protowire.ConsumeField(bi) + if !remover.Has(num) { + bo = append(bo, bi[:n]...) + } + bi = bi[n:] + } + if bi := m.GetUnknown(); len(bi) != len(bo) { + m.SetUnknown(bo) + } +} + +type fieldNum protoreflect.FieldNumber + +func (n1 fieldNum) Has(n2 protoreflect.FieldNumber) bool { + return protoreflect.FieldNumber(n1) == n2 +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/properties.go b/integration-test/vendor/github.com/golang/protobuf/proto/properties.go new file mode 100644 index 000000000..dcdc2202f --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/properties.go @@ -0,0 +1,306 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "fmt" + "reflect" + "strconv" + "strings" + "sync" + + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoimpl" +) + +// StructProperties represents protocol buffer type information for a +// generated protobuf message in the open-struct API. +// +// Deprecated: Do not use. +type StructProperties struct { + // Prop are the properties for each field. + // + // Fields belonging to a oneof are stored in OneofTypes instead, with a + // single Properties representing the parent oneof held here. + // + // The order of Prop matches the order of fields in the Go struct. + // Struct fields that are not related to protobufs have a "XXX_" prefix + // in the Properties.Name and must be ignored by the user. + Prop []*Properties + + // OneofTypes contains information about the oneof fields in this message. + // It is keyed by the protobuf field name. + OneofTypes map[string]*OneofProperties +} + +// Properties represents the type information for a protobuf message field. +// +// Deprecated: Do not use. +type Properties struct { + // Name is a placeholder name with little meaningful semantic value. + // If the name has an "XXX_" prefix, the entire Properties must be ignored. + Name string + // OrigName is the protobuf field name or oneof name. + OrigName string + // JSONName is the JSON name for the protobuf field. + JSONName string + // Enum is a placeholder name for enums. + // For historical reasons, this is neither the Go name for the enum, + // nor the protobuf name for the enum. + Enum string // Deprecated: Do not use. + // Weak contains the full name of the weakly referenced message. + Weak string + // Wire is a string representation of the wire type. + Wire string + // WireType is the protobuf wire type for the field. + WireType int + // Tag is the protobuf field number. + Tag int + // Required reports whether this is a required field. + Required bool + // Optional reports whether this is a optional field. + Optional bool + // Repeated reports whether this is a repeated field. + Repeated bool + // Packed reports whether this is a packed repeated field of scalars. + Packed bool + // Proto3 reports whether this field operates under the proto3 syntax. + Proto3 bool + // Oneof reports whether this field belongs within a oneof. + Oneof bool + + // Default is the default value in string form. + Default string + // HasDefault reports whether the field has a default value. + HasDefault bool + + // MapKeyProp is the properties for the key field for a map field. + MapKeyProp *Properties + // MapValProp is the properties for the value field for a map field. + MapValProp *Properties +} + +// OneofProperties represents the type information for a protobuf oneof. +// +// Deprecated: Do not use. +type OneofProperties struct { + // Type is a pointer to the generated wrapper type for the field value. + // This is nil for messages that are not in the open-struct API. + Type reflect.Type + // Field is the index into StructProperties.Prop for the containing oneof. + Field int + // Prop is the properties for the field. + Prop *Properties +} + +// String formats the properties in the protobuf struct field tag style. +func (p *Properties) String() string { + s := p.Wire + s += "," + strconv.Itoa(p.Tag) + if p.Required { + s += ",req" + } + if p.Optional { + s += ",opt" + } + if p.Repeated { + s += ",rep" + } + if p.Packed { + s += ",packed" + } + s += ",name=" + p.OrigName + if p.JSONName != "" { + s += ",json=" + p.JSONName + } + if len(p.Enum) > 0 { + s += ",enum=" + p.Enum + } + if len(p.Weak) > 0 { + s += ",weak=" + p.Weak + } + if p.Proto3 { + s += ",proto3" + } + if p.Oneof { + s += ",oneof" + } + if p.HasDefault { + s += ",def=" + p.Default + } + return s +} + +// Parse populates p by parsing a string in the protobuf struct field tag style. +func (p *Properties) Parse(tag string) { + // For example: "bytes,49,opt,name=foo,def=hello!" + for len(tag) > 0 { + i := strings.IndexByte(tag, ',') + if i < 0 { + i = len(tag) + } + switch s := tag[:i]; { + case strings.HasPrefix(s, "name="): + p.OrigName = s[len("name="):] + case strings.HasPrefix(s, "json="): + p.JSONName = s[len("json="):] + case strings.HasPrefix(s, "enum="): + p.Enum = s[len("enum="):] + case strings.HasPrefix(s, "weak="): + p.Weak = s[len("weak="):] + case strings.Trim(s, "0123456789") == "": + n, _ := strconv.ParseUint(s, 10, 32) + p.Tag = int(n) + case s == "opt": + p.Optional = true + case s == "req": + p.Required = true + case s == "rep": + p.Repeated = true + case s == "varint" || s == "zigzag32" || s == "zigzag64": + p.Wire = s + p.WireType = WireVarint + case s == "fixed32": + p.Wire = s + p.WireType = WireFixed32 + case s == "fixed64": + p.Wire = s + p.WireType = WireFixed64 + case s == "bytes": + p.Wire = s + p.WireType = WireBytes + case s == "group": + p.Wire = s + p.WireType = WireStartGroup + case s == "packed": + p.Packed = true + case s == "proto3": + p.Proto3 = true + case s == "oneof": + p.Oneof = true + case strings.HasPrefix(s, "def="): + // The default tag is special in that everything afterwards is the + // default regardless of the presence of commas. + p.HasDefault = true + p.Default, i = tag[len("def="):], len(tag) + } + tag = strings.TrimPrefix(tag[i:], ",") + } +} + +// Init populates the properties from a protocol buffer struct tag. +// +// Deprecated: Do not use. +func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { + p.Name = name + p.OrigName = name + if tag == "" { + return + } + p.Parse(tag) + + if typ != nil && typ.Kind() == reflect.Map { + p.MapKeyProp = new(Properties) + p.MapKeyProp.Init(nil, "Key", f.Tag.Get("protobuf_key"), nil) + p.MapValProp = new(Properties) + p.MapValProp.Init(nil, "Value", f.Tag.Get("protobuf_val"), nil) + } +} + +var propertiesCache sync.Map // map[reflect.Type]*StructProperties + +// GetProperties returns the list of properties for the type represented by t, +// which must be a generated protocol buffer message in the open-struct API, +// where protobuf message fields are represented by exported Go struct fields. +// +// Deprecated: Use protobuf reflection instead. +func GetProperties(t reflect.Type) *StructProperties { + if p, ok := propertiesCache.Load(t); ok { + return p.(*StructProperties) + } + p, _ := propertiesCache.LoadOrStore(t, newProperties(t)) + return p.(*StructProperties) +} + +func newProperties(t reflect.Type) *StructProperties { + if t.Kind() != reflect.Struct { + panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) + } + + var hasOneof bool + prop := new(StructProperties) + + // Construct a list of properties for each field in the struct. + for i := 0; i < t.NumField(); i++ { + p := new(Properties) + f := t.Field(i) + tagField := f.Tag.Get("protobuf") + p.Init(f.Type, f.Name, tagField, &f) + + tagOneof := f.Tag.Get("protobuf_oneof") + if tagOneof != "" { + hasOneof = true + p.OrigName = tagOneof + } + + // Rename unrelated struct fields with the "XXX_" prefix since so much + // user code simply checks for this to exclude special fields. + if tagField == "" && tagOneof == "" && !strings.HasPrefix(p.Name, "XXX_") { + p.Name = "XXX_" + p.Name + p.OrigName = "XXX_" + p.OrigName + } else if p.Weak != "" { + p.Name = p.OrigName // avoid possible "XXX_" prefix on weak field + } + + prop.Prop = append(prop.Prop, p) + } + + // Construct a mapping of oneof field names to properties. + if hasOneof { + var oneofWrappers []interface{} + if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { + oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) + } + if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { + oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) + } + if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoreflect.ProtoMessage); ok { + if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { + oneofWrappers = m.ProtoMessageInfo().OneofWrappers + } + } + + prop.OneofTypes = make(map[string]*OneofProperties) + for _, wrapper := range oneofWrappers { + p := &OneofProperties{ + Type: reflect.ValueOf(wrapper).Type(), // *T + Prop: new(Properties), + } + f := p.Type.Elem().Field(0) + p.Prop.Name = f.Name + p.Prop.Parse(f.Tag.Get("protobuf")) + + // Determine the struct field that contains this oneof. + // Each wrapper is assignable to exactly one parent field. + var foundOneof bool + for i := 0; i < t.NumField() && !foundOneof; i++ { + if p.Type.AssignableTo(t.Field(i).Type) { + p.Field = i + foundOneof = true + } + } + if !foundOneof { + panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) + } + prop.OneofTypes[p.Prop.OrigName] = p + } + } + + return prop +} + +func (sp *StructProperties) Len() int { return len(sp.Prop) } +func (sp *StructProperties) Less(i, j int) bool { return false } +func (sp *StructProperties) Swap(i, j int) { return } diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/proto.go b/integration-test/vendor/github.com/golang/protobuf/proto/proto.go new file mode 100644 index 000000000..5aee89c32 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/proto.go @@ -0,0 +1,167 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package proto provides functionality for handling protocol buffer messages. +// In particular, it provides marshaling and unmarshaling between a protobuf +// message and the binary wire format. +// +// See https://developers.google.com/protocol-buffers/docs/gotutorial for +// more information. +// +// Deprecated: Use the "google.golang.org/protobuf/proto" package instead. +package proto + +import ( + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoiface" + "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + ProtoPackageIsVersion1 = true + ProtoPackageIsVersion2 = true + ProtoPackageIsVersion3 = true + ProtoPackageIsVersion4 = true +) + +// GeneratedEnum is any enum type generated by protoc-gen-go +// which is a named int32 kind. +// This type exists for documentation purposes. +type GeneratedEnum interface{} + +// GeneratedMessage is any message type generated by protoc-gen-go +// which is a pointer to a named struct kind. +// This type exists for documentation purposes. +type GeneratedMessage interface{} + +// Message is a protocol buffer message. +// +// This is the v1 version of the message interface and is marginally better +// than an empty interface as it lacks any method to programatically interact +// with the contents of the message. +// +// A v2 message is declared in "google.golang.org/protobuf/proto".Message and +// exposes protobuf reflection as a first-class feature of the interface. +// +// To convert a v1 message to a v2 message, use the MessageV2 function. +// To convert a v2 message to a v1 message, use the MessageV1 function. +type Message = protoiface.MessageV1 + +// MessageV1 converts either a v1 or v2 message to a v1 message. +// It returns nil if m is nil. +func MessageV1(m GeneratedMessage) protoiface.MessageV1 { + return protoimpl.X.ProtoMessageV1Of(m) +} + +// MessageV2 converts either a v1 or v2 message to a v2 message. +// It returns nil if m is nil. +func MessageV2(m GeneratedMessage) protoV2.Message { + return protoimpl.X.ProtoMessageV2Of(m) +} + +// MessageReflect returns a reflective view for a message. +// It returns nil if m is nil. +func MessageReflect(m Message) protoreflect.Message { + return protoimpl.X.MessageOf(m) +} + +// Marshaler is implemented by messages that can marshal themselves. +// This interface is used by the following functions: Size, Marshal, +// Buffer.Marshal, and Buffer.EncodeMessage. +// +// Deprecated: Do not implement. +type Marshaler interface { + // Marshal formats the encoded bytes of the message. + // It should be deterministic and emit valid protobuf wire data. + // The caller takes ownership of the returned buffer. + Marshal() ([]byte, error) +} + +// Unmarshaler is implemented by messages that can unmarshal themselves. +// This interface is used by the following functions: Unmarshal, UnmarshalMerge, +// Buffer.Unmarshal, Buffer.DecodeMessage, and Buffer.DecodeGroup. +// +// Deprecated: Do not implement. +type Unmarshaler interface { + // Unmarshal parses the encoded bytes of the protobuf wire input. + // The provided buffer is only valid for during method call. + // It should not reset the receiver message. + Unmarshal([]byte) error +} + +// Merger is implemented by messages that can merge themselves. +// This interface is used by the following functions: Clone and Merge. +// +// Deprecated: Do not implement. +type Merger interface { + // Merge merges the contents of src into the receiver message. + // It clones all data structures in src such that it aliases no mutable + // memory referenced by src. + Merge(src Message) +} + +// RequiredNotSetError is an error type returned when +// marshaling or unmarshaling a message with missing required fields. +type RequiredNotSetError struct { + err error +} + +func (e *RequiredNotSetError) Error() string { + if e.err != nil { + return e.err.Error() + } + return "proto: required field not set" +} +func (e *RequiredNotSetError) RequiredNotSet() bool { + return true +} + +func checkRequiredNotSet(m protoV2.Message) error { + if err := protoV2.CheckInitialized(m); err != nil { + return &RequiredNotSetError{err: err} + } + return nil +} + +// Clone returns a deep copy of src. +func Clone(src Message) Message { + return MessageV1(protoV2.Clone(MessageV2(src))) +} + +// Merge merges src into dst, which must be messages of the same type. +// +// Populated scalar fields in src are copied to dst, while populated +// singular messages in src are merged into dst by recursively calling Merge. +// The elements of every list field in src is appended to the corresponded +// list fields in dst. The entries of every map field in src is copied into +// the corresponding map field in dst, possibly replacing existing entries. +// The unknown fields of src are appended to the unknown fields of dst. +func Merge(dst, src Message) { + protoV2.Merge(MessageV2(dst), MessageV2(src)) +} + +// Equal reports whether two messages are equal. +// If two messages marshal to the same bytes under deterministic serialization, +// then Equal is guaranteed to report true. +// +// Two messages are equal if they are the same protobuf message type, +// have the same set of populated known and extension field values, +// and the same set of unknown fields values. +// +// Scalar values are compared with the equivalent of the == operator in Go, +// except bytes values which are compared using bytes.Equal and +// floating point values which specially treat NaNs as equal. +// Message values are compared by recursively calling Equal. +// Lists are equal if each element value is also equal. +// Maps are equal if they have the same set of keys, where the pair of values +// for each key is also equal. +func Equal(x, y Message) bool { + return protoV2.Equal(MessageV2(x), MessageV2(y)) +} + +func isMessageSet(md protoreflect.MessageDescriptor) bool { + ms, ok := md.(interface{ IsMessageSet() bool }) + return ok && ms.IsMessageSet() +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/registry.go b/integration-test/vendor/github.com/golang/protobuf/proto/registry.go new file mode 100644 index 000000000..066b4323b --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/registry.go @@ -0,0 +1,317 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "bytes" + "compress/gzip" + "fmt" + "io/ioutil" + "reflect" + "strings" + "sync" + + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" +) + +// filePath is the path to the proto source file. +type filePath = string // e.g., "google/protobuf/descriptor.proto" + +// fileDescGZIP is the compressed contents of the encoded FileDescriptorProto. +type fileDescGZIP = []byte + +var fileCache sync.Map // map[filePath]fileDescGZIP + +// RegisterFile is called from generated code to register the compressed +// FileDescriptorProto with the file path for a proto source file. +// +// Deprecated: Use protoregistry.GlobalFiles.RegisterFile instead. +func RegisterFile(s filePath, d fileDescGZIP) { + // Decompress the descriptor. + zr, err := gzip.NewReader(bytes.NewReader(d)) + if err != nil { + panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) + } + b, err := ioutil.ReadAll(zr) + if err != nil { + panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) + } + + // Construct a protoreflect.FileDescriptor from the raw descriptor. + // Note that DescBuilder.Build automatically registers the constructed + // file descriptor with the v2 registry. + protoimpl.DescBuilder{RawDescriptor: b}.Build() + + // Locally cache the raw descriptor form for the file. + fileCache.Store(s, d) +} + +// FileDescriptor returns the compressed FileDescriptorProto given the file path +// for a proto source file. It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalFiles.FindFileByPath instead. +func FileDescriptor(s filePath) fileDescGZIP { + if v, ok := fileCache.Load(s); ok { + return v.(fileDescGZIP) + } + + // Find the descriptor in the v2 registry. + var b []byte + if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { + b, _ = Marshal(protodesc.ToFileDescriptorProto(fd)) + } + + // Locally cache the raw descriptor form for the file. + if len(b) > 0 { + v, _ := fileCache.LoadOrStore(s, protoimpl.X.CompressGZIP(b)) + return v.(fileDescGZIP) + } + return nil +} + +// enumName is the name of an enum. For historical reasons, the enum name is +// neither the full Go name nor the full protobuf name of the enum. +// The name is the dot-separated combination of just the proto package that the +// enum is declared within followed by the Go type name of the generated enum. +type enumName = string // e.g., "my.proto.package.GoMessage_GoEnum" + +// enumsByName maps enum values by name to their numeric counterpart. +type enumsByName = map[string]int32 + +// enumsByNumber maps enum values by number to their name counterpart. +type enumsByNumber = map[int32]string + +var enumCache sync.Map // map[enumName]enumsByName +var numFilesCache sync.Map // map[protoreflect.FullName]int + +// RegisterEnum is called from the generated code to register the mapping of +// enum value names to enum numbers for the enum identified by s. +// +// Deprecated: Use protoregistry.GlobalTypes.RegisterEnum instead. +func RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) { + if _, ok := enumCache.Load(s); ok { + panic("proto: duplicate enum registered: " + s) + } + enumCache.Store(s, m) + + // This does not forward registration to the v2 registry since this API + // lacks sufficient information to construct a complete v2 enum descriptor. +} + +// EnumValueMap returns the mapping from enum value names to enum numbers for +// the enum of the given name. It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalTypes.FindEnumByName instead. +func EnumValueMap(s enumName) enumsByName { + if v, ok := enumCache.Load(s); ok { + return v.(enumsByName) + } + + // Check whether the cache is stale. If the number of files in the current + // package differs, then it means that some enums may have been recently + // registered upstream that we do not know about. + var protoPkg protoreflect.FullName + if i := strings.LastIndexByte(s, '.'); i >= 0 { + protoPkg = protoreflect.FullName(s[:i]) + } + v, _ := numFilesCache.Load(protoPkg) + numFiles, _ := v.(int) + if protoregistry.GlobalFiles.NumFilesByPackage(protoPkg) == numFiles { + return nil // cache is up-to-date; was not found earlier + } + + // Update the enum cache for all enums declared in the given proto package. + numFiles = 0 + protoregistry.GlobalFiles.RangeFilesByPackage(protoPkg, func(fd protoreflect.FileDescriptor) bool { + walkEnums(fd, func(ed protoreflect.EnumDescriptor) { + name := protoimpl.X.LegacyEnumName(ed) + if _, ok := enumCache.Load(name); !ok { + m := make(enumsByName) + evs := ed.Values() + for i := evs.Len() - 1; i >= 0; i-- { + ev := evs.Get(i) + m[string(ev.Name())] = int32(ev.Number()) + } + enumCache.LoadOrStore(name, m) + } + }) + numFiles++ + return true + }) + numFilesCache.Store(protoPkg, numFiles) + + // Check cache again for enum map. + if v, ok := enumCache.Load(s); ok { + return v.(enumsByName) + } + return nil +} + +// walkEnums recursively walks all enums declared in d. +func walkEnums(d interface { + Enums() protoreflect.EnumDescriptors + Messages() protoreflect.MessageDescriptors +}, f func(protoreflect.EnumDescriptor)) { + eds := d.Enums() + for i := eds.Len() - 1; i >= 0; i-- { + f(eds.Get(i)) + } + mds := d.Messages() + for i := mds.Len() - 1; i >= 0; i-- { + walkEnums(mds.Get(i), f) + } +} + +// messageName is the full name of protobuf message. +type messageName = string + +var messageTypeCache sync.Map // map[messageName]reflect.Type + +// RegisterType is called from generated code to register the message Go type +// for a message of the given name. +// +// Deprecated: Use protoregistry.GlobalTypes.RegisterMessage instead. +func RegisterType(m Message, s messageName) { + mt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s)) + if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil { + panic(err) + } + messageTypeCache.Store(s, reflect.TypeOf(m)) +} + +// RegisterMapType is called from generated code to register the Go map type +// for a protobuf message representing a map entry. +// +// Deprecated: Do not use. +func RegisterMapType(m interface{}, s messageName) { + t := reflect.TypeOf(m) + if t.Kind() != reflect.Map { + panic(fmt.Sprintf("invalid map kind: %v", t)) + } + if _, ok := messageTypeCache.Load(s); ok { + panic(fmt.Errorf("proto: duplicate proto message registered: %s", s)) + } + messageTypeCache.Store(s, t) +} + +// MessageType returns the message type for a named message. +// It returns nil if not found. +// +// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead. +func MessageType(s messageName) reflect.Type { + if v, ok := messageTypeCache.Load(s); ok { + return v.(reflect.Type) + } + + // Derive the message type from the v2 registry. + var t reflect.Type + if mt, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(s)); mt != nil { + t = messageGoType(mt) + } + + // If we could not get a concrete type, it is possible that it is a + // pseudo-message for a map entry. + if t == nil { + d, _ := protoregistry.GlobalFiles.FindDescriptorByName(protoreflect.FullName(s)) + if md, _ := d.(protoreflect.MessageDescriptor); md != nil && md.IsMapEntry() { + kt := goTypeForField(md.Fields().ByNumber(1)) + vt := goTypeForField(md.Fields().ByNumber(2)) + t = reflect.MapOf(kt, vt) + } + } + + // Locally cache the message type for the given name. + if t != nil { + v, _ := messageTypeCache.LoadOrStore(s, t) + return v.(reflect.Type) + } + return nil +} + +func goTypeForField(fd protoreflect.FieldDescriptor) reflect.Type { + switch k := fd.Kind(); k { + case protoreflect.EnumKind: + if et, _ := protoregistry.GlobalTypes.FindEnumByName(fd.Enum().FullName()); et != nil { + return enumGoType(et) + } + return reflect.TypeOf(protoreflect.EnumNumber(0)) + case protoreflect.MessageKind, protoreflect.GroupKind: + if mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName()); mt != nil { + return messageGoType(mt) + } + return reflect.TypeOf((*protoreflect.Message)(nil)).Elem() + default: + return reflect.TypeOf(fd.Default().Interface()) + } +} + +func enumGoType(et protoreflect.EnumType) reflect.Type { + return reflect.TypeOf(et.New(0)) +} + +func messageGoType(mt protoreflect.MessageType) reflect.Type { + return reflect.TypeOf(MessageV1(mt.Zero().Interface())) +} + +// MessageName returns the full protobuf name for the given message type. +// +// Deprecated: Use protoreflect.MessageDescriptor.FullName instead. +func MessageName(m Message) messageName { + if m == nil { + return "" + } + if m, ok := m.(interface{ XXX_MessageName() messageName }); ok { + return m.XXX_MessageName() + } + return messageName(protoimpl.X.MessageDescriptorOf(m).FullName()) +} + +// RegisterExtension is called from the generated code to register +// the extension descriptor. +// +// Deprecated: Use protoregistry.GlobalTypes.RegisterExtension instead. +func RegisterExtension(d *ExtensionDesc) { + if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil { + panic(err) + } +} + +type extensionsByNumber = map[int32]*ExtensionDesc + +var extensionCache sync.Map // map[messageName]extensionsByNumber + +// RegisteredExtensions returns a map of the registered extensions for the +// provided protobuf message, indexed by the extension field number. +// +// Deprecated: Use protoregistry.GlobalTypes.RangeExtensionsByMessage instead. +func RegisteredExtensions(m Message) extensionsByNumber { + // Check whether the cache is stale. If the number of extensions for + // the given message differs, then it means that some extensions were + // recently registered upstream that we do not know about. + s := MessageName(m) + v, _ := extensionCache.Load(s) + xs, _ := v.(extensionsByNumber) + if protoregistry.GlobalTypes.NumExtensionsByMessage(protoreflect.FullName(s)) == len(xs) { + return xs // cache is up-to-date + } + + // Cache is stale, re-compute the extensions map. + xs = make(extensionsByNumber) + protoregistry.GlobalTypes.RangeExtensionsByMessage(protoreflect.FullName(s), func(xt protoreflect.ExtensionType) bool { + if xd, ok := xt.(*ExtensionDesc); ok { + xs[int32(xt.TypeDescriptor().Number())] = xd + } else { + // TODO: This implies that the protoreflect.ExtensionType is a + // custom type not generated by protoc-gen-go. We could try and + // convert the type to an ExtensionDesc. + } + return true + }) + extensionCache.Store(s, xs) + return xs +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/text_decode.go b/integration-test/vendor/github.com/golang/protobuf/proto/text_decode.go new file mode 100644 index 000000000..47eb3e445 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/text_decode.go @@ -0,0 +1,801 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "encoding" + "errors" + "fmt" + "reflect" + "strconv" + "strings" + "unicode/utf8" + + "google.golang.org/protobuf/encoding/prototext" + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" +) + +const wrapTextUnmarshalV2 = false + +// ParseError is returned by UnmarshalText. +type ParseError struct { + Message string + + // Deprecated: Do not use. + Line, Offset int +} + +func (e *ParseError) Error() string { + if wrapTextUnmarshalV2 { + return e.Message + } + if e.Line == 1 { + return fmt.Sprintf("line 1.%d: %v", e.Offset, e.Message) + } + return fmt.Sprintf("line %d: %v", e.Line, e.Message) +} + +// UnmarshalText parses a proto text formatted string into m. +func UnmarshalText(s string, m Message) error { + if u, ok := m.(encoding.TextUnmarshaler); ok { + return u.UnmarshalText([]byte(s)) + } + + m.Reset() + mi := MessageV2(m) + + if wrapTextUnmarshalV2 { + err := prototext.UnmarshalOptions{ + AllowPartial: true, + }.Unmarshal([]byte(s), mi) + if err != nil { + return &ParseError{Message: err.Error()} + } + return checkRequiredNotSet(mi) + } else { + if err := newTextParser(s).unmarshalMessage(mi.ProtoReflect(), ""); err != nil { + return err + } + return checkRequiredNotSet(mi) + } +} + +type textParser struct { + s string // remaining input + done bool // whether the parsing is finished (success or error) + backed bool // whether back() was called + offset, line int + cur token +} + +type token struct { + value string + err *ParseError + line int // line number + offset int // byte number from start of input, not start of line + unquoted string // the unquoted version of value, if it was a quoted string +} + +func newTextParser(s string) *textParser { + p := new(textParser) + p.s = s + p.line = 1 + p.cur.line = 1 + return p +} + +func (p *textParser) unmarshalMessage(m protoreflect.Message, terminator string) (err error) { + md := m.Descriptor() + fds := md.Fields() + + // A struct is a sequence of "name: value", terminated by one of + // '>' or '}', or the end of the input. A name may also be + // "[extension]" or "[type/url]". + // + // The whole struct can also be an expanded Any message, like: + // [type/url] < ... struct contents ... > + seen := make(map[protoreflect.FieldNumber]bool) + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + if tok.value == "[" { + if err := p.unmarshalExtensionOrAny(m, seen); err != nil { + return err + } + continue + } + + // This is a normal, non-extension field. + name := protoreflect.Name(tok.value) + fd := fds.ByName(name) + switch { + case fd == nil: + gd := fds.ByName(protoreflect.Name(strings.ToLower(string(name)))) + if gd != nil && gd.Kind() == protoreflect.GroupKind && gd.Message().Name() == name { + fd = gd + } + case fd.Kind() == protoreflect.GroupKind && fd.Message().Name() != name: + fd = nil + case fd.IsWeak() && fd.Message().IsPlaceholder(): + fd = nil + } + if fd == nil { + typeName := string(md.FullName()) + if m, ok := m.Interface().(Message); ok { + t := reflect.TypeOf(m) + if t.Kind() == reflect.Ptr { + typeName = t.Elem().String() + } + } + return p.errorf("unknown field name %q in %v", name, typeName) + } + if od := fd.ContainingOneof(); od != nil && m.WhichOneof(od) != nil { + return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, od.Name()) + } + if fd.Cardinality() != protoreflect.Repeated && seen[fd.Number()] { + return p.errorf("non-repeated field %q was repeated", fd.Name()) + } + seen[fd.Number()] = true + + // Consume any colon. + if err := p.checkForColon(fd); err != nil { + return err + } + + // Parse into the field. + v := m.Get(fd) + if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { + v = m.Mutable(fd) + } + if v, err = p.unmarshalValue(v, fd); err != nil { + return err + } + m.Set(fd, v) + + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + } + return nil +} + +func (p *textParser) unmarshalExtensionOrAny(m protoreflect.Message, seen map[protoreflect.FieldNumber]bool) error { + name, err := p.consumeExtensionOrAnyName() + if err != nil { + return err + } + + // If it contains a slash, it's an Any type URL. + if slashIdx := strings.LastIndex(name, "/"); slashIdx >= 0 { + tok := p.next() + if tok.err != nil { + return tok.err + } + // consume an optional colon + if tok.value == ":" { + tok = p.next() + if tok.err != nil { + return tok.err + } + } + + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + + mt, err := protoregistry.GlobalTypes.FindMessageByURL(name) + if err != nil { + return p.errorf("unrecognized message %q in google.protobuf.Any", name[slashIdx+len("/"):]) + } + m2 := mt.New() + if err := p.unmarshalMessage(m2, terminator); err != nil { + return err + } + b, err := protoV2.Marshal(m2.Interface()) + if err != nil { + return p.errorf("failed to marshal message of type %q: %v", name[slashIdx+len("/"):], err) + } + + urlFD := m.Descriptor().Fields().ByName("type_url") + valFD := m.Descriptor().Fields().ByName("value") + if seen[urlFD.Number()] { + return p.errorf("Any message unpacked multiple times, or %q already set", urlFD.Name()) + } + if seen[valFD.Number()] { + return p.errorf("Any message unpacked multiple times, or %q already set", valFD.Name()) + } + m.Set(urlFD, protoreflect.ValueOfString(name)) + m.Set(valFD, protoreflect.ValueOfBytes(b)) + seen[urlFD.Number()] = true + seen[valFD.Number()] = true + return nil + } + + xname := protoreflect.FullName(name) + xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) + if xt == nil && isMessageSet(m.Descriptor()) { + xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) + } + if xt == nil { + return p.errorf("unrecognized extension %q", name) + } + fd := xt.TypeDescriptor() + if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { + return p.errorf("extension field %q does not extend message %q", name, m.Descriptor().FullName()) + } + + if err := p.checkForColon(fd); err != nil { + return err + } + + v := m.Get(fd) + if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { + v = m.Mutable(fd) + } + v, err = p.unmarshalValue(v, fd) + if err != nil { + return err + } + m.Set(fd, v) + return p.consumeOptionalSeparator() +} + +func (p *textParser) unmarshalValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { + tok := p.next() + if tok.err != nil { + return v, tok.err + } + if tok.value == "" { + return v, p.errorf("unexpected EOF") + } + + switch { + case fd.IsList(): + lv := v.List() + var err error + if tok.value == "[" { + // Repeated field with list notation, like [1,2,3]. + for { + vv := lv.NewElement() + vv, err = p.unmarshalSingularValue(vv, fd) + if err != nil { + return v, err + } + lv.Append(vv) + + tok := p.next() + if tok.err != nil { + return v, tok.err + } + if tok.value == "]" { + break + } + if tok.value != "," { + return v, p.errorf("Expected ']' or ',' found %q", tok.value) + } + } + return v, nil + } + + // One value of the repeated field. + p.back() + vv := lv.NewElement() + vv, err = p.unmarshalSingularValue(vv, fd) + if err != nil { + return v, err + } + lv.Append(vv) + return v, nil + case fd.IsMap(): + // The map entry should be this sequence of tokens: + // < key : KEY value : VALUE > + // However, implementations may omit key or value, and technically + // we should support them in any order. + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return v, p.errorf("expected '{' or '<', found %q", tok.value) + } + + keyFD := fd.MapKey() + valFD := fd.MapValue() + + mv := v.Map() + kv := keyFD.Default() + vv := mv.NewValue() + for { + tok := p.next() + if tok.err != nil { + return v, tok.err + } + if tok.value == terminator { + break + } + var err error + switch tok.value { + case "key": + if err := p.consumeToken(":"); err != nil { + return v, err + } + if kv, err = p.unmarshalSingularValue(kv, keyFD); err != nil { + return v, err + } + if err := p.consumeOptionalSeparator(); err != nil { + return v, err + } + case "value": + if err := p.checkForColon(valFD); err != nil { + return v, err + } + if vv, err = p.unmarshalSingularValue(vv, valFD); err != nil { + return v, err + } + if err := p.consumeOptionalSeparator(); err != nil { + return v, err + } + default: + p.back() + return v, p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) + } + } + mv.Set(kv.MapKey(), vv) + return v, nil + default: + p.back() + return p.unmarshalSingularValue(v, fd) + } +} + +func (p *textParser) unmarshalSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { + tok := p.next() + if tok.err != nil { + return v, tok.err + } + if tok.value == "" { + return v, p.errorf("unexpected EOF") + } + + switch fd.Kind() { + case protoreflect.BoolKind: + switch tok.value { + case "true", "1", "t", "True": + return protoreflect.ValueOfBool(true), nil + case "false", "0", "f", "False": + return protoreflect.ValueOfBool(false), nil + } + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { + return protoreflect.ValueOfInt32(int32(x)), nil + } + + // The C++ parser accepts large positive hex numbers that uses + // two's complement arithmetic to represent negative numbers. + // This feature is here for backwards compatibility with C++. + if strings.HasPrefix(tok.value, "0x") { + if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { + return protoreflect.ValueOfInt32(int32(-(int64(^x) + 1))), nil + } + } + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { + return protoreflect.ValueOfInt64(int64(x)), nil + } + + // The C++ parser accepts large positive hex numbers that uses + // two's complement arithmetic to represent negative numbers. + // This feature is here for backwards compatibility with C++. + if strings.HasPrefix(tok.value, "0x") { + if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { + return protoreflect.ValueOfInt64(int64(-(int64(^x) + 1))), nil + } + } + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { + return protoreflect.ValueOfUint32(uint32(x)), nil + } + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { + return protoreflect.ValueOfUint64(uint64(x)), nil + } + case protoreflect.FloatKind: + // Ignore 'f' for compatibility with output generated by C++, + // but don't remove 'f' when the value is "-inf" or "inf". + v := tok.value + if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { + v = v[:len(v)-len("f")] + } + if x, err := strconv.ParseFloat(v, 32); err == nil { + return protoreflect.ValueOfFloat32(float32(x)), nil + } + case protoreflect.DoubleKind: + // Ignore 'f' for compatibility with output generated by C++, + // but don't remove 'f' when the value is "-inf" or "inf". + v := tok.value + if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { + v = v[:len(v)-len("f")] + } + if x, err := strconv.ParseFloat(v, 64); err == nil { + return protoreflect.ValueOfFloat64(float64(x)), nil + } + case protoreflect.StringKind: + if isQuote(tok.value[0]) { + return protoreflect.ValueOfString(tok.unquoted), nil + } + case protoreflect.BytesKind: + if isQuote(tok.value[0]) { + return protoreflect.ValueOfBytes([]byte(tok.unquoted)), nil + } + case protoreflect.EnumKind: + if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { + return protoreflect.ValueOfEnum(protoreflect.EnumNumber(x)), nil + } + vd := fd.Enum().Values().ByName(protoreflect.Name(tok.value)) + if vd != nil { + return protoreflect.ValueOfEnum(vd.Number()), nil + } + case protoreflect.MessageKind, protoreflect.GroupKind: + var terminator string + switch tok.value { + case "{": + terminator = "}" + case "<": + terminator = ">" + default: + return v, p.errorf("expected '{' or '<', found %q", tok.value) + } + err := p.unmarshalMessage(v.Message(), terminator) + return v, err + default: + panic(fmt.Sprintf("invalid kind %v", fd.Kind())) + } + return v, p.errorf("invalid %v: %v", fd.Kind(), tok.value) +} + +// Consume a ':' from the input stream (if the next token is a colon), +// returning an error if a colon is needed but not present. +func (p *textParser) checkForColon(fd protoreflect.FieldDescriptor) *ParseError { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ":" { + if fd.Message() == nil { + return p.errorf("expected ':', found %q", tok.value) + } + p.back() + } + return nil +} + +// consumeExtensionOrAnyName consumes an extension name or an Any type URL and +// the following ']'. It returns the name or URL consumed. +func (p *textParser) consumeExtensionOrAnyName() (string, error) { + tok := p.next() + if tok.err != nil { + return "", tok.err + } + + // If extension name or type url is quoted, it's a single token. + if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { + name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) + if err != nil { + return "", err + } + return name, p.consumeToken("]") + } + + // Consume everything up to "]" + var parts []string + for tok.value != "]" { + parts = append(parts, tok.value) + tok = p.next() + if tok.err != nil { + return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) + } + if p.done && tok.value != "]" { + return "", p.errorf("unclosed type_url or extension name") + } + } + return strings.Join(parts, ""), nil +} + +// consumeOptionalSeparator consumes an optional semicolon or comma. +// It is used in unmarshalMessage to provide backward compatibility. +func (p *textParser) consumeOptionalSeparator() error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ";" && tok.value != "," { + p.back() + } + return nil +} + +func (p *textParser) errorf(format string, a ...interface{}) *ParseError { + pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} + p.cur.err = pe + p.done = true + return pe +} + +func (p *textParser) skipWhitespace() { + i := 0 + for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { + if p.s[i] == '#' { + // comment; skip to end of line or input + for i < len(p.s) && p.s[i] != '\n' { + i++ + } + if i == len(p.s) { + break + } + } + if p.s[i] == '\n' { + p.line++ + } + i++ + } + p.offset += i + p.s = p.s[i:len(p.s)] + if len(p.s) == 0 { + p.done = true + } +} + +func (p *textParser) advance() { + // Skip whitespace + p.skipWhitespace() + if p.done { + return + } + + // Start of non-whitespace + p.cur.err = nil + p.cur.offset, p.cur.line = p.offset, p.line + p.cur.unquoted = "" + switch p.s[0] { + case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': + // Single symbol + p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] + case '"', '\'': + // Quoted string + i := 1 + for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { + if p.s[i] == '\\' && i+1 < len(p.s) { + // skip escaped char + i++ + } + i++ + } + if i >= len(p.s) || p.s[i] != p.s[0] { + p.errorf("unmatched quote") + return + } + unq, err := unquoteC(p.s[1:i], rune(p.s[0])) + if err != nil { + p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) + return + } + p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] + p.cur.unquoted = unq + default: + i := 0 + for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { + i++ + } + if i == 0 { + p.errorf("unexpected byte %#x", p.s[0]) + return + } + p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] + } + p.offset += len(p.cur.value) +} + +// Back off the parser by one token. Can only be done between calls to next(). +// It makes the next advance() a no-op. +func (p *textParser) back() { p.backed = true } + +// Advances the parser and returns the new current token. +func (p *textParser) next() *token { + if p.backed || p.done { + p.backed = false + return &p.cur + } + p.advance() + if p.done { + p.cur.value = "" + } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { + // Look for multiple quoted strings separated by whitespace, + // and concatenate them. + cat := p.cur + for { + p.skipWhitespace() + if p.done || !isQuote(p.s[0]) { + break + } + p.advance() + if p.cur.err != nil { + return &p.cur + } + cat.value += " " + p.cur.value + cat.unquoted += p.cur.unquoted + } + p.done = false // parser may have seen EOF, but we want to return cat + p.cur = cat + } + return &p.cur +} + +func (p *textParser) consumeToken(s string) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != s { + p.back() + return p.errorf("expected %q, found %q", s, tok.value) + } + return nil +} + +var errBadUTF8 = errors.New("proto: bad UTF-8") + +func unquoteC(s string, quote rune) (string, error) { + // This is based on C++'s tokenizer.cc. + // Despite its name, this is *not* parsing C syntax. + // For instance, "\0" is an invalid quoted string. + + // Avoid allocation in trivial cases. + simple := true + for _, r := range s { + if r == '\\' || r == quote { + simple = false + break + } + } + if simple { + return s, nil + } + + buf := make([]byte, 0, 3*len(s)/2) + for len(s) > 0 { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", errBadUTF8 + } + s = s[n:] + if r != '\\' { + if r < utf8.RuneSelf { + buf = append(buf, byte(r)) + } else { + buf = append(buf, string(r)...) + } + continue + } + + ch, tail, err := unescape(s) + if err != nil { + return "", err + } + buf = append(buf, ch...) + s = tail + } + return string(buf), nil +} + +func unescape(s string) (ch string, tail string, err error) { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", "", errBadUTF8 + } + s = s[n:] + switch r { + case 'a': + return "\a", s, nil + case 'b': + return "\b", s, nil + case 'f': + return "\f", s, nil + case 'n': + return "\n", s, nil + case 'r': + return "\r", s, nil + case 't': + return "\t", s, nil + case 'v': + return "\v", s, nil + case '?': + return "?", s, nil // trigraph workaround + case '\'', '"', '\\': + return string(r), s, nil + case '0', '1', '2', '3', '4', '5', '6', '7': + if len(s) < 2 { + return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) + } + ss := string(r) + s[:2] + s = s[2:] + i, err := strconv.ParseUint(ss, 8, 8) + if err != nil { + return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) + } + return string([]byte{byte(i)}), s, nil + case 'x', 'X', 'u', 'U': + var n int + switch r { + case 'x', 'X': + n = 2 + case 'u': + n = 4 + case 'U': + n = 8 + } + if len(s) < n { + return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) + } + ss := s[:n] + s = s[n:] + i, err := strconv.ParseUint(ss, 16, 64) + if err != nil { + return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) + } + if r == 'x' || r == 'X' { + return string([]byte{byte(i)}), s, nil + } + if i > utf8.MaxRune { + return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) + } + return string(rune(i)), s, nil + } + return "", "", fmt.Errorf(`unknown escape \%c`, r) +} + +func isIdentOrNumberChar(c byte) bool { + switch { + case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': + return true + case '0' <= c && c <= '9': + return true + } + switch c { + case '-', '+', '.', '_': + return true + } + return false +} + +func isWhitespace(c byte) bool { + switch c { + case ' ', '\t', '\n', '\r': + return true + } + return false +} + +func isQuote(c byte) bool { + switch c { + case '"', '\'': + return true + } + return false +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/text_encode.go b/integration-test/vendor/github.com/golang/protobuf/proto/text_encode.go new file mode 100644 index 000000000..a31134eeb --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/text_encode.go @@ -0,0 +1,560 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + "bytes" + "encoding" + "fmt" + "io" + "math" + "sort" + "strings" + + "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" +) + +const wrapTextMarshalV2 = false + +// TextMarshaler is a configurable text format marshaler. +type TextMarshaler struct { + Compact bool // use compact text format (one line) + ExpandAny bool // expand google.protobuf.Any messages of known types +} + +// Marshal writes the proto text format of m to w. +func (tm *TextMarshaler) Marshal(w io.Writer, m Message) error { + b, err := tm.marshal(m) + if len(b) > 0 { + if _, err := w.Write(b); err != nil { + return err + } + } + return err +} + +// Text returns a proto text formatted string of m. +func (tm *TextMarshaler) Text(m Message) string { + b, _ := tm.marshal(m) + return string(b) +} + +func (tm *TextMarshaler) marshal(m Message) ([]byte, error) { + mr := MessageReflect(m) + if mr == nil || !mr.IsValid() { + return []byte(""), nil + } + + if wrapTextMarshalV2 { + if m, ok := m.(encoding.TextMarshaler); ok { + return m.MarshalText() + } + + opts := prototext.MarshalOptions{ + AllowPartial: true, + EmitUnknown: true, + } + if !tm.Compact { + opts.Indent = " " + } + if !tm.ExpandAny { + opts.Resolver = (*protoregistry.Types)(nil) + } + return opts.Marshal(mr.Interface()) + } else { + w := &textWriter{ + compact: tm.Compact, + expandAny: tm.ExpandAny, + complete: true, + } + + if m, ok := m.(encoding.TextMarshaler); ok { + b, err := m.MarshalText() + if err != nil { + return nil, err + } + w.Write(b) + return w.buf, nil + } + + err := w.writeMessage(mr) + return w.buf, err + } +} + +var ( + defaultTextMarshaler = TextMarshaler{} + compactTextMarshaler = TextMarshaler{Compact: true} +) + +// MarshalText writes the proto text format of m to w. +func MarshalText(w io.Writer, m Message) error { return defaultTextMarshaler.Marshal(w, m) } + +// MarshalTextString returns a proto text formatted string of m. +func MarshalTextString(m Message) string { return defaultTextMarshaler.Text(m) } + +// CompactText writes the compact proto text format of m to w. +func CompactText(w io.Writer, m Message) error { return compactTextMarshaler.Marshal(w, m) } + +// CompactTextString returns a compact proto text formatted string of m. +func CompactTextString(m Message) string { return compactTextMarshaler.Text(m) } + +var ( + newline = []byte("\n") + endBraceNewline = []byte("}\n") + posInf = []byte("inf") + negInf = []byte("-inf") + nan = []byte("nan") +) + +// textWriter is an io.Writer that tracks its indentation level. +type textWriter struct { + compact bool // same as TextMarshaler.Compact + expandAny bool // same as TextMarshaler.ExpandAny + complete bool // whether the current position is a complete line + indent int // indentation level; never negative + buf []byte +} + +func (w *textWriter) Write(p []byte) (n int, _ error) { + newlines := bytes.Count(p, newline) + if newlines == 0 { + if !w.compact && w.complete { + w.writeIndent() + } + w.buf = append(w.buf, p...) + w.complete = false + return len(p), nil + } + + frags := bytes.SplitN(p, newline, newlines+1) + if w.compact { + for i, frag := range frags { + if i > 0 { + w.buf = append(w.buf, ' ') + n++ + } + w.buf = append(w.buf, frag...) + n += len(frag) + } + return n, nil + } + + for i, frag := range frags { + if w.complete { + w.writeIndent() + } + w.buf = append(w.buf, frag...) + n += len(frag) + if i+1 < len(frags) { + w.buf = append(w.buf, '\n') + n++ + } + } + w.complete = len(frags[len(frags)-1]) == 0 + return n, nil +} + +func (w *textWriter) WriteByte(c byte) error { + if w.compact && c == '\n' { + c = ' ' + } + if !w.compact && w.complete { + w.writeIndent() + } + w.buf = append(w.buf, c) + w.complete = c == '\n' + return nil +} + +func (w *textWriter) writeName(fd protoreflect.FieldDescriptor) { + if !w.compact && w.complete { + w.writeIndent() + } + w.complete = false + + if fd.Kind() != protoreflect.GroupKind { + w.buf = append(w.buf, fd.Name()...) + w.WriteByte(':') + } else { + // Use message type name for group field name. + w.buf = append(w.buf, fd.Message().Name()...) + } + + if !w.compact { + w.WriteByte(' ') + } +} + +func requiresQuotes(u string) bool { + // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. + for _, ch := range u { + switch { + case ch == '.' || ch == '/' || ch == '_': + continue + case '0' <= ch && ch <= '9': + continue + case 'A' <= ch && ch <= 'Z': + continue + case 'a' <= ch && ch <= 'z': + continue + default: + return true + } + } + return false +} + +// writeProto3Any writes an expanded google.protobuf.Any message. +// +// It returns (false, nil) if sv value can't be unmarshaled (e.g. because +// required messages are not linked in). +// +// It returns (true, error) when sv was written in expanded format or an error +// was encountered. +func (w *textWriter) writeProto3Any(m protoreflect.Message) (bool, error) { + md := m.Descriptor() + fdURL := md.Fields().ByName("type_url") + fdVal := md.Fields().ByName("value") + + url := m.Get(fdURL).String() + mt, err := protoregistry.GlobalTypes.FindMessageByURL(url) + if err != nil { + return false, nil + } + + b := m.Get(fdVal).Bytes() + m2 := mt.New() + if err := proto.Unmarshal(b, m2.Interface()); err != nil { + return false, nil + } + w.Write([]byte("[")) + if requiresQuotes(url) { + w.writeQuotedString(url) + } else { + w.Write([]byte(url)) + } + if w.compact { + w.Write([]byte("]:<")) + } else { + w.Write([]byte("]: <\n")) + w.indent++ + } + if err := w.writeMessage(m2); err != nil { + return true, err + } + if w.compact { + w.Write([]byte("> ")) + } else { + w.indent-- + w.Write([]byte(">\n")) + } + return true, nil +} + +func (w *textWriter) writeMessage(m protoreflect.Message) error { + md := m.Descriptor() + if w.expandAny && md.FullName() == "google.protobuf.Any" { + if canExpand, err := w.writeProto3Any(m); canExpand { + return err + } + } + + fds := md.Fields() + for i := 0; i < fds.Len(); { + fd := fds.Get(i) + if od := fd.ContainingOneof(); od != nil { + fd = m.WhichOneof(od) + i += od.Fields().Len() + } else { + i++ + } + if fd == nil || !m.Has(fd) { + continue + } + + switch { + case fd.IsList(): + lv := m.Get(fd).List() + for j := 0; j < lv.Len(); j++ { + w.writeName(fd) + v := lv.Get(j) + if err := w.writeSingularValue(v, fd); err != nil { + return err + } + w.WriteByte('\n') + } + case fd.IsMap(): + kfd := fd.MapKey() + vfd := fd.MapValue() + mv := m.Get(fd).Map() + + type entry struct{ key, val protoreflect.Value } + var entries []entry + mv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { + entries = append(entries, entry{k.Value(), v}) + return true + }) + sort.Slice(entries, func(i, j int) bool { + switch kfd.Kind() { + case protoreflect.BoolKind: + return !entries[i].key.Bool() && entries[j].key.Bool() + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + return entries[i].key.Int() < entries[j].key.Int() + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + return entries[i].key.Uint() < entries[j].key.Uint() + case protoreflect.StringKind: + return entries[i].key.String() < entries[j].key.String() + default: + panic("invalid kind") + } + }) + for _, entry := range entries { + w.writeName(fd) + w.WriteByte('<') + if !w.compact { + w.WriteByte('\n') + } + w.indent++ + w.writeName(kfd) + if err := w.writeSingularValue(entry.key, kfd); err != nil { + return err + } + w.WriteByte('\n') + w.writeName(vfd) + if err := w.writeSingularValue(entry.val, vfd); err != nil { + return err + } + w.WriteByte('\n') + w.indent-- + w.WriteByte('>') + w.WriteByte('\n') + } + default: + w.writeName(fd) + if err := w.writeSingularValue(m.Get(fd), fd); err != nil { + return err + } + w.WriteByte('\n') + } + } + + if b := m.GetUnknown(); len(b) > 0 { + w.writeUnknownFields(b) + } + return w.writeExtensions(m) +} + +func (w *textWriter) writeSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) error { + switch fd.Kind() { + case protoreflect.FloatKind, protoreflect.DoubleKind: + switch vf := v.Float(); { + case math.IsInf(vf, +1): + w.Write(posInf) + case math.IsInf(vf, -1): + w.Write(negInf) + case math.IsNaN(vf): + w.Write(nan) + default: + fmt.Fprint(w, v.Interface()) + } + case protoreflect.StringKind: + // NOTE: This does not validate UTF-8 for historical reasons. + w.writeQuotedString(string(v.String())) + case protoreflect.BytesKind: + w.writeQuotedString(string(v.Bytes())) + case protoreflect.MessageKind, protoreflect.GroupKind: + var bra, ket byte = '<', '>' + if fd.Kind() == protoreflect.GroupKind { + bra, ket = '{', '}' + } + w.WriteByte(bra) + if !w.compact { + w.WriteByte('\n') + } + w.indent++ + m := v.Message() + if m2, ok := m.Interface().(encoding.TextMarshaler); ok { + b, err := m2.MarshalText() + if err != nil { + return err + } + w.Write(b) + } else { + w.writeMessage(m) + } + w.indent-- + w.WriteByte(ket) + case protoreflect.EnumKind: + if ev := fd.Enum().Values().ByNumber(v.Enum()); ev != nil { + fmt.Fprint(w, ev.Name()) + } else { + fmt.Fprint(w, v.Enum()) + } + default: + fmt.Fprint(w, v.Interface()) + } + return nil +} + +// writeQuotedString writes a quoted string in the protocol buffer text format. +func (w *textWriter) writeQuotedString(s string) { + w.WriteByte('"') + for i := 0; i < len(s); i++ { + switch c := s[i]; c { + case '\n': + w.buf = append(w.buf, `\n`...) + case '\r': + w.buf = append(w.buf, `\r`...) + case '\t': + w.buf = append(w.buf, `\t`...) + case '"': + w.buf = append(w.buf, `\"`...) + case '\\': + w.buf = append(w.buf, `\\`...) + default: + if isPrint := c >= 0x20 && c < 0x7f; isPrint { + w.buf = append(w.buf, c) + } else { + w.buf = append(w.buf, fmt.Sprintf(`\%03o`, c)...) + } + } + } + w.WriteByte('"') +} + +func (w *textWriter) writeUnknownFields(b []byte) { + if !w.compact { + fmt.Fprintf(w, "/* %d unknown bytes */\n", len(b)) + } + + for len(b) > 0 { + num, wtyp, n := protowire.ConsumeTag(b) + if n < 0 { + return + } + b = b[n:] + + if wtyp == protowire.EndGroupType { + w.indent-- + w.Write(endBraceNewline) + continue + } + fmt.Fprint(w, num) + if wtyp != protowire.StartGroupType { + w.WriteByte(':') + } + if !w.compact || wtyp == protowire.StartGroupType { + w.WriteByte(' ') + } + switch wtyp { + case protowire.VarintType: + v, n := protowire.ConsumeVarint(b) + if n < 0 { + return + } + b = b[n:] + fmt.Fprint(w, v) + case protowire.Fixed32Type: + v, n := protowire.ConsumeFixed32(b) + if n < 0 { + return + } + b = b[n:] + fmt.Fprint(w, v) + case protowire.Fixed64Type: + v, n := protowire.ConsumeFixed64(b) + if n < 0 { + return + } + b = b[n:] + fmt.Fprint(w, v) + case protowire.BytesType: + v, n := protowire.ConsumeBytes(b) + if n < 0 { + return + } + b = b[n:] + fmt.Fprintf(w, "%q", v) + case protowire.StartGroupType: + w.WriteByte('{') + w.indent++ + default: + fmt.Fprintf(w, "/* unknown wire type %d */", wtyp) + } + w.WriteByte('\n') + } +} + +// writeExtensions writes all the extensions in m. +func (w *textWriter) writeExtensions(m protoreflect.Message) error { + md := m.Descriptor() + if md.ExtensionRanges().Len() == 0 { + return nil + } + + type ext struct { + desc protoreflect.FieldDescriptor + val protoreflect.Value + } + var exts []ext + m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + if fd.IsExtension() { + exts = append(exts, ext{fd, v}) + } + return true + }) + sort.Slice(exts, func(i, j int) bool { + return exts[i].desc.Number() < exts[j].desc.Number() + }) + + for _, ext := range exts { + // For message set, use the name of the message as the extension name. + name := string(ext.desc.FullName()) + if isMessageSet(ext.desc.ContainingMessage()) { + name = strings.TrimSuffix(name, ".message_set_extension") + } + + if !ext.desc.IsList() { + if err := w.writeSingularExtension(name, ext.val, ext.desc); err != nil { + return err + } + } else { + lv := ext.val.List() + for i := 0; i < lv.Len(); i++ { + if err := w.writeSingularExtension(name, lv.Get(i), ext.desc); err != nil { + return err + } + } + } + } + return nil +} + +func (w *textWriter) writeSingularExtension(name string, v protoreflect.Value, fd protoreflect.FieldDescriptor) error { + fmt.Fprintf(w, "[%s]:", name) + if !w.compact { + w.WriteByte(' ') + } + if err := w.writeSingularValue(v, fd); err != nil { + return err + } + w.WriteByte('\n') + return nil +} + +func (w *textWriter) writeIndent() { + if !w.complete { + return + } + for i := 0; i < w.indent*2; i++ { + w.buf = append(w.buf, ' ') + } + w.complete = false +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/wire.go b/integration-test/vendor/github.com/golang/protobuf/proto/wire.go new file mode 100644 index 000000000..d7c28da5a --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/wire.go @@ -0,0 +1,78 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +import ( + protoV2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/runtime/protoiface" +) + +// Size returns the size in bytes of the wire-format encoding of m. +func Size(m Message) int { + if m == nil { + return 0 + } + mi := MessageV2(m) + return protoV2.Size(mi) +} + +// Marshal returns the wire-format encoding of m. +func Marshal(m Message) ([]byte, error) { + b, err := marshalAppend(nil, m, false) + if b == nil { + b = zeroBytes + } + return b, err +} + +var zeroBytes = make([]byte, 0, 0) + +func marshalAppend(buf []byte, m Message, deterministic bool) ([]byte, error) { + if m == nil { + return nil, ErrNil + } + mi := MessageV2(m) + nbuf, err := protoV2.MarshalOptions{ + Deterministic: deterministic, + AllowPartial: true, + }.MarshalAppend(buf, mi) + if err != nil { + return buf, err + } + if len(buf) == len(nbuf) { + if !mi.ProtoReflect().IsValid() { + return buf, ErrNil + } + } + return nbuf, checkRequiredNotSet(mi) +} + +// Unmarshal parses a wire-format message in b and places the decoded results in m. +// +// Unmarshal resets m before starting to unmarshal, so any existing data in m is always +// removed. Use UnmarshalMerge to preserve and append to existing data. +func Unmarshal(b []byte, m Message) error { + m.Reset() + return UnmarshalMerge(b, m) +} + +// UnmarshalMerge parses a wire-format message in b and places the decoded results in m. +func UnmarshalMerge(b []byte, m Message) error { + mi := MessageV2(m) + out, err := protoV2.UnmarshalOptions{ + AllowPartial: true, + Merge: true, + }.UnmarshalState(protoiface.UnmarshalInput{ + Buf: b, + Message: mi.ProtoReflect(), + }) + if err != nil { + return err + } + if out.Flags&protoiface.UnmarshalInitialized > 0 { + return nil + } + return checkRequiredNotSet(mi) +} diff --git a/integration-test/vendor/github.com/golang/protobuf/proto/wrappers.go b/integration-test/vendor/github.com/golang/protobuf/proto/wrappers.go new file mode 100644 index 000000000..398e34859 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/proto/wrappers.go @@ -0,0 +1,34 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package proto + +// Bool stores v in a new bool value and returns a pointer to it. +func Bool(v bool) *bool { return &v } + +// Int stores v in a new int32 value and returns a pointer to it. +// +// Deprecated: Use Int32 instead. +func Int(v int) *int32 { return Int32(int32(v)) } + +// Int32 stores v in a new int32 value and returns a pointer to it. +func Int32(v int32) *int32 { return &v } + +// Int64 stores v in a new int64 value and returns a pointer to it. +func Int64(v int64) *int64 { return &v } + +// Uint32 stores v in a new uint32 value and returns a pointer to it. +func Uint32(v uint32) *uint32 { return &v } + +// Uint64 stores v in a new uint64 value and returns a pointer to it. +func Uint64(v uint64) *uint64 { return &v } + +// Float32 stores v in a new float32 value and returns a pointer to it. +func Float32(v float32) *float32 { return &v } + +// Float64 stores v in a new float64 value and returns a pointer to it. +func Float64(v float64) *float64 { return &v } + +// String stores v in a new string value and returns a pointer to it. +func String(v string) *string { return &v } diff --git a/integration-test/vendor/github.com/golang/protobuf/ptypes/any.go b/integration-test/vendor/github.com/golang/protobuf/ptypes/any.go new file mode 100644 index 000000000..85f9f5736 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/ptypes/any.go @@ -0,0 +1,179 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ptypes + +import ( + "fmt" + "strings" + + "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + + anypb "github.com/golang/protobuf/ptypes/any" +) + +const urlPrefix = "type.googleapis.com/" + +// AnyMessageName returns the message name contained in an anypb.Any message. +// Most type assertions should use the Is function instead. +// +// Deprecated: Call the any.MessageName method instead. +func AnyMessageName(any *anypb.Any) (string, error) { + name, err := anyMessageName(any) + return string(name), err +} +func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) { + if any == nil { + return "", fmt.Errorf("message is nil") + } + name := protoreflect.FullName(any.TypeUrl) + if i := strings.LastIndex(any.TypeUrl, "/"); i >= 0 { + name = name[i+len("/"):] + } + if !name.IsValid() { + return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl) + } + return name, nil +} + +// MarshalAny marshals the given message m into an anypb.Any message. +// +// Deprecated: Call the anypb.New function instead. +func MarshalAny(m proto.Message) (*anypb.Any, error) { + switch dm := m.(type) { + case DynamicAny: + m = dm.Message + case *DynamicAny: + if dm == nil { + return nil, proto.ErrNil + } + m = dm.Message + } + b, err := proto.Marshal(m) + if err != nil { + return nil, err + } + return &anypb.Any{TypeUrl: urlPrefix + proto.MessageName(m), Value: b}, nil +} + +// Empty returns a new message of the type specified in an anypb.Any message. +// It returns protoregistry.NotFound if the corresponding message type could not +// be resolved in the global registry. +// +// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead +// to resolve the message name and create a new instance of it. +func Empty(any *anypb.Any) (proto.Message, error) { + name, err := anyMessageName(any) + if err != nil { + return nil, err + } + mt, err := protoregistry.GlobalTypes.FindMessageByName(name) + if err != nil { + return nil, err + } + return proto.MessageV1(mt.New().Interface()), nil +} + +// UnmarshalAny unmarshals the encoded value contained in the anypb.Any message +// into the provided message m. It returns an error if the target message +// does not match the type in the Any message or if an unmarshal error occurs. +// +// The target message m may be a *DynamicAny message. If the underlying message +// type could not be resolved, then this returns protoregistry.NotFound. +// +// Deprecated: Call the any.UnmarshalTo method instead. +func UnmarshalAny(any *anypb.Any, m proto.Message) error { + if dm, ok := m.(*DynamicAny); ok { + if dm.Message == nil { + var err error + dm.Message, err = Empty(any) + if err != nil { + return err + } + } + m = dm.Message + } + + anyName, err := AnyMessageName(any) + if err != nil { + return err + } + msgName := proto.MessageName(m) + if anyName != msgName { + return fmt.Errorf("mismatched message type: got %q want %q", anyName, msgName) + } + return proto.Unmarshal(any.Value, m) +} + +// Is reports whether the Any message contains a message of the specified type. +// +// Deprecated: Call the any.MessageIs method instead. +func Is(any *anypb.Any, m proto.Message) bool { + if any == nil || m == nil { + return false + } + name := proto.MessageName(m) + if !strings.HasSuffix(any.TypeUrl, name) { + return false + } + return len(any.TypeUrl) == len(name) || any.TypeUrl[len(any.TypeUrl)-len(name)-1] == '/' +} + +// DynamicAny is a value that can be passed to UnmarshalAny to automatically +// allocate a proto.Message for the type specified in an anypb.Any message. +// The allocated message is stored in the embedded proto.Message. +// +// Example: +// var x ptypes.DynamicAny +// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } +// fmt.Printf("unmarshaled message: %v", x.Message) +// +// Deprecated: Use the any.UnmarshalNew method instead to unmarshal +// the any message contents into a new instance of the underlying message. +type DynamicAny struct{ proto.Message } + +func (m DynamicAny) String() string { + if m.Message == nil { + return "" + } + return m.Message.String() +} +func (m DynamicAny) Reset() { + if m.Message == nil { + return + } + m.Message.Reset() +} +func (m DynamicAny) ProtoMessage() { + return +} +func (m DynamicAny) ProtoReflect() protoreflect.Message { + if m.Message == nil { + return nil + } + return dynamicAny{proto.MessageReflect(m.Message)} +} + +type dynamicAny struct{ protoreflect.Message } + +func (m dynamicAny) Type() protoreflect.MessageType { + return dynamicAnyType{m.Message.Type()} +} +func (m dynamicAny) New() protoreflect.Message { + return dynamicAnyType{m.Message.Type()}.New() +} +func (m dynamicAny) Interface() protoreflect.ProtoMessage { + return DynamicAny{proto.MessageV1(m.Message.Interface())} +} + +type dynamicAnyType struct{ protoreflect.MessageType } + +func (t dynamicAnyType) New() protoreflect.Message { + return dynamicAny{t.MessageType.New()} +} +func (t dynamicAnyType) Zero() protoreflect.Message { + return dynamicAny{t.MessageType.Zero()} +} diff --git a/integration-test/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go b/integration-test/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go new file mode 100644 index 000000000..0ef27d33d --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go @@ -0,0 +1,62 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: github.com/golang/protobuf/ptypes/any/any.proto + +package any + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" +) + +// Symbols defined in public import of google/protobuf/any.proto. + +type Any = anypb.Any + +var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor + +var file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ + 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2b, 0x5a, 0x29, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, + 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x3b, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() } +func file_github_com_golang_protobuf_ptypes_any_any_proto_init() { + if File_github_com_golang_protobuf_ptypes_any_any_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, + }.Build() + File_github_com_golang_protobuf_ptypes_any_any_proto = out.File + file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil +} diff --git a/integration-test/vendor/github.com/golang/protobuf/ptypes/doc.go b/integration-test/vendor/github.com/golang/protobuf/ptypes/doc.go new file mode 100644 index 000000000..d3c33259d --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/ptypes/doc.go @@ -0,0 +1,10 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package ptypes provides functionality for interacting with well-known types. +// +// Deprecated: Well-known types have specialized functionality directly +// injected into the generated packages for each message type. +// See the deprecation notice for each function for the suggested alternative. +package ptypes diff --git a/integration-test/vendor/github.com/golang/protobuf/ptypes/duration.go b/integration-test/vendor/github.com/golang/protobuf/ptypes/duration.go new file mode 100644 index 000000000..b2b55dd85 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/ptypes/duration.go @@ -0,0 +1,76 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ptypes + +import ( + "errors" + "fmt" + "time" + + durationpb "github.com/golang/protobuf/ptypes/duration" +) + +// Range of google.protobuf.Duration as specified in duration.proto. +// This is about 10,000 years in seconds. +const ( + maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) + minSeconds = -maxSeconds +) + +// Duration converts a durationpb.Duration to a time.Duration. +// Duration returns an error if dur is invalid or overflows a time.Duration. +// +// Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead. +func Duration(dur *durationpb.Duration) (time.Duration, error) { + if err := validateDuration(dur); err != nil { + return 0, err + } + d := time.Duration(dur.Seconds) * time.Second + if int64(d/time.Second) != dur.Seconds { + return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) + } + if dur.Nanos != 0 { + d += time.Duration(dur.Nanos) * time.Nanosecond + if (d < 0) != (dur.Nanos < 0) { + return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) + } + } + return d, nil +} + +// DurationProto converts a time.Duration to a durationpb.Duration. +// +// Deprecated: Call the durationpb.New function instead. +func DurationProto(d time.Duration) *durationpb.Duration { + nanos := d.Nanoseconds() + secs := nanos / 1e9 + nanos -= secs * 1e9 + return &durationpb.Duration{ + Seconds: int64(secs), + Nanos: int32(nanos), + } +} + +// validateDuration determines whether the durationpb.Duration is valid +// according to the definition in google/protobuf/duration.proto. +// A valid durpb.Duration may still be too large to fit into a time.Duration +// Note that the range of durationpb.Duration is about 10,000 years, +// while the range of time.Duration is about 290 years. +func validateDuration(dur *durationpb.Duration) error { + if dur == nil { + return errors.New("duration: nil Duration") + } + if dur.Seconds < minSeconds || dur.Seconds > maxSeconds { + return fmt.Errorf("duration: %v: seconds out of range", dur) + } + if dur.Nanos <= -1e9 || dur.Nanos >= 1e9 { + return fmt.Errorf("duration: %v: nanos out of range", dur) + } + // Seconds and Nanos must have the same sign, unless d.Nanos is zero. + if (dur.Seconds < 0 && dur.Nanos > 0) || (dur.Seconds > 0 && dur.Nanos < 0) { + return fmt.Errorf("duration: %v: seconds and nanos have different signs", dur) + } + return nil +} diff --git a/integration-test/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go b/integration-test/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go new file mode 100644 index 000000000..d0079ee3e --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go @@ -0,0 +1,63 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: github.com/golang/protobuf/ptypes/duration/duration.proto + +package duration + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + reflect "reflect" +) + +// Symbols defined in public import of google/protobuf/duration.proto. + +type Duration = durationpb.Duration + +var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor + +var file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []byte{ + 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x35, 0x5a, 0x33, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } +func file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { + if File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, + }.Build() + File_github_com_golang_protobuf_ptypes_duration_duration_proto = out.File + file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil +} diff --git a/integration-test/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/integration-test/vendor/github.com/golang/protobuf/ptypes/timestamp.go new file mode 100644 index 000000000..8368a3f70 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/ptypes/timestamp.go @@ -0,0 +1,112 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ptypes + +import ( + "errors" + "fmt" + "time" + + timestamppb "github.com/golang/protobuf/ptypes/timestamp" +) + +// Range of google.protobuf.Duration as specified in timestamp.proto. +const ( + // Seconds field of the earliest valid Timestamp. + // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + minValidSeconds = -62135596800 + // Seconds field just after the latest valid Timestamp. + // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + maxValidSeconds = 253402300800 +) + +// Timestamp converts a timestamppb.Timestamp to a time.Time. +// It returns an error if the argument is invalid. +// +// Unlike most Go functions, if Timestamp returns an error, the first return +// value is not the zero time.Time. Instead, it is the value obtained from the +// time.Unix function when passed the contents of the Timestamp, in the UTC +// locale. This may or may not be a meaningful time; many invalid Timestamps +// do map to valid time.Times. +// +// A nil Timestamp returns an error. The first return value in that case is +// undefined. +// +// Deprecated: Call the ts.AsTime and ts.CheckValid methods instead. +func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) { + // Don't return the zero value on error, because corresponds to a valid + // timestamp. Instead return whatever time.Unix gives us. + var t time.Time + if ts == nil { + t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp + } else { + t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() + } + return t, validateTimestamp(ts) +} + +// TimestampNow returns a google.protobuf.Timestamp for the current time. +// +// Deprecated: Call the timestamppb.Now function instead. +func TimestampNow() *timestamppb.Timestamp { + ts, err := TimestampProto(time.Now()) + if err != nil { + panic("ptypes: time.Now() out of Timestamp range") + } + return ts +} + +// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. +// It returns an error if the resulting Timestamp is invalid. +// +// Deprecated: Call the timestamppb.New function instead. +func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { + ts := ×tamppb.Timestamp{ + Seconds: t.Unix(), + Nanos: int32(t.Nanosecond()), + } + if err := validateTimestamp(ts); err != nil { + return nil, err + } + return ts, nil +} + +// TimestampString returns the RFC 3339 string for valid Timestamps. +// For invalid Timestamps, it returns an error message in parentheses. +// +// Deprecated: Call the ts.AsTime method instead, +// followed by a call to the Format method on the time.Time value. +func TimestampString(ts *timestamppb.Timestamp) string { + t, err := Timestamp(ts) + if err != nil { + return fmt.Sprintf("(%v)", err) + } + return t.Format(time.RFC3339Nano) +} + +// validateTimestamp determines whether a Timestamp is valid. +// A valid timestamp represents a time in the range [0001-01-01, 10000-01-01) +// and has a Nanos field in the range [0, 1e9). +// +// If the Timestamp is valid, validateTimestamp returns nil. +// Otherwise, it returns an error that describes the problem. +// +// Every valid Timestamp can be represented by a time.Time, +// but the converse is not true. +func validateTimestamp(ts *timestamppb.Timestamp) error { + if ts == nil { + return errors.New("timestamp: nil Timestamp") + } + if ts.Seconds < minValidSeconds { + return fmt.Errorf("timestamp: %v before 0001-01-01", ts) + } + if ts.Seconds >= maxValidSeconds { + return fmt.Errorf("timestamp: %v after 10000-01-01", ts) + } + if ts.Nanos < 0 || ts.Nanos >= 1e9 { + return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts) + } + return nil +} diff --git a/integration-test/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go b/integration-test/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go new file mode 100644 index 000000000..a76f80760 --- /dev/null +++ b/integration-test/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go @@ -0,0 +1,64 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto + +package timestamp + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" +) + +// Symbols defined in public import of google/protobuf/timestamp.proto. + +type Timestamp = timestamppb.Timestamp + +var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor + +var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = []byte{ + 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x37, + 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} +var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } +func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { + if File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, + DependencyIndexes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, + }.Build() + File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = out.File + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil + file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil +} diff --git a/integration-test/vendor/github.com/google/go-cmp/LICENSE b/integration-test/vendor/github.com/google/go-cmp/LICENSE new file mode 100644 index 000000000..32017f8fa --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2017 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/compare.go b/integration-test/vendor/github.com/google/go-cmp/cmp/compare.go new file mode 100644 index 000000000..86d0903b8 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/compare.go @@ -0,0 +1,682 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package cmp determines equality of values. +// +// This package is intended to be a more powerful and safer alternative to +// reflect.DeepEqual for comparing whether two values are semantically equal. +// It is intended to only be used in tests, as performance is not a goal and +// it may panic if it cannot compare the values. Its propensity towards +// panicking means that its unsuitable for production environments where a +// spurious panic may be fatal. +// +// The primary features of cmp are: +// +// • When the default behavior of equality does not suit the needs of the test, +// custom equality functions can override the equality operation. +// For example, an equality function may report floats as equal so long as they +// are within some tolerance of each other. +// +// • Types that have an Equal method may use that method to determine equality. +// This allows package authors to determine the equality operation for the types +// that they define. +// +// • If no custom equality functions are used and no Equal method is defined, +// equality is determined by recursively comparing the primitive kinds on both +// values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, unexported +// fields are not compared by default; they result in panics unless suppressed +// by using an Ignore option (see cmpopts.IgnoreUnexported) or explicitly +// compared using the Exporter option. +package cmp + +import ( + "fmt" + "reflect" + "strings" + + "github.com/google/go-cmp/cmp/internal/diff" + "github.com/google/go-cmp/cmp/internal/flags" + "github.com/google/go-cmp/cmp/internal/function" + "github.com/google/go-cmp/cmp/internal/value" +) + +// Equal reports whether x and y are equal by recursively applying the +// following rules in the given order to x and y and all of their sub-values: +// +// • Let S be the set of all Ignore, Transformer, and Comparer options that +// remain after applying all path filters, value filters, and type filters. +// If at least one Ignore exists in S, then the comparison is ignored. +// If the number of Transformer and Comparer options in S is greater than one, +// then Equal panics because it is ambiguous which option to use. +// If S contains a single Transformer, then use that to transform the current +// values and recursively call Equal on the output values. +// If S contains a single Comparer, then use that to compare the current values. +// Otherwise, evaluation proceeds to the next rule. +// +// • If the values have an Equal method of the form "(T) Equal(T) bool" or +// "(T) Equal(I) bool" where T is assignable to I, then use the result of +// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and +// evaluation proceeds to the next rule. +// +// • Lastly, try to compare x and y based on their basic kinds. +// Simple kinds like booleans, integers, floats, complex numbers, strings, and +// channels are compared using the equivalent of the == operator in Go. +// Functions are only equal if they are both nil, otherwise they are unequal. +// +// Structs are equal if recursively calling Equal on all fields report equal. +// If a struct contains unexported fields, Equal panics unless an Ignore option +// (e.g., cmpopts.IgnoreUnexported) ignores that field or the Exporter option +// explicitly permits comparing the unexported field. +// +// Slices are equal if they are both nil or both non-nil, where recursively +// calling Equal on all non-ignored slice or array elements report equal. +// Empty non-nil slices and nil slices are not equal; to equate empty slices, +// consider using cmpopts.EquateEmpty. +// +// Maps are equal if they are both nil or both non-nil, where recursively +// calling Equal on all non-ignored map entries report equal. +// Map keys are equal according to the == operator. +// To use custom comparisons for map keys, consider using cmpopts.SortMaps. +// Empty non-nil maps and nil maps are not equal; to equate empty maps, +// consider using cmpopts.EquateEmpty. +// +// Pointers and interfaces are equal if they are both nil or both non-nil, +// where they have the same underlying concrete type and recursively +// calling Equal on the underlying values reports equal. +// +// Before recursing into a pointer, slice element, or map, the current path +// is checked to detect whether the address has already been visited. +// If there is a cycle, then the pointed at values are considered equal +// only if both addresses were previously visited in the same path step. +func Equal(x, y interface{}, opts ...Option) bool { + s := newState(opts) + s.compareAny(rootStep(x, y)) + return s.result.Equal() +} + +// Diff returns a human-readable report of the differences between two values: +// y - x. It returns an empty string if and only if Equal returns true for the +// same input values and options. +// +// The output is displayed as a literal in pseudo-Go syntax. +// At the start of each line, a "-" prefix indicates an element removed from x, +// a "+" prefix to indicates an element added from y, and the lack of a prefix +// indicates an element common to both x and y. If possible, the output +// uses fmt.Stringer.String or error.Error methods to produce more humanly +// readable outputs. In such cases, the string is prefixed with either an +// 's' or 'e' character, respectively, to indicate that the method was called. +// +// Do not depend on this output being stable. If you need the ability to +// programmatically interpret the difference, consider using a custom Reporter. +func Diff(x, y interface{}, opts ...Option) string { + s := newState(opts) + + // Optimization: If there are no other reporters, we can optimize for the + // common case where the result is equal (and thus no reported difference). + // This avoids the expensive construction of a difference tree. + if len(s.reporters) == 0 { + s.compareAny(rootStep(x, y)) + if s.result.Equal() { + return "" + } + s.result = diff.Result{} // Reset results + } + + r := new(defaultReporter) + s.reporters = append(s.reporters, reporter{r}) + s.compareAny(rootStep(x, y)) + d := r.String() + if (d == "") != s.result.Equal() { + panic("inconsistent difference and equality results") + } + return d +} + +// rootStep constructs the first path step. If x and y have differing types, +// then they are stored within an empty interface type. +func rootStep(x, y interface{}) PathStep { + vx := reflect.ValueOf(x) + vy := reflect.ValueOf(y) + + // If the inputs are different types, auto-wrap them in an empty interface + // so that they have the same parent type. + var t reflect.Type + if !vx.IsValid() || !vy.IsValid() || vx.Type() != vy.Type() { + t = reflect.TypeOf((*interface{})(nil)).Elem() + if vx.IsValid() { + vvx := reflect.New(t).Elem() + vvx.Set(vx) + vx = vvx + } + if vy.IsValid() { + vvy := reflect.New(t).Elem() + vvy.Set(vy) + vy = vvy + } + } else { + t = vx.Type() + } + + return &pathStep{t, vx, vy} +} + +type state struct { + // These fields represent the "comparison state". + // Calling statelessCompare must not result in observable changes to these. + result diff.Result // The current result of comparison + curPath Path // The current path in the value tree + curPtrs pointerPath // The current set of visited pointers + reporters []reporter // Optional reporters + + // recChecker checks for infinite cycles applying the same set of + // transformers upon the output of itself. + recChecker recChecker + + // dynChecker triggers pseudo-random checks for option correctness. + // It is safe for statelessCompare to mutate this value. + dynChecker dynChecker + + // These fields, once set by processOption, will not change. + exporters []exporter // List of exporters for structs with unexported fields + opts Options // List of all fundamental and filter options +} + +func newState(opts []Option) *state { + // Always ensure a validator option exists to validate the inputs. + s := &state{opts: Options{validator{}}} + s.curPtrs.Init() + s.processOption(Options(opts)) + return s +} + +func (s *state) processOption(opt Option) { + switch opt := opt.(type) { + case nil: + case Options: + for _, o := range opt { + s.processOption(o) + } + case coreOption: + type filtered interface { + isFiltered() bool + } + if fopt, ok := opt.(filtered); ok && !fopt.isFiltered() { + panic(fmt.Sprintf("cannot use an unfiltered option: %v", opt)) + } + s.opts = append(s.opts, opt) + case exporter: + s.exporters = append(s.exporters, opt) + case reporter: + s.reporters = append(s.reporters, opt) + default: + panic(fmt.Sprintf("unknown option %T", opt)) + } +} + +// statelessCompare compares two values and returns the result. +// This function is stateless in that it does not alter the current result, +// or output to any registered reporters. +func (s *state) statelessCompare(step PathStep) diff.Result { + // We do not save and restore curPath and curPtrs because all of the + // compareX methods should properly push and pop from them. + // It is an implementation bug if the contents of the paths differ from + // when calling this function to when returning from it. + + oldResult, oldReporters := s.result, s.reporters + s.result = diff.Result{} // Reset result + s.reporters = nil // Remove reporters to avoid spurious printouts + s.compareAny(step) + res := s.result + s.result, s.reporters = oldResult, oldReporters + return res +} + +func (s *state) compareAny(step PathStep) { + // Update the path stack. + s.curPath.push(step) + defer s.curPath.pop() + for _, r := range s.reporters { + r.PushStep(step) + defer r.PopStep() + } + s.recChecker.Check(s.curPath) + + // Cycle-detection for slice elements (see NOTE in compareSlice). + t := step.Type() + vx, vy := step.Values() + if si, ok := step.(SliceIndex); ok && si.isSlice && vx.IsValid() && vy.IsValid() { + px, py := vx.Addr(), vy.Addr() + if eq, visited := s.curPtrs.Push(px, py); visited { + s.report(eq, reportByCycle) + return + } + defer s.curPtrs.Pop(px, py) + } + + // Rule 1: Check whether an option applies on this node in the value tree. + if s.tryOptions(t, vx, vy) { + return + } + + // Rule 2: Check whether the type has a valid Equal method. + if s.tryMethod(t, vx, vy) { + return + } + + // Rule 3: Compare based on the underlying kind. + switch t.Kind() { + case reflect.Bool: + s.report(vx.Bool() == vy.Bool(), 0) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + s.report(vx.Int() == vy.Int(), 0) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + s.report(vx.Uint() == vy.Uint(), 0) + case reflect.Float32, reflect.Float64: + s.report(vx.Float() == vy.Float(), 0) + case reflect.Complex64, reflect.Complex128: + s.report(vx.Complex() == vy.Complex(), 0) + case reflect.String: + s.report(vx.String() == vy.String(), 0) + case reflect.Chan, reflect.UnsafePointer: + s.report(vx.Pointer() == vy.Pointer(), 0) + case reflect.Func: + s.report(vx.IsNil() && vy.IsNil(), 0) + case reflect.Struct: + s.compareStruct(t, vx, vy) + case reflect.Slice, reflect.Array: + s.compareSlice(t, vx, vy) + case reflect.Map: + s.compareMap(t, vx, vy) + case reflect.Ptr: + s.comparePtr(t, vx, vy) + case reflect.Interface: + s.compareInterface(t, vx, vy) + default: + panic(fmt.Sprintf("%v kind not handled", t.Kind())) + } +} + +func (s *state) tryOptions(t reflect.Type, vx, vy reflect.Value) bool { + // Evaluate all filters and apply the remaining options. + if opt := s.opts.filter(s, t, vx, vy); opt != nil { + opt.apply(s, vx, vy) + return true + } + return false +} + +func (s *state) tryMethod(t reflect.Type, vx, vy reflect.Value) bool { + // Check if this type even has an Equal method. + m, ok := t.MethodByName("Equal") + if !ok || !function.IsType(m.Type, function.EqualAssignable) { + return false + } + + eq := s.callTTBFunc(m.Func, vx, vy) + s.report(eq, reportByMethod) + return true +} + +func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value { + v = sanitizeValue(v, f.Type().In(0)) + if !s.dynChecker.Next() { + return f.Call([]reflect.Value{v})[0] + } + + // Run the function twice and ensure that we get the same results back. + // We run in goroutines so that the race detector (if enabled) can detect + // unsafe mutations to the input. + c := make(chan reflect.Value) + go detectRaces(c, f, v) + got := <-c + want := f.Call([]reflect.Value{v})[0] + if step.vx, step.vy = got, want; !s.statelessCompare(step).Equal() { + // To avoid false-positives with non-reflexive equality operations, + // we sanity check whether a value is equal to itself. + if step.vx, step.vy = want, want; !s.statelessCompare(step).Equal() { + return want + } + panic(fmt.Sprintf("non-deterministic function detected: %s", function.NameOf(f))) + } + return want +} + +func (s *state) callTTBFunc(f, x, y reflect.Value) bool { + x = sanitizeValue(x, f.Type().In(0)) + y = sanitizeValue(y, f.Type().In(1)) + if !s.dynChecker.Next() { + return f.Call([]reflect.Value{x, y})[0].Bool() + } + + // Swapping the input arguments is sufficient to check that + // f is symmetric and deterministic. + // We run in goroutines so that the race detector (if enabled) can detect + // unsafe mutations to the input. + c := make(chan reflect.Value) + go detectRaces(c, f, y, x) + got := <-c + want := f.Call([]reflect.Value{x, y})[0].Bool() + if !got.IsValid() || got.Bool() != want { + panic(fmt.Sprintf("non-deterministic or non-symmetric function detected: %s", function.NameOf(f))) + } + return want +} + +func detectRaces(c chan<- reflect.Value, f reflect.Value, vs ...reflect.Value) { + var ret reflect.Value + defer func() { + recover() // Ignore panics, let the other call to f panic instead + c <- ret + }() + ret = f.Call(vs)[0] +} + +// sanitizeValue converts nil interfaces of type T to those of type R, +// assuming that T is assignable to R. +// Otherwise, it returns the input value as is. +func sanitizeValue(v reflect.Value, t reflect.Type) reflect.Value { + // TODO(≥go1.10): Workaround for reflect bug (https://golang.org/issue/22143). + if !flags.AtLeastGo110 { + if v.Kind() == reflect.Interface && v.IsNil() && v.Type() != t { + return reflect.New(t).Elem() + } + } + return v +} + +func (s *state) compareStruct(t reflect.Type, vx, vy reflect.Value) { + var addr bool + var vax, vay reflect.Value // Addressable versions of vx and vy + + var mayForce, mayForceInit bool + step := StructField{&structField{}} + for i := 0; i < t.NumField(); i++ { + step.typ = t.Field(i).Type + step.vx = vx.Field(i) + step.vy = vy.Field(i) + step.name = t.Field(i).Name + step.idx = i + step.unexported = !isExported(step.name) + if step.unexported { + if step.name == "_" { + continue + } + // Defer checking of unexported fields until later to give an + // Ignore a chance to ignore the field. + if !vax.IsValid() || !vay.IsValid() { + // For retrieveUnexportedField to work, the parent struct must + // be addressable. Create a new copy of the values if + // necessary to make them addressable. + addr = vx.CanAddr() || vy.CanAddr() + vax = makeAddressable(vx) + vay = makeAddressable(vy) + } + if !mayForceInit { + for _, xf := range s.exporters { + mayForce = mayForce || xf(t) + } + mayForceInit = true + } + step.mayForce = mayForce + step.paddr = addr + step.pvx = vax + step.pvy = vay + step.field = t.Field(i) + } + s.compareAny(step) + } +} + +func (s *state) compareSlice(t reflect.Type, vx, vy reflect.Value) { + isSlice := t.Kind() == reflect.Slice + if isSlice && (vx.IsNil() || vy.IsNil()) { + s.report(vx.IsNil() && vy.IsNil(), 0) + return + } + + // NOTE: It is incorrect to call curPtrs.Push on the slice header pointer + // since slices represents a list of pointers, rather than a single pointer. + // The pointer checking logic must be handled on a per-element basis + // in compareAny. + // + // A slice header (see reflect.SliceHeader) in Go is a tuple of a starting + // pointer P, a length N, and a capacity C. Supposing each slice element has + // a memory size of M, then the slice is equivalent to the list of pointers: + // [P+i*M for i in range(N)] + // + // For example, v[:0] and v[:1] are slices with the same starting pointer, + // but they are clearly different values. Using the slice pointer alone + // violates the assumption that equal pointers implies equal values. + + step := SliceIndex{&sliceIndex{pathStep: pathStep{typ: t.Elem()}, isSlice: isSlice}} + withIndexes := func(ix, iy int) SliceIndex { + if ix >= 0 { + step.vx, step.xkey = vx.Index(ix), ix + } else { + step.vx, step.xkey = reflect.Value{}, -1 + } + if iy >= 0 { + step.vy, step.ykey = vy.Index(iy), iy + } else { + step.vy, step.ykey = reflect.Value{}, -1 + } + return step + } + + // Ignore options are able to ignore missing elements in a slice. + // However, detecting these reliably requires an optimal differencing + // algorithm, for which diff.Difference is not. + // + // Instead, we first iterate through both slices to detect which elements + // would be ignored if standing alone. The index of non-discarded elements + // are stored in a separate slice, which diffing is then performed on. + var indexesX, indexesY []int + var ignoredX, ignoredY []bool + for ix := 0; ix < vx.Len(); ix++ { + ignored := s.statelessCompare(withIndexes(ix, -1)).NumDiff == 0 + if !ignored { + indexesX = append(indexesX, ix) + } + ignoredX = append(ignoredX, ignored) + } + for iy := 0; iy < vy.Len(); iy++ { + ignored := s.statelessCompare(withIndexes(-1, iy)).NumDiff == 0 + if !ignored { + indexesY = append(indexesY, iy) + } + ignoredY = append(ignoredY, ignored) + } + + // Compute an edit-script for slices vx and vy (excluding ignored elements). + edits := diff.Difference(len(indexesX), len(indexesY), func(ix, iy int) diff.Result { + return s.statelessCompare(withIndexes(indexesX[ix], indexesY[iy])) + }) + + // Replay the ignore-scripts and the edit-script. + var ix, iy int + for ix < vx.Len() || iy < vy.Len() { + var e diff.EditType + switch { + case ix < len(ignoredX) && ignoredX[ix]: + e = diff.UniqueX + case iy < len(ignoredY) && ignoredY[iy]: + e = diff.UniqueY + default: + e, edits = edits[0], edits[1:] + } + switch e { + case diff.UniqueX: + s.compareAny(withIndexes(ix, -1)) + ix++ + case diff.UniqueY: + s.compareAny(withIndexes(-1, iy)) + iy++ + default: + s.compareAny(withIndexes(ix, iy)) + ix++ + iy++ + } + } +} + +func (s *state) compareMap(t reflect.Type, vx, vy reflect.Value) { + if vx.IsNil() || vy.IsNil() { + s.report(vx.IsNil() && vy.IsNil(), 0) + return + } + + // Cycle-detection for maps. + if eq, visited := s.curPtrs.Push(vx, vy); visited { + s.report(eq, reportByCycle) + return + } + defer s.curPtrs.Pop(vx, vy) + + // We combine and sort the two map keys so that we can perform the + // comparisons in a deterministic order. + step := MapIndex{&mapIndex{pathStep: pathStep{typ: t.Elem()}}} + for _, k := range value.SortKeys(append(vx.MapKeys(), vy.MapKeys()...)) { + step.vx = vx.MapIndex(k) + step.vy = vy.MapIndex(k) + step.key = k + if !step.vx.IsValid() && !step.vy.IsValid() { + // It is possible for both vx and vy to be invalid if the + // key contained a NaN value in it. + // + // Even with the ability to retrieve NaN keys in Go 1.12, + // there still isn't a sensible way to compare the values since + // a NaN key may map to multiple unordered values. + // The most reasonable way to compare NaNs would be to compare the + // set of values. However, this is impossible to do efficiently + // since set equality is provably an O(n^2) operation given only + // an Equal function. If we had a Less function or Hash function, + // this could be done in O(n*log(n)) or O(n), respectively. + // + // Rather than adding complex logic to deal with NaNs, make it + // the user's responsibility to compare such obscure maps. + const help = "consider providing a Comparer to compare the map" + panic(fmt.Sprintf("%#v has map key with NaNs\n%s", s.curPath, help)) + } + s.compareAny(step) + } +} + +func (s *state) comparePtr(t reflect.Type, vx, vy reflect.Value) { + if vx.IsNil() || vy.IsNil() { + s.report(vx.IsNil() && vy.IsNil(), 0) + return + } + + // Cycle-detection for pointers. + if eq, visited := s.curPtrs.Push(vx, vy); visited { + s.report(eq, reportByCycle) + return + } + defer s.curPtrs.Pop(vx, vy) + + vx, vy = vx.Elem(), vy.Elem() + s.compareAny(Indirect{&indirect{pathStep{t.Elem(), vx, vy}}}) +} + +func (s *state) compareInterface(t reflect.Type, vx, vy reflect.Value) { + if vx.IsNil() || vy.IsNil() { + s.report(vx.IsNil() && vy.IsNil(), 0) + return + } + vx, vy = vx.Elem(), vy.Elem() + if vx.Type() != vy.Type() { + s.report(false, 0) + return + } + s.compareAny(TypeAssertion{&typeAssertion{pathStep{vx.Type(), vx, vy}}}) +} + +func (s *state) report(eq bool, rf resultFlags) { + if rf&reportByIgnore == 0 { + if eq { + s.result.NumSame++ + rf |= reportEqual + } else { + s.result.NumDiff++ + rf |= reportUnequal + } + } + for _, r := range s.reporters { + r.Report(Result{flags: rf}) + } +} + +// recChecker tracks the state needed to periodically perform checks that +// user provided transformers are not stuck in an infinitely recursive cycle. +type recChecker struct{ next int } + +// Check scans the Path for any recursive transformers and panics when any +// recursive transformers are detected. Note that the presence of a +// recursive Transformer does not necessarily imply an infinite cycle. +// As such, this check only activates after some minimal number of path steps. +func (rc *recChecker) Check(p Path) { + const minLen = 1 << 16 + if rc.next == 0 { + rc.next = minLen + } + if len(p) < rc.next { + return + } + rc.next <<= 1 + + // Check whether the same transformer has appeared at least twice. + var ss []string + m := map[Option]int{} + for _, ps := range p { + if t, ok := ps.(Transform); ok { + t := t.Option() + if m[t] == 1 { // Transformer was used exactly once before + tf := t.(*transformer).fnc.Type() + ss = append(ss, fmt.Sprintf("%v: %v => %v", t, tf.In(0), tf.Out(0))) + } + m[t]++ + } + } + if len(ss) > 0 { + const warning = "recursive set of Transformers detected" + const help = "consider using cmpopts.AcyclicTransformer" + set := strings.Join(ss, "\n\t") + panic(fmt.Sprintf("%s:\n\t%s\n%s", warning, set, help)) + } +} + +// dynChecker tracks the state needed to periodically perform checks that +// user provided functions are symmetric and deterministic. +// The zero value is safe for immediate use. +type dynChecker struct{ curr, next int } + +// Next increments the state and reports whether a check should be performed. +// +// Checks occur every Nth function call, where N is a triangular number: +// 0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 ... +// See https://en.wikipedia.org/wiki/Triangular_number +// +// This sequence ensures that the cost of checks drops significantly as +// the number of functions calls grows larger. +func (dc *dynChecker) Next() bool { + ok := dc.curr == dc.next + if ok { + dc.curr = 0 + dc.next++ + } + dc.curr++ + return ok +} + +// makeAddressable returns a value that is always addressable. +// It returns the input verbatim if it is already addressable, +// otherwise it creates a new value and returns an addressable copy. +func makeAddressable(v reflect.Value) reflect.Value { + if v.CanAddr() { + return v + } + vc := reflect.New(v.Type()).Elem() + vc.Set(v) + return vc +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/export_panic.go b/integration-test/vendor/github.com/google/go-cmp/cmp/export_panic.go new file mode 100644 index 000000000..5ff0b4218 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/export_panic.go @@ -0,0 +1,15 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build purego + +package cmp + +import "reflect" + +const supportExporters = false + +func retrieveUnexportedField(reflect.Value, reflect.StructField, bool) reflect.Value { + panic("no support for forcibly accessing unexported fields") +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/export_unsafe.go b/integration-test/vendor/github.com/google/go-cmp/cmp/export_unsafe.go new file mode 100644 index 000000000..21eb54858 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/export_unsafe.go @@ -0,0 +1,35 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !purego + +package cmp + +import ( + "reflect" + "unsafe" +) + +const supportExporters = true + +// retrieveUnexportedField uses unsafe to forcibly retrieve any field from +// a struct such that the value has read-write permissions. +// +// The parent struct, v, must be addressable, while f must be a StructField +// describing the field to retrieve. If addr is false, +// then the returned value will be shallowed copied to be non-addressable. +func retrieveUnexportedField(v reflect.Value, f reflect.StructField, addr bool) reflect.Value { + ve := reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem() + if !addr { + // A field is addressable if and only if the struct is addressable. + // If the original parent value was not addressable, shallow copy the + // value to make it non-addressable to avoid leaking an implementation + // detail of how forcibly exporting a field works. + if ve.Kind() == reflect.Interface && ve.IsNil() { + return reflect.Zero(f.Type) + } + return reflect.ValueOf(ve.Interface()).Convert(f.Type) + } + return ve +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go new file mode 100644 index 000000000..1daaaacc5 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go @@ -0,0 +1,17 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !cmp_debug + +package diff + +var debug debugger + +type debugger struct{} + +func (debugger) Begin(_, _ int, f EqualFunc, _, _ *EditScript) EqualFunc { + return f +} +func (debugger) Update() {} +func (debugger) Finish() {} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go new file mode 100644 index 000000000..4b91dbcac --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go @@ -0,0 +1,122 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build cmp_debug + +package diff + +import ( + "fmt" + "strings" + "sync" + "time" +) + +// The algorithm can be seen running in real-time by enabling debugging: +// go test -tags=cmp_debug -v +// +// Example output: +// === RUN TestDifference/#34 +// ┌───────────────────────────────┐ +// │ \ · · · · · · · · · · · · · · │ +// │ · # · · · · · · · · · · · · · │ +// │ · \ · · · · · · · · · · · · · │ +// │ · · \ · · · · · · · · · · · · │ +// │ · · · X # · · · · · · · · · · │ +// │ · · · # \ · · · · · · · · · · │ +// │ · · · · · # # · · · · · · · · │ +// │ · · · · · # \ · · · · · · · · │ +// │ · · · · · · · \ · · · · · · · │ +// │ · · · · · · · · \ · · · · · · │ +// │ · · · · · · · · · \ · · · · · │ +// │ · · · · · · · · · · \ · · # · │ +// │ · · · · · · · · · · · \ # # · │ +// │ · · · · · · · · · · · # # # · │ +// │ · · · · · · · · · · # # # # · │ +// │ · · · · · · · · · # # # # # · │ +// │ · · · · · · · · · · · · · · \ │ +// └───────────────────────────────┘ +// [.Y..M.XY......YXYXY.|] +// +// The grid represents the edit-graph where the horizontal axis represents +// list X and the vertical axis represents list Y. The start of the two lists +// is the top-left, while the ends are the bottom-right. The '·' represents +// an unexplored node in the graph. The '\' indicates that the two symbols +// from list X and Y are equal. The 'X' indicates that two symbols are similar +// (but not exactly equal) to each other. The '#' indicates that the two symbols +// are different (and not similar). The algorithm traverses this graph trying to +// make the paths starting in the top-left and the bottom-right connect. +// +// The series of '.', 'X', 'Y', and 'M' characters at the bottom represents +// the currently established path from the forward and reverse searches, +// separated by a '|' character. + +const ( + updateDelay = 100 * time.Millisecond + finishDelay = 500 * time.Millisecond + ansiTerminal = true // ANSI escape codes used to move terminal cursor +) + +var debug debugger + +type debugger struct { + sync.Mutex + p1, p2 EditScript + fwdPath, revPath *EditScript + grid []byte + lines int +} + +func (dbg *debugger) Begin(nx, ny int, f EqualFunc, p1, p2 *EditScript) EqualFunc { + dbg.Lock() + dbg.fwdPath, dbg.revPath = p1, p2 + top := "┌─" + strings.Repeat("──", nx) + "┐\n" + row := "│ " + strings.Repeat("· ", nx) + "│\n" + btm := "└─" + strings.Repeat("──", nx) + "┘\n" + dbg.grid = []byte(top + strings.Repeat(row, ny) + btm) + dbg.lines = strings.Count(dbg.String(), "\n") + fmt.Print(dbg) + + // Wrap the EqualFunc so that we can intercept each result. + return func(ix, iy int) (r Result) { + cell := dbg.grid[len(top)+iy*len(row):][len("│ ")+len("· ")*ix:][:len("·")] + for i := range cell { + cell[i] = 0 // Zero out the multiple bytes of UTF-8 middle-dot + } + switch r = f(ix, iy); { + case r.Equal(): + cell[0] = '\\' + case r.Similar(): + cell[0] = 'X' + default: + cell[0] = '#' + } + return + } +} + +func (dbg *debugger) Update() { + dbg.print(updateDelay) +} + +func (dbg *debugger) Finish() { + dbg.print(finishDelay) + dbg.Unlock() +} + +func (dbg *debugger) String() string { + dbg.p1, dbg.p2 = *dbg.fwdPath, dbg.p2[:0] + for i := len(*dbg.revPath) - 1; i >= 0; i-- { + dbg.p2 = append(dbg.p2, (*dbg.revPath)[i]) + } + return fmt.Sprintf("%s[%v|%v]\n\n", dbg.grid, dbg.p1, dbg.p2) +} + +func (dbg *debugger) print(d time.Duration) { + if ansiTerminal { + fmt.Printf("\x1b[%dA", dbg.lines) // Reset terminal cursor + } + fmt.Print(dbg) + time.Sleep(d) +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go new file mode 100644 index 000000000..bc196b16c --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go @@ -0,0 +1,398 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package diff implements an algorithm for producing edit-scripts. +// The edit-script is a sequence of operations needed to transform one list +// of symbols into another (or vice-versa). The edits allowed are insertions, +// deletions, and modifications. The summation of all edits is called the +// Levenshtein distance as this problem is well-known in computer science. +// +// This package prioritizes performance over accuracy. That is, the run time +// is more important than obtaining a minimal Levenshtein distance. +package diff + +import ( + "math/rand" + "time" + + "github.com/google/go-cmp/cmp/internal/flags" +) + +// EditType represents a single operation within an edit-script. +type EditType uint8 + +const ( + // Identity indicates that a symbol pair is identical in both list X and Y. + Identity EditType = iota + // UniqueX indicates that a symbol only exists in X and not Y. + UniqueX + // UniqueY indicates that a symbol only exists in Y and not X. + UniqueY + // Modified indicates that a symbol pair is a modification of each other. + Modified +) + +// EditScript represents the series of differences between two lists. +type EditScript []EditType + +// String returns a human-readable string representing the edit-script where +// Identity, UniqueX, UniqueY, and Modified are represented by the +// '.', 'X', 'Y', and 'M' characters, respectively. +func (es EditScript) String() string { + b := make([]byte, len(es)) + for i, e := range es { + switch e { + case Identity: + b[i] = '.' + case UniqueX: + b[i] = 'X' + case UniqueY: + b[i] = 'Y' + case Modified: + b[i] = 'M' + default: + panic("invalid edit-type") + } + } + return string(b) +} + +// stats returns a histogram of the number of each type of edit operation. +func (es EditScript) stats() (s struct{ NI, NX, NY, NM int }) { + for _, e := range es { + switch e { + case Identity: + s.NI++ + case UniqueX: + s.NX++ + case UniqueY: + s.NY++ + case Modified: + s.NM++ + default: + panic("invalid edit-type") + } + } + return +} + +// Dist is the Levenshtein distance and is guaranteed to be 0 if and only if +// lists X and Y are equal. +func (es EditScript) Dist() int { return len(es) - es.stats().NI } + +// LenX is the length of the X list. +func (es EditScript) LenX() int { return len(es) - es.stats().NY } + +// LenY is the length of the Y list. +func (es EditScript) LenY() int { return len(es) - es.stats().NX } + +// EqualFunc reports whether the symbols at indexes ix and iy are equal. +// When called by Difference, the index is guaranteed to be within nx and ny. +type EqualFunc func(ix int, iy int) Result + +// Result is the result of comparison. +// NumSame is the number of sub-elements that are equal. +// NumDiff is the number of sub-elements that are not equal. +type Result struct{ NumSame, NumDiff int } + +// BoolResult returns a Result that is either Equal or not Equal. +func BoolResult(b bool) Result { + if b { + return Result{NumSame: 1} // Equal, Similar + } else { + return Result{NumDiff: 2} // Not Equal, not Similar + } +} + +// Equal indicates whether the symbols are equal. Two symbols are equal +// if and only if NumDiff == 0. If Equal, then they are also Similar. +func (r Result) Equal() bool { return r.NumDiff == 0 } + +// Similar indicates whether two symbols are similar and may be represented +// by using the Modified type. As a special case, we consider binary comparisons +// (i.e., those that return Result{1, 0} or Result{0, 1}) to be similar. +// +// The exact ratio of NumSame to NumDiff to determine similarity may change. +func (r Result) Similar() bool { + // Use NumSame+1 to offset NumSame so that binary comparisons are similar. + return r.NumSame+1 >= r.NumDiff +} + +var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 + +// Difference reports whether two lists of lengths nx and ny are equal +// given the definition of equality provided as f. +// +// This function returns an edit-script, which is a sequence of operations +// needed to convert one list into the other. The following invariants for +// the edit-script are maintained: +// • eq == (es.Dist()==0) +// • nx == es.LenX() +// • ny == es.LenY() +// +// This algorithm is not guaranteed to be an optimal solution (i.e., one that +// produces an edit-script with a minimal Levenshtein distance). This algorithm +// favors performance over optimality. The exact output is not guaranteed to +// be stable and may change over time. +func Difference(nx, ny int, f EqualFunc) (es EditScript) { + // This algorithm is based on traversing what is known as an "edit-graph". + // See Figure 1 from "An O(ND) Difference Algorithm and Its Variations" + // by Eugene W. Myers. Since D can be as large as N itself, this is + // effectively O(N^2). Unlike the algorithm from that paper, we are not + // interested in the optimal path, but at least some "decent" path. + // + // For example, let X and Y be lists of symbols: + // X = [A B C A B B A] + // Y = [C B A B A C] + // + // The edit-graph can be drawn as the following: + // A B C A B B A + // ┌─────────────┐ + // C │_|_|\|_|_|_|_│ 0 + // B │_|\|_|_|\|\|_│ 1 + // A │\|_|_|\|_|_|\│ 2 + // B │_|\|_|_|\|\|_│ 3 + // A │\|_|_|\|_|_|\│ 4 + // C │ | |\| | | | │ 5 + // └─────────────┘ 6 + // 0 1 2 3 4 5 6 7 + // + // List X is written along the horizontal axis, while list Y is written + // along the vertical axis. At any point on this grid, if the symbol in + // list X matches the corresponding symbol in list Y, then a '\' is drawn. + // The goal of any minimal edit-script algorithm is to find a path from the + // top-left corner to the bottom-right corner, while traveling through the + // fewest horizontal or vertical edges. + // A horizontal edge is equivalent to inserting a symbol from list X. + // A vertical edge is equivalent to inserting a symbol from list Y. + // A diagonal edge is equivalent to a matching symbol between both X and Y. + + // Invariants: + // • 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx + // • 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny + // + // In general: + // • fwdFrontier.X < revFrontier.X + // • fwdFrontier.Y < revFrontier.Y + // Unless, it is time for the algorithm to terminate. + fwdPath := path{+1, point{0, 0}, make(EditScript, 0, (nx+ny)/2)} + revPath := path{-1, point{nx, ny}, make(EditScript, 0)} + fwdFrontier := fwdPath.point // Forward search frontier + revFrontier := revPath.point // Reverse search frontier + + // Search budget bounds the cost of searching for better paths. + // The longest sequence of non-matching symbols that can be tolerated is + // approximately the square-root of the search budget. + searchBudget := 4 * (nx + ny) // O(n) + + // Running the tests with the "cmp_debug" build tag prints a visualization + // of the algorithm running in real-time. This is educational for + // understanding how the algorithm works. See debug_enable.go. + f = debug.Begin(nx, ny, f, &fwdPath.es, &revPath.es) + + // The algorithm below is a greedy, meet-in-the-middle algorithm for + // computing sub-optimal edit-scripts between two lists. + // + // The algorithm is approximately as follows: + // • Searching for differences switches back-and-forth between + // a search that starts at the beginning (the top-left corner), and + // a search that starts at the end (the bottom-right corner). The goal of + // the search is connect with the search from the opposite corner. + // • As we search, we build a path in a greedy manner, where the first + // match seen is added to the path (this is sub-optimal, but provides a + // decent result in practice). When matches are found, we try the next pair + // of symbols in the lists and follow all matches as far as possible. + // • When searching for matches, we search along a diagonal going through + // through the "frontier" point. If no matches are found, we advance the + // frontier towards the opposite corner. + // • This algorithm terminates when either the X coordinates or the + // Y coordinates of the forward and reverse frontier points ever intersect. + + // This algorithm is correct even if searching only in the forward direction + // or in the reverse direction. We do both because it is commonly observed + // that two lists commonly differ because elements were added to the front + // or end of the other list. + // + // Non-deterministically start with either the forward or reverse direction + // to introduce some deliberate instability so that we have the flexibility + // to change this algorithm in the future. + if flags.Deterministic || randBool { + goto forwardSearch + } else { + goto reverseSearch + } + +forwardSearch: + { + // Forward search from the beginning. + if fwdFrontier.X >= revFrontier.X || fwdFrontier.Y >= revFrontier.Y || searchBudget == 0 { + goto finishSearch + } + for stop1, stop2, i := false, false, 0; !(stop1 && stop2) && searchBudget > 0; i++ { + // Search in a diagonal pattern for a match. + z := zigzag(i) + p := point{fwdFrontier.X + z, fwdFrontier.Y - z} + switch { + case p.X >= revPath.X || p.Y < fwdPath.Y: + stop1 = true // Hit top-right corner + case p.Y >= revPath.Y || p.X < fwdPath.X: + stop2 = true // Hit bottom-left corner + case f(p.X, p.Y).Equal(): + // Match found, so connect the path to this point. + fwdPath.connect(p, f) + fwdPath.append(Identity) + // Follow sequence of matches as far as possible. + for fwdPath.X < revPath.X && fwdPath.Y < revPath.Y { + if !f(fwdPath.X, fwdPath.Y).Equal() { + break + } + fwdPath.append(Identity) + } + fwdFrontier = fwdPath.point + stop1, stop2 = true, true + default: + searchBudget-- // Match not found + } + debug.Update() + } + // Advance the frontier towards reverse point. + if revPath.X-fwdFrontier.X >= revPath.Y-fwdFrontier.Y { + fwdFrontier.X++ + } else { + fwdFrontier.Y++ + } + goto reverseSearch + } + +reverseSearch: + { + // Reverse search from the end. + if fwdFrontier.X >= revFrontier.X || fwdFrontier.Y >= revFrontier.Y || searchBudget == 0 { + goto finishSearch + } + for stop1, stop2, i := false, false, 0; !(stop1 && stop2) && searchBudget > 0; i++ { + // Search in a diagonal pattern for a match. + z := zigzag(i) + p := point{revFrontier.X - z, revFrontier.Y + z} + switch { + case fwdPath.X >= p.X || revPath.Y < p.Y: + stop1 = true // Hit bottom-left corner + case fwdPath.Y >= p.Y || revPath.X < p.X: + stop2 = true // Hit top-right corner + case f(p.X-1, p.Y-1).Equal(): + // Match found, so connect the path to this point. + revPath.connect(p, f) + revPath.append(Identity) + // Follow sequence of matches as far as possible. + for fwdPath.X < revPath.X && fwdPath.Y < revPath.Y { + if !f(revPath.X-1, revPath.Y-1).Equal() { + break + } + revPath.append(Identity) + } + revFrontier = revPath.point + stop1, stop2 = true, true + default: + searchBudget-- // Match not found + } + debug.Update() + } + // Advance the frontier towards forward point. + if revFrontier.X-fwdPath.X >= revFrontier.Y-fwdPath.Y { + revFrontier.X-- + } else { + revFrontier.Y-- + } + goto forwardSearch + } + +finishSearch: + // Join the forward and reverse paths and then append the reverse path. + fwdPath.connect(revPath.point, f) + for i := len(revPath.es) - 1; i >= 0; i-- { + t := revPath.es[i] + revPath.es = revPath.es[:i] + fwdPath.append(t) + } + debug.Finish() + return fwdPath.es +} + +type path struct { + dir int // +1 if forward, -1 if reverse + point // Leading point of the EditScript path + es EditScript +} + +// connect appends any necessary Identity, Modified, UniqueX, or UniqueY types +// to the edit-script to connect p.point to dst. +func (p *path) connect(dst point, f EqualFunc) { + if p.dir > 0 { + // Connect in forward direction. + for dst.X > p.X && dst.Y > p.Y { + switch r := f(p.X, p.Y); { + case r.Equal(): + p.append(Identity) + case r.Similar(): + p.append(Modified) + case dst.X-p.X >= dst.Y-p.Y: + p.append(UniqueX) + default: + p.append(UniqueY) + } + } + for dst.X > p.X { + p.append(UniqueX) + } + for dst.Y > p.Y { + p.append(UniqueY) + } + } else { + // Connect in reverse direction. + for p.X > dst.X && p.Y > dst.Y { + switch r := f(p.X-1, p.Y-1); { + case r.Equal(): + p.append(Identity) + case r.Similar(): + p.append(Modified) + case p.Y-dst.Y >= p.X-dst.X: + p.append(UniqueY) + default: + p.append(UniqueX) + } + } + for p.X > dst.X { + p.append(UniqueX) + } + for p.Y > dst.Y { + p.append(UniqueY) + } + } +} + +func (p *path) append(t EditType) { + p.es = append(p.es, t) + switch t { + case Identity, Modified: + p.add(p.dir, p.dir) + case UniqueX: + p.add(p.dir, 0) + case UniqueY: + p.add(0, p.dir) + } + debug.Update() +} + +type point struct{ X, Y int } + +func (p *point) add(dx, dy int) { p.X += dx; p.Y += dy } + +// zigzag maps a consecutive sequence of integers to a zig-zag sequence. +// [0 1 2 3 4 5 ...] => [0 -1 +1 -2 +2 ...] +func zigzag(x int) int { + if x&1 != 0 { + x = ^x + } + return x >> 1 +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go new file mode 100644 index 000000000..d8e459c9b --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go @@ -0,0 +1,9 @@ +// Copyright 2019, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package flags + +// Deterministic controls whether the output of Diff should be deterministic. +// This is only used for testing. +var Deterministic bool diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go new file mode 100644 index 000000000..82d1d7fbf --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go @@ -0,0 +1,10 @@ +// Copyright 2019, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !go1.10 + +package flags + +// AtLeastGo110 reports whether the Go toolchain is at least Go 1.10. +const AtLeastGo110 = false diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go new file mode 100644 index 000000000..8646f0529 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go @@ -0,0 +1,10 @@ +// Copyright 2019, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.10 + +package flags + +// AtLeastGo110 reports whether the Go toolchain is at least Go 1.10. +const AtLeastGo110 = true diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/function/func.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/function/func.go new file mode 100644 index 000000000..d127d4362 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/function/func.go @@ -0,0 +1,99 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package function provides functionality for identifying function types. +package function + +import ( + "reflect" + "regexp" + "runtime" + "strings" +) + +type funcType int + +const ( + _ funcType = iota + + tbFunc // func(T) bool + ttbFunc // func(T, T) bool + trbFunc // func(T, R) bool + tibFunc // func(T, I) bool + trFunc // func(T) R + + Equal = ttbFunc // func(T, T) bool + EqualAssignable = tibFunc // func(T, I) bool; encapsulates func(T, T) bool + Transformer = trFunc // func(T) R + ValueFilter = ttbFunc // func(T, T) bool + Less = ttbFunc // func(T, T) bool + ValuePredicate = tbFunc // func(T) bool + KeyValuePredicate = trbFunc // func(T, R) bool +) + +var boolType = reflect.TypeOf(true) + +// IsType reports whether the reflect.Type is of the specified function type. +func IsType(t reflect.Type, ft funcType) bool { + if t == nil || t.Kind() != reflect.Func || t.IsVariadic() { + return false + } + ni, no := t.NumIn(), t.NumOut() + switch ft { + case tbFunc: // func(T) bool + if ni == 1 && no == 1 && t.Out(0) == boolType { + return true + } + case ttbFunc: // func(T, T) bool + if ni == 2 && no == 1 && t.In(0) == t.In(1) && t.Out(0) == boolType { + return true + } + case trbFunc: // func(T, R) bool + if ni == 2 && no == 1 && t.Out(0) == boolType { + return true + } + case tibFunc: // func(T, I) bool + if ni == 2 && no == 1 && t.In(0).AssignableTo(t.In(1)) && t.Out(0) == boolType { + return true + } + case trFunc: // func(T) R + if ni == 1 && no == 1 { + return true + } + } + return false +} + +var lastIdentRx = regexp.MustCompile(`[_\p{L}][_\p{L}\p{N}]*$`) + +// NameOf returns the name of the function value. +func NameOf(v reflect.Value) string { + fnc := runtime.FuncForPC(v.Pointer()) + if fnc == nil { + return "" + } + fullName := fnc.Name() // e.g., "long/path/name/mypkg.(*MyType).(long/path/name/mypkg.myMethod)-fm" + + // Method closures have a "-fm" suffix. + fullName = strings.TrimSuffix(fullName, "-fm") + + var name string + for len(fullName) > 0 { + inParen := strings.HasSuffix(fullName, ")") + fullName = strings.TrimSuffix(fullName, ")") + + s := lastIdentRx.FindString(fullName) + if s == "" { + break + } + name = s + "." + name + fullName = strings.TrimSuffix(fullName, s) + + if i := strings.LastIndexByte(fullName, '('); inParen && i >= 0 { + fullName = fullName[:i] + } + fullName = strings.TrimSuffix(fullName, ".") + } + return strings.TrimSuffix(name, ".") +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/name.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/name.go new file mode 100644 index 000000000..b6c12cefb --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/name.go @@ -0,0 +1,157 @@ +// Copyright 2020, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package value + +import ( + "reflect" + "strconv" +) + +// TypeString is nearly identical to reflect.Type.String, +// but has an additional option to specify that full type names be used. +func TypeString(t reflect.Type, qualified bool) string { + return string(appendTypeName(nil, t, qualified, false)) +} + +func appendTypeName(b []byte, t reflect.Type, qualified, elideFunc bool) []byte { + // BUG: Go reflection provides no way to disambiguate two named types + // of the same name and within the same package, + // but declared within the namespace of different functions. + + // Named type. + if t.Name() != "" { + if qualified && t.PkgPath() != "" { + b = append(b, '"') + b = append(b, t.PkgPath()...) + b = append(b, '"') + b = append(b, '.') + b = append(b, t.Name()...) + } else { + b = append(b, t.String()...) + } + return b + } + + // Unnamed type. + switch k := t.Kind(); k { + case reflect.Bool, reflect.String, reflect.UnsafePointer, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, + reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: + b = append(b, k.String()...) + case reflect.Chan: + if t.ChanDir() == reflect.RecvDir { + b = append(b, "<-"...) + } + b = append(b, "chan"...) + if t.ChanDir() == reflect.SendDir { + b = append(b, "<-"...) + } + b = append(b, ' ') + b = appendTypeName(b, t.Elem(), qualified, false) + case reflect.Func: + if !elideFunc { + b = append(b, "func"...) + } + b = append(b, '(') + for i := 0; i < t.NumIn(); i++ { + if i > 0 { + b = append(b, ", "...) + } + if i == t.NumIn()-1 && t.IsVariadic() { + b = append(b, "..."...) + b = appendTypeName(b, t.In(i).Elem(), qualified, false) + } else { + b = appendTypeName(b, t.In(i), qualified, false) + } + } + b = append(b, ')') + switch t.NumOut() { + case 0: + // Do nothing + case 1: + b = append(b, ' ') + b = appendTypeName(b, t.Out(0), qualified, false) + default: + b = append(b, " ("...) + for i := 0; i < t.NumOut(); i++ { + if i > 0 { + b = append(b, ", "...) + } + b = appendTypeName(b, t.Out(i), qualified, false) + } + b = append(b, ')') + } + case reflect.Struct: + b = append(b, "struct{ "...) + for i := 0; i < t.NumField(); i++ { + if i > 0 { + b = append(b, "; "...) + } + sf := t.Field(i) + if !sf.Anonymous { + if qualified && sf.PkgPath != "" { + b = append(b, '"') + b = append(b, sf.PkgPath...) + b = append(b, '"') + b = append(b, '.') + } + b = append(b, sf.Name...) + b = append(b, ' ') + } + b = appendTypeName(b, sf.Type, qualified, false) + if sf.Tag != "" { + b = append(b, ' ') + b = strconv.AppendQuote(b, string(sf.Tag)) + } + } + if b[len(b)-1] == ' ' { + b = b[:len(b)-1] + } else { + b = append(b, ' ') + } + b = append(b, '}') + case reflect.Slice, reflect.Array: + b = append(b, '[') + if k == reflect.Array { + b = strconv.AppendUint(b, uint64(t.Len()), 10) + } + b = append(b, ']') + b = appendTypeName(b, t.Elem(), qualified, false) + case reflect.Map: + b = append(b, "map["...) + b = appendTypeName(b, t.Key(), qualified, false) + b = append(b, ']') + b = appendTypeName(b, t.Elem(), qualified, false) + case reflect.Ptr: + b = append(b, '*') + b = appendTypeName(b, t.Elem(), qualified, false) + case reflect.Interface: + b = append(b, "interface{ "...) + for i := 0; i < t.NumMethod(); i++ { + if i > 0 { + b = append(b, "; "...) + } + m := t.Method(i) + if qualified && m.PkgPath != "" { + b = append(b, '"') + b = append(b, m.PkgPath...) + b = append(b, '"') + b = append(b, '.') + } + b = append(b, m.Name...) + b = appendTypeName(b, m.Type, qualified, true) + } + if b[len(b)-1] == ' ' { + b = b[:len(b)-1] + } else { + b = append(b, ' ') + } + b = append(b, '}') + default: + panic("invalid kind: " + k.String()) + } + return b +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go new file mode 100644 index 000000000..44f4a5afd --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go @@ -0,0 +1,33 @@ +// Copyright 2018, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build purego + +package value + +import "reflect" + +// Pointer is an opaque typed pointer and is guaranteed to be comparable. +type Pointer struct { + p uintptr + t reflect.Type +} + +// PointerOf returns a Pointer from v, which must be a +// reflect.Ptr, reflect.Slice, or reflect.Map. +func PointerOf(v reflect.Value) Pointer { + // NOTE: Storing a pointer as an uintptr is technically incorrect as it + // assumes that the GC implementation does not use a moving collector. + return Pointer{v.Pointer(), v.Type()} +} + +// IsNil reports whether the pointer is nil. +func (p Pointer) IsNil() bool { + return p.p == 0 +} + +// Uintptr returns the pointer as a uintptr. +func (p Pointer) Uintptr() uintptr { + return p.p +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go new file mode 100644 index 000000000..a605953d4 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go @@ -0,0 +1,36 @@ +// Copyright 2018, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !purego + +package value + +import ( + "reflect" + "unsafe" +) + +// Pointer is an opaque typed pointer and is guaranteed to be comparable. +type Pointer struct { + p unsafe.Pointer + t reflect.Type +} + +// PointerOf returns a Pointer from v, which must be a +// reflect.Ptr, reflect.Slice, or reflect.Map. +func PointerOf(v reflect.Value) Pointer { + // The proper representation of a pointer is unsafe.Pointer, + // which is necessary if the GC ever uses a moving collector. + return Pointer{unsafe.Pointer(v.Pointer()), v.Type()} +} + +// IsNil reports whether the pointer is nil. +func (p Pointer) IsNil() bool { + return p.p == nil +} + +// Uintptr returns the pointer as a uintptr. +func (p Pointer) Uintptr() uintptr { + return uintptr(p.p) +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go new file mode 100644 index 000000000..98533b036 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go @@ -0,0 +1,106 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package value + +import ( + "fmt" + "math" + "reflect" + "sort" +) + +// SortKeys sorts a list of map keys, deduplicating keys if necessary. +// The type of each value must be comparable. +func SortKeys(vs []reflect.Value) []reflect.Value { + if len(vs) == 0 { + return vs + } + + // Sort the map keys. + sort.SliceStable(vs, func(i, j int) bool { return isLess(vs[i], vs[j]) }) + + // Deduplicate keys (fails for NaNs). + vs2 := vs[:1] + for _, v := range vs[1:] { + if isLess(vs2[len(vs2)-1], v) { + vs2 = append(vs2, v) + } + } + return vs2 +} + +// isLess is a generic function for sorting arbitrary map keys. +// The inputs must be of the same type and must be comparable. +func isLess(x, y reflect.Value) bool { + switch x.Type().Kind() { + case reflect.Bool: + return !x.Bool() && y.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return x.Int() < y.Int() + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return x.Uint() < y.Uint() + case reflect.Float32, reflect.Float64: + // NOTE: This does not sort -0 as less than +0 + // since Go maps treat -0 and +0 as equal keys. + fx, fy := x.Float(), y.Float() + return fx < fy || math.IsNaN(fx) && !math.IsNaN(fy) + case reflect.Complex64, reflect.Complex128: + cx, cy := x.Complex(), y.Complex() + rx, ix, ry, iy := real(cx), imag(cx), real(cy), imag(cy) + if rx == ry || (math.IsNaN(rx) && math.IsNaN(ry)) { + return ix < iy || math.IsNaN(ix) && !math.IsNaN(iy) + } + return rx < ry || math.IsNaN(rx) && !math.IsNaN(ry) + case reflect.Ptr, reflect.UnsafePointer, reflect.Chan: + return x.Pointer() < y.Pointer() + case reflect.String: + return x.String() < y.String() + case reflect.Array: + for i := 0; i < x.Len(); i++ { + if isLess(x.Index(i), y.Index(i)) { + return true + } + if isLess(y.Index(i), x.Index(i)) { + return false + } + } + return false + case reflect.Struct: + for i := 0; i < x.NumField(); i++ { + if isLess(x.Field(i), y.Field(i)) { + return true + } + if isLess(y.Field(i), x.Field(i)) { + return false + } + } + return false + case reflect.Interface: + vx, vy := x.Elem(), y.Elem() + if !vx.IsValid() || !vy.IsValid() { + return !vx.IsValid() && vy.IsValid() + } + tx, ty := vx.Type(), vy.Type() + if tx == ty { + return isLess(x.Elem(), y.Elem()) + } + if tx.Kind() != ty.Kind() { + return vx.Kind() < vy.Kind() + } + if tx.String() != ty.String() { + return tx.String() < ty.String() + } + if tx.PkgPath() != ty.PkgPath() { + return tx.PkgPath() < ty.PkgPath() + } + // This can happen in rare situations, so we fallback to just comparing + // the unique pointer for a reflect.Type. This guarantees deterministic + // ordering within a program, but it is obviously not stable. + return reflect.ValueOf(vx.Type()).Pointer() < reflect.ValueOf(vy.Type()).Pointer() + default: + // Must be Func, Map, or Slice; which are not comparable. + panic(fmt.Sprintf("%T is not comparable", x.Type())) + } +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go new file mode 100644 index 000000000..9147a2997 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go @@ -0,0 +1,48 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package value + +import ( + "math" + "reflect" +) + +// IsZero reports whether v is the zero value. +// This does not rely on Interface and so can be used on unexported fields. +func IsZero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Bool: + return v.Bool() == false + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return math.Float64bits(v.Float()) == 0 + case reflect.Complex64, reflect.Complex128: + return math.Float64bits(real(v.Complex())) == 0 && math.Float64bits(imag(v.Complex())) == 0 + case reflect.String: + return v.String() == "" + case reflect.UnsafePointer: + return v.Pointer() == 0 + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + return v.IsNil() + case reflect.Array: + for i := 0; i < v.Len(); i++ { + if !IsZero(v.Index(i)) { + return false + } + } + return true + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + if !IsZero(v.Field(i)) { + return false + } + } + return true + } + return false +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/options.go b/integration-test/vendor/github.com/google/go-cmp/cmp/options.go new file mode 100644 index 000000000..e57b9eb53 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/options.go @@ -0,0 +1,552 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import ( + "fmt" + "reflect" + "regexp" + "strings" + + "github.com/google/go-cmp/cmp/internal/function" +) + +// Option configures for specific behavior of Equal and Diff. In particular, +// the fundamental Option functions (Ignore, Transformer, and Comparer), +// configure how equality is determined. +// +// The fundamental options may be composed with filters (FilterPath and +// FilterValues) to control the scope over which they are applied. +// +// The cmp/cmpopts package provides helper functions for creating options that +// may be used with Equal and Diff. +type Option interface { + // filter applies all filters and returns the option that remains. + // Each option may only read s.curPath and call s.callTTBFunc. + // + // An Options is returned only if multiple comparers or transformers + // can apply simultaneously and will only contain values of those types + // or sub-Options containing values of those types. + filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption +} + +// applicableOption represents the following types: +// Fundamental: ignore | validator | *comparer | *transformer +// Grouping: Options +type applicableOption interface { + Option + + // apply executes the option, which may mutate s or panic. + apply(s *state, vx, vy reflect.Value) +} + +// coreOption represents the following types: +// Fundamental: ignore | validator | *comparer | *transformer +// Filters: *pathFilter | *valuesFilter +type coreOption interface { + Option + isCore() +} + +type core struct{} + +func (core) isCore() {} + +// Options is a list of Option values that also satisfies the Option interface. +// Helper comparison packages may return an Options value when packing multiple +// Option values into a single Option. When this package processes an Options, +// it will be implicitly expanded into a flat list. +// +// Applying a filter on an Options is equivalent to applying that same filter +// on all individual options held within. +type Options []Option + +func (opts Options) filter(s *state, t reflect.Type, vx, vy reflect.Value) (out applicableOption) { + for _, opt := range opts { + switch opt := opt.filter(s, t, vx, vy); opt.(type) { + case ignore: + return ignore{} // Only ignore can short-circuit evaluation + case validator: + out = validator{} // Takes precedence over comparer or transformer + case *comparer, *transformer, Options: + switch out.(type) { + case nil: + out = opt + case validator: + // Keep validator + case *comparer, *transformer, Options: + out = Options{out, opt} // Conflicting comparers or transformers + } + } + } + return out +} + +func (opts Options) apply(s *state, _, _ reflect.Value) { + const warning = "ambiguous set of applicable options" + const help = "consider using filters to ensure at most one Comparer or Transformer may apply" + var ss []string + for _, opt := range flattenOptions(nil, opts) { + ss = append(ss, fmt.Sprint(opt)) + } + set := strings.Join(ss, "\n\t") + panic(fmt.Sprintf("%s at %#v:\n\t%s\n%s", warning, s.curPath, set, help)) +} + +func (opts Options) String() string { + var ss []string + for _, opt := range opts { + ss = append(ss, fmt.Sprint(opt)) + } + return fmt.Sprintf("Options{%s}", strings.Join(ss, ", ")) +} + +// FilterPath returns a new Option where opt is only evaluated if filter f +// returns true for the current Path in the value tree. +// +// This filter is called even if a slice element or map entry is missing and +// provides an opportunity to ignore such cases. The filter function must be +// symmetric such that the filter result is identical regardless of whether the +// missing value is from x or y. +// +// The option passed in may be an Ignore, Transformer, Comparer, Options, or +// a previously filtered Option. +func FilterPath(f func(Path) bool, opt Option) Option { + if f == nil { + panic("invalid path filter function") + } + if opt := normalizeOption(opt); opt != nil { + return &pathFilter{fnc: f, opt: opt} + } + return nil +} + +type pathFilter struct { + core + fnc func(Path) bool + opt Option +} + +func (f pathFilter) filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption { + if f.fnc(s.curPath) { + return f.opt.filter(s, t, vx, vy) + } + return nil +} + +func (f pathFilter) String() string { + return fmt.Sprintf("FilterPath(%s, %v)", function.NameOf(reflect.ValueOf(f.fnc)), f.opt) +} + +// FilterValues returns a new Option where opt is only evaluated if filter f, +// which is a function of the form "func(T, T) bool", returns true for the +// current pair of values being compared. If either value is invalid or +// the type of the values is not assignable to T, then this filter implicitly +// returns false. +// +// The filter function must be +// symmetric (i.e., agnostic to the order of the inputs) and +// deterministic (i.e., produces the same result when given the same inputs). +// If T is an interface, it is possible that f is called with two values with +// different concrete types that both implement T. +// +// The option passed in may be an Ignore, Transformer, Comparer, Options, or +// a previously filtered Option. +func FilterValues(f interface{}, opt Option) Option { + v := reflect.ValueOf(f) + if !function.IsType(v.Type(), function.ValueFilter) || v.IsNil() { + panic(fmt.Sprintf("invalid values filter function: %T", f)) + } + if opt := normalizeOption(opt); opt != nil { + vf := &valuesFilter{fnc: v, opt: opt} + if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { + vf.typ = ti + } + return vf + } + return nil +} + +type valuesFilter struct { + core + typ reflect.Type // T + fnc reflect.Value // func(T, T) bool + opt Option +} + +func (f valuesFilter) filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption { + if !vx.IsValid() || !vx.CanInterface() || !vy.IsValid() || !vy.CanInterface() { + return nil + } + if (f.typ == nil || t.AssignableTo(f.typ)) && s.callTTBFunc(f.fnc, vx, vy) { + return f.opt.filter(s, t, vx, vy) + } + return nil +} + +func (f valuesFilter) String() string { + return fmt.Sprintf("FilterValues(%s, %v)", function.NameOf(f.fnc), f.opt) +} + +// Ignore is an Option that causes all comparisons to be ignored. +// This value is intended to be combined with FilterPath or FilterValues. +// It is an error to pass an unfiltered Ignore option to Equal. +func Ignore() Option { return ignore{} } + +type ignore struct{ core } + +func (ignore) isFiltered() bool { return false } +func (ignore) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { return ignore{} } +func (ignore) apply(s *state, _, _ reflect.Value) { s.report(true, reportByIgnore) } +func (ignore) String() string { return "Ignore()" } + +// validator is a sentinel Option type to indicate that some options could not +// be evaluated due to unexported fields, missing slice elements, or +// missing map entries. Both values are validator only for unexported fields. +type validator struct{ core } + +func (validator) filter(_ *state, _ reflect.Type, vx, vy reflect.Value) applicableOption { + if !vx.IsValid() || !vy.IsValid() { + return validator{} + } + if !vx.CanInterface() || !vy.CanInterface() { + return validator{} + } + return nil +} +func (validator) apply(s *state, vx, vy reflect.Value) { + // Implies missing slice element or map entry. + if !vx.IsValid() || !vy.IsValid() { + s.report(vx.IsValid() == vy.IsValid(), 0) + return + } + + // Unable to Interface implies unexported field without visibility access. + if !vx.CanInterface() || !vy.CanInterface() { + help := "consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported" + var name string + if t := s.curPath.Index(-2).Type(); t.Name() != "" { + // Named type with unexported fields. + name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType + if _, ok := reflect.New(t).Interface().(error); ok { + help = "consider using cmpopts.EquateErrors to compare error values" + } + } else { + // Unnamed type with unexported fields. Derive PkgPath from field. + var pkgPath string + for i := 0; i < t.NumField() && pkgPath == ""; i++ { + pkgPath = t.Field(i).PkgPath + } + name = fmt.Sprintf("%q.(%v)", pkgPath, t.String()) // e.g., "path/to/package".(struct { a int }) + } + panic(fmt.Sprintf("cannot handle unexported field at %#v:\n\t%v\n%s", s.curPath, name, help)) + } + + panic("not reachable") +} + +// identRx represents a valid identifier according to the Go specification. +const identRx = `[_\p{L}][_\p{L}\p{N}]*` + +var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`) + +// Transformer returns an Option that applies a transformation function that +// converts values of a certain type into that of another. +// +// The transformer f must be a function "func(T) R" that converts values of +// type T to those of type R and is implicitly filtered to input values +// assignable to T. The transformer must not mutate T in any way. +// +// To help prevent some cases of infinite recursive cycles applying the +// same transform to the output of itself (e.g., in the case where the +// input and output types are the same), an implicit filter is added such that +// a transformer is applicable only if that exact transformer is not already +// in the tail of the Path since the last non-Transform step. +// For situations where the implicit filter is still insufficient, +// consider using cmpopts.AcyclicTransformer, which adds a filter +// to prevent the transformer from being recursively applied upon itself. +// +// The name is a user provided label that is used as the Transform.Name in the +// transformation PathStep (and eventually shown in the Diff output). +// The name must be a valid identifier or qualified identifier in Go syntax. +// If empty, an arbitrary name is used. +func Transformer(name string, f interface{}) Option { + v := reflect.ValueOf(f) + if !function.IsType(v.Type(), function.Transformer) || v.IsNil() { + panic(fmt.Sprintf("invalid transformer function: %T", f)) + } + if name == "" { + name = function.NameOf(v) + if !identsRx.MatchString(name) { + name = "λ" // Lambda-symbol as placeholder name + } + } else if !identsRx.MatchString(name) { + panic(fmt.Sprintf("invalid name: %q", name)) + } + tr := &transformer{name: name, fnc: reflect.ValueOf(f)} + if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { + tr.typ = ti + } + return tr +} + +type transformer struct { + core + name string + typ reflect.Type // T + fnc reflect.Value // func(T) R +} + +func (tr *transformer) isFiltered() bool { return tr.typ != nil } + +func (tr *transformer) filter(s *state, t reflect.Type, _, _ reflect.Value) applicableOption { + for i := len(s.curPath) - 1; i >= 0; i-- { + if t, ok := s.curPath[i].(Transform); !ok { + break // Hit most recent non-Transform step + } else if tr == t.trans { + return nil // Cannot directly use same Transform + } + } + if tr.typ == nil || t.AssignableTo(tr.typ) { + return tr + } + return nil +} + +func (tr *transformer) apply(s *state, vx, vy reflect.Value) { + step := Transform{&transform{pathStep{typ: tr.fnc.Type().Out(0)}, tr}} + vvx := s.callTRFunc(tr.fnc, vx, step) + vvy := s.callTRFunc(tr.fnc, vy, step) + step.vx, step.vy = vvx, vvy + s.compareAny(step) +} + +func (tr transformer) String() string { + return fmt.Sprintf("Transformer(%s, %s)", tr.name, function.NameOf(tr.fnc)) +} + +// Comparer returns an Option that determines whether two values are equal +// to each other. +// +// The comparer f must be a function "func(T, T) bool" and is implicitly +// filtered to input values assignable to T. If T is an interface, it is +// possible that f is called with two values of different concrete types that +// both implement T. +// +// The equality function must be: +// • Symmetric: equal(x, y) == equal(y, x) +// • Deterministic: equal(x, y) == equal(x, y) +// • Pure: equal(x, y) does not modify x or y +func Comparer(f interface{}) Option { + v := reflect.ValueOf(f) + if !function.IsType(v.Type(), function.Equal) || v.IsNil() { + panic(fmt.Sprintf("invalid comparer function: %T", f)) + } + cm := &comparer{fnc: v} + if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { + cm.typ = ti + } + return cm +} + +type comparer struct { + core + typ reflect.Type // T + fnc reflect.Value // func(T, T) bool +} + +func (cm *comparer) isFiltered() bool { return cm.typ != nil } + +func (cm *comparer) filter(_ *state, t reflect.Type, _, _ reflect.Value) applicableOption { + if cm.typ == nil || t.AssignableTo(cm.typ) { + return cm + } + return nil +} + +func (cm *comparer) apply(s *state, vx, vy reflect.Value) { + eq := s.callTTBFunc(cm.fnc, vx, vy) + s.report(eq, reportByFunc) +} + +func (cm comparer) String() string { + return fmt.Sprintf("Comparer(%s)", function.NameOf(cm.fnc)) +} + +// Exporter returns an Option that specifies whether Equal is allowed to +// introspect into the unexported fields of certain struct types. +// +// Users of this option must understand that comparing on unexported fields +// from external packages is not safe since changes in the internal +// implementation of some external package may cause the result of Equal +// to unexpectedly change. However, it may be valid to use this option on types +// defined in an internal package where the semantic meaning of an unexported +// field is in the control of the user. +// +// In many cases, a custom Comparer should be used instead that defines +// equality as a function of the public API of a type rather than the underlying +// unexported implementation. +// +// For example, the reflect.Type documentation defines equality to be determined +// by the == operator on the interface (essentially performing a shallow pointer +// comparison) and most attempts to compare *regexp.Regexp types are interested +// in only checking that the regular expression strings are equal. +// Both of these are accomplished using Comparers: +// +// Comparer(func(x, y reflect.Type) bool { return x == y }) +// Comparer(func(x, y *regexp.Regexp) bool { return x.String() == y.String() }) +// +// In other cases, the cmpopts.IgnoreUnexported option can be used to ignore +// all unexported fields on specified struct types. +func Exporter(f func(reflect.Type) bool) Option { + if !supportExporters { + panic("Exporter is not supported on purego builds") + } + return exporter(f) +} + +type exporter func(reflect.Type) bool + +func (exporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { + panic("not implemented") +} + +// AllowUnexported returns an Options that allows Equal to forcibly introspect +// unexported fields of the specified struct types. +// +// See Exporter for the proper use of this option. +func AllowUnexported(types ...interface{}) Option { + m := make(map[reflect.Type]bool) + for _, typ := range types { + t := reflect.TypeOf(typ) + if t.Kind() != reflect.Struct { + panic(fmt.Sprintf("invalid struct type: %T", typ)) + } + m[t] = true + } + return exporter(func(t reflect.Type) bool { return m[t] }) +} + +// Result represents the comparison result for a single node and +// is provided by cmp when calling Result (see Reporter). +type Result struct { + _ [0]func() // Make Result incomparable + flags resultFlags +} + +// Equal reports whether the node was determined to be equal or not. +// As a special case, ignored nodes are considered equal. +func (r Result) Equal() bool { + return r.flags&(reportEqual|reportByIgnore) != 0 +} + +// ByIgnore reports whether the node is equal because it was ignored. +// This never reports true if Equal reports false. +func (r Result) ByIgnore() bool { + return r.flags&reportByIgnore != 0 +} + +// ByMethod reports whether the Equal method determined equality. +func (r Result) ByMethod() bool { + return r.flags&reportByMethod != 0 +} + +// ByFunc reports whether a Comparer function determined equality. +func (r Result) ByFunc() bool { + return r.flags&reportByFunc != 0 +} + +// ByCycle reports whether a reference cycle was detected. +func (r Result) ByCycle() bool { + return r.flags&reportByCycle != 0 +} + +type resultFlags uint + +const ( + _ resultFlags = (1 << iota) / 2 + + reportEqual + reportUnequal + reportByIgnore + reportByMethod + reportByFunc + reportByCycle +) + +// Reporter is an Option that can be passed to Equal. When Equal traverses +// the value trees, it calls PushStep as it descends into each node in the +// tree and PopStep as it ascend out of the node. The leaves of the tree are +// either compared (determined to be equal or not equal) or ignored and reported +// as such by calling the Report method. +func Reporter(r interface { + // PushStep is called when a tree-traversal operation is performed. + // The PathStep itself is only valid until the step is popped. + // The PathStep.Values are valid for the duration of the entire traversal + // and must not be mutated. + // + // Equal always calls PushStep at the start to provide an operation-less + // PathStep used to report the root values. + // + // Within a slice, the exact set of inserted, removed, or modified elements + // is unspecified and may change in future implementations. + // The entries of a map are iterated through in an unspecified order. + PushStep(PathStep) + + // Report is called exactly once on leaf nodes to report whether the + // comparison identified the node as equal, unequal, or ignored. + // A leaf node is one that is immediately preceded by and followed by + // a pair of PushStep and PopStep calls. + Report(Result) + + // PopStep ascends back up the value tree. + // There is always a matching pop call for every push call. + PopStep() +}) Option { + return reporter{r} +} + +type reporter struct{ reporterIface } +type reporterIface interface { + PushStep(PathStep) + Report(Result) + PopStep() +} + +func (reporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { + panic("not implemented") +} + +// normalizeOption normalizes the input options such that all Options groups +// are flattened and groups with a single element are reduced to that element. +// Only coreOptions and Options containing coreOptions are allowed. +func normalizeOption(src Option) Option { + switch opts := flattenOptions(nil, Options{src}); len(opts) { + case 0: + return nil + case 1: + return opts[0] + default: + return opts + } +} + +// flattenOptions copies all options in src to dst as a flat list. +// Only coreOptions and Options containing coreOptions are allowed. +func flattenOptions(dst, src Options) Options { + for _, opt := range src { + switch opt := opt.(type) { + case nil: + continue + case Options: + dst = flattenOptions(dst, opt) + case coreOption: + dst = append(dst, opt) + default: + panic(fmt.Sprintf("invalid option type: %T", opt)) + } + } + return dst +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/path.go b/integration-test/vendor/github.com/google/go-cmp/cmp/path.go new file mode 100644 index 000000000..f01eff318 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/path.go @@ -0,0 +1,378 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import ( + "fmt" + "reflect" + "strings" + "unicode" + "unicode/utf8" + + "github.com/google/go-cmp/cmp/internal/value" +) + +// Path is a list of PathSteps describing the sequence of operations to get +// from some root type to the current position in the value tree. +// The first Path element is always an operation-less PathStep that exists +// simply to identify the initial type. +// +// When traversing structs with embedded structs, the embedded struct will +// always be accessed as a field before traversing the fields of the +// embedded struct themselves. That is, an exported field from the +// embedded struct will never be accessed directly from the parent struct. +type Path []PathStep + +// PathStep is a union-type for specific operations to traverse +// a value's tree structure. Users of this package never need to implement +// these types as values of this type will be returned by this package. +// +// Implementations of this interface are +// StructField, SliceIndex, MapIndex, Indirect, TypeAssertion, and Transform. +type PathStep interface { + String() string + + // Type is the resulting type after performing the path step. + Type() reflect.Type + + // Values is the resulting values after performing the path step. + // The type of each valid value is guaranteed to be identical to Type. + // + // In some cases, one or both may be invalid or have restrictions: + // • For StructField, both are not interface-able if the current field + // is unexported and the struct type is not explicitly permitted by + // an Exporter to traverse unexported fields. + // • For SliceIndex, one may be invalid if an element is missing from + // either the x or y slice. + // • For MapIndex, one may be invalid if an entry is missing from + // either the x or y map. + // + // The provided values must not be mutated. + Values() (vx, vy reflect.Value) +} + +var ( + _ PathStep = StructField{} + _ PathStep = SliceIndex{} + _ PathStep = MapIndex{} + _ PathStep = Indirect{} + _ PathStep = TypeAssertion{} + _ PathStep = Transform{} +) + +func (pa *Path) push(s PathStep) { + *pa = append(*pa, s) +} + +func (pa *Path) pop() { + *pa = (*pa)[:len(*pa)-1] +} + +// Last returns the last PathStep in the Path. +// If the path is empty, this returns a non-nil PathStep that reports a nil Type. +func (pa Path) Last() PathStep { + return pa.Index(-1) +} + +// Index returns the ith step in the Path and supports negative indexing. +// A negative index starts counting from the tail of the Path such that -1 +// refers to the last step, -2 refers to the second-to-last step, and so on. +// If index is invalid, this returns a non-nil PathStep that reports a nil Type. +func (pa Path) Index(i int) PathStep { + if i < 0 { + i = len(pa) + i + } + if i < 0 || i >= len(pa) { + return pathStep{} + } + return pa[i] +} + +// String returns the simplified path to a node. +// The simplified path only contains struct field accesses. +// +// For example: +// MyMap.MySlices.MyField +func (pa Path) String() string { + var ss []string + for _, s := range pa { + if _, ok := s.(StructField); ok { + ss = append(ss, s.String()) + } + } + return strings.TrimPrefix(strings.Join(ss, ""), ".") +} + +// GoString returns the path to a specific node using Go syntax. +// +// For example: +// (*root.MyMap["key"].(*mypkg.MyStruct).MySlices)[2][3].MyField +func (pa Path) GoString() string { + var ssPre, ssPost []string + var numIndirect int + for i, s := range pa { + var nextStep PathStep + if i+1 < len(pa) { + nextStep = pa[i+1] + } + switch s := s.(type) { + case Indirect: + numIndirect++ + pPre, pPost := "(", ")" + switch nextStep.(type) { + case Indirect: + continue // Next step is indirection, so let them batch up + case StructField: + numIndirect-- // Automatic indirection on struct fields + case nil: + pPre, pPost = "", "" // Last step; no need for parenthesis + } + if numIndirect > 0 { + ssPre = append(ssPre, pPre+strings.Repeat("*", numIndirect)) + ssPost = append(ssPost, pPost) + } + numIndirect = 0 + continue + case Transform: + ssPre = append(ssPre, s.trans.name+"(") + ssPost = append(ssPost, ")") + continue + } + ssPost = append(ssPost, s.String()) + } + for i, j := 0, len(ssPre)-1; i < j; i, j = i+1, j-1 { + ssPre[i], ssPre[j] = ssPre[j], ssPre[i] + } + return strings.Join(ssPre, "") + strings.Join(ssPost, "") +} + +type pathStep struct { + typ reflect.Type + vx, vy reflect.Value +} + +func (ps pathStep) Type() reflect.Type { return ps.typ } +func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy } +func (ps pathStep) String() string { + if ps.typ == nil { + return "" + } + s := ps.typ.String() + if s == "" || strings.ContainsAny(s, "{}\n") { + return "root" // Type too simple or complex to print + } + return fmt.Sprintf("{%s}", s) +} + +// StructField represents a struct field access on a field called Name. +type StructField struct{ *structField } +type structField struct { + pathStep + name string + idx int + + // These fields are used for forcibly accessing an unexported field. + // pvx, pvy, and field are only valid if unexported is true. + unexported bool + mayForce bool // Forcibly allow visibility + paddr bool // Was parent addressable? + pvx, pvy reflect.Value // Parent values (always addressible) + field reflect.StructField // Field information +} + +func (sf StructField) Type() reflect.Type { return sf.typ } +func (sf StructField) Values() (vx, vy reflect.Value) { + if !sf.unexported { + return sf.vx, sf.vy // CanInterface reports true + } + + // Forcibly obtain read-write access to an unexported struct field. + if sf.mayForce { + vx = retrieveUnexportedField(sf.pvx, sf.field, sf.paddr) + vy = retrieveUnexportedField(sf.pvy, sf.field, sf.paddr) + return vx, vy // CanInterface reports true + } + return sf.vx, sf.vy // CanInterface reports false +} +func (sf StructField) String() string { return fmt.Sprintf(".%s", sf.name) } + +// Name is the field name. +func (sf StructField) Name() string { return sf.name } + +// Index is the index of the field in the parent struct type. +// See reflect.Type.Field. +func (sf StructField) Index() int { return sf.idx } + +// SliceIndex is an index operation on a slice or array at some index Key. +type SliceIndex struct{ *sliceIndex } +type sliceIndex struct { + pathStep + xkey, ykey int + isSlice bool // False for reflect.Array +} + +func (si SliceIndex) Type() reflect.Type { return si.typ } +func (si SliceIndex) Values() (vx, vy reflect.Value) { return si.vx, si.vy } +func (si SliceIndex) String() string { + switch { + case si.xkey == si.ykey: + return fmt.Sprintf("[%d]", si.xkey) + case si.ykey == -1: + // [5->?] means "I don't know where X[5] went" + return fmt.Sprintf("[%d->?]", si.xkey) + case si.xkey == -1: + // [?->3] means "I don't know where Y[3] came from" + return fmt.Sprintf("[?->%d]", si.ykey) + default: + // [5->3] means "X[5] moved to Y[3]" + return fmt.Sprintf("[%d->%d]", si.xkey, si.ykey) + } +} + +// Key is the index key; it may return -1 if in a split state +func (si SliceIndex) Key() int { + if si.xkey != si.ykey { + return -1 + } + return si.xkey +} + +// SplitKeys are the indexes for indexing into slices in the +// x and y values, respectively. These indexes may differ due to the +// insertion or removal of an element in one of the slices, causing +// all of the indexes to be shifted. If an index is -1, then that +// indicates that the element does not exist in the associated slice. +// +// Key is guaranteed to return -1 if and only if the indexes returned +// by SplitKeys are not the same. SplitKeys will never return -1 for +// both indexes. +func (si SliceIndex) SplitKeys() (ix, iy int) { return si.xkey, si.ykey } + +// MapIndex is an index operation on a map at some index Key. +type MapIndex struct{ *mapIndex } +type mapIndex struct { + pathStep + key reflect.Value +} + +func (mi MapIndex) Type() reflect.Type { return mi.typ } +func (mi MapIndex) Values() (vx, vy reflect.Value) { return mi.vx, mi.vy } +func (mi MapIndex) String() string { return fmt.Sprintf("[%#v]", mi.key) } + +// Key is the value of the map key. +func (mi MapIndex) Key() reflect.Value { return mi.key } + +// Indirect represents pointer indirection on the parent type. +type Indirect struct{ *indirect } +type indirect struct { + pathStep +} + +func (in Indirect) Type() reflect.Type { return in.typ } +func (in Indirect) Values() (vx, vy reflect.Value) { return in.vx, in.vy } +func (in Indirect) String() string { return "*" } + +// TypeAssertion represents a type assertion on an interface. +type TypeAssertion struct{ *typeAssertion } +type typeAssertion struct { + pathStep +} + +func (ta TypeAssertion) Type() reflect.Type { return ta.typ } +func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy } +func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", ta.typ) } + +// Transform is a transformation from the parent type to the current type. +type Transform struct{ *transform } +type transform struct { + pathStep + trans *transformer +} + +func (tf Transform) Type() reflect.Type { return tf.typ } +func (tf Transform) Values() (vx, vy reflect.Value) { return tf.vx, tf.vy } +func (tf Transform) String() string { return fmt.Sprintf("%s()", tf.trans.name) } + +// Name is the name of the Transformer. +func (tf Transform) Name() string { return tf.trans.name } + +// Func is the function pointer to the transformer function. +func (tf Transform) Func() reflect.Value { return tf.trans.fnc } + +// Option returns the originally constructed Transformer option. +// The == operator can be used to detect the exact option used. +func (tf Transform) Option() Option { return tf.trans } + +// pointerPath represents a dual-stack of pointers encountered when +// recursively traversing the x and y values. This data structure supports +// detection of cycles and determining whether the cycles are equal. +// In Go, cycles can occur via pointers, slices, and maps. +// +// The pointerPath uses a map to represent a stack; where descension into a +// pointer pushes the address onto the stack, and ascension from a pointer +// pops the address from the stack. Thus, when traversing into a pointer from +// reflect.Ptr, reflect.Slice element, or reflect.Map, we can detect cycles +// by checking whether the pointer has already been visited. The cycle detection +// uses a separate stack for the x and y values. +// +// If a cycle is detected we need to determine whether the two pointers +// should be considered equal. The definition of equality chosen by Equal +// requires two graphs to have the same structure. To determine this, both the +// x and y values must have a cycle where the previous pointers were also +// encountered together as a pair. +// +// Semantically, this is equivalent to augmenting Indirect, SliceIndex, and +// MapIndex with pointer information for the x and y values. +// Suppose px and py are two pointers to compare, we then search the +// Path for whether px was ever encountered in the Path history of x, and +// similarly so with py. If either side has a cycle, the comparison is only +// equal if both px and py have a cycle resulting from the same PathStep. +// +// Using a map as a stack is more performant as we can perform cycle detection +// in O(1) instead of O(N) where N is len(Path). +type pointerPath struct { + // mx is keyed by x pointers, where the value is the associated y pointer. + mx map[value.Pointer]value.Pointer + // my is keyed by y pointers, where the value is the associated x pointer. + my map[value.Pointer]value.Pointer +} + +func (p *pointerPath) Init() { + p.mx = make(map[value.Pointer]value.Pointer) + p.my = make(map[value.Pointer]value.Pointer) +} + +// Push indicates intent to descend into pointers vx and vy where +// visited reports whether either has been seen before. If visited before, +// equal reports whether both pointers were encountered together. +// Pop must be called if and only if the pointers were never visited. +// +// The pointers vx and vy must be a reflect.Ptr, reflect.Slice, or reflect.Map +// and be non-nil. +func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) { + px := value.PointerOf(vx) + py := value.PointerOf(vy) + _, ok1 := p.mx[px] + _, ok2 := p.my[py] + if ok1 || ok2 { + equal = p.mx[px] == py && p.my[py] == px // Pointers paired together + return equal, true + } + p.mx[px] = py + p.my[py] = px + return false, false +} + +// Pop ascends from pointers vx and vy. +func (p pointerPath) Pop(vx, vy reflect.Value) { + delete(p.mx, value.PointerOf(vx)) + delete(p.my, value.PointerOf(vy)) +} + +// isExported reports whether the identifier is exported. +func isExported(id string) bool { + r, _ := utf8.DecodeRuneInString(id) + return unicode.IsUpper(r) +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/report.go b/integration-test/vendor/github.com/google/go-cmp/cmp/report.go new file mode 100644 index 000000000..f43cd12eb --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/report.go @@ -0,0 +1,54 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +// defaultReporter implements the reporter interface. +// +// As Equal serially calls the PushStep, Report, and PopStep methods, the +// defaultReporter constructs a tree-based representation of the compared value +// and the result of each comparison (see valueNode). +// +// When the String method is called, the FormatDiff method transforms the +// valueNode tree into a textNode tree, which is a tree-based representation +// of the textual output (see textNode). +// +// Lastly, the textNode.String method produces the final report as a string. +type defaultReporter struct { + root *valueNode + curr *valueNode +} + +func (r *defaultReporter) PushStep(ps PathStep) { + r.curr = r.curr.PushStep(ps) + if r.root == nil { + r.root = r.curr + } +} +func (r *defaultReporter) Report(rs Result) { + r.curr.Report(rs) +} +func (r *defaultReporter) PopStep() { + r.curr = r.curr.PopStep() +} + +// String provides a full report of the differences detected as a structured +// literal in pseudo-Go syntax. String may only be called after the entire tree +// has been traversed. +func (r *defaultReporter) String() string { + assert(r.root != nil && r.curr == nil) + if r.root.NumDiff == 0 { + return "" + } + ptrs := new(pointerReferences) + text := formatOptions{}.FormatDiff(r.root, ptrs) + resolveReferences(text) + return text.String() +} + +func assert(ok bool) { + if !ok { + panic("assertion failure") + } +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/report_compare.go b/integration-test/vendor/github.com/google/go-cmp/cmp/report_compare.go new file mode 100644 index 000000000..104bb3053 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/report_compare.go @@ -0,0 +1,432 @@ +// Copyright 2019, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import ( + "fmt" + "reflect" + + "github.com/google/go-cmp/cmp/internal/value" +) + +// numContextRecords is the number of surrounding equal records to print. +const numContextRecords = 2 + +type diffMode byte + +const ( + diffUnknown diffMode = 0 + diffIdentical diffMode = ' ' + diffRemoved diffMode = '-' + diffInserted diffMode = '+' +) + +type typeMode int + +const ( + // emitType always prints the type. + emitType typeMode = iota + // elideType never prints the type. + elideType + // autoType prints the type only for composite kinds + // (i.e., structs, slices, arrays, and maps). + autoType +) + +type formatOptions struct { + // DiffMode controls the output mode of FormatDiff. + // + // If diffUnknown, then produce a diff of the x and y values. + // If diffIdentical, then emit values as if they were equal. + // If diffRemoved, then only emit x values (ignoring y values). + // If diffInserted, then only emit y values (ignoring x values). + DiffMode diffMode + + // TypeMode controls whether to print the type for the current node. + // + // As a general rule of thumb, we always print the type of the next node + // after an interface, and always elide the type of the next node after + // a slice or map node. + TypeMode typeMode + + // formatValueOptions are options specific to printing reflect.Values. + formatValueOptions +} + +func (opts formatOptions) WithDiffMode(d diffMode) formatOptions { + opts.DiffMode = d + return opts +} +func (opts formatOptions) WithTypeMode(t typeMode) formatOptions { + opts.TypeMode = t + return opts +} +func (opts formatOptions) WithVerbosity(level int) formatOptions { + opts.VerbosityLevel = level + opts.LimitVerbosity = true + return opts +} +func (opts formatOptions) verbosity() uint { + switch { + case opts.VerbosityLevel < 0: + return 0 + case opts.VerbosityLevel > 16: + return 16 // some reasonable maximum to avoid shift overflow + default: + return uint(opts.VerbosityLevel) + } +} + +const maxVerbosityPreset = 6 + +// verbosityPreset modifies the verbosity settings given an index +// between 0 and maxVerbosityPreset, inclusive. +func verbosityPreset(opts formatOptions, i int) formatOptions { + opts.VerbosityLevel = int(opts.verbosity()) + 2*i + if i > 0 { + opts.AvoidStringer = true + } + if i >= maxVerbosityPreset { + opts.PrintAddresses = true + opts.QualifiedNames = true + } + return opts +} + +// FormatDiff converts a valueNode tree into a textNode tree, where the later +// is a textual representation of the differences detected in the former. +func (opts formatOptions) FormatDiff(v *valueNode, ptrs *pointerReferences) (out textNode) { + if opts.DiffMode == diffIdentical { + opts = opts.WithVerbosity(1) + } else if opts.verbosity() < 3 { + opts = opts.WithVerbosity(3) + } + + // Check whether we have specialized formatting for this node. + // This is not necessary, but helpful for producing more readable outputs. + if opts.CanFormatDiffSlice(v) { + return opts.FormatDiffSlice(v) + } + + var parentKind reflect.Kind + if v.parent != nil && v.parent.TransformerName == "" { + parentKind = v.parent.Type.Kind() + } + + // For leaf nodes, format the value based on the reflect.Values alone. + if v.MaxDepth == 0 { + switch opts.DiffMode { + case diffUnknown, diffIdentical: + // Format Equal. + if v.NumDiff == 0 { + outx := opts.FormatValue(v.ValueX, parentKind, ptrs) + outy := opts.FormatValue(v.ValueY, parentKind, ptrs) + if v.NumIgnored > 0 && v.NumSame == 0 { + return textEllipsis + } else if outx.Len() < outy.Len() { + return outx + } else { + return outy + } + } + + // Format unequal. + assert(opts.DiffMode == diffUnknown) + var list textList + outx := opts.WithTypeMode(elideType).FormatValue(v.ValueX, parentKind, ptrs) + outy := opts.WithTypeMode(elideType).FormatValue(v.ValueY, parentKind, ptrs) + for i := 0; i <= maxVerbosityPreset && outx != nil && outy != nil && outx.Equal(outy); i++ { + opts2 := verbosityPreset(opts, i).WithTypeMode(elideType) + outx = opts2.FormatValue(v.ValueX, parentKind, ptrs) + outy = opts2.FormatValue(v.ValueY, parentKind, ptrs) + } + if outx != nil { + list = append(list, textRecord{Diff: '-', Value: outx}) + } + if outy != nil { + list = append(list, textRecord{Diff: '+', Value: outy}) + } + return opts.WithTypeMode(emitType).FormatType(v.Type, list) + case diffRemoved: + return opts.FormatValue(v.ValueX, parentKind, ptrs) + case diffInserted: + return opts.FormatValue(v.ValueY, parentKind, ptrs) + default: + panic("invalid diff mode") + } + } + + // Register slice element to support cycle detection. + if parentKind == reflect.Slice { + ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, true) + defer ptrs.Pop() + defer func() { out = wrapTrunkReferences(ptrRefs, out) }() + } + + // Descend into the child value node. + if v.TransformerName != "" { + out := opts.WithTypeMode(emitType).FormatDiff(v.Value, ptrs) + out = &textWrap{Prefix: "Inverse(" + v.TransformerName + ", ", Value: out, Suffix: ")"} + return opts.FormatType(v.Type, out) + } else { + switch k := v.Type.Kind(); k { + case reflect.Struct, reflect.Array, reflect.Slice: + out = opts.formatDiffList(v.Records, k, ptrs) + out = opts.FormatType(v.Type, out) + case reflect.Map: + // Register map to support cycle detection. + ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, false) + defer ptrs.Pop() + + out = opts.formatDiffList(v.Records, k, ptrs) + out = wrapTrunkReferences(ptrRefs, out) + out = opts.FormatType(v.Type, out) + case reflect.Ptr: + // Register pointer to support cycle detection. + ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, false) + defer ptrs.Pop() + + out = opts.FormatDiff(v.Value, ptrs) + out = wrapTrunkReferences(ptrRefs, out) + out = &textWrap{Prefix: "&", Value: out} + case reflect.Interface: + out = opts.WithTypeMode(emitType).FormatDiff(v.Value, ptrs) + default: + panic(fmt.Sprintf("%v cannot have children", k)) + } + return out + } +} + +func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind, ptrs *pointerReferences) textNode { + // Derive record name based on the data structure kind. + var name string + var formatKey func(reflect.Value) string + switch k { + case reflect.Struct: + name = "field" + opts = opts.WithTypeMode(autoType) + formatKey = func(v reflect.Value) string { return v.String() } + case reflect.Slice, reflect.Array: + name = "element" + opts = opts.WithTypeMode(elideType) + formatKey = func(reflect.Value) string { return "" } + case reflect.Map: + name = "entry" + opts = opts.WithTypeMode(elideType) + formatKey = func(v reflect.Value) string { return formatMapKey(v, false, ptrs) } + } + + maxLen := -1 + if opts.LimitVerbosity { + if opts.DiffMode == diffIdentical { + maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... + } else { + maxLen = (1 << opts.verbosity()) << 1 // 2, 4, 8, 16, 32, 64, etc... + } + opts.VerbosityLevel-- + } + + // Handle unification. + switch opts.DiffMode { + case diffIdentical, diffRemoved, diffInserted: + var list textList + var deferredEllipsis bool // Add final "..." to indicate records were dropped + for _, r := range recs { + if len(list) == maxLen { + deferredEllipsis = true + break + } + + // Elide struct fields that are zero value. + if k == reflect.Struct { + var isZero bool + switch opts.DiffMode { + case diffIdentical: + isZero = value.IsZero(r.Value.ValueX) || value.IsZero(r.Value.ValueY) + case diffRemoved: + isZero = value.IsZero(r.Value.ValueX) + case diffInserted: + isZero = value.IsZero(r.Value.ValueY) + } + if isZero { + continue + } + } + // Elide ignored nodes. + if r.Value.NumIgnored > 0 && r.Value.NumSame+r.Value.NumDiff == 0 { + deferredEllipsis = !(k == reflect.Slice || k == reflect.Array) + if !deferredEllipsis { + list.AppendEllipsis(diffStats{}) + } + continue + } + if out := opts.FormatDiff(r.Value, ptrs); out != nil { + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + } + } + if deferredEllipsis { + list.AppendEllipsis(diffStats{}) + } + return &textWrap{Prefix: "{", Value: list, Suffix: "}"} + case diffUnknown: + default: + panic("invalid diff mode") + } + + // Handle differencing. + var numDiffs int + var list textList + var keys []reflect.Value // invariant: len(list) == len(keys) + groups := coalesceAdjacentRecords(name, recs) + maxGroup := diffStats{Name: name} + for i, ds := range groups { + if maxLen >= 0 && numDiffs >= maxLen { + maxGroup = maxGroup.Append(ds) + continue + } + + // Handle equal records. + if ds.NumDiff() == 0 { + // Compute the number of leading and trailing records to print. + var numLo, numHi int + numEqual := ds.NumIgnored + ds.NumIdentical + for numLo < numContextRecords && numLo+numHi < numEqual && i != 0 { + if r := recs[numLo].Value; r.NumIgnored > 0 && r.NumSame+r.NumDiff == 0 { + break + } + numLo++ + } + for numHi < numContextRecords && numLo+numHi < numEqual && i != len(groups)-1 { + if r := recs[numEqual-numHi-1].Value; r.NumIgnored > 0 && r.NumSame+r.NumDiff == 0 { + break + } + numHi++ + } + if numEqual-(numLo+numHi) == 1 && ds.NumIgnored == 0 { + numHi++ // Avoid pointless coalescing of a single equal record + } + + // Format the equal values. + for _, r := range recs[:numLo] { + out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value, ptrs) + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + keys = append(keys, r.Key) + } + if numEqual > numLo+numHi { + ds.NumIdentical -= numLo + numHi + list.AppendEllipsis(ds) + for len(keys) < len(list) { + keys = append(keys, reflect.Value{}) + } + } + for _, r := range recs[numEqual-numHi : numEqual] { + out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value, ptrs) + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + keys = append(keys, r.Key) + } + recs = recs[numEqual:] + continue + } + + // Handle unequal records. + for _, r := range recs[:ds.NumDiff()] { + switch { + case opts.CanFormatDiffSlice(r.Value): + out := opts.FormatDiffSlice(r.Value) + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + keys = append(keys, r.Key) + case r.Value.NumChildren == r.Value.MaxDepth: + outx := opts.WithDiffMode(diffRemoved).FormatDiff(r.Value, ptrs) + outy := opts.WithDiffMode(diffInserted).FormatDiff(r.Value, ptrs) + for i := 0; i <= maxVerbosityPreset && outx != nil && outy != nil && outx.Equal(outy); i++ { + opts2 := verbosityPreset(opts, i) + outx = opts2.WithDiffMode(diffRemoved).FormatDiff(r.Value, ptrs) + outy = opts2.WithDiffMode(diffInserted).FormatDiff(r.Value, ptrs) + } + if outx != nil { + list = append(list, textRecord{Diff: diffRemoved, Key: formatKey(r.Key), Value: outx}) + keys = append(keys, r.Key) + } + if outy != nil { + list = append(list, textRecord{Diff: diffInserted, Key: formatKey(r.Key), Value: outy}) + keys = append(keys, r.Key) + } + default: + out := opts.FormatDiff(r.Value, ptrs) + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + keys = append(keys, r.Key) + } + } + recs = recs[ds.NumDiff():] + numDiffs += ds.NumDiff() + } + if maxGroup.IsZero() { + assert(len(recs) == 0) + } else { + list.AppendEllipsis(maxGroup) + for len(keys) < len(list) { + keys = append(keys, reflect.Value{}) + } + } + assert(len(list) == len(keys)) + + // For maps, the default formatting logic uses fmt.Stringer which may + // produce ambiguous output. Avoid calling String to disambiguate. + if k == reflect.Map { + var ambiguous bool + seenKeys := map[string]reflect.Value{} + for i, currKey := range keys { + if currKey.IsValid() { + strKey := list[i].Key + prevKey, seen := seenKeys[strKey] + if seen && prevKey.CanInterface() && currKey.CanInterface() { + ambiguous = prevKey.Interface() != currKey.Interface() + if ambiguous { + break + } + } + seenKeys[strKey] = currKey + } + } + if ambiguous { + for i, k := range keys { + if k.IsValid() { + list[i].Key = formatMapKey(k, true, ptrs) + } + } + } + } + + return &textWrap{Prefix: "{", Value: list, Suffix: "}"} +} + +// coalesceAdjacentRecords coalesces the list of records into groups of +// adjacent equal, or unequal counts. +func coalesceAdjacentRecords(name string, recs []reportRecord) (groups []diffStats) { + var prevCase int // Arbitrary index into which case last occurred + lastStats := func(i int) *diffStats { + if prevCase != i { + groups = append(groups, diffStats{Name: name}) + prevCase = i + } + return &groups[len(groups)-1] + } + for _, r := range recs { + switch rv := r.Value; { + case rv.NumIgnored > 0 && rv.NumSame+rv.NumDiff == 0: + lastStats(1).NumIgnored++ + case rv.NumDiff == 0: + lastStats(1).NumIdentical++ + case rv.NumDiff > 0 && !rv.ValueY.IsValid(): + lastStats(2).NumRemoved++ + case rv.NumDiff > 0 && !rv.ValueX.IsValid(): + lastStats(2).NumInserted++ + default: + lastStats(2).NumModified++ + } + } + return groups +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/report_references.go b/integration-test/vendor/github.com/google/go-cmp/cmp/report_references.go new file mode 100644 index 000000000..be31b33a9 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/report_references.go @@ -0,0 +1,264 @@ +// Copyright 2020, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import ( + "fmt" + "reflect" + "strings" + + "github.com/google/go-cmp/cmp/internal/flags" + "github.com/google/go-cmp/cmp/internal/value" +) + +const ( + pointerDelimPrefix = "⟪" + pointerDelimSuffix = "⟫" +) + +// formatPointer prints the address of the pointer. +func formatPointer(p value.Pointer, withDelims bool) string { + v := p.Uintptr() + if flags.Deterministic { + v = 0xdeadf00f // Only used for stable testing purposes + } + if withDelims { + return pointerDelimPrefix + formatHex(uint64(v)) + pointerDelimSuffix + } + return formatHex(uint64(v)) +} + +// pointerReferences is a stack of pointers visited so far. +type pointerReferences [][2]value.Pointer + +func (ps *pointerReferences) PushPair(vx, vy reflect.Value, d diffMode, deref bool) (pp [2]value.Pointer) { + if deref && vx.IsValid() { + vx = vx.Addr() + } + if deref && vy.IsValid() { + vy = vy.Addr() + } + switch d { + case diffUnknown, diffIdentical: + pp = [2]value.Pointer{value.PointerOf(vx), value.PointerOf(vy)} + case diffRemoved: + pp = [2]value.Pointer{value.PointerOf(vx), value.Pointer{}} + case diffInserted: + pp = [2]value.Pointer{value.Pointer{}, value.PointerOf(vy)} + } + *ps = append(*ps, pp) + return pp +} + +func (ps *pointerReferences) Push(v reflect.Value) (p value.Pointer, seen bool) { + p = value.PointerOf(v) + for _, pp := range *ps { + if p == pp[0] || p == pp[1] { + return p, true + } + } + *ps = append(*ps, [2]value.Pointer{p, p}) + return p, false +} + +func (ps *pointerReferences) Pop() { + *ps = (*ps)[:len(*ps)-1] +} + +// trunkReferences is metadata for a textNode indicating that the sub-tree +// represents the value for either pointer in a pair of references. +type trunkReferences struct{ pp [2]value.Pointer } + +// trunkReference is metadata for a textNode indicating that the sub-tree +// represents the value for the given pointer reference. +type trunkReference struct{ p value.Pointer } + +// leafReference is metadata for a textNode indicating that the value is +// truncated as it refers to another part of the tree (i.e., a trunk). +type leafReference struct{ p value.Pointer } + +func wrapTrunkReferences(pp [2]value.Pointer, s textNode) textNode { + switch { + case pp[0].IsNil(): + return &textWrap{Value: s, Metadata: trunkReference{pp[1]}} + case pp[1].IsNil(): + return &textWrap{Value: s, Metadata: trunkReference{pp[0]}} + case pp[0] == pp[1]: + return &textWrap{Value: s, Metadata: trunkReference{pp[0]}} + default: + return &textWrap{Value: s, Metadata: trunkReferences{pp}} + } +} +func wrapTrunkReference(p value.Pointer, printAddress bool, s textNode) textNode { + var prefix string + if printAddress { + prefix = formatPointer(p, true) + } + return &textWrap{Prefix: prefix, Value: s, Metadata: trunkReference{p}} +} +func makeLeafReference(p value.Pointer, printAddress bool) textNode { + out := &textWrap{Prefix: "(", Value: textEllipsis, Suffix: ")"} + var prefix string + if printAddress { + prefix = formatPointer(p, true) + } + return &textWrap{Prefix: prefix, Value: out, Metadata: leafReference{p}} +} + +// resolveReferences walks the textNode tree searching for any leaf reference +// metadata and resolves each against the corresponding trunk references. +// Since pointer addresses in memory are not particularly readable to the user, +// it replaces each pointer value with an arbitrary and unique reference ID. +func resolveReferences(s textNode) { + var walkNodes func(textNode, func(textNode)) + walkNodes = func(s textNode, f func(textNode)) { + f(s) + switch s := s.(type) { + case *textWrap: + walkNodes(s.Value, f) + case textList: + for _, r := range s { + walkNodes(r.Value, f) + } + } + } + + // Collect all trunks and leaves with reference metadata. + var trunks, leaves []*textWrap + walkNodes(s, func(s textNode) { + if s, ok := s.(*textWrap); ok { + switch s.Metadata.(type) { + case leafReference: + leaves = append(leaves, s) + case trunkReference, trunkReferences: + trunks = append(trunks, s) + } + } + }) + + // No leaf references to resolve. + if len(leaves) == 0 { + return + } + + // Collect the set of all leaf references to resolve. + leafPtrs := make(map[value.Pointer]bool) + for _, leaf := range leaves { + leafPtrs[leaf.Metadata.(leafReference).p] = true + } + + // Collect the set of trunk pointers that are always paired together. + // This allows us to assign a single ID to both pointers for brevity. + // If a pointer in a pair ever occurs by itself or as a different pair, + // then the pair is broken. + pairedTrunkPtrs := make(map[value.Pointer]value.Pointer) + unpair := func(p value.Pointer) { + if !pairedTrunkPtrs[p].IsNil() { + pairedTrunkPtrs[pairedTrunkPtrs[p]] = value.Pointer{} // invalidate other half + } + pairedTrunkPtrs[p] = value.Pointer{} // invalidate this half + } + for _, trunk := range trunks { + switch p := trunk.Metadata.(type) { + case trunkReference: + unpair(p.p) // standalone pointer cannot be part of a pair + case trunkReferences: + p0, ok0 := pairedTrunkPtrs[p.pp[0]] + p1, ok1 := pairedTrunkPtrs[p.pp[1]] + switch { + case !ok0 && !ok1: + // Register the newly seen pair. + pairedTrunkPtrs[p.pp[0]] = p.pp[1] + pairedTrunkPtrs[p.pp[1]] = p.pp[0] + case ok0 && ok1 && p0 == p.pp[1] && p1 == p.pp[0]: + // Exact pair already seen; do nothing. + default: + // Pair conflicts with some other pair; break all pairs. + unpair(p.pp[0]) + unpair(p.pp[1]) + } + } + } + + // Correlate each pointer referenced by leaves to a unique identifier, + // and print the IDs for each trunk that matches those pointers. + var nextID uint + ptrIDs := make(map[value.Pointer]uint) + newID := func() uint { + id := nextID + nextID++ + return id + } + for _, trunk := range trunks { + switch p := trunk.Metadata.(type) { + case trunkReference: + if print := leafPtrs[p.p]; print { + id, ok := ptrIDs[p.p] + if !ok { + id = newID() + ptrIDs[p.p] = id + } + trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id)) + } + case trunkReferences: + print0 := leafPtrs[p.pp[0]] + print1 := leafPtrs[p.pp[1]] + if print0 || print1 { + id0, ok0 := ptrIDs[p.pp[0]] + id1, ok1 := ptrIDs[p.pp[1]] + isPair := pairedTrunkPtrs[p.pp[0]] == p.pp[1] && pairedTrunkPtrs[p.pp[1]] == p.pp[0] + if isPair { + var id uint + assert(ok0 == ok1) // must be seen together or not at all + if ok0 { + assert(id0 == id1) // must have the same ID + id = id0 + } else { + id = newID() + ptrIDs[p.pp[0]] = id + ptrIDs[p.pp[1]] = id + } + trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id)) + } else { + if print0 && !ok0 { + id0 = newID() + ptrIDs[p.pp[0]] = id0 + } + if print1 && !ok1 { + id1 = newID() + ptrIDs[p.pp[1]] = id1 + } + switch { + case print0 && print1: + trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id0)+","+formatReference(id1)) + case print0: + trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id0)) + case print1: + trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id1)) + } + } + } + } + } + + // Update all leaf references with the unique identifier. + for _, leaf := range leaves { + if id, ok := ptrIDs[leaf.Metadata.(leafReference).p]; ok { + leaf.Prefix = updateReferencePrefix(leaf.Prefix, formatReference(id)) + } + } +} + +func formatReference(id uint) string { + return fmt.Sprintf("ref#%d", id) +} + +func updateReferencePrefix(prefix, ref string) string { + if prefix == "" { + return pointerDelimPrefix + ref + pointerDelimSuffix + } + suffix := strings.TrimPrefix(prefix, pointerDelimPrefix) + return pointerDelimPrefix + ref + ": " + suffix +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/integration-test/vendor/github.com/google/go-cmp/cmp/report_reflect.go new file mode 100644 index 000000000..33f03577f --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/report_reflect.go @@ -0,0 +1,402 @@ +// Copyright 2019, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import ( + "bytes" + "fmt" + "reflect" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "github.com/google/go-cmp/cmp/internal/value" +) + +type formatValueOptions struct { + // AvoidStringer controls whether to avoid calling custom stringer + // methods like error.Error or fmt.Stringer.String. + AvoidStringer bool + + // PrintAddresses controls whether to print the address of all pointers, + // slice elements, and maps. + PrintAddresses bool + + // QualifiedNames controls whether FormatType uses the fully qualified name + // (including the full package path as opposed to just the package name). + QualifiedNames bool + + // VerbosityLevel controls the amount of output to produce. + // A higher value produces more output. A value of zero or lower produces + // no output (represented using an ellipsis). + // If LimitVerbosity is false, then the level is treated as infinite. + VerbosityLevel int + + // LimitVerbosity specifies that formatting should respect VerbosityLevel. + LimitVerbosity bool +} + +// FormatType prints the type as if it were wrapping s. +// This may return s as-is depending on the current type and TypeMode mode. +func (opts formatOptions) FormatType(t reflect.Type, s textNode) textNode { + // Check whether to emit the type or not. + switch opts.TypeMode { + case autoType: + switch t.Kind() { + case reflect.Struct, reflect.Slice, reflect.Array, reflect.Map: + if s.Equal(textNil) { + return s + } + default: + return s + } + if opts.DiffMode == diffIdentical { + return s // elide type for identical nodes + } + case elideType: + return s + } + + // Determine the type label, applying special handling for unnamed types. + typeName := value.TypeString(t, opts.QualifiedNames) + if t.Name() == "" { + // According to Go grammar, certain type literals contain symbols that + // do not strongly bind to the next lexicographical token (e.g., *T). + switch t.Kind() { + case reflect.Chan, reflect.Func, reflect.Ptr: + typeName = "(" + typeName + ")" + } + } + return &textWrap{Prefix: typeName, Value: wrapParens(s)} +} + +// wrapParens wraps s with a set of parenthesis, but avoids it if the +// wrapped node itself is already surrounded by a pair of parenthesis or braces. +// It handles unwrapping one level of pointer-reference nodes. +func wrapParens(s textNode) textNode { + var refNode *textWrap + if s2, ok := s.(*textWrap); ok { + // Unwrap a single pointer reference node. + switch s2.Metadata.(type) { + case leafReference, trunkReference, trunkReferences: + refNode = s2 + if s3, ok := refNode.Value.(*textWrap); ok { + s2 = s3 + } + } + + // Already has delimiters that make parenthesis unnecessary. + hasParens := strings.HasPrefix(s2.Prefix, "(") && strings.HasSuffix(s2.Suffix, ")") + hasBraces := strings.HasPrefix(s2.Prefix, "{") && strings.HasSuffix(s2.Suffix, "}") + if hasParens || hasBraces { + return s + } + } + if refNode != nil { + refNode.Value = &textWrap{Prefix: "(", Value: refNode.Value, Suffix: ")"} + return s + } + return &textWrap{Prefix: "(", Value: s, Suffix: ")"} +} + +// FormatValue prints the reflect.Value, taking extra care to avoid descending +// into pointers already in ptrs. As pointers are visited, ptrs is also updated. +func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, ptrs *pointerReferences) (out textNode) { + if !v.IsValid() { + return nil + } + t := v.Type() + + // Check slice element for cycles. + if parentKind == reflect.Slice { + ptrRef, visited := ptrs.Push(v.Addr()) + if visited { + return makeLeafReference(ptrRef, false) + } + defer ptrs.Pop() + defer func() { out = wrapTrunkReference(ptrRef, false, out) }() + } + + // Check whether there is an Error or String method to call. + if !opts.AvoidStringer && v.CanInterface() { + // Avoid calling Error or String methods on nil receivers since many + // implementations crash when doing so. + if (t.Kind() != reflect.Ptr && t.Kind() != reflect.Interface) || !v.IsNil() { + var prefix, strVal string + func() { + // Swallow and ignore any panics from String or Error. + defer func() { recover() }() + switch v := v.Interface().(type) { + case error: + strVal = v.Error() + prefix = "e" + case fmt.Stringer: + strVal = v.String() + prefix = "s" + } + }() + if prefix != "" { + return opts.formatString(prefix, strVal) + } + } + } + + // Check whether to explicitly wrap the result with the type. + var skipType bool + defer func() { + if !skipType { + out = opts.FormatType(t, out) + } + }() + + switch t.Kind() { + case reflect.Bool: + return textLine(fmt.Sprint(v.Bool())) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return textLine(fmt.Sprint(v.Int())) + case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return textLine(fmt.Sprint(v.Uint())) + case reflect.Uint8: + if parentKind == reflect.Slice || parentKind == reflect.Array { + return textLine(formatHex(v.Uint())) + } + return textLine(fmt.Sprint(v.Uint())) + case reflect.Uintptr: + return textLine(formatHex(v.Uint())) + case reflect.Float32, reflect.Float64: + return textLine(fmt.Sprint(v.Float())) + case reflect.Complex64, reflect.Complex128: + return textLine(fmt.Sprint(v.Complex())) + case reflect.String: + return opts.formatString("", v.String()) + case reflect.UnsafePointer, reflect.Chan, reflect.Func: + return textLine(formatPointer(value.PointerOf(v), true)) + case reflect.Struct: + var list textList + v := makeAddressable(v) // needed for retrieveUnexportedField + maxLen := v.NumField() + if opts.LimitVerbosity { + maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... + opts.VerbosityLevel-- + } + for i := 0; i < v.NumField(); i++ { + vv := v.Field(i) + if value.IsZero(vv) { + continue // Elide fields with zero values + } + if len(list) == maxLen { + list.AppendEllipsis(diffStats{}) + break + } + sf := t.Field(i) + if supportExporters && !isExported(sf.Name) { + vv = retrieveUnexportedField(v, sf, true) + } + s := opts.WithTypeMode(autoType).FormatValue(vv, t.Kind(), ptrs) + list = append(list, textRecord{Key: sf.Name, Value: s}) + } + return &textWrap{Prefix: "{", Value: list, Suffix: "}"} + case reflect.Slice: + if v.IsNil() { + return textNil + } + + // Check whether this is a []byte of text data. + if t.Elem() == reflect.TypeOf(byte(0)) { + b := v.Bytes() + isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) && unicode.IsSpace(r) } + if len(b) > 0 && utf8.Valid(b) && len(bytes.TrimFunc(b, isPrintSpace)) == 0 { + out = opts.formatString("", string(b)) + return opts.WithTypeMode(emitType).FormatType(t, out) + } + } + + fallthrough + case reflect.Array: + maxLen := v.Len() + if opts.LimitVerbosity { + maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... + opts.VerbosityLevel-- + } + var list textList + for i := 0; i < v.Len(); i++ { + if len(list) == maxLen { + list.AppendEllipsis(diffStats{}) + break + } + s := opts.WithTypeMode(elideType).FormatValue(v.Index(i), t.Kind(), ptrs) + list = append(list, textRecord{Value: s}) + } + + out = &textWrap{Prefix: "{", Value: list, Suffix: "}"} + if t.Kind() == reflect.Slice && opts.PrintAddresses { + header := fmt.Sprintf("ptr:%v, len:%d, cap:%d", formatPointer(value.PointerOf(v), false), v.Len(), v.Cap()) + out = &textWrap{Prefix: pointerDelimPrefix + header + pointerDelimSuffix, Value: out} + } + return out + case reflect.Map: + if v.IsNil() { + return textNil + } + + // Check pointer for cycles. + ptrRef, visited := ptrs.Push(v) + if visited { + return makeLeafReference(ptrRef, opts.PrintAddresses) + } + defer ptrs.Pop() + + maxLen := v.Len() + if opts.LimitVerbosity { + maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... + opts.VerbosityLevel-- + } + var list textList + for _, k := range value.SortKeys(v.MapKeys()) { + if len(list) == maxLen { + list.AppendEllipsis(diffStats{}) + break + } + sk := formatMapKey(k, false, ptrs) + sv := opts.WithTypeMode(elideType).FormatValue(v.MapIndex(k), t.Kind(), ptrs) + list = append(list, textRecord{Key: sk, Value: sv}) + } + + out = &textWrap{Prefix: "{", Value: list, Suffix: "}"} + out = wrapTrunkReference(ptrRef, opts.PrintAddresses, out) + return out + case reflect.Ptr: + if v.IsNil() { + return textNil + } + + // Check pointer for cycles. + ptrRef, visited := ptrs.Push(v) + if visited { + out = makeLeafReference(ptrRef, opts.PrintAddresses) + return &textWrap{Prefix: "&", Value: out} + } + defer ptrs.Pop() + + skipType = true // Let the underlying value print the type instead + out = opts.FormatValue(v.Elem(), t.Kind(), ptrs) + out = wrapTrunkReference(ptrRef, opts.PrintAddresses, out) + out = &textWrap{Prefix: "&", Value: out} + return out + case reflect.Interface: + if v.IsNil() { + return textNil + } + // Interfaces accept different concrete types, + // so configure the underlying value to explicitly print the type. + skipType = true // Print the concrete type instead + return opts.WithTypeMode(emitType).FormatValue(v.Elem(), t.Kind(), ptrs) + default: + panic(fmt.Sprintf("%v kind not handled", v.Kind())) + } +} + +func (opts formatOptions) formatString(prefix, s string) textNode { + maxLen := len(s) + maxLines := strings.Count(s, "\n") + 1 + if opts.LimitVerbosity { + maxLen = (1 << opts.verbosity()) << 5 // 32, 64, 128, 256, etc... + maxLines = (1 << opts.verbosity()) << 2 // 4, 8, 16, 32, 64, etc... + } + + // For multiline strings, use the triple-quote syntax, + // but only use it when printing removed or inserted nodes since + // we only want the extra verbosity for those cases. + lines := strings.Split(strings.TrimSuffix(s, "\n"), "\n") + isTripleQuoted := len(lines) >= 4 && (opts.DiffMode == '-' || opts.DiffMode == '+') + for i := 0; i < len(lines) && isTripleQuoted; i++ { + lines[i] = strings.TrimPrefix(strings.TrimSuffix(lines[i], "\r"), "\r") // trim leading/trailing carriage returns for legacy Windows endline support + isPrintable := func(r rune) bool { + return unicode.IsPrint(r) || r == '\t' // specially treat tab as printable + } + line := lines[i] + isTripleQuoted = !strings.HasPrefix(strings.TrimPrefix(line, prefix), `"""`) && !strings.HasPrefix(line, "...") && strings.TrimFunc(line, isPrintable) == "" && len(line) <= maxLen + } + if isTripleQuoted { + var list textList + list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(prefix + `"""`), ElideComma: true}) + for i, line := range lines { + if numElided := len(lines) - i; i == maxLines-1 && numElided > 1 { + comment := commentString(fmt.Sprintf("%d elided lines", numElided)) + list = append(list, textRecord{Diff: opts.DiffMode, Value: textEllipsis, ElideComma: true, Comment: comment}) + break + } + list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(line), ElideComma: true}) + } + list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(prefix + `"""`), ElideComma: true}) + return &textWrap{Prefix: "(", Value: list, Suffix: ")"} + } + + // Format the string as a single-line quoted string. + if len(s) > maxLen+len(textEllipsis) { + return textLine(prefix + formatString(s[:maxLen]) + string(textEllipsis)) + } + return textLine(prefix + formatString(s)) +} + +// formatMapKey formats v as if it were a map key. +// The result is guaranteed to be a single line. +func formatMapKey(v reflect.Value, disambiguate bool, ptrs *pointerReferences) string { + var opts formatOptions + opts.DiffMode = diffIdentical + opts.TypeMode = elideType + opts.PrintAddresses = disambiguate + opts.AvoidStringer = disambiguate + opts.QualifiedNames = disambiguate + opts.VerbosityLevel = maxVerbosityPreset + opts.LimitVerbosity = true + s := opts.FormatValue(v, reflect.Map, ptrs).String() + return strings.TrimSpace(s) +} + +// formatString prints s as a double-quoted or backtick-quoted string. +func formatString(s string) string { + // Use quoted string if it the same length as a raw string literal. + // Otherwise, attempt to use the raw string form. + qs := strconv.Quote(s) + if len(qs) == 1+len(s)+1 { + return qs + } + + // Disallow newlines to ensure output is a single line. + // Only allow printable runes for readability purposes. + rawInvalid := func(r rune) bool { + return r == '`' || r == '\n' || !(unicode.IsPrint(r) || r == '\t') + } + if utf8.ValidString(s) && strings.IndexFunc(s, rawInvalid) < 0 { + return "`" + s + "`" + } + return qs +} + +// formatHex prints u as a hexadecimal integer in Go notation. +func formatHex(u uint64) string { + var f string + switch { + case u <= 0xff: + f = "0x%02x" + case u <= 0xffff: + f = "0x%04x" + case u <= 0xffffff: + f = "0x%06x" + case u <= 0xffffffff: + f = "0x%08x" + case u <= 0xffffffffff: + f = "0x%010x" + case u <= 0xffffffffffff: + f = "0x%012x" + case u <= 0xffffffffffffff: + f = "0x%014x" + case u <= 0xffffffffffffffff: + f = "0x%016x" + } + return fmt.Sprintf(f, u) +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/report_slices.go b/integration-test/vendor/github.com/google/go-cmp/cmp/report_slices.go new file mode 100644 index 000000000..2ad3bc85b --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/report_slices.go @@ -0,0 +1,613 @@ +// Copyright 2019, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import ( + "bytes" + "fmt" + "math" + "reflect" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "github.com/google/go-cmp/cmp/internal/diff" +) + +// CanFormatDiffSlice reports whether we support custom formatting for nodes +// that are slices of primitive kinds or strings. +func (opts formatOptions) CanFormatDiffSlice(v *valueNode) bool { + switch { + case opts.DiffMode != diffUnknown: + return false // Must be formatting in diff mode + case v.NumDiff == 0: + return false // No differences detected + case !v.ValueX.IsValid() || !v.ValueY.IsValid(): + return false // Both values must be valid + case v.NumIgnored > 0: + return false // Some ignore option was used + case v.NumTransformed > 0: + return false // Some transform option was used + case v.NumCompared > 1: + return false // More than one comparison was used + case v.NumCompared == 1 && v.Type.Name() != "": + // The need for cmp to check applicability of options on every element + // in a slice is a significant performance detriment for large []byte. + // The workaround is to specify Comparer(bytes.Equal), + // which enables cmp to compare []byte more efficiently. + // If they differ, we still want to provide batched diffing. + // The logic disallows named types since they tend to have their own + // String method, with nicer formatting than what this provides. + return false + } + + // Check whether this is an interface with the same concrete types. + t := v.Type + vx, vy := v.ValueX, v.ValueY + if t.Kind() == reflect.Interface && !vx.IsNil() && !vy.IsNil() && vx.Elem().Type() == vy.Elem().Type() { + vx, vy = vx.Elem(), vy.Elem() + t = vx.Type() + } + + // Check whether we provide specialized diffing for this type. + switch t.Kind() { + case reflect.String: + case reflect.Array, reflect.Slice: + // Only slices of primitive types have specialized handling. + switch t.Elem().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, + reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: + default: + return false + } + + // Both slice values have to be non-empty. + if t.Kind() == reflect.Slice && (vx.Len() == 0 || vy.Len() == 0) { + return false + } + + // If a sufficient number of elements already differ, + // use specialized formatting even if length requirement is not met. + if v.NumDiff > v.NumSame { + return true + } + default: + return false + } + + // Use specialized string diffing for longer slices or strings. + const minLength = 64 + return vx.Len() >= minLength && vy.Len() >= minLength +} + +// FormatDiffSlice prints a diff for the slices (or strings) represented by v. +// This provides custom-tailored logic to make printing of differences in +// textual strings and slices of primitive kinds more readable. +func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { + assert(opts.DiffMode == diffUnknown) + t, vx, vy := v.Type, v.ValueX, v.ValueY + if t.Kind() == reflect.Interface { + vx, vy = vx.Elem(), vy.Elem() + t = vx.Type() + opts = opts.WithTypeMode(emitType) + } + + // Auto-detect the type of the data. + var sx, sy string + var ssx, ssy []string + var isString, isMostlyText, isPureLinedText, isBinary bool + switch { + case t.Kind() == reflect.String: + sx, sy = vx.String(), vy.String() + isString = true + case t.Kind() == reflect.Slice && t.Elem() == reflect.TypeOf(byte(0)): + sx, sy = string(vx.Bytes()), string(vy.Bytes()) + isString = true + case t.Kind() == reflect.Array: + // Arrays need to be addressable for slice operations to work. + vx2, vy2 := reflect.New(t).Elem(), reflect.New(t).Elem() + vx2.Set(vx) + vy2.Set(vy) + vx, vy = vx2, vy2 + } + if isString { + var numTotalRunes, numValidRunes, numLines, lastLineIdx, maxLineLen int + for i, r := range sx + sy { + numTotalRunes++ + if (unicode.IsPrint(r) || unicode.IsSpace(r)) && r != utf8.RuneError { + numValidRunes++ + } + if r == '\n' { + if maxLineLen < i-lastLineIdx { + maxLineLen = i - lastLineIdx + } + lastLineIdx = i + 1 + numLines++ + } + } + isPureText := numValidRunes == numTotalRunes + isMostlyText = float64(numValidRunes) > math.Floor(0.90*float64(numTotalRunes)) + isPureLinedText = isPureText && numLines >= 4 && maxLineLen <= 1024 + isBinary = !isMostlyText + + // Avoid diffing by lines if it produces a significantly more complex + // edit script than diffing by bytes. + if isPureLinedText { + ssx = strings.Split(sx, "\n") + ssy = strings.Split(sy, "\n") + esLines := diff.Difference(len(ssx), len(ssy), func(ix, iy int) diff.Result { + return diff.BoolResult(ssx[ix] == ssy[iy]) + }) + esBytes := diff.Difference(len(sx), len(sy), func(ix, iy int) diff.Result { + return diff.BoolResult(sx[ix] == sy[iy]) + }) + efficiencyLines := float64(esLines.Dist()) / float64(len(esLines)) + efficiencyBytes := float64(esBytes.Dist()) / float64(len(esBytes)) + isPureLinedText = efficiencyLines < 4*efficiencyBytes + } + } + + // Format the string into printable records. + var list textList + var delim string + switch { + // If the text appears to be multi-lined text, + // then perform differencing across individual lines. + case isPureLinedText: + list = opts.formatDiffSlice( + reflect.ValueOf(ssx), reflect.ValueOf(ssy), 1, "line", + func(v reflect.Value, d diffMode) textRecord { + s := formatString(v.Index(0).String()) + return textRecord{Diff: d, Value: textLine(s)} + }, + ) + delim = "\n" + + // If possible, use a custom triple-quote (""") syntax for printing + // differences in a string literal. This format is more readable, + // but has edge-cases where differences are visually indistinguishable. + // This format is avoided under the following conditions: + // • A line starts with `"""` + // • A line starts with "..." + // • A line contains non-printable characters + // • Adjacent different lines differ only by whitespace + // + // For example: + // """ + // ... // 3 identical lines + // foo + // bar + // - baz + // + BAZ + // """ + isTripleQuoted := true + prevRemoveLines := map[string]bool{} + prevInsertLines := map[string]bool{} + var list2 textList + list2 = append(list2, textRecord{Value: textLine(`"""`), ElideComma: true}) + for _, r := range list { + if !r.Value.Equal(textEllipsis) { + line, _ := strconv.Unquote(string(r.Value.(textLine))) + line = strings.TrimPrefix(strings.TrimSuffix(line, "\r"), "\r") // trim leading/trailing carriage returns for legacy Windows endline support + normLine := strings.Map(func(r rune) rune { + if unicode.IsSpace(r) { + return -1 // drop whitespace to avoid visually indistinguishable output + } + return r + }, line) + isPrintable := func(r rune) bool { + return unicode.IsPrint(r) || r == '\t' // specially treat tab as printable + } + isTripleQuoted = !strings.HasPrefix(line, `"""`) && !strings.HasPrefix(line, "...") && strings.TrimFunc(line, isPrintable) == "" + switch r.Diff { + case diffRemoved: + isTripleQuoted = isTripleQuoted && !prevInsertLines[normLine] + prevRemoveLines[normLine] = true + case diffInserted: + isTripleQuoted = isTripleQuoted && !prevRemoveLines[normLine] + prevInsertLines[normLine] = true + } + if !isTripleQuoted { + break + } + r.Value = textLine(line) + r.ElideComma = true + } + if !(r.Diff == diffRemoved || r.Diff == diffInserted) { // start a new non-adjacent difference group + prevRemoveLines = map[string]bool{} + prevInsertLines = map[string]bool{} + } + list2 = append(list2, r) + } + if r := list2[len(list2)-1]; r.Diff == diffIdentical && len(r.Value.(textLine)) == 0 { + list2 = list2[:len(list2)-1] // elide single empty line at the end + } + list2 = append(list2, textRecord{Value: textLine(`"""`), ElideComma: true}) + if isTripleQuoted { + var out textNode = &textWrap{Prefix: "(", Value: list2, Suffix: ")"} + switch t.Kind() { + case reflect.String: + if t != reflect.TypeOf(string("")) { + out = opts.FormatType(t, out) + } + case reflect.Slice: + // Always emit type for slices since the triple-quote syntax + // looks like a string (not a slice). + opts = opts.WithTypeMode(emitType) + out = opts.FormatType(t, out) + } + return out + } + + // If the text appears to be single-lined text, + // then perform differencing in approximately fixed-sized chunks. + // The output is printed as quoted strings. + case isMostlyText: + list = opts.formatDiffSlice( + reflect.ValueOf(sx), reflect.ValueOf(sy), 64, "byte", + func(v reflect.Value, d diffMode) textRecord { + s := formatString(v.String()) + return textRecord{Diff: d, Value: textLine(s)} + }, + ) + + // If the text appears to be binary data, + // then perform differencing in approximately fixed-sized chunks. + // The output is inspired by hexdump. + case isBinary: + list = opts.formatDiffSlice( + reflect.ValueOf(sx), reflect.ValueOf(sy), 16, "byte", + func(v reflect.Value, d diffMode) textRecord { + var ss []string + for i := 0; i < v.Len(); i++ { + ss = append(ss, formatHex(v.Index(i).Uint())) + } + s := strings.Join(ss, ", ") + comment := commentString(fmt.Sprintf("%c|%v|", d, formatASCII(v.String()))) + return textRecord{Diff: d, Value: textLine(s), Comment: comment} + }, + ) + + // For all other slices of primitive types, + // then perform differencing in approximately fixed-sized chunks. + // The size of each chunk depends on the width of the element kind. + default: + var chunkSize int + if t.Elem().Kind() == reflect.Bool { + chunkSize = 16 + } else { + switch t.Elem().Bits() { + case 8: + chunkSize = 16 + case 16: + chunkSize = 12 + case 32: + chunkSize = 8 + default: + chunkSize = 8 + } + } + list = opts.formatDiffSlice( + vx, vy, chunkSize, t.Elem().Kind().String(), + func(v reflect.Value, d diffMode) textRecord { + var ss []string + for i := 0; i < v.Len(); i++ { + switch t.Elem().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + ss = append(ss, fmt.Sprint(v.Index(i).Int())) + case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: + ss = append(ss, fmt.Sprint(v.Index(i).Uint())) + case reflect.Uint8, reflect.Uintptr: + ss = append(ss, formatHex(v.Index(i).Uint())) + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: + ss = append(ss, fmt.Sprint(v.Index(i).Interface())) + } + } + s := strings.Join(ss, ", ") + return textRecord{Diff: d, Value: textLine(s)} + }, + ) + } + + // Wrap the output with appropriate type information. + var out textNode = &textWrap{Prefix: "{", Value: list, Suffix: "}"} + if !isMostlyText { + // The "{...}" byte-sequence literal is not valid Go syntax for strings. + // Emit the type for extra clarity (e.g. "string{...}"). + if t.Kind() == reflect.String { + opts = opts.WithTypeMode(emitType) + } + return opts.FormatType(t, out) + } + switch t.Kind() { + case reflect.String: + out = &textWrap{Prefix: "strings.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)} + if t != reflect.TypeOf(string("")) { + out = opts.FormatType(t, out) + } + case reflect.Slice: + out = &textWrap{Prefix: "bytes.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)} + if t != reflect.TypeOf([]byte(nil)) { + out = opts.FormatType(t, out) + } + } + return out +} + +// formatASCII formats s as an ASCII string. +// This is useful for printing binary strings in a semi-legible way. +func formatASCII(s string) string { + b := bytes.Repeat([]byte{'.'}, len(s)) + for i := 0; i < len(s); i++ { + if ' ' <= s[i] && s[i] <= '~' { + b[i] = s[i] + } + } + return string(b) +} + +func (opts formatOptions) formatDiffSlice( + vx, vy reflect.Value, chunkSize int, name string, + makeRec func(reflect.Value, diffMode) textRecord, +) (list textList) { + eq := func(ix, iy int) bool { + return vx.Index(ix).Interface() == vy.Index(iy).Interface() + } + es := diff.Difference(vx.Len(), vy.Len(), func(ix, iy int) diff.Result { + return diff.BoolResult(eq(ix, iy)) + }) + + appendChunks := func(v reflect.Value, d diffMode) int { + n0 := v.Len() + for v.Len() > 0 { + n := chunkSize + if n > v.Len() { + n = v.Len() + } + list = append(list, makeRec(v.Slice(0, n), d)) + v = v.Slice(n, v.Len()) + } + return n0 - v.Len() + } + + var numDiffs int + maxLen := -1 + if opts.LimitVerbosity { + maxLen = (1 << opts.verbosity()) << 2 // 4, 8, 16, 32, 64, etc... + opts.VerbosityLevel-- + } + + groups := coalesceAdjacentEdits(name, es) + groups = coalesceInterveningIdentical(groups, chunkSize/4) + groups = cleanupSurroundingIdentical(groups, eq) + maxGroup := diffStats{Name: name} + for i, ds := range groups { + if maxLen >= 0 && numDiffs >= maxLen { + maxGroup = maxGroup.Append(ds) + continue + } + + // Print equal. + if ds.NumDiff() == 0 { + // Compute the number of leading and trailing equal bytes to print. + var numLo, numHi int + numEqual := ds.NumIgnored + ds.NumIdentical + for numLo < chunkSize*numContextRecords && numLo+numHi < numEqual && i != 0 { + numLo++ + } + for numHi < chunkSize*numContextRecords && numLo+numHi < numEqual && i != len(groups)-1 { + numHi++ + } + if numEqual-(numLo+numHi) <= chunkSize && ds.NumIgnored == 0 { + numHi = numEqual - numLo // Avoid pointless coalescing of single equal row + } + + // Print the equal bytes. + appendChunks(vx.Slice(0, numLo), diffIdentical) + if numEqual > numLo+numHi { + ds.NumIdentical -= numLo + numHi + list.AppendEllipsis(ds) + } + appendChunks(vx.Slice(numEqual-numHi, numEqual), diffIdentical) + vx = vx.Slice(numEqual, vx.Len()) + vy = vy.Slice(numEqual, vy.Len()) + continue + } + + // Print unequal. + len0 := len(list) + nx := appendChunks(vx.Slice(0, ds.NumIdentical+ds.NumRemoved+ds.NumModified), diffRemoved) + vx = vx.Slice(nx, vx.Len()) + ny := appendChunks(vy.Slice(0, ds.NumIdentical+ds.NumInserted+ds.NumModified), diffInserted) + vy = vy.Slice(ny, vy.Len()) + numDiffs += len(list) - len0 + } + if maxGroup.IsZero() { + assert(vx.Len() == 0 && vy.Len() == 0) + } else { + list.AppendEllipsis(maxGroup) + } + return list +} + +// coalesceAdjacentEdits coalesces the list of edits into groups of adjacent +// equal or unequal counts. +// +// Example: +// +// Input: "..XXY...Y" +// Output: [ +// {NumIdentical: 2}, +// {NumRemoved: 2, NumInserted 1}, +// {NumIdentical: 3}, +// {NumInserted: 1}, +// ] +// +func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) { + var prevMode byte + lastStats := func(mode byte) *diffStats { + if prevMode != mode { + groups = append(groups, diffStats{Name: name}) + prevMode = mode + } + return &groups[len(groups)-1] + } + for _, e := range es { + switch e { + case diff.Identity: + lastStats('=').NumIdentical++ + case diff.UniqueX: + lastStats('!').NumRemoved++ + case diff.UniqueY: + lastStats('!').NumInserted++ + case diff.Modified: + lastStats('!').NumModified++ + } + } + return groups +} + +// coalesceInterveningIdentical coalesces sufficiently short (<= windowSize) +// equal groups into adjacent unequal groups that currently result in a +// dual inserted/removed printout. This acts as a high-pass filter to smooth +// out high-frequency changes within the windowSize. +// +// Example: +// +// WindowSize: 16, +// Input: [ +// {NumIdentical: 61}, // group 0 +// {NumRemoved: 3, NumInserted: 1}, // group 1 +// {NumIdentical: 6}, // ├── coalesce +// {NumInserted: 2}, // ├── coalesce +// {NumIdentical: 1}, // ├── coalesce +// {NumRemoved: 9}, // └── coalesce +// {NumIdentical: 64}, // group 2 +// {NumRemoved: 3, NumInserted: 1}, // group 3 +// {NumIdentical: 6}, // ├── coalesce +// {NumInserted: 2}, // ├── coalesce +// {NumIdentical: 1}, // ├── coalesce +// {NumRemoved: 7}, // ├── coalesce +// {NumIdentical: 1}, // ├── coalesce +// {NumRemoved: 2}, // └── coalesce +// {NumIdentical: 63}, // group 4 +// ] +// Output: [ +// {NumIdentical: 61}, +// {NumIdentical: 7, NumRemoved: 12, NumInserted: 3}, +// {NumIdentical: 64}, +// {NumIdentical: 8, NumRemoved: 12, NumInserted: 3}, +// {NumIdentical: 63}, +// ] +// +func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStats { + groups, groupsOrig := groups[:0], groups + for i, ds := range groupsOrig { + if len(groups) >= 2 && ds.NumDiff() > 0 { + prev := &groups[len(groups)-2] // Unequal group + curr := &groups[len(groups)-1] // Equal group + next := &groupsOrig[i] // Unequal group + hadX, hadY := prev.NumRemoved > 0, prev.NumInserted > 0 + hasX, hasY := next.NumRemoved > 0, next.NumInserted > 0 + if ((hadX || hasX) && (hadY || hasY)) && curr.NumIdentical <= windowSize { + *prev = prev.Append(*curr).Append(*next) + groups = groups[:len(groups)-1] // Truncate off equal group + continue + } + } + groups = append(groups, ds) + } + return groups +} + +// cleanupSurroundingIdentical scans through all unequal groups, and +// moves any leading sequence of equal elements to the preceding equal group and +// moves and trailing sequence of equal elements to the succeeding equal group. +// +// This is necessary since coalesceInterveningIdentical may coalesce edit groups +// together such that leading/trailing spans of equal elements becomes possible. +// Note that this can occur even with an optimal diffing algorithm. +// +// Example: +// +// Input: [ +// {NumIdentical: 61}, +// {NumIdentical: 1 , NumRemoved: 11, NumInserted: 2}, // assume 3 leading identical elements +// {NumIdentical: 67}, +// {NumIdentical: 7, NumRemoved: 12, NumInserted: 3}, // assume 10 trailing identical elements +// {NumIdentical: 54}, +// ] +// Output: [ +// {NumIdentical: 64}, // incremented by 3 +// {NumRemoved: 9}, +// {NumIdentical: 67}, +// {NumRemoved: 9}, +// {NumIdentical: 64}, // incremented by 10 +// ] +// +func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []diffStats { + var ix, iy int // indexes into sequence x and y + for i, ds := range groups { + // Handle equal group. + if ds.NumDiff() == 0 { + ix += ds.NumIdentical + iy += ds.NumIdentical + continue + } + + // Handle unequal group. + nx := ds.NumIdentical + ds.NumRemoved + ds.NumModified + ny := ds.NumIdentical + ds.NumInserted + ds.NumModified + var numLeadingIdentical, numTrailingIdentical int + for i := 0; i < nx && i < ny && eq(ix+i, iy+i); i++ { + numLeadingIdentical++ + } + for i := 0; i < nx && i < ny && eq(ix+nx-1-i, iy+ny-1-i); i++ { + numTrailingIdentical++ + } + if numIdentical := numLeadingIdentical + numTrailingIdentical; numIdentical > 0 { + if numLeadingIdentical > 0 { + // Remove leading identical span from this group and + // insert it into the preceding group. + if i-1 >= 0 { + groups[i-1].NumIdentical += numLeadingIdentical + } else { + // No preceding group exists, so prepend a new group, + // but do so after we finish iterating over all groups. + defer func() { + groups = append([]diffStats{{Name: groups[0].Name, NumIdentical: numLeadingIdentical}}, groups...) + }() + } + // Increment indexes since the preceding group would have handled this. + ix += numLeadingIdentical + iy += numLeadingIdentical + } + if numTrailingIdentical > 0 { + // Remove trailing identical span from this group and + // insert it into the succeeding group. + if i+1 < len(groups) { + groups[i+1].NumIdentical += numTrailingIdentical + } else { + // No succeeding group exists, so append a new group, + // but do so after we finish iterating over all groups. + defer func() { + groups = append(groups, diffStats{Name: groups[len(groups)-1].Name, NumIdentical: numTrailingIdentical}) + }() + } + // Do not increment indexes since the succeeding group will handle this. + } + + // Update this group since some identical elements were removed. + nx -= numIdentical + ny -= numIdentical + groups[i] = diffStats{Name: ds.Name, NumRemoved: nx, NumInserted: ny} + } + ix += nx + iy += ny + } + return groups +} diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/report_text.go b/integration-test/vendor/github.com/google/go-cmp/cmp/report_text.go new file mode 100644 index 000000000..0fd46d7ff --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/report_text.go @@ -0,0 +1,431 @@ +// Copyright 2019, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import ( + "bytes" + "fmt" + "math/rand" + "strings" + "time" + "unicode/utf8" + + "github.com/google/go-cmp/cmp/internal/flags" +) + +var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 + +const maxColumnLength = 80 + +type indentMode int + +func (n indentMode) appendIndent(b []byte, d diffMode) []byte { + // The output of Diff is documented as being unstable to provide future + // flexibility in changing the output for more humanly readable reports. + // This logic intentionally introduces instability to the exact output + // so that users can detect accidental reliance on stability early on, + // rather than much later when an actual change to the format occurs. + if flags.Deterministic || randBool { + // Use regular spaces (U+0020). + switch d { + case diffUnknown, diffIdentical: + b = append(b, " "...) + case diffRemoved: + b = append(b, "- "...) + case diffInserted: + b = append(b, "+ "...) + } + } else { + // Use non-breaking spaces (U+00a0). + switch d { + case diffUnknown, diffIdentical: + b = append(b, "  "...) + case diffRemoved: + b = append(b, "- "...) + case diffInserted: + b = append(b, "+ "...) + } + } + return repeatCount(n).appendChar(b, '\t') +} + +type repeatCount int + +func (n repeatCount) appendChar(b []byte, c byte) []byte { + for ; n > 0; n-- { + b = append(b, c) + } + return b +} + +// textNode is a simplified tree-based representation of structured text. +// Possible node types are textWrap, textList, or textLine. +type textNode interface { + // Len reports the length in bytes of a single-line version of the tree. + // Nested textRecord.Diff and textRecord.Comment fields are ignored. + Len() int + // Equal reports whether the two trees are structurally identical. + // Nested textRecord.Diff and textRecord.Comment fields are compared. + Equal(textNode) bool + // String returns the string representation of the text tree. + // It is not guaranteed that len(x.String()) == x.Len(), + // nor that x.String() == y.String() implies that x.Equal(y). + String() string + + // formatCompactTo formats the contents of the tree as a single-line string + // to the provided buffer. Any nested textRecord.Diff and textRecord.Comment + // fields are ignored. + // + // However, not all nodes in the tree should be collapsed as a single-line. + // If a node can be collapsed as a single-line, it is replaced by a textLine + // node. Since the top-level node cannot replace itself, this also returns + // the current node itself. + // + // This does not mutate the receiver. + formatCompactTo([]byte, diffMode) ([]byte, textNode) + // formatExpandedTo formats the contents of the tree as a multi-line string + // to the provided buffer. In order for column alignment to operate well, + // formatCompactTo must be called before calling formatExpandedTo. + formatExpandedTo([]byte, diffMode, indentMode) []byte +} + +// textWrap is a wrapper that concatenates a prefix and/or a suffix +// to the underlying node. +type textWrap struct { + Prefix string // e.g., "bytes.Buffer{" + Value textNode // textWrap | textList | textLine + Suffix string // e.g., "}" + Metadata interface{} // arbitrary metadata; has no effect on formatting +} + +func (s *textWrap) Len() int { + return len(s.Prefix) + s.Value.Len() + len(s.Suffix) +} +func (s1 *textWrap) Equal(s2 textNode) bool { + if s2, ok := s2.(*textWrap); ok { + return s1.Prefix == s2.Prefix && s1.Value.Equal(s2.Value) && s1.Suffix == s2.Suffix + } + return false +} +func (s *textWrap) String() string { + var d diffMode + var n indentMode + _, s2 := s.formatCompactTo(nil, d) + b := n.appendIndent(nil, d) // Leading indent + b = s2.formatExpandedTo(b, d, n) // Main body + b = append(b, '\n') // Trailing newline + return string(b) +} +func (s *textWrap) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { + n0 := len(b) // Original buffer length + b = append(b, s.Prefix...) + b, s.Value = s.Value.formatCompactTo(b, d) + b = append(b, s.Suffix...) + if _, ok := s.Value.(textLine); ok { + return b, textLine(b[n0:]) + } + return b, s +} +func (s *textWrap) formatExpandedTo(b []byte, d diffMode, n indentMode) []byte { + b = append(b, s.Prefix...) + b = s.Value.formatExpandedTo(b, d, n) + b = append(b, s.Suffix...) + return b +} + +// textList is a comma-separated list of textWrap or textLine nodes. +// The list may be formatted as multi-lines or single-line at the discretion +// of the textList.formatCompactTo method. +type textList []textRecord +type textRecord struct { + Diff diffMode // e.g., 0 or '-' or '+' + Key string // e.g., "MyField" + Value textNode // textWrap | textLine + ElideComma bool // avoid trailing comma + Comment fmt.Stringer // e.g., "6 identical fields" +} + +// AppendEllipsis appends a new ellipsis node to the list if none already +// exists at the end. If cs is non-zero it coalesces the statistics with the +// previous diffStats. +func (s *textList) AppendEllipsis(ds diffStats) { + hasStats := !ds.IsZero() + if len(*s) == 0 || !(*s)[len(*s)-1].Value.Equal(textEllipsis) { + if hasStats { + *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true, Comment: ds}) + } else { + *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true}) + } + return + } + if hasStats { + (*s)[len(*s)-1].Comment = (*s)[len(*s)-1].Comment.(diffStats).Append(ds) + } +} + +func (s textList) Len() (n int) { + for i, r := range s { + n += len(r.Key) + if r.Key != "" { + n += len(": ") + } + n += r.Value.Len() + if i < len(s)-1 { + n += len(", ") + } + } + return n +} + +func (s1 textList) Equal(s2 textNode) bool { + if s2, ok := s2.(textList); ok { + if len(s1) != len(s2) { + return false + } + for i := range s1 { + r1, r2 := s1[i], s2[i] + if !(r1.Diff == r2.Diff && r1.Key == r2.Key && r1.Value.Equal(r2.Value) && r1.Comment == r2.Comment) { + return false + } + } + return true + } + return false +} + +func (s textList) String() string { + return (&textWrap{Prefix: "{", Value: s, Suffix: "}"}).String() +} + +func (s textList) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { + s = append(textList(nil), s...) // Avoid mutating original + + // Determine whether we can collapse this list as a single line. + n0 := len(b) // Original buffer length + var multiLine bool + for i, r := range s { + if r.Diff == diffInserted || r.Diff == diffRemoved { + multiLine = true + } + b = append(b, r.Key...) + if r.Key != "" { + b = append(b, ": "...) + } + b, s[i].Value = r.Value.formatCompactTo(b, d|r.Diff) + if _, ok := s[i].Value.(textLine); !ok { + multiLine = true + } + if r.Comment != nil { + multiLine = true + } + if i < len(s)-1 { + b = append(b, ", "...) + } + } + // Force multi-lined output when printing a removed/inserted node that + // is sufficiently long. + if (d == diffInserted || d == diffRemoved) && len(b[n0:]) > maxColumnLength { + multiLine = true + } + if !multiLine { + return b, textLine(b[n0:]) + } + return b, s +} + +func (s textList) formatExpandedTo(b []byte, d diffMode, n indentMode) []byte { + alignKeyLens := s.alignLens( + func(r textRecord) bool { + _, isLine := r.Value.(textLine) + return r.Key == "" || !isLine + }, + func(r textRecord) int { return utf8.RuneCountInString(r.Key) }, + ) + alignValueLens := s.alignLens( + func(r textRecord) bool { + _, isLine := r.Value.(textLine) + return !isLine || r.Value.Equal(textEllipsis) || r.Comment == nil + }, + func(r textRecord) int { return utf8.RuneCount(r.Value.(textLine)) }, + ) + + // Format lists of simple lists in a batched form. + // If the list is sequence of only textLine values, + // then batch multiple values on a single line. + var isSimple bool + for _, r := range s { + _, isLine := r.Value.(textLine) + isSimple = r.Diff == 0 && r.Key == "" && isLine && r.Comment == nil + if !isSimple { + break + } + } + if isSimple { + n++ + var batch []byte + emitBatch := func() { + if len(batch) > 0 { + b = n.appendIndent(append(b, '\n'), d) + b = append(b, bytes.TrimRight(batch, " ")...) + batch = batch[:0] + } + } + for _, r := range s { + line := r.Value.(textLine) + if len(batch)+len(line)+len(", ") > maxColumnLength { + emitBatch() + } + batch = append(batch, line...) + batch = append(batch, ", "...) + } + emitBatch() + n-- + return n.appendIndent(append(b, '\n'), d) + } + + // Format the list as a multi-lined output. + n++ + for i, r := range s { + b = n.appendIndent(append(b, '\n'), d|r.Diff) + if r.Key != "" { + b = append(b, r.Key+": "...) + } + b = alignKeyLens[i].appendChar(b, ' ') + + b = r.Value.formatExpandedTo(b, d|r.Diff, n) + if !r.ElideComma { + b = append(b, ',') + } + b = alignValueLens[i].appendChar(b, ' ') + + if r.Comment != nil { + b = append(b, " // "+r.Comment.String()...) + } + } + n-- + + return n.appendIndent(append(b, '\n'), d) +} + +func (s textList) alignLens( + skipFunc func(textRecord) bool, + lenFunc func(textRecord) int, +) []repeatCount { + var startIdx, endIdx, maxLen int + lens := make([]repeatCount, len(s)) + for i, r := range s { + if skipFunc(r) { + for j := startIdx; j < endIdx && j < len(s); j++ { + lens[j] = repeatCount(maxLen - lenFunc(s[j])) + } + startIdx, endIdx, maxLen = i+1, i+1, 0 + } else { + if maxLen < lenFunc(r) { + maxLen = lenFunc(r) + } + endIdx = i + 1 + } + } + for j := startIdx; j < endIdx && j < len(s); j++ { + lens[j] = repeatCount(maxLen - lenFunc(s[j])) + } + return lens +} + +// textLine is a single-line segment of text and is always a leaf node +// in the textNode tree. +type textLine []byte + +var ( + textNil = textLine("nil") + textEllipsis = textLine("...") +) + +func (s textLine) Len() int { + return len(s) +} +func (s1 textLine) Equal(s2 textNode) bool { + if s2, ok := s2.(textLine); ok { + return bytes.Equal([]byte(s1), []byte(s2)) + } + return false +} +func (s textLine) String() string { + return string(s) +} +func (s textLine) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { + return append(b, s...), s +} +func (s textLine) formatExpandedTo(b []byte, _ diffMode, _ indentMode) []byte { + return append(b, s...) +} + +type diffStats struct { + Name string + NumIgnored int + NumIdentical int + NumRemoved int + NumInserted int + NumModified int +} + +func (s diffStats) IsZero() bool { + s.Name = "" + return s == diffStats{} +} + +func (s diffStats) NumDiff() int { + return s.NumRemoved + s.NumInserted + s.NumModified +} + +func (s diffStats) Append(ds diffStats) diffStats { + assert(s.Name == ds.Name) + s.NumIgnored += ds.NumIgnored + s.NumIdentical += ds.NumIdentical + s.NumRemoved += ds.NumRemoved + s.NumInserted += ds.NumInserted + s.NumModified += ds.NumModified + return s +} + +// String prints a humanly-readable summary of coalesced records. +// +// Example: +// diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields" +func (s diffStats) String() string { + var ss []string + var sum int + labels := [...]string{"ignored", "identical", "removed", "inserted", "modified"} + counts := [...]int{s.NumIgnored, s.NumIdentical, s.NumRemoved, s.NumInserted, s.NumModified} + for i, n := range counts { + if n > 0 { + ss = append(ss, fmt.Sprintf("%d %v", n, labels[i])) + } + sum += n + } + + // Pluralize the name (adjusting for some obscure English grammar rules). + name := s.Name + if sum > 1 { + name += "s" + if strings.HasSuffix(name, "ys") { + name = name[:len(name)-2] + "ies" // e.g., "entrys" => "entries" + } + } + + // Format the list according to English grammar (with Oxford comma). + switch n := len(ss); n { + case 0: + return "" + case 1, 2: + return strings.Join(ss, " and ") + " " + name + default: + return strings.Join(ss[:n-1], ", ") + ", and " + ss[n-1] + " " + name + } +} + +type commentString string + +func (s commentString) String() string { return string(s) } diff --git a/integration-test/vendor/github.com/google/go-cmp/cmp/report_value.go b/integration-test/vendor/github.com/google/go-cmp/cmp/report_value.go new file mode 100644 index 000000000..668d470fd --- /dev/null +++ b/integration-test/vendor/github.com/google/go-cmp/cmp/report_value.go @@ -0,0 +1,121 @@ +// Copyright 2019, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import "reflect" + +// valueNode represents a single node within a report, which is a +// structured representation of the value tree, containing information +// regarding which nodes are equal or not. +type valueNode struct { + parent *valueNode + + Type reflect.Type + ValueX reflect.Value + ValueY reflect.Value + + // NumSame is the number of leaf nodes that are equal. + // All descendants are equal only if NumDiff is 0. + NumSame int + // NumDiff is the number of leaf nodes that are not equal. + NumDiff int + // NumIgnored is the number of leaf nodes that are ignored. + NumIgnored int + // NumCompared is the number of leaf nodes that were compared + // using an Equal method or Comparer function. + NumCompared int + // NumTransformed is the number of non-leaf nodes that were transformed. + NumTransformed int + // NumChildren is the number of transitive descendants of this node. + // This counts from zero; thus, leaf nodes have no descendants. + NumChildren int + // MaxDepth is the maximum depth of the tree. This counts from zero; + // thus, leaf nodes have a depth of zero. + MaxDepth int + + // Records is a list of struct fields, slice elements, or map entries. + Records []reportRecord // If populated, implies Value is not populated + + // Value is the result of a transformation, pointer indirect, of + // type assertion. + Value *valueNode // If populated, implies Records is not populated + + // TransformerName is the name of the transformer. + TransformerName string // If non-empty, implies Value is populated +} +type reportRecord struct { + Key reflect.Value // Invalid for slice element + Value *valueNode +} + +func (parent *valueNode) PushStep(ps PathStep) (child *valueNode) { + vx, vy := ps.Values() + child = &valueNode{parent: parent, Type: ps.Type(), ValueX: vx, ValueY: vy} + switch s := ps.(type) { + case StructField: + assert(parent.Value == nil) + parent.Records = append(parent.Records, reportRecord{Key: reflect.ValueOf(s.Name()), Value: child}) + case SliceIndex: + assert(parent.Value == nil) + parent.Records = append(parent.Records, reportRecord{Value: child}) + case MapIndex: + assert(parent.Value == nil) + parent.Records = append(parent.Records, reportRecord{Key: s.Key(), Value: child}) + case Indirect: + assert(parent.Value == nil && parent.Records == nil) + parent.Value = child + case TypeAssertion: + assert(parent.Value == nil && parent.Records == nil) + parent.Value = child + case Transform: + assert(parent.Value == nil && parent.Records == nil) + parent.Value = child + parent.TransformerName = s.Name() + parent.NumTransformed++ + default: + assert(parent == nil) // Must be the root step + } + return child +} + +func (r *valueNode) Report(rs Result) { + assert(r.MaxDepth == 0) // May only be called on leaf nodes + + if rs.ByIgnore() { + r.NumIgnored++ + } else { + if rs.Equal() { + r.NumSame++ + } else { + r.NumDiff++ + } + } + assert(r.NumSame+r.NumDiff+r.NumIgnored == 1) + + if rs.ByMethod() { + r.NumCompared++ + } + if rs.ByFunc() { + r.NumCompared++ + } + assert(r.NumCompared <= 1) +} + +func (child *valueNode) PopStep() (parent *valueNode) { + if child.parent == nil { + return nil + } + parent = child.parent + parent.NumSame += child.NumSame + parent.NumDiff += child.NumDiff + parent.NumIgnored += child.NumIgnored + parent.NumCompared += child.NumCompared + parent.NumTransformed += child.NumTransformed + parent.NumChildren += child.NumChildren + 1 + if parent.MaxDepth < child.MaxDepth+1 { + parent.MaxDepth = child.MaxDepth + 1 + } + return parent +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/LICENSE b/integration-test/vendor/github.com/google/go-containerregistry/LICENSE new file mode 100644 index 000000000..7a4a3ea24 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/LICENSE @@ -0,0 +1,202 @@ + + 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. \ No newline at end of file diff --git a/integration-test/vendor/github.com/google/go-containerregistry/internal/redact/redact.go b/integration-test/vendor/github.com/google/go-containerregistry/internal/redact/redact.go new file mode 100644 index 000000000..dc9c56b7f --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/internal/redact/redact.go @@ -0,0 +1,35 @@ +// Copyright 2020 Google LLC All Rights Reserved. +// +// 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 redact contains a simple context signal for redacting requests. +package redact + +import ( + "context" +) + +type contextKey string + +var redactKey = contextKey("redact") + +// NewContext creates a new ctx with the reason for redaction. +func NewContext(ctx context.Context, reason string) context.Context { + return context.WithValue(ctx, redactKey, reason) +} + +// FromContext returns the redaction reason, if any. +func FromContext(ctx context.Context) (bool, string) { + reason, ok := ctx.Value(redactKey).(string) + return ok, reason +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/internal/retry/retry.go b/integration-test/vendor/github.com/google/go-containerregistry/internal/retry/retry.go new file mode 100644 index 000000000..133cb1c12 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/internal/retry/retry.go @@ -0,0 +1,77 @@ +// Copyright 2019 Google LLC All Rights Reserved. +// +// 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 retry provides methods for retrying operations. It is a thin wrapper +// around k8s.io/apimachinery/pkg/util/wait to make certain operations easier. +package retry + +import ( + "context" + "fmt" + + "github.com/google/go-containerregistry/internal/retry/wait" +) + +// Backoff is an alias of our own wait.Backoff to avoid name conflicts with +// the kubernetes wait package. Typing retry.Backoff is aesier than fixing +// the wrong import every time you use wait.Backoff. +type Backoff = wait.Backoff + +// This is implemented by several errors in the net package as well as our +// transport.Error. +type temporary interface { + Temporary() bool +} + +// IsTemporary returns true if err implements Temporary() and it returns true. +func IsTemporary(err error) bool { + if err == context.DeadlineExceeded { + return false + } + if te, ok := err.(temporary); ok && te.Temporary() { + return true + } + return false +} + +// IsNotNil returns true if err is not nil. +func IsNotNil(err error) bool { + return err != nil +} + +// Predicate determines whether an error should be retried. +type Predicate func(error) (retry bool) + +// Retry retries a given function, f, until a predicate is satisfied, using +// exponential backoff. If the predicate is never satisfied, it will return the +// last error returned by f. +func Retry(f func() error, p Predicate, backoff wait.Backoff) (err error) { + if f == nil { + return fmt.Errorf("nil f passed to retry") + } + if p == nil { + return fmt.Errorf("nil p passed to retry") + } + + condition := func() (bool, error) { + err = f() + if p(err) { + return false, nil + } + return true, err + } + + wait.ExponentialBackoff(backoff, condition) + return +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/internal/retry/wait/kubernetes_apimachinery_wait.go b/integration-test/vendor/github.com/google/go-containerregistry/internal/retry/wait/kubernetes_apimachinery_wait.go new file mode 100644 index 000000000..ab06e5f10 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/internal/retry/wait/kubernetes_apimachinery_wait.go @@ -0,0 +1,123 @@ +/* +Copyright 2014 The Kubernetes Authors. + +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 wait is a subset of k8s.io/apimachinery to avoid conflicts +// in dependencies (specifically, logging). +package wait + +import ( + "errors" + "math/rand" + "time" +) + +// Jitter returns a time.Duration between duration and duration + maxFactor * +// duration. +// +// This allows clients to avoid converging on periodic behavior. If maxFactor +// is 0.0, a suggested default value will be chosen. +func Jitter(duration time.Duration, maxFactor float64) time.Duration { + if maxFactor <= 0.0 { + maxFactor = 1.0 + } + wait := duration + time.Duration(rand.Float64()*maxFactor*float64(duration)) + return wait +} + +// ErrWaitTimeout is returned when the condition exited without success. +var ErrWaitTimeout = errors.New("timed out waiting for the condition") + +// ConditionFunc returns true if the condition is satisfied, or an error +// if the loop should be aborted. +type ConditionFunc func() (done bool, err error) + +// Backoff holds parameters applied to a Backoff function. +type Backoff struct { + // The initial duration. + Duration time.Duration + // Duration is multiplied by factor each iteration, if factor is not zero + // and the limits imposed by Steps and Cap have not been reached. + // Should not be negative. + // The jitter does not contribute to the updates to the duration parameter. + Factor float64 + // The sleep at each iteration is the duration plus an additional + // amount chosen uniformly at random from the interval between + // zero and `jitter*duration`. + Jitter float64 + // The remaining number of iterations in which the duration + // parameter may change (but progress can be stopped earlier by + // hitting the cap). If not positive, the duration is not + // changed. Used for exponential backoff in combination with + // Factor and Cap. + Steps int + // A limit on revised values of the duration parameter. If a + // multiplication by the factor parameter would make the duration + // exceed the cap then the duration is set to the cap and the + // steps parameter is set to zero. + Cap time.Duration +} + +// Step (1) returns an amount of time to sleep determined by the +// original Duration and Jitter and (2) mutates the provided Backoff +// to update its Steps and Duration. +func (b *Backoff) Step() time.Duration { + if b.Steps < 1 { + if b.Jitter > 0 { + return Jitter(b.Duration, b.Jitter) + } + return b.Duration + } + b.Steps-- + + duration := b.Duration + + // calculate the next step + if b.Factor != 0 { + b.Duration = time.Duration(float64(b.Duration) * b.Factor) + if b.Cap > 0 && b.Duration > b.Cap { + b.Duration = b.Cap + b.Steps = 0 + } + } + + if b.Jitter > 0 { + duration = Jitter(duration, b.Jitter) + } + return duration +} + +// ExponentialBackoff repeats a condition check with exponential backoff. +// +// It repeatedly checks the condition and then sleeps, using `backoff.Step()` +// to determine the length of the sleep and adjust Duration and Steps. +// Stops and returns as soon as: +// 1. the condition check returns true or an error, +// 2. `backoff.Steps` checks of the condition have been done, or +// 3. a sleep truncated by the cap on duration has been completed. +// In case (1) the returned error is what the condition function returned. +// In all other cases, ErrWaitTimeout is returned. +func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error { + for backoff.Steps > 0 { + if ok, err := condition(); err != nil || ok { + return err + } + if backoff.Steps == 1 { + break + } + time.Sleep(backoff.Step()) + } + return ErrWaitTimeout +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/README.md b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/README.md new file mode 100644 index 000000000..1eb17c7ab --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/README.md @@ -0,0 +1,242 @@ +# `authn` + +[![GoDoc](https://godoc.org/github.com/google/go-containerregistry/pkg/authn?status.svg)](https://godoc.org/github.com/google/go-containerregistry/pkg/authn) + +This README outlines how we acquire and use credentials when interacting with a registry. + +As much as possible, we attempt to emulate docker's authentication behavior and configuration so that this library "just works" if you've already configured credentials that work with docker; however, when things don't work, a basic understanding of what's going on can help with debugging. + +The official documentation for how docker authentication works is (reasonably) scattered across several different sites and GitHub repositories, so we've tried to summarize the relevant bits here. + +## tl;dr for consumers of this package + +By default, [`pkg/v1/remote`](https://godoc.org/github.com/google/go-containerregistry/pkg/v1/remote) uses [`Anonymous`](https://godoc.org/github.com/google/go-containerregistry/pkg/authn#Anonymous) credentials (i.e. _none_), which for most registries will only allow read access to public images. + +To use the credentials found in your docker config file, you can use the [`DefaultKeychain`](https://godoc.org/github.com/google/go-containerregistry/pkg/authn#DefaultKeychain), e.g.: + +```go +package main + +import ( + "fmt" + + "github.com/google/go-containerregistry/pkg/authn" + "github.com/google/go-containerregistry/pkg/name" + "github.com/google/go-containerregistry/pkg/v1/remote" +) + +func main() { + ref, err := name.ParseReference("registry.example.com/private/repo") + if err != nil { + panic(err) + } + + // Fetch the manifest using default credentials. + img, err := remote.Get(ref, remote.WithAuthFromKeychain(authn.DefaultKeychain)) + if err != nil { + panic(err) + } + + // Prints the digest of registry.example.com/private/repo + fmt.Println(img.Digest) +} +``` + +(If you're only using [gcr.io](https://gcr.io), see the [`pkg/v1/google.Keychain`](https://godoc.org/github.com/google/go-containerregistry/pkg/v1/google#Keychain), which emulates [`docker-credential-gcr`](https://github.com/GoogleCloudPlatform/docker-credential-gcr).) + +## The Config File + +This file contains various configuration options for docker and is (by default) located at: +* `$HOME/.docker/config.json` (on linux and darwin), or +* `%USERPROFILE%\.docker\config.json` (on windows). + +You can override this location with the `DOCKER_CONFIG` environment variable. + +### Plaintext + +The config file is where your credentials are stored when you invoke `docker login`, e.g. the contents may look something like this: + +```json +{ + "auths": { + "registry.example.com": { + "auth": "QXp1cmVEaWFtb25kOmh1bnRlcjI=" + } + } +} +``` + +The `auths` map has an entry per registry, and the `auth` field contains your username and password encoded as [HTTP 'Basic' Auth](https://tools.ietf.org/html/rfc7617). + +**NOTE**: This means that your credentials are stored _in plaintext_: + +```bash +$ echo "QXp1cmVEaWFtb25kOmh1bnRlcjI=" | base64 -d +AzureDiamond:hunter2 +``` + +For what it's worth, this config file is equivalent to: + +```json +{ + "auths": { + "registry.example.com": { + "username": "AzureDiamond", + "password": "hunter2" + } + } +} +``` + +... which is useful to know if e.g. your CI system provides you a registry username and password via environment variables and you want to populate this file manually without invoking `docker login`. + +### Helpers + +If you log in like this, docker will warn you that you should use a [credential helper](https://docs.docker.com/engine/reference/commandline/login/#credentials-store), and you should! + +To configure a global credential helper: +```json +{ + "credsStore": "osxkeychain" +} +``` + +To configure a per-registry credential helper: +```json +{ + "credHelpers": { + "gcr.io": "gcr" + } +} +``` + +We use [`github.com/docker/cli/cli/config.Load`](https://godoc.org/github.com/docker/cli/cli/config#Load) to parse the config file and invoke any necessary credential helpers. This handles the logic of taking a [`ConfigFile`](https://github.com/docker/cli/blob/ba63a92655c0bea4857b8d6cc4991498858b3c60/cli/config/configfile/file.go#L25-L54) + registry domain and producing an [`AuthConfig`](https://github.com/docker/cli/blob/ba63a92655c0bea4857b8d6cc4991498858b3c60/cli/config/types/authconfig.go#L3-L22), which determines how we authenticate to the registry. + +## Credential Helpers + +The [credential helper protocol](https://github.com/docker/docker-credential-helpers) allows you to configure a binary that supplies credentials for the registry, rather than hard-coding them in the config file. + +The protocol has several verbs, but the one we most care about is `get`. + +For example, using the following config file: +```json +{ + "credHelpers": { + "gcr.io": "gcr", + "eu.gcr.io": "gcr" + } +} +``` + +To acquire credentials for `gcr.io`, we look in the `credHelpers` map to find +the credential helper for `gcr.io` is `gcr`. By appending that value to +`docker-credential-`, we can get the name of the binary we need to use. + +For this example, that's `docker-credential-gcr`, which must be on our `$PATH`. +We'll then invoke that binary to get credentials: + +```bash +$ echo "gcr.io" | docker-credential-gcr get +{"Username":"_token","Secret":""} +``` + +You can configure the same credential helper for multiple registries, which is +why we need to pass the domain in via STDIN, e.g. if we were trying to access +`eu.gcr.io`, we'd do this instead: + +```bash +$ echo "eu.gcr.io" | docker-credential-gcr get +{"Username":"_token","Secret":""} +``` + +### Debugging credential helpers + +If a credential helper is configured but doesn't seem to be working, it can be +challenging to debug. Implementing a fake credential helper lets you poke around +to make it easier to see where the failure is happening. + +This "implements" a credential helper with hard-coded values: +``` +#!/usr/bin/env bash +echo '{"Username":"","Secret":"hunter2"}' +``` + + +This implements a credential helper that prints the output of +`docker-credential-gcr` to both stderr and whatever called it, which allows you +to snoop on another credential helper: +``` +#!/usr/bin/env bash +docker-credential-gcr $@ | tee >(cat 1>&2) +``` + +Put those files somewhere on your path, naming them e.g. +`docker-credential-hardcoded` and `docker-credential-tee`, then modify the +config file to use them: + +```json +{ + "credHelpers": { + "gcr.io": "tee", + "eu.gcr.io": "hardcoded" + } +} +``` + +The `docker-credential-tee` trick works with both `crane` and `docker`: + +```bash +$ crane manifest gcr.io/google-containers/pause > /dev/null +{"ServerURL":"","Username":"_dcgcr_1_5_0_token","Secret":""} + +$ docker pull gcr.io/google-containers/pause +Using default tag: latest +{"ServerURL":"","Username":"_dcgcr_1_5_0_token","Secret":""} +latest: Pulling from google-containers/pause +a3ed95caeb02: Pull complete +4964c72cd024: Pull complete +Digest: sha256:a78c2d6208eff9b672de43f880093100050983047b7b0afe0217d3656e1b0d5f +Status: Downloaded newer image for gcr.io/google-containers/pause:latest +gcr.io/google-containers/pause:latest +``` + +## The Registry + +There are two methods for authenticating against a registry: +[token](https://docs.docker.com/registry/spec/auth/token/) and +[oauth2](https://docs.docker.com/registry/spec/auth/oauth/). + +Both methods are used to acquire an opaque `Bearer` token (or +[RegistryToken](https://github.com/docker/cli/blob/ba63a92655c0bea4857b8d6cc4991498858b3c60/cli/config/types/authconfig.go#L21)) +to use in the `Authorization` header. The registry will return a `401 +Unauthorized` during the [version +check](https://github.com/opencontainers/distribution-spec/blob/2c3975d1f03b67c9a0203199038adea0413f0573/spec.md#api-version-check) +(or during normal operations) with +[Www-Authenticate](https://tools.ietf.org/html/rfc7235#section-4.1) challenge +indicating how to proceed. + +### Token + +If we get back an `AuthConfig` containing a [`Username/Password`](https://github.com/docker/cli/blob/ba63a92655c0bea4857b8d6cc4991498858b3c60/cli/config/types/authconfig.go#L5-L6) +or +[`Auth`](https://github.com/docker/cli/blob/ba63a92655c0bea4857b8d6cc4991498858b3c60/cli/config/types/authconfig.go#L7), +we'll use the token method for authentication: + +![basic](../../images/credhelper-basic.svg) + +### OAuth 2 + +If we get back an `AuthConfig` containing an [`IdentityToken`](https://github.com/docker/cli/blob/ba63a92655c0bea4857b8d6cc4991498858b3c60/cli/config/types/authconfig.go#L18) +we'll use the oauth2 method for authentication: + +![oauth](../../images/credhelper-oauth.svg) + +This happens when a credential helper returns a response with the +[`Username`](https://github.com/docker/docker-credential-helpers/blob/f78081d1f7fef6ad74ad6b79368de6348386e591/credentials/credentials.go#L16) +set to `` (no, that's not a placeholder, the literal string `""`). +It is unclear why: [moby/moby#36926](https://github.com/moby/moby/issues/36926). + +We only support the oauth2 `grant_type` for `refresh_token` ([#629](https://github.com/google/go-containerregistry/issues/629)), +since it's impossible to determine from the registry response whether we should +use oauth, and the token method for authentication is widely implemented by +registries. diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/anon.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/anon.go new file mode 100644 index 000000000..83214957d --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/anon.go @@ -0,0 +1,26 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 authn + +// anonymous implements Authenticator for anonymous authentication. +type anonymous struct{} + +// Authorization implements Authenticator. +func (a *anonymous) Authorization() (*AuthConfig, error) { + return &AuthConfig{}, nil +} + +// Anonymous is a singleton Authenticator for providing anonymous auth. +var Anonymous Authenticator = &anonymous{} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/auth.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/auth.go new file mode 100644 index 000000000..0111f1ae7 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/auth.go @@ -0,0 +1,30 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 authn + +// auth is an Authenticator that simply returns the wrapped AuthConfig. +type auth struct { + config AuthConfig +} + +// FromConfig returns an Authenticator that just returns the given AuthConfig. +func FromConfig(cfg AuthConfig) Authenticator { + return &auth{cfg} +} + +// Authorization implements Authenticator. +func (a *auth) Authorization() (*AuthConfig, error) { + return &a.config, nil +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/authn.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/authn.go new file mode 100644 index 000000000..690e81d05 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/authn.go @@ -0,0 +1,36 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 authn + +// AuthConfig contains authorization information for connecting to a Registry +// Inlined what we use from github.com/docker/cli/cli/config/types +type AuthConfig struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Auth string `json:"auth,omitempty"` + + // IdentityToken is used to authenticate the user and get + // an access token for the registry. + IdentityToken string `json:"identitytoken,omitempty"` + + // RegistryToken is a bearer token to be sent to a registry + RegistryToken string `json:"registrytoken,omitempty"` +} + +// Authenticator is used to authenticate Docker transports. +type Authenticator interface { + // Authorization returns the value to use in an http transport's Authorization header. + Authorization() (*AuthConfig, error) +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/basic.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/basic.go new file mode 100644 index 000000000..500cb6616 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/basic.go @@ -0,0 +1,29 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 authn + +// Basic implements Authenticator for basic authentication. +type Basic struct { + Username string + Password string +} + +// Authorization implements Authenticator. +func (b *Basic) Authorization() (*AuthConfig, error) { + return &AuthConfig{ + Username: b.Username, + Password: b.Password, + }, nil +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/bearer.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/bearer.go new file mode 100644 index 000000000..4cf86df92 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/bearer.go @@ -0,0 +1,27 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 authn + +// Bearer implements Authenticator for bearer authentication. +type Bearer struct { + Token string `json:"token"` +} + +// Authorization implements Authenticator. +func (b *Bearer) Authorization() (*AuthConfig, error) { + return &AuthConfig{ + RegistryToken: b.Token, + }, nil +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/doc.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/doc.go new file mode 100644 index 000000000..c2a5fc026 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/doc.go @@ -0,0 +1,17 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 authn defines different methods of authentication for +// talking to a container registry. +package authn diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/keychain.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/keychain.go new file mode 100644 index 000000000..60eebc759 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/keychain.go @@ -0,0 +1,89 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 authn + +import ( + "os" + + "github.com/docker/cli/cli/config" + "github.com/docker/cli/cli/config/types" + "github.com/google/go-containerregistry/pkg/name" +) + +// Resource represents a registry or repository that can be authenticated against. +type Resource interface { + // String returns the full string representation of the target, e.g. + // gcr.io/my-project or just gcr.io. + String() string + + // RegistryStr returns just the registry portion of the target, e.g. for + // gcr.io/my-project, this should just return gcr.io. This is needed to + // pull out an appropriate hostname. + RegistryStr() string +} + +// Keychain is an interface for resolving an image reference to a credential. +type Keychain interface { + // Resolve looks up the most appropriate credential for the specified target. + Resolve(Resource) (Authenticator, error) +} + +// defaultKeychain implements Keychain with the semantics of the standard Docker +// credential keychain. +type defaultKeychain struct{} + +var ( + // DefaultKeychain implements Keychain by interpreting the docker config file. + DefaultKeychain Keychain = &defaultKeychain{} +) + +const ( + // DefaultAuthKey is the key used for dockerhub in config files, which + // is hardcoded for historical reasons. + DefaultAuthKey = "https://" + name.DefaultRegistry + "/v1/" +) + +// Resolve implements Keychain. +func (dk *defaultKeychain) Resolve(target Resource) (Authenticator, error) { + cf, err := config.Load(os.Getenv("DOCKER_CONFIG")) + if err != nil { + return nil, err + } + + // See: + // https://github.com/google/ko/issues/90 + // https://github.com/moby/moby/blob/fc01c2b481097a6057bec3cd1ab2d7b4488c50c4/registry/config.go#L397-L404 + key := target.RegistryStr() + if key == name.DefaultRegistry { + key = DefaultAuthKey + } + + cfg, err := cf.GetAuthConfig(key) + if err != nil { + return nil, err + } + + empty := types.AuthConfig{} + if cfg == empty { + return Anonymous, nil + } + return FromConfig(AuthConfig{ + Username: cfg.Username, + Password: cfg.Password, + Auth: cfg.Auth, + IdentityToken: cfg.IdentityToken, + RegistryToken: cfg.RegistryToken, + }), nil +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/multikeychain.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/multikeychain.go new file mode 100644 index 000000000..3b1804f5d --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/authn/multikeychain.go @@ -0,0 +1,41 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 authn + +type multiKeychain struct { + keychains []Keychain +} + +// Assert that our multi-keychain implements Keychain. +var _ (Keychain) = (*multiKeychain)(nil) + +// NewMultiKeychain composes a list of keychains into one new keychain. +func NewMultiKeychain(kcs ...Keychain) Keychain { + return &multiKeychain{keychains: kcs} +} + +// Resolve implements Keychain. +func (mk *multiKeychain) Resolve(target Resource) (Authenticator, error) { + for _, kc := range mk.keychains { + auth, err := kc.Resolve(target) + if err != nil { + return nil, err + } + if auth != Anonymous { + return auth, nil + } + } + return Anonymous, nil +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/logs/logs.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/logs/logs.go new file mode 100644 index 000000000..5d25d63d6 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/logs/logs.go @@ -0,0 +1,39 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 logs exposes the loggers used by this library. +package logs + +import ( + "io/ioutil" + "log" +) + +var ( + // Warn is used to log non-fatal errors. + Warn = log.New(ioutil.Discard, "", log.LstdFlags) + + // Progress is used to log notable, successful events. + Progress = log.New(ioutil.Discard, "", log.LstdFlags) + + // Debug is used to log information that is useful for debugging. + Debug = log.New(ioutil.Discard, "", log.LstdFlags) +) + +// Enabled checks to see if the logger's writer is set to something other +// than ioutil.Discard. This allows callers to avoid expensive operations +// that will end up in /dev/null anyway. +func Enabled(l *log.Logger) bool { + return l.Writer() != ioutil.Discard +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/README.md b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/README.md new file mode 100644 index 000000000..4889b8446 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/README.md @@ -0,0 +1,3 @@ +# `name` + +[![GoDoc](https://godoc.org/github.com/google/go-containerregistry/pkg/name?status.svg)](https://godoc.org/github.com/google/go-containerregistry/pkg/name) diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/check.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/check.go new file mode 100644 index 000000000..01b03e562 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/check.go @@ -0,0 +1,43 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name + +import ( + "strings" + "unicode/utf8" +) + +// stripRunesFn returns a function which returns -1 (i.e. a value which +// signals deletion in strings.Map) for runes in 'runes', and the rune otherwise. +func stripRunesFn(runes string) func(rune) rune { + return func(r rune) rune { + if strings.ContainsRune(runes, r) { + return -1 + } + return r + } +} + +// checkElement checks a given named element matches character and length restrictions. +// Returns true if the given element adheres to the given restrictions, false otherwise. +func checkElement(name, element, allowedRunes string, minRunes, maxRunes int) error { + numRunes := utf8.RuneCountInString(element) + if (numRunes < minRunes) || (maxRunes < numRunes) { + return NewErrBadName("%s must be between %d and %d runes in length: %s", name, minRunes, maxRunes, element) + } else if len(strings.Map(stripRunesFn(allowedRunes), element)) != 0 { + return NewErrBadName("%s can only contain the runes `%s`: %s", name, allowedRunes, element) + } + return nil +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/digest.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/digest.go new file mode 100644 index 000000000..120dd216a --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/digest.go @@ -0,0 +1,96 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name + +import ( + "strings" +) + +const ( + // These have the form: sha256: + // TODO(dekkagaijin): replace with opencontainers/go-digest or docker/distribution's validation. + digestChars = "sh:0123456789abcdef" + digestDelim = "@" +) + +// Digest stores a digest name in a structured form. +type Digest struct { + Repository + digest string + original string +} + +// Ensure Digest implements Reference +var _ Reference = (*Digest)(nil) + +// Context implements Reference. +func (d Digest) Context() Repository { + return d.Repository +} + +// Identifier implements Reference. +func (d Digest) Identifier() string { + return d.DigestStr() +} + +// DigestStr returns the digest component of the Digest. +func (d Digest) DigestStr() string { + return d.digest +} + +// Name returns the name from which the Digest was derived. +func (d Digest) Name() string { + return d.Repository.Name() + digestDelim + d.DigestStr() +} + +// String returns the original input string. +func (d Digest) String() string { + return d.original +} + +func checkDigest(name string) error { + return checkElement("digest", name, digestChars, 7+64, 7+64) +} + +// NewDigest returns a new Digest representing the given name. +func NewDigest(name string, opts ...Option) (Digest, error) { + // Split on "@" + parts := strings.Split(name, digestDelim) + if len(parts) != 2 { + return Digest{}, NewErrBadName("a digest must contain exactly one '@' separator (e.g. registry/repository@digest) saw: %s", name) + } + base := parts[0] + digest := parts[1] + + // Always check that the digest is valid. + if err := checkDigest(digest); err != nil { + return Digest{}, err + } + + tag, err := NewTag(base, opts...) + if err == nil { + base = tag.Repository.Name() + } + + repo, err := NewRepository(base, opts...) + if err != nil { + return Digest{}, err + } + return Digest{ + Repository: repo, + digest: digest, + original: name, + }, nil +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/doc.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/doc.go new file mode 100644 index 000000000..b294794dc --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/doc.go @@ -0,0 +1,42 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name defines structured types for representing image references. +// +// What's in a name? For image references, not nearly enough! +// +// Image references look a lot like URLs, but they differ in that they don't +// contain the scheme (http or https), they can end with a :tag or a @digest +// (the latter being validated), and they perform defaulting for missing +// components. +// +// Since image references don't contain the scheme, we do our best to infer +// if we use http or https from the given hostname. We allow http fallback for +// any host that looks like localhost (localhost, 127.0.0.1, ::1), ends in +// ".local", or is in the "private" address space per RFC 1918. For everything +// else, we assume https only. To override this heuristic, use the Insecure +// option. +// +// Image references with a digest signal to us that we should verify the content +// of the image matches the digest. E.g. when pulling a Digest reference, we'll +// calculate the sha256 of the manifest returned by the registry and error out +// if it doesn't match what we asked for. +// +// For defaulting, we interpret "ubuntu" as +// "index.docker.io/library/ubuntu:latest" because we add the missing repo +// "library", the missing registry "index.docker.io", and the missing tag +// "latest". To disable this defaulting, use the StrictValidation option. This +// is useful e.g. to only allow image references that explicitly set a tag or +// digest, so that you don't accidentally pull "latest". +package name diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/errors.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/errors.go new file mode 100644 index 000000000..7847cc5d1 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/errors.go @@ -0,0 +1,37 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name + +import "fmt" + +// ErrBadName is an error for when a bad docker name is supplied. +type ErrBadName struct { + info string +} + +func (e *ErrBadName) Error() string { + return e.info +} + +// NewErrBadName returns a ErrBadName which returns the given formatted string from Error(). +func NewErrBadName(fmtStr string, args ...interface{}) *ErrBadName { + return &ErrBadName{fmt.Sprintf(fmtStr, args...)} +} + +// IsErrBadName returns true if the given error is an ErrBadName. +func IsErrBadName(err error) bool { + _, ok := err.(*ErrBadName) + return ok +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/options.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/options.go new file mode 100644 index 000000000..d14fedcda --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/options.go @@ -0,0 +1,83 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name + +const ( + // DefaultRegistry is the registry name that will be used if no registry + // provided and the default is not overridden. + DefaultRegistry = "index.docker.io" + defaultRegistryAlias = "docker.io" + + // DefaultTag is the tag name that will be used if no tag provided and the + // default is not overridden. + DefaultTag = "latest" +) + +type options struct { + strict bool // weak by default + insecure bool // secure by default + defaultRegistry string + defaultTag string +} + +func makeOptions(opts ...Option) options { + opt := options{ + defaultRegistry: DefaultRegistry, + defaultTag: DefaultTag, + } + for _, o := range opts { + o(&opt) + } + return opt +} + +// Option is a functional option for name parsing. +type Option func(*options) + +// StrictValidation is an Option that requires image references to be fully +// specified; i.e. no defaulting for registry (dockerhub), repo (library), +// or tag (latest). +func StrictValidation(opts *options) { + opts.strict = true +} + +// WeakValidation is an Option that sets defaults when parsing names, see +// StrictValidation. +func WeakValidation(opts *options) { + opts.strict = false +} + +// Insecure is an Option that allows image references to be fetched without TLS. +func Insecure(opts *options) { + opts.insecure = true +} + +// OptionFn is a function that returns an option. +type OptionFn func() Option + +// WithDefaultRegistry sets the default registry that will be used if one is not +// provided. +func WithDefaultRegistry(r string) Option { + return func(opts *options) { + opts.defaultRegistry = r + } +} + +// WithDefaultTag sets the default tag that will be used if one is not provided. +func WithDefaultTag(t string) Option { + return func(opts *options) { + opts.defaultTag = t + } +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/ref.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/ref.go new file mode 100644 index 000000000..e5180b3d0 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/ref.go @@ -0,0 +1,76 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name + +import ( + "fmt" +) + +// Reference defines the interface that consumers use when they can +// take either a tag or a digest. +type Reference interface { + fmt.Stringer + + // Context accesses the Repository context of the reference. + Context() Repository + + // Identifier accesses the type-specific portion of the reference. + Identifier() string + + // Name is the fully-qualified reference name. + Name() string + + // Scope is the scope needed to access this reference. + Scope(string) string +} + +// ParseReference parses the string as a reference, either by tag or digest. +func ParseReference(s string, opts ...Option) (Reference, error) { + if t, err := NewTag(s, opts...); err == nil { + return t, nil + } + if d, err := NewDigest(s, opts...); err == nil { + return d, nil + } + return nil, NewErrBadName("could not parse reference: " + s) + +} + +type stringConst string + +// MustParseReference behaves like ParseReference, but panics instead of +// returning an error. It's intended for use in tests, or when a value is +// expected to be valid at code authoring time. +// +// To discourage its use in scenarios where the value is not known at code +// authoring time, it must be passed a string constant: +// +// const str = "valid/string" +// MustParseReference(str) +// MustParseReference("another/valid/string") +// MustParseReference(str + "/and/more") +// +// These will not compile: +// +// var str = "valid/string" +// MustParseReference(str) +// MustParseReference(strings.Join([]string{"valid", "string"}, "/")) +func MustParseReference(s stringConst, opts ...Option) Reference { + ref, err := ParseReference(string(s), opts...) + if err != nil { + panic(err) + } + return ref +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/registry.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/registry.go new file mode 100644 index 000000000..d4da7409e --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/registry.go @@ -0,0 +1,136 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name + +import ( + "net" + "net/url" + "regexp" + "strings" +) + +// Detect more complex forms of local references. +var reLocal = regexp.MustCompile(`.*\.local(?:host)?(?::\d{1,5})?$`) + +// Detect the loopback IP (127.0.0.1) +var reLoopback = regexp.MustCompile(regexp.QuoteMeta("127.0.0.1")) + +// Detect the loopback IPV6 (::1) +var reipv6Loopback = regexp.MustCompile(regexp.QuoteMeta("::1")) + +// Registry stores a docker registry name in a structured form. +type Registry struct { + insecure bool + registry string +} + +// RegistryStr returns the registry component of the Registry. +func (r Registry) RegistryStr() string { + return r.registry +} + +// Name returns the name from which the Registry was derived. +func (r Registry) Name() string { + return r.RegistryStr() +} + +func (r Registry) String() string { + return r.Name() +} + +// Scope returns the scope required to access the registry. +func (r Registry) Scope(string) string { + // The only resource under 'registry' is 'catalog'. http://goo.gl/N9cN9Z + return "registry:catalog:*" +} + +func (r Registry) isRFC1918() bool { + ipStr := strings.Split(r.Name(), ":")[0] + ip := net.ParseIP(ipStr) + if ip == nil { + return false + } + for _, cidr := range []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"} { + _, block, _ := net.ParseCIDR(cidr) + if block.Contains(ip) { + return true + } + } + return false +} + +// Scheme returns https scheme for all the endpoints except localhost or when explicitly defined. +func (r Registry) Scheme() string { + if r.insecure { + return "http" + } + if r.isRFC1918() { + return "http" + } + if strings.HasPrefix(r.Name(), "localhost:") { + return "http" + } + if reLocal.MatchString(r.Name()) { + return "http" + } + if reLoopback.MatchString(r.Name()) { + return "http" + } + if reipv6Loopback.MatchString(r.Name()) { + return "http" + } + return "https" +} + +func checkRegistry(name string) error { + // Per RFC 3986, registries (authorities) are required to be prefixed with "//" + // url.Host == hostname[:port] == authority + if url, err := url.Parse("//" + name); err != nil || url.Host != name { + return NewErrBadName("registries must be valid RFC 3986 URI authorities: %s", name) + } + return nil +} + +// NewRegistry returns a Registry based on the given name. +// Strict validation requires explicit, valid RFC 3986 URI authorities to be given. +func NewRegistry(name string, opts ...Option) (Registry, error) { + opt := makeOptions(opts...) + if opt.strict && len(name) == 0 { + return Registry{}, NewErrBadName("strict validation requires the registry to be explicitly defined") + } + + if err := checkRegistry(name); err != nil { + return Registry{}, err + } + + if name == "" { + name = opt.defaultRegistry + } + // Rewrite "docker.io" to "index.docker.io". + // See: https://github.com/google/go-containerregistry/issues/68 + if name == defaultRegistryAlias { + name = DefaultRegistry + } + + return Registry{registry: name, insecure: opt.insecure}, nil +} + +// NewInsecureRegistry returns an Insecure Registry based on the given name. +// +// Deprecated: Use the Insecure Option with NewRegistry instead. +func NewInsecureRegistry(name string, opts ...Option) (Registry, error) { + opts = append(opts, Insecure) + return NewRegistry(name, opts...) +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/repository.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/repository.go new file mode 100644 index 000000000..54367a15c --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/repository.go @@ -0,0 +1,121 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name + +import ( + "fmt" + "strings" +) + +const ( + defaultNamespace = "library" + repositoryChars = "abcdefghijklmnopqrstuvwxyz0123456789_-./" + regRepoDelimiter = "/" +) + +// Repository stores a docker repository name in a structured form. +type Repository struct { + Registry + repository string +} + +// See https://docs.docker.com/docker-hub/official_repos +func hasImplicitNamespace(repo string, reg Registry) bool { + return !strings.ContainsRune(repo, '/') && reg.RegistryStr() == DefaultRegistry +} + +// RepositoryStr returns the repository component of the Repository. +func (r Repository) RepositoryStr() string { + if hasImplicitNamespace(r.repository, r.Registry) { + return fmt.Sprintf("%s/%s", defaultNamespace, r.repository) + } + return r.repository +} + +// Name returns the name from which the Repository was derived. +func (r Repository) Name() string { + regName := r.Registry.Name() + if regName != "" { + return regName + regRepoDelimiter + r.RepositoryStr() + } + // TODO: As far as I can tell, this is unreachable. + return r.RepositoryStr() +} + +func (r Repository) String() string { + return r.Name() +} + +// Scope returns the scope required to perform the given action on the registry. +// TODO(jonjohnsonjr): consider moving scopes to a separate package. +func (r Repository) Scope(action string) string { + return fmt.Sprintf("repository:%s:%s", r.RepositoryStr(), action) +} + +func checkRepository(repository string) error { + return checkElement("repository", repository, repositoryChars, 2, 255) +} + +// NewRepository returns a new Repository representing the given name, according to the given strictness. +func NewRepository(name string, opts ...Option) (Repository, error) { + opt := makeOptions(opts...) + if len(name) == 0 { + return Repository{}, NewErrBadName("a repository name must be specified") + } + + var registry string + repo := name + parts := strings.SplitN(name, regRepoDelimiter, 2) + if len(parts) == 2 && (strings.ContainsRune(parts[0], '.') || strings.ContainsRune(parts[0], ':')) { + // The first part of the repository is treated as the registry domain + // iff it contains a '.' or ':' character, otherwise it is all repository + // and the domain defaults to Docker Hub. + registry = parts[0] + repo = parts[1] + } + + if err := checkRepository(repo); err != nil { + return Repository{}, err + } + + reg, err := NewRegistry(registry, opts...) + if err != nil { + return Repository{}, err + } + if hasImplicitNamespace(repo, reg) && opt.strict { + return Repository{}, NewErrBadName("strict validation requires the full repository path (missing 'library')") + } + return Repository{reg, repo}, nil +} + +// Tag returns a Tag in this Repository. +func (r Repository) Tag(identifier string) Tag { + t := Tag{ + tag: identifier, + Repository: r, + } + t.original = t.Name() + return t +} + +// Digest returns a Digest in this Repository. +func (r Repository) Digest(identifier string) Digest { + d := Digest{ + digest: identifier, + Repository: r, + } + d.original = d.Name() + return d +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/tag.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/tag.go new file mode 100644 index 000000000..66bd1bec3 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/name/tag.go @@ -0,0 +1,108 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 name + +import ( + "strings" +) + +const ( + // TODO(dekkagaijin): use the docker/distribution regexes for validation. + tagChars = "abcdefghijklmnopqrstuvwxyz0123456789_-.ABCDEFGHIJKLMNOPQRSTUVWXYZ" + tagDelim = ":" +) + +// Tag stores a docker tag name in a structured form. +type Tag struct { + Repository + tag string + original string +} + +// Ensure Tag implements Reference +var _ Reference = (*Tag)(nil) + +// Context implements Reference. +func (t Tag) Context() Repository { + return t.Repository +} + +// Identifier implements Reference. +func (t Tag) Identifier() string { + return t.TagStr() +} + +// TagStr returns the tag component of the Tag. +func (t Tag) TagStr() string { + return t.tag +} + +// Name returns the name from which the Tag was derived. +func (t Tag) Name() string { + return t.Repository.Name() + tagDelim + t.TagStr() +} + +// String returns the original input string. +func (t Tag) String() string { + return t.original +} + +// Scope returns the scope required to perform the given action on the tag. +func (t Tag) Scope(action string) string { + return t.Repository.Scope(action) +} + +func checkTag(name string) error { + return checkElement("tag", name, tagChars, 1, 128) +} + +// NewTag returns a new Tag representing the given name, according to the given strictness. +func NewTag(name string, opts ...Option) (Tag, error) { + opt := makeOptions(opts...) + base := name + tag := "" + + // Split on ":" + parts := strings.Split(name, tagDelim) + // Verify that we aren't confusing a tag for a hostname w/ port for the purposes of weak validation. + if len(parts) > 1 && !strings.Contains(parts[len(parts)-1], regRepoDelimiter) { + base = strings.Join(parts[:len(parts)-1], tagDelim) + tag = parts[len(parts)-1] + } + + // We don't require a tag, but if we get one check it's valid, + // even when not being strict. + // If we are being strict, we want to validate the tag regardless in case + // it's empty. + if tag != "" || opt.strict { + if err := checkTag(tag); err != nil { + return Tag{}, err + } + } + + if tag == "" { + tag = opt.defaultTag + } + + repo, err := NewRepository(base, opts...) + if err != nil { + return Tag{}, err + } + return Tag{ + Repository: repo, + tag: tag, + original: name, + }, nil +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/README.md b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/README.md new file mode 100644 index 000000000..bd4d957b0 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/README.md @@ -0,0 +1,129 @@ +# `transport` + +[![GoDoc](https://godoc.org/github.com/google/go-containerregistry/pkg/v1/transport?status.svg)](https://godoc.org/github.com/google/go-containerregistry/pkg/v1/transport) + +The [distribution protocol](https://github.com/opencontainers/distribution-spec) is fairly simple, but correctly [implementing authentication](../../../authn/README.md) is **hard**. + +This package [implements](https://godoc.org/github.com/google/go-containerregistry/pkg/v1/remote/transport#New) an [`http.RoundTripper`](https://godoc.org/net/http#RoundTripper) +that transparently performs: +* [Token +Authentication](https://docs.docker.com/registry/spec/auth/token/) and +* [OAuth2 +Authentication](https://docs.docker.com/registry/spec/auth/oauth/) + +for registry clients. + +## Raison d'être + +> Why not just use the [`docker/distribution`](https://godoc.org/github.com/docker/distribution/registry/client/auth) client? + +Great question! Mostly, because I don't want to depend on [`prometheus/client_golang`](https://github.com/prometheus/client_golang). + +As a performance optimization, that client uses [a cache](https://github.com/docker/distribution/blob/a8371794149d1d95f1e846744b05c87f2f825e5a/registry/client/repository.go#L173) to keep track of a mapping between blob digests and their [descriptors](https://github.com/docker/distribution/blob/a8371794149d1d95f1e846744b05c87f2f825e5a/blobs.go#L57-L86). Unfortunately, the cache [uses prometheus](https://github.com/docker/distribution/blob/a8371794149d1d95f1e846744b05c87f2f825e5a/registry/storage/cache/cachedblobdescriptorstore.go#L44) to track hits and misses, so if you want to use that client you have to pull in all of prometheus, which is pretty large. + +![docker/distribution](../../../../images/docker.dot.svg) + +> Why does it matter if you depend on prometheus? Who cares? + +It's generally polite to your downstream to reduce the number of dependencies your package requires: + +* Downloading your package is faster, which helps our Australian friends and people on airplanes. +* There is less code to compile, which speeds up builds and saves the planet from global warming. +* You reduce the likelihood of inflicting dependency hell upon your consumers. +* [Tim Hockin](https://twitter.com/thockin/status/958606077456654336) prefers it based on his experience working on Kubernetes, and he's a pretty smart guy. + +> Okay, what about [`containerd/containerd`](https://godoc.org/github.com/containerd/containerd/remotes/docker)? + +Similar reasons! That ends up pulling in grpc, protobuf, and logrus. + +![containerd/containerd](../../../../images/containerd.dot.svg) + +> Well... what about [`containers/image`](https://godoc.org/github.com/containers/image/docker)? + +That just uses the the `docker/distribution` client... and more! + +![containers/image](../../../../images/containers.dot.svg) + +> Wow, what about this package? + +Of course, this package isn't perfect either. `transport` depends on `authn`, +which in turn depends on docker's config file parsing and handling package, +which you don't strictly need but almost certainly want if you're going to be +interacting with a registry. + +![google/go-containerregistry](../../../../images/ggcr.dot.svg) + +*These graphs were generated by +[`kisielk/godepgraph`](https://github.com/kisielk/godepgraph).* + +## Usage + +This is heavily used by the +[`remote`](https://godoc.org/github.com/google/go-containerregistry/pkg/v1/remote) +package, which implements higher level image-centric functionality, but this +package is useful if you want to interact directly with the registry to do +something that `remote` doesn't support, e.g. [to handle with schema 1 +images](https://github.com/google/go-containerregistry/pull/509). + +This package also includes some [error +handling](https://github.com/opencontainers/distribution-spec/blob/60be706c34ee7805bdd1d3d11affec53b0dfb8fb/spec.md#errors) +facilities in the form of +[`CheckError`](https://godoc.org/github.com/google/go-containerregistry/pkg/v1/remote/transport#CheckError), +which will parse the response body into a structured error for unexpected http +status codes. + +Here's a "simple" program that writes the result of +[listing tags](https://github.com/opencontainers/distribution-spec/blob/60be706c34ee7805bdd1d3d11affec53b0dfb8fb/spec.md#tags) +for [`gcr.io/google-containers/pause`](https://gcr.io/google-containers/pause) +to stdout. + +```go +package main + +import ( + "io" + "net/http" + "os" + + "github.com/google/go-containerregistry/pkg/authn" + "github.com/google/go-containerregistry/pkg/name" + "github.com/google/go-containerregistry/pkg/v1/remote/transport" +) + +func main() { + repo, err := name.NewRepository("gcr.io/google-containers/pause") + if err != nil { + panic(err) + } + + // Fetch credentials based on your docker config file, which is $HOME/.docker/config.json or $DOCKER_CONFIG. + auth, err := authn.DefaultKeychain.Resolve(repo.Registry) + if err != nil { + panic(err) + } + + // Construct an http.Client that is authorized to pull from gcr.io/google-containers/pause. + scopes := []string{repo.Scope(transport.PullScope)} + t, err := transport.New(repo.Registry, auth, http.DefaultTransport, scopes) + if err != nil { + panic(err) + } + client := &http.Client{Transport: t} + + // Make the actual request. + resp, err := client.Get("https://gcr.io/v2/google-containers/pause/tags/list") + if err != nil { + panic(err) + } + + // Assert that we get a 200, otherwise attempt to parse body as a structured error. + if err := transport.CheckError(resp, http.StatusOK); err != nil { + panic(err) + } + + // Write the response to stdout. + if _, err := io.Copy(os.Stdout, resp.Body); err != nil { + panic(err) + } +} +``` diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/basic.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/basic.go new file mode 100644 index 000000000..fdb362b76 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/basic.go @@ -0,0 +1,62 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "encoding/base64" + "fmt" + "net/http" + + "github.com/google/go-containerregistry/pkg/authn" +) + +type basicTransport struct { + inner http.RoundTripper + auth authn.Authenticator + target string +} + +var _ http.RoundTripper = (*basicTransport)(nil) + +// RoundTrip implements http.RoundTripper +func (bt *basicTransport) RoundTrip(in *http.Request) (*http.Response, error) { + if bt.auth != authn.Anonymous { + auth, err := bt.auth.Authorization() + if err != nil { + return nil, err + } + + // http.Client handles redirects at a layer above the http.RoundTripper + // abstraction, so to avoid forwarding Authorization headers to places + // we are redirected, only set it when the authorization header matches + // the host with which we are interacting. + // In case of redirect http.Client can use an empty Host, check URL too. + if in.Host == bt.target || in.URL.Host == bt.target { + if bearer := auth.RegistryToken; bearer != "" { + hdr := fmt.Sprintf("Bearer %s", bearer) + in.Header.Set("Authorization", hdr) + } else if user, pass := auth.Username, auth.Password; user != "" && pass != "" { + delimited := fmt.Sprintf("%s:%s", user, pass) + encoded := base64.StdEncoding.EncodeToString([]byte(delimited)) + hdr := fmt.Sprintf("Basic %s", encoded) + in.Header.Set("Authorization", hdr) + } else if token := auth.Auth; token != "" { + hdr := fmt.Sprintf("Basic %s", token) + in.Header.Set("Authorization", hdr) + } + } + } + return bt.inner.RoundTrip(in) +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/bearer.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/bearer.go new file mode 100644 index 000000000..49941bd89 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/bearer.go @@ -0,0 +1,311 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net" + "net/http" + "net/url" + "strings" + + authchallenge "github.com/docker/distribution/registry/client/auth/challenge" + "github.com/google/go-containerregistry/internal/redact" + "github.com/google/go-containerregistry/pkg/authn" + "github.com/google/go-containerregistry/pkg/logs" + "github.com/google/go-containerregistry/pkg/name" +) + +type bearerTransport struct { + // Wrapped by bearerTransport. + inner http.RoundTripper + // Basic credentials that we exchange for bearer tokens. + basic authn.Authenticator + // Holds the bearer response from the token service. + bearer authn.AuthConfig + // Registry to which we send bearer tokens. + registry name.Registry + // See https://tools.ietf.org/html/rfc6750#section-3 + realm string + // See https://docs.docker.com/registry/spec/auth/token/ + service string + scopes []string + // Scheme we should use, determined by ping response. + scheme string +} + +var _ http.RoundTripper = (*bearerTransport)(nil) + +var portMap = map[string]string{ + "http": "80", + "https": "443", +} + +func stringSet(ss []string) map[string]struct{} { + set := make(map[string]struct{}) + for _, s := range ss { + set[s] = struct{}{} + } + return set +} + +// RoundTrip implements http.RoundTripper +func (bt *bearerTransport) RoundTrip(in *http.Request) (*http.Response, error) { + sendRequest := func() (*http.Response, error) { + // http.Client handles redirects at a layer above the http.RoundTripper + // abstraction, so to avoid forwarding Authorization headers to places + // we are redirected, only set it when the authorization header matches + // the registry with which we are interacting. + // In case of redirect http.Client can use an empty Host, check URL too. + if matchesHost(bt.registry, in, bt.scheme) { + hdr := fmt.Sprintf("Bearer %s", bt.bearer.RegistryToken) + in.Header.Set("Authorization", hdr) + } + return bt.inner.RoundTrip(in) + } + + res, err := sendRequest() + if err != nil { + return nil, err + } + + // If we hit a WWW-Authenticate challenge, it might be due to expired tokens or insufficient scope. + if challenges := authchallenge.ResponseChallenges(res); len(challenges) != 0 { + for _, wac := range challenges { + // TODO(jonjohnsonjr): Should we also update "realm" or "service"? + if scope, ok := wac.Parameters["scope"]; ok { + // From https://tools.ietf.org/html/rfc6750#section-3 + // The "scope" attribute is defined in Section 3.3 of [RFC6749]. The + // "scope" attribute is a space-delimited list of case-sensitive scope + // values indicating the required scope of the access token for + // accessing the requested resource. + scopes := strings.Split(scope, " ") + + // Add any scopes that we don't already request. + got := stringSet(bt.scopes) + for _, want := range scopes { + if _, ok := got[want]; !ok { + bt.scopes = append(bt.scopes, want) + } + } + } + } + + // TODO(jonjohnsonjr): Teach transport.Error about "error" and "error_description" from challenge. + + // Retry the request to attempt to get a valid token. + if err = bt.refresh(in.Context()); err != nil { + return nil, err + } + return sendRequest() + } + + return res, err +} + +// It's unclear which authentication flow to use based purely on the protocol, +// so we rely on heuristics and fallbacks to support as many registries as possible. +// The basic token exchange is attempted first, falling back to the oauth flow. +// If the IdentityToken is set, this indicates that we should start with the oauth flow. +func (bt *bearerTransport) refresh(ctx context.Context) error { + auth, err := bt.basic.Authorization() + if err != nil { + return err + } + + if auth.RegistryToken != "" { + bt.bearer.RegistryToken = auth.RegistryToken + return nil + } + + var content []byte + if auth.IdentityToken != "" { + // If the secret being stored is an identity token, + // the Username should be set to , which indicates + // we are using an oauth flow. + content, err = bt.refreshOauth(ctx) + if terr, ok := err.(*Error); ok && terr.StatusCode == http.StatusNotFound { + // Note: Not all token servers implement oauth2. + // If the request to the endpoint returns 404 using the HTTP POST method, + // refer to Token Documentation for using the HTTP GET method supported by all token servers. + content, err = bt.refreshBasic(ctx) + } + } else { + content, err = bt.refreshBasic(ctx) + } + if err != nil { + return err + } + + // Some registries don't have "token" in the response. See #54. + type tokenResponse struct { + Token string `json:"token"` + AccessToken string `json:"access_token"` + RefreshToken string `json:"refresh_token"` + // TODO: handle expiry? + } + + var response tokenResponse + if err := json.Unmarshal(content, &response); err != nil { + return err + } + + // Some registries set access_token instead of token. + if response.AccessToken != "" { + response.Token = response.AccessToken + } + + // Find a token to turn into a Bearer authenticator + if response.Token != "" { + bt.bearer.RegistryToken = response.Token + } else { + return fmt.Errorf("no token in bearer response:\n%s", content) + } + + // If we obtained a refresh token from the oauth flow, use that for refresh() now. + if response.RefreshToken != "" { + bt.basic = authn.FromConfig(authn.AuthConfig{ + IdentityToken: response.RefreshToken, + }) + } + + return nil +} + +func matchesHost(reg name.Registry, in *http.Request, scheme string) bool { + canonicalHeaderHost := canonicalAddress(in.Host, scheme) + canonicalURLHost := canonicalAddress(in.URL.Host, scheme) + canonicalRegistryHost := canonicalAddress(reg.RegistryStr(), scheme) + return canonicalHeaderHost == canonicalRegistryHost || canonicalURLHost == canonicalRegistryHost +} + +func canonicalAddress(host, scheme string) (address string) { + // The host may be any one of: + // - hostname + // - hostname:port + // - ipv4 + // - ipv4:port + // - ipv6 + // - [ipv6]:port + // As net.SplitHostPort returns an error if the host does not contain a port, we should only attempt + // to call it when we know that the address contains a port + if strings.Count(host, ":") == 1 || (strings.Count(host, ":") >= 2 && strings.Contains(host, "]:")) { + hostname, port, err := net.SplitHostPort(host) + if err != nil { + return host + } + if port == "" { + port = portMap[scheme] + } + + return net.JoinHostPort(hostname, port) + } + + return net.JoinHostPort(host, portMap[scheme]) +} + +// https://docs.docker.com/registry/spec/auth/oauth/ +func (bt *bearerTransport) refreshOauth(ctx context.Context) ([]byte, error) { + auth, err := bt.basic.Authorization() + if err != nil { + return nil, err + } + + u, err := url.Parse(bt.realm) + if err != nil { + return nil, err + } + + v := url.Values{} + v.Set("scope", strings.Join(bt.scopes, " ")) + v.Set("service", bt.service) + v.Set("client_id", defaultUserAgent) + if auth.IdentityToken != "" { + v.Set("grant_type", "refresh_token") + v.Set("refresh_token", auth.IdentityToken) + } else if auth.Username != "" && auth.Password != "" { + // TODO(#629): This is unreachable. + v.Set("grant_type", "password") + v.Set("username", auth.Username) + v.Set("password", auth.Password) + v.Set("access_type", "offline") + } + + client := http.Client{Transport: bt.inner} + req, err := http.NewRequest(http.MethodPost, u.String(), strings.NewReader(v.Encode())) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + + // We don't want to log credentials. + ctx = redact.NewContext(ctx, "oauth token response contains credentials") + + resp, err := client.Do(req.WithContext(ctx)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + if err := CheckError(resp, http.StatusOK); err != nil { + logs.Warn.Printf("No matching credentials were found for %q", bt.registry) + return nil, err + } + + return ioutil.ReadAll(resp.Body) +} + +// https://docs.docker.com/registry/spec/auth/token/ +func (bt *bearerTransport) refreshBasic(ctx context.Context) ([]byte, error) { + u, err := url.Parse(bt.realm) + if err != nil { + return nil, err + } + b := &basicTransport{ + inner: bt.inner, + auth: bt.basic, + target: u.Host, + } + client := http.Client{Transport: b} + + v := u.Query() + v["scope"] = bt.scopes + v.Set("service", bt.service) + u.RawQuery = v.Encode() + + req, err := http.NewRequest(http.MethodGet, u.String(), nil) + if err != nil { + return nil, err + } + + // We don't want to log credentials. + ctx = redact.NewContext(ctx, "basic token response contains credentials") + + resp, err := client.Do(req.WithContext(ctx)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + if err := CheckError(resp, http.StatusOK); err != nil { + logs.Warn.Printf("No matching credentials were found for %q", bt.registry) + return nil, err + } + + return ioutil.ReadAll(resp.Body) +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/doc.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/doc.go new file mode 100644 index 000000000..ff7025b5c --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 transport provides facilities for setting up an authenticated +// http.RoundTripper given an Authenticator and base RoundTripper. See +// transport.New for more information. +package transport diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/error.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/error.go new file mode 100644 index 000000000..bb59d22e4 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/error.go @@ -0,0 +1,197 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// The set of query string keys that we expect to send as part of the registry +// protocol. Anything else is potentially dangerous to leak, as it's probably +// from a redirect. These redirects often included tokens or signed URLs. +var paramAllowlist = map[string]struct{}{ + // Token exchange + "scope": {}, + "service": {}, + // Cross-repo mounting + "mount": {}, + "from": {}, + // Layer PUT + "digest": {}, + // Listing tags and catalog + "n": {}, + "last": {}, +} + +// Error implements error to support the following error specification: +// https://github.com/docker/distribution/blob/master/docs/spec/api.md#errors +type Error struct { + Errors []Diagnostic `json:"errors,omitempty"` + // The http status code returned. + StatusCode int + // The raw body if we couldn't understand it. + rawBody string + // The request that failed. + request *http.Request +} + +// Check that Error implements error +var _ error = (*Error)(nil) + +// Error implements error +func (e *Error) Error() string { + prefix := "" + if e.request != nil { + prefix = fmt.Sprintf("%s %s: ", e.request.Method, redactURL(e.request.URL)) + } + return prefix + e.responseErr() +} + +func (e *Error) responseErr() string { + switch len(e.Errors) { + case 0: + if len(e.rawBody) == 0 { + if e.request != nil && e.request.Method == http.MethodHead { + return fmt.Sprintf("unexpected status code %d %s (HEAD responses have no body, use GET for details)", e.StatusCode, http.StatusText(e.StatusCode)) + } + return fmt.Sprintf("unexpected status code %d %s", e.StatusCode, http.StatusText(e.StatusCode)) + } + return fmt.Sprintf("unexpected status code %d %s: %s", e.StatusCode, http.StatusText(e.StatusCode), e.rawBody) + case 1: + return e.Errors[0].String() + default: + var errors []string + for _, d := range e.Errors { + errors = append(errors, d.String()) + } + return fmt.Sprintf("multiple errors returned: %s", + strings.Join(errors, "; ")) + } +} + +// Temporary returns whether the request that preceded the error is temporary. +func (e *Error) Temporary() bool { + if len(e.Errors) == 0 { + _, ok := temporaryStatusCodes[e.StatusCode] + return ok + } + for _, d := range e.Errors { + if _, ok := temporaryErrorCodes[d.Code]; !ok { + return false + } + } + return true +} + +// TODO(jonjohnsonjr): Consider moving to internal/redact. +func redactURL(original *url.URL) *url.URL { + qs := original.Query() + for k, v := range qs { + for i := range v { + if _, ok := paramAllowlist[k]; !ok { + // key is not in the Allowlist + v[i] = "REDACTED" + } + } + } + redacted := *original + redacted.RawQuery = qs.Encode() + return &redacted +} + +// Diagnostic represents a single error returned by a Docker registry interaction. +type Diagnostic struct { + Code ErrorCode `json:"code"` + Message string `json:"message,omitempty"` + Detail interface{} `json:"detail,omitempty"` +} + +// String stringifies the Diagnostic in the form: $Code: $Message[; $Detail] +func (d Diagnostic) String() string { + msg := fmt.Sprintf("%s: %s", d.Code, d.Message) + if d.Detail != nil { + msg = fmt.Sprintf("%s; %v", msg, d.Detail) + } + return msg +} + +// ErrorCode is an enumeration of supported error codes. +type ErrorCode string + +// The set of error conditions a registry may return: +// https://github.com/docker/distribution/blob/master/docs/spec/api.md#errors-2 +const ( + BlobUnknownErrorCode ErrorCode = "BLOB_UNKNOWN" + BlobUploadInvalidErrorCode ErrorCode = "BLOB_UPLOAD_INVALID" + BlobUploadUnknownErrorCode ErrorCode = "BLOB_UPLOAD_UNKNOWN" + DigestInvalidErrorCode ErrorCode = "DIGEST_INVALID" + ManifestBlobUnknownErrorCode ErrorCode = "MANIFEST_BLOB_UNKNOWN" + ManifestInvalidErrorCode ErrorCode = "MANIFEST_INVALID" + ManifestUnknownErrorCode ErrorCode = "MANIFEST_UNKNOWN" + ManifestUnverifiedErrorCode ErrorCode = "MANIFEST_UNVERIFIED" + NameInvalidErrorCode ErrorCode = "NAME_INVALID" + NameUnknownErrorCode ErrorCode = "NAME_UNKNOWN" + SizeInvalidErrorCode ErrorCode = "SIZE_INVALID" + TagInvalidErrorCode ErrorCode = "TAG_INVALID" + UnauthorizedErrorCode ErrorCode = "UNAUTHORIZED" + DeniedErrorCode ErrorCode = "DENIED" + UnsupportedErrorCode ErrorCode = "UNSUPPORTED" + TooManyRequestsErrorCode ErrorCode = "TOOMANYREQUESTS" +) + +// TODO: Include other error types. +var temporaryErrorCodes = map[ErrorCode]struct{}{ + BlobUploadInvalidErrorCode: {}, + TooManyRequestsErrorCode: {}, +} + +var temporaryStatusCodes = map[int]struct{}{ + http.StatusRequestTimeout: {}, + http.StatusInternalServerError: {}, + http.StatusBadGateway: {}, + http.StatusServiceUnavailable: {}, +} + +// CheckError returns a structured error if the response status is not in codes. +func CheckError(resp *http.Response, codes ...int) error { + for _, code := range codes { + if resp.StatusCode == code { + // This is one of the supported status codes. + return nil + } + } + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + + // https://github.com/docker/distribution/blob/master/docs/spec/api.md#errors + structuredError := &Error{} + + // This can fail if e.g. the response body is not valid JSON. That's fine, + // we'll construct an appropriate error string from the body and status code. + _ = json.Unmarshal(b, structuredError) + + structuredError.rawBody = string(b) + structuredError.StatusCode = resp.StatusCode + structuredError.request = resp.Request + + return structuredError +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/logger.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/logger.go new file mode 100644 index 000000000..c341f844e --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/logger.go @@ -0,0 +1,91 @@ +// Copyright 2020 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "fmt" + "net/http" + "net/http/httputil" + "time" + + "github.com/google/go-containerregistry/internal/redact" + "github.com/google/go-containerregistry/pkg/logs" +) + +type logTransport struct { + inner http.RoundTripper +} + +// NewLogger returns a transport that logs requests and responses to +// github.com/google/go-containerregistry/pkg/logs.Debug. +func NewLogger(inner http.RoundTripper) http.RoundTripper { + return &logTransport{inner} +} + +func (t *logTransport) RoundTrip(in *http.Request) (out *http.Response, err error) { + // Inspired by: github.com/motemen/go-loghttp + + // We redact token responses and binary blobs in response/request. + omitBody, reason := redact.FromContext(in.Context()) + if omitBody { + logs.Debug.Printf("--> %s %s [body redacted: %s]", in.Method, in.URL, reason) + } else { + logs.Debug.Printf("--> %s %s", in.Method, in.URL) + } + + // Save these headers so we can redact Authorization. + savedHeaders := in.Header.Clone() + if in.Header != nil && in.Header.Get("authorization") != "" { + in.Header.Set("authorization", "") + } + + b, err := httputil.DumpRequestOut(in, !omitBody) + if err == nil { + logs.Debug.Println(string(b)) + } else { + logs.Debug.Printf("Failed to dump request %s %s: %v", in.Method, in.URL, err) + } + + // Restore the non-redacted headers. + in.Header = savedHeaders + + start := time.Now() + out, err = t.inner.RoundTrip(in) + duration := time.Since(start) + if err != nil { + logs.Debug.Printf("<-- %v %s %s (%s)", err, in.Method, in.URL, duration) + } + if out != nil { + msg := fmt.Sprintf("<-- %d", out.StatusCode) + if out.Request != nil { + msg = fmt.Sprintf("%s %s", msg, out.Request.URL) + } + msg = fmt.Sprintf("%s (%s)", msg, duration) + + if omitBody { + msg = fmt.Sprintf("%s [body redacted: %s]", msg, reason) + } + + logs.Debug.Print(msg) + + b, err := httputil.DumpResponse(out, !omitBody) + if err == nil { + logs.Debug.Println(string(b)) + } else { + logs.Debug.Printf("Failed to dump response %s %s: %v", in.Method, in.URL, err) + } + } + return +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/ping.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/ping.go new file mode 100644 index 000000000..396d4e034 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/ping.go @@ -0,0 +1,129 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "context" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "strings" + + authchallenge "github.com/docker/distribution/registry/client/auth/challenge" + "github.com/google/go-containerregistry/pkg/name" +) + +type challenge string + +const ( + anonymous challenge = "anonymous" + basic challenge = "basic" + bearer challenge = "bearer" +) + +type pingResp struct { + challenge challenge + + // Following the challenge there are often key/value pairs + // e.g. Bearer service="gcr.io",realm="https://auth.gcr.io/v36/tokenz" + parameters map[string]string + + // The registry's scheme to use. Communicates whether we fell back to http. + scheme string +} + +func (c challenge) Canonical() challenge { + return challenge(strings.ToLower(string(c))) +} + +func parseChallenge(suffix string) map[string]string { + kv := make(map[string]string) + for _, token := range strings.Split(suffix, ",") { + // Trim any whitespace around each token. + token = strings.Trim(token, " ") + + // Break the token into a key/value pair + if parts := strings.SplitN(token, "=", 2); len(parts) == 2 { + // Unquote the value, if it is quoted. + kv[parts[0]] = strings.Trim(parts[1], `"`) + } else { + // If there was only one part, treat is as a key with an empty value + kv[token] = "" + } + } + return kv +} + +func ping(ctx context.Context, reg name.Registry, t http.RoundTripper) (*pingResp, error) { + client := http.Client{Transport: t} + + // This first attempts to use "https" for every request, falling back to http + // if the registry matches our localhost heuristic or if it is intentionally + // set to insecure via name.NewInsecureRegistry. + schemes := []string{"https"} + if reg.Scheme() == "http" { + schemes = append(schemes, "http") + } + + var errs []string + for _, scheme := range schemes { + url := fmt.Sprintf("%s://%s/v2/", scheme, reg.Name()) + req, err := http.NewRequest(http.MethodGet, url, nil) + if err != nil { + return nil, err + } + resp, err := client.Do(req.WithContext(ctx)) + if err != nil { + errs = append(errs, err.Error()) + // Potentially retry with http. + continue + } + defer func() { + // By draining the body, make sure to reuse the connection made by + // the ping for the following access to the registry + io.Copy(ioutil.Discard, resp.Body) + resp.Body.Close() + }() + + switch resp.StatusCode { + case http.StatusOK: + // If we get a 200, then no authentication is needed. + return &pingResp{ + challenge: anonymous, + scheme: scheme, + }, nil + case http.StatusUnauthorized: + if challenges := authchallenge.ResponseChallenges(resp); len(challenges) != 0 { + // If we hit more than one, I'm not even sure what to do. + wac := challenges[0] + return &pingResp{ + challenge: challenge(wac.Scheme).Canonical(), + parameters: wac.Parameters, + scheme: scheme, + }, nil + } + // Otherwise, just return the challenge without parameters. + return &pingResp{ + challenge: challenge(resp.Header.Get("WWW-Authenticate")).Canonical(), + scheme: scheme, + }, nil + default: + return nil, CheckError(resp, http.StatusOK, http.StatusUnauthorized) + } + } + return nil, errors.New(strings.Join(errs, "; ")) +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/retry.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/retry.go new file mode 100644 index 000000000..7f7d1e452 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/retry.go @@ -0,0 +1,88 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "net/http" + "time" + + "github.com/google/go-containerregistry/internal/retry" +) + +// Sleep for 0.1, 0.3, 0.9, 2.7 seconds. This should cover networking blips. +var defaultBackoff = retry.Backoff{ + Duration: 100 * time.Millisecond, + Factor: 3.0, + Jitter: 0.1, + Steps: 5, +} + +var _ http.RoundTripper = (*retryTransport)(nil) + +// retryTransport wraps a RoundTripper and retries temporary network errors. +type retryTransport struct { + inner http.RoundTripper + backoff retry.Backoff + predicate retry.Predicate +} + +// Option is a functional option for retryTransport. +type Option func(*options) + +type options struct { + backoff retry.Backoff + predicate retry.Predicate +} + +// WithRetryBackoff sets the backoff for retry operations. +func WithRetryBackoff(backoff retry.Backoff) Option { + return func(o *options) { + o.backoff = backoff + } +} + +// WithRetryPredicate sets the predicate for retry operations. +func WithRetryPredicate(predicate func(error) bool) Option { + return func(o *options) { + o.predicate = predicate + } +} + +// NewRetry returns a transport that retries errors. +func NewRetry(inner http.RoundTripper, opts ...Option) http.RoundTripper { + o := &options{ + backoff: defaultBackoff, + predicate: retry.IsTemporary, + } + + for _, opt := range opts { + opt(o) + } + + return &retryTransport{ + inner: inner, + backoff: o.backoff, + predicate: o.predicate, + } +} + +func (t *retryTransport) RoundTrip(in *http.Request) (out *http.Response, err error) { + roundtrip := func() error { + out, err = t.inner.RoundTrip(in) + return err + } + retry.Retry(roundtrip, t.predicate, t.backoff) + return +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/schemer.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/schemer.go new file mode 100644 index 000000000..d70b6a850 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/schemer.go @@ -0,0 +1,44 @@ +// Copyright 2019 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "net/http" + + "github.com/google/go-containerregistry/pkg/name" +) + +type schemeTransport struct { + // Scheme we should use, determined by ping response. + scheme string + + // Registry we're talking to. + registry name.Registry + + // Wrapped by schemeTransport. + inner http.RoundTripper +} + +// RoundTrip implements http.RoundTripper +func (st *schemeTransport) RoundTrip(in *http.Request) (*http.Response, error) { + // When we ping() the registry, we determine whether to use http or https + // based on which scheme was successful. That is only valid for the + // registry server and not e.g. a separate token server or blob storage, + // so we should only override the scheme if the host is the registry. + if matchesHost(st.registry, in, st.scheme) { + in.URL.Scheme = st.scheme + } + return st.inner.RoundTrip(in) +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/scope.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/scope.go new file mode 100644 index 000000000..c3b56f7a4 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/scope.go @@ -0,0 +1,24 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 transport + +// Scopes suitable to qualify each Repository +const ( + PullScope string = "pull" + PushScope string = "push,pull" + // For now DELETE is PUSH, which is the read/write ACL. + DeleteScope string = PushScope + CatalogScope string = "catalog" +) diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/transport.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/transport.go new file mode 100644 index 000000000..5c35fc7c9 --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/transport.go @@ -0,0 +1,103 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "context" + "fmt" + "net/http" + + "github.com/google/go-containerregistry/pkg/authn" + "github.com/google/go-containerregistry/pkg/name" +) + +// New returns a new RoundTripper based on the provided RoundTripper that has been +// setup to authenticate with the remote registry "reg", in the capacity +// laid out by the specified scopes. +// +// TODO(jonjohnsonjr): Deprecate this. +func New(reg name.Registry, auth authn.Authenticator, t http.RoundTripper, scopes []string) (http.RoundTripper, error) { + return NewWithContext(context.Background(), reg, auth, t, scopes) +} + +// NewWithContext returns a new RoundTripper based on the provided RoundTripper that has been +// setup to authenticate with the remote registry "reg", in the capacity +// laid out by the specified scopes. +func NewWithContext(ctx context.Context, reg name.Registry, auth authn.Authenticator, t http.RoundTripper, scopes []string) (http.RoundTripper, error) { + // The handshake: + // 1. Use "t" to ping() the registry for the authentication challenge. + // + // 2a. If we get back a 200, then simply use "t". + // + // 2b. If we get back a 401 with a Basic challenge, then use a transport + // that just attachs auth each roundtrip. + // + // 2c. If we get back a 401 with a Bearer challenge, then use a transport + // that attaches a bearer token to each request, and refreshes is on 401s. + // Perform an initial refresh to seed the bearer token. + + // First we ping the registry to determine the parameters of the authentication handshake + // (if one is even necessary). + pr, err := ping(ctx, reg, t) + if err != nil { + return nil, err + } + + // Wrap t with a useragent transport unless we already have one. + if _, ok := t.(*userAgentTransport); !ok { + t = NewUserAgent(t, "") + } + + // Wrap t in a transport that selects the appropriate scheme based on the ping response. + t = &schemeTransport{ + scheme: pr.scheme, + registry: reg, + inner: t, + } + + switch pr.challenge.Canonical() { + case anonymous: + return t, nil + case basic: + return &basicTransport{inner: t, auth: auth, target: reg.RegistryStr()}, nil + case bearer: + // We require the realm, which tells us where to send our Basic auth to turn it into Bearer auth. + realm, ok := pr.parameters["realm"] + if !ok { + return nil, fmt.Errorf("malformed www-authenticate, missing realm: %v", pr.parameters) + } + service, ok := pr.parameters["service"] + if !ok { + // If the service parameter is not specified, then default it to the registry + // with which we are talking. + service = reg.String() + } + bt := &bearerTransport{ + inner: t, + basic: auth, + realm: realm, + registry: reg, + service: service, + scopes: scopes, + scheme: pr.scheme, + } + if err := bt.refresh(ctx); err != nil { + return nil, err + } + return bt, nil + default: + return nil, fmt.Errorf("unrecognized challenge: %s", pr.challenge) + } +} diff --git a/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/useragent.go b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/useragent.go new file mode 100644 index 000000000..74a9e71bd --- /dev/null +++ b/integration-test/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/useragent.go @@ -0,0 +1,94 @@ +// Copyright 2019 Google LLC All Rights Reserved. +// +// 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 transport + +import ( + "fmt" + "net/http" + "runtime/debug" +) + +var ( + // Version can be set via: + // -ldflags="-X 'github.com/google/go-containerregistry/pkg/v1/remote/transport.Version=$TAG'" + Version string + + ggcrVersion = defaultUserAgent +) + +const ( + defaultUserAgent = "go-containerregistry" + moduleName = "github.com/google/go-containerregistry" +) + +type userAgentTransport struct { + inner http.RoundTripper + ua string +} + +func init() { + if v := version(); v != "" { + ggcrVersion = fmt.Sprintf("%s/%s", defaultUserAgent, v) + } +} + +func version() string { + if Version != "" { + // Version was set via ldflags, just return it. + return Version + } + + info, ok := debug.ReadBuildInfo() + if !ok { + return "" + } + + // Happens for crane and gcrane. + if info.Main.Path == moduleName { + return info.Main.Version + } + + // Anything else. + for _, dep := range info.Deps { + if dep.Path == moduleName { + return dep.Version + } + } + + return "" +} + +// NewUserAgent returns an http.Roundtripper that sets the user agent to +// The provided string plus additional go-containerregistry information, +// e.g. if provided "crane/v0.1.4" and this modules was built at v0.1.4: +// +// User-Agent: crane/v0.1.4 go-containerregistry/v0.1.4 +func NewUserAgent(inner http.RoundTripper, ua string) http.RoundTripper { + if ua == "" { + ua = ggcrVersion + } else { + ua = fmt.Sprintf("%s %s", ua, ggcrVersion) + } + return &userAgentTransport{ + inner: inner, + ua: ua, + } +} + +// RoundTrip implements http.RoundTripper +func (ut *userAgentTransport) RoundTrip(in *http.Request) (*http.Response, error) { + in.Header.Set("User-Agent", ut.ua) + return ut.inner.RoundTrip(in) +} diff --git a/integration-test/vendor/github.com/google/gofuzz/.travis.yml b/integration-test/vendor/github.com/google/gofuzz/.travis.yml new file mode 100644 index 000000000..f8684d99f --- /dev/null +++ b/integration-test/vendor/github.com/google/gofuzz/.travis.yml @@ -0,0 +1,13 @@ +language: go + +go: + - 1.4 + - 1.3 + - 1.2 + - tip + +install: + - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi + +script: + - go test -cover diff --git a/integration-test/vendor/github.com/google/gofuzz/CONTRIBUTING.md b/integration-test/vendor/github.com/google/gofuzz/CONTRIBUTING.md new file mode 100644 index 000000000..51cf5cd1a --- /dev/null +++ b/integration-test/vendor/github.com/google/gofuzz/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# How to contribute # + +We'd love to accept your patches and contributions to this project. There are +a just a few small guidelines you need to follow. + + +## Contributor License Agreement ## + +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. + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual + CLA][]. + + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA][]. + +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. + +[individual CLA]: https://developers.google.com/open-source/cla/individual +[corporate CLA]: https://developers.google.com/open-source/cla/corporate + + +## Submitting a patch ## + + 1. It's generally best to start by opening a new issue describing the bug or + feature you're intending to fix. Even if you think it's relatively minor, + it's helpful to know what people are working on. Mention in the initial + issue that you are planning to work on that bug or feature so that it can + be assigned to you. + + 1. Follow the normal process of [forking][] the project, and setup a new + branch to work in. It's important that each group of changes be done in + separate branches in order to ensure that a pull request only includes the + commits related to that bug or feature. + + 1. Go makes it very simple to ensure properly formatted code, so always run + `go fmt` on your code before committing it. You should also run + [golint][] over your code. As noted in the [golint readme][], it's not + strictly necessary that your code be completely "lint-free", but this will + help you find common style issues. + + 1. Any significant changes should almost always be accompanied by tests. The + project already has good test coverage, so look at some of the existing + tests if you're unsure how to go about it. [gocov][] and [gocov-html][] + are invaluable tools for seeing which parts of your code aren't being + exercised by your tests. + + 1. Do your best to have [well-formed commit messages][] for each change. + This provides consistency throughout the project, and ensures that commit + messages are able to be formatted properly by various git tools. + + 1. Finally, push the commits to your fork and submit a [pull request][]. + +[forking]: https://help.github.com/articles/fork-a-repo +[golint]: https://github.com/golang/lint +[golint readme]: https://github.com/golang/lint/blob/master/README +[gocov]: https://github.com/axw/gocov +[gocov-html]: https://github.com/matm/gocov-html +[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[squash]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits +[pull request]: https://help.github.com/articles/creating-a-pull-request diff --git a/integration-test/vendor/github.com/google/gofuzz/LICENSE b/integration-test/vendor/github.com/google/gofuzz/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/integration-test/vendor/github.com/google/gofuzz/LICENSE @@ -0,0 +1,202 @@ + + 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. diff --git a/integration-test/vendor/github.com/google/gofuzz/README.md b/integration-test/vendor/github.com/google/gofuzz/README.md new file mode 100644 index 000000000..386c2a457 --- /dev/null +++ b/integration-test/vendor/github.com/google/gofuzz/README.md @@ -0,0 +1,71 @@ +gofuzz +====== + +gofuzz is a library for populating go objects with random values. + +[![GoDoc](https://godoc.org/github.com/google/gofuzz?status.svg)](https://godoc.org/github.com/google/gofuzz) +[![Travis](https://travis-ci.org/google/gofuzz.svg?branch=master)](https://travis-ci.org/google/gofuzz) + +This is useful for testing: + +* Do your project's objects really serialize/unserialize correctly in all cases? +* Is there an incorrectly formatted object that will cause your project to panic? + +Import with ```import "github.com/google/gofuzz"``` + +You can use it on single variables: +```go +f := fuzz.New() +var myInt int +f.Fuzz(&myInt) // myInt gets a random value. +``` + +You can use it on maps: +```go +f := fuzz.New().NilChance(0).NumElements(1, 1) +var myMap map[ComplexKeyType]string +f.Fuzz(&myMap) // myMap will have exactly one element. +``` + +Customize the chance of getting a nil pointer: +```go +f := fuzz.New().NilChance(.5) +var fancyStruct struct { + A, B, C, D *string +} +f.Fuzz(&fancyStruct) // About half the pointers should be set. +``` + +You can even customize the randomization completely if needed: +```go +type MyEnum string +const ( + A MyEnum = "A" + B MyEnum = "B" +) +type MyInfo struct { + Type MyEnum + AInfo *string + BInfo *string +} + +f := fuzz.New().NilChance(0).Funcs( + func(e *MyInfo, c fuzz.Continue) { + switch c.Intn(2) { + case 0: + e.Type = A + c.Fuzz(&e.AInfo) + case 1: + e.Type = B + c.Fuzz(&e.BInfo) + } + }, +) + +var myObject MyInfo +f.Fuzz(&myObject) // Type will correspond to whether A or B info is set. +``` + +See more examples in ```example_test.go```. + +Happy testing! diff --git a/integration-test/vendor/github.com/google/gofuzz/doc.go b/integration-test/vendor/github.com/google/gofuzz/doc.go new file mode 100644 index 000000000..9f9956d4a --- /dev/null +++ b/integration-test/vendor/github.com/google/gofuzz/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2014 Google Inc. All rights reserved. + +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 fuzz is a library for populating go objects with random values. +package fuzz diff --git a/integration-test/vendor/github.com/google/gofuzz/fuzz.go b/integration-test/vendor/github.com/google/gofuzz/fuzz.go new file mode 100644 index 000000000..da0a5f938 --- /dev/null +++ b/integration-test/vendor/github.com/google/gofuzz/fuzz.go @@ -0,0 +1,506 @@ +/* +Copyright 2014 Google Inc. All rights reserved. + +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 fuzz + +import ( + "fmt" + "math/rand" + "reflect" + "regexp" + "time" +) + +// fuzzFuncMap is a map from a type to a fuzzFunc that handles that type. +type fuzzFuncMap map[reflect.Type]reflect.Value + +// Fuzzer knows how to fill any object with random fields. +type Fuzzer struct { + fuzzFuncs fuzzFuncMap + defaultFuzzFuncs fuzzFuncMap + r *rand.Rand + nilChance float64 + minElements int + maxElements int + maxDepth int + skipFieldPatterns []*regexp.Regexp +} + +// New returns a new Fuzzer. Customize your Fuzzer further by calling Funcs, +// RandSource, NilChance, or NumElements in any order. +func New() *Fuzzer { + return NewWithSeed(time.Now().UnixNano()) +} + +func NewWithSeed(seed int64) *Fuzzer { + f := &Fuzzer{ + defaultFuzzFuncs: fuzzFuncMap{ + reflect.TypeOf(&time.Time{}): reflect.ValueOf(fuzzTime), + }, + + fuzzFuncs: fuzzFuncMap{}, + r: rand.New(rand.NewSource(seed)), + nilChance: .2, + minElements: 1, + maxElements: 10, + maxDepth: 100, + } + return f +} + +// Funcs adds each entry in fuzzFuncs as a custom fuzzing function. +// +// Each entry in fuzzFuncs must be a function taking two parameters. +// The first parameter must be a pointer or map. It is the variable that +// function will fill with random data. The second parameter must be a +// fuzz.Continue, which will provide a source of randomness and a way +// to automatically continue fuzzing smaller pieces of the first parameter. +// +// These functions are called sensibly, e.g., if you wanted custom string +// fuzzing, the function `func(s *string, c fuzz.Continue)` would get +// called and passed the address of strings. Maps and pointers will always +// be made/new'd for you, ignoring the NilChange option. For slices, it +// doesn't make much sense to pre-create them--Fuzzer doesn't know how +// long you want your slice--so take a pointer to a slice, and make it +// yourself. (If you don't want your map/pointer type pre-made, take a +// pointer to it, and make it yourself.) See the examples for a range of +// custom functions. +func (f *Fuzzer) Funcs(fuzzFuncs ...interface{}) *Fuzzer { + for i := range fuzzFuncs { + v := reflect.ValueOf(fuzzFuncs[i]) + if v.Kind() != reflect.Func { + panic("Need only funcs!") + } + t := v.Type() + if t.NumIn() != 2 || t.NumOut() != 0 { + panic("Need 2 in and 0 out params!") + } + argT := t.In(0) + switch argT.Kind() { + case reflect.Ptr, reflect.Map: + default: + panic("fuzzFunc must take pointer or map type") + } + if t.In(1) != reflect.TypeOf(Continue{}) { + panic("fuzzFunc's second parameter must be type fuzz.Continue") + } + f.fuzzFuncs[argT] = v + } + return f +} + +// RandSource causes f to get values from the given source of randomness. +// Use if you want deterministic fuzzing. +func (f *Fuzzer) RandSource(s rand.Source) *Fuzzer { + f.r = rand.New(s) + return f +} + +// NilChance sets the probability of creating a nil pointer, map, or slice to +// 'p'. 'p' should be between 0 (no nils) and 1 (all nils), inclusive. +func (f *Fuzzer) NilChance(p float64) *Fuzzer { + if p < 0 || p > 1 { + panic("p should be between 0 and 1, inclusive.") + } + f.nilChance = p + return f +} + +// NumElements sets the minimum and maximum number of elements that will be +// added to a non-nil map or slice. +func (f *Fuzzer) NumElements(atLeast, atMost int) *Fuzzer { + if atLeast > atMost { + panic("atLeast must be <= atMost") + } + if atLeast < 0 { + panic("atLeast must be >= 0") + } + f.minElements = atLeast + f.maxElements = atMost + return f +} + +func (f *Fuzzer) genElementCount() int { + if f.minElements == f.maxElements { + return f.minElements + } + return f.minElements + f.r.Intn(f.maxElements-f.minElements+1) +} + +func (f *Fuzzer) genShouldFill() bool { + return f.r.Float64() > f.nilChance +} + +// MaxDepth sets the maximum number of recursive fuzz calls that will be made +// before stopping. This includes struct members, pointers, and map and slice +// elements. +func (f *Fuzzer) MaxDepth(d int) *Fuzzer { + f.maxDepth = d + return f +} + +// Skip fields which match the supplied pattern. Call this multiple times if needed +// This is useful to skip XXX_ fields generated by protobuf +func (f *Fuzzer) SkipFieldsWithPattern(pattern *regexp.Regexp) *Fuzzer { + f.skipFieldPatterns = append(f.skipFieldPatterns, pattern) + return f +} + +// Fuzz recursively fills all of obj's fields with something random. First +// this tries to find a custom fuzz function (see Funcs). If there is no +// custom function this tests whether the object implements fuzz.Interface and, +// if so, calls Fuzz on it to fuzz itself. If that fails, this will see if +// there is a default fuzz function provided by this package. If all of that +// fails, this will generate random values for all primitive fields and then +// recurse for all non-primitives. +// +// This is safe for cyclic or tree-like structs, up to a limit. Use the +// MaxDepth method to adjust how deep you need it to recurse. +// +// obj must be a pointer. Only exported (public) fields can be set (thanks, +// golang :/ ) Intended for tests, so will panic on bad input or unimplemented +// fields. +func (f *Fuzzer) Fuzz(obj interface{}) { + v := reflect.ValueOf(obj) + if v.Kind() != reflect.Ptr { + panic("needed ptr!") + } + v = v.Elem() + f.fuzzWithContext(v, 0) +} + +// FuzzNoCustom is just like Fuzz, except that any custom fuzz function for +// obj's type will not be called and obj will not be tested for fuzz.Interface +// conformance. This applies only to obj and not other instances of obj's +// type. +// Not safe for cyclic or tree-like structs! +// obj must be a pointer. Only exported (public) fields can be set (thanks, golang :/ ) +// Intended for tests, so will panic on bad input or unimplemented fields. +func (f *Fuzzer) FuzzNoCustom(obj interface{}) { + v := reflect.ValueOf(obj) + if v.Kind() != reflect.Ptr { + panic("needed ptr!") + } + v = v.Elem() + f.fuzzWithContext(v, flagNoCustomFuzz) +} + +const ( + // Do not try to find a custom fuzz function. Does not apply recursively. + flagNoCustomFuzz uint64 = 1 << iota +) + +func (f *Fuzzer) fuzzWithContext(v reflect.Value, flags uint64) { + fc := &fuzzerContext{fuzzer: f} + fc.doFuzz(v, flags) +} + +// fuzzerContext carries context about a single fuzzing run, which lets Fuzzer +// be thread-safe. +type fuzzerContext struct { + fuzzer *Fuzzer + curDepth int +} + +func (fc *fuzzerContext) doFuzz(v reflect.Value, flags uint64) { + if fc.curDepth >= fc.fuzzer.maxDepth { + return + } + fc.curDepth++ + defer func() { fc.curDepth-- }() + + if !v.CanSet() { + return + } + + if flags&flagNoCustomFuzz == 0 { + // Check for both pointer and non-pointer custom functions. + if v.CanAddr() && fc.tryCustom(v.Addr()) { + return + } + if fc.tryCustom(v) { + return + } + } + + if fn, ok := fillFuncMap[v.Kind()]; ok { + fn(v, fc.fuzzer.r) + return + } + switch v.Kind() { + case reflect.Map: + if fc.fuzzer.genShouldFill() { + v.Set(reflect.MakeMap(v.Type())) + n := fc.fuzzer.genElementCount() + for i := 0; i < n; i++ { + key := reflect.New(v.Type().Key()).Elem() + fc.doFuzz(key, 0) + val := reflect.New(v.Type().Elem()).Elem() + fc.doFuzz(val, 0) + v.SetMapIndex(key, val) + } + return + } + v.Set(reflect.Zero(v.Type())) + case reflect.Ptr: + if fc.fuzzer.genShouldFill() { + v.Set(reflect.New(v.Type().Elem())) + fc.doFuzz(v.Elem(), 0) + return + } + v.Set(reflect.Zero(v.Type())) + case reflect.Slice: + if fc.fuzzer.genShouldFill() { + n := fc.fuzzer.genElementCount() + v.Set(reflect.MakeSlice(v.Type(), n, n)) + for i := 0; i < n; i++ { + fc.doFuzz(v.Index(i), 0) + } + return + } + v.Set(reflect.Zero(v.Type())) + case reflect.Array: + if fc.fuzzer.genShouldFill() { + n := v.Len() + for i := 0; i < n; i++ { + fc.doFuzz(v.Index(i), 0) + } + return + } + v.Set(reflect.Zero(v.Type())) + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + skipField := false + fieldName := v.Type().Field(i).Name + for _, pattern := range fc.fuzzer.skipFieldPatterns { + if pattern.MatchString(fieldName) { + skipField = true + break + } + } + if !skipField { + fc.doFuzz(v.Field(i), 0) + } + } + case reflect.Chan: + fallthrough + case reflect.Func: + fallthrough + case reflect.Interface: + fallthrough + default: + panic(fmt.Sprintf("Can't handle %#v", v.Interface())) + } +} + +// tryCustom searches for custom handlers, and returns true iff it finds a match +// and successfully randomizes v. +func (fc *fuzzerContext) tryCustom(v reflect.Value) bool { + // First: see if we have a fuzz function for it. + doCustom, ok := fc.fuzzer.fuzzFuncs[v.Type()] + if !ok { + // Second: see if it can fuzz itself. + if v.CanInterface() { + intf := v.Interface() + if fuzzable, ok := intf.(Interface); ok { + fuzzable.Fuzz(Continue{fc: fc, Rand: fc.fuzzer.r}) + return true + } + } + // Finally: see if there is a default fuzz function. + doCustom, ok = fc.fuzzer.defaultFuzzFuncs[v.Type()] + if !ok { + return false + } + } + + switch v.Kind() { + case reflect.Ptr: + if v.IsNil() { + if !v.CanSet() { + return false + } + v.Set(reflect.New(v.Type().Elem())) + } + case reflect.Map: + if v.IsNil() { + if !v.CanSet() { + return false + } + v.Set(reflect.MakeMap(v.Type())) + } + default: + return false + } + + doCustom.Call([]reflect.Value{v, reflect.ValueOf(Continue{ + fc: fc, + Rand: fc.fuzzer.r, + })}) + return true +} + +// Interface represents an object that knows how to fuzz itself. Any time we +// find a type that implements this interface we will delegate the act of +// fuzzing itself. +type Interface interface { + Fuzz(c Continue) +} + +// Continue can be passed to custom fuzzing functions to allow them to use +// the correct source of randomness and to continue fuzzing their members. +type Continue struct { + fc *fuzzerContext + + // For convenience, Continue implements rand.Rand via embedding. + // Use this for generating any randomness if you want your fuzzing + // to be repeatable for a given seed. + *rand.Rand +} + +// Fuzz continues fuzzing obj. obj must be a pointer. +func (c Continue) Fuzz(obj interface{}) { + v := reflect.ValueOf(obj) + if v.Kind() != reflect.Ptr { + panic("needed ptr!") + } + v = v.Elem() + c.fc.doFuzz(v, 0) +} + +// FuzzNoCustom continues fuzzing obj, except that any custom fuzz function for +// obj's type will not be called and obj will not be tested for fuzz.Interface +// conformance. This applies only to obj and not other instances of obj's +// type. +func (c Continue) FuzzNoCustom(obj interface{}) { + v := reflect.ValueOf(obj) + if v.Kind() != reflect.Ptr { + panic("needed ptr!") + } + v = v.Elem() + c.fc.doFuzz(v, flagNoCustomFuzz) +} + +// RandString makes a random string up to 20 characters long. The returned string +// may include a variety of (valid) UTF-8 encodings. +func (c Continue) RandString() string { + return randString(c.Rand) +} + +// RandUint64 makes random 64 bit numbers. +// Weirdly, rand doesn't have a function that gives you 64 random bits. +func (c Continue) RandUint64() uint64 { + return randUint64(c.Rand) +} + +// RandBool returns true or false randomly. +func (c Continue) RandBool() bool { + return randBool(c.Rand) +} + +func fuzzInt(v reflect.Value, r *rand.Rand) { + v.SetInt(int64(randUint64(r))) +} + +func fuzzUint(v reflect.Value, r *rand.Rand) { + v.SetUint(randUint64(r)) +} + +func fuzzTime(t *time.Time, c Continue) { + var sec, nsec int64 + // Allow for about 1000 years of random time values, which keeps things + // like JSON parsing reasonably happy. + sec = c.Rand.Int63n(1000 * 365 * 24 * 60 * 60) + c.Fuzz(&nsec) + *t = time.Unix(sec, nsec) +} + +var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){ + reflect.Bool: func(v reflect.Value, r *rand.Rand) { + v.SetBool(randBool(r)) + }, + reflect.Int: fuzzInt, + reflect.Int8: fuzzInt, + reflect.Int16: fuzzInt, + reflect.Int32: fuzzInt, + reflect.Int64: fuzzInt, + reflect.Uint: fuzzUint, + reflect.Uint8: fuzzUint, + reflect.Uint16: fuzzUint, + reflect.Uint32: fuzzUint, + reflect.Uint64: fuzzUint, + reflect.Uintptr: fuzzUint, + reflect.Float32: func(v reflect.Value, r *rand.Rand) { + v.SetFloat(float64(r.Float32())) + }, + reflect.Float64: func(v reflect.Value, r *rand.Rand) { + v.SetFloat(r.Float64()) + }, + reflect.Complex64: func(v reflect.Value, r *rand.Rand) { + panic("unimplemented") + }, + reflect.Complex128: func(v reflect.Value, r *rand.Rand) { + panic("unimplemented") + }, + reflect.String: func(v reflect.Value, r *rand.Rand) { + v.SetString(randString(r)) + }, + reflect.UnsafePointer: func(v reflect.Value, r *rand.Rand) { + panic("unimplemented") + }, +} + +// randBool returns true or false randomly. +func randBool(r *rand.Rand) bool { + if r.Int()&1 == 1 { + return true + } + return false +} + +type charRange struct { + first, last rune +} + +// choose returns a random unicode character from the given range, using the +// given randomness source. +func (r *charRange) choose(rand *rand.Rand) rune { + count := int64(r.last - r.first) + return r.first + rune(rand.Int63n(count)) +} + +var unicodeRanges = []charRange{ + {' ', '~'}, // ASCII characters + {'\u00a0', '\u02af'}, // Multi-byte encoded characters + {'\u4e00', '\u9fff'}, // Common CJK (even longer encodings) +} + +// randString makes a random string up to 20 characters long. The returned string +// may include a variety of (valid) UTF-8 encodings. +func randString(r *rand.Rand) string { + n := r.Intn(20) + runes := make([]rune, n) + for i := range runes { + runes[i] = unicodeRanges[r.Intn(len(unicodeRanges))].choose(r) + } + return string(runes) +} + +// randUint64 makes random 64 bit numbers. +// Weirdly, rand doesn't have a function that gives you 64 random bits. +func randUint64(r *rand.Rand) uint64 { + return uint64(r.Uint32())<<32 | uint64(r.Uint32()) +} diff --git a/integration-test/vendor/github.com/google/uuid/.travis.yml b/integration-test/vendor/github.com/google/uuid/.travis.yml new file mode 100644 index 000000000..d8156a60b --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/.travis.yml @@ -0,0 +1,9 @@ +language: go + +go: + - 1.4.3 + - 1.5.3 + - tip + +script: + - go test -v ./... diff --git a/integration-test/vendor/github.com/google/uuid/CONTRIBUTING.md b/integration-test/vendor/github.com/google/uuid/CONTRIBUTING.md new file mode 100644 index 000000000..04fdf09f1 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to contribute + +We definitely welcome patches and contribution to this project! + +### Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +You may have already signed it for other Google projects. diff --git a/integration-test/vendor/github.com/google/uuid/CONTRIBUTORS b/integration-test/vendor/github.com/google/uuid/CONTRIBUTORS new file mode 100644 index 000000000..b4bb97f6b --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/CONTRIBUTORS @@ -0,0 +1,9 @@ +Paul Borman +bmatsuo +shawnps +theory +jboverfelt +dsymonds +cd1 +wallclockbuilder +dansouza diff --git a/integration-test/vendor/github.com/google/uuid/LICENSE b/integration-test/vendor/github.com/google/uuid/LICENSE new file mode 100644 index 000000000..5dc68268d --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009,2014 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/integration-test/vendor/github.com/google/uuid/README.md b/integration-test/vendor/github.com/google/uuid/README.md new file mode 100644 index 000000000..f765a46f9 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/README.md @@ -0,0 +1,19 @@ +# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) +The uuid package generates and inspects UUIDs based on +[RFC 4122](http://tools.ietf.org/html/rfc4122) +and DCE 1.1: Authentication and Security Services. + +This package is based on the github.com/pborman/uuid package (previously named +code.google.com/p/go-uuid). It differs from these earlier packages in that +a UUID is a 16 byte array rather than a byte slice. One loss due to this +change is the ability to represent an invalid UUID (vs a NIL UUID). + +###### Install +`go get github.com/google/uuid` + +###### Documentation +[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) + +Full `go doc` style documentation for the package can be viewed online without +installing this package by using the GoDoc site here: +http://pkg.go.dev/github.com/google/uuid diff --git a/integration-test/vendor/github.com/google/uuid/dce.go b/integration-test/vendor/github.com/google/uuid/dce.go new file mode 100644 index 000000000..fa820b9d3 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/dce.go @@ -0,0 +1,80 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "fmt" + "os" +) + +// A Domain represents a Version 2 domain +type Domain byte + +// Domain constants for DCE Security (Version 2) UUIDs. +const ( + Person = Domain(0) + Group = Domain(1) + Org = Domain(2) +) + +// NewDCESecurity returns a DCE Security (Version 2) UUID. +// +// The domain should be one of Person, Group or Org. +// On a POSIX system the id should be the users UID for the Person +// domain and the users GID for the Group. The meaning of id for +// the domain Org or on non-POSIX systems is site defined. +// +// For a given domain/id pair the same token may be returned for up to +// 7 minutes and 10 seconds. +func NewDCESecurity(domain Domain, id uint32) (UUID, error) { + uuid, err := NewUUID() + if err == nil { + uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 + uuid[9] = byte(domain) + binary.BigEndian.PutUint32(uuid[0:], id) + } + return uuid, err +} + +// NewDCEPerson returns a DCE Security (Version 2) UUID in the person +// domain with the id returned by os.Getuid. +// +// NewDCESecurity(Person, uint32(os.Getuid())) +func NewDCEPerson() (UUID, error) { + return NewDCESecurity(Person, uint32(os.Getuid())) +} + +// NewDCEGroup returns a DCE Security (Version 2) UUID in the group +// domain with the id returned by os.Getgid. +// +// NewDCESecurity(Group, uint32(os.Getgid())) +func NewDCEGroup() (UUID, error) { + return NewDCESecurity(Group, uint32(os.Getgid())) +} + +// Domain returns the domain for a Version 2 UUID. Domains are only defined +// for Version 2 UUIDs. +func (uuid UUID) Domain() Domain { + return Domain(uuid[9]) +} + +// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 +// UUIDs. +func (uuid UUID) ID() uint32 { + return binary.BigEndian.Uint32(uuid[0:4]) +} + +func (d Domain) String() string { + switch d { + case Person: + return "Person" + case Group: + return "Group" + case Org: + return "Org" + } + return fmt.Sprintf("Domain%d", int(d)) +} diff --git a/integration-test/vendor/github.com/google/uuid/doc.go b/integration-test/vendor/github.com/google/uuid/doc.go new file mode 100644 index 000000000..5b8a4b9af --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/doc.go @@ -0,0 +1,12 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package uuid generates and inspects UUIDs. +// +// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security +// Services. +// +// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to +// maps or compared directly. +package uuid diff --git a/integration-test/vendor/github.com/google/uuid/hash.go b/integration-test/vendor/github.com/google/uuid/hash.go new file mode 100644 index 000000000..b404f4bec --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/hash.go @@ -0,0 +1,53 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "crypto/md5" + "crypto/sha1" + "hash" +) + +// Well known namespace IDs and UUIDs +var ( + NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) + Nil UUID // empty UUID, all zeros +) + +// NewHash returns a new UUID derived from the hash of space concatenated with +// data generated by h. The hash should be at least 16 byte in length. The +// first 16 bytes of the hash are used to form the UUID. The version of the +// UUID will be the lower 4 bits of version. NewHash is used to implement +// NewMD5 and NewSHA1. +func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { + h.Reset() + h.Write(space[:]) //nolint:errcheck + h.Write(data) //nolint:errcheck + s := h.Sum(nil) + var uuid UUID + copy(uuid[:], s) + uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + return uuid +} + +// NewMD5 returns a new MD5 (Version 3) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(md5.New(), space, data, 3) +func NewMD5(space UUID, data []byte) UUID { + return NewHash(md5.New(), space, data, 3) +} + +// NewSHA1 returns a new SHA1 (Version 5) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(sha1.New(), space, data, 5) +func NewSHA1(space UUID, data []byte) UUID { + return NewHash(sha1.New(), space, data, 5) +} diff --git a/integration-test/vendor/github.com/google/uuid/marshal.go b/integration-test/vendor/github.com/google/uuid/marshal.go new file mode 100644 index 000000000..14bd34072 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/marshal.go @@ -0,0 +1,38 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "fmt" + +// MarshalText implements encoding.TextMarshaler. +func (uuid UUID) MarshalText() ([]byte, error) { + var js [36]byte + encodeHex(js[:], uuid) + return js[:], nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (uuid *UUID) UnmarshalText(data []byte) error { + id, err := ParseBytes(data) + if err != nil { + return err + } + *uuid = id + return nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (uuid UUID) MarshalBinary() ([]byte, error) { + return uuid[:], nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (uuid *UUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(uuid[:], data) + return nil +} diff --git a/integration-test/vendor/github.com/google/uuid/node.go b/integration-test/vendor/github.com/google/uuid/node.go new file mode 100644 index 000000000..d651a2b06 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/node.go @@ -0,0 +1,90 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "sync" +) + +var ( + nodeMu sync.Mutex + ifname string // name of interface being used + nodeID [6]byte // hardware for version 1 UUIDs + zeroID [6]byte // nodeID with only 0's +) + +// NodeInterface returns the name of the interface from which the NodeID was +// derived. The interface "user" is returned if the NodeID was set by +// SetNodeID. +func NodeInterface() string { + defer nodeMu.Unlock() + nodeMu.Lock() + return ifname +} + +// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. +// If name is "" then the first usable interface found will be used or a random +// Node ID will be generated. If a named interface cannot be found then false +// is returned. +// +// SetNodeInterface never fails when name is "". +func SetNodeInterface(name string) bool { + defer nodeMu.Unlock() + nodeMu.Lock() + return setNodeInterface(name) +} + +func setNodeInterface(name string) bool { + iname, addr := getHardwareInterface(name) // null implementation for js + if iname != "" && addr != nil { + ifname = iname + copy(nodeID[:], addr) + return true + } + + // We found no interfaces with a valid hardware address. If name + // does not specify a specific interface generate a random Node ID + // (section 4.1.6) + if name == "" { + ifname = "random" + randomBits(nodeID[:]) + return true + } + return false +} + +// NodeID returns a slice of a copy of the current Node ID, setting the Node ID +// if not already set. +func NodeID() []byte { + defer nodeMu.Unlock() + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nid := nodeID + return nid[:] +} + +// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes +// of id are used. If id is less than 6 bytes then false is returned and the +// Node ID is not set. +func SetNodeID(id []byte) bool { + if len(id) < 6 { + return false + } + defer nodeMu.Unlock() + nodeMu.Lock() + copy(nodeID[:], id) + ifname = "user" + return true +} + +// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is +// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) NodeID() []byte { + var node [6]byte + copy(node[:], uuid[10:]) + return node[:] +} diff --git a/integration-test/vendor/github.com/google/uuid/node_js.go b/integration-test/vendor/github.com/google/uuid/node_js.go new file mode 100644 index 000000000..24b78edc9 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/node_js.go @@ -0,0 +1,12 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build js + +package uuid + +// getHardwareInterface returns nil values for the JS version of the code. +// This remvoves the "net" dependency, because it is not used in the browser. +// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. +func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/integration-test/vendor/github.com/google/uuid/node_net.go b/integration-test/vendor/github.com/google/uuid/node_net.go new file mode 100644 index 000000000..0cbbcddbd --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/node_net.go @@ -0,0 +1,33 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !js + +package uuid + +import "net" + +var interfaces []net.Interface // cached list of interfaces + +// getHardwareInterface returns the name and hardware address of interface name. +// If name is "" then the name and hardware address of one of the system's +// interfaces is returned. If no interfaces are found (name does not exist or +// there are no interfaces) then "", nil is returned. +// +// Only addresses of at least 6 bytes are returned. +func getHardwareInterface(name string) (string, []byte) { + if interfaces == nil { + var err error + interfaces, err = net.Interfaces() + if err != nil { + return "", nil + } + } + for _, ifs := range interfaces { + if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { + return ifs.Name, ifs.HardwareAddr + } + } + return "", nil +} diff --git a/integration-test/vendor/github.com/google/uuid/null.go b/integration-test/vendor/github.com/google/uuid/null.go new file mode 100644 index 000000000..d7fcbf286 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/null.go @@ -0,0 +1,118 @@ +// Copyright 2021 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "database/sql/driver" + "encoding/json" + "fmt" +) + +var jsonNull = []byte("null") + +// NullUUID represents a UUID that may be null. +// NullUUID implements the SQL driver.Scanner interface so +// it can be used as a scan destination: +// +// var u uuid.NullUUID +// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) +// ... +// if u.Valid { +// // use u.UUID +// } else { +// // NULL value +// } +// +type NullUUID struct { + UUID UUID + Valid bool // Valid is true if UUID is not NULL +} + +// Scan implements the SQL driver.Scanner interface. +func (nu *NullUUID) Scan(value interface{}) error { + if value == nil { + nu.UUID, nu.Valid = Nil, false + return nil + } + + err := nu.UUID.Scan(value) + if err != nil { + nu.Valid = false + return err + } + + nu.Valid = true + return nil +} + +// Value implements the driver Valuer interface. +func (nu NullUUID) Value() (driver.Value, error) { + if !nu.Valid { + return nil, nil + } + // Delegate to UUID Value function + return nu.UUID.Value() +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (nu NullUUID) MarshalBinary() ([]byte, error) { + if nu.Valid { + return nu.UUID[:], nil + } + + return []byte(nil), nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (nu *NullUUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(nu.UUID[:], data) + nu.Valid = true + return nil +} + +// MarshalText implements encoding.TextMarshaler. +func (nu NullUUID) MarshalText() ([]byte, error) { + if nu.Valid { + return nu.UUID.MarshalText() + } + + return jsonNull, nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (nu *NullUUID) UnmarshalText(data []byte) error { + id, err := ParseBytes(data) + if err != nil { + nu.Valid = false + return err + } + nu.UUID = id + nu.Valid = true + return nil +} + +// MarshalJSON implements json.Marshaler. +func (nu NullUUID) MarshalJSON() ([]byte, error) { + if nu.Valid { + return json.Marshal(nu.UUID) + } + + return jsonNull, nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (nu *NullUUID) UnmarshalJSON(data []byte) error { + if bytes.Equal(data, jsonNull) { + *nu = NullUUID{} + return nil // valid null UUID + } + err := json.Unmarshal(data, &nu.UUID) + nu.Valid = err == nil + return err +} diff --git a/integration-test/vendor/github.com/google/uuid/sql.go b/integration-test/vendor/github.com/google/uuid/sql.go new file mode 100644 index 000000000..2e02ec06c --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/sql.go @@ -0,0 +1,59 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "database/sql/driver" + "fmt" +) + +// Scan implements sql.Scanner so UUIDs can be read from databases transparently. +// Currently, database types that map to string and []byte are supported. Please +// consult database-specific driver documentation for matching types. +func (uuid *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case nil: + return nil + + case string: + // if an empty UUID comes from a table, we return a null UUID + if src == "" { + return nil + } + + // see Parse for required string format + u, err := Parse(src) + if err != nil { + return fmt.Errorf("Scan: %v", err) + } + + *uuid = u + + case []byte: + // if an empty UUID comes from a table, we return a null UUID + if len(src) == 0 { + return nil + } + + // assumes a simple slice of bytes if 16 bytes + // otherwise attempts to parse + if len(src) != 16 { + return uuid.Scan(string(src)) + } + copy((*uuid)[:], src) + + default: + return fmt.Errorf("Scan: unable to scan type %T into UUID", src) + } + + return nil +} + +// Value implements sql.Valuer so that UUIDs can be written to databases +// transparently. Currently, UUIDs map to strings. Please consult +// database-specific driver documentation for matching types. +func (uuid UUID) Value() (driver.Value, error) { + return uuid.String(), nil +} diff --git a/integration-test/vendor/github.com/google/uuid/time.go b/integration-test/vendor/github.com/google/uuid/time.go new file mode 100644 index 000000000..e6ef06cdc --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/time.go @@ -0,0 +1,123 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "sync" + "time" +) + +// A Time represents a time as the number of 100's of nanoseconds since 15 Oct +// 1582. +type Time int64 + +const ( + lillian = 2299160 // Julian day of 15 Oct 1582 + unix = 2440587 // Julian day of 1 Jan 1970 + epoch = unix - lillian // Days between epochs + g1582 = epoch * 86400 // seconds between epochs + g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs +) + +var ( + timeMu sync.Mutex + lasttime uint64 // last time we returned + clockSeq uint16 // clock sequence for this run + + timeNow = time.Now // for testing +) + +// UnixTime converts t the number of seconds and nanoseconds using the Unix +// epoch of 1 Jan 1970. +func (t Time) UnixTime() (sec, nsec int64) { + sec = int64(t - g1582ns100) + nsec = (sec % 10000000) * 100 + sec /= 10000000 + return sec, nsec +} + +// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and +// clock sequence as well as adjusting the clock sequence as needed. An error +// is returned if the current time cannot be determined. +func GetTime() (Time, uint16, error) { + defer timeMu.Unlock() + timeMu.Lock() + return getTime() +} + +func getTime() (Time, uint16, error) { + t := timeNow() + + // If we don't have a clock sequence already, set one. + if clockSeq == 0 { + setClockSequence(-1) + } + now := uint64(t.UnixNano()/100) + g1582ns100 + + // If time has gone backwards with this clock sequence then we + // increment the clock sequence + if now <= lasttime { + clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 + } + lasttime = now + return Time(now), clockSeq, nil +} + +// ClockSequence returns the current clock sequence, generating one if not +// already set. The clock sequence is only used for Version 1 UUIDs. +// +// The uuid package does not use global static storage for the clock sequence or +// the last time a UUID was generated. Unless SetClockSequence is used, a new +// random clock sequence is generated the first time a clock sequence is +// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) +func ClockSequence() int { + defer timeMu.Unlock() + timeMu.Lock() + return clockSequence() +} + +func clockSequence() int { + if clockSeq == 0 { + setClockSequence(-1) + } + return int(clockSeq & 0x3fff) +} + +// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to +// -1 causes a new sequence to be generated. +func SetClockSequence(seq int) { + defer timeMu.Unlock() + timeMu.Lock() + setClockSequence(seq) +} + +func setClockSequence(seq int) { + if seq == -1 { + var b [2]byte + randomBits(b[:]) // clock sequence + seq = int(b[0])<<8 | int(b[1]) + } + oldSeq := clockSeq + clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant + if oldSeq != clockSeq { + lasttime = 0 + } +} + +// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in +// uuid. The time is only defined for version 1 and 2 UUIDs. +func (uuid UUID) Time() Time { + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + return Time(time) +} + +// ClockSequence returns the clock sequence encoded in uuid. +// The clock sequence is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) ClockSequence() int { + return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff +} diff --git a/integration-test/vendor/github.com/google/uuid/util.go b/integration-test/vendor/github.com/google/uuid/util.go new file mode 100644 index 000000000..5ea6c7378 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/util.go @@ -0,0 +1,43 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// randomBits completely fills slice b with random data. +func randomBits(b []byte) { + if _, err := io.ReadFull(rander, b); err != nil { + panic(err.Error()) // rand should never fail + } +} + +// xvalues returns the value of a byte as a hexadecimal digit or 255. +var xvalues = [256]byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +} + +// xtob converts hex characters x1 and x2 into a byte. +func xtob(x1, x2 byte) (byte, bool) { + b1 := xvalues[x1] + b2 := xvalues[x2] + return (b1 << 4) | b2, b1 != 255 && b2 != 255 +} diff --git a/integration-test/vendor/github.com/google/uuid/uuid.go b/integration-test/vendor/github.com/google/uuid/uuid.go new file mode 100644 index 000000000..a57207aeb --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/uuid.go @@ -0,0 +1,294 @@ +// Copyright 2018 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "io" + "strings" + "sync" +) + +// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC +// 4122. +type UUID [16]byte + +// A Version represents a UUID's version. +type Version byte + +// A Variant represents a UUID's variant. +type Variant byte + +// Constants returned by Variant. +const ( + Invalid = Variant(iota) // Invalid UUID + RFC4122 // The variant specified in RFC4122 + Reserved // Reserved, NCS backward compatibility. + Microsoft // Reserved, Microsoft Corporation backward compatibility. + Future // Reserved for future definition. +) + +const randPoolSize = 16 * 16 + +var ( + rander = rand.Reader // random function + poolEnabled = false + poolMu sync.Mutex + poolPos = randPoolSize // protected with poolMu + pool [randPoolSize]byte // protected with poolMu +) + +type invalidLengthError struct{ len int } + +func (err invalidLengthError) Error() string { + return fmt.Sprintf("invalid UUID length: %d", err.len) +} + +// IsInvalidLengthError is matcher function for custom error invalidLengthError +func IsInvalidLengthError(err error) bool { + _, ok := err.(invalidLengthError) + return ok +} + +// Parse decodes s into a UUID or returns an error. Both the standard UUID +// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the +// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex +// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. +func Parse(s string) (UUID, error) { + var uuid UUID + switch len(s) { + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36: + + // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: + if strings.ToLower(s[:9]) != "urn:uuid:" { + return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) + } + s = s[9:] + + // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + case 36 + 2: + s = s[1:] + + // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + case 32: + var ok bool + for i := range uuid { + uuid[i], ok = xtob(s[i*2], s[i*2+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, invalidLengthError{len(s)} + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + v, ok := xtob(s[x], s[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// ParseBytes is like Parse, except it parses a byte slice instead of a string. +func ParseBytes(b []byte) (UUID, error) { + var uuid UUID + switch len(b) { + case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { + return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) + } + b = b[9:] + case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + b = b[1:] + case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + var ok bool + for i := 0; i < 32; i += 2 { + uuid[i/2], ok = xtob(b[i], b[i+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, invalidLengthError{len(b)} + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + v, ok := xtob(b[x], b[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// MustParse is like Parse but panics if the string cannot be parsed. +// It simplifies safe initialization of global variables holding compiled UUIDs. +func MustParse(s string) UUID { + uuid, err := Parse(s) + if err != nil { + panic(`uuid: Parse(` + s + `): ` + err.Error()) + } + return uuid +} + +// FromBytes creates a new UUID from a byte slice. Returns an error if the slice +// does not have a length of 16. The bytes are copied from the slice. +func FromBytes(b []byte) (uuid UUID, err error) { + err = uuid.UnmarshalBinary(b) + return uuid, err +} + +// Must returns uuid if err is nil and panics otherwise. +func Must(uuid UUID, err error) UUID { + if err != nil { + panic(err) + } + return uuid +} + +// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// , or "" if uuid is invalid. +func (uuid UUID) String() string { + var buf [36]byte + encodeHex(buf[:], uuid) + return string(buf[:]) +} + +// URN returns the RFC 2141 URN form of uuid, +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. +func (uuid UUID) URN() string { + var buf [36 + 9]byte + copy(buf[:], "urn:uuid:") + encodeHex(buf[9:], uuid) + return string(buf[:]) +} + +func encodeHex(dst []byte, uuid UUID) { + hex.Encode(dst, uuid[:4]) + dst[8] = '-' + hex.Encode(dst[9:13], uuid[4:6]) + dst[13] = '-' + hex.Encode(dst[14:18], uuid[6:8]) + dst[18] = '-' + hex.Encode(dst[19:23], uuid[8:10]) + dst[23] = '-' + hex.Encode(dst[24:], uuid[10:]) +} + +// Variant returns the variant encoded in uuid. +func (uuid UUID) Variant() Variant { + switch { + case (uuid[8] & 0xc0) == 0x80: + return RFC4122 + case (uuid[8] & 0xe0) == 0xc0: + return Microsoft + case (uuid[8] & 0xe0) == 0xe0: + return Future + default: + return Reserved + } +} + +// Version returns the version of uuid. +func (uuid UUID) Version() Version { + return Version(uuid[6] >> 4) +} + +func (v Version) String() string { + if v > 15 { + return fmt.Sprintf("BAD_VERSION_%d", v) + } + return fmt.Sprintf("VERSION_%d", v) +} + +func (v Variant) String() string { + switch v { + case RFC4122: + return "RFC4122" + case Reserved: + return "Reserved" + case Microsoft: + return "Microsoft" + case Future: + return "Future" + case Invalid: + return "Invalid" + } + return fmt.Sprintf("BadVariant%d", int(v)) +} + +// SetRand sets the random number generator to r, which implements io.Reader. +// If r.Read returns an error when the package requests random data then +// a panic will be issued. +// +// Calling SetRand with nil sets the random number generator to the default +// generator. +func SetRand(r io.Reader) { + if r == nil { + rander = rand.Reader + return + } + rander = r +} + +// EnableRandPool enables internal randomness pool used for Random +// (Version 4) UUID generation. The pool contains random bytes read from +// the random number generator on demand in batches. Enabling the pool +// may improve the UUID generation throughput significantly. +// +// Since the pool is stored on the Go heap, this feature may be a bad fit +// for security sensitive applications. +// +// Both EnableRandPool and DisableRandPool are not thread-safe and should +// only be called when there is no possibility that New or any other +// UUID Version 4 generation function will be called concurrently. +func EnableRandPool() { + poolEnabled = true +} + +// DisableRandPool disables the randomness pool if it was previously +// enabled with EnableRandPool. +// +// Both EnableRandPool and DisableRandPool are not thread-safe and should +// only be called when there is no possibility that New or any other +// UUID Version 4 generation function will be called concurrently. +func DisableRandPool() { + poolEnabled = false + defer poolMu.Unlock() + poolMu.Lock() + poolPos = randPoolSize +} diff --git a/integration-test/vendor/github.com/google/uuid/version1.go b/integration-test/vendor/github.com/google/uuid/version1.go new file mode 100644 index 000000000..463109629 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/version1.go @@ -0,0 +1,44 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" +) + +// NewUUID returns a Version 1 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewUUID returns nil. If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewUUID returns nil and an error. +// +// In most cases, New should be used. +func NewUUID() (UUID, error) { + var uuid UUID + now, seq, err := GetTime() + if err != nil { + return uuid, err + } + + timeLow := uint32(now & 0xffffffff) + timeMid := uint16((now >> 32) & 0xffff) + timeHi := uint16((now >> 48) & 0x0fff) + timeHi |= 0x1000 // Version 1 + + binary.BigEndian.PutUint32(uuid[0:], timeLow) + binary.BigEndian.PutUint16(uuid[4:], timeMid) + binary.BigEndian.PutUint16(uuid[6:], timeHi) + binary.BigEndian.PutUint16(uuid[8:], seq) + + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + copy(uuid[10:], nodeID[:]) + nodeMu.Unlock() + + return uuid, nil +} diff --git a/integration-test/vendor/github.com/google/uuid/version4.go b/integration-test/vendor/github.com/google/uuid/version4.go new file mode 100644 index 000000000..7697802e4 --- /dev/null +++ b/integration-test/vendor/github.com/google/uuid/version4.go @@ -0,0 +1,76 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "io" + +// New creates a new random UUID or panics. New is equivalent to +// the expression +// +// uuid.Must(uuid.NewRandom()) +func New() UUID { + return Must(NewRandom()) +} + +// NewString creates a new random UUID and returns it as a string or panics. +// NewString is equivalent to the expression +// +// uuid.New().String() +func NewString() string { + return Must(NewRandom()).String() +} + +// NewRandom returns a Random (Version 4) UUID. +// +// The strength of the UUIDs is based on the strength of the crypto/rand +// package. +// +// Uses the randomness pool if it was enabled with EnableRandPool. +// +// A note about uniqueness derived from the UUID Wikipedia entry: +// +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. +func NewRandom() (UUID, error) { + if !poolEnabled { + return NewRandomFromReader(rander) + } + return newRandomFromPool() +} + +// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader. +func NewRandomFromReader(r io.Reader) (UUID, error) { + var uuid UUID + _, err := io.ReadFull(r, uuid[:]) + if err != nil { + return Nil, err + } + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} + +func newRandomFromPool() (UUID, error) { + var uuid UUID + poolMu.Lock() + if poolPos == randPoolSize { + _, err := io.ReadFull(rander, pool[:]) + if err != nil { + poolMu.Unlock() + return Nil, err + } + poolPos = 0 + } + copy(uuid[:], pool[poolPos:(poolPos+16)]) + poolPos += 16 + poolMu.Unlock() + + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/LICENSE b/integration-test/vendor/github.com/googleapis/gnostic/LICENSE new file mode 100644 index 000000000..6b0b1270f --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/LICENSE @@ -0,0 +1,203 @@ + + 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. + diff --git a/integration-test/vendor/github.com/googleapis/gnostic/compiler/README.md b/integration-test/vendor/github.com/googleapis/gnostic/compiler/README.md new file mode 100644 index 000000000..ee9783d23 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/compiler/README.md @@ -0,0 +1,4 @@ +# Compiler support code + +This directory contains compiler support code used by Gnostic and Gnostic +extensions. diff --git a/integration-test/vendor/github.com/googleapis/gnostic/compiler/context.go b/integration-test/vendor/github.com/googleapis/gnostic/compiler/context.go new file mode 100644 index 000000000..1bfe96121 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/compiler/context.go @@ -0,0 +1,49 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 compiler + +import ( + yaml "gopkg.in/yaml.v3" +) + +// Context contains state of the compiler as it traverses a document. +type Context struct { + Parent *Context + Name string + Node *yaml.Node + ExtensionHandlers *[]ExtensionHandler +} + +// NewContextWithExtensions returns a new object representing the compiler state +func NewContextWithExtensions(name string, node *yaml.Node, parent *Context, extensionHandlers *[]ExtensionHandler) *Context { + return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: extensionHandlers} +} + +// NewContext returns a new object representing the compiler state +func NewContext(name string, node *yaml.Node, parent *Context) *Context { + if parent != nil { + return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: parent.ExtensionHandlers} + } + return &Context{Name: name, Parent: parent, ExtensionHandlers: nil} +} + +// Description returns a text description of the compiler state +func (context *Context) Description() string { + name := context.Name + if context.Parent != nil { + name = context.Parent.Description() + "." + name + } + return name +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/compiler/error.go b/integration-test/vendor/github.com/googleapis/gnostic/compiler/error.go new file mode 100644 index 000000000..6f40515d6 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/compiler/error.go @@ -0,0 +1,70 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 compiler + +import "fmt" + +// Error represents compiler errors and their location in the document. +type Error struct { + Context *Context + Message string +} + +// NewError creates an Error. +func NewError(context *Context, message string) *Error { + return &Error{Context: context, Message: message} +} + +func (err *Error) locationDescription() string { + if err.Context.Node != nil { + return fmt.Sprintf("[%d,%d] %s", err.Context.Node.Line, err.Context.Node.Column, err.Context.Description()) + } + return err.Context.Description() +} + +// Error returns the string value of an Error. +func (err *Error) Error() string { + if err.Context == nil { + return err.Message + } + return err.locationDescription() + " " + err.Message +} + +// ErrorGroup is a container for groups of Error values. +type ErrorGroup struct { + Errors []error +} + +// NewErrorGroupOrNil returns a new ErrorGroup for a slice of errors or nil if the slice is empty. +func NewErrorGroupOrNil(errors []error) error { + if len(errors) == 0 { + return nil + } else if len(errors) == 1 { + return errors[0] + } else { + return &ErrorGroup{Errors: errors} + } +} + +func (group *ErrorGroup) Error() string { + result := "" + for i, err := range group.Errors { + if i > 0 { + result += "\n" + } + result += err.Error() + } + return result +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/compiler/extensions.go b/integration-test/vendor/github.com/googleapis/gnostic/compiler/extensions.go new file mode 100644 index 000000000..20848a0a1 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/compiler/extensions.go @@ -0,0 +1,85 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 compiler + +import ( + "bytes" + "fmt" + "os/exec" + "strings" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/any" + extensions "github.com/googleapis/gnostic/extensions" + yaml "gopkg.in/yaml.v3" +) + +// ExtensionHandler describes a binary that is called by the compiler to handle specification extensions. +type ExtensionHandler struct { + Name string +} + +// CallExtension calls a binary extension handler. +func CallExtension(context *Context, in *yaml.Node, extensionName string) (handled bool, response *any.Any, err error) { + if context == nil || context.ExtensionHandlers == nil { + return false, nil, nil + } + handled = false + for _, handler := range *(context.ExtensionHandlers) { + response, err = handler.handle(in, extensionName) + if response == nil { + continue + } else { + handled = true + break + } + } + return handled, response, err +} + +func (extensionHandlers *ExtensionHandler) handle(in *yaml.Node, extensionName string) (*any.Any, error) { + if extensionHandlers.Name != "" { + yamlData, _ := yaml.Marshal(in) + request := &extensions.ExtensionHandlerRequest{ + CompilerVersion: &extensions.Version{ + Major: 0, + Minor: 1, + Patch: 0, + }, + Wrapper: &extensions.Wrapper{ + Version: "unknown", // TODO: set this to the type/version of spec being parsed. + Yaml: string(yamlData), + ExtensionName: extensionName, + }, + } + requestBytes, _ := proto.Marshal(request) + cmd := exec.Command(extensionHandlers.Name) + cmd.Stdin = bytes.NewReader(requestBytes) + output, err := cmd.Output() + if err != nil { + return nil, err + } + response := &extensions.ExtensionHandlerResponse{} + err = proto.Unmarshal(output, response) + if err != nil || !response.Handled { + return nil, err + } + if len(response.Errors) != 0 { + return nil, fmt.Errorf("Errors when parsing: %+v for field %s by vendor extension handler %s. Details %+v", in, extensionName, extensionHandlers.Name, strings.Join(response.Errors, ",")) + } + return response.Value, nil + } + return nil, nil +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/compiler/helpers.go b/integration-test/vendor/github.com/googleapis/gnostic/compiler/helpers.go new file mode 100644 index 000000000..48f02f395 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/compiler/helpers.go @@ -0,0 +1,396 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 compiler + +import ( + "fmt" + "regexp" + "sort" + "strconv" + + "github.com/googleapis/gnostic/jsonschema" + "gopkg.in/yaml.v3" +) + +// compiler helper functions, usually called from generated code + +// UnpackMap gets a *yaml.Node if possible. +func UnpackMap(in *yaml.Node) (*yaml.Node, bool) { + if in == nil { + return nil, false + } + return in, true +} + +// SortedKeysForMap returns the sorted keys of a yamlv2.MapSlice. +func SortedKeysForMap(m *yaml.Node) []string { + keys := make([]string, 0) + if m.Kind == yaml.MappingNode { + for i := 0; i < len(m.Content); i += 2 { + keys = append(keys, m.Content[i].Value) + } + } + sort.Strings(keys) + return keys +} + +// MapHasKey returns true if a yamlv2.MapSlice contains a specified key. +func MapHasKey(m *yaml.Node, key string) bool { + if m == nil { + return false + } + if m.Kind == yaml.MappingNode { + for i := 0; i < len(m.Content); i += 2 { + itemKey := m.Content[i].Value + if key == itemKey { + return true + } + } + } + return false +} + +// MapValueForKey gets the value of a map value for a specified key. +func MapValueForKey(m *yaml.Node, key string) *yaml.Node { + if m == nil { + return nil + } + if m.Kind == yaml.MappingNode { + for i := 0; i < len(m.Content); i += 2 { + itemKey := m.Content[i].Value + if key == itemKey { + return m.Content[i+1] + } + } + } + return nil +} + +// ConvertInterfaceArrayToStringArray converts an array of interfaces to an array of strings, if possible. +func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string { + stringArray := make([]string, 0) + for _, item := range interfaceArray { + v, ok := item.(string) + if ok { + stringArray = append(stringArray, v) + } + } + return stringArray +} + +// SequenceNodeForNode returns a node if it is a SequenceNode. +func SequenceNodeForNode(node *yaml.Node) (*yaml.Node, bool) { + if node.Kind != yaml.SequenceNode { + return nil, false + } + return node, true +} + +// BoolForScalarNode returns the bool value of a node. +func BoolForScalarNode(node *yaml.Node) (bool, bool) { + if node == nil { + return false, false + } + if node.Kind == yaml.DocumentNode { + return BoolForScalarNode(node.Content[0]) + } + if node.Kind != yaml.ScalarNode { + return false, false + } + if node.Tag != "!!bool" { + return false, false + } + v, err := strconv.ParseBool(node.Value) + if err != nil { + return false, false + } + return v, true +} + +// IntForScalarNode returns the integer value of a node. +func IntForScalarNode(node *yaml.Node) (int64, bool) { + if node == nil { + return 0, false + } + if node.Kind == yaml.DocumentNode { + return IntForScalarNode(node.Content[0]) + } + if node.Kind != yaml.ScalarNode { + return 0, false + } + if node.Tag != "!!int" { + return 0, false + } + v, err := strconv.ParseInt(node.Value, 10, 64) + if err != nil { + return 0, false + } + return v, true +} + +// FloatForScalarNode returns the float value of a node. +func FloatForScalarNode(node *yaml.Node) (float64, bool) { + if node == nil { + return 0.0, false + } + if node.Kind == yaml.DocumentNode { + return FloatForScalarNode(node.Content[0]) + } + if node.Kind != yaml.ScalarNode { + return 0.0, false + } + if (node.Tag != "!!int") && (node.Tag != "!!float") { + return 0.0, false + } + v, err := strconv.ParseFloat(node.Value, 64) + if err != nil { + return 0.0, false + } + return v, true +} + +// StringForScalarNode returns the string value of a node. +func StringForScalarNode(node *yaml.Node) (string, bool) { + if node == nil { + return "", false + } + if node.Kind == yaml.DocumentNode { + return StringForScalarNode(node.Content[0]) + } + switch node.Kind { + case yaml.ScalarNode: + switch node.Tag { + case "!!int": + return node.Value, true + case "!!str": + return node.Value, true + case "!!timestamp": + return node.Value, true + case "!!null": + return "", true + default: + return "", false + } + default: + return "", false + } +} + +// StringArrayForSequenceNode converts a sequence node to an array of strings, if possible. +func StringArrayForSequenceNode(node *yaml.Node) []string { + stringArray := make([]string, 0) + for _, item := range node.Content { + v, ok := StringForScalarNode(item) + if ok { + stringArray = append(stringArray, v) + } + } + return stringArray +} + +// MissingKeysInMap identifies which keys from a list of required keys are not in a map. +func MissingKeysInMap(m *yaml.Node, requiredKeys []string) []string { + missingKeys := make([]string, 0) + for _, k := range requiredKeys { + if !MapHasKey(m, k) { + missingKeys = append(missingKeys, k) + } + } + return missingKeys +} + +// InvalidKeysInMap returns keys in a map that don't match a list of allowed keys and patterns. +func InvalidKeysInMap(m *yaml.Node, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string { + invalidKeys := make([]string, 0) + if m == nil || m.Kind != yaml.MappingNode { + return invalidKeys + } + for i := 0; i < len(m.Content); i += 2 { + key := m.Content[i].Value + found := false + // does the key match an allowed key? + for _, allowedKey := range allowedKeys { + if key == allowedKey { + found = true + break + } + } + if !found { + // does the key match an allowed pattern? + for _, allowedPattern := range allowedPatterns { + if allowedPattern.MatchString(key) { + found = true + break + } + } + if !found { + invalidKeys = append(invalidKeys, key) + } + } + } + return invalidKeys +} + +// NewNullNode creates a new Null node. +func NewNullNode() *yaml.Node { + node := &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!null", + } + return node +} + +// NewMappingNode creates a new Mapping node. +func NewMappingNode() *yaml.Node { + return &yaml.Node{ + Kind: yaml.MappingNode, + Content: make([]*yaml.Node, 0), + } +} + +// NewSequenceNode creates a new Sequence node. +func NewSequenceNode() *yaml.Node { + node := &yaml.Node{ + Kind: yaml.SequenceNode, + Content: make([]*yaml.Node, 0), + } + return node +} + +// NewScalarNodeForString creates a new node to hold a string. +func NewScalarNodeForString(s string) *yaml.Node { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!str", + Value: s, + } +} + +// NewSequenceNodeForStringArray creates a new node to hold an array of strings. +func NewSequenceNodeForStringArray(strings []string) *yaml.Node { + node := &yaml.Node{ + Kind: yaml.SequenceNode, + Content: make([]*yaml.Node, 0), + } + for _, s := range strings { + node.Content = append(node.Content, NewScalarNodeForString(s)) + } + return node +} + +// NewScalarNodeForBool creates a new node to hold a bool. +func NewScalarNodeForBool(b bool) *yaml.Node { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!bool", + Value: fmt.Sprintf("%t", b), + } +} + +// NewScalarNodeForFloat creates a new node to hold a float. +func NewScalarNodeForFloat(f float64) *yaml.Node { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!float", + Value: fmt.Sprintf("%g", f), + } +} + +// NewScalarNodeForInt creates a new node to hold an integer. +func NewScalarNodeForInt(i int64) *yaml.Node { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!int", + Value: fmt.Sprintf("%d", i), + } +} + +// PluralProperties returns the string "properties" pluralized. +func PluralProperties(count int) string { + if count == 1 { + return "property" + } + return "properties" +} + +// StringArrayContainsValue returns true if a string array contains a specified value. +func StringArrayContainsValue(array []string, value string) bool { + for _, item := range array { + if item == value { + return true + } + } + return false +} + +// StringArrayContainsValues returns true if a string array contains all of a list of specified values. +func StringArrayContainsValues(array []string, values []string) bool { + for _, value := range values { + if !StringArrayContainsValue(array, value) { + return false + } + } + return true +} + +// StringValue returns the string value of an item. +func StringValue(item interface{}) (value string, ok bool) { + value, ok = item.(string) + if ok { + return value, ok + } + intValue, ok := item.(int) + if ok { + return strconv.Itoa(intValue), true + } + return "", false +} + +// Description returns a human-readable represention of an item. +func Description(item interface{}) string { + value, ok := item.(*yaml.Node) + if ok { + return jsonschema.Render(value) + } + return fmt.Sprintf("%+v", item) +} + +// Display returns a description of a node for use in error messages. +func Display(node *yaml.Node) string { + switch node.Kind { + case yaml.ScalarNode: + switch node.Tag { + case "!!str": + return fmt.Sprintf("%s (string)", node.Value) + } + } + return fmt.Sprintf("%+v (%T)", node, node) +} + +// Marshal creates a yaml version of a structure in our preferred style +func Marshal(in *yaml.Node) []byte { + clearStyle(in) + //bytes, _ := yaml.Marshal(&yaml.Node{Kind: yaml.DocumentNode, Content: []*yaml.Node{in}}) + bytes, _ := yaml.Marshal(in) + + return bytes +} + +func clearStyle(node *yaml.Node) { + node.Style = 0 + for _, c := range node.Content { + clearStyle(c) + } +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/compiler/main.go b/integration-test/vendor/github.com/googleapis/gnostic/compiler/main.go new file mode 100644 index 000000000..ce9fcc456 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/compiler/main.go @@ -0,0 +1,16 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 compiler provides support functions to generated compiler code. +package compiler diff --git a/integration-test/vendor/github.com/googleapis/gnostic/compiler/reader.go b/integration-test/vendor/github.com/googleapis/gnostic/compiler/reader.go new file mode 100644 index 000000000..be0e8b40c --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/compiler/reader.go @@ -0,0 +1,307 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 compiler + +import ( + "fmt" + "io/ioutil" + "log" + "net/http" + "net/url" + "path/filepath" + "strings" + "sync" + + yaml "gopkg.in/yaml.v3" +) + +var verboseReader = false + +var fileCache map[string][]byte +var infoCache map[string]*yaml.Node + +var fileCacheEnable = true +var infoCacheEnable = true + +// These locks are used to synchronize accesses to the fileCache and infoCache +// maps (above). They are global state and can throw thread-related errors +// when modified from separate goroutines. The general strategy is to protect +// all public functions in this file with mutex Lock() calls. As a result, to +// avoid deadlock, these public functions should not call other public +// functions, so some public functions have private equivalents. +// In the future, we might consider replacing the maps with sync.Map and +// eliminating these mutexes. +var fileCacheMutex sync.Mutex +var infoCacheMutex sync.Mutex + +func initializeFileCache() { + if fileCache == nil { + fileCache = make(map[string][]byte, 0) + } +} + +func initializeInfoCache() { + if infoCache == nil { + infoCache = make(map[string]*yaml.Node, 0) + } +} + +// EnableFileCache turns on file caching. +func EnableFileCache() { + fileCacheMutex.Lock() + defer fileCacheMutex.Unlock() + fileCacheEnable = true +} + +// EnableInfoCache turns on parsed info caching. +func EnableInfoCache() { + infoCacheMutex.Lock() + defer infoCacheMutex.Unlock() + infoCacheEnable = true +} + +// DisableFileCache turns off file caching. +func DisableFileCache() { + fileCacheMutex.Lock() + defer fileCacheMutex.Unlock() + fileCacheEnable = false +} + +// DisableInfoCache turns off parsed info caching. +func DisableInfoCache() { + infoCacheMutex.Lock() + defer infoCacheMutex.Unlock() + infoCacheEnable = false +} + +// RemoveFromFileCache removes an entry from the file cache. +func RemoveFromFileCache(fileurl string) { + fileCacheMutex.Lock() + defer fileCacheMutex.Unlock() + if !fileCacheEnable { + return + } + initializeFileCache() + delete(fileCache, fileurl) +} + +// RemoveFromInfoCache removes an entry from the info cache. +func RemoveFromInfoCache(filename string) { + infoCacheMutex.Lock() + defer infoCacheMutex.Unlock() + if !infoCacheEnable { + return + } + initializeInfoCache() + delete(infoCache, filename) +} + +// GetInfoCache returns the info cache map. +func GetInfoCache() map[string]*yaml.Node { + infoCacheMutex.Lock() + defer infoCacheMutex.Unlock() + if infoCache == nil { + initializeInfoCache() + } + return infoCache +} + +// ClearFileCache clears the file cache. +func ClearFileCache() { + fileCacheMutex.Lock() + defer fileCacheMutex.Unlock() + fileCache = make(map[string][]byte, 0) +} + +// ClearInfoCache clears the info cache. +func ClearInfoCache() { + infoCacheMutex.Lock() + defer infoCacheMutex.Unlock() + infoCache = make(map[string]*yaml.Node) +} + +// ClearCaches clears all caches. +func ClearCaches() { + ClearFileCache() + ClearInfoCache() +} + +// FetchFile gets a specified file from the local filesystem or a remote location. +func FetchFile(fileurl string) ([]byte, error) { + fileCacheMutex.Lock() + defer fileCacheMutex.Unlock() + return fetchFile(fileurl) +} + +func fetchFile(fileurl string) ([]byte, error) { + var bytes []byte + initializeFileCache() + if fileCacheEnable { + bytes, ok := fileCache[fileurl] + if ok { + if verboseReader { + log.Printf("Cache hit %s", fileurl) + } + return bytes, nil + } + if verboseReader { + log.Printf("Fetching %s", fileurl) + } + } + response, err := http.Get(fileurl) + if err != nil { + return nil, err + } + defer response.Body.Close() + if response.StatusCode != 200 { + return nil, fmt.Errorf("Error downloading %s: %s", fileurl, response.Status) + } + bytes, err = ioutil.ReadAll(response.Body) + if fileCacheEnable && err == nil { + fileCache[fileurl] = bytes + } + return bytes, err +} + +// ReadBytesForFile reads the bytes of a file. +func ReadBytesForFile(filename string) ([]byte, error) { + fileCacheMutex.Lock() + defer fileCacheMutex.Unlock() + return readBytesForFile(filename) +} + +func readBytesForFile(filename string) ([]byte, error) { + // is the filename a url? + fileurl, _ := url.Parse(filename) + if fileurl.Scheme != "" { + // yes, fetch it + bytes, err := fetchFile(filename) + if err != nil { + return nil, err + } + return bytes, nil + } + // no, it's a local filename + bytes, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + return bytes, nil +} + +// ReadInfoFromBytes unmarshals a file as a *yaml.Node. +func ReadInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) { + infoCacheMutex.Lock() + defer infoCacheMutex.Unlock() + return readInfoFromBytes(filename, bytes) +} + +func readInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) { + initializeInfoCache() + if infoCacheEnable { + cachedInfo, ok := infoCache[filename] + if ok { + if verboseReader { + log.Printf("Cache hit info for file %s", filename) + } + return cachedInfo, nil + } + if verboseReader { + log.Printf("Reading info for file %s", filename) + } + } + var info yaml.Node + err := yaml.Unmarshal(bytes, &info) + if err != nil { + return nil, err + } + if infoCacheEnable && len(filename) > 0 { + infoCache[filename] = &info + } + return &info, nil +} + +// ReadInfoForRef reads a file and return the fragment needed to resolve a $ref. +func ReadInfoForRef(basefile string, ref string) (*yaml.Node, error) { + fileCacheMutex.Lock() + defer fileCacheMutex.Unlock() + infoCacheMutex.Lock() + defer infoCacheMutex.Unlock() + initializeInfoCache() + if infoCacheEnable { + info, ok := infoCache[ref] + if ok { + if verboseReader { + log.Printf("Cache hit for ref %s#%s", basefile, ref) + } + return info, nil + } + if verboseReader { + log.Printf("Reading info for ref %s#%s", basefile, ref) + } + } + basedir, _ := filepath.Split(basefile) + parts := strings.Split(ref, "#") + var filename string + if parts[0] != "" { + filename = parts[0] + if _, err := url.ParseRequestURI(parts[0]); err != nil { + // It is not an URL, so the file is local + filename = basedir + parts[0] + } + } else { + filename = basefile + } + bytes, err := readBytesForFile(filename) + if err != nil { + return nil, err + } + info, err := readInfoFromBytes(filename, bytes) + if info != nil && info.Kind == yaml.DocumentNode { + info = info.Content[0] + } + if err != nil { + log.Printf("File error: %v\n", err) + } else { + if info == nil { + return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref)) + } + if len(parts) > 1 { + path := strings.Split(parts[1], "/") + for i, key := range path { + if i > 0 { + m := info + if true { + found := false + for i := 0; i < len(m.Content); i += 2 { + if m.Content[i].Value == key { + info = m.Content[i+1] + found = true + } + } + if !found { + infoCache[ref] = nil + return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref)) + } + } + } + } + } + } + if infoCacheEnable { + infoCache[ref] = info + } + return info, nil +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/extensions/README.md b/integration-test/vendor/github.com/googleapis/gnostic/extensions/README.md new file mode 100644 index 000000000..4b5d63e58 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/extensions/README.md @@ -0,0 +1,13 @@ +# Extensions + +**Extension Support is experimental.** + +This directory contains support code for building Gnostic extensio handlers and +associated examples. + +Extension handlers can be used to compile vendor or specification extensions +into protocol buffer structures. + +Like plugins, extension handlers are built as separate executables. Extension +bodies are written to extension handlers as serialized +ExtensionHandlerRequests. diff --git a/integration-test/vendor/github.com/googleapis/gnostic/extensions/extension.pb.go b/integration-test/vendor/github.com/googleapis/gnostic/extensions/extension.pb.go new file mode 100644 index 000000000..5aab58ebf --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/extensions/extension.pb.go @@ -0,0 +1,461 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.5 +// source: extensions/extension.proto + +package gnostic_extension_v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The version number of Gnostic. +type Version struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` + // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should + // be empty for mainline stable releases. + Suffix string `protobuf:"bytes,4,opt,name=suffix,proto3" json:"suffix,omitempty"` +} + +func (x *Version) Reset() { + *x = Version{} + if protoimpl.UnsafeEnabled { + mi := &file_extensions_extension_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Version) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Version) ProtoMessage() {} + +func (x *Version) ProtoReflect() protoreflect.Message { + mi := &file_extensions_extension_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Version.ProtoReflect.Descriptor instead. +func (*Version) Descriptor() ([]byte, []int) { + return file_extensions_extension_proto_rawDescGZIP(), []int{0} +} + +func (x *Version) GetMajor() int32 { + if x != nil { + return x.Major + } + return 0 +} + +func (x *Version) GetMinor() int32 { + if x != nil { + return x.Minor + } + return 0 +} + +func (x *Version) GetPatch() int32 { + if x != nil { + return x.Patch + } + return 0 +} + +func (x *Version) GetSuffix() string { + if x != nil { + return x.Suffix + } + return "" +} + +// An encoded Request is written to the ExtensionHandler's stdin. +type ExtensionHandlerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The extension to process. + Wrapper *Wrapper `protobuf:"bytes,1,opt,name=wrapper,proto3" json:"wrapper,omitempty"` + // The version number of Gnostic. + CompilerVersion *Version `protobuf:"bytes,2,opt,name=compiler_version,json=compilerVersion,proto3" json:"compiler_version,omitempty"` +} + +func (x *ExtensionHandlerRequest) Reset() { + *x = ExtensionHandlerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_extensions_extension_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExtensionHandlerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtensionHandlerRequest) ProtoMessage() {} + +func (x *ExtensionHandlerRequest) ProtoReflect() protoreflect.Message { + mi := &file_extensions_extension_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtensionHandlerRequest.ProtoReflect.Descriptor instead. +func (*ExtensionHandlerRequest) Descriptor() ([]byte, []int) { + return file_extensions_extension_proto_rawDescGZIP(), []int{1} +} + +func (x *ExtensionHandlerRequest) GetWrapper() *Wrapper { + if x != nil { + return x.Wrapper + } + return nil +} + +func (x *ExtensionHandlerRequest) GetCompilerVersion() *Version { + if x != nil { + return x.CompilerVersion + } + return nil +} + +// The extensions writes an encoded ExtensionHandlerResponse to stdout. +type ExtensionHandlerResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // true if the extension is handled by the extension handler; false otherwise + Handled bool `protobuf:"varint,1,opt,name=handled,proto3" json:"handled,omitempty"` + // Error message(s). If non-empty, the extension handling failed. + // The extension handler process should exit with status code zero + // even if it reports an error in this way. + // + // This should be used to indicate errors which prevent the extension from + // operating as intended. Errors which indicate a problem in gnostic + // itself -- such as the input Document being unparseable -- should be + // reported by writing a message to stderr and exiting with a non-zero + // status code. + Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` + // text output + Value *anypb.Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *ExtensionHandlerResponse) Reset() { + *x = ExtensionHandlerResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_extensions_extension_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExtensionHandlerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtensionHandlerResponse) ProtoMessage() {} + +func (x *ExtensionHandlerResponse) ProtoReflect() protoreflect.Message { + mi := &file_extensions_extension_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtensionHandlerResponse.ProtoReflect.Descriptor instead. +func (*ExtensionHandlerResponse) Descriptor() ([]byte, []int) { + return file_extensions_extension_proto_rawDescGZIP(), []int{2} +} + +func (x *ExtensionHandlerResponse) GetHandled() bool { + if x != nil { + return x.Handled + } + return false +} + +func (x *ExtensionHandlerResponse) GetErrors() []string { + if x != nil { + return x.Errors + } + return nil +} + +func (x *ExtensionHandlerResponse) GetValue() *anypb.Any { + if x != nil { + return x.Value + } + return nil +} + +type Wrapper struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // version of the OpenAPI specification in which this extension was written. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Name of the extension. + ExtensionName string `protobuf:"bytes,2,opt,name=extension_name,json=extensionName,proto3" json:"extension_name,omitempty"` + // YAML-formatted extension value. + Yaml string `protobuf:"bytes,3,opt,name=yaml,proto3" json:"yaml,omitempty"` +} + +func (x *Wrapper) Reset() { + *x = Wrapper{} + if protoimpl.UnsafeEnabled { + mi := &file_extensions_extension_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Wrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Wrapper) ProtoMessage() {} + +func (x *Wrapper) ProtoReflect() protoreflect.Message { + mi := &file_extensions_extension_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Wrapper.ProtoReflect.Descriptor instead. +func (*Wrapper) Descriptor() ([]byte, []int) { + return file_extensions_extension_proto_rawDescGZIP(), []int{3} +} + +func (x *Wrapper) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Wrapper) GetExtensionName() string { + if x != nil { + return x.ExtensionName + } + return "" +} + +func (x *Wrapper) GetYaml() string { + if x != nil { + return x.Yaml + } + return "" +} + +var File_extensions_extension_proto protoreflect.FileDescriptor + +var file_extensions_extension_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x67, 0x6e, + 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a, + 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, + 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, + 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, + 0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, + 0x69, 0x78, 0x22, 0x9c, 0x01, 0x0a, 0x17, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, + 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x07, + 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x70, 0x69, + 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x22, 0x78, 0x0a, 0x18, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61, + 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, + 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5e, 0x0a, 0x07, 0x57, + 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x42, 0x4d, 0x0a, 0x0e, 0x6f, + 0x72, 0x67, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x47, + 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x50, + 0x01, 0x5a, 0x21, 0x2e, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3b, + 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x47, 0x4e, 0x58, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_extensions_extension_proto_rawDescOnce sync.Once + file_extensions_extension_proto_rawDescData = file_extensions_extension_proto_rawDesc +) + +func file_extensions_extension_proto_rawDescGZIP() []byte { + file_extensions_extension_proto_rawDescOnce.Do(func() { + file_extensions_extension_proto_rawDescData = protoimpl.X.CompressGZIP(file_extensions_extension_proto_rawDescData) + }) + return file_extensions_extension_proto_rawDescData +} + +var file_extensions_extension_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_extensions_extension_proto_goTypes = []interface{}{ + (*Version)(nil), // 0: gnostic.extension.v1.Version + (*ExtensionHandlerRequest)(nil), // 1: gnostic.extension.v1.ExtensionHandlerRequest + (*ExtensionHandlerResponse)(nil), // 2: gnostic.extension.v1.ExtensionHandlerResponse + (*Wrapper)(nil), // 3: gnostic.extension.v1.Wrapper + (*anypb.Any)(nil), // 4: google.protobuf.Any +} +var file_extensions_extension_proto_depIdxs = []int32{ + 3, // 0: gnostic.extension.v1.ExtensionHandlerRequest.wrapper:type_name -> gnostic.extension.v1.Wrapper + 0, // 1: gnostic.extension.v1.ExtensionHandlerRequest.compiler_version:type_name -> gnostic.extension.v1.Version + 4, // 2: gnostic.extension.v1.ExtensionHandlerResponse.value:type_name -> google.protobuf.Any + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_extensions_extension_proto_init() } +func file_extensions_extension_proto_init() { + if File_extensions_extension_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_extensions_extension_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Version); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_extensions_extension_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExtensionHandlerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_extensions_extension_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExtensionHandlerResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_extensions_extension_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Wrapper); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_extensions_extension_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_extensions_extension_proto_goTypes, + DependencyIndexes: file_extensions_extension_proto_depIdxs, + MessageInfos: file_extensions_extension_proto_msgTypes, + }.Build() + File_extensions_extension_proto = out.File + file_extensions_extension_proto_rawDesc = nil + file_extensions_extension_proto_goTypes = nil + file_extensions_extension_proto_depIdxs = nil +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/extensions/extension.proto b/integration-test/vendor/github.com/googleapis/gnostic/extensions/extension.proto new file mode 100644 index 000000000..875137c1a --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/extensions/extension.proto @@ -0,0 +1,97 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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. + +syntax = "proto3"; + +package gnostic.extension.v1; + +import "google/protobuf/any.proto"; + +// This option lets the proto compiler generate Java code inside the package +// name (see below) instead of inside an outer class. It creates a simpler +// developer experience by reducing one-level of name nesting and be +// consistent with most programming languages that don't support outer classes. +option java_multiple_files = true; + +// The Java outer classname should be the filename in UpperCamelCase. This +// class is only used to hold proto descriptor, so developers don't need to +// work with it directly. +option java_outer_classname = "GnosticExtension"; + +// The Java package name must be proto package name with proper prefix. +option java_package = "org.gnostic.v1"; + +// A reasonable prefix for the Objective-C symbols generated from the package. +// It should at a minimum be 3 characters long, all uppercase, and convention +// is to use an abbreviation of the package name. Something short, but +// hopefully unique enough to not conflict with things that may come along in +// the future. 'GPB' is reserved for the protocol buffer implementation itself. +// +// "Gnostic Extension" +option objc_class_prefix = "GNX"; + +// The Go package name. +option go_package = "./extensions;gnostic_extension_v1"; + +// The version number of Gnostic. +message Version { + int32 major = 1; + int32 minor = 2; + int32 patch = 3; + // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should + // be empty for mainline stable releases. + string suffix = 4; +} + +// An encoded Request is written to the ExtensionHandler's stdin. +message ExtensionHandlerRequest { + + // The extension to process. + Wrapper wrapper = 1; + + // The version number of Gnostic. + Version compiler_version = 2; +} + +// The extensions writes an encoded ExtensionHandlerResponse to stdout. +message ExtensionHandlerResponse { + + // true if the extension is handled by the extension handler; false otherwise + bool handled = 1; + + // Error message(s). If non-empty, the extension handling failed. + // The extension handler process should exit with status code zero + // even if it reports an error in this way. + // + // This should be used to indicate errors which prevent the extension from + // operating as intended. Errors which indicate a problem in gnostic + // itself -- such as the input Document being unparseable -- should be + // reported by writing a message to stderr and exiting with a non-zero + // status code. + repeated string errors = 2; + + // text output + google.protobuf.Any value = 3; +} + +message Wrapper { + // version of the OpenAPI specification in which this extension was written. + string version = 1; + + // Name of the extension. + string extension_name = 2; + + // YAML-formatted extension value. + string yaml = 3; +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/extensions/extensions.go b/integration-test/vendor/github.com/googleapis/gnostic/extensions/extensions.go new file mode 100644 index 000000000..ec8afd009 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/extensions/extensions.go @@ -0,0 +1,64 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 gnostic_extension_v1 + +import ( + "io/ioutil" + "log" + "os" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" +) + +type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error) + +// Main implements the main program of an extension handler. +func Main(handler extensionHandler) { + // unpack the request + data, err := ioutil.ReadAll(os.Stdin) + if err != nil { + log.Println("File error:", err.Error()) + os.Exit(1) + } + if len(data) == 0 { + log.Println("No input data.") + os.Exit(1) + } + request := &ExtensionHandlerRequest{} + err = proto.Unmarshal(data, request) + if err != nil { + log.Println("Input error:", err.Error()) + os.Exit(1) + } + // call the handler + handled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml) + // respond with the output of the handler + response := &ExtensionHandlerResponse{ + Handled: false, // default assumption + Errors: make([]string, 0), + } + if err != nil { + response.Errors = append(response.Errors, err.Error()) + } else if handled { + response.Handled = true + response.Value, err = ptypes.MarshalAny(output) + if err != nil { + response.Errors = append(response.Errors, err.Error()) + } + } + responseBytes, _ := proto.Marshal(response) + os.Stdout.Write(responseBytes) +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/README.md b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/README.md new file mode 100644 index 000000000..6793c5179 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/README.md @@ -0,0 +1,4 @@ +# jsonschema + +This directory contains code for reading, writing, and manipulating JSON +schemas. diff --git a/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/base.go b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/base.go new file mode 100644 index 000000000..0af8b148b --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/base.go @@ -0,0 +1,84 @@ + +// THIS FILE IS AUTOMATICALLY GENERATED. + +package jsonschema + +import ( + "encoding/base64" +) + +func baseSchemaBytes() ([]byte, error){ + return base64.StdEncoding.DecodeString( +`ewogICAgImlkIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIyIsCiAgICAi +JHNjaGVtYSI6ICJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMiLAogICAgImRl +c2NyaXB0aW9uIjogIkNvcmUgc2NoZW1hIG1ldGEtc2NoZW1hIiwKICAgICJkZWZpbml0aW9ucyI6IHsK +ICAgICAgICAic2NoZW1hQXJyYXkiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImFycmF5IiwKICAgICAg +ICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjIiB9CiAg +ICAgICAgfSwKICAgICAgICAicG9zaXRpdmVJbnRlZ2VyIjogewogICAgICAgICAgICAidHlwZSI6ICJp +bnRlZ2VyIiwKICAgICAgICAgICAgIm1pbmltdW0iOiAwCiAgICAgICAgfSwKICAgICAgICAicG9zaXRp +dmVJbnRlZ2VyRGVmYXVsdDAiOiB7CiAgICAgICAgICAgICJhbGxPZiI6IFsgeyAiJHJlZiI6ICIjL2Rl +ZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlciIgfSwgeyAiZGVmYXVsdCI6IDAgfSBdCiAgICAgICAgfSwK +ICAgICAgICAic2ltcGxlVHlwZXMiOiB7CiAgICAgICAgICAgICJlbnVtIjogWyAiYXJyYXkiLCAiYm9v +bGVhbiIsICJpbnRlZ2VyIiwgIm51bGwiLCAibnVtYmVyIiwgIm9iamVjdCIsICJzdHJpbmciIF0KICAg +ICAgICB9LAogICAgICAgICJzdHJpbmdBcnJheSI6IHsKICAgICAgICAgICAgInR5cGUiOiAiYXJyYXki +LAogICAgICAgICAgICAiaXRlbXMiOiB7ICJ0eXBlIjogInN0cmluZyIgfSwKICAgICAgICAgICAgIm1p +bkl0ZW1zIjogMSwKICAgICAgICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0KICAgIH0s +CiAgICAidHlwZSI6ICJvYmplY3QiLAogICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgImlkIjogewog +ICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAogICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAg +ICAgICB9LAogICAgICAgICIkc2NoZW1hIjogewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAog +ICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAgICAgICB9LAogICAgICAgICJ0aXRsZSI6IHsKICAg +ICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0sCiAgICAgICAgImRlc2NyaXB0aW9uIjog +ewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgfSwKICAgICAgICAiZGVmYXVsdCI6 +IHt9LAogICAgICAgICJtdWx0aXBsZU9mIjogewogICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiLAog +ICAgICAgICAgICAibWluaW11bSI6IDAsCiAgICAgICAgICAgICJleGNsdXNpdmVNaW5pbXVtIjogdHJ1 +ZQogICAgICAgIH0sCiAgICAgICAgIm1heGltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJl +ciIKICAgICAgICB9LAogICAgICAgICJleGNsdXNpdmVNYXhpbXVtIjogewogICAgICAgICAgICAidHlw +ZSI6ICJib29sZWFuIiwKICAgICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAg +ICAgIm1pbmltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICB9LAogICAg +ICAgICJleGNsdXNpdmVNaW5pbXVtIjogewogICAgICAgICAgICAidHlwZSI6ICJib29sZWFuIiwKICAg +ICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAgICAgIm1heExlbmd0aCI6IHsg +IiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pbkxlbmd0 +aCI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAg +ICAgICAicGF0dGVybiI6IHsKICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIiwKICAgICAgICAgICAg +ImZvcm1hdCI6ICJyZWdleCIKICAgICAgICB9LAogICAgICAgICJhZGRpdGlvbmFsSXRlbXMiOiB7CiAg +ICAgICAgICAgICJhbnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgInR5cGUiOiAiYm9vbGVhbiIgfSwK +ICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfQogICAgICAgICAgICBdLAogICAgICAgICAgICAi +ZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAiaXRlbXMiOiB7CiAgICAgICAgICAgICJhbnlP +ZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgICAgIHsgIiRy +ZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIgfQogICAgICAgICAgICBdLAogICAgICAgICAg +ICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAibWF4SXRlbXMiOiB7ICIkcmVmIjogIiMv +ZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyIiB9LAogICAgICAgICJtaW5JdGVtcyI6IHsgIiRyZWYi +OiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAgICAgICAidW5pcXVl +SXRlbXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iLAogICAgICAgICAgICAiZGVmYXVs +dCI6IGZhbHNlCiAgICAgICAgfSwKICAgICAgICAibWF4UHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIy9k +ZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pblByb3BlcnRpZXMiOiB7ICIk +cmVmIjogIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDAiIH0sCiAgICAgICAgInJl +cXVpcmVkIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3N0cmluZ0FycmF5IiB9LAogICAgICAgICJh +ZGRpdGlvbmFsUHJvcGVydGllcyI6IHsKICAgICAgICAgICAgImFueU9mIjogWwogICAgICAgICAgICAg +ICAgeyAidHlwZSI6ICJib29sZWFuIiB9LAogICAgICAgICAgICAgICAgeyAiJHJlZiI6ICIjIiB9CiAg +ICAgICAgICAgIF0sCiAgICAgICAgICAgICJkZWZhdWx0Ijoge30KICAgICAgICB9LAogICAgICAgICJk +ZWZpbml0aW9ucyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgICAgICAgImFk +ZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9LAogICAgICAgICAgICAiZGVmYXVsdCI6 +IHt9CiAgICAgICAgfSwKICAgICAgICAicHJvcGVydGllcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAi +b2JqZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9 +LAogICAgICAgICAgICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAicGF0dGVyblByb3Bl +cnRpZXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICAgICAgICJhZGRpdGlv +bmFsUHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgImRlZmF1bHQiOiB7fQog +ICAgICAgIH0sCiAgICAgICAgImRlcGVuZGVuY2llcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2Jq +ZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICAg +ImFueU9mIjogWwogICAgICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAg +ICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc3RyaW5nQXJyYXkiIH0KICAgICAgICAgICAg +ICAgIF0KICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgImVudW0iOiB7CiAgICAgICAgICAg +ICJ0eXBlIjogImFycmF5IiwKICAgICAgICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgInVu +aXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0sCiAgICAgICAgInR5cGUiOiB7CiAgICAgICAgICAgICJh +bnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBl +cyIgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAidHlwZSI6ICJhcnJheSIs +CiAgICAgICAgICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NpbXBs +ZVR5cGVzIiB9LAogICAgICAgICAgICAgICAgICAgICJtaW5JdGVtcyI6IDEsCiAgICAgICAgICAgICAg +ICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAg +ICAgICAgfSwKICAgICAgICAiYWxsT2YiOiB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJy +YXkiIH0sCiAgICAgICAgImFueU9mIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5 +IiB9LAogICAgICAgICJvbmVPZiI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIg +fSwKICAgICAgICAibm90IjogeyAiJHJlZiI6ICIjIiB9CiAgICB9LAogICAgImRlcGVuZGVuY2llcyI6 +IHsKICAgICAgICAiZXhjbHVzaXZlTWF4aW11bSI6IFsgIm1heGltdW0iIF0sCiAgICAgICAgImV4Y2x1 +c2l2ZU1pbmltdW0iOiBbICJtaW5pbXVtIiBdCiAgICB9LAogICAgImRlZmF1bHQiOiB7fQp9Cg==`)} \ No newline at end of file diff --git a/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/display.go b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/display.go new file mode 100644 index 000000000..028a760a9 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/display.go @@ -0,0 +1,229 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 jsonschema + +import ( + "fmt" + "strings" +) + +// +// DISPLAY +// The following methods display Schemas. +// + +// Description returns a string representation of a string or string array. +func (s *StringOrStringArray) Description() string { + if s.String != nil { + return *s.String + } + if s.StringArray != nil { + return strings.Join(*s.StringArray, ", ") + } + return "" +} + +// Returns a string representation of a Schema. +func (schema *Schema) String() string { + return schema.describeSchema("") +} + +// Helper: Returns a string representation of a Schema indented by a specified string. +func (schema *Schema) describeSchema(indent string) string { + result := "" + if schema.Schema != nil { + result += indent + "$schema: " + *(schema.Schema) + "\n" + } + if schema.ID != nil { + result += indent + "id: " + *(schema.ID) + "\n" + } + if schema.MultipleOf != nil { + result += indent + fmt.Sprintf("multipleOf: %+v\n", *(schema.MultipleOf)) + } + if schema.Maximum != nil { + result += indent + fmt.Sprintf("maximum: %+v\n", *(schema.Maximum)) + } + if schema.ExclusiveMaximum != nil { + result += indent + fmt.Sprintf("exclusiveMaximum: %+v\n", *(schema.ExclusiveMaximum)) + } + if schema.Minimum != nil { + result += indent + fmt.Sprintf("minimum: %+v\n", *(schema.Minimum)) + } + if schema.ExclusiveMinimum != nil { + result += indent + fmt.Sprintf("exclusiveMinimum: %+v\n", *(schema.ExclusiveMinimum)) + } + if schema.MaxLength != nil { + result += indent + fmt.Sprintf("maxLength: %+v\n", *(schema.MaxLength)) + } + if schema.MinLength != nil { + result += indent + fmt.Sprintf("minLength: %+v\n", *(schema.MinLength)) + } + if schema.Pattern != nil { + result += indent + fmt.Sprintf("pattern: %+v\n", *(schema.Pattern)) + } + if schema.AdditionalItems != nil { + s := schema.AdditionalItems.Schema + if s != nil { + result += indent + "additionalItems:\n" + result += s.describeSchema(indent + " ") + } else { + b := *(schema.AdditionalItems.Boolean) + result += indent + fmt.Sprintf("additionalItems: %+v\n", b) + } + } + if schema.Items != nil { + result += indent + "items:\n" + items := schema.Items + if items.SchemaArray != nil { + for i, s := range *(items.SchemaArray) { + result += indent + " " + fmt.Sprintf("%d", i) + ":\n" + result += s.describeSchema(indent + " " + " ") + } + } else if items.Schema != nil { + result += items.Schema.describeSchema(indent + " " + " ") + } + } + if schema.MaxItems != nil { + result += indent + fmt.Sprintf("maxItems: %+v\n", *(schema.MaxItems)) + } + if schema.MinItems != nil { + result += indent + fmt.Sprintf("minItems: %+v\n", *(schema.MinItems)) + } + if schema.UniqueItems != nil { + result += indent + fmt.Sprintf("uniqueItems: %+v\n", *(schema.UniqueItems)) + } + if schema.MaxProperties != nil { + result += indent + fmt.Sprintf("maxProperties: %+v\n", *(schema.MaxProperties)) + } + if schema.MinProperties != nil { + result += indent + fmt.Sprintf("minProperties: %+v\n", *(schema.MinProperties)) + } + if schema.Required != nil { + result += indent + fmt.Sprintf("required: %+v\n", *(schema.Required)) + } + if schema.AdditionalProperties != nil { + s := schema.AdditionalProperties.Schema + if s != nil { + result += indent + "additionalProperties:\n" + result += s.describeSchema(indent + " ") + } else { + b := *(schema.AdditionalProperties.Boolean) + result += indent + fmt.Sprintf("additionalProperties: %+v\n", b) + } + } + if schema.Properties != nil { + result += indent + "properties:\n" + for _, pair := range *(schema.Properties) { + name := pair.Name + s := pair.Value + result += indent + " " + name + ":\n" + result += s.describeSchema(indent + " " + " ") + } + } + if schema.PatternProperties != nil { + result += indent + "patternProperties:\n" + for _, pair := range *(schema.PatternProperties) { + name := pair.Name + s := pair.Value + result += indent + " " + name + ":\n" + result += s.describeSchema(indent + " " + " ") + } + } + if schema.Dependencies != nil { + result += indent + "dependencies:\n" + for _, pair := range *(schema.Dependencies) { + name := pair.Name + schemaOrStringArray := pair.Value + s := schemaOrStringArray.Schema + if s != nil { + result += indent + " " + name + ":\n" + result += s.describeSchema(indent + " " + " ") + } else { + a := schemaOrStringArray.StringArray + if a != nil { + result += indent + " " + name + ":\n" + for _, s2 := range *a { + result += indent + " " + " " + s2 + "\n" + } + } + } + + } + } + if schema.Enumeration != nil { + result += indent + "enumeration:\n" + for _, value := range *(schema.Enumeration) { + if value.String != nil { + result += indent + " " + fmt.Sprintf("%+v\n", *value.String) + } else { + result += indent + " " + fmt.Sprintf("%+v\n", *value.Bool) + } + } + } + if schema.Type != nil { + result += indent + fmt.Sprintf("type: %+v\n", schema.Type.Description()) + } + if schema.AllOf != nil { + result += indent + "allOf:\n" + for _, s := range *(schema.AllOf) { + result += s.describeSchema(indent + " ") + result += indent + "-\n" + } + } + if schema.AnyOf != nil { + result += indent + "anyOf:\n" + for _, s := range *(schema.AnyOf) { + result += s.describeSchema(indent + " ") + result += indent + "-\n" + } + } + if schema.OneOf != nil { + result += indent + "oneOf:\n" + for _, s := range *(schema.OneOf) { + result += s.describeSchema(indent + " ") + result += indent + "-\n" + } + } + if schema.Not != nil { + result += indent + "not:\n" + result += schema.Not.describeSchema(indent + " ") + } + if schema.Definitions != nil { + result += indent + "definitions:\n" + for _, pair := range *(schema.Definitions) { + name := pair.Name + s := pair.Value + result += indent + " " + name + ":\n" + result += s.describeSchema(indent + " " + " ") + } + } + if schema.Title != nil { + result += indent + "title: " + *(schema.Title) + "\n" + } + if schema.Description != nil { + result += indent + "description: " + *(schema.Description) + "\n" + } + if schema.Default != nil { + result += indent + "default:\n" + result += indent + fmt.Sprintf(" %+v\n", *(schema.Default)) + } + if schema.Format != nil { + result += indent + "format: " + *(schema.Format) + "\n" + } + if schema.Ref != nil { + result += indent + "$ref: " + *(schema.Ref) + "\n" + } + return result +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/models.go b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/models.go new file mode 100644 index 000000000..4781bdc5f --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/models.go @@ -0,0 +1,228 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 jsonschema supports the reading, writing, and manipulation +// of JSON Schemas. +package jsonschema + +import "gopkg.in/yaml.v3" + +// The Schema struct models a JSON Schema and, because schemas are +// defined hierarchically, contains many references to itself. +// All fields are pointers and are nil if the associated values +// are not specified. +type Schema struct { + Schema *string // $schema + ID *string // id keyword used for $ref resolution scope + Ref *string // $ref, i.e. JSON Pointers + + // http://json-schema.org/latest/json-schema-validation.html + // 5.1. Validation keywords for numeric instances (number and integer) + MultipleOf *SchemaNumber + Maximum *SchemaNumber + ExclusiveMaximum *bool + Minimum *SchemaNumber + ExclusiveMinimum *bool + + // 5.2. Validation keywords for strings + MaxLength *int64 + MinLength *int64 + Pattern *string + + // 5.3. Validation keywords for arrays + AdditionalItems *SchemaOrBoolean + Items *SchemaOrSchemaArray + MaxItems *int64 + MinItems *int64 + UniqueItems *bool + + // 5.4. Validation keywords for objects + MaxProperties *int64 + MinProperties *int64 + Required *[]string + AdditionalProperties *SchemaOrBoolean + Properties *[]*NamedSchema + PatternProperties *[]*NamedSchema + Dependencies *[]*NamedSchemaOrStringArray + + // 5.5. Validation keywords for any instance type + Enumeration *[]SchemaEnumValue + Type *StringOrStringArray + AllOf *[]*Schema + AnyOf *[]*Schema + OneOf *[]*Schema + Not *Schema + Definitions *[]*NamedSchema + + // 6. Metadata keywords + Title *string + Description *string + Default *yaml.Node + + // 7. Semantic validation with "format" + Format *string +} + +// These helper structs represent "combination" types that generally can +// have values of one type or another. All are used to represent parts +// of Schemas. + +// SchemaNumber represents a value that can be either an Integer or a Float. +type SchemaNumber struct { + Integer *int64 + Float *float64 +} + +// NewSchemaNumberWithInteger creates and returns a new object +func NewSchemaNumberWithInteger(i int64) *SchemaNumber { + result := &SchemaNumber{} + result.Integer = &i + return result +} + +// NewSchemaNumberWithFloat creates and returns a new object +func NewSchemaNumberWithFloat(f float64) *SchemaNumber { + result := &SchemaNumber{} + result.Float = &f + return result +} + +// SchemaOrBoolean represents a value that can be either a Schema or a Boolean. +type SchemaOrBoolean struct { + Schema *Schema + Boolean *bool +} + +// NewSchemaOrBooleanWithSchema creates and returns a new object +func NewSchemaOrBooleanWithSchema(s *Schema) *SchemaOrBoolean { + result := &SchemaOrBoolean{} + result.Schema = s + return result +} + +// NewSchemaOrBooleanWithBoolean creates and returns a new object +func NewSchemaOrBooleanWithBoolean(b bool) *SchemaOrBoolean { + result := &SchemaOrBoolean{} + result.Boolean = &b + return result +} + +// StringOrStringArray represents a value that can be either +// a String or an Array of Strings. +type StringOrStringArray struct { + String *string + StringArray *[]string +} + +// NewStringOrStringArrayWithString creates and returns a new object +func NewStringOrStringArrayWithString(s string) *StringOrStringArray { + result := &StringOrStringArray{} + result.String = &s + return result +} + +// NewStringOrStringArrayWithStringArray creates and returns a new object +func NewStringOrStringArrayWithStringArray(a []string) *StringOrStringArray { + result := &StringOrStringArray{} + result.StringArray = &a + return result +} + +// SchemaOrStringArray represents a value that can be either +// a Schema or an Array of Strings. +type SchemaOrStringArray struct { + Schema *Schema + StringArray *[]string +} + +// SchemaOrSchemaArray represents a value that can be either +// a Schema or an Array of Schemas. +type SchemaOrSchemaArray struct { + Schema *Schema + SchemaArray *[]*Schema +} + +// NewSchemaOrSchemaArrayWithSchema creates and returns a new object +func NewSchemaOrSchemaArrayWithSchema(s *Schema) *SchemaOrSchemaArray { + result := &SchemaOrSchemaArray{} + result.Schema = s + return result +} + +// NewSchemaOrSchemaArrayWithSchemaArray creates and returns a new object +func NewSchemaOrSchemaArrayWithSchemaArray(a []*Schema) *SchemaOrSchemaArray { + result := &SchemaOrSchemaArray{} + result.SchemaArray = &a + return result +} + +// SchemaEnumValue represents a value that can be part of an +// enumeration in a Schema. +type SchemaEnumValue struct { + String *string + Bool *bool +} + +// NamedSchema is a name-value pair that is used to emulate maps +// with ordered keys. +type NamedSchema struct { + Name string + Value *Schema +} + +// NewNamedSchema creates and returns a new object +func NewNamedSchema(name string, value *Schema) *NamedSchema { + return &NamedSchema{Name: name, Value: value} +} + +// NamedSchemaOrStringArray is a name-value pair that is used +// to emulate maps with ordered keys. +type NamedSchemaOrStringArray struct { + Name string + Value *SchemaOrStringArray +} + +// Access named subschemas by name + +func namedSchemaArrayElementWithName(array *[]*NamedSchema, name string) *Schema { + if array == nil { + return nil + } + for _, pair := range *array { + if pair.Name == name { + return pair.Value + } + } + return nil +} + +// PropertyWithName returns the selected element. +func (s *Schema) PropertyWithName(name string) *Schema { + return namedSchemaArrayElementWithName(s.Properties, name) +} + +// PatternPropertyWithName returns the selected element. +func (s *Schema) PatternPropertyWithName(name string) *Schema { + return namedSchemaArrayElementWithName(s.PatternProperties, name) +} + +// DefinitionWithName returns the selected element. +func (s *Schema) DefinitionWithName(name string) *Schema { + return namedSchemaArrayElementWithName(s.Definitions, name) +} + +// AddProperty adds a named property. +func (s *Schema) AddProperty(name string, property *Schema) { + *s.Properties = append(*s.Properties, NewNamedSchema(name, property)) +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/operations.go b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/operations.go new file mode 100644 index 000000000..ba8dd4a91 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/operations.go @@ -0,0 +1,394 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 jsonschema + +import ( + "fmt" + "log" + "strings" +) + +// +// OPERATIONS +// The following methods perform operations on Schemas. +// + +// IsEmpty returns true if no members of the Schema are specified. +func (schema *Schema) IsEmpty() bool { + return (schema.Schema == nil) && + (schema.ID == nil) && + (schema.MultipleOf == nil) && + (schema.Maximum == nil) && + (schema.ExclusiveMaximum == nil) && + (schema.Minimum == nil) && + (schema.ExclusiveMinimum == nil) && + (schema.MaxLength == nil) && + (schema.MinLength == nil) && + (schema.Pattern == nil) && + (schema.AdditionalItems == nil) && + (schema.Items == nil) && + (schema.MaxItems == nil) && + (schema.MinItems == nil) && + (schema.UniqueItems == nil) && + (schema.MaxProperties == nil) && + (schema.MinProperties == nil) && + (schema.Required == nil) && + (schema.AdditionalProperties == nil) && + (schema.Properties == nil) && + (schema.PatternProperties == nil) && + (schema.Dependencies == nil) && + (schema.Enumeration == nil) && + (schema.Type == nil) && + (schema.AllOf == nil) && + (schema.AnyOf == nil) && + (schema.OneOf == nil) && + (schema.Not == nil) && + (schema.Definitions == nil) && + (schema.Title == nil) && + (schema.Description == nil) && + (schema.Default == nil) && + (schema.Format == nil) && + (schema.Ref == nil) +} + +// IsEqual returns true if two schemas are equal. +func (schema *Schema) IsEqual(schema2 *Schema) bool { + return schema.String() == schema2.String() +} + +// SchemaOperation represents a function that can be applied to a Schema. +type SchemaOperation func(schema *Schema, context string) + +// Applies a specified function to a Schema and all of the Schemas that it contains. +func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) { + + if schema.AdditionalItems != nil { + s := schema.AdditionalItems.Schema + if s != nil { + s.applyToSchemas(operation, "AdditionalItems") + } + } + + if schema.Items != nil { + if schema.Items.SchemaArray != nil { + for _, s := range *(schema.Items.SchemaArray) { + s.applyToSchemas(operation, "Items.SchemaArray") + } + } else if schema.Items.Schema != nil { + schema.Items.Schema.applyToSchemas(operation, "Items.Schema") + } + } + + if schema.AdditionalProperties != nil { + s := schema.AdditionalProperties.Schema + if s != nil { + s.applyToSchemas(operation, "AdditionalProperties") + } + } + + if schema.Properties != nil { + for _, pair := range *(schema.Properties) { + s := pair.Value + s.applyToSchemas(operation, "Properties") + } + } + if schema.PatternProperties != nil { + for _, pair := range *(schema.PatternProperties) { + s := pair.Value + s.applyToSchemas(operation, "PatternProperties") + } + } + + if schema.Dependencies != nil { + for _, pair := range *(schema.Dependencies) { + schemaOrStringArray := pair.Value + s := schemaOrStringArray.Schema + if s != nil { + s.applyToSchemas(operation, "Dependencies") + } + } + } + + if schema.AllOf != nil { + for _, s := range *(schema.AllOf) { + s.applyToSchemas(operation, "AllOf") + } + } + if schema.AnyOf != nil { + for _, s := range *(schema.AnyOf) { + s.applyToSchemas(operation, "AnyOf") + } + } + if schema.OneOf != nil { + for _, s := range *(schema.OneOf) { + s.applyToSchemas(operation, "OneOf") + } + } + if schema.Not != nil { + schema.Not.applyToSchemas(operation, "Not") + } + + if schema.Definitions != nil { + for _, pair := range *(schema.Definitions) { + s := pair.Value + s.applyToSchemas(operation, "Definitions") + } + } + + operation(schema, context) +} + +// CopyProperties copies all non-nil properties from the source Schema to the schema Schema. +func (schema *Schema) CopyProperties(source *Schema) { + if source.Schema != nil { + schema.Schema = source.Schema + } + if source.ID != nil { + schema.ID = source.ID + } + if source.MultipleOf != nil { + schema.MultipleOf = source.MultipleOf + } + if source.Maximum != nil { + schema.Maximum = source.Maximum + } + if source.ExclusiveMaximum != nil { + schema.ExclusiveMaximum = source.ExclusiveMaximum + } + if source.Minimum != nil { + schema.Minimum = source.Minimum + } + if source.ExclusiveMinimum != nil { + schema.ExclusiveMinimum = source.ExclusiveMinimum + } + if source.MaxLength != nil { + schema.MaxLength = source.MaxLength + } + if source.MinLength != nil { + schema.MinLength = source.MinLength + } + if source.Pattern != nil { + schema.Pattern = source.Pattern + } + if source.AdditionalItems != nil { + schema.AdditionalItems = source.AdditionalItems + } + if source.Items != nil { + schema.Items = source.Items + } + if source.MaxItems != nil { + schema.MaxItems = source.MaxItems + } + if source.MinItems != nil { + schema.MinItems = source.MinItems + } + if source.UniqueItems != nil { + schema.UniqueItems = source.UniqueItems + } + if source.MaxProperties != nil { + schema.MaxProperties = source.MaxProperties + } + if source.MinProperties != nil { + schema.MinProperties = source.MinProperties + } + if source.Required != nil { + schema.Required = source.Required + } + if source.AdditionalProperties != nil { + schema.AdditionalProperties = source.AdditionalProperties + } + if source.Properties != nil { + schema.Properties = source.Properties + } + if source.PatternProperties != nil { + schema.PatternProperties = source.PatternProperties + } + if source.Dependencies != nil { + schema.Dependencies = source.Dependencies + } + if source.Enumeration != nil { + schema.Enumeration = source.Enumeration + } + if source.Type != nil { + schema.Type = source.Type + } + if source.AllOf != nil { + schema.AllOf = source.AllOf + } + if source.AnyOf != nil { + schema.AnyOf = source.AnyOf + } + if source.OneOf != nil { + schema.OneOf = source.OneOf + } + if source.Not != nil { + schema.Not = source.Not + } + if source.Definitions != nil { + schema.Definitions = source.Definitions + } + if source.Title != nil { + schema.Title = source.Title + } + if source.Description != nil { + schema.Description = source.Description + } + if source.Default != nil { + schema.Default = source.Default + } + if source.Format != nil { + schema.Format = source.Format + } + if source.Ref != nil { + schema.Ref = source.Ref + } +} + +// TypeIs returns true if the Type of a Schema includes the specified type +func (schema *Schema) TypeIs(typeName string) bool { + if schema.Type != nil { + // the schema Type is either a string or an array of strings + if schema.Type.String != nil { + return (*(schema.Type.String) == typeName) + } else if schema.Type.StringArray != nil { + for _, n := range *(schema.Type.StringArray) { + if n == typeName { + return true + } + } + } + } + return false +} + +// ResolveRefs resolves "$ref" elements in a Schema and its children. +// But if a reference refers to an object type, is inside a oneOf, or contains a oneOf, +// the reference is kept and we expect downstream tools to separately model these +// referenced schemas. +func (schema *Schema) ResolveRefs() { + rootSchema := schema + count := 1 + for count > 0 { + count = 0 + schema.applyToSchemas( + func(schema *Schema, context string) { + if schema.Ref != nil { + resolvedRef, err := rootSchema.resolveJSONPointer(*(schema.Ref)) + if err != nil { + log.Printf("%+v", err) + } else if resolvedRef.TypeIs("object") { + // don't substitute for objects, we'll model the referenced schema with a class + } else if context == "OneOf" { + // don't substitute for references inside oneOf declarations + } else if resolvedRef.OneOf != nil { + // don't substitute for references that contain oneOf declarations + } else if resolvedRef.AdditionalProperties != nil { + // don't substitute for references that look like objects + } else { + schema.Ref = nil + schema.CopyProperties(resolvedRef) + count++ + } + } + }, "") + } +} + +// resolveJSONPointer resolves JSON pointers. +// This current implementation is very crude and custom for OpenAPI 2.0 schemas. +// It panics for any pointer that it is unable to resolve. +func (schema *Schema) resolveJSONPointer(ref string) (result *Schema, err error) { + parts := strings.Split(ref, "#") + if len(parts) == 2 { + documentName := parts[0] + "#" + if documentName == "#" && schema.ID != nil { + documentName = *(schema.ID) + } + path := parts[1] + document := schemas[documentName] + pathParts := strings.Split(path, "/") + + // we currently do a very limited (hard-coded) resolution of certain paths and log errors for missed cases + if len(pathParts) == 1 { + return document, nil + } else if len(pathParts) == 3 { + switch pathParts[1] { + case "definitions": + dictionary := document.Definitions + for _, pair := range *dictionary { + if pair.Name == pathParts[2] { + result = pair.Value + } + } + case "properties": + dictionary := document.Properties + for _, pair := range *dictionary { + if pair.Name == pathParts[2] { + result = pair.Value + } + } + default: + break + } + } + } + if result == nil { + return nil, fmt.Errorf("unresolved pointer: %+v", ref) + } + return result, nil +} + +// ResolveAllOfs replaces "allOf" elements by merging their properties into the parent Schema. +func (schema *Schema) ResolveAllOfs() { + schema.applyToSchemas( + func(schema *Schema, context string) { + if schema.AllOf != nil { + for _, allOf := range *(schema.AllOf) { + schema.CopyProperties(allOf) + } + schema.AllOf = nil + } + }, "resolveAllOfs") +} + +// ResolveAnyOfs replaces all "anyOf" elements with "oneOf". +func (schema *Schema) ResolveAnyOfs() { + schema.applyToSchemas( + func(schema *Schema, context string) { + if schema.AnyOf != nil { + schema.OneOf = schema.AnyOf + schema.AnyOf = nil + } + }, "resolveAnyOfs") +} + +// return a pointer to a copy of a passed-in string +func stringptr(input string) (output *string) { + return &input +} + +// CopyOfficialSchemaProperty copies a named property from the official JSON Schema definition +func (schema *Schema) CopyOfficialSchemaProperty(name string) { + *schema.Properties = append(*schema.Properties, + NewNamedSchema(name, + &Schema{Ref: stringptr("http://json-schema.org/draft-04/schema#/properties/" + name)})) +} + +// CopyOfficialSchemaProperties copies named properties from the official JSON Schema definition +func (schema *Schema) CopyOfficialSchemaProperties(names []string) { + for _, name := range names { + schema.CopyOfficialSchemaProperty(name) + } +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/reader.go b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/reader.go new file mode 100644 index 000000000..b8583d466 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/reader.go @@ -0,0 +1,442 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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. + +//go:generate go run generate-base.go + +package jsonschema + +import ( + "fmt" + "io/ioutil" + "strconv" + + "gopkg.in/yaml.v3" +) + +// This is a global map of all known Schemas. +// It is initialized when the first Schema is created and inserted. +var schemas map[string]*Schema + +// NewBaseSchema builds a schema object from an embedded json representation. +func NewBaseSchema() (schema *Schema, err error) { + b, err := baseSchemaBytes() + if err != nil { + return nil, err + } + var node yaml.Node + err = yaml.Unmarshal(b, &node) + if err != nil { + return nil, err + } + return NewSchemaFromObject(&node), nil +} + +// NewSchemaFromFile reads a schema from a file. +// Currently this assumes that schemas are stored in the source distribution of this project. +func NewSchemaFromFile(filename string) (schema *Schema, err error) { + file, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + var node yaml.Node + err = yaml.Unmarshal(file, &node) + if err != nil { + return nil, err + } + return NewSchemaFromObject(&node), nil +} + +// NewSchemaFromObject constructs a schema from a parsed JSON object. +// Due to the complexity of the schema representation, this is a +// custom reader and not the standard Go JSON reader (encoding/json). +func NewSchemaFromObject(jsonData *yaml.Node) *Schema { + switch jsonData.Kind { + case yaml.DocumentNode: + return NewSchemaFromObject(jsonData.Content[0]) + case yaml.MappingNode: + schema := &Schema{} + + for i := 0; i < len(jsonData.Content); i += 2 { + k := jsonData.Content[i].Value + v := jsonData.Content[i+1] + + switch k { + case "$schema": + schema.Schema = schema.stringValue(v) + case "id": + schema.ID = schema.stringValue(v) + + case "multipleOf": + schema.MultipleOf = schema.numberValue(v) + case "maximum": + schema.Maximum = schema.numberValue(v) + case "exclusiveMaximum": + schema.ExclusiveMaximum = schema.boolValue(v) + case "minimum": + schema.Minimum = schema.numberValue(v) + case "exclusiveMinimum": + schema.ExclusiveMinimum = schema.boolValue(v) + + case "maxLength": + schema.MaxLength = schema.intValue(v) + case "minLength": + schema.MinLength = schema.intValue(v) + case "pattern": + schema.Pattern = schema.stringValue(v) + + case "additionalItems": + schema.AdditionalItems = schema.schemaOrBooleanValue(v) + case "items": + schema.Items = schema.schemaOrSchemaArrayValue(v) + case "maxItems": + schema.MaxItems = schema.intValue(v) + case "minItems": + schema.MinItems = schema.intValue(v) + case "uniqueItems": + schema.UniqueItems = schema.boolValue(v) + + case "maxProperties": + schema.MaxProperties = schema.intValue(v) + case "minProperties": + schema.MinProperties = schema.intValue(v) + case "required": + schema.Required = schema.arrayOfStringsValue(v) + case "additionalProperties": + schema.AdditionalProperties = schema.schemaOrBooleanValue(v) + case "properties": + schema.Properties = schema.mapOfSchemasValue(v) + case "patternProperties": + schema.PatternProperties = schema.mapOfSchemasValue(v) + case "dependencies": + schema.Dependencies = schema.mapOfSchemasOrStringArraysValue(v) + + case "enum": + schema.Enumeration = schema.arrayOfEnumValuesValue(v) + + case "type": + schema.Type = schema.stringOrStringArrayValue(v) + case "allOf": + schema.AllOf = schema.arrayOfSchemasValue(v) + case "anyOf": + schema.AnyOf = schema.arrayOfSchemasValue(v) + case "oneOf": + schema.OneOf = schema.arrayOfSchemasValue(v) + case "not": + schema.Not = NewSchemaFromObject(v) + case "definitions": + schema.Definitions = schema.mapOfSchemasValue(v) + + case "title": + schema.Title = schema.stringValue(v) + case "description": + schema.Description = schema.stringValue(v) + + case "default": + schema.Default = v + + case "format": + schema.Format = schema.stringValue(v) + case "$ref": + schema.Ref = schema.stringValue(v) + default: + fmt.Printf("UNSUPPORTED (%s)\n", k) + } + } + + // insert schema in global map + if schema.ID != nil { + if schemas == nil { + schemas = make(map[string]*Schema, 0) + } + schemas[*(schema.ID)] = schema + } + return schema + + default: + fmt.Printf("schemaValue: unexpected node %+v\n", jsonData) + return nil + } + + return nil +} + +// +// BUILDERS +// The following methods build elements of Schemas from interface{} values. +// Each returns nil if it is unable to build the desired element. +// + +// Gets the string value of an interface{} value if possible. +func (schema *Schema) stringValue(v *yaml.Node) *string { + switch v.Kind { + case yaml.ScalarNode: + return &v.Value + default: + fmt.Printf("stringValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets the numeric value of an interface{} value if possible. +func (schema *Schema) numberValue(v *yaml.Node) *SchemaNumber { + number := &SchemaNumber{} + switch v.Kind { + case yaml.ScalarNode: + switch v.Tag { + case "!!float": + v2, _ := strconv.ParseFloat(v.Value, 64) + number.Float = &v2 + return number + case "!!int": + v2, _ := strconv.ParseInt(v.Value, 10, 64) + number.Integer = &v2 + return number + default: + fmt.Printf("stringValue: unexpected node %+v\n", v) + } + default: + fmt.Printf("stringValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets the integer value of an interface{} value if possible. +func (schema *Schema) intValue(v *yaml.Node) *int64 { + switch v.Kind { + case yaml.ScalarNode: + switch v.Tag { + case "!!float": + v2, _ := strconv.ParseFloat(v.Value, 64) + v3 := int64(v2) + return &v3 + case "!!int": + v2, _ := strconv.ParseInt(v.Value, 10, 64) + return &v2 + default: + fmt.Printf("intValue: unexpected node %+v\n", v) + } + default: + fmt.Printf("intValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets the bool value of an interface{} value if possible. +func (schema *Schema) boolValue(v *yaml.Node) *bool { + switch v.Kind { + case yaml.ScalarNode: + switch v.Tag { + case "!!bool": + v2, _ := strconv.ParseBool(v.Value) + return &v2 + default: + fmt.Printf("boolValue: unexpected node %+v\n", v) + } + default: + fmt.Printf("boolValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets a map of Schemas from an interface{} value if possible. +func (schema *Schema) mapOfSchemasValue(v *yaml.Node) *[]*NamedSchema { + switch v.Kind { + case yaml.MappingNode: + m := make([]*NamedSchema, 0) + for i := 0; i < len(v.Content); i += 2 { + k2 := v.Content[i].Value + v2 := v.Content[i+1] + pair := &NamedSchema{Name: k2, Value: NewSchemaFromObject(v2)} + m = append(m, pair) + } + return &m + default: + fmt.Printf("mapOfSchemasValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets an array of Schemas from an interface{} value if possible. +func (schema *Schema) arrayOfSchemasValue(v *yaml.Node) *[]*Schema { + switch v.Kind { + case yaml.SequenceNode: + m := make([]*Schema, 0) + for _, v2 := range v.Content { + switch v2.Kind { + case yaml.MappingNode: + s := NewSchemaFromObject(v2) + m = append(m, s) + default: + fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v2) + } + } + return &m + case yaml.MappingNode: + m := make([]*Schema, 0) + s := NewSchemaFromObject(v) + m = append(m, s) + return &m + default: + fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets a Schema or an array of Schemas from an interface{} value if possible. +func (schema *Schema) schemaOrSchemaArrayValue(v *yaml.Node) *SchemaOrSchemaArray { + switch v.Kind { + case yaml.SequenceNode: + m := make([]*Schema, 0) + for _, v2 := range v.Content { + switch v2.Kind { + case yaml.MappingNode: + s := NewSchemaFromObject(v2) + m = append(m, s) + default: + fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v2) + } + } + return &SchemaOrSchemaArray{SchemaArray: &m} + case yaml.MappingNode: + s := NewSchemaFromObject(v) + return &SchemaOrSchemaArray{Schema: s} + default: + fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets an array of strings from an interface{} value if possible. +func (schema *Schema) arrayOfStringsValue(v *yaml.Node) *[]string { + switch v.Kind { + case yaml.ScalarNode: + a := []string{v.Value} + return &a + case yaml.SequenceNode: + a := make([]string, 0) + for _, v2 := range v.Content { + switch v2.Kind { + case yaml.ScalarNode: + a = append(a, v2.Value) + default: + fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2) + } + } + return &a + default: + fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets a string or an array of strings from an interface{} value if possible. +func (schema *Schema) stringOrStringArrayValue(v *yaml.Node) *StringOrStringArray { + switch v.Kind { + case yaml.ScalarNode: + s := &StringOrStringArray{} + s.String = &v.Value + return s + case yaml.SequenceNode: + a := make([]string, 0) + for _, v2 := range v.Content { + switch v2.Kind { + case yaml.ScalarNode: + a = append(a, v2.Value) + default: + fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2) + } + } + s := &StringOrStringArray{} + s.StringArray = &a + return s + default: + fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v) + } + return nil +} + +// Gets an array of enum values from an interface{} value if possible. +func (schema *Schema) arrayOfEnumValuesValue(v *yaml.Node) *[]SchemaEnumValue { + a := make([]SchemaEnumValue, 0) + switch v.Kind { + case yaml.SequenceNode: + for _, v2 := range v.Content { + switch v2.Kind { + case yaml.ScalarNode: + switch v2.Tag { + case "!!str": + a = append(a, SchemaEnumValue{String: &v2.Value}) + case "!!bool": + v3, _ := strconv.ParseBool(v2.Value) + a = append(a, SchemaEnumValue{Bool: &v3}) + default: + fmt.Printf("arrayOfEnumValuesValue: unexpected type %s\n", v2.Tag) + } + default: + fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v2) + } + } + default: + fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v) + } + return &a +} + +// Gets a map of schemas or string arrays from an interface{} value if possible. +func (schema *Schema) mapOfSchemasOrStringArraysValue(v *yaml.Node) *[]*NamedSchemaOrStringArray { + m := make([]*NamedSchemaOrStringArray, 0) + switch v.Kind { + case yaml.MappingNode: + for i := 0; i < len(v.Content); i += 2 { + k2 := v.Content[i].Value + v2 := v.Content[i+1] + switch v2.Kind { + case yaml.SequenceNode: + a := make([]string, 0) + for _, v3 := range v2.Content { + switch v3.Kind { + case yaml.ScalarNode: + a = append(a, v3.Value) + default: + fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v3) + } + } + s := &SchemaOrStringArray{} + s.StringArray = &a + pair := &NamedSchemaOrStringArray{Name: k2, Value: s} + m = append(m, pair) + default: + fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v2) + } + } + default: + fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v) + } + return &m +} + +// Gets a schema or a boolean value from an interface{} value if possible. +func (schema *Schema) schemaOrBooleanValue(v *yaml.Node) *SchemaOrBoolean { + schemaOrBoolean := &SchemaOrBoolean{} + switch v.Kind { + case yaml.ScalarNode: + v2, _ := strconv.ParseBool(v.Value) + schemaOrBoolean.Boolean = &v2 + case yaml.MappingNode: + schemaOrBoolean.Schema = NewSchemaFromObject(v) + default: + fmt.Printf("schemaOrBooleanValue: unexpected node %+v\n", v) + } + return schemaOrBoolean +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/schema.json b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/schema.json new file mode 100644 index 000000000..85eb502a6 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/schema.json @@ -0,0 +1,150 @@ +{ + "id": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "positiveInteger": { + "type": "integer", + "minimum": 0 + }, + "positiveIntegerDefault0": { + "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + }, + "simpleTypes": { + "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + } + }, + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "multipleOf": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { "$ref": "#/definitions/positiveInteger" }, + "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/positiveInteger" }, + "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { "$ref": "#/definitions/positiveInteger" }, + "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "dependencies": { + "exclusiveMaximum": [ "maximum" ], + "exclusiveMinimum": [ "minimum" ] + }, + "default": {} +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/writer.go b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/writer.go new file mode 100644 index 000000000..340dc5f93 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/jsonschema/writer.go @@ -0,0 +1,369 @@ +// Copyright 2017 Google LLC. All Rights Reserved. +// +// 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 jsonschema + +import ( + "fmt" + + "gopkg.in/yaml.v3" +) + +const indentation = " " + +func renderMappingNode(node *yaml.Node, indent string) (result string) { + result = "{\n" + innerIndent := indent + indentation + for i := 0; i < len(node.Content); i += 2 { + // first print the key + key := node.Content[i].Value + result += fmt.Sprintf("%s\"%+v\": ", innerIndent, key) + // then the value + value := node.Content[i+1] + switch value.Kind { + case yaml.ScalarNode: + result += "\"" + value.Value + "\"" + case yaml.MappingNode: + result += renderMappingNode(value, innerIndent) + case yaml.SequenceNode: + result += renderSequenceNode(value, innerIndent) + default: + result += fmt.Sprintf("???MapItem(Key:%+v, Value:%T)", value, value) + } + if i < len(node.Content)-2 { + result += "," + } + result += "\n" + } + + result += indent + "}" + return result +} + +func renderSequenceNode(node *yaml.Node, indent string) (result string) { + result = "[\n" + innerIndent := indent + indentation + for i := 0; i < len(node.Content); i++ { + item := node.Content[i] + switch item.Kind { + case yaml.ScalarNode: + result += innerIndent + "\"" + item.Value + "\"" + case yaml.MappingNode: + result += innerIndent + renderMappingNode(item, innerIndent) + "" + default: + result += innerIndent + fmt.Sprintf("???ArrayItem(%+v)", item) + } + if i < len(node.Content)-1 { + result += "," + } + result += "\n" + } + result += indent + "]" + return result +} + +func renderStringArray(array []string, indent string) (result string) { + result = "[\n" + innerIndent := indent + indentation + for i, item := range array { + result += innerIndent + "\"" + item + "\"" + if i < len(array)-1 { + result += "," + } + result += "\n" + } + result += indent + "]" + return result +} + +// Render renders a yaml.Node as JSON +func Render(node *yaml.Node) string { + if node.Kind == yaml.DocumentNode { + if len(node.Content) == 1 { + return Render(node.Content[0]) + } + } else if node.Kind == yaml.MappingNode { + return renderMappingNode(node, "") + "\n" + } else if node.Kind == yaml.SequenceNode { + return renderSequenceNode(node, "") + "\n" + } + return "" +} + +func (object *SchemaNumber) nodeValue() *yaml.Node { + if object.Integer != nil { + return nodeForInt64(*object.Integer) + } else if object.Float != nil { + return nodeForFloat64(*object.Float) + } else { + return nil + } +} + +func (object *SchemaOrBoolean) nodeValue() *yaml.Node { + if object.Schema != nil { + return object.Schema.nodeValue() + } else if object.Boolean != nil { + return nodeForBoolean(*object.Boolean) + } else { + return nil + } +} + +func nodeForStringArray(array []string) *yaml.Node { + content := make([]*yaml.Node, 0) + for _, item := range array { + content = append(content, nodeForString(item)) + } + return nodeForSequence(content) +} + +func nodeForSchemaArray(array []*Schema) *yaml.Node { + content := make([]*yaml.Node, 0) + for _, item := range array { + content = append(content, item.nodeValue()) + } + return nodeForSequence(content) +} + +func (object *StringOrStringArray) nodeValue() *yaml.Node { + if object.String != nil { + return nodeForString(*object.String) + } else if object.StringArray != nil { + return nodeForStringArray(*(object.StringArray)) + } else { + return nil + } +} + +func (object *SchemaOrStringArray) nodeValue() *yaml.Node { + if object.Schema != nil { + return object.Schema.nodeValue() + } else if object.StringArray != nil { + return nodeForStringArray(*(object.StringArray)) + } else { + return nil + } +} + +func (object *SchemaOrSchemaArray) nodeValue() *yaml.Node { + if object.Schema != nil { + return object.Schema.nodeValue() + } else if object.SchemaArray != nil { + return nodeForSchemaArray(*(object.SchemaArray)) + } else { + return nil + } +} + +func (object *SchemaEnumValue) nodeValue() *yaml.Node { + if object.String != nil { + return nodeForString(*object.String) + } else if object.Bool != nil { + return nodeForBoolean(*object.Bool) + } else { + return nil + } +} + +func nodeForNamedSchemaArray(array *[]*NamedSchema) *yaml.Node { + content := make([]*yaml.Node, 0) + for _, pair := range *(array) { + content = appendPair(content, pair.Name, pair.Value.nodeValue()) + } + return nodeForMapping(content) +} + +func nodeForNamedSchemaOrStringArray(array *[]*NamedSchemaOrStringArray) *yaml.Node { + content := make([]*yaml.Node, 0) + for _, pair := range *(array) { + content = appendPair(content, pair.Name, pair.Value.nodeValue()) + } + return nodeForMapping(content) +} + +func nodeForSchemaEnumArray(array *[]SchemaEnumValue) *yaml.Node { + content := make([]*yaml.Node, 0) + for _, item := range *array { + content = append(content, item.nodeValue()) + } + return nodeForSequence(content) +} + +func nodeForMapping(content []*yaml.Node) *yaml.Node { + return &yaml.Node{ + Kind: yaml.MappingNode, + Content: content, + } +} + +func nodeForSequence(content []*yaml.Node) *yaml.Node { + return &yaml.Node{ + Kind: yaml.SequenceNode, + Content: content, + } +} + +func nodeForString(value string) *yaml.Node { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!str", + Value: value, + } +} + +func nodeForBoolean(value bool) *yaml.Node { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!bool", + Value: fmt.Sprintf("%t", value), + } +} + +func nodeForInt64(value int64) *yaml.Node { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!int", + Value: fmt.Sprintf("%d", value), + } +} + +func nodeForFloat64(value float64) *yaml.Node { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Tag: "!!float", + Value: fmt.Sprintf("%f", value), + } +} + +func appendPair(nodes []*yaml.Node, name string, value *yaml.Node) []*yaml.Node { + nodes = append(nodes, nodeForString(name)) + nodes = append(nodes, value) + return nodes +} + +func (schema *Schema) nodeValue() *yaml.Node { + n := &yaml.Node{Kind: yaml.MappingNode} + content := make([]*yaml.Node, 0) + if schema.Title != nil { + content = appendPair(content, "title", nodeForString(*schema.Title)) + } + if schema.ID != nil { + content = appendPair(content, "id", nodeForString(*schema.ID)) + } + if schema.Schema != nil { + content = appendPair(content, "$schema", nodeForString(*schema.Schema)) + } + if schema.Type != nil { + content = appendPair(content, "type", schema.Type.nodeValue()) + } + if schema.Items != nil { + content = appendPair(content, "items", schema.Items.nodeValue()) + } + if schema.Description != nil { + content = appendPair(content, "description", nodeForString(*schema.Description)) + } + if schema.Required != nil { + content = appendPair(content, "required", nodeForStringArray(*schema.Required)) + } + if schema.AdditionalProperties != nil { + content = appendPair(content, "additionalProperties", schema.AdditionalProperties.nodeValue()) + } + if schema.PatternProperties != nil { + content = appendPair(content, "patternProperties", nodeForNamedSchemaArray(schema.PatternProperties)) + } + if schema.Properties != nil { + content = appendPair(content, "properties", nodeForNamedSchemaArray(schema.Properties)) + } + if schema.Dependencies != nil { + content = appendPair(content, "dependencies", nodeForNamedSchemaOrStringArray(schema.Dependencies)) + } + if schema.Ref != nil { + content = appendPair(content, "$ref", nodeForString(*schema.Ref)) + } + if schema.MultipleOf != nil { + content = appendPair(content, "multipleOf", schema.MultipleOf.nodeValue()) + } + if schema.Maximum != nil { + content = appendPair(content, "maximum", schema.Maximum.nodeValue()) + } + if schema.ExclusiveMaximum != nil { + content = appendPair(content, "exclusiveMaximum", nodeForBoolean(*schema.ExclusiveMaximum)) + } + if schema.Minimum != nil { + content = appendPair(content, "minimum", schema.Minimum.nodeValue()) + } + if schema.ExclusiveMinimum != nil { + content = appendPair(content, "exclusiveMinimum", nodeForBoolean(*schema.ExclusiveMinimum)) + } + if schema.MaxLength != nil { + content = appendPair(content, "maxLength", nodeForInt64(*schema.MaxLength)) + } + if schema.MinLength != nil { + content = appendPair(content, "minLength", nodeForInt64(*schema.MinLength)) + } + if schema.Pattern != nil { + content = appendPair(content, "pattern", nodeForString(*schema.Pattern)) + } + if schema.AdditionalItems != nil { + content = appendPair(content, "additionalItems", schema.AdditionalItems.nodeValue()) + } + if schema.MaxItems != nil { + content = appendPair(content, "maxItems", nodeForInt64(*schema.MaxItems)) + } + if schema.MinItems != nil { + content = appendPair(content, "minItems", nodeForInt64(*schema.MinItems)) + } + if schema.UniqueItems != nil { + content = appendPair(content, "uniqueItems", nodeForBoolean(*schema.UniqueItems)) + } + if schema.MaxProperties != nil { + content = appendPair(content, "maxProperties", nodeForInt64(*schema.MaxProperties)) + } + if schema.MinProperties != nil { + content = appendPair(content, "minProperties", nodeForInt64(*schema.MinProperties)) + } + if schema.Enumeration != nil { + content = appendPair(content, "enum", nodeForSchemaEnumArray(schema.Enumeration)) + } + if schema.AllOf != nil { + content = appendPair(content, "allOf", nodeForSchemaArray(*schema.AllOf)) + } + if schema.AnyOf != nil { + content = appendPair(content, "anyOf", nodeForSchemaArray(*schema.AnyOf)) + } + if schema.OneOf != nil { + content = appendPair(content, "oneOf", nodeForSchemaArray(*schema.OneOf)) + } + if schema.Not != nil { + content = appendPair(content, "not", schema.Not.nodeValue()) + } + if schema.Definitions != nil { + content = appendPair(content, "definitions", nodeForNamedSchemaArray(schema.Definitions)) + } + if schema.Default != nil { + // m = append(m, yaml.MapItem{Key: "default", Value: *schema.Default}) + } + if schema.Format != nil { + content = appendPair(content, "format", nodeForString(*schema.Format)) + } + n.Content = content + return n +} + +// JSONString returns a json representation of a schema. +func (schema *Schema) JSONString() string { + node := schema.nodeValue() + return Render(node) +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.go b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.go new file mode 100644 index 000000000..727d7f4ad --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.go @@ -0,0 +1,8818 @@ +// Copyright 2020 Google LLC. All Rights Reserved. +// +// 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. + +// THIS FILE IS AUTOMATICALLY GENERATED. + +package openapi_v2 + +import ( + "fmt" + "github.com/googleapis/gnostic/compiler" + "gopkg.in/yaml.v3" + "regexp" + "strings" +) + +// Version returns the package name (and OpenAPI version). +func Version() string { + return "openapi_v2" +} + +// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not. +func NewAdditionalPropertiesItem(in *yaml.Node, context *compiler.Context) (*AdditionalPropertiesItem, error) { + errors := make([]error, 0) + x := &AdditionalPropertiesItem{} + matched := false + // Schema schema = 1; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context)) + if matchingError == nil { + x.Oneof = &AdditionalPropertiesItem_Schema{Schema: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // bool boolean = 2; + boolValue, ok := compiler.BoolForScalarNode(in) + if ok { + x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue} + matched = true + } + if matched { + // since the oneof matched one of its possibilities, discard any matching errors + errors = make([]error, 0) + } else { + message := fmt.Sprintf("contains an invalid AdditionalPropertiesItem") + err := compiler.NewError(context, message) + errors = []error{err} + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewAny creates an object of type Any if possible, returning an error if not. +func NewAny(in *yaml.Node, context *compiler.Context) (*Any, error) { + errors := make([]error, 0) + x := &Any{} + bytes := compiler.Marshal(in) + x.Yaml = string(bytes) + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewApiKeySecurity creates an object of type ApiKeySecurity if possible, returning an error if not. +func NewApiKeySecurity(in *yaml.Node, context *compiler.Context) (*ApiKeySecurity, error) { + errors := make([]error, 0) + x := &ApiKeySecurity{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"in", "name", "type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"description", "in", "name", "type"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string type = 1; + v1 := compiler.MapValueForKey(m, "type") + if v1 != nil { + x.Type, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [apiKey] + if ok && !compiler.StringArrayContainsValue([]string{"apiKey"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string name = 2; + v2 := compiler.MapValueForKey(m, "name") + if v2 != nil { + x.Name, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string in = 3; + v3 := compiler.MapValueForKey(m, "in") + if v3 != nil { + x.In, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [header query] + if ok && !compiler.StringArrayContainsValue([]string{"header", "query"}, x.In) { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 4; + v4 := compiler.MapValueForKey(m, "description") + if v4 != nil { + x.Description, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 5; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewBasicAuthenticationSecurity creates an object of type BasicAuthenticationSecurity if possible, returning an error if not. +func NewBasicAuthenticationSecurity(in *yaml.Node, context *compiler.Context) (*BasicAuthenticationSecurity, error) { + errors := make([]error, 0) + x := &BasicAuthenticationSecurity{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"description", "type"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string type = 1; + v1 := compiler.MapValueForKey(m, "type") + if v1 != nil { + x.Type, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [basic] + if ok && !compiler.StringArrayContainsValue([]string{"basic"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 2; + v2 := compiler.MapValueForKey(m, "description") + if v2 != nil { + x.Description, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 3; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewBodyParameter creates an object of type BodyParameter if possible, returning an error if not. +func NewBodyParameter(in *yaml.Node, context *compiler.Context) (*BodyParameter, error) { + errors := make([]error, 0) + x := &BodyParameter{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"in", "name", "schema"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"description", "in", "name", "required", "schema"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string description = 1; + v1 := compiler.MapValueForKey(m, "description") + if v1 != nil { + x.Description, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string name = 2; + v2 := compiler.MapValueForKey(m, "name") + if v2 != nil { + x.Name, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string in = 3; + v3 := compiler.MapValueForKey(m, "in") + if v3 != nil { + x.In, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [body] + if ok && !compiler.StringArrayContainsValue([]string{"body"}, x.In) { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool required = 4; + v4 := compiler.MapValueForKey(m, "required") + if v4 != nil { + x.Required, ok = compiler.BoolForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Schema schema = 5; + v5 := compiler.MapValueForKey(m, "schema") + if v5 != nil { + var err error + x.Schema, err = NewSchema(v5, compiler.NewContext("schema", v5, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated NamedAny vendor_extension = 6; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewContact creates an object of type Contact if possible, returning an error if not. +func NewContact(in *yaml.Node, context *compiler.Context) (*Contact, error) { + errors := make([]error, 0) + x := &Contact{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"email", "name", "url"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string url = 2; + v2 := compiler.MapValueForKey(m, "url") + if v2 != nil { + x.Url, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string email = 3; + v3 := compiler.MapValueForKey(m, "email") + if v3 != nil { + x.Email, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for email: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 4; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewDefault creates an object of type Default if possible, returning an error if not. +func NewDefault(in *yaml.Node, context *compiler.Context) (*Default, error) { + errors := make([]error, 0) + x := &Default{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedAny additional_properties = 1; + // MAP: Any + x.AdditionalProperties = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewDefinitions creates an object of type Definitions if possible, returning an error if not. +func NewDefinitions(in *yaml.Node, context *compiler.Context) (*Definitions, error) { + errors := make([]error, 0) + x := &Definitions{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedSchema additional_properties = 1; + // MAP: Schema + x.AdditionalProperties = make([]*NamedSchema, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedSchema{} + pair.Name = k + var err error + pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewDocument creates an object of type Document if possible, returning an error if not. +func NewDocument(in *yaml.Node, context *compiler.Context) (*Document, error) { + errors := make([]error, 0) + x := &Document{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"info", "paths", "swagger"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"basePath", "consumes", "definitions", "externalDocs", "host", "info", "parameters", "paths", "produces", "responses", "schemes", "security", "securityDefinitions", "swagger", "tags"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string swagger = 1; + v1 := compiler.MapValueForKey(m, "swagger") + if v1 != nil { + x.Swagger, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [2.0] + if ok && !compiler.StringArrayContainsValue([]string{"2.0"}, x.Swagger) { + message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Info info = 2; + v2 := compiler.MapValueForKey(m, "info") + if v2 != nil { + var err error + x.Info, err = NewInfo(v2, compiler.NewContext("info", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + // string host = 3; + v3 := compiler.MapValueForKey(m, "host") + if v3 != nil { + x.Host, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for host: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string base_path = 4; + v4 := compiler.MapValueForKey(m, "basePath") + if v4 != nil { + x.BasePath, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for basePath: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated string schemes = 5; + v5 := compiler.MapValueForKey(m, "schemes") + if v5 != nil { + v, ok := compiler.SequenceNodeForNode(v5) + if ok { + x.Schemes = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [http https ws wss] + if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) { + message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated string consumes = 6; + v6 := compiler.MapValueForKey(m, "consumes") + if v6 != nil { + v, ok := compiler.SequenceNodeForNode(v6) + if ok { + x.Consumes = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated string produces = 7; + v7 := compiler.MapValueForKey(m, "produces") + if v7 != nil { + v, ok := compiler.SequenceNodeForNode(v7) + if ok { + x.Produces = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v7)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Paths paths = 8; + v8 := compiler.MapValueForKey(m, "paths") + if v8 != nil { + var err error + x.Paths, err = NewPaths(v8, compiler.NewContext("paths", v8, context)) + if err != nil { + errors = append(errors, err) + } + } + // Definitions definitions = 9; + v9 := compiler.MapValueForKey(m, "definitions") + if v9 != nil { + var err error + x.Definitions, err = NewDefinitions(v9, compiler.NewContext("definitions", v9, context)) + if err != nil { + errors = append(errors, err) + } + } + // ParameterDefinitions parameters = 10; + v10 := compiler.MapValueForKey(m, "parameters") + if v10 != nil { + var err error + x.Parameters, err = NewParameterDefinitions(v10, compiler.NewContext("parameters", v10, context)) + if err != nil { + errors = append(errors, err) + } + } + // ResponseDefinitions responses = 11; + v11 := compiler.MapValueForKey(m, "responses") + if v11 != nil { + var err error + x.Responses, err = NewResponseDefinitions(v11, compiler.NewContext("responses", v11, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated SecurityRequirement security = 12; + v12 := compiler.MapValueForKey(m, "security") + if v12 != nil { + // repeated SecurityRequirement + x.Security = make([]*SecurityRequirement, 0) + a, ok := compiler.SequenceNodeForNode(v12) + if ok { + for _, item := range a.Content { + y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Security = append(x.Security, y) + } + } + } + // SecurityDefinitions security_definitions = 13; + v13 := compiler.MapValueForKey(m, "securityDefinitions") + if v13 != nil { + var err error + x.SecurityDefinitions, err = NewSecurityDefinitions(v13, compiler.NewContext("securityDefinitions", v13, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated Tag tags = 14; + v14 := compiler.MapValueForKey(m, "tags") + if v14 != nil { + // repeated Tag + x.Tags = make([]*Tag, 0) + a, ok := compiler.SequenceNodeForNode(v14) + if ok { + for _, item := range a.Content { + y, err := NewTag(item, compiler.NewContext("tags", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Tags = append(x.Tags, y) + } + } + } + // ExternalDocs external_docs = 15; + v15 := compiler.MapValueForKey(m, "externalDocs") + if v15 != nil { + var err error + x.ExternalDocs, err = NewExternalDocs(v15, compiler.NewContext("externalDocs", v15, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated NamedAny vendor_extension = 16; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewExamples creates an object of type Examples if possible, returning an error if not. +func NewExamples(in *yaml.Node, context *compiler.Context) (*Examples, error) { + errors := make([]error, 0) + x := &Examples{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedAny additional_properties = 1; + // MAP: Any + x.AdditionalProperties = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewExternalDocs creates an object of type ExternalDocs if possible, returning an error if not. +func NewExternalDocs(in *yaml.Node, context *compiler.Context) (*ExternalDocs, error) { + errors := make([]error, 0) + x := &ExternalDocs{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"url"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"description", "url"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string description = 1; + v1 := compiler.MapValueForKey(m, "description") + if v1 != nil { + x.Description, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string url = 2; + v2 := compiler.MapValueForKey(m, "url") + if v2 != nil { + x.Url, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 3; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewFileSchema creates an object of type FileSchema if possible, returning an error if not. +func NewFileSchema(in *yaml.Node, context *compiler.Context) (*FileSchema, error) { + errors := make([]error, 0) + x := &FileSchema{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"default", "description", "example", "externalDocs", "format", "readOnly", "required", "title", "type"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string format = 1; + v1 := compiler.MapValueForKey(m, "format") + if v1 != nil { + x.Format, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string title = 2; + v2 := compiler.MapValueForKey(m, "title") + if v2 != nil { + x.Title, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 3; + v3 := compiler.MapValueForKey(m, "description") + if v3 != nil { + x.Description, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any default = 4; + v4 := compiler.MapValueForKey(m, "default") + if v4 != nil { + var err error + x.Default, err = NewAny(v4, compiler.NewContext("default", v4, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated string required = 5; + v5 := compiler.MapValueForKey(m, "required") + if v5 != nil { + v, ok := compiler.SequenceNodeForNode(v5) + if ok { + x.Required = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string type = 6; + v6 := compiler.MapValueForKey(m, "type") + if v6 != nil { + x.Type, ok = compiler.StringForScalarNode(v6) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [file] + if ok && !compiler.StringArrayContainsValue([]string{"file"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool read_only = 7; + v7 := compiler.MapValueForKey(m, "readOnly") + if v7 != nil { + x.ReadOnly, ok = compiler.BoolForScalarNode(v7) + if !ok { + message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v7)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // ExternalDocs external_docs = 8; + v8 := compiler.MapValueForKey(m, "externalDocs") + if v8 != nil { + var err error + x.ExternalDocs, err = NewExternalDocs(v8, compiler.NewContext("externalDocs", v8, context)) + if err != nil { + errors = append(errors, err) + } + } + // Any example = 9; + v9 := compiler.MapValueForKey(m, "example") + if v9 != nil { + var err error + x.Example, err = NewAny(v9, compiler.NewContext("example", v9, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated NamedAny vendor_extension = 10; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewFormDataParameterSubSchema creates an object of type FormDataParameterSubSchema if possible, returning an error if not. +func NewFormDataParameterSubSchema(in *yaml.Node, context *compiler.Context) (*FormDataParameterSubSchema, error) { + errors := make([]error, 0) + x := &FormDataParameterSubSchema{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // bool required = 1; + v1 := compiler.MapValueForKey(m, "required") + if v1 != nil { + x.Required, ok = compiler.BoolForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string in = 2; + v2 := compiler.MapValueForKey(m, "in") + if v2 != nil { + x.In, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [formData] + if ok && !compiler.StringArrayContainsValue([]string{"formData"}, x.In) { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 3; + v3 := compiler.MapValueForKey(m, "description") + if v3 != nil { + x.Description, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string name = 4; + v4 := compiler.MapValueForKey(m, "name") + if v4 != nil { + x.Name, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool allow_empty_value = 5; + v5 := compiler.MapValueForKey(m, "allowEmptyValue") + if v5 != nil { + x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string type = 6; + v6 := compiler.MapValueForKey(m, "type") + if v6 != nil { + x.Type, ok = compiler.StringForScalarNode(v6) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [string number boolean integer array file] + if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array", "file"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string format = 7; + v7 := compiler.MapValueForKey(m, "format") + if v7 != nil { + x.Format, ok = compiler.StringForScalarNode(v7) + if !ok { + message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // PrimitivesItems items = 8; + v8 := compiler.MapValueForKey(m, "items") + if v8 != nil { + var err error + x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context)) + if err != nil { + errors = append(errors, err) + } + } + // string collection_format = 9; + v9 := compiler.MapValueForKey(m, "collectionFormat") + if v9 != nil { + x.CollectionFormat, ok = compiler.StringForScalarNode(v9) + if !ok { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [csv ssv tsv pipes multi] + if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any default = 10; + v10 := compiler.MapValueForKey(m, "default") + if v10 != nil { + var err error + x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context)) + if err != nil { + errors = append(errors, err) + } + } + // float maximum = 11; + v11 := compiler.MapValueForKey(m, "maximum") + if v11 != nil { + v, ok := compiler.FloatForScalarNode(v11) + if ok { + x.Maximum = v + } else { + message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_maximum = 12; + v12 := compiler.MapValueForKey(m, "exclusiveMaximum") + if v12 != nil { + x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // float minimum = 13; + v13 := compiler.MapValueForKey(m, "minimum") + if v13 != nil { + v, ok := compiler.FloatForScalarNode(v13) + if ok { + x.Minimum = v + } else { + message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_minimum = 14; + v14 := compiler.MapValueForKey(m, "exclusiveMinimum") + if v14 != nil { + x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_length = 15; + v15 := compiler.MapValueForKey(m, "maxLength") + if v15 != nil { + t, ok := compiler.IntForScalarNode(v15) + if ok { + x.MaxLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_length = 16; + v16 := compiler.MapValueForKey(m, "minLength") + if v16 != nil { + t, ok := compiler.IntForScalarNode(v16) + if ok { + x.MinLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string pattern = 17; + v17 := compiler.MapValueForKey(m, "pattern") + if v17 != nil { + x.Pattern, ok = compiler.StringForScalarNode(v17) + if !ok { + message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_items = 18; + v18 := compiler.MapValueForKey(m, "maxItems") + if v18 != nil { + t, ok := compiler.IntForScalarNode(v18) + if ok { + x.MaxItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_items = 19; + v19 := compiler.MapValueForKey(m, "minItems") + if v19 != nil { + t, ok := compiler.IntForScalarNode(v19) + if ok { + x.MinItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool unique_items = 20; + v20 := compiler.MapValueForKey(m, "uniqueItems") + if v20 != nil { + x.UniqueItems, ok = compiler.BoolForScalarNode(v20) + if !ok { + message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated Any enum = 21; + v21 := compiler.MapValueForKey(m, "enum") + if v21 != nil { + // repeated Any + x.Enum = make([]*Any, 0) + a, ok := compiler.SequenceNodeForNode(v21) + if ok { + for _, item := range a.Content { + y, err := NewAny(item, compiler.NewContext("enum", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Enum = append(x.Enum, y) + } + } + } + // float multiple_of = 22; + v22 := compiler.MapValueForKey(m, "multipleOf") + if v22 != nil { + v, ok := compiler.FloatForScalarNode(v22) + if ok { + x.MultipleOf = v + } else { + message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 23; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewHeader creates an object of type Header if possible, returning an error if not. +func NewHeader(in *yaml.Node, context *compiler.Context) (*Header, error) { + errors := make([]error, 0) + x := &Header{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string type = 1; + v1 := compiler.MapValueForKey(m, "type") + if v1 != nil { + x.Type, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [string number integer boolean array] + if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string format = 2; + v2 := compiler.MapValueForKey(m, "format") + if v2 != nil { + x.Format, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // PrimitivesItems items = 3; + v3 := compiler.MapValueForKey(m, "items") + if v3 != nil { + var err error + x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // string collection_format = 4; + v4 := compiler.MapValueForKey(m, "collectionFormat") + if v4 != nil { + x.CollectionFormat, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [csv ssv tsv pipes] + if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any default = 5; + v5 := compiler.MapValueForKey(m, "default") + if v5 != nil { + var err error + x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) + if err != nil { + errors = append(errors, err) + } + } + // float maximum = 6; + v6 := compiler.MapValueForKey(m, "maximum") + if v6 != nil { + v, ok := compiler.FloatForScalarNode(v6) + if ok { + x.Maximum = v + } else { + message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_maximum = 7; + v7 := compiler.MapValueForKey(m, "exclusiveMaximum") + if v7 != nil { + x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // float minimum = 8; + v8 := compiler.MapValueForKey(m, "minimum") + if v8 != nil { + v, ok := compiler.FloatForScalarNode(v8) + if ok { + x.Minimum = v + } else { + message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_minimum = 9; + v9 := compiler.MapValueForKey(m, "exclusiveMinimum") + if v9 != nil { + x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_length = 10; + v10 := compiler.MapValueForKey(m, "maxLength") + if v10 != nil { + t, ok := compiler.IntForScalarNode(v10) + if ok { + x.MaxLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_length = 11; + v11 := compiler.MapValueForKey(m, "minLength") + if v11 != nil { + t, ok := compiler.IntForScalarNode(v11) + if ok { + x.MinLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string pattern = 12; + v12 := compiler.MapValueForKey(m, "pattern") + if v12 != nil { + x.Pattern, ok = compiler.StringForScalarNode(v12) + if !ok { + message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_items = 13; + v13 := compiler.MapValueForKey(m, "maxItems") + if v13 != nil { + t, ok := compiler.IntForScalarNode(v13) + if ok { + x.MaxItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_items = 14; + v14 := compiler.MapValueForKey(m, "minItems") + if v14 != nil { + t, ok := compiler.IntForScalarNode(v14) + if ok { + x.MinItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool unique_items = 15; + v15 := compiler.MapValueForKey(m, "uniqueItems") + if v15 != nil { + x.UniqueItems, ok = compiler.BoolForScalarNode(v15) + if !ok { + message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated Any enum = 16; + v16 := compiler.MapValueForKey(m, "enum") + if v16 != nil { + // repeated Any + x.Enum = make([]*Any, 0) + a, ok := compiler.SequenceNodeForNode(v16) + if ok { + for _, item := range a.Content { + y, err := NewAny(item, compiler.NewContext("enum", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Enum = append(x.Enum, y) + } + } + } + // float multiple_of = 17; + v17 := compiler.MapValueForKey(m, "multipleOf") + if v17 != nil { + v, ok := compiler.FloatForScalarNode(v17) + if ok { + x.MultipleOf = v + } else { + message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 18; + v18 := compiler.MapValueForKey(m, "description") + if v18 != nil { + x.Description, ok = compiler.StringForScalarNode(v18) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v18)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 19; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewHeaderParameterSubSchema creates an object of type HeaderParameterSubSchema if possible, returning an error if not. +func NewHeaderParameterSubSchema(in *yaml.Node, context *compiler.Context) (*HeaderParameterSubSchema, error) { + errors := make([]error, 0) + x := &HeaderParameterSubSchema{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // bool required = 1; + v1 := compiler.MapValueForKey(m, "required") + if v1 != nil { + x.Required, ok = compiler.BoolForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string in = 2; + v2 := compiler.MapValueForKey(m, "in") + if v2 != nil { + x.In, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [header] + if ok && !compiler.StringArrayContainsValue([]string{"header"}, x.In) { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 3; + v3 := compiler.MapValueForKey(m, "description") + if v3 != nil { + x.Description, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string name = 4; + v4 := compiler.MapValueForKey(m, "name") + if v4 != nil { + x.Name, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string type = 5; + v5 := compiler.MapValueForKey(m, "type") + if v5 != nil { + x.Type, ok = compiler.StringForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [string number boolean integer array] + if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string format = 6; + v6 := compiler.MapValueForKey(m, "format") + if v6 != nil { + x.Format, ok = compiler.StringForScalarNode(v6) + if !ok { + message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // PrimitivesItems items = 7; + v7 := compiler.MapValueForKey(m, "items") + if v7 != nil { + var err error + x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context)) + if err != nil { + errors = append(errors, err) + } + } + // string collection_format = 8; + v8 := compiler.MapValueForKey(m, "collectionFormat") + if v8 != nil { + x.CollectionFormat, ok = compiler.StringForScalarNode(v8) + if !ok { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [csv ssv tsv pipes] + if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any default = 9; + v9 := compiler.MapValueForKey(m, "default") + if v9 != nil { + var err error + x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context)) + if err != nil { + errors = append(errors, err) + } + } + // float maximum = 10; + v10 := compiler.MapValueForKey(m, "maximum") + if v10 != nil { + v, ok := compiler.FloatForScalarNode(v10) + if ok { + x.Maximum = v + } else { + message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_maximum = 11; + v11 := compiler.MapValueForKey(m, "exclusiveMaximum") + if v11 != nil { + x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // float minimum = 12; + v12 := compiler.MapValueForKey(m, "minimum") + if v12 != nil { + v, ok := compiler.FloatForScalarNode(v12) + if ok { + x.Minimum = v + } else { + message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_minimum = 13; + v13 := compiler.MapValueForKey(m, "exclusiveMinimum") + if v13 != nil { + x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_length = 14; + v14 := compiler.MapValueForKey(m, "maxLength") + if v14 != nil { + t, ok := compiler.IntForScalarNode(v14) + if ok { + x.MaxLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_length = 15; + v15 := compiler.MapValueForKey(m, "minLength") + if v15 != nil { + t, ok := compiler.IntForScalarNode(v15) + if ok { + x.MinLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string pattern = 16; + v16 := compiler.MapValueForKey(m, "pattern") + if v16 != nil { + x.Pattern, ok = compiler.StringForScalarNode(v16) + if !ok { + message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_items = 17; + v17 := compiler.MapValueForKey(m, "maxItems") + if v17 != nil { + t, ok := compiler.IntForScalarNode(v17) + if ok { + x.MaxItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_items = 18; + v18 := compiler.MapValueForKey(m, "minItems") + if v18 != nil { + t, ok := compiler.IntForScalarNode(v18) + if ok { + x.MinItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool unique_items = 19; + v19 := compiler.MapValueForKey(m, "uniqueItems") + if v19 != nil { + x.UniqueItems, ok = compiler.BoolForScalarNode(v19) + if !ok { + message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated Any enum = 20; + v20 := compiler.MapValueForKey(m, "enum") + if v20 != nil { + // repeated Any + x.Enum = make([]*Any, 0) + a, ok := compiler.SequenceNodeForNode(v20) + if ok { + for _, item := range a.Content { + y, err := NewAny(item, compiler.NewContext("enum", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Enum = append(x.Enum, y) + } + } + } + // float multiple_of = 21; + v21 := compiler.MapValueForKey(m, "multipleOf") + if v21 != nil { + v, ok := compiler.FloatForScalarNode(v21) + if ok { + x.MultipleOf = v + } else { + message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 22; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewHeaders creates an object of type Headers if possible, returning an error if not. +func NewHeaders(in *yaml.Node, context *compiler.Context) (*Headers, error) { + errors := make([]error, 0) + x := &Headers{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedHeader additional_properties = 1; + // MAP: Header + x.AdditionalProperties = make([]*NamedHeader, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedHeader{} + pair.Name = k + var err error + pair.Value, err = NewHeader(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewInfo creates an object of type Info if possible, returning an error if not. +func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) { + errors := make([]error, 0) + x := &Info{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"title", "version"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"contact", "description", "license", "termsOfService", "title", "version"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string title = 1; + v1 := compiler.MapValueForKey(m, "title") + if v1 != nil { + x.Title, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string version = 2; + v2 := compiler.MapValueForKey(m, "version") + if v2 != nil { + x.Version, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for version: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 3; + v3 := compiler.MapValueForKey(m, "description") + if v3 != nil { + x.Description, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string terms_of_service = 4; + v4 := compiler.MapValueForKey(m, "termsOfService") + if v4 != nil { + x.TermsOfService, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for termsOfService: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Contact contact = 5; + v5 := compiler.MapValueForKey(m, "contact") + if v5 != nil { + var err error + x.Contact, err = NewContact(v5, compiler.NewContext("contact", v5, context)) + if err != nil { + errors = append(errors, err) + } + } + // License license = 6; + v6 := compiler.MapValueForKey(m, "license") + if v6 != nil { + var err error + x.License, err = NewLicense(v6, compiler.NewContext("license", v6, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated NamedAny vendor_extension = 7; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not. +func NewItemsItem(in *yaml.Node, context *compiler.Context) (*ItemsItem, error) { + errors := make([]error, 0) + x := &ItemsItem{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + x.Schema = make([]*Schema, 0) + y, err := NewSchema(m, compiler.NewContext("", m, context)) + if err != nil { + return nil, err + } + x.Schema = append(x.Schema, y) + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewJsonReference creates an object of type JsonReference if possible, returning an error if not. +func NewJsonReference(in *yaml.Node, context *compiler.Context) (*JsonReference, error) { + errors := make([]error, 0) + x := &JsonReference{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"$ref"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string _ref = 1; + v1 := compiler.MapValueForKey(m, "$ref") + if v1 != nil { + x.XRef, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 2; + v2 := compiler.MapValueForKey(m, "description") + if v2 != nil { + x.Description, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewLicense creates an object of type License if possible, returning an error if not. +func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) { + errors := make([]error, 0) + x := &License{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"name"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"name", "url"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string url = 2; + v2 := compiler.MapValueForKey(m, "url") + if v2 != nil { + x.Url, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 3; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedAny creates an object of type NamedAny if possible, returning an error if not. +func NewNamedAny(in *yaml.Node, context *compiler.Context) (*NamedAny, error) { + errors := make([]error, 0) + x := &NamedAny{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewAny(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedHeader creates an object of type NamedHeader if possible, returning an error if not. +func NewNamedHeader(in *yaml.Node, context *compiler.Context) (*NamedHeader, error) { + errors := make([]error, 0) + x := &NamedHeader{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Header value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewHeader(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedParameter creates an object of type NamedParameter if possible, returning an error if not. +func NewNamedParameter(in *yaml.Node, context *compiler.Context) (*NamedParameter, error) { + errors := make([]error, 0) + x := &NamedParameter{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Parameter value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewParameter(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not. +func NewNamedPathItem(in *yaml.Node, context *compiler.Context) (*NamedPathItem, error) { + errors := make([]error, 0) + x := &NamedPathItem{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // PathItem value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewPathItem(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedResponse creates an object of type NamedResponse if possible, returning an error if not. +func NewNamedResponse(in *yaml.Node, context *compiler.Context) (*NamedResponse, error) { + errors := make([]error, 0) + x := &NamedResponse{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Response value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewResponse(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedResponseValue creates an object of type NamedResponseValue if possible, returning an error if not. +func NewNamedResponseValue(in *yaml.Node, context *compiler.Context) (*NamedResponseValue, error) { + errors := make([]error, 0) + x := &NamedResponseValue{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // ResponseValue value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewResponseValue(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedSchema creates an object of type NamedSchema if possible, returning an error if not. +func NewNamedSchema(in *yaml.Node, context *compiler.Context) (*NamedSchema, error) { + errors := make([]error, 0) + x := &NamedSchema{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Schema value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewSchema(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedSecurityDefinitionsItem creates an object of type NamedSecurityDefinitionsItem if possible, returning an error if not. +func NewNamedSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*NamedSecurityDefinitionsItem, error) { + errors := make([]error, 0) + x := &NamedSecurityDefinitionsItem{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // SecurityDefinitionsItem value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewSecurityDefinitionsItem(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedString creates an object of type NamedString if possible, returning an error if not. +func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) { + errors := make([]error, 0) + x := &NamedString{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + x.Value, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for value: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not. +func NewNamedStringArray(in *yaml.Node, context *compiler.Context) (*NamedStringArray, error) { + errors := make([]error, 0) + x := &NamedStringArray{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"name", "value"} + var allowedPatterns []*regexp.Regexp + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // StringArray value = 2; + v2 := compiler.MapValueForKey(m, "value") + if v2 != nil { + var err error + x.Value, err = NewStringArray(v2, compiler.NewContext("value", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewNonBodyParameter creates an object of type NonBodyParameter if possible, returning an error if not. +func NewNonBodyParameter(in *yaml.Node, context *compiler.Context) (*NonBodyParameter, error) { + errors := make([]error, 0) + x := &NonBodyParameter{} + matched := false + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"in", "name", "type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // HeaderParameterSubSchema header_parameter_sub_schema = 1; + { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewHeaderParameterSubSchema(m, compiler.NewContext("headerParameterSubSchema", m, context)) + if matchingError == nil { + x.Oneof = &NonBodyParameter_HeaderParameterSubSchema{HeaderParameterSubSchema: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + // FormDataParameterSubSchema form_data_parameter_sub_schema = 2; + { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewFormDataParameterSubSchema(m, compiler.NewContext("formDataParameterSubSchema", m, context)) + if matchingError == nil { + x.Oneof = &NonBodyParameter_FormDataParameterSubSchema{FormDataParameterSubSchema: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + // QueryParameterSubSchema query_parameter_sub_schema = 3; + { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewQueryParameterSubSchema(m, compiler.NewContext("queryParameterSubSchema", m, context)) + if matchingError == nil { + x.Oneof = &NonBodyParameter_QueryParameterSubSchema{QueryParameterSubSchema: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + // PathParameterSubSchema path_parameter_sub_schema = 4; + { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewPathParameterSubSchema(m, compiler.NewContext("pathParameterSubSchema", m, context)) + if matchingError == nil { + x.Oneof = &NonBodyParameter_PathParameterSubSchema{PathParameterSubSchema: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + if matched { + // since the oneof matched one of its possibilities, discard any matching errors + errors = make([]error, 0) + } else { + message := fmt.Sprintf("contains an invalid NonBodyParameter") + err := compiler.NewError(context, message) + errors = []error{err} + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewOauth2AccessCodeSecurity creates an object of type Oauth2AccessCodeSecurity if possible, returning an error if not. +func NewOauth2AccessCodeSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2AccessCodeSecurity, error) { + errors := make([]error, 0) + x := &Oauth2AccessCodeSecurity{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"authorizationUrl", "flow", "tokenUrl", "type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "tokenUrl", "type"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string type = 1; + v1 := compiler.MapValueForKey(m, "type") + if v1 != nil { + x.Type, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [oauth2] + if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string flow = 2; + v2 := compiler.MapValueForKey(m, "flow") + if v2 != nil { + x.Flow, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [accessCode] + if ok && !compiler.StringArrayContainsValue([]string{"accessCode"}, x.Flow) { + message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Oauth2Scopes scopes = 3; + v3 := compiler.MapValueForKey(m, "scopes") + if v3 != nil { + var err error + x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // string authorization_url = 4; + v4 := compiler.MapValueForKey(m, "authorizationUrl") + if v4 != nil { + x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string token_url = 5; + v5 := compiler.MapValueForKey(m, "tokenUrl") + if v5 != nil { + x.TokenUrl, ok = compiler.StringForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 6; + v6 := compiler.MapValueForKey(m, "description") + if v6 != nil { + x.Description, ok = compiler.StringForScalarNode(v6) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 7; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewOauth2ApplicationSecurity creates an object of type Oauth2ApplicationSecurity if possible, returning an error if not. +func NewOauth2ApplicationSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ApplicationSecurity, error) { + errors := make([]error, 0) + x := &Oauth2ApplicationSecurity{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"flow", "tokenUrl", "type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string type = 1; + v1 := compiler.MapValueForKey(m, "type") + if v1 != nil { + x.Type, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [oauth2] + if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string flow = 2; + v2 := compiler.MapValueForKey(m, "flow") + if v2 != nil { + x.Flow, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [application] + if ok && !compiler.StringArrayContainsValue([]string{"application"}, x.Flow) { + message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Oauth2Scopes scopes = 3; + v3 := compiler.MapValueForKey(m, "scopes") + if v3 != nil { + var err error + x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // string token_url = 4; + v4 := compiler.MapValueForKey(m, "tokenUrl") + if v4 != nil { + x.TokenUrl, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 5; + v5 := compiler.MapValueForKey(m, "description") + if v5 != nil { + x.Description, ok = compiler.StringForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 6; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewOauth2ImplicitSecurity creates an object of type Oauth2ImplicitSecurity if possible, returning an error if not. +func NewOauth2ImplicitSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ImplicitSecurity, error) { + errors := make([]error, 0) + x := &Oauth2ImplicitSecurity{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"authorizationUrl", "flow", "type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "type"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string type = 1; + v1 := compiler.MapValueForKey(m, "type") + if v1 != nil { + x.Type, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [oauth2] + if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string flow = 2; + v2 := compiler.MapValueForKey(m, "flow") + if v2 != nil { + x.Flow, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [implicit] + if ok && !compiler.StringArrayContainsValue([]string{"implicit"}, x.Flow) { + message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Oauth2Scopes scopes = 3; + v3 := compiler.MapValueForKey(m, "scopes") + if v3 != nil { + var err error + x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // string authorization_url = 4; + v4 := compiler.MapValueForKey(m, "authorizationUrl") + if v4 != nil { + x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 5; + v5 := compiler.MapValueForKey(m, "description") + if v5 != nil { + x.Description, ok = compiler.StringForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 6; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewOauth2PasswordSecurity creates an object of type Oauth2PasswordSecurity if possible, returning an error if not. +func NewOauth2PasswordSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2PasswordSecurity, error) { + errors := make([]error, 0) + x := &Oauth2PasswordSecurity{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"flow", "tokenUrl", "type"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string type = 1; + v1 := compiler.MapValueForKey(m, "type") + if v1 != nil { + x.Type, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [oauth2] + if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string flow = 2; + v2 := compiler.MapValueForKey(m, "flow") + if v2 != nil { + x.Flow, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [password] + if ok && !compiler.StringArrayContainsValue([]string{"password"}, x.Flow) { + message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Oauth2Scopes scopes = 3; + v3 := compiler.MapValueForKey(m, "scopes") + if v3 != nil { + var err error + x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // string token_url = 4; + v4 := compiler.MapValueForKey(m, "tokenUrl") + if v4 != nil { + x.TokenUrl, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 5; + v5 := compiler.MapValueForKey(m, "description") + if v5 != nil { + x.Description, ok = compiler.StringForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 6; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewOauth2Scopes creates an object of type Oauth2Scopes if possible, returning an error if not. +func NewOauth2Scopes(in *yaml.Node, context *compiler.Context) (*Oauth2Scopes, error) { + errors := make([]error, 0) + x := &Oauth2Scopes{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedString additional_properties = 1; + // MAP: string + x.AdditionalProperties = make([]*NamedString, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedString{} + pair.Name = k + pair.Value, _ = compiler.StringForScalarNode(v) + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewOperation creates an object of type Operation if possible, returning an error if not. +func NewOperation(in *yaml.Node, context *compiler.Context) (*Operation, error) { + errors := make([]error, 0) + x := &Operation{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"responses"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"consumes", "deprecated", "description", "externalDocs", "operationId", "parameters", "produces", "responses", "schemes", "security", "summary", "tags"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // repeated string tags = 1; + v1 := compiler.MapValueForKey(m, "tags") + if v1 != nil { + v, ok := compiler.SequenceNodeForNode(v1) + if ok { + x.Tags = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for tags: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string summary = 2; + v2 := compiler.MapValueForKey(m, "summary") + if v2 != nil { + x.Summary, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 3; + v3 := compiler.MapValueForKey(m, "description") + if v3 != nil { + x.Description, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // ExternalDocs external_docs = 4; + v4 := compiler.MapValueForKey(m, "externalDocs") + if v4 != nil { + var err error + x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", v4, context)) + if err != nil { + errors = append(errors, err) + } + } + // string operation_id = 5; + v5 := compiler.MapValueForKey(m, "operationId") + if v5 != nil { + x.OperationId, ok = compiler.StringForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated string produces = 6; + v6 := compiler.MapValueForKey(m, "produces") + if v6 != nil { + v, ok := compiler.SequenceNodeForNode(v6) + if ok { + x.Produces = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated string consumes = 7; + v7 := compiler.MapValueForKey(m, "consumes") + if v7 != nil { + v, ok := compiler.SequenceNodeForNode(v7) + if ok { + x.Consumes = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v7)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated ParametersItem parameters = 8; + v8 := compiler.MapValueForKey(m, "parameters") + if v8 != nil { + // repeated ParametersItem + x.Parameters = make([]*ParametersItem, 0) + a, ok := compiler.SequenceNodeForNode(v8) + if ok { + for _, item := range a.Content { + y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Parameters = append(x.Parameters, y) + } + } + } + // Responses responses = 9; + v9 := compiler.MapValueForKey(m, "responses") + if v9 != nil { + var err error + x.Responses, err = NewResponses(v9, compiler.NewContext("responses", v9, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated string schemes = 10; + v10 := compiler.MapValueForKey(m, "schemes") + if v10 != nil { + v, ok := compiler.SequenceNodeForNode(v10) + if ok { + x.Schemes = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [http https ws wss] + if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) { + message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool deprecated = 11; + v11 := compiler.MapValueForKey(m, "deprecated") + if v11 != nil { + x.Deprecated, ok = compiler.BoolForScalarNode(v11) + if !ok { + message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v11)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated SecurityRequirement security = 12; + v12 := compiler.MapValueForKey(m, "security") + if v12 != nil { + // repeated SecurityRequirement + x.Security = make([]*SecurityRequirement, 0) + a, ok := compiler.SequenceNodeForNode(v12) + if ok { + for _, item := range a.Content { + y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Security = append(x.Security, y) + } + } + } + // repeated NamedAny vendor_extension = 13; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewParameter creates an object of type Parameter if possible, returning an error if not. +func NewParameter(in *yaml.Node, context *compiler.Context) (*Parameter, error) { + errors := make([]error, 0) + x := &Parameter{} + matched := false + // BodyParameter body_parameter = 1; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewBodyParameter(m, compiler.NewContext("bodyParameter", m, context)) + if matchingError == nil { + x.Oneof = &Parameter_BodyParameter{BodyParameter: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // NonBodyParameter non_body_parameter = 2; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewNonBodyParameter(m, compiler.NewContext("nonBodyParameter", m, context)) + if matchingError == nil { + x.Oneof = &Parameter_NonBodyParameter{NonBodyParameter: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + if matched { + // since the oneof matched one of its possibilities, discard any matching errors + errors = make([]error, 0) + } else { + message := fmt.Sprintf("contains an invalid Parameter") + err := compiler.NewError(context, message) + errors = []error{err} + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewParameterDefinitions creates an object of type ParameterDefinitions if possible, returning an error if not. +func NewParameterDefinitions(in *yaml.Node, context *compiler.Context) (*ParameterDefinitions, error) { + errors := make([]error, 0) + x := &ParameterDefinitions{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedParameter additional_properties = 1; + // MAP: Parameter + x.AdditionalProperties = make([]*NamedParameter, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedParameter{} + pair.Name = k + var err error + pair.Value, err = NewParameter(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewParametersItem creates an object of type ParametersItem if possible, returning an error if not. +func NewParametersItem(in *yaml.Node, context *compiler.Context) (*ParametersItem, error) { + errors := make([]error, 0) + x := &ParametersItem{} + matched := false + // Parameter parameter = 1; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewParameter(m, compiler.NewContext("parameter", m, context)) + if matchingError == nil { + x.Oneof = &ParametersItem_Parameter{Parameter: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // JsonReference json_reference = 2; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context)) + if matchingError == nil { + x.Oneof = &ParametersItem_JsonReference{JsonReference: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + if matched { + // since the oneof matched one of its possibilities, discard any matching errors + errors = make([]error, 0) + } else { + message := fmt.Sprintf("contains an invalid ParametersItem") + err := compiler.NewError(context, message) + errors = []error{err} + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewPathItem creates an object of type PathItem if possible, returning an error if not. +func NewPathItem(in *yaml.Node, context *compiler.Context) (*PathItem, error) { + errors := make([]error, 0) + x := &PathItem{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"$ref", "delete", "get", "head", "options", "parameters", "patch", "post", "put"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string _ref = 1; + v1 := compiler.MapValueForKey(m, "$ref") + if v1 != nil { + x.XRef, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Operation get = 2; + v2 := compiler.MapValueForKey(m, "get") + if v2 != nil { + var err error + x.Get, err = NewOperation(v2, compiler.NewContext("get", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + // Operation put = 3; + v3 := compiler.MapValueForKey(m, "put") + if v3 != nil { + var err error + x.Put, err = NewOperation(v3, compiler.NewContext("put", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // Operation post = 4; + v4 := compiler.MapValueForKey(m, "post") + if v4 != nil { + var err error + x.Post, err = NewOperation(v4, compiler.NewContext("post", v4, context)) + if err != nil { + errors = append(errors, err) + } + } + // Operation delete = 5; + v5 := compiler.MapValueForKey(m, "delete") + if v5 != nil { + var err error + x.Delete, err = NewOperation(v5, compiler.NewContext("delete", v5, context)) + if err != nil { + errors = append(errors, err) + } + } + // Operation options = 6; + v6 := compiler.MapValueForKey(m, "options") + if v6 != nil { + var err error + x.Options, err = NewOperation(v6, compiler.NewContext("options", v6, context)) + if err != nil { + errors = append(errors, err) + } + } + // Operation head = 7; + v7 := compiler.MapValueForKey(m, "head") + if v7 != nil { + var err error + x.Head, err = NewOperation(v7, compiler.NewContext("head", v7, context)) + if err != nil { + errors = append(errors, err) + } + } + // Operation patch = 8; + v8 := compiler.MapValueForKey(m, "patch") + if v8 != nil { + var err error + x.Patch, err = NewOperation(v8, compiler.NewContext("patch", v8, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated ParametersItem parameters = 9; + v9 := compiler.MapValueForKey(m, "parameters") + if v9 != nil { + // repeated ParametersItem + x.Parameters = make([]*ParametersItem, 0) + a, ok := compiler.SequenceNodeForNode(v9) + if ok { + for _, item := range a.Content { + y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Parameters = append(x.Parameters, y) + } + } + } + // repeated NamedAny vendor_extension = 10; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewPathParameterSubSchema creates an object of type PathParameterSubSchema if possible, returning an error if not. +func NewPathParameterSubSchema(in *yaml.Node, context *compiler.Context) (*PathParameterSubSchema, error) { + errors := make([]error, 0) + x := &PathParameterSubSchema{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"required"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // bool required = 1; + v1 := compiler.MapValueForKey(m, "required") + if v1 != nil { + x.Required, ok = compiler.BoolForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string in = 2; + v2 := compiler.MapValueForKey(m, "in") + if v2 != nil { + x.In, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [path] + if ok && !compiler.StringArrayContainsValue([]string{"path"}, x.In) { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 3; + v3 := compiler.MapValueForKey(m, "description") + if v3 != nil { + x.Description, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string name = 4; + v4 := compiler.MapValueForKey(m, "name") + if v4 != nil { + x.Name, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string type = 5; + v5 := compiler.MapValueForKey(m, "type") + if v5 != nil { + x.Type, ok = compiler.StringForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [string number boolean integer array] + if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string format = 6; + v6 := compiler.MapValueForKey(m, "format") + if v6 != nil { + x.Format, ok = compiler.StringForScalarNode(v6) + if !ok { + message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // PrimitivesItems items = 7; + v7 := compiler.MapValueForKey(m, "items") + if v7 != nil { + var err error + x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context)) + if err != nil { + errors = append(errors, err) + } + } + // string collection_format = 8; + v8 := compiler.MapValueForKey(m, "collectionFormat") + if v8 != nil { + x.CollectionFormat, ok = compiler.StringForScalarNode(v8) + if !ok { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [csv ssv tsv pipes] + if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any default = 9; + v9 := compiler.MapValueForKey(m, "default") + if v9 != nil { + var err error + x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context)) + if err != nil { + errors = append(errors, err) + } + } + // float maximum = 10; + v10 := compiler.MapValueForKey(m, "maximum") + if v10 != nil { + v, ok := compiler.FloatForScalarNode(v10) + if ok { + x.Maximum = v + } else { + message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_maximum = 11; + v11 := compiler.MapValueForKey(m, "exclusiveMaximum") + if v11 != nil { + x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // float minimum = 12; + v12 := compiler.MapValueForKey(m, "minimum") + if v12 != nil { + v, ok := compiler.FloatForScalarNode(v12) + if ok { + x.Minimum = v + } else { + message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_minimum = 13; + v13 := compiler.MapValueForKey(m, "exclusiveMinimum") + if v13 != nil { + x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_length = 14; + v14 := compiler.MapValueForKey(m, "maxLength") + if v14 != nil { + t, ok := compiler.IntForScalarNode(v14) + if ok { + x.MaxLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_length = 15; + v15 := compiler.MapValueForKey(m, "minLength") + if v15 != nil { + t, ok := compiler.IntForScalarNode(v15) + if ok { + x.MinLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string pattern = 16; + v16 := compiler.MapValueForKey(m, "pattern") + if v16 != nil { + x.Pattern, ok = compiler.StringForScalarNode(v16) + if !ok { + message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_items = 17; + v17 := compiler.MapValueForKey(m, "maxItems") + if v17 != nil { + t, ok := compiler.IntForScalarNode(v17) + if ok { + x.MaxItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_items = 18; + v18 := compiler.MapValueForKey(m, "minItems") + if v18 != nil { + t, ok := compiler.IntForScalarNode(v18) + if ok { + x.MinItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool unique_items = 19; + v19 := compiler.MapValueForKey(m, "uniqueItems") + if v19 != nil { + x.UniqueItems, ok = compiler.BoolForScalarNode(v19) + if !ok { + message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated Any enum = 20; + v20 := compiler.MapValueForKey(m, "enum") + if v20 != nil { + // repeated Any + x.Enum = make([]*Any, 0) + a, ok := compiler.SequenceNodeForNode(v20) + if ok { + for _, item := range a.Content { + y, err := NewAny(item, compiler.NewContext("enum", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Enum = append(x.Enum, y) + } + } + } + // float multiple_of = 21; + v21 := compiler.MapValueForKey(m, "multipleOf") + if v21 != nil { + v, ok := compiler.FloatForScalarNode(v21) + if ok { + x.MultipleOf = v + } else { + message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 22; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewPaths creates an object of type Paths if possible, returning an error if not. +func NewPaths(in *yaml.Node, context *compiler.Context) (*Paths, error) { + errors := make([]error, 0) + x := &Paths{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{} + allowedPatterns := []*regexp.Regexp{pattern0, pattern1} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // repeated NamedAny vendor_extension = 1; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + // repeated NamedPathItem path = 2; + // MAP: PathItem ^/ + x.Path = make([]*NamedPathItem, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "/") { + pair := &NamedPathItem{} + pair.Name = k + var err error + pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.Path = append(x.Path, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewPrimitivesItems creates an object of type PrimitivesItems if possible, returning an error if not. +func NewPrimitivesItems(in *yaml.Node, context *compiler.Context) (*PrimitivesItems, error) { + errors := make([]error, 0) + x := &PrimitivesItems{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"collectionFormat", "default", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string type = 1; + v1 := compiler.MapValueForKey(m, "type") + if v1 != nil { + x.Type, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [string number integer boolean array] + if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string format = 2; + v2 := compiler.MapValueForKey(m, "format") + if v2 != nil { + x.Format, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // PrimitivesItems items = 3; + v3 := compiler.MapValueForKey(m, "items") + if v3 != nil { + var err error + x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // string collection_format = 4; + v4 := compiler.MapValueForKey(m, "collectionFormat") + if v4 != nil { + x.CollectionFormat, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [csv ssv tsv pipes] + if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any default = 5; + v5 := compiler.MapValueForKey(m, "default") + if v5 != nil { + var err error + x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) + if err != nil { + errors = append(errors, err) + } + } + // float maximum = 6; + v6 := compiler.MapValueForKey(m, "maximum") + if v6 != nil { + v, ok := compiler.FloatForScalarNode(v6) + if ok { + x.Maximum = v + } else { + message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_maximum = 7; + v7 := compiler.MapValueForKey(m, "exclusiveMaximum") + if v7 != nil { + x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // float minimum = 8; + v8 := compiler.MapValueForKey(m, "minimum") + if v8 != nil { + v, ok := compiler.FloatForScalarNode(v8) + if ok { + x.Minimum = v + } else { + message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_minimum = 9; + v9 := compiler.MapValueForKey(m, "exclusiveMinimum") + if v9 != nil { + x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_length = 10; + v10 := compiler.MapValueForKey(m, "maxLength") + if v10 != nil { + t, ok := compiler.IntForScalarNode(v10) + if ok { + x.MaxLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_length = 11; + v11 := compiler.MapValueForKey(m, "minLength") + if v11 != nil { + t, ok := compiler.IntForScalarNode(v11) + if ok { + x.MinLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string pattern = 12; + v12 := compiler.MapValueForKey(m, "pattern") + if v12 != nil { + x.Pattern, ok = compiler.StringForScalarNode(v12) + if !ok { + message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_items = 13; + v13 := compiler.MapValueForKey(m, "maxItems") + if v13 != nil { + t, ok := compiler.IntForScalarNode(v13) + if ok { + x.MaxItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_items = 14; + v14 := compiler.MapValueForKey(m, "minItems") + if v14 != nil { + t, ok := compiler.IntForScalarNode(v14) + if ok { + x.MinItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool unique_items = 15; + v15 := compiler.MapValueForKey(m, "uniqueItems") + if v15 != nil { + x.UniqueItems, ok = compiler.BoolForScalarNode(v15) + if !ok { + message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated Any enum = 16; + v16 := compiler.MapValueForKey(m, "enum") + if v16 != nil { + // repeated Any + x.Enum = make([]*Any, 0) + a, ok := compiler.SequenceNodeForNode(v16) + if ok { + for _, item := range a.Content { + y, err := NewAny(item, compiler.NewContext("enum", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Enum = append(x.Enum, y) + } + } + } + // float multiple_of = 17; + v17 := compiler.MapValueForKey(m, "multipleOf") + if v17 != nil { + v, ok := compiler.FloatForScalarNode(v17) + if ok { + x.MultipleOf = v + } else { + message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 18; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewProperties creates an object of type Properties if possible, returning an error if not. +func NewProperties(in *yaml.Node, context *compiler.Context) (*Properties, error) { + errors := make([]error, 0) + x := &Properties{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedSchema additional_properties = 1; + // MAP: Schema + x.AdditionalProperties = make([]*NamedSchema, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedSchema{} + pair.Name = k + var err error + pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewQueryParameterSubSchema creates an object of type QueryParameterSubSchema if possible, returning an error if not. +func NewQueryParameterSubSchema(in *yaml.Node, context *compiler.Context) (*QueryParameterSubSchema, error) { + errors := make([]error, 0) + x := &QueryParameterSubSchema{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // bool required = 1; + v1 := compiler.MapValueForKey(m, "required") + if v1 != nil { + x.Required, ok = compiler.BoolForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string in = 2; + v2 := compiler.MapValueForKey(m, "in") + if v2 != nil { + x.In, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [query] + if ok && !compiler.StringArrayContainsValue([]string{"query"}, x.In) { + message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 3; + v3 := compiler.MapValueForKey(m, "description") + if v3 != nil { + x.Description, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string name = 4; + v4 := compiler.MapValueForKey(m, "name") + if v4 != nil { + x.Name, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool allow_empty_value = 5; + v5 := compiler.MapValueForKey(m, "allowEmptyValue") + if v5 != nil { + x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string type = 6; + v6 := compiler.MapValueForKey(m, "type") + if v6 != nil { + x.Type, ok = compiler.StringForScalarNode(v6) + if !ok { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [string number boolean integer array] + if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { + message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string format = 7; + v7 := compiler.MapValueForKey(m, "format") + if v7 != nil { + x.Format, ok = compiler.StringForScalarNode(v7) + if !ok { + message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // PrimitivesItems items = 8; + v8 := compiler.MapValueForKey(m, "items") + if v8 != nil { + var err error + x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context)) + if err != nil { + errors = append(errors, err) + } + } + // string collection_format = 9; + v9 := compiler.MapValueForKey(m, "collectionFormat") + if v9 != nil { + x.CollectionFormat, ok = compiler.StringForScalarNode(v9) + if !ok { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) + errors = append(errors, compiler.NewError(context, message)) + } + // check for valid enum values + // [csv ssv tsv pipes multi] + if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) { + message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any default = 10; + v10 := compiler.MapValueForKey(m, "default") + if v10 != nil { + var err error + x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context)) + if err != nil { + errors = append(errors, err) + } + } + // float maximum = 11; + v11 := compiler.MapValueForKey(m, "maximum") + if v11 != nil { + v, ok := compiler.FloatForScalarNode(v11) + if ok { + x.Maximum = v + } else { + message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_maximum = 12; + v12 := compiler.MapValueForKey(m, "exclusiveMaximum") + if v12 != nil { + x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // float minimum = 13; + v13 := compiler.MapValueForKey(m, "minimum") + if v13 != nil { + v, ok := compiler.FloatForScalarNode(v13) + if ok { + x.Minimum = v + } else { + message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_minimum = 14; + v14 := compiler.MapValueForKey(m, "exclusiveMinimum") + if v14 != nil { + x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_length = 15; + v15 := compiler.MapValueForKey(m, "maxLength") + if v15 != nil { + t, ok := compiler.IntForScalarNode(v15) + if ok { + x.MaxLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_length = 16; + v16 := compiler.MapValueForKey(m, "minLength") + if v16 != nil { + t, ok := compiler.IntForScalarNode(v16) + if ok { + x.MinLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string pattern = 17; + v17 := compiler.MapValueForKey(m, "pattern") + if v17 != nil { + x.Pattern, ok = compiler.StringForScalarNode(v17) + if !ok { + message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_items = 18; + v18 := compiler.MapValueForKey(m, "maxItems") + if v18 != nil { + t, ok := compiler.IntForScalarNode(v18) + if ok { + x.MaxItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_items = 19; + v19 := compiler.MapValueForKey(m, "minItems") + if v19 != nil { + t, ok := compiler.IntForScalarNode(v19) + if ok { + x.MinItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool unique_items = 20; + v20 := compiler.MapValueForKey(m, "uniqueItems") + if v20 != nil { + x.UniqueItems, ok = compiler.BoolForScalarNode(v20) + if !ok { + message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated Any enum = 21; + v21 := compiler.MapValueForKey(m, "enum") + if v21 != nil { + // repeated Any + x.Enum = make([]*Any, 0) + a, ok := compiler.SequenceNodeForNode(v21) + if ok { + for _, item := range a.Content { + y, err := NewAny(item, compiler.NewContext("enum", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Enum = append(x.Enum, y) + } + } + } + // float multiple_of = 22; + v22 := compiler.MapValueForKey(m, "multipleOf") + if v22 != nil { + v, ok := compiler.FloatForScalarNode(v22) + if ok { + x.MultipleOf = v + } else { + message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 23; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewResponse creates an object of type Response if possible, returning an error if not. +func NewResponse(in *yaml.Node, context *compiler.Context) (*Response, error) { + errors := make([]error, 0) + x := &Response{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"description"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"description", "examples", "headers", "schema"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string description = 1; + v1 := compiler.MapValueForKey(m, "description") + if v1 != nil { + x.Description, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // SchemaItem schema = 2; + v2 := compiler.MapValueForKey(m, "schema") + if v2 != nil { + var err error + x.Schema, err = NewSchemaItem(v2, compiler.NewContext("schema", v2, context)) + if err != nil { + errors = append(errors, err) + } + } + // Headers headers = 3; + v3 := compiler.MapValueForKey(m, "headers") + if v3 != nil { + var err error + x.Headers, err = NewHeaders(v3, compiler.NewContext("headers", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // Examples examples = 4; + v4 := compiler.MapValueForKey(m, "examples") + if v4 != nil { + var err error + x.Examples, err = NewExamples(v4, compiler.NewContext("examples", v4, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated NamedAny vendor_extension = 5; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewResponseDefinitions creates an object of type ResponseDefinitions if possible, returning an error if not. +func NewResponseDefinitions(in *yaml.Node, context *compiler.Context) (*ResponseDefinitions, error) { + errors := make([]error, 0) + x := &ResponseDefinitions{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedResponse additional_properties = 1; + // MAP: Response + x.AdditionalProperties = make([]*NamedResponse, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedResponse{} + pair.Name = k + var err error + pair.Value, err = NewResponse(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewResponseValue creates an object of type ResponseValue if possible, returning an error if not. +func NewResponseValue(in *yaml.Node, context *compiler.Context) (*ResponseValue, error) { + errors := make([]error, 0) + x := &ResponseValue{} + matched := false + // Response response = 1; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewResponse(m, compiler.NewContext("response", m, context)) + if matchingError == nil { + x.Oneof = &ResponseValue_Response{Response: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // JsonReference json_reference = 2; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context)) + if matchingError == nil { + x.Oneof = &ResponseValue_JsonReference{JsonReference: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + if matched { + // since the oneof matched one of its possibilities, discard any matching errors + errors = make([]error, 0) + } else { + message := fmt.Sprintf("contains an invalid ResponseValue") + err := compiler.NewError(context, message) + errors = []error{err} + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewResponses creates an object of type Responses if possible, returning an error if not. +func NewResponses(in *yaml.Node, context *compiler.Context) (*Responses, error) { + errors := make([]error, 0) + x := &Responses{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{} + allowedPatterns := []*regexp.Regexp{pattern2, pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // repeated NamedResponseValue response_code = 1; + // MAP: ResponseValue ^([0-9]{3})$|^(default)$ + x.ResponseCode = make([]*NamedResponseValue, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if pattern2.MatchString(k) { + pair := &NamedResponseValue{} + pair.Name = k + var err error + pair.Value, err = NewResponseValue(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.ResponseCode = append(x.ResponseCode, pair) + } + } + } + // repeated NamedAny vendor_extension = 2; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewSchema creates an object of type Schema if possible, returning an error if not. +func NewSchema(in *yaml.Node, context *compiler.Context) (*Schema, error) { + errors := make([]error, 0) + x := &Schema{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"$ref", "additionalProperties", "allOf", "default", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "xml"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string _ref = 1; + v1 := compiler.MapValueForKey(m, "$ref") + if v1 != nil { + x.XRef, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string format = 2; + v2 := compiler.MapValueForKey(m, "format") + if v2 != nil { + x.Format, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string title = 3; + v3 := compiler.MapValueForKey(m, "title") + if v3 != nil { + x.Title, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 4; + v4 := compiler.MapValueForKey(m, "description") + if v4 != nil { + x.Description, ok = compiler.StringForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Any default = 5; + v5 := compiler.MapValueForKey(m, "default") + if v5 != nil { + var err error + x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) + if err != nil { + errors = append(errors, err) + } + } + // float multiple_of = 6; + v6 := compiler.MapValueForKey(m, "multipleOf") + if v6 != nil { + v, ok := compiler.FloatForScalarNode(v6) + if ok { + x.MultipleOf = v + } else { + message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v6)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // float maximum = 7; + v7 := compiler.MapValueForKey(m, "maximum") + if v7 != nil { + v, ok := compiler.FloatForScalarNode(v7) + if ok { + x.Maximum = v + } else { + message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v7)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_maximum = 8; + v8 := compiler.MapValueForKey(m, "exclusiveMaximum") + if v8 != nil { + x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v8) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v8)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // float minimum = 9; + v9 := compiler.MapValueForKey(m, "minimum") + if v9 != nil { + v, ok := compiler.FloatForScalarNode(v9) + if ok { + x.Minimum = v + } else { + message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v9)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool exclusive_minimum = 10; + v10 := compiler.MapValueForKey(m, "exclusiveMinimum") + if v10 != nil { + x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v10) + if !ok { + message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v10)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_length = 11; + v11 := compiler.MapValueForKey(m, "maxLength") + if v11 != nil { + t, ok := compiler.IntForScalarNode(v11) + if ok { + x.MaxLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v11)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_length = 12; + v12 := compiler.MapValueForKey(m, "minLength") + if v12 != nil { + t, ok := compiler.IntForScalarNode(v12) + if ok { + x.MinLength = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v12)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string pattern = 13; + v13 := compiler.MapValueForKey(m, "pattern") + if v13 != nil { + x.Pattern, ok = compiler.StringForScalarNode(v13) + if !ok { + message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v13)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_items = 14; + v14 := compiler.MapValueForKey(m, "maxItems") + if v14 != nil { + t, ok := compiler.IntForScalarNode(v14) + if ok { + x.MaxItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v14)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_items = 15; + v15 := compiler.MapValueForKey(m, "minItems") + if v15 != nil { + t, ok := compiler.IntForScalarNode(v15) + if ok { + x.MinItems = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v15)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool unique_items = 16; + v16 := compiler.MapValueForKey(m, "uniqueItems") + if v16 != nil { + x.UniqueItems, ok = compiler.BoolForScalarNode(v16) + if !ok { + message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v16)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 max_properties = 17; + v17 := compiler.MapValueForKey(m, "maxProperties") + if v17 != nil { + t, ok := compiler.IntForScalarNode(v17) + if ok { + x.MaxProperties = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for maxProperties: %s", compiler.Display(v17)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // int64 min_properties = 18; + v18 := compiler.MapValueForKey(m, "minProperties") + if v18 != nil { + t, ok := compiler.IntForScalarNode(v18) + if ok { + x.MinProperties = int64(t) + } else { + message := fmt.Sprintf("has unexpected value for minProperties: %s", compiler.Display(v18)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated string required = 19; + v19 := compiler.MapValueForKey(m, "required") + if v19 != nil { + v, ok := compiler.SequenceNodeForNode(v19) + if ok { + x.Required = compiler.StringArrayForSequenceNode(v) + } else { + message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v19)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated Any enum = 20; + v20 := compiler.MapValueForKey(m, "enum") + if v20 != nil { + // repeated Any + x.Enum = make([]*Any, 0) + a, ok := compiler.SequenceNodeForNode(v20) + if ok { + for _, item := range a.Content { + y, err := NewAny(item, compiler.NewContext("enum", item, context)) + if err != nil { + errors = append(errors, err) + } + x.Enum = append(x.Enum, y) + } + } + } + // AdditionalPropertiesItem additional_properties = 21; + v21 := compiler.MapValueForKey(m, "additionalProperties") + if v21 != nil { + var err error + x.AdditionalProperties, err = NewAdditionalPropertiesItem(v21, compiler.NewContext("additionalProperties", v21, context)) + if err != nil { + errors = append(errors, err) + } + } + // TypeItem type = 22; + v22 := compiler.MapValueForKey(m, "type") + if v22 != nil { + var err error + x.Type, err = NewTypeItem(v22, compiler.NewContext("type", v22, context)) + if err != nil { + errors = append(errors, err) + } + } + // ItemsItem items = 23; + v23 := compiler.MapValueForKey(m, "items") + if v23 != nil { + var err error + x.Items, err = NewItemsItem(v23, compiler.NewContext("items", v23, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated Schema all_of = 24; + v24 := compiler.MapValueForKey(m, "allOf") + if v24 != nil { + // repeated Schema + x.AllOf = make([]*Schema, 0) + a, ok := compiler.SequenceNodeForNode(v24) + if ok { + for _, item := range a.Content { + y, err := NewSchema(item, compiler.NewContext("allOf", item, context)) + if err != nil { + errors = append(errors, err) + } + x.AllOf = append(x.AllOf, y) + } + } + } + // Properties properties = 25; + v25 := compiler.MapValueForKey(m, "properties") + if v25 != nil { + var err error + x.Properties, err = NewProperties(v25, compiler.NewContext("properties", v25, context)) + if err != nil { + errors = append(errors, err) + } + } + // string discriminator = 26; + v26 := compiler.MapValueForKey(m, "discriminator") + if v26 != nil { + x.Discriminator, ok = compiler.StringForScalarNode(v26) + if !ok { + message := fmt.Sprintf("has unexpected value for discriminator: %s", compiler.Display(v26)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool read_only = 27; + v27 := compiler.MapValueForKey(m, "readOnly") + if v27 != nil { + x.ReadOnly, ok = compiler.BoolForScalarNode(v27) + if !ok { + message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v27)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // Xml xml = 28; + v28 := compiler.MapValueForKey(m, "xml") + if v28 != nil { + var err error + x.Xml, err = NewXml(v28, compiler.NewContext("xml", v28, context)) + if err != nil { + errors = append(errors, err) + } + } + // ExternalDocs external_docs = 29; + v29 := compiler.MapValueForKey(m, "externalDocs") + if v29 != nil { + var err error + x.ExternalDocs, err = NewExternalDocs(v29, compiler.NewContext("externalDocs", v29, context)) + if err != nil { + errors = append(errors, err) + } + } + // Any example = 30; + v30 := compiler.MapValueForKey(m, "example") + if v30 != nil { + var err error + x.Example, err = NewAny(v30, compiler.NewContext("example", v30, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated NamedAny vendor_extension = 31; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewSchemaItem creates an object of type SchemaItem if possible, returning an error if not. +func NewSchemaItem(in *yaml.Node, context *compiler.Context) (*SchemaItem, error) { + errors := make([]error, 0) + x := &SchemaItem{} + matched := false + // Schema schema = 1; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context)) + if matchingError == nil { + x.Oneof = &SchemaItem_Schema{Schema: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // FileSchema file_schema = 2; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewFileSchema(m, compiler.NewContext("fileSchema", m, context)) + if matchingError == nil { + x.Oneof = &SchemaItem_FileSchema{FileSchema: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + if matched { + // since the oneof matched one of its possibilities, discard any matching errors + errors = make([]error, 0) + } else { + message := fmt.Sprintf("contains an invalid SchemaItem") + err := compiler.NewError(context, message) + errors = []error{err} + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewSecurityDefinitions creates an object of type SecurityDefinitions if possible, returning an error if not. +func NewSecurityDefinitions(in *yaml.Node, context *compiler.Context) (*SecurityDefinitions, error) { + errors := make([]error, 0) + x := &SecurityDefinitions{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedSecurityDefinitionsItem additional_properties = 1; + // MAP: SecurityDefinitionsItem + x.AdditionalProperties = make([]*NamedSecurityDefinitionsItem, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedSecurityDefinitionsItem{} + pair.Name = k + var err error + pair.Value, err = NewSecurityDefinitionsItem(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewSecurityDefinitionsItem creates an object of type SecurityDefinitionsItem if possible, returning an error if not. +func NewSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*SecurityDefinitionsItem, error) { + errors := make([]error, 0) + x := &SecurityDefinitionsItem{} + matched := false + // BasicAuthenticationSecurity basic_authentication_security = 1; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewBasicAuthenticationSecurity(m, compiler.NewContext("basicAuthenticationSecurity", m, context)) + if matchingError == nil { + x.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{BasicAuthenticationSecurity: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // ApiKeySecurity api_key_security = 2; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewApiKeySecurity(m, compiler.NewContext("apiKeySecurity", m, context)) + if matchingError == nil { + x.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{ApiKeySecurity: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // Oauth2ImplicitSecurity oauth2_implicit_security = 3; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewOauth2ImplicitSecurity(m, compiler.NewContext("oauth2ImplicitSecurity", m, context)) + if matchingError == nil { + x.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{Oauth2ImplicitSecurity: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // Oauth2PasswordSecurity oauth2_password_security = 4; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewOauth2PasswordSecurity(m, compiler.NewContext("oauth2PasswordSecurity", m, context)) + if matchingError == nil { + x.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{Oauth2PasswordSecurity: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // Oauth2ApplicationSecurity oauth2_application_security = 5; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewOauth2ApplicationSecurity(m, compiler.NewContext("oauth2ApplicationSecurity", m, context)) + if matchingError == nil { + x.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{Oauth2ApplicationSecurity: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + // Oauth2AccessCodeSecurity oauth2_access_code_security = 6; + { + m, ok := compiler.UnpackMap(in) + if ok { + // errors might be ok here, they mean we just don't have the right subtype + t, matchingError := NewOauth2AccessCodeSecurity(m, compiler.NewContext("oauth2AccessCodeSecurity", m, context)) + if matchingError == nil { + x.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{Oauth2AccessCodeSecurity: t} + matched = true + } else { + errors = append(errors, matchingError) + } + } + } + if matched { + // since the oneof matched one of its possibilities, discard any matching errors + errors = make([]error, 0) + } else { + message := fmt.Sprintf("contains an invalid SecurityDefinitionsItem") + err := compiler.NewError(context, message) + errors = []error{err} + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not. +func NewSecurityRequirement(in *yaml.Node, context *compiler.Context) (*SecurityRequirement, error) { + errors := make([]error, 0) + x := &SecurityRequirement{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedStringArray additional_properties = 1; + // MAP: StringArray + x.AdditionalProperties = make([]*NamedStringArray, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedStringArray{} + pair.Name = k + var err error + pair.Value, err = NewStringArray(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewStringArray creates an object of type StringArray if possible, returning an error if not. +func NewStringArray(in *yaml.Node, context *compiler.Context) (*StringArray, error) { + errors := make([]error, 0) + x := &StringArray{} + x.Value = make([]string, 0) + for _, node := range in.Content { + s, _ := compiler.StringForScalarNode(node) + x.Value = append(x.Value, s) + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewTag creates an object of type Tag if possible, returning an error if not. +func NewTag(in *yaml.Node, context *compiler.Context) (*Tag, error) { + errors := make([]error, 0) + x := &Tag{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + requiredKeys := []string{"name"} + missingKeys := compiler.MissingKeysInMap(m, requiredKeys) + if len(missingKeys) > 0 { + message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + allowedKeys := []string{"description", "externalDocs", "name"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string description = 2; + v2 := compiler.MapValueForKey(m, "description") + if v2 != nil { + x.Description, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // ExternalDocs external_docs = 3; + v3 := compiler.MapValueForKey(m, "externalDocs") + if v3 != nil { + var err error + x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", v3, context)) + if err != nil { + errors = append(errors, err) + } + } + // repeated NamedAny vendor_extension = 4; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewTypeItem creates an object of type TypeItem if possible, returning an error if not. +func NewTypeItem(in *yaml.Node, context *compiler.Context) (*TypeItem, error) { + errors := make([]error, 0) + x := &TypeItem{} + v1 := in + switch v1.Kind { + case yaml.ScalarNode: + x.Value = make([]string, 0) + x.Value = append(x.Value, v1.Value) + case yaml.SequenceNode: + x.Value = make([]string, 0) + for _, v := range v1.Content { + value := v.Value + ok := v.Kind == yaml.ScalarNode + if ok { + x.Value = append(x.Value, value) + } else { + message := fmt.Sprintf("has unexpected value for string array element: %+v (%T)", value, value) + errors = append(errors, compiler.NewError(context, message)) + } + } + default: + message := fmt.Sprintf("has unexpected value for string array: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewVendorExtension creates an object of type VendorExtension if possible, returning an error if not. +func NewVendorExtension(in *yaml.Node, context *compiler.Context) (*VendorExtension, error) { + errors := make([]error, 0) + x := &VendorExtension{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + // repeated NamedAny additional_properties = 1; + // MAP: Any + x.AdditionalProperties = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.AdditionalProperties = append(x.AdditionalProperties, pair) + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// NewXml creates an object of type Xml if possible, returning an error if not. +func NewXml(in *yaml.Node, context *compiler.Context) (*Xml, error) { + errors := make([]error, 0) + x := &Xml{} + m, ok := compiler.UnpackMap(in) + if !ok { + message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) + errors = append(errors, compiler.NewError(context, message)) + } else { + allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"} + allowedPatterns := []*regexp.Regexp{pattern0} + invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) + if len(invalidKeys) > 0 { + message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) + errors = append(errors, compiler.NewError(context, message)) + } + // string name = 1; + v1 := compiler.MapValueForKey(m, "name") + if v1 != nil { + x.Name, ok = compiler.StringForScalarNode(v1) + if !ok { + message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string namespace = 2; + v2 := compiler.MapValueForKey(m, "namespace") + if v2 != nil { + x.Namespace, ok = compiler.StringForScalarNode(v2) + if !ok { + message := fmt.Sprintf("has unexpected value for namespace: %s", compiler.Display(v2)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // string prefix = 3; + v3 := compiler.MapValueForKey(m, "prefix") + if v3 != nil { + x.Prefix, ok = compiler.StringForScalarNode(v3) + if !ok { + message := fmt.Sprintf("has unexpected value for prefix: %s", compiler.Display(v3)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool attribute = 4; + v4 := compiler.MapValueForKey(m, "attribute") + if v4 != nil { + x.Attribute, ok = compiler.BoolForScalarNode(v4) + if !ok { + message := fmt.Sprintf("has unexpected value for attribute: %s", compiler.Display(v4)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // bool wrapped = 5; + v5 := compiler.MapValueForKey(m, "wrapped") + if v5 != nil { + x.Wrapped, ok = compiler.BoolForScalarNode(v5) + if !ok { + message := fmt.Sprintf("has unexpected value for wrapped: %s", compiler.Display(v5)) + errors = append(errors, compiler.NewError(context, message)) + } + } + // repeated NamedAny vendor_extension = 6; + // MAP: Any ^x- + x.VendorExtension = make([]*NamedAny, 0) + for i := 0; i < len(m.Content); i += 2 { + k, ok := compiler.StringForScalarNode(m.Content[i]) + if ok { + v := m.Content[i+1] + if strings.HasPrefix(k, "x-") { + pair := &NamedAny{} + pair.Name = k + result := &Any{} + handled, resultFromExt, err := compiler.CallExtension(context, v, k) + if handled { + if err != nil { + errors = append(errors, err) + } else { + bytes := compiler.Marshal(v) + result.Yaml = string(bytes) + result.Value = resultFromExt + pair.Value = result + } + } else { + pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) + if err != nil { + errors = append(errors, err) + } + } + x.VendorExtension = append(x.VendorExtension, pair) + } + } + } + } + return x, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside AdditionalPropertiesItem objects. +func (m *AdditionalPropertiesItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + { + p, ok := m.Oneof.(*AdditionalPropertiesItem_Schema) + if ok { + _, err := p.Schema.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Any objects. +func (m *Any) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside ApiKeySecurity objects. +func (m *ApiKeySecurity) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside BasicAuthenticationSecurity objects. +func (m *BasicAuthenticationSecurity) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside BodyParameter objects. +func (m *BodyParameter) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Schema != nil { + _, err := m.Schema.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Contact objects. +func (m *Contact) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Default objects. +func (m *Default) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Definitions objects. +func (m *Definitions) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Document objects. +func (m *Document) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Info != nil { + _, err := m.Info.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Paths != nil { + _, err := m.Paths.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Definitions != nil { + _, err := m.Definitions.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Parameters != nil { + _, err := m.Parameters.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Responses != nil { + _, err := m.Responses.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Security { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + if m.SecurityDefinitions != nil { + _, err := m.SecurityDefinitions.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Tags { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + if m.ExternalDocs != nil { + _, err := m.ExternalDocs.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Examples objects. +func (m *Examples) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside ExternalDocs objects. +func (m *ExternalDocs) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside FileSchema objects. +func (m *FileSchema) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Default != nil { + _, err := m.Default.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.ExternalDocs != nil { + _, err := m.ExternalDocs.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Example != nil { + _, err := m.Example.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside FormDataParameterSubSchema objects. +func (m *FormDataParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Items != nil { + _, err := m.Items.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Default != nil { + _, err := m.Default.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Enum { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Header objects. +func (m *Header) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Items != nil { + _, err := m.Items.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Default != nil { + _, err := m.Default.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Enum { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside HeaderParameterSubSchema objects. +func (m *HeaderParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Items != nil { + _, err := m.Items.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Default != nil { + _, err := m.Default.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Enum { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Headers objects. +func (m *Headers) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Info objects. +func (m *Info) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Contact != nil { + _, err := m.Contact.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.License != nil { + _, err := m.License.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside ItemsItem objects. +func (m *ItemsItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.Schema { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside JsonReference objects. +func (m *JsonReference) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.XRef != "" { + info, err := compiler.ReadInfoForRef(root, m.XRef) + if err != nil { + return nil, err + } + if info != nil { + replacement, err := NewJsonReference(info, nil) + if err == nil { + *m = *replacement + return m.ResolveReferences(root) + } + } + return info, nil + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside License objects. +func (m *License) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedAny objects. +func (m *NamedAny) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedHeader objects. +func (m *NamedHeader) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedParameter objects. +func (m *NamedParameter) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedPathItem objects. +func (m *NamedPathItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedResponse objects. +func (m *NamedResponse) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedResponseValue objects. +func (m *NamedResponseValue) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedSchema objects. +func (m *NamedSchema) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedSecurityDefinitionsItem objects. +func (m *NamedSecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedString objects. +func (m *NamedString) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NamedStringArray objects. +func (m *NamedStringArray) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Value != nil { + _, err := m.Value.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside NonBodyParameter objects. +func (m *NonBodyParameter) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + { + p, ok := m.Oneof.(*NonBodyParameter_HeaderParameterSubSchema) + if ok { + _, err := p.HeaderParameterSubSchema.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*NonBodyParameter_FormDataParameterSubSchema) + if ok { + _, err := p.FormDataParameterSubSchema.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*NonBodyParameter_QueryParameterSubSchema) + if ok { + _, err := p.QueryParameterSubSchema.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*NonBodyParameter_PathParameterSubSchema) + if ok { + _, err := p.PathParameterSubSchema.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Oauth2AccessCodeSecurity objects. +func (m *Oauth2AccessCodeSecurity) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Scopes != nil { + _, err := m.Scopes.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Oauth2ApplicationSecurity objects. +func (m *Oauth2ApplicationSecurity) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Scopes != nil { + _, err := m.Scopes.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Oauth2ImplicitSecurity objects. +func (m *Oauth2ImplicitSecurity) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Scopes != nil { + _, err := m.Scopes.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Oauth2PasswordSecurity objects. +func (m *Oauth2PasswordSecurity) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Scopes != nil { + _, err := m.Scopes.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Oauth2Scopes objects. +func (m *Oauth2Scopes) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Operation objects. +func (m *Operation) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.ExternalDocs != nil { + _, err := m.ExternalDocs.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Parameters { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + if m.Responses != nil { + _, err := m.Responses.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Security { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Parameter objects. +func (m *Parameter) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + { + p, ok := m.Oneof.(*Parameter_BodyParameter) + if ok { + _, err := p.BodyParameter.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*Parameter_NonBodyParameter) + if ok { + _, err := p.NonBodyParameter.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside ParameterDefinitions objects. +func (m *ParameterDefinitions) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside ParametersItem objects. +func (m *ParametersItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + { + p, ok := m.Oneof.(*ParametersItem_Parameter) + if ok { + _, err := p.Parameter.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*ParametersItem_JsonReference) + if ok { + info, err := p.JsonReference.ResolveReferences(root) + if err != nil { + return nil, err + } else if info != nil { + n, err := NewParametersItem(info, nil) + if err != nil { + return nil, err + } else if n != nil { + *m = *n + return nil, nil + } + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside PathItem objects. +func (m *PathItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.XRef != "" { + info, err := compiler.ReadInfoForRef(root, m.XRef) + if err != nil { + return nil, err + } + if info != nil { + replacement, err := NewPathItem(info, nil) + if err == nil { + *m = *replacement + return m.ResolveReferences(root) + } + } + return info, nil + } + if m.Get != nil { + _, err := m.Get.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Put != nil { + _, err := m.Put.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Post != nil { + _, err := m.Post.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Delete != nil { + _, err := m.Delete.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Options != nil { + _, err := m.Options.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Head != nil { + _, err := m.Head.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Patch != nil { + _, err := m.Patch.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Parameters { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside PathParameterSubSchema objects. +func (m *PathParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Items != nil { + _, err := m.Items.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Default != nil { + _, err := m.Default.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Enum { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Paths objects. +func (m *Paths) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.Path { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside PrimitivesItems objects. +func (m *PrimitivesItems) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Items != nil { + _, err := m.Items.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Default != nil { + _, err := m.Default.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Enum { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Properties objects. +func (m *Properties) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside QueryParameterSubSchema objects. +func (m *QueryParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Items != nil { + _, err := m.Items.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Default != nil { + _, err := m.Default.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Enum { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Response objects. +func (m *Response) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.Schema != nil { + _, err := m.Schema.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Headers != nil { + _, err := m.Headers.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Examples != nil { + _, err := m.Examples.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside ResponseDefinitions objects. +func (m *ResponseDefinitions) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside ResponseValue objects. +func (m *ResponseValue) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + { + p, ok := m.Oneof.(*ResponseValue_Response) + if ok { + _, err := p.Response.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*ResponseValue_JsonReference) + if ok { + info, err := p.JsonReference.ResolveReferences(root) + if err != nil { + return nil, err + } else if info != nil { + n, err := NewResponseValue(info, nil) + if err != nil { + return nil, err + } else if n != nil { + *m = *n + return nil, nil + } + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Responses objects. +func (m *Responses) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.ResponseCode { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Schema objects. +func (m *Schema) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.XRef != "" { + info, err := compiler.ReadInfoForRef(root, m.XRef) + if err != nil { + return nil, err + } + if info != nil { + replacement, err := NewSchema(info, nil) + if err == nil { + *m = *replacement + return m.ResolveReferences(root) + } + } + return info, nil + } + if m.Default != nil { + _, err := m.Default.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.Enum { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + if m.AdditionalProperties != nil { + _, err := m.AdditionalProperties.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Type != nil { + _, err := m.Type.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Items != nil { + _, err := m.Items.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.AllOf { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + if m.Properties != nil { + _, err := m.Properties.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Xml != nil { + _, err := m.Xml.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.ExternalDocs != nil { + _, err := m.ExternalDocs.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + if m.Example != nil { + _, err := m.Example.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside SchemaItem objects. +func (m *SchemaItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + { + p, ok := m.Oneof.(*SchemaItem_Schema) + if ok { + _, err := p.Schema.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*SchemaItem_FileSchema) + if ok { + _, err := p.FileSchema.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside SecurityDefinitions objects. +func (m *SecurityDefinitions) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside SecurityDefinitionsItem objects. +func (m *SecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + { + p, ok := m.Oneof.(*SecurityDefinitionsItem_BasicAuthenticationSecurity) + if ok { + _, err := p.BasicAuthenticationSecurity.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*SecurityDefinitionsItem_ApiKeySecurity) + if ok { + _, err := p.ApiKeySecurity.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ImplicitSecurity) + if ok { + _, err := p.Oauth2ImplicitSecurity.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2PasswordSecurity) + if ok { + _, err := p.Oauth2PasswordSecurity.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ApplicationSecurity) + if ok { + _, err := p.Oauth2ApplicationSecurity.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + { + p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) + if ok { + _, err := p.Oauth2AccessCodeSecurity.ResolveReferences(root) + if err != nil { + return nil, err + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside SecurityRequirement objects. +func (m *SecurityRequirement) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside StringArray objects. +func (m *StringArray) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Tag objects. +func (m *Tag) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + if m.ExternalDocs != nil { + _, err := m.ExternalDocs.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside TypeItem objects. +func (m *TypeItem) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside VendorExtension objects. +func (m *VendorExtension) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.AdditionalProperties { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ResolveReferences resolves references found inside Xml objects. +func (m *Xml) ResolveReferences(root string) (*yaml.Node, error) { + errors := make([]error, 0) + for _, item := range m.VendorExtension { + if item != nil { + _, err := item.ResolveReferences(root) + if err != nil { + errors = append(errors, err) + } + } + } + return nil, compiler.NewErrorGroupOrNil(errors) +} + +// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export. +func (m *AdditionalPropertiesItem) ToRawInfo() *yaml.Node { + // ONE OF WRAPPER + // AdditionalPropertiesItem + // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v0 := m.GetSchema() + if v0 != nil { + return v0.ToRawInfo() + } + // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { + return compiler.NewScalarNodeForBool(v1.Boolean) + } + return compiler.NewNullNode() +} + +// ToRawInfo returns a description of Any suitable for JSON or YAML export. +func (m *Any) ToRawInfo() *yaml.Node { + var err error + var node yaml.Node + err = yaml.Unmarshal([]byte(m.Yaml), &node) + if err == nil { + if node.Kind == yaml.DocumentNode { + return node.Content[0] + } + return &node + } + return compiler.NewNullNode() +} + +// ToRawInfo returns a description of ApiKeySecurity suitable for JSON or YAML export. +func (m *ApiKeySecurity) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of BasicAuthenticationSecurity suitable for JSON or YAML export. +func (m *BasicAuthenticationSecurity) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of BodyParameter suitable for JSON or YAML export. +func (m *BodyParameter) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) + if m.Required != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) + info.Content = append(info.Content, m.Schema.ToRawInfo()) + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Contact suitable for JSON or YAML export. +func (m *Contact) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + if m.Url != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) + } + if m.Email != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("email")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Email)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Default suitable for JSON or YAML export. +func (m *Default) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Definitions suitable for JSON or YAML export. +func (m *Definitions) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Document suitable for JSON or YAML export. +func (m *Document) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("swagger")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Swagger)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("info")) + info.Content = append(info.Content, m.Info.ToRawInfo()) + if m.Host != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("host")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Host)) + } + if m.BasePath != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("basePath")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.BasePath)) + } + if len(m.Schemes) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes)) + } + if len(m.Consumes) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes)) + } + if len(m.Produces) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("produces")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces)) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("paths")) + info.Content = append(info.Content, m.Paths.ToRawInfo()) + if m.Definitions != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("definitions")) + info.Content = append(info.Content, m.Definitions.ToRawInfo()) + } + if m.Parameters != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) + info.Content = append(info.Content, m.Parameters.ToRawInfo()) + } + if m.Responses != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) + info.Content = append(info.Content, m.Responses.ToRawInfo()) + } + if len(m.Security) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Security { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) + info.Content = append(info.Content, items) + } + if m.SecurityDefinitions != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("securityDefinitions")) + info.Content = append(info.Content, m.SecurityDefinitions.ToRawInfo()) + } + if len(m.Tags) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Tags { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) + info.Content = append(info.Content, items) + } + if m.ExternalDocs != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) + info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Examples suitable for JSON or YAML export. +func (m *Examples) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export. +func (m *ExternalDocs) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of FileSchema suitable for JSON or YAML export. +func (m *FileSchema) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Format != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) + } + if m.Title != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.Default != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) + info.Content = append(info.Content, m.Default.ToRawInfo()) + } + if len(m.Required) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required)) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + if m.ReadOnly != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly)) + } + if m.ExternalDocs != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) + info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) + } + if m.Example != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) + info.Content = append(info.Content, m.Example.ToRawInfo()) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of FormDataParameterSubSchema suitable for JSON or YAML export. +func (m *FormDataParameterSubSchema) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Required != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) + } + if m.In != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + if m.AllowEmptyValue != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) + } + if m.Type != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + } + if m.Format != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) + } + if m.Items != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) + info.Content = append(info.Content, m.Items.ToRawInfo()) + } + if m.CollectionFormat != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) + } + if m.Default != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) + info.Content = append(info.Content, m.Default.ToRawInfo()) + } + if m.Maximum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) + } + if m.ExclusiveMaximum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) + } + if m.Minimum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) + } + if m.ExclusiveMinimum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) + } + if m.MaxLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) + } + if m.MinLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) + } + if m.Pattern != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) + } + if m.MaxItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) + } + if m.MinItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) + } + if m.UniqueItems != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) + } + if len(m.Enum) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Enum { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) + info.Content = append(info.Content, items) + } + if m.MultipleOf != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Header suitable for JSON or YAML export. +func (m *Header) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + if m.Format != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) + } + if m.Items != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) + info.Content = append(info.Content, m.Items.ToRawInfo()) + } + if m.CollectionFormat != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) + } + if m.Default != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) + info.Content = append(info.Content, m.Default.ToRawInfo()) + } + if m.Maximum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) + } + if m.ExclusiveMaximum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) + } + if m.Minimum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) + } + if m.ExclusiveMinimum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) + } + if m.MaxLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) + } + if m.MinLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) + } + if m.Pattern != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) + } + if m.MaxItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) + } + if m.MinItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) + } + if m.UniqueItems != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) + } + if len(m.Enum) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Enum { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) + info.Content = append(info.Content, items) + } + if m.MultipleOf != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of HeaderParameterSubSchema suitable for JSON or YAML export. +func (m *HeaderParameterSubSchema) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Required != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) + } + if m.In != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + if m.Type != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + } + if m.Format != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) + } + if m.Items != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) + info.Content = append(info.Content, m.Items.ToRawInfo()) + } + if m.CollectionFormat != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) + } + if m.Default != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) + info.Content = append(info.Content, m.Default.ToRawInfo()) + } + if m.Maximum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) + } + if m.ExclusiveMaximum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) + } + if m.Minimum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) + } + if m.ExclusiveMinimum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) + } + if m.MaxLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) + } + if m.MinLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) + } + if m.Pattern != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) + } + if m.MaxItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) + } + if m.MinItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) + } + if m.UniqueItems != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) + } + if len(m.Enum) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Enum { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) + info.Content = append(info.Content, items) + } + if m.MultipleOf != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Headers suitable for JSON or YAML export. +func (m *Headers) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Info suitable for JSON or YAML export. +func (m *Info) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("version")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Version)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.TermsOfService != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("termsOfService")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TermsOfService)) + } + if m.Contact != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("contact")) + info.Content = append(info.Content, m.Contact.ToRawInfo()) + } + if m.License != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("license")) + info.Content = append(info.Content, m.License.ToRawInfo()) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export. +func (m *ItemsItem) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if len(m.Schema) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Schema { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) + info.Content = append(info.Content, items) + } + return info +} + +// ToRawInfo returns a description of JsonReference suitable for JSON or YAML export. +func (m *JsonReference) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + return info +} + +// ToRawInfo returns a description of License suitable for JSON or YAML export. +func (m *License) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + if m.Url != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export. +func (m *NamedAny) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + if m.Value != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) + info.Content = append(info.Content, m.Value.ToRawInfo()) + } + return info +} + +// ToRawInfo returns a description of NamedHeader suitable for JSON or YAML export. +func (m *NamedHeader) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + // &{Name:value Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} + return info +} + +// ToRawInfo returns a description of NamedParameter suitable for JSON or YAML export. +func (m *NamedParameter) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + // &{Name:value Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} + return info +} + +// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export. +func (m *NamedPathItem) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} + return info +} + +// ToRawInfo returns a description of NamedResponse suitable for JSON or YAML export. +func (m *NamedResponse) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + // &{Name:value Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} + return info +} + +// ToRawInfo returns a description of NamedResponseValue suitable for JSON or YAML export. +func (m *NamedResponseValue) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + // &{Name:value Type:ResponseValue StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} + return info +} + +// ToRawInfo returns a description of NamedSchema suitable for JSON or YAML export. +func (m *NamedSchema) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + // &{Name:value Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} + return info +} + +// ToRawInfo returns a description of NamedSecurityDefinitionsItem suitable for JSON or YAML export. +func (m *NamedSecurityDefinitionsItem) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + // &{Name:value Type:SecurityDefinitionsItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} + return info +} + +// ToRawInfo returns a description of NamedString suitable for JSON or YAML export. +func (m *NamedString) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + if m.Value != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Value)) + } + return info +} + +// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export. +func (m *NamedStringArray) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} + return info +} + +// ToRawInfo returns a description of NonBodyParameter suitable for JSON or YAML export. +func (m *NonBodyParameter) ToRawInfo() *yaml.Node { + // ONE OF WRAPPER + // NonBodyParameter + // {Name:headerParameterSubSchema Type:HeaderParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v0 := m.GetHeaderParameterSubSchema() + if v0 != nil { + return v0.ToRawInfo() + } + // {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v1 := m.GetFormDataParameterSubSchema() + if v1 != nil { + return v1.ToRawInfo() + } + // {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v2 := m.GetQueryParameterSubSchema() + if v2 != nil { + return v2.ToRawInfo() + } + // {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v3 := m.GetPathParameterSubSchema() + if v3 != nil { + return v3.ToRawInfo() + } + return compiler.NewNullNode() +} + +// ToRawInfo returns a description of Oauth2AccessCodeSecurity suitable for JSON or YAML export. +func (m *Oauth2AccessCodeSecurity) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) + if m.Scopes != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) + info.Content = append(info.Content, m.Scopes.ToRawInfo()) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Oauth2ApplicationSecurity suitable for JSON or YAML export. +func (m *Oauth2ApplicationSecurity) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) + if m.Scopes != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) + info.Content = append(info.Content, m.Scopes.ToRawInfo()) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Oauth2ImplicitSecurity suitable for JSON or YAML export. +func (m *Oauth2ImplicitSecurity) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) + if m.Scopes != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) + info.Content = append(info.Content, m.Scopes.ToRawInfo()) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Oauth2PasswordSecurity suitable for JSON or YAML export. +func (m *Oauth2PasswordSecurity) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) + if m.Scopes != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) + info.Content = append(info.Content, m.Scopes.ToRawInfo()) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Oauth2Scopes suitable for JSON or YAML export. +func (m *Oauth2Scopes) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:} + return info +} + +// ToRawInfo returns a description of Operation suitable for JSON or YAML export. +func (m *Operation) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if len(m.Tags) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Tags)) + } + if m.Summary != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.ExternalDocs != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) + info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) + } + if m.OperationId != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId)) + } + if len(m.Produces) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("produces")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces)) + } + if len(m.Consumes) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes)) + } + if len(m.Parameters) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Parameters { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) + info.Content = append(info.Content, items) + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) + info.Content = append(info.Content, m.Responses.ToRawInfo()) + if len(m.Schemes) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes)) + } + if m.Deprecated != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) + } + if len(m.Security) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Security { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) + info.Content = append(info.Content, items) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Parameter suitable for JSON or YAML export. +func (m *Parameter) ToRawInfo() *yaml.Node { + // ONE OF WRAPPER + // Parameter + // {Name:bodyParameter Type:BodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v0 := m.GetBodyParameter() + if v0 != nil { + return v0.ToRawInfo() + } + // {Name:nonBodyParameter Type:NonBodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v1 := m.GetNonBodyParameter() + if v1 != nil { + return v1.ToRawInfo() + } + return compiler.NewNullNode() +} + +// ToRawInfo returns a description of ParameterDefinitions suitable for JSON or YAML export. +func (m *ParameterDefinitions) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of ParametersItem suitable for JSON or YAML export. +func (m *ParametersItem) ToRawInfo() *yaml.Node { + // ONE OF WRAPPER + // ParametersItem + // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v0 := m.GetParameter() + if v0 != nil { + return v0.ToRawInfo() + } + // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v1 := m.GetJsonReference() + if v1 != nil { + return v1.ToRawInfo() + } + return compiler.NewNullNode() +} + +// ToRawInfo returns a description of PathItem suitable for JSON or YAML export. +func (m *PathItem) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.XRef != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) + } + if m.Get != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("get")) + info.Content = append(info.Content, m.Get.ToRawInfo()) + } + if m.Put != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("put")) + info.Content = append(info.Content, m.Put.ToRawInfo()) + } + if m.Post != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("post")) + info.Content = append(info.Content, m.Post.ToRawInfo()) + } + if m.Delete != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("delete")) + info.Content = append(info.Content, m.Delete.ToRawInfo()) + } + if m.Options != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("options")) + info.Content = append(info.Content, m.Options.ToRawInfo()) + } + if m.Head != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("head")) + info.Content = append(info.Content, m.Head.ToRawInfo()) + } + if m.Patch != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("patch")) + info.Content = append(info.Content, m.Patch.ToRawInfo()) + } + if len(m.Parameters) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Parameters { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) + info.Content = append(info.Content, items) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of PathParameterSubSchema suitable for JSON or YAML export. +func (m *PathParameterSubSchema) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) + if m.In != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + if m.Type != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + } + if m.Format != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) + } + if m.Items != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) + info.Content = append(info.Content, m.Items.ToRawInfo()) + } + if m.CollectionFormat != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) + } + if m.Default != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) + info.Content = append(info.Content, m.Default.ToRawInfo()) + } + if m.Maximum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) + } + if m.ExclusiveMaximum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) + } + if m.Minimum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) + } + if m.ExclusiveMinimum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) + } + if m.MaxLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) + } + if m.MinLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) + } + if m.Pattern != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) + } + if m.MaxItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) + } + if m.MinItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) + } + if m.UniqueItems != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) + } + if len(m.Enum) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Enum { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) + info.Content = append(info.Content, items) + } + if m.MultipleOf != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Paths suitable for JSON or YAML export. +func (m *Paths) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + if m.Path != nil { + for _, item := range m.Path { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of PrimitivesItems suitable for JSON or YAML export. +func (m *PrimitivesItems) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Type != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + } + if m.Format != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) + } + if m.Items != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) + info.Content = append(info.Content, m.Items.ToRawInfo()) + } + if m.CollectionFormat != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) + } + if m.Default != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) + info.Content = append(info.Content, m.Default.ToRawInfo()) + } + if m.Maximum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) + } + if m.ExclusiveMaximum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) + } + if m.Minimum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) + } + if m.ExclusiveMinimum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) + } + if m.MaxLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) + } + if m.MinLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) + } + if m.Pattern != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) + } + if m.MaxItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) + } + if m.MinItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) + } + if m.UniqueItems != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) + } + if len(m.Enum) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Enum { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) + info.Content = append(info.Content, items) + } + if m.MultipleOf != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Properties suitable for JSON or YAML export. +func (m *Properties) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of QueryParameterSubSchema suitable for JSON or YAML export. +func (m *QueryParameterSubSchema) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Required != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) + } + if m.In != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + if m.AllowEmptyValue != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) + } + if m.Type != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) + } + if m.Format != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) + } + if m.Items != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) + info.Content = append(info.Content, m.Items.ToRawInfo()) + } + if m.CollectionFormat != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) + } + if m.Default != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) + info.Content = append(info.Content, m.Default.ToRawInfo()) + } + if m.Maximum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) + } + if m.ExclusiveMaximum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) + } + if m.Minimum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) + } + if m.ExclusiveMinimum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) + } + if m.MaxLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) + } + if m.MinLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) + } + if m.Pattern != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) + } + if m.MaxItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) + } + if m.MinItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) + } + if m.UniqueItems != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) + } + if len(m.Enum) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Enum { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) + info.Content = append(info.Content, items) + } + if m.MultipleOf != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Response suitable for JSON or YAML export. +func (m *Response) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + if m.Schema != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) + info.Content = append(info.Content, m.Schema.ToRawInfo()) + } + if m.Headers != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) + info.Content = append(info.Content, m.Headers.ToRawInfo()) + } + if m.Examples != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) + info.Content = append(info.Content, m.Examples.ToRawInfo()) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of ResponseDefinitions suitable for JSON or YAML export. +func (m *ResponseDefinitions) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of ResponseValue suitable for JSON or YAML export. +func (m *ResponseValue) ToRawInfo() *yaml.Node { + // ONE OF WRAPPER + // ResponseValue + // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v0 := m.GetResponse() + if v0 != nil { + return v0.ToRawInfo() + } + // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v1 := m.GetJsonReference() + if v1 != nil { + return v1.ToRawInfo() + } + return compiler.NewNullNode() +} + +// ToRawInfo returns a description of Responses suitable for JSON or YAML export. +func (m *Responses) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.ResponseCode != nil { + for _, item := range m.ResponseCode { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Schema suitable for JSON or YAML export. +func (m *Schema) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.XRef != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) + } + if m.Format != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) + } + if m.Title != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) + } + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.Default != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) + info.Content = append(info.Content, m.Default.ToRawInfo()) + } + if m.MultipleOf != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) + } + if m.Maximum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) + } + if m.ExclusiveMaximum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) + } + if m.Minimum != 0.0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) + } + if m.ExclusiveMinimum != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) + } + if m.MaxLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) + } + if m.MinLength != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) + } + if m.Pattern != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) + } + if m.MaxItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) + } + if m.MinItems != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) + } + if m.UniqueItems != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) + } + if m.MaxProperties != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("maxProperties")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxProperties)) + } + if m.MinProperties != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("minProperties")) + info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinProperties)) + } + if len(m.Required) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required)) + } + if len(m.Enum) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.Enum { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) + info.Content = append(info.Content, items) + } + if m.AdditionalProperties != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("additionalProperties")) + info.Content = append(info.Content, m.AdditionalProperties.ToRawInfo()) + } + if m.Type != nil { + if len(m.Type.Value) == 1 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type.Value[0])) + } else { + info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Type.Value)) + } + } + if m.Items != nil { + items := compiler.NewSequenceNode() + for _, item := range m.Items.Schema { + items.Content = append(items.Content, item.ToRawInfo()) + } + if len(items.Content) == 1 { + items = items.Content[0] + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) + info.Content = append(info.Content, items) + } + if len(m.AllOf) != 0 { + items := compiler.NewSequenceNode() + for _, item := range m.AllOf { + items.Content = append(items.Content, item.ToRawInfo()) + } + info.Content = append(info.Content, compiler.NewScalarNodeForString("allOf")) + info.Content = append(info.Content, items) + } + if m.Properties != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("properties")) + info.Content = append(info.Content, m.Properties.ToRawInfo()) + } + if m.Discriminator != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("discriminator")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Discriminator)) + } + if m.ReadOnly != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly)) + } + if m.Xml != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("xml")) + info.Content = append(info.Content, m.Xml.ToRawInfo()) + } + if m.ExternalDocs != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) + info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) + } + if m.Example != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) + info.Content = append(info.Content, m.Example.ToRawInfo()) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of SchemaItem suitable for JSON or YAML export. +func (m *SchemaItem) ToRawInfo() *yaml.Node { + // ONE OF WRAPPER + // SchemaItem + // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v0 := m.GetSchema() + if v0 != nil { + return v0.ToRawInfo() + } + // {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v1 := m.GetFileSchema() + if v1 != nil { + return v1.ToRawInfo() + } + return compiler.NewNullNode() +} + +// ToRawInfo returns a description of SecurityDefinitions suitable for JSON or YAML export. +func (m *SecurityDefinitions) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of SecurityDefinitionsItem suitable for JSON or YAML export. +func (m *SecurityDefinitionsItem) ToRawInfo() *yaml.Node { + // ONE OF WRAPPER + // SecurityDefinitionsItem + // {Name:basicAuthenticationSecurity Type:BasicAuthenticationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v0 := m.GetBasicAuthenticationSecurity() + if v0 != nil { + return v0.ToRawInfo() + } + // {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v1 := m.GetApiKeySecurity() + if v1 != nil { + return v1.ToRawInfo() + } + // {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v2 := m.GetOauth2ImplicitSecurity() + if v2 != nil { + return v2.ToRawInfo() + } + // {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v3 := m.GetOauth2PasswordSecurity() + if v3 != nil { + return v3.ToRawInfo() + } + // {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v4 := m.GetOauth2ApplicationSecurity() + if v4 != nil { + return v4.ToRawInfo() + } + // {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} + v5 := m.GetOauth2AccessCodeSecurity() + if v5 != nil { + return v5.ToRawInfo() + } + return compiler.NewNullNode() +} + +// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export. +func (m *SecurityRequirement) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of StringArray suitable for JSON or YAML export. +func (m *StringArray) ToRawInfo() *yaml.Node { + return compiler.NewSequenceNodeForStringArray(m.Value) +} + +// ToRawInfo returns a description of Tag suitable for JSON or YAML export. +func (m *Tag) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + // always include this required field. + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + if m.Description != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) + } + if m.ExternalDocs != nil { + info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) + info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of TypeItem suitable for JSON or YAML export. +func (m *TypeItem) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if len(m.Value) != 0 { + info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) + info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Value)) + } + return info +} + +// ToRawInfo returns a description of VendorExtension suitable for JSON or YAML export. +func (m *VendorExtension) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.AdditionalProperties != nil { + for _, item := range m.AdditionalProperties { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +// ToRawInfo returns a description of Xml suitable for JSON or YAML export. +func (m *Xml) ToRawInfo() *yaml.Node { + info := compiler.NewMappingNode() + if m == nil { + return info + } + if m.Name != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) + } + if m.Namespace != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("namespace")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Namespace)) + } + if m.Prefix != "" { + info.Content = append(info.Content, compiler.NewScalarNodeForString("prefix")) + info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Prefix)) + } + if m.Attribute != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("attribute")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Attribute)) + } + if m.Wrapped != false { + info.Content = append(info.Content, compiler.NewScalarNodeForString("wrapped")) + info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Wrapped)) + } + if m.VendorExtension != nil { + for _, item := range m.VendorExtension { + info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) + info.Content = append(info.Content, item.Value.ToRawInfo()) + } + } + return info +} + +var ( + pattern0 = regexp.MustCompile("^x-") + pattern1 = regexp.MustCompile("^/") + pattern2 = regexp.MustCompile("^([0-9]{3})$|^(default)$") +) diff --git a/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.pb.go b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.pb.go new file mode 100644 index 000000000..8a5f302f3 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.pb.go @@ -0,0 +1,7342 @@ +// Copyright 2020 Google LLC. All Rights Reserved. +// +// 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. + +// THIS FILE IS AUTOMATICALLY GENERATED. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.5 +// source: openapiv2/OpenAPIv2.proto + +package openapi_v2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AdditionalPropertiesItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Oneof: + // *AdditionalPropertiesItem_Schema + // *AdditionalPropertiesItem_Boolean + Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"` +} + +func (x *AdditionalPropertiesItem) Reset() { + *x = AdditionalPropertiesItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AdditionalPropertiesItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AdditionalPropertiesItem) ProtoMessage() {} + +func (x *AdditionalPropertiesItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AdditionalPropertiesItem.ProtoReflect.Descriptor instead. +func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{0} +} + +func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof { + if m != nil { + return m.Oneof + } + return nil +} + +func (x *AdditionalPropertiesItem) GetSchema() *Schema { + if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Schema); ok { + return x.Schema + } + return nil +} + +func (x *AdditionalPropertiesItem) GetBoolean() bool { + if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { + return x.Boolean + } + return false +} + +type isAdditionalPropertiesItem_Oneof interface { + isAdditionalPropertiesItem_Oneof() +} + +type AdditionalPropertiesItem_Schema struct { + Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"` +} + +type AdditionalPropertiesItem_Boolean struct { + Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` +} + +func (*AdditionalPropertiesItem_Schema) isAdditionalPropertiesItem_Oneof() {} + +func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {} + +type Any struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Yaml string `protobuf:"bytes,2,opt,name=yaml,proto3" json:"yaml,omitempty"` +} + +func (x *Any) Reset() { + *x = Any{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Any) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Any) ProtoMessage() {} + +func (x *Any) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Any.ProtoReflect.Descriptor instead. +func (*Any) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{1} +} + +func (x *Any) GetValue() *anypb.Any { + if x != nil { + return x.Value + } + return nil +} + +func (x *Any) GetYaml() string { + if x != nil { + return x.Yaml + } + return "" +} + +type ApiKeySecurity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *ApiKeySecurity) Reset() { + *x = ApiKeySecurity{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApiKeySecurity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiKeySecurity) ProtoMessage() {} + +func (x *ApiKeySecurity) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiKeySecurity.ProtoReflect.Descriptor instead. +func (*ApiKeySecurity) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{2} +} + +func (x *ApiKeySecurity) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ApiKeySecurity) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ApiKeySecurity) GetIn() string { + if x != nil { + return x.In + } + return "" +} + +func (x *ApiKeySecurity) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *ApiKeySecurity) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type BasicAuthenticationSecurity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *BasicAuthenticationSecurity) Reset() { + *x = BasicAuthenticationSecurity{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BasicAuthenticationSecurity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BasicAuthenticationSecurity) ProtoMessage() {} + +func (x *BasicAuthenticationSecurity) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BasicAuthenticationSecurity.ProtoReflect.Descriptor instead. +func (*BasicAuthenticationSecurity) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{3} +} + +func (x *BasicAuthenticationSecurity) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *BasicAuthenticationSecurity) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *BasicAuthenticationSecurity) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type BodyParameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + // The name of the parameter. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Determines the location of the parameter. + In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"` + // Determines whether or not this parameter is required or optional. + Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"` + Schema *Schema `protobuf:"bytes,5,opt,name=schema,proto3" json:"schema,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *BodyParameter) Reset() { + *x = BodyParameter{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BodyParameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BodyParameter) ProtoMessage() {} + +func (x *BodyParameter) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BodyParameter.ProtoReflect.Descriptor instead. +func (*BodyParameter) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{4} +} + +func (x *BodyParameter) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *BodyParameter) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BodyParameter) GetIn() string { + if x != nil { + return x.In + } + return "" +} + +func (x *BodyParameter) GetRequired() bool { + if x != nil { + return x.Required + } + return false +} + +func (x *BodyParameter) GetSchema() *Schema { + if x != nil { + return x.Schema + } + return nil +} + +func (x *BodyParameter) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +// Contact information for the owners of the API. +type Contact struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The identifying name of the contact person/organization. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The URL pointing to the contact information. + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + // The email address of the contact person/organization. + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Contact) Reset() { + *x = Contact{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Contact) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Contact) ProtoMessage() {} + +func (x *Contact) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Contact.ProtoReflect.Descriptor instead. +func (*Contact) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{5} +} + +func (x *Contact) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Contact) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Contact) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *Contact) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Default struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *Default) Reset() { + *x = Default{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Default) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Default) ProtoMessage() {} + +func (x *Default) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Default.ProtoReflect.Descriptor instead. +func (*Default) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{6} +} + +func (x *Default) GetAdditionalProperties() []*NamedAny { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +// One or more JSON objects describing the schemas being consumed and produced by the API. +type Definitions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *Definitions) Reset() { + *x = Definitions{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Definitions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Definitions) ProtoMessage() {} + +func (x *Definitions) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Definitions.ProtoReflect.Descriptor instead. +func (*Definitions) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{7} +} + +func (x *Definitions) GetAdditionalProperties() []*NamedSchema { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +type Document struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The Swagger version of this document. + Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"` + Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // The host (name or ip) of the API. Example: 'swagger.io' + Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` + // The base path to the API. Example: '/api'. + BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` + // The transfer protocol of the API. + Schemes []string `protobuf:"bytes,5,rep,name=schemes,proto3" json:"schemes,omitempty"` + // A list of MIME types accepted by the API. + Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` + // A list of MIME types the API can produce. + Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` + Paths *Paths `protobuf:"bytes,8,opt,name=paths,proto3" json:"paths,omitempty"` + Definitions *Definitions `protobuf:"bytes,9,opt,name=definitions,proto3" json:"definitions,omitempty"` + Parameters *ParameterDefinitions `protobuf:"bytes,10,opt,name=parameters,proto3" json:"parameters,omitempty"` + Responses *ResponseDefinitions `protobuf:"bytes,11,opt,name=responses,proto3" json:"responses,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` + SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,13,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"` + Tags []*Tag `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"` + ExternalDocs *ExternalDocs `protobuf:"bytes,15,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,16,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Document) Reset() { + *x = Document{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Document) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Document) ProtoMessage() {} + +func (x *Document) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Document.ProtoReflect.Descriptor instead. +func (*Document) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{8} +} + +func (x *Document) GetSwagger() string { + if x != nil { + return x.Swagger + } + return "" +} + +func (x *Document) GetInfo() *Info { + if x != nil { + return x.Info + } + return nil +} + +func (x *Document) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *Document) GetBasePath() string { + if x != nil { + return x.BasePath + } + return "" +} + +func (x *Document) GetSchemes() []string { + if x != nil { + return x.Schemes + } + return nil +} + +func (x *Document) GetConsumes() []string { + if x != nil { + return x.Consumes + } + return nil +} + +func (x *Document) GetProduces() []string { + if x != nil { + return x.Produces + } + return nil +} + +func (x *Document) GetPaths() *Paths { + if x != nil { + return x.Paths + } + return nil +} + +func (x *Document) GetDefinitions() *Definitions { + if x != nil { + return x.Definitions + } + return nil +} + +func (x *Document) GetParameters() *ParameterDefinitions { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *Document) GetResponses() *ResponseDefinitions { + if x != nil { + return x.Responses + } + return nil +} + +func (x *Document) GetSecurity() []*SecurityRequirement { + if x != nil { + return x.Security + } + return nil +} + +func (x *Document) GetSecurityDefinitions() *SecurityDefinitions { + if x != nil { + return x.SecurityDefinitions + } + return nil +} + +func (x *Document) GetTags() []*Tag { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Document) GetExternalDocs() *ExternalDocs { + if x != nil { + return x.ExternalDocs + } + return nil +} + +func (x *Document) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Examples struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *Examples) Reset() { + *x = Examples{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Examples) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Examples) ProtoMessage() {} + +func (x *Examples) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Examples.ProtoReflect.Descriptor instead. +func (*Examples) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{9} +} + +func (x *Examples) GetAdditionalProperties() []*NamedAny { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +// information about external documentation +type ExternalDocs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *ExternalDocs) Reset() { + *x = ExternalDocs{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExternalDocs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExternalDocs) ProtoMessage() {} + +func (x *ExternalDocs) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExternalDocs.ProtoReflect.Descriptor instead. +func (*ExternalDocs) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{10} +} + +func (x *ExternalDocs) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *ExternalDocs) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *ExternalDocs) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +// A deterministic version of a JSON Schema object. +type FileSchema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Format string `protobuf:"bytes,1,opt,name=format,proto3" json:"format,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Default *Any `protobuf:"bytes,4,opt,name=default,proto3" json:"default,omitempty"` + Required []string `protobuf:"bytes,5,rep,name=required,proto3" json:"required,omitempty"` + Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` + ReadOnly bool `protobuf:"varint,7,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` + ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + Example *Any `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *FileSchema) Reset() { + *x = FileSchema{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileSchema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileSchema) ProtoMessage() {} + +func (x *FileSchema) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileSchema.ProtoReflect.Descriptor instead. +func (*FileSchema) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{11} +} + +func (x *FileSchema) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *FileSchema) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *FileSchema) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *FileSchema) GetDefault() *Any { + if x != nil { + return x.Default + } + return nil +} + +func (x *FileSchema) GetRequired() []string { + if x != nil { + return x.Required + } + return nil +} + +func (x *FileSchema) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *FileSchema) GetReadOnly() bool { + if x != nil { + return x.ReadOnly + } + return false +} + +func (x *FileSchema) GetExternalDocs() *ExternalDocs { + if x != nil { + return x.ExternalDocs + } + return nil +} + +func (x *FileSchema) GetExample() *Any { + if x != nil { + return x.Example + } + return nil +} + +func (x *FileSchema) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type FormDataParameterSubSchema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Determines whether or not this parameter is required or optional. + Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` + // Determines the location of the parameter. + In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // The name of the parameter. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // allows sending a parameter by name only or with an empty value. + AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` + Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` + Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"` + Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"` + CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` + Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"` + Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` + MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` + MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` + MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` + MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` + Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"` + MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *FormDataParameterSubSchema) Reset() { + *x = FormDataParameterSubSchema{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FormDataParameterSubSchema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FormDataParameterSubSchema) ProtoMessage() {} + +func (x *FormDataParameterSubSchema) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FormDataParameterSubSchema.ProtoReflect.Descriptor instead. +func (*FormDataParameterSubSchema) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{12} +} + +func (x *FormDataParameterSubSchema) GetRequired() bool { + if x != nil { + return x.Required + } + return false +} + +func (x *FormDataParameterSubSchema) GetIn() string { + if x != nil { + return x.In + } + return "" +} + +func (x *FormDataParameterSubSchema) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *FormDataParameterSubSchema) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FormDataParameterSubSchema) GetAllowEmptyValue() bool { + if x != nil { + return x.AllowEmptyValue + } + return false +} + +func (x *FormDataParameterSubSchema) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *FormDataParameterSubSchema) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *FormDataParameterSubSchema) GetItems() *PrimitivesItems { + if x != nil { + return x.Items + } + return nil +} + +func (x *FormDataParameterSubSchema) GetCollectionFormat() string { + if x != nil { + return x.CollectionFormat + } + return "" +} + +func (x *FormDataParameterSubSchema) GetDefault() *Any { + if x != nil { + return x.Default + } + return nil +} + +func (x *FormDataParameterSubSchema) GetMaximum() float64 { + if x != nil { + return x.Maximum + } + return 0 +} + +func (x *FormDataParameterSubSchema) GetExclusiveMaximum() bool { + if x != nil { + return x.ExclusiveMaximum + } + return false +} + +func (x *FormDataParameterSubSchema) GetMinimum() float64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *FormDataParameterSubSchema) GetExclusiveMinimum() bool { + if x != nil { + return x.ExclusiveMinimum + } + return false +} + +func (x *FormDataParameterSubSchema) GetMaxLength() int64 { + if x != nil { + return x.MaxLength + } + return 0 +} + +func (x *FormDataParameterSubSchema) GetMinLength() int64 { + if x != nil { + return x.MinLength + } + return 0 +} + +func (x *FormDataParameterSubSchema) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *FormDataParameterSubSchema) GetMaxItems() int64 { + if x != nil { + return x.MaxItems + } + return 0 +} + +func (x *FormDataParameterSubSchema) GetMinItems() int64 { + if x != nil { + return x.MinItems + } + return 0 +} + +func (x *FormDataParameterSubSchema) GetUniqueItems() bool { + if x != nil { + return x.UniqueItems + } + return false +} + +func (x *FormDataParameterSubSchema) GetEnum() []*Any { + if x != nil { + return x.Enum + } + return nil +} + +func (x *FormDataParameterSubSchema) GetMultipleOf() float64 { + if x != nil { + return x.MultipleOf + } + return 0 +} + +func (x *FormDataParameterSubSchema) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Header struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` + Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"` + CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` + Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` + Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` + MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` + MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"` + MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` + MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` + Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"` + MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` + Description string `protobuf:"bytes,18,opt,name=description,proto3" json:"description,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,19,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Header) Reset() { + *x = Header{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Header) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header) ProtoMessage() {} + +func (x *Header) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Header.ProtoReflect.Descriptor instead. +func (*Header) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{13} +} + +func (x *Header) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Header) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *Header) GetItems() *PrimitivesItems { + if x != nil { + return x.Items + } + return nil +} + +func (x *Header) GetCollectionFormat() string { + if x != nil { + return x.CollectionFormat + } + return "" +} + +func (x *Header) GetDefault() *Any { + if x != nil { + return x.Default + } + return nil +} + +func (x *Header) GetMaximum() float64 { + if x != nil { + return x.Maximum + } + return 0 +} + +func (x *Header) GetExclusiveMaximum() bool { + if x != nil { + return x.ExclusiveMaximum + } + return false +} + +func (x *Header) GetMinimum() float64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *Header) GetExclusiveMinimum() bool { + if x != nil { + return x.ExclusiveMinimum + } + return false +} + +func (x *Header) GetMaxLength() int64 { + if x != nil { + return x.MaxLength + } + return 0 +} + +func (x *Header) GetMinLength() int64 { + if x != nil { + return x.MinLength + } + return 0 +} + +func (x *Header) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *Header) GetMaxItems() int64 { + if x != nil { + return x.MaxItems + } + return 0 +} + +func (x *Header) GetMinItems() int64 { + if x != nil { + return x.MinItems + } + return 0 +} + +func (x *Header) GetUniqueItems() bool { + if x != nil { + return x.UniqueItems + } + return false +} + +func (x *Header) GetEnum() []*Any { + if x != nil { + return x.Enum + } + return nil +} + +func (x *Header) GetMultipleOf() float64 { + if x != nil { + return x.MultipleOf + } + return 0 +} + +func (x *Header) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Header) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type HeaderParameterSubSchema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Determines whether or not this parameter is required or optional. + Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` + // Determines the location of the parameter. + In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // The name of the parameter. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` + Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"` + Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"` + CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` + Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"` + Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` + MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` + MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"` + MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` + MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` + Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` + MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *HeaderParameterSubSchema) Reset() { + *x = HeaderParameterSubSchema{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeaderParameterSubSchema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeaderParameterSubSchema) ProtoMessage() {} + +func (x *HeaderParameterSubSchema) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeaderParameterSubSchema.ProtoReflect.Descriptor instead. +func (*HeaderParameterSubSchema) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{14} +} + +func (x *HeaderParameterSubSchema) GetRequired() bool { + if x != nil { + return x.Required + } + return false +} + +func (x *HeaderParameterSubSchema) GetIn() string { + if x != nil { + return x.In + } + return "" +} + +func (x *HeaderParameterSubSchema) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *HeaderParameterSubSchema) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *HeaderParameterSubSchema) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *HeaderParameterSubSchema) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *HeaderParameterSubSchema) GetItems() *PrimitivesItems { + if x != nil { + return x.Items + } + return nil +} + +func (x *HeaderParameterSubSchema) GetCollectionFormat() string { + if x != nil { + return x.CollectionFormat + } + return "" +} + +func (x *HeaderParameterSubSchema) GetDefault() *Any { + if x != nil { + return x.Default + } + return nil +} + +func (x *HeaderParameterSubSchema) GetMaximum() float64 { + if x != nil { + return x.Maximum + } + return 0 +} + +func (x *HeaderParameterSubSchema) GetExclusiveMaximum() bool { + if x != nil { + return x.ExclusiveMaximum + } + return false +} + +func (x *HeaderParameterSubSchema) GetMinimum() float64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *HeaderParameterSubSchema) GetExclusiveMinimum() bool { + if x != nil { + return x.ExclusiveMinimum + } + return false +} + +func (x *HeaderParameterSubSchema) GetMaxLength() int64 { + if x != nil { + return x.MaxLength + } + return 0 +} + +func (x *HeaderParameterSubSchema) GetMinLength() int64 { + if x != nil { + return x.MinLength + } + return 0 +} + +func (x *HeaderParameterSubSchema) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *HeaderParameterSubSchema) GetMaxItems() int64 { + if x != nil { + return x.MaxItems + } + return 0 +} + +func (x *HeaderParameterSubSchema) GetMinItems() int64 { + if x != nil { + return x.MinItems + } + return 0 +} + +func (x *HeaderParameterSubSchema) GetUniqueItems() bool { + if x != nil { + return x.UniqueItems + } + return false +} + +func (x *HeaderParameterSubSchema) GetEnum() []*Any { + if x != nil { + return x.Enum + } + return nil +} + +func (x *HeaderParameterSubSchema) GetMultipleOf() float64 { + if x != nil { + return x.MultipleOf + } + return 0 +} + +func (x *HeaderParameterSubSchema) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Headers struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedHeader `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *Headers) Reset() { + *x = Headers{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Headers) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Headers) ProtoMessage() {} + +func (x *Headers) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Headers.ProtoReflect.Descriptor instead. +func (*Headers) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{15} +} + +func (x *Headers) GetAdditionalProperties() []*NamedHeader { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +// General information about the API. +type Info struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique and precise title of the API. + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // A semantic version number of the API. + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // The terms of service for the API. + TermsOfService string `protobuf:"bytes,4,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` + Contact *Contact `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` + License *License `protobuf:"bytes,6,opt,name=license,proto3" json:"license,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Info) Reset() { + *x = Info{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Info) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Info) ProtoMessage() {} + +func (x *Info) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Info.ProtoReflect.Descriptor instead. +func (*Info) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{16} +} + +func (x *Info) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Info) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Info) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Info) GetTermsOfService() string { + if x != nil { + return x.TermsOfService + } + return "" +} + +func (x *Info) GetContact() *Contact { + if x != nil { + return x.Contact + } + return nil +} + +func (x *Info) GetLicense() *License { + if x != nil { + return x.License + } + return nil +} + +func (x *Info) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type ItemsItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Schema []*Schema `protobuf:"bytes,1,rep,name=schema,proto3" json:"schema,omitempty"` +} + +func (x *ItemsItem) Reset() { + *x = ItemsItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ItemsItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ItemsItem) ProtoMessage() {} + +func (x *ItemsItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ItemsItem.ProtoReflect.Descriptor instead. +func (*ItemsItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{17} +} + +func (x *ItemsItem) GetSchema() []*Schema { + if x != nil { + return x.Schema + } + return nil +} + +type JsonReference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` +} + +func (x *JsonReference) Reset() { + *x = JsonReference{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JsonReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JsonReference) ProtoMessage() {} + +func (x *JsonReference) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JsonReference.ProtoReflect.Descriptor instead. +func (*JsonReference) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{18} +} + +func (x *JsonReference) GetXRef() string { + if x != nil { + return x.XRef + } + return "" +} + +func (x *JsonReference) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +type License struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the license type. It's encouraged to use an OSI compatible license. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The URL pointing to the license. + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *License) Reset() { + *x = License{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *License) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*License) ProtoMessage() {} + +func (x *License) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use License.ProtoReflect.Descriptor instead. +func (*License) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{19} +} + +func (x *License) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *License) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *License) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. +type NamedAny struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedAny) Reset() { + *x = NamedAny{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedAny) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedAny) ProtoMessage() {} + +func (x *NamedAny) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedAny.ProtoReflect.Descriptor instead. +func (*NamedAny) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{20} +} + +func (x *NamedAny) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedAny) GetValue() *Any { + if x != nil { + return x.Value + } + return nil +} + +// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs. +type NamedHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *Header `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedHeader) Reset() { + *x = NamedHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedHeader) ProtoMessage() {} + +func (x *NamedHeader) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedHeader.ProtoReflect.Descriptor instead. +func (*NamedHeader) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{21} +} + +func (x *NamedHeader) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedHeader) GetValue() *Header { + if x != nil { + return x.Value + } + return nil +} + +// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs. +type NamedParameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *Parameter `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedParameter) Reset() { + *x = NamedParameter{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedParameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedParameter) ProtoMessage() {} + +func (x *NamedParameter) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedParameter.ProtoReflect.Descriptor instead. +func (*NamedParameter) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{22} +} + +func (x *NamedParameter) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedParameter) GetValue() *Parameter { + if x != nil { + return x.Value + } + return nil +} + +// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. +type NamedPathItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *PathItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedPathItem) Reset() { + *x = NamedPathItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedPathItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedPathItem) ProtoMessage() {} + +func (x *NamedPathItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedPathItem.ProtoReflect.Descriptor instead. +func (*NamedPathItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{23} +} + +func (x *NamedPathItem) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedPathItem) GetValue() *PathItem { + if x != nil { + return x.Value + } + return nil +} + +// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs. +type NamedResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *Response `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedResponse) Reset() { + *x = NamedResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedResponse) ProtoMessage() {} + +func (x *NamedResponse) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedResponse.ProtoReflect.Descriptor instead. +func (*NamedResponse) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{24} +} + +func (x *NamedResponse) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedResponse) GetValue() *Response { + if x != nil { + return x.Value + } + return nil +} + +// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs. +type NamedResponseValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *ResponseValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedResponseValue) Reset() { + *x = NamedResponseValue{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedResponseValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedResponseValue) ProtoMessage() {} + +func (x *NamedResponseValue) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedResponseValue.ProtoReflect.Descriptor instead. +func (*NamedResponseValue) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{25} +} + +func (x *NamedResponseValue) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedResponseValue) GetValue() *ResponseValue { + if x != nil { + return x.Value + } + return nil +} + +// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs. +type NamedSchema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *Schema `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedSchema) Reset() { + *x = NamedSchema{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedSchema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedSchema) ProtoMessage() {} + +func (x *NamedSchema) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedSchema.ProtoReflect.Descriptor instead. +func (*NamedSchema) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{26} +} + +func (x *NamedSchema) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedSchema) GetValue() *Schema { + if x != nil { + return x.Value + } + return nil +} + +// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs. +type NamedSecurityDefinitionsItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *SecurityDefinitionsItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedSecurityDefinitionsItem) Reset() { + *x = NamedSecurityDefinitionsItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedSecurityDefinitionsItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedSecurityDefinitionsItem) ProtoMessage() {} + +func (x *NamedSecurityDefinitionsItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedSecurityDefinitionsItem.ProtoReflect.Descriptor instead. +func (*NamedSecurityDefinitionsItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{27} +} + +func (x *NamedSecurityDefinitionsItem) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedSecurityDefinitionsItem) GetValue() *SecurityDefinitionsItem { + if x != nil { + return x.Value + } + return nil +} + +// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. +type NamedString struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedString) Reset() { + *x = NamedString{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedString) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedString) ProtoMessage() {} + +func (x *NamedString) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedString.ProtoReflect.Descriptor instead. +func (*NamedString) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{28} +} + +func (x *NamedString) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedString) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. +type NamedStringArray struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Map key + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Mapped value + Value *StringArray `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *NamedStringArray) Reset() { + *x = NamedStringArray{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamedStringArray) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamedStringArray) ProtoMessage() {} + +func (x *NamedStringArray) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NamedStringArray.ProtoReflect.Descriptor instead. +func (*NamedStringArray) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{29} +} + +func (x *NamedStringArray) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NamedStringArray) GetValue() *StringArray { + if x != nil { + return x.Value + } + return nil +} + +type NonBodyParameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Oneof: + // *NonBodyParameter_HeaderParameterSubSchema + // *NonBodyParameter_FormDataParameterSubSchema + // *NonBodyParameter_QueryParameterSubSchema + // *NonBodyParameter_PathParameterSubSchema + Oneof isNonBodyParameter_Oneof `protobuf_oneof:"oneof"` +} + +func (x *NonBodyParameter) Reset() { + *x = NonBodyParameter{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NonBodyParameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NonBodyParameter) ProtoMessage() {} + +func (x *NonBodyParameter) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NonBodyParameter.ProtoReflect.Descriptor instead. +func (*NonBodyParameter) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{30} +} + +func (m *NonBodyParameter) GetOneof() isNonBodyParameter_Oneof { + if m != nil { + return m.Oneof + } + return nil +} + +func (x *NonBodyParameter) GetHeaderParameterSubSchema() *HeaderParameterSubSchema { + if x, ok := x.GetOneof().(*NonBodyParameter_HeaderParameterSubSchema); ok { + return x.HeaderParameterSubSchema + } + return nil +} + +func (x *NonBodyParameter) GetFormDataParameterSubSchema() *FormDataParameterSubSchema { + if x, ok := x.GetOneof().(*NonBodyParameter_FormDataParameterSubSchema); ok { + return x.FormDataParameterSubSchema + } + return nil +} + +func (x *NonBodyParameter) GetQueryParameterSubSchema() *QueryParameterSubSchema { + if x, ok := x.GetOneof().(*NonBodyParameter_QueryParameterSubSchema); ok { + return x.QueryParameterSubSchema + } + return nil +} + +func (x *NonBodyParameter) GetPathParameterSubSchema() *PathParameterSubSchema { + if x, ok := x.GetOneof().(*NonBodyParameter_PathParameterSubSchema); ok { + return x.PathParameterSubSchema + } + return nil +} + +type isNonBodyParameter_Oneof interface { + isNonBodyParameter_Oneof() +} + +type NonBodyParameter_HeaderParameterSubSchema struct { + HeaderParameterSubSchema *HeaderParameterSubSchema `protobuf:"bytes,1,opt,name=header_parameter_sub_schema,json=headerParameterSubSchema,proto3,oneof"` +} + +type NonBodyParameter_FormDataParameterSubSchema struct { + FormDataParameterSubSchema *FormDataParameterSubSchema `protobuf:"bytes,2,opt,name=form_data_parameter_sub_schema,json=formDataParameterSubSchema,proto3,oneof"` +} + +type NonBodyParameter_QueryParameterSubSchema struct { + QueryParameterSubSchema *QueryParameterSubSchema `protobuf:"bytes,3,opt,name=query_parameter_sub_schema,json=queryParameterSubSchema,proto3,oneof"` +} + +type NonBodyParameter_PathParameterSubSchema struct { + PathParameterSubSchema *PathParameterSubSchema `protobuf:"bytes,4,opt,name=path_parameter_sub_schema,json=pathParameterSubSchema,proto3,oneof"` +} + +func (*NonBodyParameter_HeaderParameterSubSchema) isNonBodyParameter_Oneof() {} + +func (*NonBodyParameter_FormDataParameterSubSchema) isNonBodyParameter_Oneof() {} + +func (*NonBodyParameter_QueryParameterSubSchema) isNonBodyParameter_Oneof() {} + +func (*NonBodyParameter_PathParameterSubSchema) isNonBodyParameter_Oneof() {} + +type Oauth2AccessCodeSecurity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` + Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` + AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` + TokenUrl string `protobuf:"bytes,5,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Oauth2AccessCodeSecurity) Reset() { + *x = Oauth2AccessCodeSecurity{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Oauth2AccessCodeSecurity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Oauth2AccessCodeSecurity) ProtoMessage() {} + +func (x *Oauth2AccessCodeSecurity) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Oauth2AccessCodeSecurity.ProtoReflect.Descriptor instead. +func (*Oauth2AccessCodeSecurity) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{31} +} + +func (x *Oauth2AccessCodeSecurity) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Oauth2AccessCodeSecurity) GetFlow() string { + if x != nil { + return x.Flow + } + return "" +} + +func (x *Oauth2AccessCodeSecurity) GetScopes() *Oauth2Scopes { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *Oauth2AccessCodeSecurity) GetAuthorizationUrl() string { + if x != nil { + return x.AuthorizationUrl + } + return "" +} + +func (x *Oauth2AccessCodeSecurity) GetTokenUrl() string { + if x != nil { + return x.TokenUrl + } + return "" +} + +func (x *Oauth2AccessCodeSecurity) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Oauth2AccessCodeSecurity) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Oauth2ApplicationSecurity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` + Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` + TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Oauth2ApplicationSecurity) Reset() { + *x = Oauth2ApplicationSecurity{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Oauth2ApplicationSecurity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Oauth2ApplicationSecurity) ProtoMessage() {} + +func (x *Oauth2ApplicationSecurity) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Oauth2ApplicationSecurity.ProtoReflect.Descriptor instead. +func (*Oauth2ApplicationSecurity) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{32} +} + +func (x *Oauth2ApplicationSecurity) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Oauth2ApplicationSecurity) GetFlow() string { + if x != nil { + return x.Flow + } + return "" +} + +func (x *Oauth2ApplicationSecurity) GetScopes() *Oauth2Scopes { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *Oauth2ApplicationSecurity) GetTokenUrl() string { + if x != nil { + return x.TokenUrl + } + return "" +} + +func (x *Oauth2ApplicationSecurity) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Oauth2ApplicationSecurity) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Oauth2ImplicitSecurity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` + Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` + AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Oauth2ImplicitSecurity) Reset() { + *x = Oauth2ImplicitSecurity{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Oauth2ImplicitSecurity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Oauth2ImplicitSecurity) ProtoMessage() {} + +func (x *Oauth2ImplicitSecurity) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Oauth2ImplicitSecurity.ProtoReflect.Descriptor instead. +func (*Oauth2ImplicitSecurity) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{33} +} + +func (x *Oauth2ImplicitSecurity) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Oauth2ImplicitSecurity) GetFlow() string { + if x != nil { + return x.Flow + } + return "" +} + +func (x *Oauth2ImplicitSecurity) GetScopes() *Oauth2Scopes { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *Oauth2ImplicitSecurity) GetAuthorizationUrl() string { + if x != nil { + return x.AuthorizationUrl + } + return "" +} + +func (x *Oauth2ImplicitSecurity) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Oauth2ImplicitSecurity) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Oauth2PasswordSecurity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` + Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` + TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Oauth2PasswordSecurity) Reset() { + *x = Oauth2PasswordSecurity{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Oauth2PasswordSecurity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Oauth2PasswordSecurity) ProtoMessage() {} + +func (x *Oauth2PasswordSecurity) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Oauth2PasswordSecurity.ProtoReflect.Descriptor instead. +func (*Oauth2PasswordSecurity) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{34} +} + +func (x *Oauth2PasswordSecurity) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Oauth2PasswordSecurity) GetFlow() string { + if x != nil { + return x.Flow + } + return "" +} + +func (x *Oauth2PasswordSecurity) GetScopes() *Oauth2Scopes { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *Oauth2PasswordSecurity) GetTokenUrl() string { + if x != nil { + return x.TokenUrl + } + return "" +} + +func (x *Oauth2PasswordSecurity) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Oauth2PasswordSecurity) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Oauth2Scopes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *Oauth2Scopes) Reset() { + *x = Oauth2Scopes{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Oauth2Scopes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Oauth2Scopes) ProtoMessage() {} + +func (x *Oauth2Scopes) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Oauth2Scopes.ProtoReflect.Descriptor instead. +func (*Oauth2Scopes) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{35} +} + +func (x *Oauth2Scopes) GetAdditionalProperties() []*NamedString { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +type Operation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` + // A brief summary of the operation. + Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` + // A longer description of the operation, GitHub Flavored Markdown is allowed. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + // A unique identifier of the operation. + OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` + // A list of MIME types the API can produce. + Produces []string `protobuf:"bytes,6,rep,name=produces,proto3" json:"produces,omitempty"` + // A list of MIME types the API can consume. + Consumes []string `protobuf:"bytes,7,rep,name=consumes,proto3" json:"consumes,omitempty"` + // The parameters needed to send a valid API call. + Parameters []*ParametersItem `protobuf:"bytes,8,rep,name=parameters,proto3" json:"parameters,omitempty"` + Responses *Responses `protobuf:"bytes,9,opt,name=responses,proto3" json:"responses,omitempty"` + // The transfer protocol of the API. + Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"` + Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,13,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Operation) Reset() { + *x = Operation{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Operation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Operation) ProtoMessage() {} + +func (x *Operation) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Operation.ProtoReflect.Descriptor instead. +func (*Operation) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{36} +} + +func (x *Operation) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Operation) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *Operation) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Operation) GetExternalDocs() *ExternalDocs { + if x != nil { + return x.ExternalDocs + } + return nil +} + +func (x *Operation) GetOperationId() string { + if x != nil { + return x.OperationId + } + return "" +} + +func (x *Operation) GetProduces() []string { + if x != nil { + return x.Produces + } + return nil +} + +func (x *Operation) GetConsumes() []string { + if x != nil { + return x.Consumes + } + return nil +} + +func (x *Operation) GetParameters() []*ParametersItem { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *Operation) GetResponses() *Responses { + if x != nil { + return x.Responses + } + return nil +} + +func (x *Operation) GetSchemes() []string { + if x != nil { + return x.Schemes + } + return nil +} + +func (x *Operation) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *Operation) GetSecurity() []*SecurityRequirement { + if x != nil { + return x.Security + } + return nil +} + +func (x *Operation) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Parameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Oneof: + // *Parameter_BodyParameter + // *Parameter_NonBodyParameter + Oneof isParameter_Oneof `protobuf_oneof:"oneof"` +} + +func (x *Parameter) Reset() { + *x = Parameter{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Parameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Parameter) ProtoMessage() {} + +func (x *Parameter) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Parameter.ProtoReflect.Descriptor instead. +func (*Parameter) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{37} +} + +func (m *Parameter) GetOneof() isParameter_Oneof { + if m != nil { + return m.Oneof + } + return nil +} + +func (x *Parameter) GetBodyParameter() *BodyParameter { + if x, ok := x.GetOneof().(*Parameter_BodyParameter); ok { + return x.BodyParameter + } + return nil +} + +func (x *Parameter) GetNonBodyParameter() *NonBodyParameter { + if x, ok := x.GetOneof().(*Parameter_NonBodyParameter); ok { + return x.NonBodyParameter + } + return nil +} + +type isParameter_Oneof interface { + isParameter_Oneof() +} + +type Parameter_BodyParameter struct { + BodyParameter *BodyParameter `protobuf:"bytes,1,opt,name=body_parameter,json=bodyParameter,proto3,oneof"` +} + +type Parameter_NonBodyParameter struct { + NonBodyParameter *NonBodyParameter `protobuf:"bytes,2,opt,name=non_body_parameter,json=nonBodyParameter,proto3,oneof"` +} + +func (*Parameter_BodyParameter) isParameter_Oneof() {} + +func (*Parameter_NonBodyParameter) isParameter_Oneof() {} + +// One or more JSON representations for parameters +type ParameterDefinitions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedParameter `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *ParameterDefinitions) Reset() { + *x = ParameterDefinitions{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ParameterDefinitions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParameterDefinitions) ProtoMessage() {} + +func (x *ParameterDefinitions) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ParameterDefinitions.ProtoReflect.Descriptor instead. +func (*ParameterDefinitions) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{38} +} + +func (x *ParameterDefinitions) GetAdditionalProperties() []*NamedParameter { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +type ParametersItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Oneof: + // *ParametersItem_Parameter + // *ParametersItem_JsonReference + Oneof isParametersItem_Oneof `protobuf_oneof:"oneof"` +} + +func (x *ParametersItem) Reset() { + *x = ParametersItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ParametersItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParametersItem) ProtoMessage() {} + +func (x *ParametersItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ParametersItem.ProtoReflect.Descriptor instead. +func (*ParametersItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{39} +} + +func (m *ParametersItem) GetOneof() isParametersItem_Oneof { + if m != nil { + return m.Oneof + } + return nil +} + +func (x *ParametersItem) GetParameter() *Parameter { + if x, ok := x.GetOneof().(*ParametersItem_Parameter); ok { + return x.Parameter + } + return nil +} + +func (x *ParametersItem) GetJsonReference() *JsonReference { + if x, ok := x.GetOneof().(*ParametersItem_JsonReference); ok { + return x.JsonReference + } + return nil +} + +type isParametersItem_Oneof interface { + isParametersItem_Oneof() +} + +type ParametersItem_Parameter struct { + Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,proto3,oneof"` +} + +type ParametersItem_JsonReference struct { + JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"` +} + +func (*ParametersItem_Parameter) isParametersItem_Oneof() {} + +func (*ParametersItem_JsonReference) isParametersItem_Oneof() {} + +type PathItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` + Get *Operation `protobuf:"bytes,2,opt,name=get,proto3" json:"get,omitempty"` + Put *Operation `protobuf:"bytes,3,opt,name=put,proto3" json:"put,omitempty"` + Post *Operation `protobuf:"bytes,4,opt,name=post,proto3" json:"post,omitempty"` + Delete *Operation `protobuf:"bytes,5,opt,name=delete,proto3" json:"delete,omitempty"` + Options *Operation `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` + Head *Operation `protobuf:"bytes,7,opt,name=head,proto3" json:"head,omitempty"` + Patch *Operation `protobuf:"bytes,8,opt,name=patch,proto3" json:"patch,omitempty"` + // The parameters needed to send a valid API call. + Parameters []*ParametersItem `protobuf:"bytes,9,rep,name=parameters,proto3" json:"parameters,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *PathItem) Reset() { + *x = PathItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PathItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PathItem) ProtoMessage() {} + +func (x *PathItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PathItem.ProtoReflect.Descriptor instead. +func (*PathItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{40} +} + +func (x *PathItem) GetXRef() string { + if x != nil { + return x.XRef + } + return "" +} + +func (x *PathItem) GetGet() *Operation { + if x != nil { + return x.Get + } + return nil +} + +func (x *PathItem) GetPut() *Operation { + if x != nil { + return x.Put + } + return nil +} + +func (x *PathItem) GetPost() *Operation { + if x != nil { + return x.Post + } + return nil +} + +func (x *PathItem) GetDelete() *Operation { + if x != nil { + return x.Delete + } + return nil +} + +func (x *PathItem) GetOptions() *Operation { + if x != nil { + return x.Options + } + return nil +} + +func (x *PathItem) GetHead() *Operation { + if x != nil { + return x.Head + } + return nil +} + +func (x *PathItem) GetPatch() *Operation { + if x != nil { + return x.Patch + } + return nil +} + +func (x *PathItem) GetParameters() []*ParametersItem { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *PathItem) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type PathParameterSubSchema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Determines whether or not this parameter is required or optional. + Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` + // Determines the location of the parameter. + In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // The name of the parameter. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` + Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"` + Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"` + CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` + Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"` + Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` + MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` + MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"` + MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` + MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` + Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` + MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *PathParameterSubSchema) Reset() { + *x = PathParameterSubSchema{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PathParameterSubSchema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PathParameterSubSchema) ProtoMessage() {} + +func (x *PathParameterSubSchema) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PathParameterSubSchema.ProtoReflect.Descriptor instead. +func (*PathParameterSubSchema) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{41} +} + +func (x *PathParameterSubSchema) GetRequired() bool { + if x != nil { + return x.Required + } + return false +} + +func (x *PathParameterSubSchema) GetIn() string { + if x != nil { + return x.In + } + return "" +} + +func (x *PathParameterSubSchema) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *PathParameterSubSchema) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PathParameterSubSchema) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *PathParameterSubSchema) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *PathParameterSubSchema) GetItems() *PrimitivesItems { + if x != nil { + return x.Items + } + return nil +} + +func (x *PathParameterSubSchema) GetCollectionFormat() string { + if x != nil { + return x.CollectionFormat + } + return "" +} + +func (x *PathParameterSubSchema) GetDefault() *Any { + if x != nil { + return x.Default + } + return nil +} + +func (x *PathParameterSubSchema) GetMaximum() float64 { + if x != nil { + return x.Maximum + } + return 0 +} + +func (x *PathParameterSubSchema) GetExclusiveMaximum() bool { + if x != nil { + return x.ExclusiveMaximum + } + return false +} + +func (x *PathParameterSubSchema) GetMinimum() float64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *PathParameterSubSchema) GetExclusiveMinimum() bool { + if x != nil { + return x.ExclusiveMinimum + } + return false +} + +func (x *PathParameterSubSchema) GetMaxLength() int64 { + if x != nil { + return x.MaxLength + } + return 0 +} + +func (x *PathParameterSubSchema) GetMinLength() int64 { + if x != nil { + return x.MinLength + } + return 0 +} + +func (x *PathParameterSubSchema) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *PathParameterSubSchema) GetMaxItems() int64 { + if x != nil { + return x.MaxItems + } + return 0 +} + +func (x *PathParameterSubSchema) GetMinItems() int64 { + if x != nil { + return x.MinItems + } + return 0 +} + +func (x *PathParameterSubSchema) GetUniqueItems() bool { + if x != nil { + return x.UniqueItems + } + return false +} + +func (x *PathParameterSubSchema) GetEnum() []*Any { + if x != nil { + return x.Enum + } + return nil +} + +func (x *PathParameterSubSchema) GetMultipleOf() float64 { + if x != nil { + return x.MultipleOf + } + return 0 +} + +func (x *PathParameterSubSchema) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +// Relative paths to the individual endpoints. They must be relative to the 'basePath'. +type Paths struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + VendorExtension []*NamedAny `protobuf:"bytes,1,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` + Path []*NamedPathItem `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` +} + +func (x *Paths) Reset() { + *x = Paths{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Paths) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Paths) ProtoMessage() {} + +func (x *Paths) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Paths.ProtoReflect.Descriptor instead. +func (*Paths) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{42} +} + +func (x *Paths) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +func (x *Paths) GetPath() []*NamedPathItem { + if x != nil { + return x.Path + } + return nil +} + +type PrimitivesItems struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` + Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"` + CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` + Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` + Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` + MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` + MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"` + MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` + MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` + Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"` + MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,18,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *PrimitivesItems) Reset() { + *x = PrimitivesItems{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrimitivesItems) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrimitivesItems) ProtoMessage() {} + +func (x *PrimitivesItems) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrimitivesItems.ProtoReflect.Descriptor instead. +func (*PrimitivesItems) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{43} +} + +func (x *PrimitivesItems) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *PrimitivesItems) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *PrimitivesItems) GetItems() *PrimitivesItems { + if x != nil { + return x.Items + } + return nil +} + +func (x *PrimitivesItems) GetCollectionFormat() string { + if x != nil { + return x.CollectionFormat + } + return "" +} + +func (x *PrimitivesItems) GetDefault() *Any { + if x != nil { + return x.Default + } + return nil +} + +func (x *PrimitivesItems) GetMaximum() float64 { + if x != nil { + return x.Maximum + } + return 0 +} + +func (x *PrimitivesItems) GetExclusiveMaximum() bool { + if x != nil { + return x.ExclusiveMaximum + } + return false +} + +func (x *PrimitivesItems) GetMinimum() float64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *PrimitivesItems) GetExclusiveMinimum() bool { + if x != nil { + return x.ExclusiveMinimum + } + return false +} + +func (x *PrimitivesItems) GetMaxLength() int64 { + if x != nil { + return x.MaxLength + } + return 0 +} + +func (x *PrimitivesItems) GetMinLength() int64 { + if x != nil { + return x.MinLength + } + return 0 +} + +func (x *PrimitivesItems) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *PrimitivesItems) GetMaxItems() int64 { + if x != nil { + return x.MaxItems + } + return 0 +} + +func (x *PrimitivesItems) GetMinItems() int64 { + if x != nil { + return x.MinItems + } + return 0 +} + +func (x *PrimitivesItems) GetUniqueItems() bool { + if x != nil { + return x.UniqueItems + } + return false +} + +func (x *PrimitivesItems) GetEnum() []*Any { + if x != nil { + return x.Enum + } + return nil +} + +func (x *PrimitivesItems) GetMultipleOf() float64 { + if x != nil { + return x.MultipleOf + } + return 0 +} + +func (x *PrimitivesItems) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Properties struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *Properties) Reset() { + *x = Properties{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Properties) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Properties) ProtoMessage() {} + +func (x *Properties) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Properties.ProtoReflect.Descriptor instead. +func (*Properties) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{44} +} + +func (x *Properties) GetAdditionalProperties() []*NamedSchema { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +type QueryParameterSubSchema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Determines whether or not this parameter is required or optional. + Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` + // Determines the location of the parameter. + In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // The name of the parameter. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // allows sending a parameter by name only or with an empty value. + AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` + Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` + Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"` + Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"` + CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` + Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"` + Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` + MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` + MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` + MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` + MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` + Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"` + MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *QueryParameterSubSchema) Reset() { + *x = QueryParameterSubSchema{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParameterSubSchema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParameterSubSchema) ProtoMessage() {} + +func (x *QueryParameterSubSchema) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryParameterSubSchema.ProtoReflect.Descriptor instead. +func (*QueryParameterSubSchema) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{45} +} + +func (x *QueryParameterSubSchema) GetRequired() bool { + if x != nil { + return x.Required + } + return false +} + +func (x *QueryParameterSubSchema) GetIn() string { + if x != nil { + return x.In + } + return "" +} + +func (x *QueryParameterSubSchema) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *QueryParameterSubSchema) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *QueryParameterSubSchema) GetAllowEmptyValue() bool { + if x != nil { + return x.AllowEmptyValue + } + return false +} + +func (x *QueryParameterSubSchema) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *QueryParameterSubSchema) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *QueryParameterSubSchema) GetItems() *PrimitivesItems { + if x != nil { + return x.Items + } + return nil +} + +func (x *QueryParameterSubSchema) GetCollectionFormat() string { + if x != nil { + return x.CollectionFormat + } + return "" +} + +func (x *QueryParameterSubSchema) GetDefault() *Any { + if x != nil { + return x.Default + } + return nil +} + +func (x *QueryParameterSubSchema) GetMaximum() float64 { + if x != nil { + return x.Maximum + } + return 0 +} + +func (x *QueryParameterSubSchema) GetExclusiveMaximum() bool { + if x != nil { + return x.ExclusiveMaximum + } + return false +} + +func (x *QueryParameterSubSchema) GetMinimum() float64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *QueryParameterSubSchema) GetExclusiveMinimum() bool { + if x != nil { + return x.ExclusiveMinimum + } + return false +} + +func (x *QueryParameterSubSchema) GetMaxLength() int64 { + if x != nil { + return x.MaxLength + } + return 0 +} + +func (x *QueryParameterSubSchema) GetMinLength() int64 { + if x != nil { + return x.MinLength + } + return 0 +} + +func (x *QueryParameterSubSchema) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *QueryParameterSubSchema) GetMaxItems() int64 { + if x != nil { + return x.MaxItems + } + return 0 +} + +func (x *QueryParameterSubSchema) GetMinItems() int64 { + if x != nil { + return x.MinItems + } + return 0 +} + +func (x *QueryParameterSubSchema) GetUniqueItems() bool { + if x != nil { + return x.UniqueItems + } + return false +} + +func (x *QueryParameterSubSchema) GetEnum() []*Any { + if x != nil { + return x.Enum + } + return nil +} + +func (x *QueryParameterSubSchema) GetMultipleOf() float64 { + if x != nil { + return x.MultipleOf + } + return 0 +} + +func (x *QueryParameterSubSchema) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type Response struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + Schema *SchemaItem `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + Headers *Headers `protobuf:"bytes,3,opt,name=headers,proto3" json:"headers,omitempty"` + Examples *Examples `protobuf:"bytes,4,opt,name=examples,proto3" json:"examples,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Response) Reset() { + *x = Response{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{46} +} + +func (x *Response) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Response) GetSchema() *SchemaItem { + if x != nil { + return x.Schema + } + return nil +} + +func (x *Response) GetHeaders() *Headers { + if x != nil { + return x.Headers + } + return nil +} + +func (x *Response) GetExamples() *Examples { + if x != nil { + return x.Examples + } + return nil +} + +func (x *Response) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +// One or more JSON representations for responses +type ResponseDefinitions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedResponse `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *ResponseDefinitions) Reset() { + *x = ResponseDefinitions{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResponseDefinitions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseDefinitions) ProtoMessage() {} + +func (x *ResponseDefinitions) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResponseDefinitions.ProtoReflect.Descriptor instead. +func (*ResponseDefinitions) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{47} +} + +func (x *ResponseDefinitions) GetAdditionalProperties() []*NamedResponse { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +type ResponseValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Oneof: + // *ResponseValue_Response + // *ResponseValue_JsonReference + Oneof isResponseValue_Oneof `protobuf_oneof:"oneof"` +} + +func (x *ResponseValue) Reset() { + *x = ResponseValue{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResponseValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseValue) ProtoMessage() {} + +func (x *ResponseValue) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResponseValue.ProtoReflect.Descriptor instead. +func (*ResponseValue) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{48} +} + +func (m *ResponseValue) GetOneof() isResponseValue_Oneof { + if m != nil { + return m.Oneof + } + return nil +} + +func (x *ResponseValue) GetResponse() *Response { + if x, ok := x.GetOneof().(*ResponseValue_Response); ok { + return x.Response + } + return nil +} + +func (x *ResponseValue) GetJsonReference() *JsonReference { + if x, ok := x.GetOneof().(*ResponseValue_JsonReference); ok { + return x.JsonReference + } + return nil +} + +type isResponseValue_Oneof interface { + isResponseValue_Oneof() +} + +type ResponseValue_Response struct { + Response *Response `protobuf:"bytes,1,opt,name=response,proto3,oneof"` +} + +type ResponseValue_JsonReference struct { + JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"` +} + +func (*ResponseValue_Response) isResponseValue_Oneof() {} + +func (*ResponseValue_JsonReference) isResponseValue_Oneof() {} + +// Response objects names can either be any valid HTTP status code or 'default'. +type Responses struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ResponseCode []*NamedResponseValue `protobuf:"bytes,1,rep,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,2,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Responses) Reset() { + *x = Responses{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Responses) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Responses) ProtoMessage() {} + +func (x *Responses) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Responses.ProtoReflect.Descriptor instead. +func (*Responses) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{49} +} + +func (x *Responses) GetResponseCode() []*NamedResponseValue { + if x != nil { + return x.ResponseCode + } + return nil +} + +func (x *Responses) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +// A deterministic version of a JSON Schema object. +type Schema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` + Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` + MultipleOf float64 `protobuf:"fixed64,6,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` + Maximum float64 `protobuf:"fixed64,7,opt,name=maximum,proto3" json:"maximum,omitempty"` + ExclusiveMaximum bool `protobuf:"varint,8,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` + Minimum float64 `protobuf:"fixed64,9,opt,name=minimum,proto3" json:"minimum,omitempty"` + ExclusiveMinimum bool `protobuf:"varint,10,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` + MaxLength int64 `protobuf:"varint,11,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` + MinLength int64 `protobuf:"varint,12,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + Pattern string `protobuf:"bytes,13,opt,name=pattern,proto3" json:"pattern,omitempty"` + MaxItems int64 `protobuf:"varint,14,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` + MinItems int64 `protobuf:"varint,15,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` + UniqueItems bool `protobuf:"varint,16,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` + MaxProperties int64 `protobuf:"varint,17,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"` + MinProperties int64 `protobuf:"varint,18,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"` + Required []string `protobuf:"bytes,19,rep,name=required,proto3" json:"required,omitempty"` + Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` + AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,21,opt,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` + Type *TypeItem `protobuf:"bytes,22,opt,name=type,proto3" json:"type,omitempty"` + Items *ItemsItem `protobuf:"bytes,23,opt,name=items,proto3" json:"items,omitempty"` + AllOf []*Schema `protobuf:"bytes,24,rep,name=all_of,json=allOf,proto3" json:"all_of,omitempty"` + Properties *Properties `protobuf:"bytes,25,opt,name=properties,proto3" json:"properties,omitempty"` + Discriminator string `protobuf:"bytes,26,opt,name=discriminator,proto3" json:"discriminator,omitempty"` + ReadOnly bool `protobuf:"varint,27,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` + Xml *Xml `protobuf:"bytes,28,opt,name=xml,proto3" json:"xml,omitempty"` + ExternalDocs *ExternalDocs `protobuf:"bytes,29,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + Example *Any `protobuf:"bytes,30,opt,name=example,proto3" json:"example,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,31,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Schema) Reset() { + *x = Schema{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Schema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Schema) ProtoMessage() {} + +func (x *Schema) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Schema.ProtoReflect.Descriptor instead. +func (*Schema) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{50} +} + +func (x *Schema) GetXRef() string { + if x != nil { + return x.XRef + } + return "" +} + +func (x *Schema) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *Schema) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Schema) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Schema) GetDefault() *Any { + if x != nil { + return x.Default + } + return nil +} + +func (x *Schema) GetMultipleOf() float64 { + if x != nil { + return x.MultipleOf + } + return 0 +} + +func (x *Schema) GetMaximum() float64 { + if x != nil { + return x.Maximum + } + return 0 +} + +func (x *Schema) GetExclusiveMaximum() bool { + if x != nil { + return x.ExclusiveMaximum + } + return false +} + +func (x *Schema) GetMinimum() float64 { + if x != nil { + return x.Minimum + } + return 0 +} + +func (x *Schema) GetExclusiveMinimum() bool { + if x != nil { + return x.ExclusiveMinimum + } + return false +} + +func (x *Schema) GetMaxLength() int64 { + if x != nil { + return x.MaxLength + } + return 0 +} + +func (x *Schema) GetMinLength() int64 { + if x != nil { + return x.MinLength + } + return 0 +} + +func (x *Schema) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *Schema) GetMaxItems() int64 { + if x != nil { + return x.MaxItems + } + return 0 +} + +func (x *Schema) GetMinItems() int64 { + if x != nil { + return x.MinItems + } + return 0 +} + +func (x *Schema) GetUniqueItems() bool { + if x != nil { + return x.UniqueItems + } + return false +} + +func (x *Schema) GetMaxProperties() int64 { + if x != nil { + return x.MaxProperties + } + return 0 +} + +func (x *Schema) GetMinProperties() int64 { + if x != nil { + return x.MinProperties + } + return 0 +} + +func (x *Schema) GetRequired() []string { + if x != nil { + return x.Required + } + return nil +} + +func (x *Schema) GetEnum() []*Any { + if x != nil { + return x.Enum + } + return nil +} + +func (x *Schema) GetAdditionalProperties() *AdditionalPropertiesItem { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +func (x *Schema) GetType() *TypeItem { + if x != nil { + return x.Type + } + return nil +} + +func (x *Schema) GetItems() *ItemsItem { + if x != nil { + return x.Items + } + return nil +} + +func (x *Schema) GetAllOf() []*Schema { + if x != nil { + return x.AllOf + } + return nil +} + +func (x *Schema) GetProperties() *Properties { + if x != nil { + return x.Properties + } + return nil +} + +func (x *Schema) GetDiscriminator() string { + if x != nil { + return x.Discriminator + } + return "" +} + +func (x *Schema) GetReadOnly() bool { + if x != nil { + return x.ReadOnly + } + return false +} + +func (x *Schema) GetXml() *Xml { + if x != nil { + return x.Xml + } + return nil +} + +func (x *Schema) GetExternalDocs() *ExternalDocs { + if x != nil { + return x.ExternalDocs + } + return nil +} + +func (x *Schema) GetExample() *Any { + if x != nil { + return x.Example + } + return nil +} + +func (x *Schema) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type SchemaItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Oneof: + // *SchemaItem_Schema + // *SchemaItem_FileSchema + Oneof isSchemaItem_Oneof `protobuf_oneof:"oneof"` +} + +func (x *SchemaItem) Reset() { + *x = SchemaItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SchemaItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SchemaItem) ProtoMessage() {} + +func (x *SchemaItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SchemaItem.ProtoReflect.Descriptor instead. +func (*SchemaItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{51} +} + +func (m *SchemaItem) GetOneof() isSchemaItem_Oneof { + if m != nil { + return m.Oneof + } + return nil +} + +func (x *SchemaItem) GetSchema() *Schema { + if x, ok := x.GetOneof().(*SchemaItem_Schema); ok { + return x.Schema + } + return nil +} + +func (x *SchemaItem) GetFileSchema() *FileSchema { + if x, ok := x.GetOneof().(*SchemaItem_FileSchema); ok { + return x.FileSchema + } + return nil +} + +type isSchemaItem_Oneof interface { + isSchemaItem_Oneof() +} + +type SchemaItem_Schema struct { + Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"` +} + +type SchemaItem_FileSchema struct { + FileSchema *FileSchema `protobuf:"bytes,2,opt,name=file_schema,json=fileSchema,proto3,oneof"` +} + +func (*SchemaItem_Schema) isSchemaItem_Oneof() {} + +func (*SchemaItem_FileSchema) isSchemaItem_Oneof() {} + +type SecurityDefinitions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedSecurityDefinitionsItem `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *SecurityDefinitions) Reset() { + *x = SecurityDefinitions{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SecurityDefinitions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityDefinitions) ProtoMessage() {} + +func (x *SecurityDefinitions) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SecurityDefinitions.ProtoReflect.Descriptor instead. +func (*SecurityDefinitions) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{52} +} + +func (x *SecurityDefinitions) GetAdditionalProperties() []*NamedSecurityDefinitionsItem { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +type SecurityDefinitionsItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Oneof: + // *SecurityDefinitionsItem_BasicAuthenticationSecurity + // *SecurityDefinitionsItem_ApiKeySecurity + // *SecurityDefinitionsItem_Oauth2ImplicitSecurity + // *SecurityDefinitionsItem_Oauth2PasswordSecurity + // *SecurityDefinitionsItem_Oauth2ApplicationSecurity + // *SecurityDefinitionsItem_Oauth2AccessCodeSecurity + Oneof isSecurityDefinitionsItem_Oneof `protobuf_oneof:"oneof"` +} + +func (x *SecurityDefinitionsItem) Reset() { + *x = SecurityDefinitionsItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SecurityDefinitionsItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityDefinitionsItem) ProtoMessage() {} + +func (x *SecurityDefinitionsItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SecurityDefinitionsItem.ProtoReflect.Descriptor instead. +func (*SecurityDefinitionsItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{53} +} + +func (m *SecurityDefinitionsItem) GetOneof() isSecurityDefinitionsItem_Oneof { + if m != nil { + return m.Oneof + } + return nil +} + +func (x *SecurityDefinitionsItem) GetBasicAuthenticationSecurity() *BasicAuthenticationSecurity { + if x, ok := x.GetOneof().(*SecurityDefinitionsItem_BasicAuthenticationSecurity); ok { + return x.BasicAuthenticationSecurity + } + return nil +} + +func (x *SecurityDefinitionsItem) GetApiKeySecurity() *ApiKeySecurity { + if x, ok := x.GetOneof().(*SecurityDefinitionsItem_ApiKeySecurity); ok { + return x.ApiKeySecurity + } + return nil +} + +func (x *SecurityDefinitionsItem) GetOauth2ImplicitSecurity() *Oauth2ImplicitSecurity { + if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ImplicitSecurity); ok { + return x.Oauth2ImplicitSecurity + } + return nil +} + +func (x *SecurityDefinitionsItem) GetOauth2PasswordSecurity() *Oauth2PasswordSecurity { + if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2PasswordSecurity); ok { + return x.Oauth2PasswordSecurity + } + return nil +} + +func (x *SecurityDefinitionsItem) GetOauth2ApplicationSecurity() *Oauth2ApplicationSecurity { + if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ApplicationSecurity); ok { + return x.Oauth2ApplicationSecurity + } + return nil +} + +func (x *SecurityDefinitionsItem) GetOauth2AccessCodeSecurity() *Oauth2AccessCodeSecurity { + if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity); ok { + return x.Oauth2AccessCodeSecurity + } + return nil +} + +type isSecurityDefinitionsItem_Oneof interface { + isSecurityDefinitionsItem_Oneof() +} + +type SecurityDefinitionsItem_BasicAuthenticationSecurity struct { + BasicAuthenticationSecurity *BasicAuthenticationSecurity `protobuf:"bytes,1,opt,name=basic_authentication_security,json=basicAuthenticationSecurity,proto3,oneof"` +} + +type SecurityDefinitionsItem_ApiKeySecurity struct { + ApiKeySecurity *ApiKeySecurity `protobuf:"bytes,2,opt,name=api_key_security,json=apiKeySecurity,proto3,oneof"` +} + +type SecurityDefinitionsItem_Oauth2ImplicitSecurity struct { + Oauth2ImplicitSecurity *Oauth2ImplicitSecurity `protobuf:"bytes,3,opt,name=oauth2_implicit_security,json=oauth2ImplicitSecurity,proto3,oneof"` +} + +type SecurityDefinitionsItem_Oauth2PasswordSecurity struct { + Oauth2PasswordSecurity *Oauth2PasswordSecurity `protobuf:"bytes,4,opt,name=oauth2_password_security,json=oauth2PasswordSecurity,proto3,oneof"` +} + +type SecurityDefinitionsItem_Oauth2ApplicationSecurity struct { + Oauth2ApplicationSecurity *Oauth2ApplicationSecurity `protobuf:"bytes,5,opt,name=oauth2_application_security,json=oauth2ApplicationSecurity,proto3,oneof"` +} + +type SecurityDefinitionsItem_Oauth2AccessCodeSecurity struct { + Oauth2AccessCodeSecurity *Oauth2AccessCodeSecurity `protobuf:"bytes,6,opt,name=oauth2_access_code_security,json=oauth2AccessCodeSecurity,proto3,oneof"` +} + +func (*SecurityDefinitionsItem_BasicAuthenticationSecurity) isSecurityDefinitionsItem_Oneof() {} + +func (*SecurityDefinitionsItem_ApiKeySecurity) isSecurityDefinitionsItem_Oneof() {} + +func (*SecurityDefinitionsItem_Oauth2ImplicitSecurity) isSecurityDefinitionsItem_Oneof() {} + +func (*SecurityDefinitionsItem_Oauth2PasswordSecurity) isSecurityDefinitionsItem_Oneof() {} + +func (*SecurityDefinitionsItem_Oauth2ApplicationSecurity) isSecurityDefinitionsItem_Oneof() {} + +func (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) isSecurityDefinitionsItem_Oneof() {} + +type SecurityRequirement struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *SecurityRequirement) Reset() { + *x = SecurityRequirement{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SecurityRequirement) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityRequirement) ProtoMessage() {} + +func (x *SecurityRequirement) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SecurityRequirement.ProtoReflect.Descriptor instead. +func (*SecurityRequirement) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{54} +} + +func (x *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +type StringArray struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` +} + +func (x *StringArray) Reset() { + *x = StringArray{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StringArray) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StringArray) ProtoMessage() {} + +func (x *StringArray) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StringArray.ProtoReflect.Descriptor instead. +func (*StringArray) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{55} +} + +func (x *StringArray) GetValue() []string { + if x != nil { + return x.Value + } + return nil +} + +type Tag struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Tag) Reset() { + *x = Tag{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Tag) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Tag) ProtoMessage() {} + +func (x *Tag) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Tag.ProtoReflect.Descriptor instead. +func (*Tag) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{56} +} + +func (x *Tag) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Tag) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Tag) GetExternalDocs() *ExternalDocs { + if x != nil { + return x.ExternalDocs + } + return nil +} + +func (x *Tag) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +type TypeItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` +} + +func (x *TypeItem) Reset() { + *x = TypeItem{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TypeItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TypeItem) ProtoMessage() {} + +func (x *TypeItem) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TypeItem.ProtoReflect.Descriptor instead. +func (*TypeItem) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{57} +} + +func (x *TypeItem) GetValue() []string { + if x != nil { + return x.Value + } + return nil +} + +// Any property starting with x- is valid. +type VendorExtension struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` +} + +func (x *VendorExtension) Reset() { + *x = VendorExtension{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VendorExtension) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VendorExtension) ProtoMessage() {} + +func (x *VendorExtension) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VendorExtension.ProtoReflect.Descriptor instead. +func (*VendorExtension) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{58} +} + +func (x *VendorExtension) GetAdditionalProperties() []*NamedAny { + if x != nil { + return x.AdditionalProperties + } + return nil +} + +type Xml struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` + Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"` + Attribute bool `protobuf:"varint,4,opt,name=attribute,proto3" json:"attribute,omitempty"` + Wrapped bool `protobuf:"varint,5,opt,name=wrapped,proto3" json:"wrapped,omitempty"` + VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` +} + +func (x *Xml) Reset() { + *x = Xml{} + if protoimpl.UnsafeEnabled { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Xml) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Xml) ProtoMessage() {} + +func (x *Xml) ProtoReflect() protoreflect.Message { + mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Xml.ProtoReflect.Descriptor instead. +func (*Xml) Descriptor() ([]byte, []int) { + return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{59} +} + +func (x *Xml) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Xml) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *Xml) GetPrefix() string { + if x != nil { + return x.Prefix + } + return "" +} + +func (x *Xml) GetAttribute() bool { + if x != nil { + return x.Attribute + } + return false +} + +func (x *Xml) GetWrapped() bool { + if x != nil { + return x.Wrapped + } + return false +} + +func (x *Xml) GetVendorExtension() []*NamedAny { + if x != nil { + return x.VendorExtension + } + return nil +} + +var File_openapiv2_OpenAPIv2_proto protoreflect.FileDescriptor + +var file_openapiv2_OpenAPIv2_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x4f, 0x70, 0x65, 0x6e, + 0x41, 0x50, 0x49, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c, + 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x07, + 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, + 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, + 0x66, 0x22, 0x45, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x22, 0xab, 0x01, 0x0a, 0x0e, 0x41, 0x70, 0x69, + 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, + 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, + 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x1b, 0x42, 0x61, 0x73, 0x69, 0x63, + 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, + 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, + 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xde, 0x01, + 0x0a, 0x0d, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3f, 0x0a, + 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, + 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x86, + 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, + 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, + 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x54, 0x0a, 0x07, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, + 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5b, 0x0a, + 0x0b, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4c, 0x0a, 0x15, + 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xe8, 0x05, 0x0a, 0x08, 0x44, + 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, + 0x72, 0x12, 0x24, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62, + 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x1a, + 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, + 0x74, 0x68, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x73, 0x52, 0x05, 0x70, 0x61, + 0x74, 0x68, 0x73, 0x12, 0x39, 0x0a, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, + 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x12, 0x3d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, + 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, + 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x52, 0x0a, 0x14, + 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, + 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x13, 0x73, 0x65, 0x63, + 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x23, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, + 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, + 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x55, 0x0a, 0x08, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, + 0x73, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, + 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, + 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a, + 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, + 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, + 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x22, 0xff, 0x02, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, + 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, + 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, + 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, + 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, + 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, + 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xab, 0x06, 0x0a, 0x1a, 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74, + 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, + 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, + 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, + 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, + 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, + 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, + 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, + 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, + 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, + 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, + 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, + 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, + 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, + 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, + 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, + 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, + 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, + 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, + 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, + 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x22, 0xab, 0x05, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, + 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, + 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, + 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, + 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, + 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, + 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, + 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, + 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, + 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, + 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, + 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, + 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x11, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, + 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x22, 0xfd, 0x05, 0x0a, 0x18, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, + 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, + 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, + 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, + 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, + 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, + 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, + 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, + 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, + 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, + 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, + 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x10, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, + 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, + 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, + 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, + 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, + 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, + 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x15, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, + 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, + 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x22, 0x57, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x61, + 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa1, 0x02, 0x0a, 0x04, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, + 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, + 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, + 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x2d, 0x0a, + 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x63, 0x65, + 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x10, + 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, + 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x37, 0x0a, + 0x09, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x44, 0x0a, 0x0d, 0x4a, 0x73, 0x6f, 0x6e, 0x52, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x70, 0x0a, 0x07, + 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x3f, 0x0a, + 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, + 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x45, + 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, + 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x59, 0x0a, 0x12, 0x4e, 0x61, 0x6d, 0x65, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x6d, 0x0a, 0x1c, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, + 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x37, + 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65, 0x64, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb5, + 0x03, 0x0a, 0x10, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x1b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, + 0x52, 0x18, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x6c, 0x0a, 0x1e, 0x66, 0x6f, + 0x72, 0x6d, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x1a, 0x66, 0x6f, + 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, + 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x62, 0x0a, 0x1a, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x48, 0x00, 0x52, 0x17, 0x71, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x5f, 0x0a, 0x19, + 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, + 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, + 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, 0x07, 0x0a, + 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xa1, 0x02, 0x0a, 0x18, 0x4f, 0x61, 0x75, 0x74, 0x68, + 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, + 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a, + 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, + 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, + 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x19, 0x4f, + 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, + 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, + 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, + 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, + 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, + 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, + 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, + 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf2, 0x01, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74, + 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, + 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, + 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, + 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, + 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x0c, + 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x15, + 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x9e, 0x04, 0x0a, 0x09, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, + 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, + 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x33, + 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x1e, 0x0a, + 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a, + 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63, + 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, + 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, + 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa6, 0x01, 0x0a, 0x09, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x62, 0x6f, 0x64, + 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d, + 0x62, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x4c, 0x0a, + 0x12, 0x6e, 0x6f, 0x6e, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x10, 0x6e, 0x6f, 0x6e, 0x42, 0x6f, + 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x42, 0x07, 0x0a, 0x05, 0x6f, + 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x67, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4f, 0x0a, 0x15, + 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x94, 0x01, + 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d, + 0x12, 0x35, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, + 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f, + 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73, + 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, + 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xcf, 0x03, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, + 0x6d, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x52, 0x65, 0x66, 0x12, 0x27, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, + 0x03, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x70, 0x6f, 0x73, + 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x29, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x0a, 0x05, + 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, + 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, + 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfb, 0x05, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x68, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, + 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, + 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, + 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, + 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, + 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, + 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, + 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, + 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, + 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, + 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, + 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, + 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, + 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, + 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, + 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, + 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, + 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, + 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x3f, 0x0a, + 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, + 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, + 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x92, 0x05, + 0x0a, 0x0f, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, + 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, + 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, + 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, + 0x6d, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, + 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, + 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, + 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, + 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, + 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, + 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, + 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, + 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, + 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, + 0x6e, 0x75, 0x6d, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, + 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, + 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, + 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, + 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, + 0x12, 0x4c, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, + 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa8, + 0x06, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, + 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, + 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, + 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, + 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, + 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, + 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, + 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, + 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, + 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, + 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, + 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, + 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, + 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, + 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, + 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, + 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfe, 0x01, 0x0a, 0x08, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d, + 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x2d, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x07, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x52, + 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, + 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, + 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x65, 0x0a, 0x13, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x4e, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, + 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, + 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, + 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, + 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f, + 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73, + 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, + 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x91, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, + 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, + 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, + 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x09, 0x0a, 0x06, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, + 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, + 0x4f, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, + 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, + 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, + 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, + 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, + 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, + 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, + 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, + 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, + 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, + 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, + 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, + 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, + 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f, + 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, + 0x61, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, + 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x12, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, + 0x69, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, + 0x13, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, + 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, + 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x15, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, + 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x49, + 0x74, 0x65, 0x6d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x29, 0x0a, 0x06, 0x61, 0x6c, 0x6c, 0x5f, 0x6f, 0x66, + 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x4f, + 0x66, 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, + 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x70, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x69, 0x73, + 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, + 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x1b, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x03, + 0x78, 0x6d, 0x6c, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x58, 0x6d, 0x6c, 0x52, 0x03, 0x78, 0x6d, 0x6c, 0x12, + 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, + 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, + 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29, + 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, + 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, + 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x1f, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, + 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x7e, 0x0a, 0x0a, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x39, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x74, 0x0a, 0x13, 0x53, 0x65, + 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x5d, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, + 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, + 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, + 0x22, 0xe9, 0x04, 0x0a, 0x17, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, + 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x6d, 0x0a, 0x1d, + 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x1b, + 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x61, + 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, + 0x79, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x69, 0x6d, + 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, + 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75, + 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75, + 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x1b, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, + 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, + 0x00, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x1b, + 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, + 0x64, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, + 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, + 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, + 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, + 0x69, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x68, 0x0a, 0x13, + 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, + 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, + 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x03, + 0x54, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, + 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x0a, 0x08, 0x54, 0x79, 0x70, + 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5c, 0x0a, 0x0f, 0x56, + 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, + 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, + 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, + 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x03, 0x58, 0x6d, + 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70, + 0x70, 0x65, 0x64, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, + 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x3e, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x42, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x76, 0x32, 0x3b, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0xa2, 0x02, + 0x03, 0x4f, 0x41, 0x53, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_openapiv2_OpenAPIv2_proto_rawDescOnce sync.Once + file_openapiv2_OpenAPIv2_proto_rawDescData = file_openapiv2_OpenAPIv2_proto_rawDesc +) + +func file_openapiv2_OpenAPIv2_proto_rawDescGZIP() []byte { + file_openapiv2_OpenAPIv2_proto_rawDescOnce.Do(func() { + file_openapiv2_OpenAPIv2_proto_rawDescData = protoimpl.X.CompressGZIP(file_openapiv2_OpenAPIv2_proto_rawDescData) + }) + return file_openapiv2_OpenAPIv2_proto_rawDescData +} + +var file_openapiv2_OpenAPIv2_proto_msgTypes = make([]protoimpl.MessageInfo, 60) +var file_openapiv2_OpenAPIv2_proto_goTypes = []interface{}{ + (*AdditionalPropertiesItem)(nil), // 0: openapi.v2.AdditionalPropertiesItem + (*Any)(nil), // 1: openapi.v2.Any + (*ApiKeySecurity)(nil), // 2: openapi.v2.ApiKeySecurity + (*BasicAuthenticationSecurity)(nil), // 3: openapi.v2.BasicAuthenticationSecurity + (*BodyParameter)(nil), // 4: openapi.v2.BodyParameter + (*Contact)(nil), // 5: openapi.v2.Contact + (*Default)(nil), // 6: openapi.v2.Default + (*Definitions)(nil), // 7: openapi.v2.Definitions + (*Document)(nil), // 8: openapi.v2.Document + (*Examples)(nil), // 9: openapi.v2.Examples + (*ExternalDocs)(nil), // 10: openapi.v2.ExternalDocs + (*FileSchema)(nil), // 11: openapi.v2.FileSchema + (*FormDataParameterSubSchema)(nil), // 12: openapi.v2.FormDataParameterSubSchema + (*Header)(nil), // 13: openapi.v2.Header + (*HeaderParameterSubSchema)(nil), // 14: openapi.v2.HeaderParameterSubSchema + (*Headers)(nil), // 15: openapi.v2.Headers + (*Info)(nil), // 16: openapi.v2.Info + (*ItemsItem)(nil), // 17: openapi.v2.ItemsItem + (*JsonReference)(nil), // 18: openapi.v2.JsonReference + (*License)(nil), // 19: openapi.v2.License + (*NamedAny)(nil), // 20: openapi.v2.NamedAny + (*NamedHeader)(nil), // 21: openapi.v2.NamedHeader + (*NamedParameter)(nil), // 22: openapi.v2.NamedParameter + (*NamedPathItem)(nil), // 23: openapi.v2.NamedPathItem + (*NamedResponse)(nil), // 24: openapi.v2.NamedResponse + (*NamedResponseValue)(nil), // 25: openapi.v2.NamedResponseValue + (*NamedSchema)(nil), // 26: openapi.v2.NamedSchema + (*NamedSecurityDefinitionsItem)(nil), // 27: openapi.v2.NamedSecurityDefinitionsItem + (*NamedString)(nil), // 28: openapi.v2.NamedString + (*NamedStringArray)(nil), // 29: openapi.v2.NamedStringArray + (*NonBodyParameter)(nil), // 30: openapi.v2.NonBodyParameter + (*Oauth2AccessCodeSecurity)(nil), // 31: openapi.v2.Oauth2AccessCodeSecurity + (*Oauth2ApplicationSecurity)(nil), // 32: openapi.v2.Oauth2ApplicationSecurity + (*Oauth2ImplicitSecurity)(nil), // 33: openapi.v2.Oauth2ImplicitSecurity + (*Oauth2PasswordSecurity)(nil), // 34: openapi.v2.Oauth2PasswordSecurity + (*Oauth2Scopes)(nil), // 35: openapi.v2.Oauth2Scopes + (*Operation)(nil), // 36: openapi.v2.Operation + (*Parameter)(nil), // 37: openapi.v2.Parameter + (*ParameterDefinitions)(nil), // 38: openapi.v2.ParameterDefinitions + (*ParametersItem)(nil), // 39: openapi.v2.ParametersItem + (*PathItem)(nil), // 40: openapi.v2.PathItem + (*PathParameterSubSchema)(nil), // 41: openapi.v2.PathParameterSubSchema + (*Paths)(nil), // 42: openapi.v2.Paths + (*PrimitivesItems)(nil), // 43: openapi.v2.PrimitivesItems + (*Properties)(nil), // 44: openapi.v2.Properties + (*QueryParameterSubSchema)(nil), // 45: openapi.v2.QueryParameterSubSchema + (*Response)(nil), // 46: openapi.v2.Response + (*ResponseDefinitions)(nil), // 47: openapi.v2.ResponseDefinitions + (*ResponseValue)(nil), // 48: openapi.v2.ResponseValue + (*Responses)(nil), // 49: openapi.v2.Responses + (*Schema)(nil), // 50: openapi.v2.Schema + (*SchemaItem)(nil), // 51: openapi.v2.SchemaItem + (*SecurityDefinitions)(nil), // 52: openapi.v2.SecurityDefinitions + (*SecurityDefinitionsItem)(nil), // 53: openapi.v2.SecurityDefinitionsItem + (*SecurityRequirement)(nil), // 54: openapi.v2.SecurityRequirement + (*StringArray)(nil), // 55: openapi.v2.StringArray + (*Tag)(nil), // 56: openapi.v2.Tag + (*TypeItem)(nil), // 57: openapi.v2.TypeItem + (*VendorExtension)(nil), // 58: openapi.v2.VendorExtension + (*Xml)(nil), // 59: openapi.v2.Xml + (*anypb.Any)(nil), // 60: google.protobuf.Any +} +var file_openapiv2_OpenAPIv2_proto_depIdxs = []int32{ + 50, // 0: openapi.v2.AdditionalPropertiesItem.schema:type_name -> openapi.v2.Schema + 60, // 1: openapi.v2.Any.value:type_name -> google.protobuf.Any + 20, // 2: openapi.v2.ApiKeySecurity.vendor_extension:type_name -> openapi.v2.NamedAny + 20, // 3: openapi.v2.BasicAuthenticationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny + 50, // 4: openapi.v2.BodyParameter.schema:type_name -> openapi.v2.Schema + 20, // 5: openapi.v2.BodyParameter.vendor_extension:type_name -> openapi.v2.NamedAny + 20, // 6: openapi.v2.Contact.vendor_extension:type_name -> openapi.v2.NamedAny + 20, // 7: openapi.v2.Default.additional_properties:type_name -> openapi.v2.NamedAny + 26, // 8: openapi.v2.Definitions.additional_properties:type_name -> openapi.v2.NamedSchema + 16, // 9: openapi.v2.Document.info:type_name -> openapi.v2.Info + 42, // 10: openapi.v2.Document.paths:type_name -> openapi.v2.Paths + 7, // 11: openapi.v2.Document.definitions:type_name -> openapi.v2.Definitions + 38, // 12: openapi.v2.Document.parameters:type_name -> openapi.v2.ParameterDefinitions + 47, // 13: openapi.v2.Document.responses:type_name -> openapi.v2.ResponseDefinitions + 54, // 14: openapi.v2.Document.security:type_name -> openapi.v2.SecurityRequirement + 52, // 15: openapi.v2.Document.security_definitions:type_name -> openapi.v2.SecurityDefinitions + 56, // 16: openapi.v2.Document.tags:type_name -> openapi.v2.Tag + 10, // 17: openapi.v2.Document.external_docs:type_name -> openapi.v2.ExternalDocs + 20, // 18: openapi.v2.Document.vendor_extension:type_name -> openapi.v2.NamedAny + 20, // 19: openapi.v2.Examples.additional_properties:type_name -> openapi.v2.NamedAny + 20, // 20: openapi.v2.ExternalDocs.vendor_extension:type_name -> openapi.v2.NamedAny + 1, // 21: openapi.v2.FileSchema.default:type_name -> openapi.v2.Any + 10, // 22: openapi.v2.FileSchema.external_docs:type_name -> openapi.v2.ExternalDocs + 1, // 23: openapi.v2.FileSchema.example:type_name -> openapi.v2.Any + 20, // 24: openapi.v2.FileSchema.vendor_extension:type_name -> openapi.v2.NamedAny + 43, // 25: openapi.v2.FormDataParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems + 1, // 26: openapi.v2.FormDataParameterSubSchema.default:type_name -> openapi.v2.Any + 1, // 27: openapi.v2.FormDataParameterSubSchema.enum:type_name -> openapi.v2.Any + 20, // 28: openapi.v2.FormDataParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny + 43, // 29: openapi.v2.Header.items:type_name -> openapi.v2.PrimitivesItems + 1, // 30: openapi.v2.Header.default:type_name -> openapi.v2.Any + 1, // 31: openapi.v2.Header.enum:type_name -> openapi.v2.Any + 20, // 32: openapi.v2.Header.vendor_extension:type_name -> openapi.v2.NamedAny + 43, // 33: openapi.v2.HeaderParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems + 1, // 34: openapi.v2.HeaderParameterSubSchema.default:type_name -> openapi.v2.Any + 1, // 35: openapi.v2.HeaderParameterSubSchema.enum:type_name -> openapi.v2.Any + 20, // 36: openapi.v2.HeaderParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny + 21, // 37: openapi.v2.Headers.additional_properties:type_name -> openapi.v2.NamedHeader + 5, // 38: openapi.v2.Info.contact:type_name -> openapi.v2.Contact + 19, // 39: openapi.v2.Info.license:type_name -> openapi.v2.License + 20, // 40: openapi.v2.Info.vendor_extension:type_name -> openapi.v2.NamedAny + 50, // 41: openapi.v2.ItemsItem.schema:type_name -> openapi.v2.Schema + 20, // 42: openapi.v2.License.vendor_extension:type_name -> openapi.v2.NamedAny + 1, // 43: openapi.v2.NamedAny.value:type_name -> openapi.v2.Any + 13, // 44: openapi.v2.NamedHeader.value:type_name -> openapi.v2.Header + 37, // 45: openapi.v2.NamedParameter.value:type_name -> openapi.v2.Parameter + 40, // 46: openapi.v2.NamedPathItem.value:type_name -> openapi.v2.PathItem + 46, // 47: openapi.v2.NamedResponse.value:type_name -> openapi.v2.Response + 48, // 48: openapi.v2.NamedResponseValue.value:type_name -> openapi.v2.ResponseValue + 50, // 49: openapi.v2.NamedSchema.value:type_name -> openapi.v2.Schema + 53, // 50: openapi.v2.NamedSecurityDefinitionsItem.value:type_name -> openapi.v2.SecurityDefinitionsItem + 55, // 51: openapi.v2.NamedStringArray.value:type_name -> openapi.v2.StringArray + 14, // 52: openapi.v2.NonBodyParameter.header_parameter_sub_schema:type_name -> openapi.v2.HeaderParameterSubSchema + 12, // 53: openapi.v2.NonBodyParameter.form_data_parameter_sub_schema:type_name -> openapi.v2.FormDataParameterSubSchema + 45, // 54: openapi.v2.NonBodyParameter.query_parameter_sub_schema:type_name -> openapi.v2.QueryParameterSubSchema + 41, // 55: openapi.v2.NonBodyParameter.path_parameter_sub_schema:type_name -> openapi.v2.PathParameterSubSchema + 35, // 56: openapi.v2.Oauth2AccessCodeSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes + 20, // 57: openapi.v2.Oauth2AccessCodeSecurity.vendor_extension:type_name -> openapi.v2.NamedAny + 35, // 58: openapi.v2.Oauth2ApplicationSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes + 20, // 59: openapi.v2.Oauth2ApplicationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny + 35, // 60: openapi.v2.Oauth2ImplicitSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes + 20, // 61: openapi.v2.Oauth2ImplicitSecurity.vendor_extension:type_name -> openapi.v2.NamedAny + 35, // 62: openapi.v2.Oauth2PasswordSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes + 20, // 63: openapi.v2.Oauth2PasswordSecurity.vendor_extension:type_name -> openapi.v2.NamedAny + 28, // 64: openapi.v2.Oauth2Scopes.additional_properties:type_name -> openapi.v2.NamedString + 10, // 65: openapi.v2.Operation.external_docs:type_name -> openapi.v2.ExternalDocs + 39, // 66: openapi.v2.Operation.parameters:type_name -> openapi.v2.ParametersItem + 49, // 67: openapi.v2.Operation.responses:type_name -> openapi.v2.Responses + 54, // 68: openapi.v2.Operation.security:type_name -> openapi.v2.SecurityRequirement + 20, // 69: openapi.v2.Operation.vendor_extension:type_name -> openapi.v2.NamedAny + 4, // 70: openapi.v2.Parameter.body_parameter:type_name -> openapi.v2.BodyParameter + 30, // 71: openapi.v2.Parameter.non_body_parameter:type_name -> openapi.v2.NonBodyParameter + 22, // 72: openapi.v2.ParameterDefinitions.additional_properties:type_name -> openapi.v2.NamedParameter + 37, // 73: openapi.v2.ParametersItem.parameter:type_name -> openapi.v2.Parameter + 18, // 74: openapi.v2.ParametersItem.json_reference:type_name -> openapi.v2.JsonReference + 36, // 75: openapi.v2.PathItem.get:type_name -> openapi.v2.Operation + 36, // 76: openapi.v2.PathItem.put:type_name -> openapi.v2.Operation + 36, // 77: openapi.v2.PathItem.post:type_name -> openapi.v2.Operation + 36, // 78: openapi.v2.PathItem.delete:type_name -> openapi.v2.Operation + 36, // 79: openapi.v2.PathItem.options:type_name -> openapi.v2.Operation + 36, // 80: openapi.v2.PathItem.head:type_name -> openapi.v2.Operation + 36, // 81: openapi.v2.PathItem.patch:type_name -> openapi.v2.Operation + 39, // 82: openapi.v2.PathItem.parameters:type_name -> openapi.v2.ParametersItem + 20, // 83: openapi.v2.PathItem.vendor_extension:type_name -> openapi.v2.NamedAny + 43, // 84: openapi.v2.PathParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems + 1, // 85: openapi.v2.PathParameterSubSchema.default:type_name -> openapi.v2.Any + 1, // 86: openapi.v2.PathParameterSubSchema.enum:type_name -> openapi.v2.Any + 20, // 87: openapi.v2.PathParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny + 20, // 88: openapi.v2.Paths.vendor_extension:type_name -> openapi.v2.NamedAny + 23, // 89: openapi.v2.Paths.path:type_name -> openapi.v2.NamedPathItem + 43, // 90: openapi.v2.PrimitivesItems.items:type_name -> openapi.v2.PrimitivesItems + 1, // 91: openapi.v2.PrimitivesItems.default:type_name -> openapi.v2.Any + 1, // 92: openapi.v2.PrimitivesItems.enum:type_name -> openapi.v2.Any + 20, // 93: openapi.v2.PrimitivesItems.vendor_extension:type_name -> openapi.v2.NamedAny + 26, // 94: openapi.v2.Properties.additional_properties:type_name -> openapi.v2.NamedSchema + 43, // 95: openapi.v2.QueryParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems + 1, // 96: openapi.v2.QueryParameterSubSchema.default:type_name -> openapi.v2.Any + 1, // 97: openapi.v2.QueryParameterSubSchema.enum:type_name -> openapi.v2.Any + 20, // 98: openapi.v2.QueryParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny + 51, // 99: openapi.v2.Response.schema:type_name -> openapi.v2.SchemaItem + 15, // 100: openapi.v2.Response.headers:type_name -> openapi.v2.Headers + 9, // 101: openapi.v2.Response.examples:type_name -> openapi.v2.Examples + 20, // 102: openapi.v2.Response.vendor_extension:type_name -> openapi.v2.NamedAny + 24, // 103: openapi.v2.ResponseDefinitions.additional_properties:type_name -> openapi.v2.NamedResponse + 46, // 104: openapi.v2.ResponseValue.response:type_name -> openapi.v2.Response + 18, // 105: openapi.v2.ResponseValue.json_reference:type_name -> openapi.v2.JsonReference + 25, // 106: openapi.v2.Responses.response_code:type_name -> openapi.v2.NamedResponseValue + 20, // 107: openapi.v2.Responses.vendor_extension:type_name -> openapi.v2.NamedAny + 1, // 108: openapi.v2.Schema.default:type_name -> openapi.v2.Any + 1, // 109: openapi.v2.Schema.enum:type_name -> openapi.v2.Any + 0, // 110: openapi.v2.Schema.additional_properties:type_name -> openapi.v2.AdditionalPropertiesItem + 57, // 111: openapi.v2.Schema.type:type_name -> openapi.v2.TypeItem + 17, // 112: openapi.v2.Schema.items:type_name -> openapi.v2.ItemsItem + 50, // 113: openapi.v2.Schema.all_of:type_name -> openapi.v2.Schema + 44, // 114: openapi.v2.Schema.properties:type_name -> openapi.v2.Properties + 59, // 115: openapi.v2.Schema.xml:type_name -> openapi.v2.Xml + 10, // 116: openapi.v2.Schema.external_docs:type_name -> openapi.v2.ExternalDocs + 1, // 117: openapi.v2.Schema.example:type_name -> openapi.v2.Any + 20, // 118: openapi.v2.Schema.vendor_extension:type_name -> openapi.v2.NamedAny + 50, // 119: openapi.v2.SchemaItem.schema:type_name -> openapi.v2.Schema + 11, // 120: openapi.v2.SchemaItem.file_schema:type_name -> openapi.v2.FileSchema + 27, // 121: openapi.v2.SecurityDefinitions.additional_properties:type_name -> openapi.v2.NamedSecurityDefinitionsItem + 3, // 122: openapi.v2.SecurityDefinitionsItem.basic_authentication_security:type_name -> openapi.v2.BasicAuthenticationSecurity + 2, // 123: openapi.v2.SecurityDefinitionsItem.api_key_security:type_name -> openapi.v2.ApiKeySecurity + 33, // 124: openapi.v2.SecurityDefinitionsItem.oauth2_implicit_security:type_name -> openapi.v2.Oauth2ImplicitSecurity + 34, // 125: openapi.v2.SecurityDefinitionsItem.oauth2_password_security:type_name -> openapi.v2.Oauth2PasswordSecurity + 32, // 126: openapi.v2.SecurityDefinitionsItem.oauth2_application_security:type_name -> openapi.v2.Oauth2ApplicationSecurity + 31, // 127: openapi.v2.SecurityDefinitionsItem.oauth2_access_code_security:type_name -> openapi.v2.Oauth2AccessCodeSecurity + 29, // 128: openapi.v2.SecurityRequirement.additional_properties:type_name -> openapi.v2.NamedStringArray + 10, // 129: openapi.v2.Tag.external_docs:type_name -> openapi.v2.ExternalDocs + 20, // 130: openapi.v2.Tag.vendor_extension:type_name -> openapi.v2.NamedAny + 20, // 131: openapi.v2.VendorExtension.additional_properties:type_name -> openapi.v2.NamedAny + 20, // 132: openapi.v2.Xml.vendor_extension:type_name -> openapi.v2.NamedAny + 133, // [133:133] is the sub-list for method output_type + 133, // [133:133] is the sub-list for method input_type + 133, // [133:133] is the sub-list for extension type_name + 133, // [133:133] is the sub-list for extension extendee + 0, // [0:133] is the sub-list for field type_name +} + +func init() { file_openapiv2_OpenAPIv2_proto_init() } +func file_openapiv2_OpenAPIv2_proto_init() { + if File_openapiv2_OpenAPIv2_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_openapiv2_OpenAPIv2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AdditionalPropertiesItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Any); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApiKeySecurity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BasicAuthenticationSecurity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BodyParameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Contact); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Default); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Definitions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Document); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Examples); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExternalDocs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileSchema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FormDataParameterSubSchema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeaderParameterSubSchema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Headers); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Info); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ItemsItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JsonReference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*License); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedAny); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedParameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedPathItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedResponseValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedSchema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedSecurityDefinitionsItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedString); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamedStringArray); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NonBodyParameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Oauth2AccessCodeSecurity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Oauth2ApplicationSecurity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Oauth2ImplicitSecurity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Oauth2PasswordSecurity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Oauth2Scopes); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Operation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Parameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ParameterDefinitions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ParametersItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PathItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PathParameterSubSchema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Paths); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrimitivesItems); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Properties); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParameterSubSchema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Response); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResponseDefinitions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResponseValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Responses); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Schema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SchemaItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SecurityDefinitions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SecurityDefinitionsItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SecurityRequirement); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StringArray); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Tag); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TypeItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VendorExtension); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Xml); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_openapiv2_OpenAPIv2_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*AdditionalPropertiesItem_Schema)(nil), + (*AdditionalPropertiesItem_Boolean)(nil), + } + file_openapiv2_OpenAPIv2_proto_msgTypes[30].OneofWrappers = []interface{}{ + (*NonBodyParameter_HeaderParameterSubSchema)(nil), + (*NonBodyParameter_FormDataParameterSubSchema)(nil), + (*NonBodyParameter_QueryParameterSubSchema)(nil), + (*NonBodyParameter_PathParameterSubSchema)(nil), + } + file_openapiv2_OpenAPIv2_proto_msgTypes[37].OneofWrappers = []interface{}{ + (*Parameter_BodyParameter)(nil), + (*Parameter_NonBodyParameter)(nil), + } + file_openapiv2_OpenAPIv2_proto_msgTypes[39].OneofWrappers = []interface{}{ + (*ParametersItem_Parameter)(nil), + (*ParametersItem_JsonReference)(nil), + } + file_openapiv2_OpenAPIv2_proto_msgTypes[48].OneofWrappers = []interface{}{ + (*ResponseValue_Response)(nil), + (*ResponseValue_JsonReference)(nil), + } + file_openapiv2_OpenAPIv2_proto_msgTypes[51].OneofWrappers = []interface{}{ + (*SchemaItem_Schema)(nil), + (*SchemaItem_FileSchema)(nil), + } + file_openapiv2_OpenAPIv2_proto_msgTypes[53].OneofWrappers = []interface{}{ + (*SecurityDefinitionsItem_BasicAuthenticationSecurity)(nil), + (*SecurityDefinitionsItem_ApiKeySecurity)(nil), + (*SecurityDefinitionsItem_Oauth2ImplicitSecurity)(nil), + (*SecurityDefinitionsItem_Oauth2PasswordSecurity)(nil), + (*SecurityDefinitionsItem_Oauth2ApplicationSecurity)(nil), + (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_openapiv2_OpenAPIv2_proto_rawDesc, + NumEnums: 0, + NumMessages: 60, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_openapiv2_OpenAPIv2_proto_goTypes, + DependencyIndexes: file_openapiv2_OpenAPIv2_proto_depIdxs, + MessageInfos: file_openapiv2_OpenAPIv2_proto_msgTypes, + }.Build() + File_openapiv2_OpenAPIv2_proto = out.File + file_openapiv2_OpenAPIv2_proto_rawDesc = nil + file_openapiv2_OpenAPIv2_proto_goTypes = nil + file_openapiv2_OpenAPIv2_proto_depIdxs = nil +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.proto b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.proto new file mode 100644 index 000000000..1c59b2f4a --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.proto @@ -0,0 +1,666 @@ +// Copyright 2020 Google LLC. All Rights Reserved. +// +// 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. + +// THIS FILE IS AUTOMATICALLY GENERATED. + +syntax = "proto3"; + +package openapi.v2; + +import "google/protobuf/any.proto"; + +// This option lets the proto compiler generate Java code inside the package +// name (see below) instead of inside an outer class. It creates a simpler +// developer experience by reducing one-level of name nesting and be +// consistent with most programming languages that don't support outer classes. +option java_multiple_files = true; + +// The Java outer classname should be the filename in UpperCamelCase. This +// class is only used to hold proto descriptor, so developers don't need to +// work with it directly. +option java_outer_classname = "OpenAPIProto"; + +// The Java package name must be proto package name with proper prefix. +option java_package = "org.openapi_v2"; + +// A reasonable prefix for the Objective-C symbols generated from the package. +// It should at a minimum be 3 characters long, all uppercase, and convention +// is to use an abbreviation of the package name. Something short, but +// hopefully unique enough to not conflict with things that may come along in +// the future. 'GPB' is reserved for the protocol buffer implementation itself. +option objc_class_prefix = "OAS"; + +// The Go package name. +option go_package = "./openapiv2;openapi_v2"; + +message AdditionalPropertiesItem { + oneof oneof { + Schema schema = 1; + bool boolean = 2; + } +} + +message Any { + google.protobuf.Any value = 1; + string yaml = 2; +} + +message ApiKeySecurity { + string type = 1; + string name = 2; + string in = 3; + string description = 4; + repeated NamedAny vendor_extension = 5; +} + +message BasicAuthenticationSecurity { + string type = 1; + string description = 2; + repeated NamedAny vendor_extension = 3; +} + +message BodyParameter { + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + string description = 1; + // The name of the parameter. + string name = 2; + // Determines the location of the parameter. + string in = 3; + // Determines whether or not this parameter is required or optional. + bool required = 4; + Schema schema = 5; + repeated NamedAny vendor_extension = 6; +} + +// Contact information for the owners of the API. +message Contact { + // The identifying name of the contact person/organization. + string name = 1; + // The URL pointing to the contact information. + string url = 2; + // The email address of the contact person/organization. + string email = 3; + repeated NamedAny vendor_extension = 4; +} + +message Default { + repeated NamedAny additional_properties = 1; +} + +// One or more JSON objects describing the schemas being consumed and produced by the API. +message Definitions { + repeated NamedSchema additional_properties = 1; +} + +message Document { + // The Swagger version of this document. + string swagger = 1; + Info info = 2; + // The host (name or ip) of the API. Example: 'swagger.io' + string host = 3; + // The base path to the API. Example: '/api'. + string base_path = 4; + // The transfer protocol of the API. + repeated string schemes = 5; + // A list of MIME types accepted by the API. + repeated string consumes = 6; + // A list of MIME types the API can produce. + repeated string produces = 7; + Paths paths = 8; + Definitions definitions = 9; + ParameterDefinitions parameters = 10; + ResponseDefinitions responses = 11; + repeated SecurityRequirement security = 12; + SecurityDefinitions security_definitions = 13; + repeated Tag tags = 14; + ExternalDocs external_docs = 15; + repeated NamedAny vendor_extension = 16; +} + +message Examples { + repeated NamedAny additional_properties = 1; +} + +// information about external documentation +message ExternalDocs { + string description = 1; + string url = 2; + repeated NamedAny vendor_extension = 3; +} + +// A deterministic version of a JSON Schema object. +message FileSchema { + string format = 1; + string title = 2; + string description = 3; + Any default = 4; + repeated string required = 5; + string type = 6; + bool read_only = 7; + ExternalDocs external_docs = 8; + Any example = 9; + repeated NamedAny vendor_extension = 10; +} + +message FormDataParameterSubSchema { + // Determines whether or not this parameter is required or optional. + bool required = 1; + // Determines the location of the parameter. + string in = 2; + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + string description = 3; + // The name of the parameter. + string name = 4; + // allows sending a parameter by name only or with an empty value. + bool allow_empty_value = 5; + string type = 6; + string format = 7; + PrimitivesItems items = 8; + string collection_format = 9; + Any default = 10; + double maximum = 11; + bool exclusive_maximum = 12; + double minimum = 13; + bool exclusive_minimum = 14; + int64 max_length = 15; + int64 min_length = 16; + string pattern = 17; + int64 max_items = 18; + int64 min_items = 19; + bool unique_items = 20; + repeated Any enum = 21; + double multiple_of = 22; + repeated NamedAny vendor_extension = 23; +} + +message Header { + string type = 1; + string format = 2; + PrimitivesItems items = 3; + string collection_format = 4; + Any default = 5; + double maximum = 6; + bool exclusive_maximum = 7; + double minimum = 8; + bool exclusive_minimum = 9; + int64 max_length = 10; + int64 min_length = 11; + string pattern = 12; + int64 max_items = 13; + int64 min_items = 14; + bool unique_items = 15; + repeated Any enum = 16; + double multiple_of = 17; + string description = 18; + repeated NamedAny vendor_extension = 19; +} + +message HeaderParameterSubSchema { + // Determines whether or not this parameter is required or optional. + bool required = 1; + // Determines the location of the parameter. + string in = 2; + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + string description = 3; + // The name of the parameter. + string name = 4; + string type = 5; + string format = 6; + PrimitivesItems items = 7; + string collection_format = 8; + Any default = 9; + double maximum = 10; + bool exclusive_maximum = 11; + double minimum = 12; + bool exclusive_minimum = 13; + int64 max_length = 14; + int64 min_length = 15; + string pattern = 16; + int64 max_items = 17; + int64 min_items = 18; + bool unique_items = 19; + repeated Any enum = 20; + double multiple_of = 21; + repeated NamedAny vendor_extension = 22; +} + +message Headers { + repeated NamedHeader additional_properties = 1; +} + +// General information about the API. +message Info { + // A unique and precise title of the API. + string title = 1; + // A semantic version number of the API. + string version = 2; + // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed. + string description = 3; + // The terms of service for the API. + string terms_of_service = 4; + Contact contact = 5; + License license = 6; + repeated NamedAny vendor_extension = 7; +} + +message ItemsItem { + repeated Schema schema = 1; +} + +message JsonReference { + string _ref = 1; + string description = 2; +} + +message License { + // The name of the license type. It's encouraged to use an OSI compatible license. + string name = 1; + // The URL pointing to the license. + string url = 2; + repeated NamedAny vendor_extension = 3; +} + +// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. +message NamedAny { + // Map key + string name = 1; + // Mapped value + Any value = 2; +} + +// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs. +message NamedHeader { + // Map key + string name = 1; + // Mapped value + Header value = 2; +} + +// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs. +message NamedParameter { + // Map key + string name = 1; + // Mapped value + Parameter value = 2; +} + +// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. +message NamedPathItem { + // Map key + string name = 1; + // Mapped value + PathItem value = 2; +} + +// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs. +message NamedResponse { + // Map key + string name = 1; + // Mapped value + Response value = 2; +} + +// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs. +message NamedResponseValue { + // Map key + string name = 1; + // Mapped value + ResponseValue value = 2; +} + +// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs. +message NamedSchema { + // Map key + string name = 1; + // Mapped value + Schema value = 2; +} + +// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs. +message NamedSecurityDefinitionsItem { + // Map key + string name = 1; + // Mapped value + SecurityDefinitionsItem value = 2; +} + +// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. +message NamedString { + // Map key + string name = 1; + // Mapped value + string value = 2; +} + +// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. +message NamedStringArray { + // Map key + string name = 1; + // Mapped value + StringArray value = 2; +} + +message NonBodyParameter { + oneof oneof { + HeaderParameterSubSchema header_parameter_sub_schema = 1; + FormDataParameterSubSchema form_data_parameter_sub_schema = 2; + QueryParameterSubSchema query_parameter_sub_schema = 3; + PathParameterSubSchema path_parameter_sub_schema = 4; + } +} + +message Oauth2AccessCodeSecurity { + string type = 1; + string flow = 2; + Oauth2Scopes scopes = 3; + string authorization_url = 4; + string token_url = 5; + string description = 6; + repeated NamedAny vendor_extension = 7; +} + +message Oauth2ApplicationSecurity { + string type = 1; + string flow = 2; + Oauth2Scopes scopes = 3; + string token_url = 4; + string description = 5; + repeated NamedAny vendor_extension = 6; +} + +message Oauth2ImplicitSecurity { + string type = 1; + string flow = 2; + Oauth2Scopes scopes = 3; + string authorization_url = 4; + string description = 5; + repeated NamedAny vendor_extension = 6; +} + +message Oauth2PasswordSecurity { + string type = 1; + string flow = 2; + Oauth2Scopes scopes = 3; + string token_url = 4; + string description = 5; + repeated NamedAny vendor_extension = 6; +} + +message Oauth2Scopes { + repeated NamedString additional_properties = 1; +} + +message Operation { + repeated string tags = 1; + // A brief summary of the operation. + string summary = 2; + // A longer description of the operation, GitHub Flavored Markdown is allowed. + string description = 3; + ExternalDocs external_docs = 4; + // A unique identifier of the operation. + string operation_id = 5; + // A list of MIME types the API can produce. + repeated string produces = 6; + // A list of MIME types the API can consume. + repeated string consumes = 7; + // The parameters needed to send a valid API call. + repeated ParametersItem parameters = 8; + Responses responses = 9; + // The transfer protocol of the API. + repeated string schemes = 10; + bool deprecated = 11; + repeated SecurityRequirement security = 12; + repeated NamedAny vendor_extension = 13; +} + +message Parameter { + oneof oneof { + BodyParameter body_parameter = 1; + NonBodyParameter non_body_parameter = 2; + } +} + +// One or more JSON representations for parameters +message ParameterDefinitions { + repeated NamedParameter additional_properties = 1; +} + +message ParametersItem { + oneof oneof { + Parameter parameter = 1; + JsonReference json_reference = 2; + } +} + +message PathItem { + string _ref = 1; + Operation get = 2; + Operation put = 3; + Operation post = 4; + Operation delete = 5; + Operation options = 6; + Operation head = 7; + Operation patch = 8; + // The parameters needed to send a valid API call. + repeated ParametersItem parameters = 9; + repeated NamedAny vendor_extension = 10; +} + +message PathParameterSubSchema { + // Determines whether or not this parameter is required or optional. + bool required = 1; + // Determines the location of the parameter. + string in = 2; + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + string description = 3; + // The name of the parameter. + string name = 4; + string type = 5; + string format = 6; + PrimitivesItems items = 7; + string collection_format = 8; + Any default = 9; + double maximum = 10; + bool exclusive_maximum = 11; + double minimum = 12; + bool exclusive_minimum = 13; + int64 max_length = 14; + int64 min_length = 15; + string pattern = 16; + int64 max_items = 17; + int64 min_items = 18; + bool unique_items = 19; + repeated Any enum = 20; + double multiple_of = 21; + repeated NamedAny vendor_extension = 22; +} + +// Relative paths to the individual endpoints. They must be relative to the 'basePath'. +message Paths { + repeated NamedAny vendor_extension = 1; + repeated NamedPathItem path = 2; +} + +message PrimitivesItems { + string type = 1; + string format = 2; + PrimitivesItems items = 3; + string collection_format = 4; + Any default = 5; + double maximum = 6; + bool exclusive_maximum = 7; + double minimum = 8; + bool exclusive_minimum = 9; + int64 max_length = 10; + int64 min_length = 11; + string pattern = 12; + int64 max_items = 13; + int64 min_items = 14; + bool unique_items = 15; + repeated Any enum = 16; + double multiple_of = 17; + repeated NamedAny vendor_extension = 18; +} + +message Properties { + repeated NamedSchema additional_properties = 1; +} + +message QueryParameterSubSchema { + // Determines whether or not this parameter is required or optional. + bool required = 1; + // Determines the location of the parameter. + string in = 2; + // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. + string description = 3; + // The name of the parameter. + string name = 4; + // allows sending a parameter by name only or with an empty value. + bool allow_empty_value = 5; + string type = 6; + string format = 7; + PrimitivesItems items = 8; + string collection_format = 9; + Any default = 10; + double maximum = 11; + bool exclusive_maximum = 12; + double minimum = 13; + bool exclusive_minimum = 14; + int64 max_length = 15; + int64 min_length = 16; + string pattern = 17; + int64 max_items = 18; + int64 min_items = 19; + bool unique_items = 20; + repeated Any enum = 21; + double multiple_of = 22; + repeated NamedAny vendor_extension = 23; +} + +message Response { + string description = 1; + SchemaItem schema = 2; + Headers headers = 3; + Examples examples = 4; + repeated NamedAny vendor_extension = 5; +} + +// One or more JSON representations for responses +message ResponseDefinitions { + repeated NamedResponse additional_properties = 1; +} + +message ResponseValue { + oneof oneof { + Response response = 1; + JsonReference json_reference = 2; + } +} + +// Response objects names can either be any valid HTTP status code or 'default'. +message Responses { + repeated NamedResponseValue response_code = 1; + repeated NamedAny vendor_extension = 2; +} + +// A deterministic version of a JSON Schema object. +message Schema { + string _ref = 1; + string format = 2; + string title = 3; + string description = 4; + Any default = 5; + double multiple_of = 6; + double maximum = 7; + bool exclusive_maximum = 8; + double minimum = 9; + bool exclusive_minimum = 10; + int64 max_length = 11; + int64 min_length = 12; + string pattern = 13; + int64 max_items = 14; + int64 min_items = 15; + bool unique_items = 16; + int64 max_properties = 17; + int64 min_properties = 18; + repeated string required = 19; + repeated Any enum = 20; + AdditionalPropertiesItem additional_properties = 21; + TypeItem type = 22; + ItemsItem items = 23; + repeated Schema all_of = 24; + Properties properties = 25; + string discriminator = 26; + bool read_only = 27; + Xml xml = 28; + ExternalDocs external_docs = 29; + Any example = 30; + repeated NamedAny vendor_extension = 31; +} + +message SchemaItem { + oneof oneof { + Schema schema = 1; + FileSchema file_schema = 2; + } +} + +message SecurityDefinitions { + repeated NamedSecurityDefinitionsItem additional_properties = 1; +} + +message SecurityDefinitionsItem { + oneof oneof { + BasicAuthenticationSecurity basic_authentication_security = 1; + ApiKeySecurity api_key_security = 2; + Oauth2ImplicitSecurity oauth2_implicit_security = 3; + Oauth2PasswordSecurity oauth2_password_security = 4; + Oauth2ApplicationSecurity oauth2_application_security = 5; + Oauth2AccessCodeSecurity oauth2_access_code_security = 6; + } +} + +message SecurityRequirement { + repeated NamedStringArray additional_properties = 1; +} + +message StringArray { + repeated string value = 1; +} + +message Tag { + string name = 1; + string description = 2; + ExternalDocs external_docs = 3; + repeated NamedAny vendor_extension = 4; +} + +message TypeItem { + repeated string value = 1; +} + +// Any property starting with x- is valid. +message VendorExtension { + repeated NamedAny additional_properties = 1; +} + +message Xml { + string name = 1; + string namespace = 2; + string prefix = 3; + bool attribute = 4; + bool wrapped = 5; + repeated NamedAny vendor_extension = 6; +} + diff --git a/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/README.md b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/README.md new file mode 100644 index 000000000..5276128d3 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/README.md @@ -0,0 +1,14 @@ +# OpenAPI v2 Protocol Buffer Models + +This directory contains a Protocol Buffer-language model and related code for +supporting OpenAPI v2. + +Gnostic applications and plugins can use OpenAPIv2.proto to generate Protocol +Buffer support code for their preferred languages. + +OpenAPIv2.go is used by Gnostic to read JSON and YAML OpenAPI descriptions into +the Protocol Buffer-based datastructures generated from OpenAPIv2.proto. + +OpenAPIv2.proto and OpenAPIv2.go are generated by the Gnostic compiler +generator, and OpenAPIv2.pb.go is generated by protoc, the Protocol Buffer +compiler, and protoc-gen-go, the Protocol Buffer Go code generation plugin. diff --git a/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/document.go b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/document.go new file mode 100644 index 000000000..56e5966b4 --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/document.go @@ -0,0 +1,41 @@ +// Copyright 2020 Google LLC. All Rights Reserved. +// +// 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 openapi_v2 + +import ( + "github.com/googleapis/gnostic/compiler" + "gopkg.in/yaml.v3" +) + +// ParseDocument reads an OpenAPI v2 description from a YAML/JSON representation. +func ParseDocument(b []byte) (*Document, error) { + info, err := compiler.ReadInfoFromBytes("", b) + if err != nil { + return nil, err + } + root := info.Content[0] + return NewDocument(root, compiler.NewContextWithExtensions("$root", root, nil, nil)) +} + +// YAMLValue produces a serialized YAML representation of the document. +func (d *Document) YAMLValue(comment string) ([]byte, error) { + rawInfo := d.ToRawInfo() + rawInfo = &yaml.Node{ + Kind: yaml.DocumentNode, + Content: []*yaml.Node{rawInfo}, + HeadComment: comment, + } + return yaml.Marshal(rawInfo) +} diff --git a/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/openapi-2.0.json b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/openapi-2.0.json new file mode 100644 index 000000000..afa12b79b --- /dev/null +++ b/integration-test/vendor/github.com/googleapis/gnostic/openapiv2/openapi-2.0.json @@ -0,0 +1,1610 @@ +{ + "title": "A JSON Schema for Swagger 2.0 API.", + "id": "http://swagger.io/v2/schema.json#", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "required": [ + "swagger", + "info", + "paths" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "swagger": { + "type": "string", + "enum": [ + "2.0" + ], + "description": "The Swagger version of this document." + }, + "info": { + "$ref": "#/definitions/info" + }, + "host": { + "type": "string", + "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", + "description": "The host (name or ip) of the API. Example: 'swagger.io'" + }, + "basePath": { + "type": "string", + "pattern": "^/", + "description": "The base path to the API. Example: '/api'." + }, + "schemes": { + "$ref": "#/definitions/schemesList" + }, + "consumes": { + "description": "A list of MIME types accepted by the API.", + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] + }, + "produces": { + "description": "A list of MIME types the API can produce.", + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] + }, + "paths": { + "$ref": "#/definitions/paths" + }, + "definitions": { + "$ref": "#/definitions/definitions" + }, + "parameters": { + "$ref": "#/definitions/parameterDefinitions" + }, + "responses": { + "$ref": "#/definitions/responseDefinitions" + }, + "security": { + "$ref": "#/definitions/security" + }, + "securityDefinitions": { + "$ref": "#/definitions/securityDefinitions" + }, + "tags": { + "type": "array", + "items": { + "$ref": "#/definitions/tag" + }, + "uniqueItems": true + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } + }, + "definitions": { + "info": { + "type": "object", + "description": "General information about the API.", + "required": [ + "version", + "title" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "title": { + "type": "string", + "description": "A unique and precise title of the API." + }, + "version": { + "type": "string", + "description": "A semantic version number of the API." + }, + "description": { + "type": "string", + "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." + }, + "termsOfService": { + "type": "string", + "description": "The terms of service for the API." + }, + "contact": { + "$ref": "#/definitions/contact" + }, + "license": { + "$ref": "#/definitions/license" + } + } + }, + "contact": { + "type": "object", + "description": "Contact information for the owners of the API.", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The identifying name of the contact person/organization." + }, + "url": { + "type": "string", + "description": "The URL pointing to the contact information.", + "format": "uri" + }, + "email": { + "type": "string", + "description": "The email address of the contact person/organization.", + "format": "email" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "license": { + "type": "object", + "required": [ + "name" + ], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of the license type. It's encouraged to use an OSI compatible license." + }, + "url": { + "type": "string", + "description": "The URL pointing to the license.", + "format": "uri" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "paths": { + "type": "object", + "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + }, + "^/": { + "$ref": "#/definitions/pathItem" + } + }, + "additionalProperties": false + }, + "definitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "description": "One or more JSON objects describing the schemas being consumed and produced by the API." + }, + "parameterDefinitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/parameter" + }, + "description": "One or more JSON representations for parameters" + }, + "responseDefinitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/response" + }, + "description": "One or more JSON representations for responses" + }, + "externalDocs": { + "type": "object", + "additionalProperties": false, + "description": "information about external documentation", + "required": [ + "url" + ], + "properties": { + "description": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "examples": { + "type": "object", + "additionalProperties": true + }, + "mimeType": { + "type": "string", + "description": "The MIME type of the HTTP message." + }, + "operation": { + "type": "object", + "required": [ + "responses" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "summary": { + "type": "string", + "description": "A brief summary of the operation." + }, + "description": { + "type": "string", + "description": "A longer description of the operation, GitHub Flavored Markdown is allowed." + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "operationId": { + "type": "string", + "description": "A unique identifier of the operation." + }, + "produces": { + "description": "A list of MIME types the API can produce.", + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] + }, + "consumes": { + "description": "A list of MIME types the API can consume.", + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] + }, + "parameters": { + "$ref": "#/definitions/parametersList" + }, + "responses": { + "$ref": "#/definitions/responses" + }, + "schemes": { + "$ref": "#/definitions/schemesList" + }, + "deprecated": { + "type": "boolean", + "default": false + }, + "security": { + "$ref": "#/definitions/security" + } + } + }, + "pathItem": { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "$ref": { + "type": "string" + }, + "get": { + "$ref": "#/definitions/operation" + }, + "put": { + "$ref": "#/definitions/operation" + }, + "post": { + "$ref": "#/definitions/operation" + }, + "delete": { + "$ref": "#/definitions/operation" + }, + "options": { + "$ref": "#/definitions/operation" + }, + "head": { + "$ref": "#/definitions/operation" + }, + "patch": { + "$ref": "#/definitions/operation" + }, + "parameters": { + "$ref": "#/definitions/parametersList" + } + } + }, + "responses": { + "type": "object", + "description": "Response objects names can either be any valid HTTP status code or 'default'.", + "minProperties": 1, + "additionalProperties": false, + "patternProperties": { + "^([0-9]{3})$|^(default)$": { + "$ref": "#/definitions/responseValue" + }, + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "not": { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + } + }, + "responseValue": { + "oneOf": [ + { + "$ref": "#/definitions/response" + }, + { + "$ref": "#/definitions/jsonReference" + } + ] + }, + "response": { + "type": "object", + "required": [ + "description" + ], + "properties": { + "description": { + "type": "string" + }, + "schema": { + "oneOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "$ref": "#/definitions/fileSchema" + } + ] + }, + "headers": { + "$ref": "#/definitions/headers" + }, + "examples": { + "$ref": "#/definitions/examples" + } + }, + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "headers": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/header" + } + }, + "header": { + "type": "object", + "additionalProperties": false, + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "vendorExtension": { + "description": "Any property starting with x- is valid.", + "additionalProperties": true, + "additionalItems": true + }, + "bodyParameter": { + "type": "object", + "required": [ + "name", + "in", + "schema" + ], + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "body" + ] + }, + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "schema": { + "$ref": "#/definitions/schema" + } + }, + "additionalProperties": false + }, + "headerParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "header" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "queryParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "query" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "allowEmptyValue": { + "type": "boolean", + "default": false, + "description": "allows sending a parameter by name only or with an empty value." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormatWithMulti" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "formDataParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "formData" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "allowEmptyValue": { + "type": "boolean", + "default": false, + "description": "allows sending a parameter by name only or with an empty value." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array", + "file" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormatWithMulti" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "pathParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "required": [ + "required" + ], + "properties": { + "required": { + "type": "boolean", + "enum": [ + true + ], + "description": "Determines whether or not this parameter is required or optional." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "path" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "nonBodyParameter": { + "type": "object", + "required": [ + "name", + "in", + "type" + ], + "oneOf": [ + { + "$ref": "#/definitions/headerParameterSubSchema" + }, + { + "$ref": "#/definitions/formDataParameterSubSchema" + }, + { + "$ref": "#/definitions/queryParameterSubSchema" + }, + { + "$ref": "#/definitions/pathParameterSubSchema" + } + ] + }, + "parameter": { + "oneOf": [ + { + "$ref": "#/definitions/bodyParameter" + }, + { + "$ref": "#/definitions/nonBodyParameter" + } + ] + }, + "schema": { + "type": "object", + "description": "A deterministic version of a JSON Schema object.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "$ref": { + "type": "string" + }, + "format": { + "type": "string" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "maxProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "required": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "boolean" + } + ], + "default": {} + }, + "type": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/type" + }, + "items": { + "anyOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + } + ], + "default": {} + }, + "allOf": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "default": {} + }, + "discriminator": { + "type": "string" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/xml" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "example": {} + }, + "additionalProperties": false + }, + "fileSchema": { + "type": "object", + "description": "A deterministic version of a JSON Schema object.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "required": [ + "type" + ], + "properties": { + "format": { + "type": "string" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "required": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" + }, + "type": { + "type": "string", + "enum": [ + "file" + ] + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "example": {} + }, + "additionalProperties": false + }, + "primitivesItems": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "security": { + "type": "array", + "items": { + "$ref": "#/definitions/securityRequirement" + }, + "uniqueItems": true + }, + "securityRequirement": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "xml": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean", + "default": false + }, + "wrapped": { + "type": "boolean", + "default": false + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "tag": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "securityDefinitions": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/basicAuthenticationSecurity" + }, + { + "$ref": "#/definitions/apiKeySecurity" + }, + { + "$ref": "#/definitions/oauth2ImplicitSecurity" + }, + { + "$ref": "#/definitions/oauth2PasswordSecurity" + }, + { + "$ref": "#/definitions/oauth2ApplicationSecurity" + }, + { + "$ref": "#/definitions/oauth2AccessCodeSecurity" + } + ] + } + }, + "basicAuthenticationSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "basic" + ] + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "apiKeySecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "name", + "in" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "apiKey" + ] + }, + "name": { + "type": "string" + }, + "in": { + "type": "string", + "enum": [ + "header", + "query" + ] + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2ImplicitSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "authorizationUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "implicit" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "authorizationUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2PasswordSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "password" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2ApplicationSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "application" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2AccessCodeSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "authorizationUrl", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "accessCode" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "authorizationUrl": { + "type": "string", + "format": "uri" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2Scopes": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "mediaTypeList": { + "type": "array", + "items": { + "$ref": "#/definitions/mimeType" + }, + "uniqueItems": true + }, + "parametersList": { + "type": "array", + "description": "The parameters needed to send a valid API call.", + "additionalItems": false, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/parameter" + }, + { + "$ref": "#/definitions/jsonReference" + } + ] + }, + "uniqueItems": true + }, + "schemesList": { + "type": "array", + "description": "The transfer protocol of the API.", + "items": { + "type": "string", + "enum": [ + "http", + "https", + "ws", + "wss" + ] + }, + "uniqueItems": true + }, + "collectionFormat": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes" + ], + "default": "csv" + }, + "collectionFormatWithMulti": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes", + "multi" + ], + "default": "csv" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "jsonReference": { + "type": "object", + "required": [ + "$ref" + ], + "additionalProperties": false, + "properties": { + "$ref": { + "type": "string" + }, + "description": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/integration-test/vendor/github.com/imdario/mergo/.deepsource.toml b/integration-test/vendor/github.com/imdario/mergo/.deepsource.toml new file mode 100644 index 000000000..8a0681af8 --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/.deepsource.toml @@ -0,0 +1,12 @@ +version = 1 + +test_patterns = [ + "*_test.go" +] + +[[analyzers]] +name = "go" +enabled = true + + [analyzers.meta] + import_path = "github.com/imdario/mergo" \ No newline at end of file diff --git a/integration-test/vendor/github.com/imdario/mergo/.gitignore b/integration-test/vendor/github.com/imdario/mergo/.gitignore new file mode 100644 index 000000000..529c3412b --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/.gitignore @@ -0,0 +1,33 @@ +#### joe made this: http://goel.io/joe + +#### go #### +# Binaries for programs and plugins +*.exe +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 +.glide/ + +#### vim #### +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-v][a-z] +[._]sw[a-p] + +# Session +Session.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags diff --git a/integration-test/vendor/github.com/imdario/mergo/.travis.yml b/integration-test/vendor/github.com/imdario/mergo/.travis.yml new file mode 100644 index 000000000..d324c43ba --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/.travis.yml @@ -0,0 +1,12 @@ +language: go +arch: + - amd64 + - ppc64le +install: + - go get -t + - go get golang.org/x/tools/cmd/cover + - go get github.com/mattn/goveralls +script: + - go test -race -v ./... +after_script: + - $HOME/gopath/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN diff --git a/integration-test/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md b/integration-test/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..469b44907 --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at i@dario.im. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/integration-test/vendor/github.com/imdario/mergo/LICENSE b/integration-test/vendor/github.com/imdario/mergo/LICENSE new file mode 100644 index 000000000..686680298 --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2013 Dario Castañé. All rights reserved. +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/integration-test/vendor/github.com/imdario/mergo/README.md b/integration-test/vendor/github.com/imdario/mergo/README.md new file mode 100644 index 000000000..aa8cbd7ce --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/README.md @@ -0,0 +1,247 @@ +# Mergo + + +[![GoDoc][3]][4] +[![GitHub release][5]][6] +[![GoCard][7]][8] +[![Build Status][1]][2] +[![Coverage Status][9]][10] +[![Sourcegraph][11]][12] +[![FOSSA Status][13]][14] + +[![GoCenter Kudos][15]][16] + +[1]: https://travis-ci.org/imdario/mergo.png +[2]: https://travis-ci.org/imdario/mergo +[3]: https://godoc.org/github.com/imdario/mergo?status.svg +[4]: https://godoc.org/github.com/imdario/mergo +[5]: https://img.shields.io/github/release/imdario/mergo.svg +[6]: https://github.com/imdario/mergo/releases +[7]: https://goreportcard.com/badge/imdario/mergo +[8]: https://goreportcard.com/report/github.com/imdario/mergo +[9]: https://coveralls.io/repos/github/imdario/mergo/badge.svg?branch=master +[10]: https://coveralls.io/github/imdario/mergo?branch=master +[11]: https://sourcegraph.com/github.com/imdario/mergo/-/badge.svg +[12]: https://sourcegraph.com/github.com/imdario/mergo?badge +[13]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Fimdario%2Fmergo.svg?type=shield +[14]: https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_shield +[15]: https://search.gocenter.io/api/ui/badge/github.com%2Fimdario%2Fmergo +[16]: https://search.gocenter.io/github.com/imdario/mergo + +A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. + +Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). + +Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region of Marche. + +## Status + +It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc](https://github.com/imdario/mergo#mergo-in-the-wild). + +### Important note + +Please keep in mind that a problematic PR broke [0.3.9](//github.com/imdario/mergo/releases/tag/0.3.9). I reverted it in [0.3.10](//github.com/imdario/mergo/releases/tag/0.3.10), and I consider it stable but not bug-free. Also, this version adds suppot for go modules. + +Keep in mind that in [0.3.2](//github.com/imdario/mergo/releases/tag/0.3.2), Mergo changed `Merge()`and `Map()` signatures to support [transformers](#transformers). I added an optional/variadic argument so that it won't break the existing code. + +If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with ```go get -u github.com/imdario/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). + +### Donations + +If Mergo is useful to you, consider buying me a coffee, a beer, or making a monthly donation to allow me to keep building great free software. :heart_eyes: + +Buy Me a Coffee at ko-fi.com +[![Beerpay](https://beerpay.io/imdario/mergo/badge.svg)](https://beerpay.io/imdario/mergo) +[![Beerpay](https://beerpay.io/imdario/mergo/make-wish.svg)](https://beerpay.io/imdario/mergo) +Donate using Liberapay + +### Mergo in the wild + +- [moby/moby](https://github.com/moby/moby) +- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) +- [vmware/dispatch](https://github.com/vmware/dispatch) +- [Shopify/themekit](https://github.com/Shopify/themekit) +- [imdario/zas](https://github.com/imdario/zas) +- [matcornic/hermes](https://github.com/matcornic/hermes) +- [OpenBazaar/openbazaar-go](https://github.com/OpenBazaar/openbazaar-go) +- [kataras/iris](https://github.com/kataras/iris) +- [michaelsauter/crane](https://github.com/michaelsauter/crane) +- [go-task/task](https://github.com/go-task/task) +- [sensu/uchiwa](https://github.com/sensu/uchiwa) +- [ory/hydra](https://github.com/ory/hydra) +- [sisatech/vcli](https://github.com/sisatech/vcli) +- [dairycart/dairycart](https://github.com/dairycart/dairycart) +- [projectcalico/felix](https://github.com/projectcalico/felix) +- [resin-os/balena](https://github.com/resin-os/balena) +- [go-kivik/kivik](https://github.com/go-kivik/kivik) +- [Telefonica/govice](https://github.com/Telefonica/govice) +- [supergiant/supergiant](supergiant/supergiant) +- [SergeyTsalkov/brooce](https://github.com/SergeyTsalkov/brooce) +- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy) +- [ohsu-comp-bio/funnel](https://github.com/ohsu-comp-bio/funnel) +- [EagerIO/Stout](https://github.com/EagerIO/Stout) +- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api) +- [russross/canvasassignments](https://github.com/russross/canvasassignments) +- [rdegges/cryptly-api](https://github.com/rdegges/cryptly-api) +- [casualjim/exeggutor](https://github.com/casualjim/exeggutor) +- [divshot/gitling](https://github.com/divshot/gitling) +- [RWJMurphy/gorl](https://github.com/RWJMurphy/gorl) +- [andrerocker/deploy42](https://github.com/andrerocker/deploy42) +- [elwinar/rambler](https://github.com/elwinar/rambler) +- [tmaiaroto/gopartman](https://github.com/tmaiaroto/gopartman) +- [jfbus/impressionist](https://github.com/jfbus/impressionist) +- [Jmeyering/zealot](https://github.com/Jmeyering/zealot) +- [godep-migrator/rigger-host](https://github.com/godep-migrator/rigger-host) +- [Dronevery/MultiwaySwitch-Go](https://github.com/Dronevery/MultiwaySwitch-Go) +- [thoas/picfit](https://github.com/thoas/picfit) +- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server) +- [jnuthong/item_search](https://github.com/jnuthong/item_search) +- [bukalapak/snowboard](https://github.com/bukalapak/snowboard) +- [containerssh/containerssh](https://github.com/containerssh/containerssh) + +## Install + + go get github.com/imdario/mergo + + // use in your .go code + import ( + "github.com/imdario/mergo" + ) + +## Usage + +You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as [they are zero values](https://golang.org/ref/spec#The_zero_value) too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). + +```go +if err := mergo.Merge(&dst, src); err != nil { + // ... +} +``` + +Also, you can merge overwriting values using the transformer `WithOverride`. + +```go +if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil { + // ... +} +``` + +Additionally, you can map a `map[string]interface{}` to a struct (and otherwise, from struct to map), following the same restrictions as in `Merge()`. Keys are capitalized to find each corresponding exported field. + +```go +if err := mergo.Map(&dst, srcMap); err != nil { + // ... +} +``` + +Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as `map[string]interface{}`. They will be just assigned as values. + +Here is a nice example: + +```go +package main + +import ( + "fmt" + "github.com/imdario/mergo" +) + +type Foo struct { + A string + B int64 +} + +func main() { + src := Foo{ + A: "one", + B: 2, + } + dest := Foo{ + A: "two", + } + mergo.Merge(&dest, src) + fmt.Println(dest) + // Will print + // {two 2} +} +``` + +Note: if test are failing due missing package, please execute: + + go get gopkg.in/yaml.v2 + +### Transformers + +Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, `time.Time` is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero `time.Time`? + +```go +package main + +import ( + "fmt" + "github.com/imdario/mergo" + "reflect" + "time" +) + +type timeTransformer struct { +} + +func (t timeTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error { + if typ == reflect.TypeOf(time.Time{}) { + return func(dst, src reflect.Value) error { + if dst.CanSet() { + isZero := dst.MethodByName("IsZero") + result := isZero.Call([]reflect.Value{}) + if result[0].Bool() { + dst.Set(src) + } + } + return nil + } + } + return nil +} + +type Snapshot struct { + Time time.Time + // ... +} + +func main() { + src := Snapshot{time.Now()} + dest := Snapshot{} + mergo.Merge(&dest, src, mergo.WithTransformers(timeTransformer{})) + fmt.Println(dest) + // Will print + // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } +} +``` + + +## Contact me + +If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): [@im_dario](https://twitter.com/im_dario) + +## About + +Written by [Dario Castañé](http://dario.im). + +## Top Contributors + +[![0](https://sourcerer.io/fame/imdario/imdario/mergo/images/0)](https://sourcerer.io/fame/imdario/imdario/mergo/links/0) +[![1](https://sourcerer.io/fame/imdario/imdario/mergo/images/1)](https://sourcerer.io/fame/imdario/imdario/mergo/links/1) +[![2](https://sourcerer.io/fame/imdario/imdario/mergo/images/2)](https://sourcerer.io/fame/imdario/imdario/mergo/links/2) +[![3](https://sourcerer.io/fame/imdario/imdario/mergo/images/3)](https://sourcerer.io/fame/imdario/imdario/mergo/links/3) +[![4](https://sourcerer.io/fame/imdario/imdario/mergo/images/4)](https://sourcerer.io/fame/imdario/imdario/mergo/links/4) +[![5](https://sourcerer.io/fame/imdario/imdario/mergo/images/5)](https://sourcerer.io/fame/imdario/imdario/mergo/links/5) +[![6](https://sourcerer.io/fame/imdario/imdario/mergo/images/6)](https://sourcerer.io/fame/imdario/imdario/mergo/links/6) +[![7](https://sourcerer.io/fame/imdario/imdario/mergo/images/7)](https://sourcerer.io/fame/imdario/imdario/mergo/links/7) + + +## License + +[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license, as [Go language](http://golang.org/LICENSE). + + +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fimdario%2Fmergo.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_large) diff --git a/integration-test/vendor/github.com/imdario/mergo/doc.go b/integration-test/vendor/github.com/imdario/mergo/doc.go new file mode 100644 index 000000000..fcd985f99 --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/doc.go @@ -0,0 +1,143 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. + +Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). + +Status + +It is ready for production use. It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc. + +Important note + +Please keep in mind that a problematic PR broke 0.3.9. We reverted it in 0.3.10. We consider 0.3.10 as stable but not bug-free. . Also, this version adds suppot for go modules. + +Keep in mind that in 0.3.2, Mergo changed Merge() and Map() signatures to support transformers. We added an optional/variadic argument so that it won't break the existing code. + +If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with go get -u github.com/imdario/mergo. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). + +Install + +Do your usual installation procedure: + + go get github.com/imdario/mergo + + // use in your .go code + import ( + "github.com/imdario/mergo" + ) + +Usage + +You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as they are zero values too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). + + if err := mergo.Merge(&dst, src); err != nil { + // ... + } + +Also, you can merge overwriting values using the transformer WithOverride. + + if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil { + // ... + } + +Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field. + + if err := mergo.Map(&dst, srcMap); err != nil { + // ... + } + +Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as map[string]interface{}. They will be just assigned as values. + +Here is a nice example: + + package main + + import ( + "fmt" + "github.com/imdario/mergo" + ) + + type Foo struct { + A string + B int64 + } + + func main() { + src := Foo{ + A: "one", + B: 2, + } + dest := Foo{ + A: "two", + } + mergo.Merge(&dest, src) + fmt.Println(dest) + // Will print + // {two 2} + } + +Transformers + +Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, time.Time is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero time.Time? + + package main + + import ( + "fmt" + "github.com/imdario/mergo" + "reflect" + "time" + ) + + type timeTransformer struct { + } + + func (t timeTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error { + if typ == reflect.TypeOf(time.Time{}) { + return func(dst, src reflect.Value) error { + if dst.CanSet() { + isZero := dst.MethodByName("IsZero") + result := isZero.Call([]reflect.Value{}) + if result[0].Bool() { + dst.Set(src) + } + } + return nil + } + } + return nil + } + + type Snapshot struct { + Time time.Time + // ... + } + + func main() { + src := Snapshot{time.Now()} + dest := Snapshot{} + mergo.Merge(&dest, src, mergo.WithTransformers(timeTransformer{})) + fmt.Println(dest) + // Will print + // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } + } + +Contact me + +If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): https://twitter.com/im_dario + +About + +Written by Dario Castañé: https://da.rio.hn + +License + +BSD 3-Clause license, as Go language. + +*/ +package mergo diff --git a/integration-test/vendor/github.com/imdario/mergo/map.go b/integration-test/vendor/github.com/imdario/mergo/map.go new file mode 100644 index 000000000..a13a7ee46 --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/map.go @@ -0,0 +1,178 @@ +// Copyright 2014 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "fmt" + "reflect" + "unicode" + "unicode/utf8" +) + +func changeInitialCase(s string, mapper func(rune) rune) string { + if s == "" { + return s + } + r, n := utf8.DecodeRuneInString(s) + return string(mapper(r)) + s[n:] +} + +func isExported(field reflect.StructField) bool { + r, _ := utf8.DecodeRuneInString(field.Name) + return r >= 'A' && r <= 'Z' +} + +// Traverses recursively both values, assigning src's fields values to dst. +// The map argument tracks comparisons that have already been seen, which allows +// short circuiting on recursive types. +func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { + overwrite := config.Overwrite + if dst.CanAddr() { + addr := dst.UnsafeAddr() + h := 17 * addr + seen := visited[h] + typ := dst.Type() + for p := seen; p != nil; p = p.next { + if p.ptr == addr && p.typ == typ { + return nil + } + } + // Remember, remember... + visited[h] = &visit{addr, typ, seen} + } + zeroValue := reflect.Value{} + switch dst.Kind() { + case reflect.Map: + dstMap := dst.Interface().(map[string]interface{}) + for i, n := 0, src.NumField(); i < n; i++ { + srcType := src.Type() + field := srcType.Field(i) + if !isExported(field) { + continue + } + fieldName := field.Name + fieldName = changeInitialCase(fieldName, unicode.ToLower) + if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v)) || overwrite) { + dstMap[fieldName] = src.Field(i).Interface() + } + } + case reflect.Ptr: + if dst.IsNil() { + v := reflect.New(dst.Type().Elem()) + dst.Set(v) + } + dst = dst.Elem() + fallthrough + case reflect.Struct: + srcMap := src.Interface().(map[string]interface{}) + for key := range srcMap { + config.overwriteWithEmptyValue = true + srcValue := srcMap[key] + fieldName := changeInitialCase(key, unicode.ToUpper) + dstElement := dst.FieldByName(fieldName) + if dstElement == zeroValue { + // We discard it because the field doesn't exist. + continue + } + srcElement := reflect.ValueOf(srcValue) + dstKind := dstElement.Kind() + srcKind := srcElement.Kind() + if srcKind == reflect.Ptr && dstKind != reflect.Ptr { + srcElement = srcElement.Elem() + srcKind = reflect.TypeOf(srcElement.Interface()).Kind() + } else if dstKind == reflect.Ptr { + // Can this work? I guess it can't. + if srcKind != reflect.Ptr && srcElement.CanAddr() { + srcPtr := srcElement.Addr() + srcElement = reflect.ValueOf(srcPtr) + srcKind = reflect.Ptr + } + } + + if !srcElement.IsValid() { + continue + } + if srcKind == dstKind { + if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { + return + } + } else if dstKind == reflect.Interface && dstElement.Kind() == reflect.Interface { + if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { + return + } + } else if srcKind == reflect.Map { + if err = deepMap(dstElement, srcElement, visited, depth+1, config); err != nil { + return + } + } else { + return fmt.Errorf("type mismatch on %s field: found %v, expected %v", fieldName, srcKind, dstKind) + } + } + } + return +} + +// Map sets fields' values in dst from src. +// src can be a map with string keys or a struct. dst must be the opposite: +// if src is a map, dst must be a valid pointer to struct. If src is a struct, +// dst must be map[string]interface{}. +// It won't merge unexported (private) fields and will do recursively +// any exported field. +// If dst is a map, keys will be src fields' names in lower camel case. +// Missing key in src that doesn't match a field in dst will be skipped. This +// doesn't apply if dst is a map. +// This is separated method from Merge because it is cleaner and it keeps sane +// semantics: merging equal types, mapping different (restricted) types. +func Map(dst, src interface{}, opts ...func(*Config)) error { + return _map(dst, src, opts...) +} + +// MapWithOverwrite will do the same as Map except that non-empty dst attributes will be overridden by +// non-empty src attribute values. +// Deprecated: Use Map(…) with WithOverride +func MapWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { + return _map(dst, src, append(opts, WithOverride)...) +} + +func _map(dst, src interface{}, opts ...func(*Config)) error { + if dst != nil && reflect.ValueOf(dst).Kind() != reflect.Ptr { + return ErrNonPointerAgument + } + var ( + vDst, vSrc reflect.Value + err error + ) + config := &Config{} + + for _, opt := range opts { + opt(config) + } + + if vDst, vSrc, err = resolveValues(dst, src); err != nil { + return err + } + // To be friction-less, we redirect equal-type arguments + // to deepMerge. Only because arguments can be anything. + if vSrc.Kind() == vDst.Kind() { + return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config) + } + switch vSrc.Kind() { + case reflect.Struct: + if vDst.Kind() != reflect.Map { + return ErrExpectedMapAsDestination + } + case reflect.Map: + if vDst.Kind() != reflect.Struct { + return ErrExpectedStructAsDestination + } + default: + return ErrNotSupported + } + return deepMap(vDst, vSrc, make(map[uintptr]*visit), 0, config) +} diff --git a/integration-test/vendor/github.com/imdario/mergo/merge.go b/integration-test/vendor/github.com/imdario/mergo/merge.go new file mode 100644 index 000000000..8c2a8fcd9 --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/merge.go @@ -0,0 +1,380 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "fmt" + "reflect" +) + +func hasMergeableFields(dst reflect.Value) (exported bool) { + for i, n := 0, dst.NumField(); i < n; i++ { + field := dst.Type().Field(i) + if field.Anonymous && dst.Field(i).Kind() == reflect.Struct { + exported = exported || hasMergeableFields(dst.Field(i)) + } else if isExportedComponent(&field) { + exported = exported || len(field.PkgPath) == 0 + } + } + return +} + +func isExportedComponent(field *reflect.StructField) bool { + pkgPath := field.PkgPath + if len(pkgPath) > 0 { + return false + } + c := field.Name[0] + if 'a' <= c && c <= 'z' || c == '_' { + return false + } + return true +} + +type Config struct { + Overwrite bool + AppendSlice bool + TypeCheck bool + Transformers Transformers + overwriteWithEmptyValue bool + overwriteSliceWithEmptyValue bool + sliceDeepCopy bool + debug bool +} + +type Transformers interface { + Transformer(reflect.Type) func(dst, src reflect.Value) error +} + +// Traverses recursively both values, assigning src's fields values to dst. +// The map argument tracks comparisons that have already been seen, which allows +// short circuiting on recursive types. +func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { + overwrite := config.Overwrite + typeCheck := config.TypeCheck + overwriteWithEmptySrc := config.overwriteWithEmptyValue + overwriteSliceWithEmptySrc := config.overwriteSliceWithEmptyValue + sliceDeepCopy := config.sliceDeepCopy + + if !src.IsValid() { + return + } + if dst.CanAddr() { + addr := dst.UnsafeAddr() + h := 17 * addr + seen := visited[h] + typ := dst.Type() + for p := seen; p != nil; p = p.next { + if p.ptr == addr && p.typ == typ { + return nil + } + } + // Remember, remember... + visited[h] = &visit{addr, typ, seen} + } + + if config.Transformers != nil && !isEmptyValue(dst) { + if fn := config.Transformers.Transformer(dst.Type()); fn != nil { + err = fn(dst, src) + return + } + } + + switch dst.Kind() { + case reflect.Struct: + if hasMergeableFields(dst) { + for i, n := 0, dst.NumField(); i < n; i++ { + if err = deepMerge(dst.Field(i), src.Field(i), visited, depth+1, config); err != nil { + return + } + } + } else { + if dst.CanSet() && (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) { + dst.Set(src) + } + } + case reflect.Map: + if dst.IsNil() && !src.IsNil() { + if dst.CanSet() { + dst.Set(reflect.MakeMap(dst.Type())) + } else { + dst = src + return + } + } + + if src.Kind() != reflect.Map { + if overwrite { + dst.Set(src) + } + return + } + + for _, key := range src.MapKeys() { + srcElement := src.MapIndex(key) + if !srcElement.IsValid() { + continue + } + dstElement := dst.MapIndex(key) + switch srcElement.Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Interface, reflect.Slice: + if srcElement.IsNil() { + if overwrite { + dst.SetMapIndex(key, srcElement) + } + continue + } + fallthrough + default: + if !srcElement.CanInterface() { + continue + } + switch reflect.TypeOf(srcElement.Interface()).Kind() { + case reflect.Struct: + fallthrough + case reflect.Ptr: + fallthrough + case reflect.Map: + srcMapElm := srcElement + dstMapElm := dstElement + if srcMapElm.CanInterface() { + srcMapElm = reflect.ValueOf(srcMapElm.Interface()) + if dstMapElm.IsValid() { + dstMapElm = reflect.ValueOf(dstMapElm.Interface()) + } + } + if err = deepMerge(dstMapElm, srcMapElm, visited, depth+1, config); err != nil { + return + } + case reflect.Slice: + srcSlice := reflect.ValueOf(srcElement.Interface()) + + var dstSlice reflect.Value + if !dstElement.IsValid() || dstElement.IsNil() { + dstSlice = reflect.MakeSlice(srcSlice.Type(), 0, srcSlice.Len()) + } else { + dstSlice = reflect.ValueOf(dstElement.Interface()) + } + + if (!isEmptyValue(src) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice && !sliceDeepCopy { + if typeCheck && srcSlice.Type() != dstSlice.Type() { + return fmt.Errorf("cannot override two slices with different type (%s, %s)", srcSlice.Type(), dstSlice.Type()) + } + dstSlice = srcSlice + } else if config.AppendSlice { + if srcSlice.Type() != dstSlice.Type() { + return fmt.Errorf("cannot append two slices with different type (%s, %s)", srcSlice.Type(), dstSlice.Type()) + } + dstSlice = reflect.AppendSlice(dstSlice, srcSlice) + } else if sliceDeepCopy { + i := 0 + for ; i < srcSlice.Len() && i < dstSlice.Len(); i++ { + srcElement := srcSlice.Index(i) + dstElement := dstSlice.Index(i) + + if srcElement.CanInterface() { + srcElement = reflect.ValueOf(srcElement.Interface()) + } + if dstElement.CanInterface() { + dstElement = reflect.ValueOf(dstElement.Interface()) + } + + if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { + return + } + } + + } + dst.SetMapIndex(key, dstSlice) + } + } + if dstElement.IsValid() && !isEmptyValue(dstElement) && (reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Map || reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Slice) { + continue + } + + if srcElement.IsValid() && ((srcElement.Kind() != reflect.Ptr && overwrite) || !dstElement.IsValid() || isEmptyValue(dstElement)) { + if dst.IsNil() { + dst.Set(reflect.MakeMap(dst.Type())) + } + dst.SetMapIndex(key, srcElement) + } + } + case reflect.Slice: + if !dst.CanSet() { + break + } + if (!isEmptyValue(src) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice && !sliceDeepCopy { + dst.Set(src) + } else if config.AppendSlice { + if src.Type() != dst.Type() { + return fmt.Errorf("cannot append two slice with different type (%s, %s)", src.Type(), dst.Type()) + } + dst.Set(reflect.AppendSlice(dst, src)) + } else if sliceDeepCopy { + for i := 0; i < src.Len() && i < dst.Len(); i++ { + srcElement := src.Index(i) + dstElement := dst.Index(i) + if srcElement.CanInterface() { + srcElement = reflect.ValueOf(srcElement.Interface()) + } + if dstElement.CanInterface() { + dstElement = reflect.ValueOf(dstElement.Interface()) + } + + if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { + return + } + } + } + case reflect.Ptr: + fallthrough + case reflect.Interface: + if isReflectNil(src) { + if overwriteWithEmptySrc && dst.CanSet() && src.Type().AssignableTo(dst.Type()) { + dst.Set(src) + } + break + } + + if src.Kind() != reflect.Interface { + if dst.IsNil() || (src.Kind() != reflect.Ptr && overwrite) { + if dst.CanSet() && (overwrite || isEmptyValue(dst)) { + dst.Set(src) + } + } else if src.Kind() == reflect.Ptr { + if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { + return + } + } else if dst.Elem().Type() == src.Type() { + if err = deepMerge(dst.Elem(), src, visited, depth+1, config); err != nil { + return + } + } else { + return ErrDifferentArgumentsTypes + } + break + } + + if dst.IsNil() || overwrite { + if dst.CanSet() && (overwrite || isEmptyValue(dst)) { + dst.Set(src) + } + break + } + + if dst.Elem().Kind() == src.Elem().Kind() { + if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { + return + } + break + } + default: + mustSet := (isEmptyValue(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) + if mustSet { + if dst.CanSet() { + dst.Set(src) + } else { + dst = src + } + } + } + + return +} + +// Merge will fill any empty for value type attributes on the dst struct using corresponding +// src attributes if they themselves are not empty. dst and src must be valid same-type structs +// and dst must be a pointer to struct. +// It won't merge unexported (private) fields and will do recursively any exported field. +func Merge(dst, src interface{}, opts ...func(*Config)) error { + return merge(dst, src, opts...) +} + +// MergeWithOverwrite will do the same as Merge except that non-empty dst attributes will be overridden by +// non-empty src attribute values. +// Deprecated: use Merge(…) with WithOverride +func MergeWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { + return merge(dst, src, append(opts, WithOverride)...) +} + +// WithTransformers adds transformers to merge, allowing to customize the merging of some types. +func WithTransformers(transformers Transformers) func(*Config) { + return func(config *Config) { + config.Transformers = transformers + } +} + +// WithOverride will make merge override non-empty dst attributes with non-empty src attributes values. +func WithOverride(config *Config) { + config.Overwrite = true +} + +// WithOverwriteWithEmptyValue will make merge override non empty dst attributes with empty src attributes values. +func WithOverwriteWithEmptyValue(config *Config) { + config.Overwrite = true + config.overwriteWithEmptyValue = true +} + +// WithOverrideEmptySlice will make merge override empty dst slice with empty src slice. +func WithOverrideEmptySlice(config *Config) { + config.overwriteSliceWithEmptyValue = true +} + +// WithAppendSlice will make merge append slices instead of overwriting it. +func WithAppendSlice(config *Config) { + config.AppendSlice = true +} + +// WithTypeCheck will make merge check types while overwriting it (must be used with WithOverride). +func WithTypeCheck(config *Config) { + config.TypeCheck = true +} + +// WithSliceDeepCopy will merge slice element one by one with Overwrite flag. +func WithSliceDeepCopy(config *Config) { + config.sliceDeepCopy = true + config.Overwrite = true +} + +func merge(dst, src interface{}, opts ...func(*Config)) error { + if dst != nil && reflect.ValueOf(dst).Kind() != reflect.Ptr { + return ErrNonPointerAgument + } + var ( + vDst, vSrc reflect.Value + err error + ) + + config := &Config{} + + for _, opt := range opts { + opt(config) + } + + if vDst, vSrc, err = resolveValues(dst, src); err != nil { + return err + } + if vDst.Type() != vSrc.Type() { + return ErrDifferentArgumentsTypes + } + return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config) +} + +// IsReflectNil is the reflect value provided nil +func isReflectNil(v reflect.Value) bool { + k := v.Kind() + switch k { + case reflect.Interface, reflect.Slice, reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr: + // Both interface and slice are nil if first word is 0. + // Both are always bigger than a word; assume flagIndir. + return v.IsNil() + default: + return false + } +} diff --git a/integration-test/vendor/github.com/imdario/mergo/mergo.go b/integration-test/vendor/github.com/imdario/mergo/mergo.go new file mode 100644 index 000000000..3cc926c7f --- /dev/null +++ b/integration-test/vendor/github.com/imdario/mergo/mergo.go @@ -0,0 +1,78 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "errors" + "reflect" +) + +// Errors reported by Mergo when it finds invalid arguments. +var ( + ErrNilArguments = errors.New("src and dst must not be nil") + ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type") + ErrNotSupported = errors.New("only structs and maps are supported") + ErrExpectedMapAsDestination = errors.New("dst was expected to be a map") + ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct") + ErrNonPointerAgument = errors.New("dst must be a pointer") +) + +// During deepMerge, must keep track of checks that are +// in progress. The comparison algorithm assumes that all +// checks in progress are true when it reencounters them. +// Visited are stored in a map indexed by 17 * a1 + a2; +type visit struct { + ptr uintptr + typ reflect.Type + next *visit +} + +// From src/pkg/encoding/json/encode.go. +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + if v.IsNil() { + return true + } + return isEmptyValue(v.Elem()) + case reflect.Func: + return v.IsNil() + case reflect.Invalid: + return true + } + return false +} + +func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) { + if dst == nil || src == nil { + err = ErrNilArguments + return + } + vDst = reflect.ValueOf(dst).Elem() + if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map { + err = ErrNotSupported + return + } + vSrc = reflect.ValueOf(src) + // We check if vSrc is a pointer to dereference it. + if vSrc.Kind() == reflect.Ptr { + vSrc = vSrc.Elem() + } + return +} diff --git a/integration-test/vendor/github.com/inconshreveable/mousetrap/LICENSE b/integration-test/vendor/github.com/inconshreveable/mousetrap/LICENSE new file mode 100644 index 000000000..5f0d1fb6a --- /dev/null +++ b/integration-test/vendor/github.com/inconshreveable/mousetrap/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014 Alan Shreve + +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. diff --git a/integration-test/vendor/github.com/inconshreveable/mousetrap/README.md b/integration-test/vendor/github.com/inconshreveable/mousetrap/README.md new file mode 100644 index 000000000..7a950d177 --- /dev/null +++ b/integration-test/vendor/github.com/inconshreveable/mousetrap/README.md @@ -0,0 +1,23 @@ +# mousetrap + +mousetrap is a tiny library that answers a single question. + +On a Windows machine, was the process invoked by someone double clicking on +the executable file while browsing in explorer? + +### Motivation + +Windows developers unfamiliar with command line tools will often "double-click" +the executable for a tool. Because most CLI tools print the help and then exit +when invoked without arguments, this is often very frustrating for those users. + +mousetrap provides a way to detect these invocations so that you can provide +more helpful behavior and instructions on how to run the CLI tool. To see what +this looks like, both from an organizational and a technical perspective, see +https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ + +### The interface + +The library exposes a single interface: + + func StartedByExplorer() (bool) diff --git a/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_others.go b/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_others.go new file mode 100644 index 000000000..9d2d8a4ba --- /dev/null +++ b/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_others.go @@ -0,0 +1,15 @@ +// +build !windows + +package mousetrap + +// StartedByExplorer returns true if the program was invoked by the user +// double-clicking on the executable from explorer.exe +// +// It is conservative and returns false if any of the internal calls fail. +// It does not guarantee that the program was run from a terminal. It only can tell you +// whether it was launched from explorer.exe +// +// On non-Windows platforms, it always returns false. +func StartedByExplorer() bool { + return false +} diff --git a/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_windows.go new file mode 100644 index 000000000..336142a5e --- /dev/null +++ b/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_windows.go @@ -0,0 +1,98 @@ +// +build windows +// +build !go1.4 + +package mousetrap + +import ( + "fmt" + "os" + "syscall" + "unsafe" +) + +const ( + // defined by the Win32 API + th32cs_snapprocess uintptr = 0x2 +) + +var ( + kernel = syscall.MustLoadDLL("kernel32.dll") + CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot") + Process32First = kernel.MustFindProc("Process32FirstW") + Process32Next = kernel.MustFindProc("Process32NextW") +) + +// ProcessEntry32 structure defined by the Win32 API +type processEntry32 struct { + dwSize uint32 + cntUsage uint32 + th32ProcessID uint32 + th32DefaultHeapID int + th32ModuleID uint32 + cntThreads uint32 + th32ParentProcessID uint32 + pcPriClassBase int32 + dwFlags uint32 + szExeFile [syscall.MAX_PATH]uint16 +} + +func getProcessEntry(pid int) (pe *processEntry32, err error) { + snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0)) + if snapshot == uintptr(syscall.InvalidHandle) { + err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1) + return + } + defer syscall.CloseHandle(syscall.Handle(snapshot)) + + var processEntry processEntry32 + processEntry.dwSize = uint32(unsafe.Sizeof(processEntry)) + ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) + if ok == 0 { + err = fmt.Errorf("Process32First: %v", e1) + return + } + + for { + if processEntry.th32ProcessID == uint32(pid) { + pe = &processEntry + return + } + + ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) + if ok == 0 { + err = fmt.Errorf("Process32Next: %v", e1) + return + } + } +} + +func getppid() (pid int, err error) { + pe, err := getProcessEntry(os.Getpid()) + if err != nil { + return + } + + pid = int(pe.th32ParentProcessID) + return +} + +// StartedByExplorer returns true if the program was invoked by the user double-clicking +// on the executable from explorer.exe +// +// It is conservative and returns false if any of the internal calls fail. +// It does not guarantee that the program was run from a terminal. It only can tell you +// whether it was launched from explorer.exe +func StartedByExplorer() bool { + ppid, err := getppid() + if err != nil { + return false + } + + pe, err := getProcessEntry(ppid) + if err != nil { + return false + } + + name := syscall.UTF16ToString(pe.szExeFile[:]) + return name == "explorer.exe" +} diff --git a/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go new file mode 100644 index 000000000..9a28e57c3 --- /dev/null +++ b/integration-test/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go @@ -0,0 +1,46 @@ +// +build windows +// +build go1.4 + +package mousetrap + +import ( + "os" + "syscall" + "unsafe" +) + +func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { + snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) + if err != nil { + return nil, err + } + defer syscall.CloseHandle(snapshot) + var procEntry syscall.ProcessEntry32 + procEntry.Size = uint32(unsafe.Sizeof(procEntry)) + if err = syscall.Process32First(snapshot, &procEntry); err != nil { + return nil, err + } + for { + if procEntry.ProcessID == uint32(pid) { + return &procEntry, nil + } + err = syscall.Process32Next(snapshot, &procEntry) + if err != nil { + return nil, err + } + } +} + +// StartedByExplorer returns true if the program was invoked by the user double-clicking +// on the executable from explorer.exe +// +// It is conservative and returns false if any of the internal calls fail. +// It does not guarantee that the program was run from a terminal. It only can tell you +// whether it was launched from explorer.exe +func StartedByExplorer() bool { + pe, err := getProcessEntry(os.Getppid()) + if err != nil { + return false + } + return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/.codecov.yml b/integration-test/vendor/github.com/json-iterator/go/.codecov.yml new file mode 100644 index 000000000..955dc0be5 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/.codecov.yml @@ -0,0 +1,3 @@ +ignore: + - "output_tests/.*" + diff --git a/integration-test/vendor/github.com/json-iterator/go/.gitignore b/integration-test/vendor/github.com/json-iterator/go/.gitignore new file mode 100644 index 000000000..15556530a --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/.gitignore @@ -0,0 +1,4 @@ +/vendor +/bug_test.go +/coverage.txt +/.idea diff --git a/integration-test/vendor/github.com/json-iterator/go/.travis.yml b/integration-test/vendor/github.com/json-iterator/go/.travis.yml new file mode 100644 index 000000000..449e67cd0 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/.travis.yml @@ -0,0 +1,14 @@ +language: go + +go: + - 1.8.x + - 1.x + +before_install: + - go get -t -v ./... + +script: + - ./test.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/integration-test/vendor/github.com/json-iterator/go/Gopkg.lock b/integration-test/vendor/github.com/json-iterator/go/Gopkg.lock new file mode 100644 index 000000000..c8a9fbb38 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/Gopkg.lock @@ -0,0 +1,21 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "github.com/modern-go/concurrent" + packages = ["."] + revision = "e0a39a4cb4216ea8db28e22a69f4ec25610d513a" + version = "1.0.0" + +[[projects]] + name = "github.com/modern-go/reflect2" + packages = ["."] + revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" + version = "1.0.1" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "ea54a775e5a354cb015502d2e7aa4b74230fc77e894f34a838b268c25ec8eeb8" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/integration-test/vendor/github.com/json-iterator/go/Gopkg.toml b/integration-test/vendor/github.com/json-iterator/go/Gopkg.toml new file mode 100644 index 000000000..313a0f887 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/Gopkg.toml @@ -0,0 +1,26 @@ +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + +ignored = ["github.com/davecgh/go-spew*","github.com/google/gofuzz*","github.com/stretchr/testify*"] + +[[constraint]] + name = "github.com/modern-go/reflect2" + version = "1.0.1" diff --git a/integration-test/vendor/github.com/json-iterator/go/LICENSE b/integration-test/vendor/github.com/json-iterator/go/LICENSE new file mode 100644 index 000000000..2cf4f5ab2 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 json-iterator + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/integration-test/vendor/github.com/json-iterator/go/README.md b/integration-test/vendor/github.com/json-iterator/go/README.md new file mode 100644 index 000000000..52b111d5f --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/README.md @@ -0,0 +1,87 @@ +[![Sourcegraph](https://sourcegraph.com/github.com/json-iterator/go/-/badge.svg)](https://sourcegraph.com/github.com/json-iterator/go?badge) +[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/json-iterator/go) +[![Build Status](https://travis-ci.org/json-iterator/go.svg?branch=master)](https://travis-ci.org/json-iterator/go) +[![codecov](https://codecov.io/gh/json-iterator/go/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/go) +[![rcard](https://goreportcard.com/badge/github.com/json-iterator/go)](https://goreportcard.com/report/github.com/json-iterator/go) +[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/go/master/LICENSE) +[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) + +A high-performance 100% compatible drop-in replacement of "encoding/json" + +You can also use thrift like JSON using [thrift-iterator](https://github.com/thrift-iterator/go) + +# Benchmark + +![benchmark](http://jsoniter.com/benchmarks/go-benchmark.png) + +Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go + +Raw Result (easyjson requires static code generation) + +| | ns/op | allocation bytes | allocation times | +| --------------- | ----------- | ---------------- | ---------------- | +| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op | +| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op | +| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op | +| std encode | 2213 ns/op | 712 B/op | 5 allocs/op | +| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op | +| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op | + +Always benchmark with your own workload. +The result depends heavily on the data input. + +# Usage + +100% compatibility with standard lib + +Replace + +```go +import "encoding/json" +json.Marshal(&data) +``` + +with + +```go +import jsoniter "github.com/json-iterator/go" + +var json = jsoniter.ConfigCompatibleWithStandardLibrary +json.Marshal(&data) +``` + +Replace + +```go +import "encoding/json" +json.Unmarshal(input, &data) +``` + +with + +```go +import jsoniter "github.com/json-iterator/go" + +var json = jsoniter.ConfigCompatibleWithStandardLibrary +json.Unmarshal(input, &data) +``` + +[More documentation](http://jsoniter.com/migrate-from-go-std.html) + +# How to get + +``` +go get github.com/json-iterator/go +``` + +# Contribution Welcomed ! + +Contributors + +- [thockin](https://github.com/thockin) +- [mattn](https://github.com/mattn) +- [cch123](https://github.com/cch123) +- [Oleg Shaldybin](https://github.com/olegshaldybin) +- [Jason Toffaletti](https://github.com/toffaletti) + +Report issue or pull request, or email taowen@gmail.com, or [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) diff --git a/integration-test/vendor/github.com/json-iterator/go/adapter.go b/integration-test/vendor/github.com/json-iterator/go/adapter.go new file mode 100644 index 000000000..92d2cc4a3 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/adapter.go @@ -0,0 +1,150 @@ +package jsoniter + +import ( + "bytes" + "io" +) + +// RawMessage to make replace json with jsoniter +type RawMessage []byte + +// Unmarshal adapts to json/encoding Unmarshal API +// +// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. +// Refer to https://godoc.org/encoding/json#Unmarshal for more information +func Unmarshal(data []byte, v interface{}) error { + return ConfigDefault.Unmarshal(data, v) +} + +// UnmarshalFromString is a convenient method to read from string instead of []byte +func UnmarshalFromString(str string, v interface{}) error { + return ConfigDefault.UnmarshalFromString(str, v) +} + +// Get quick method to get value from deeply nested JSON structure +func Get(data []byte, path ...interface{}) Any { + return ConfigDefault.Get(data, path...) +} + +// Marshal adapts to json/encoding Marshal API +// +// Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API +// Refer to https://godoc.org/encoding/json#Marshal for more information +func Marshal(v interface{}) ([]byte, error) { + return ConfigDefault.Marshal(v) +} + +// MarshalIndent same as json.MarshalIndent. Prefix is not supported. +func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { + return ConfigDefault.MarshalIndent(v, prefix, indent) +} + +// MarshalToString convenient method to write as string instead of []byte +func MarshalToString(v interface{}) (string, error) { + return ConfigDefault.MarshalToString(v) +} + +// NewDecoder adapts to json/stream NewDecoder API. +// +// NewDecoder returns a new decoder that reads from r. +// +// Instead of a json/encoding Decoder, an Decoder is returned +// Refer to https://godoc.org/encoding/json#NewDecoder for more information +func NewDecoder(reader io.Reader) *Decoder { + return ConfigDefault.NewDecoder(reader) +} + +// Decoder reads and decodes JSON values from an input stream. +// Decoder provides identical APIs with json/stream Decoder (Token() and UseNumber() are in progress) +type Decoder struct { + iter *Iterator +} + +// Decode decode JSON into interface{} +func (adapter *Decoder) Decode(obj interface{}) error { + if adapter.iter.head == adapter.iter.tail && adapter.iter.reader != nil { + if !adapter.iter.loadMore() { + return io.EOF + } + } + adapter.iter.ReadVal(obj) + err := adapter.iter.Error + if err == io.EOF { + return nil + } + return adapter.iter.Error +} + +// More is there more? +func (adapter *Decoder) More() bool { + iter := adapter.iter + if iter.Error != nil { + return false + } + c := iter.nextToken() + if c == 0 { + return false + } + iter.unreadByte() + return c != ']' && c != '}' +} + +// Buffered remaining buffer +func (adapter *Decoder) Buffered() io.Reader { + remaining := adapter.iter.buf[adapter.iter.head:adapter.iter.tail] + return bytes.NewReader(remaining) +} + +// UseNumber causes the Decoder to unmarshal a number into an interface{} as a +// Number instead of as a float64. +func (adapter *Decoder) UseNumber() { + cfg := adapter.iter.cfg.configBeforeFrozen + cfg.UseNumber = true + adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions) +} + +// DisallowUnknownFields causes the Decoder to return an error when the destination +// is a struct and the input contains object keys which do not match any +// non-ignored, exported fields in the destination. +func (adapter *Decoder) DisallowUnknownFields() { + cfg := adapter.iter.cfg.configBeforeFrozen + cfg.DisallowUnknownFields = true + adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions) +} + +// NewEncoder same as json.NewEncoder +func NewEncoder(writer io.Writer) *Encoder { + return ConfigDefault.NewEncoder(writer) +} + +// Encoder same as json.Encoder +type Encoder struct { + stream *Stream +} + +// Encode encode interface{} as JSON to io.Writer +func (adapter *Encoder) Encode(val interface{}) error { + adapter.stream.WriteVal(val) + adapter.stream.WriteRaw("\n") + adapter.stream.Flush() + return adapter.stream.Error +} + +// SetIndent set the indention. Prefix is not supported +func (adapter *Encoder) SetIndent(prefix, indent string) { + config := adapter.stream.cfg.configBeforeFrozen + config.IndentionStep = len(indent) + adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions) +} + +// SetEscapeHTML escape html by default, set to false to disable +func (adapter *Encoder) SetEscapeHTML(escapeHTML bool) { + config := adapter.stream.cfg.configBeforeFrozen + config.EscapeHTML = escapeHTML + adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions) +} + +// Valid reports whether data is a valid JSON encoding. +func Valid(data []byte) bool { + return ConfigDefault.Valid(data) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any.go b/integration-test/vendor/github.com/json-iterator/go/any.go new file mode 100644 index 000000000..f6b8aeab0 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any.go @@ -0,0 +1,325 @@ +package jsoniter + +import ( + "errors" + "fmt" + "github.com/modern-go/reflect2" + "io" + "reflect" + "strconv" + "unsafe" +) + +// Any generic object representation. +// The lazy json implementation holds []byte and parse lazily. +type Any interface { + LastError() error + ValueType() ValueType + MustBeValid() Any + ToBool() bool + ToInt() int + ToInt32() int32 + ToInt64() int64 + ToUint() uint + ToUint32() uint32 + ToUint64() uint64 + ToFloat32() float32 + ToFloat64() float64 + ToString() string + ToVal(val interface{}) + Get(path ...interface{}) Any + Size() int + Keys() []string + GetInterface() interface{} + WriteTo(stream *Stream) +} + +type baseAny struct{} + +func (any *baseAny) Get(path ...interface{}) Any { + return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} +} + +func (any *baseAny) Size() int { + return 0 +} + +func (any *baseAny) Keys() []string { + return []string{} +} + +func (any *baseAny) ToVal(obj interface{}) { + panic("not implemented") +} + +// WrapInt32 turn int32 into Any interface +func WrapInt32(val int32) Any { + return &int32Any{baseAny{}, val} +} + +// WrapInt64 turn int64 into Any interface +func WrapInt64(val int64) Any { + return &int64Any{baseAny{}, val} +} + +// WrapUint32 turn uint32 into Any interface +func WrapUint32(val uint32) Any { + return &uint32Any{baseAny{}, val} +} + +// WrapUint64 turn uint64 into Any interface +func WrapUint64(val uint64) Any { + return &uint64Any{baseAny{}, val} +} + +// WrapFloat64 turn float64 into Any interface +func WrapFloat64(val float64) Any { + return &floatAny{baseAny{}, val} +} + +// WrapString turn string into Any interface +func WrapString(val string) Any { + return &stringAny{baseAny{}, val} +} + +// Wrap turn a go object into Any interface +func Wrap(val interface{}) Any { + if val == nil { + return &nilAny{} + } + asAny, isAny := val.(Any) + if isAny { + return asAny + } + typ := reflect2.TypeOf(val) + switch typ.Kind() { + case reflect.Slice: + return wrapArray(val) + case reflect.Struct: + return wrapStruct(val) + case reflect.Map: + return wrapMap(val) + case reflect.String: + return WrapString(val.(string)) + case reflect.Int: + if strconv.IntSize == 32 { + return WrapInt32(int32(val.(int))) + } + return WrapInt64(int64(val.(int))) + case reflect.Int8: + return WrapInt32(int32(val.(int8))) + case reflect.Int16: + return WrapInt32(int32(val.(int16))) + case reflect.Int32: + return WrapInt32(val.(int32)) + case reflect.Int64: + return WrapInt64(val.(int64)) + case reflect.Uint: + if strconv.IntSize == 32 { + return WrapUint32(uint32(val.(uint))) + } + return WrapUint64(uint64(val.(uint))) + case reflect.Uintptr: + if ptrSize == 32 { + return WrapUint32(uint32(val.(uintptr))) + } + return WrapUint64(uint64(val.(uintptr))) + case reflect.Uint8: + return WrapUint32(uint32(val.(uint8))) + case reflect.Uint16: + return WrapUint32(uint32(val.(uint16))) + case reflect.Uint32: + return WrapUint32(uint32(val.(uint32))) + case reflect.Uint64: + return WrapUint64(val.(uint64)) + case reflect.Float32: + return WrapFloat64(float64(val.(float32))) + case reflect.Float64: + return WrapFloat64(val.(float64)) + case reflect.Bool: + if val.(bool) == true { + return &trueAny{} + } + return &falseAny{} + } + return &invalidAny{baseAny{}, fmt.Errorf("unsupported type: %v", typ)} +} + +// ReadAny read next JSON element as an Any object. It is a better json.RawMessage. +func (iter *Iterator) ReadAny() Any { + return iter.readAny() +} + +func (iter *Iterator) readAny() Any { + c := iter.nextToken() + switch c { + case '"': + iter.unreadByte() + return &stringAny{baseAny{}, iter.ReadString()} + case 'n': + iter.skipThreeBytes('u', 'l', 'l') // null + return &nilAny{} + case 't': + iter.skipThreeBytes('r', 'u', 'e') // true + return &trueAny{} + case 'f': + iter.skipFourBytes('a', 'l', 's', 'e') // false + return &falseAny{} + case '{': + return iter.readObjectAny() + case '[': + return iter.readArrayAny() + case '-': + return iter.readNumberAny(false) + case 0: + return &invalidAny{baseAny{}, errors.New("input is empty")} + default: + return iter.readNumberAny(true) + } +} + +func (iter *Iterator) readNumberAny(positive bool) Any { + iter.startCapture(iter.head - 1) + iter.skipNumber() + lazyBuf := iter.stopCapture() + return &numberLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} +} + +func (iter *Iterator) readObjectAny() Any { + iter.startCapture(iter.head - 1) + iter.skipObject() + lazyBuf := iter.stopCapture() + return &objectLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} +} + +func (iter *Iterator) readArrayAny() Any { + iter.startCapture(iter.head - 1) + iter.skipArray() + lazyBuf := iter.stopCapture() + return &arrayLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} +} + +func locateObjectField(iter *Iterator, target string) []byte { + var found []byte + iter.ReadObjectCB(func(iter *Iterator, field string) bool { + if field == target { + found = iter.SkipAndReturnBytes() + return false + } + iter.Skip() + return true + }) + return found +} + +func locateArrayElement(iter *Iterator, target int) []byte { + var found []byte + n := 0 + iter.ReadArrayCB(func(iter *Iterator) bool { + if n == target { + found = iter.SkipAndReturnBytes() + return false + } + iter.Skip() + n++ + return true + }) + return found +} + +func locatePath(iter *Iterator, path []interface{}) Any { + for i, pathKeyObj := range path { + switch pathKey := pathKeyObj.(type) { + case string: + valueBytes := locateObjectField(iter, pathKey) + if valueBytes == nil { + return newInvalidAny(path[i:]) + } + iter.ResetBytes(valueBytes) + case int: + valueBytes := locateArrayElement(iter, pathKey) + if valueBytes == nil { + return newInvalidAny(path[i:]) + } + iter.ResetBytes(valueBytes) + case int32: + if '*' == pathKey { + return iter.readAny().Get(path[i:]...) + } + return newInvalidAny(path[i:]) + default: + return newInvalidAny(path[i:]) + } + } + if iter.Error != nil && iter.Error != io.EOF { + return &invalidAny{baseAny{}, iter.Error} + } + return iter.readAny() +} + +var anyType = reflect2.TypeOfPtr((*Any)(nil)).Elem() + +func createDecoderOfAny(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ == anyType { + return &directAnyCodec{} + } + if typ.Implements(anyType) { + return &anyCodec{ + valType: typ, + } + } + return nil +} + +func createEncoderOfAny(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == anyType { + return &directAnyCodec{} + } + if typ.Implements(anyType) { + return &anyCodec{ + valType: typ, + } + } + return nil +} + +type anyCodec struct { + valType reflect2.Type +} + +func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + panic("not implemented") +} + +func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := codec.valType.UnsafeIndirect(ptr) + any := obj.(Any) + any.WriteTo(stream) +} + +func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool { + obj := codec.valType.UnsafeIndirect(ptr) + any := obj.(Any) + return any.Size() == 0 +} + +type directAnyCodec struct { +} + +func (codec *directAnyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *(*Any)(ptr) = iter.readAny() +} + +func (codec *directAnyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + any := *(*Any)(ptr) + if any == nil { + stream.WriteNil() + return + } + any.WriteTo(stream) +} + +func (codec *directAnyCodec) IsEmpty(ptr unsafe.Pointer) bool { + any := *(*Any)(ptr) + return any.Size() == 0 +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_array.go b/integration-test/vendor/github.com/json-iterator/go/any_array.go new file mode 100644 index 000000000..0449e9aa4 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_array.go @@ -0,0 +1,278 @@ +package jsoniter + +import ( + "reflect" + "unsafe" +) + +type arrayLazyAny struct { + baseAny + cfg *frozenConfig + buf []byte + err error +} + +func (any *arrayLazyAny) ValueType() ValueType { + return ArrayValue +} + +func (any *arrayLazyAny) MustBeValid() Any { + return any +} + +func (any *arrayLazyAny) LastError() error { + return any.err +} + +func (any *arrayLazyAny) ToBool() bool { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + return iter.ReadArray() +} + +func (any *arrayLazyAny) ToInt() int { + if any.ToBool() { + return 1 + } + return 0 +} + +func (any *arrayLazyAny) ToInt32() int32 { + if any.ToBool() { + return 1 + } + return 0 +} + +func (any *arrayLazyAny) ToInt64() int64 { + if any.ToBool() { + return 1 + } + return 0 +} + +func (any *arrayLazyAny) ToUint() uint { + if any.ToBool() { + return 1 + } + return 0 +} + +func (any *arrayLazyAny) ToUint32() uint32 { + if any.ToBool() { + return 1 + } + return 0 +} + +func (any *arrayLazyAny) ToUint64() uint64 { + if any.ToBool() { + return 1 + } + return 0 +} + +func (any *arrayLazyAny) ToFloat32() float32 { + if any.ToBool() { + return 1 + } + return 0 +} + +func (any *arrayLazyAny) ToFloat64() float64 { + if any.ToBool() { + return 1 + } + return 0 +} + +func (any *arrayLazyAny) ToString() string { + return *(*string)(unsafe.Pointer(&any.buf)) +} + +func (any *arrayLazyAny) ToVal(val interface{}) { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + iter.ReadVal(val) +} + +func (any *arrayLazyAny) Get(path ...interface{}) Any { + if len(path) == 0 { + return any + } + switch firstPath := path[0].(type) { + case int: + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + valueBytes := locateArrayElement(iter, firstPath) + if valueBytes == nil { + return newInvalidAny(path) + } + iter.ResetBytes(valueBytes) + return locatePath(iter, path[1:]) + case int32: + if '*' == firstPath { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + arr := make([]Any, 0) + iter.ReadArrayCB(func(iter *Iterator) bool { + found := iter.readAny().Get(path[1:]...) + if found.ValueType() != InvalidValue { + arr = append(arr, found) + } + return true + }) + return wrapArray(arr) + } + return newInvalidAny(path) + default: + return newInvalidAny(path) + } +} + +func (any *arrayLazyAny) Size() int { + size := 0 + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + iter.ReadArrayCB(func(iter *Iterator) bool { + size++ + iter.Skip() + return true + }) + return size +} + +func (any *arrayLazyAny) WriteTo(stream *Stream) { + stream.Write(any.buf) +} + +func (any *arrayLazyAny) GetInterface() interface{} { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + return iter.Read() +} + +type arrayAny struct { + baseAny + val reflect.Value +} + +func wrapArray(val interface{}) *arrayAny { + return &arrayAny{baseAny{}, reflect.ValueOf(val)} +} + +func (any *arrayAny) ValueType() ValueType { + return ArrayValue +} + +func (any *arrayAny) MustBeValid() Any { + return any +} + +func (any *arrayAny) LastError() error { + return nil +} + +func (any *arrayAny) ToBool() bool { + return any.val.Len() != 0 +} + +func (any *arrayAny) ToInt() int { + if any.val.Len() == 0 { + return 0 + } + return 1 +} + +func (any *arrayAny) ToInt32() int32 { + if any.val.Len() == 0 { + return 0 + } + return 1 +} + +func (any *arrayAny) ToInt64() int64 { + if any.val.Len() == 0 { + return 0 + } + return 1 +} + +func (any *arrayAny) ToUint() uint { + if any.val.Len() == 0 { + return 0 + } + return 1 +} + +func (any *arrayAny) ToUint32() uint32 { + if any.val.Len() == 0 { + return 0 + } + return 1 +} + +func (any *arrayAny) ToUint64() uint64 { + if any.val.Len() == 0 { + return 0 + } + return 1 +} + +func (any *arrayAny) ToFloat32() float32 { + if any.val.Len() == 0 { + return 0 + } + return 1 +} + +func (any *arrayAny) ToFloat64() float64 { + if any.val.Len() == 0 { + return 0 + } + return 1 +} + +func (any *arrayAny) ToString() string { + str, _ := MarshalToString(any.val.Interface()) + return str +} + +func (any *arrayAny) Get(path ...interface{}) Any { + if len(path) == 0 { + return any + } + switch firstPath := path[0].(type) { + case int: + if firstPath < 0 || firstPath >= any.val.Len() { + return newInvalidAny(path) + } + return Wrap(any.val.Index(firstPath).Interface()) + case int32: + if '*' == firstPath { + mappedAll := make([]Any, 0) + for i := 0; i < any.val.Len(); i++ { + mapped := Wrap(any.val.Index(i).Interface()).Get(path[1:]...) + if mapped.ValueType() != InvalidValue { + mappedAll = append(mappedAll, mapped) + } + } + return wrapArray(mappedAll) + } + return newInvalidAny(path) + default: + return newInvalidAny(path) + } +} + +func (any *arrayAny) Size() int { + return any.val.Len() +} + +func (any *arrayAny) WriteTo(stream *Stream) { + stream.WriteVal(any.val) +} + +func (any *arrayAny) GetInterface() interface{} { + return any.val.Interface() +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_bool.go b/integration-test/vendor/github.com/json-iterator/go/any_bool.go new file mode 100644 index 000000000..9452324af --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_bool.go @@ -0,0 +1,137 @@ +package jsoniter + +type trueAny struct { + baseAny +} + +func (any *trueAny) LastError() error { + return nil +} + +func (any *trueAny) ToBool() bool { + return true +} + +func (any *trueAny) ToInt() int { + return 1 +} + +func (any *trueAny) ToInt32() int32 { + return 1 +} + +func (any *trueAny) ToInt64() int64 { + return 1 +} + +func (any *trueAny) ToUint() uint { + return 1 +} + +func (any *trueAny) ToUint32() uint32 { + return 1 +} + +func (any *trueAny) ToUint64() uint64 { + return 1 +} + +func (any *trueAny) ToFloat32() float32 { + return 1 +} + +func (any *trueAny) ToFloat64() float64 { + return 1 +} + +func (any *trueAny) ToString() string { + return "true" +} + +func (any *trueAny) WriteTo(stream *Stream) { + stream.WriteTrue() +} + +func (any *trueAny) Parse() *Iterator { + return nil +} + +func (any *trueAny) GetInterface() interface{} { + return true +} + +func (any *trueAny) ValueType() ValueType { + return BoolValue +} + +func (any *trueAny) MustBeValid() Any { + return any +} + +type falseAny struct { + baseAny +} + +func (any *falseAny) LastError() error { + return nil +} + +func (any *falseAny) ToBool() bool { + return false +} + +func (any *falseAny) ToInt() int { + return 0 +} + +func (any *falseAny) ToInt32() int32 { + return 0 +} + +func (any *falseAny) ToInt64() int64 { + return 0 +} + +func (any *falseAny) ToUint() uint { + return 0 +} + +func (any *falseAny) ToUint32() uint32 { + return 0 +} + +func (any *falseAny) ToUint64() uint64 { + return 0 +} + +func (any *falseAny) ToFloat32() float32 { + return 0 +} + +func (any *falseAny) ToFloat64() float64 { + return 0 +} + +func (any *falseAny) ToString() string { + return "false" +} + +func (any *falseAny) WriteTo(stream *Stream) { + stream.WriteFalse() +} + +func (any *falseAny) Parse() *Iterator { + return nil +} + +func (any *falseAny) GetInterface() interface{} { + return false +} + +func (any *falseAny) ValueType() ValueType { + return BoolValue +} + +func (any *falseAny) MustBeValid() Any { + return any +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_float.go b/integration-test/vendor/github.com/json-iterator/go/any_float.go new file mode 100644 index 000000000..35fdb0949 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_float.go @@ -0,0 +1,83 @@ +package jsoniter + +import ( + "strconv" +) + +type floatAny struct { + baseAny + val float64 +} + +func (any *floatAny) Parse() *Iterator { + return nil +} + +func (any *floatAny) ValueType() ValueType { + return NumberValue +} + +func (any *floatAny) MustBeValid() Any { + return any +} + +func (any *floatAny) LastError() error { + return nil +} + +func (any *floatAny) ToBool() bool { + return any.ToFloat64() != 0 +} + +func (any *floatAny) ToInt() int { + return int(any.val) +} + +func (any *floatAny) ToInt32() int32 { + return int32(any.val) +} + +func (any *floatAny) ToInt64() int64 { + return int64(any.val) +} + +func (any *floatAny) ToUint() uint { + if any.val > 0 { + return uint(any.val) + } + return 0 +} + +func (any *floatAny) ToUint32() uint32 { + if any.val > 0 { + return uint32(any.val) + } + return 0 +} + +func (any *floatAny) ToUint64() uint64 { + if any.val > 0 { + return uint64(any.val) + } + return 0 +} + +func (any *floatAny) ToFloat32() float32 { + return float32(any.val) +} + +func (any *floatAny) ToFloat64() float64 { + return any.val +} + +func (any *floatAny) ToString() string { + return strconv.FormatFloat(any.val, 'E', -1, 64) +} + +func (any *floatAny) WriteTo(stream *Stream) { + stream.WriteFloat64(any.val) +} + +func (any *floatAny) GetInterface() interface{} { + return any.val +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_int32.go b/integration-test/vendor/github.com/json-iterator/go/any_int32.go new file mode 100644 index 000000000..1b56f3991 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_int32.go @@ -0,0 +1,74 @@ +package jsoniter + +import ( + "strconv" +) + +type int32Any struct { + baseAny + val int32 +} + +func (any *int32Any) LastError() error { + return nil +} + +func (any *int32Any) ValueType() ValueType { + return NumberValue +} + +func (any *int32Any) MustBeValid() Any { + return any +} + +func (any *int32Any) ToBool() bool { + return any.val != 0 +} + +func (any *int32Any) ToInt() int { + return int(any.val) +} + +func (any *int32Any) ToInt32() int32 { + return any.val +} + +func (any *int32Any) ToInt64() int64 { + return int64(any.val) +} + +func (any *int32Any) ToUint() uint { + return uint(any.val) +} + +func (any *int32Any) ToUint32() uint32 { + return uint32(any.val) +} + +func (any *int32Any) ToUint64() uint64 { + return uint64(any.val) +} + +func (any *int32Any) ToFloat32() float32 { + return float32(any.val) +} + +func (any *int32Any) ToFloat64() float64 { + return float64(any.val) +} + +func (any *int32Any) ToString() string { + return strconv.FormatInt(int64(any.val), 10) +} + +func (any *int32Any) WriteTo(stream *Stream) { + stream.WriteInt32(any.val) +} + +func (any *int32Any) Parse() *Iterator { + return nil +} + +func (any *int32Any) GetInterface() interface{} { + return any.val +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_int64.go b/integration-test/vendor/github.com/json-iterator/go/any_int64.go new file mode 100644 index 000000000..c440d72b6 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_int64.go @@ -0,0 +1,74 @@ +package jsoniter + +import ( + "strconv" +) + +type int64Any struct { + baseAny + val int64 +} + +func (any *int64Any) LastError() error { + return nil +} + +func (any *int64Any) ValueType() ValueType { + return NumberValue +} + +func (any *int64Any) MustBeValid() Any { + return any +} + +func (any *int64Any) ToBool() bool { + return any.val != 0 +} + +func (any *int64Any) ToInt() int { + return int(any.val) +} + +func (any *int64Any) ToInt32() int32 { + return int32(any.val) +} + +func (any *int64Any) ToInt64() int64 { + return any.val +} + +func (any *int64Any) ToUint() uint { + return uint(any.val) +} + +func (any *int64Any) ToUint32() uint32 { + return uint32(any.val) +} + +func (any *int64Any) ToUint64() uint64 { + return uint64(any.val) +} + +func (any *int64Any) ToFloat32() float32 { + return float32(any.val) +} + +func (any *int64Any) ToFloat64() float64 { + return float64(any.val) +} + +func (any *int64Any) ToString() string { + return strconv.FormatInt(any.val, 10) +} + +func (any *int64Any) WriteTo(stream *Stream) { + stream.WriteInt64(any.val) +} + +func (any *int64Any) Parse() *Iterator { + return nil +} + +func (any *int64Any) GetInterface() interface{} { + return any.val +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_invalid.go b/integration-test/vendor/github.com/json-iterator/go/any_invalid.go new file mode 100644 index 000000000..1d859eac3 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_invalid.go @@ -0,0 +1,82 @@ +package jsoniter + +import "fmt" + +type invalidAny struct { + baseAny + err error +} + +func newInvalidAny(path []interface{}) *invalidAny { + return &invalidAny{baseAny{}, fmt.Errorf("%v not found", path)} +} + +func (any *invalidAny) LastError() error { + return any.err +} + +func (any *invalidAny) ValueType() ValueType { + return InvalidValue +} + +func (any *invalidAny) MustBeValid() Any { + panic(any.err) +} + +func (any *invalidAny) ToBool() bool { + return false +} + +func (any *invalidAny) ToInt() int { + return 0 +} + +func (any *invalidAny) ToInt32() int32 { + return 0 +} + +func (any *invalidAny) ToInt64() int64 { + return 0 +} + +func (any *invalidAny) ToUint() uint { + return 0 +} + +func (any *invalidAny) ToUint32() uint32 { + return 0 +} + +func (any *invalidAny) ToUint64() uint64 { + return 0 +} + +func (any *invalidAny) ToFloat32() float32 { + return 0 +} + +func (any *invalidAny) ToFloat64() float64 { + return 0 +} + +func (any *invalidAny) ToString() string { + return "" +} + +func (any *invalidAny) WriteTo(stream *Stream) { +} + +func (any *invalidAny) Get(path ...interface{}) Any { + if any.err == nil { + return &invalidAny{baseAny{}, fmt.Errorf("get %v from invalid", path)} + } + return &invalidAny{baseAny{}, fmt.Errorf("%v, get %v from invalid", any.err, path)} +} + +func (any *invalidAny) Parse() *Iterator { + return nil +} + +func (any *invalidAny) GetInterface() interface{} { + return nil +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_nil.go b/integration-test/vendor/github.com/json-iterator/go/any_nil.go new file mode 100644 index 000000000..d04cb54c1 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_nil.go @@ -0,0 +1,69 @@ +package jsoniter + +type nilAny struct { + baseAny +} + +func (any *nilAny) LastError() error { + return nil +} + +func (any *nilAny) ValueType() ValueType { + return NilValue +} + +func (any *nilAny) MustBeValid() Any { + return any +} + +func (any *nilAny) ToBool() bool { + return false +} + +func (any *nilAny) ToInt() int { + return 0 +} + +func (any *nilAny) ToInt32() int32 { + return 0 +} + +func (any *nilAny) ToInt64() int64 { + return 0 +} + +func (any *nilAny) ToUint() uint { + return 0 +} + +func (any *nilAny) ToUint32() uint32 { + return 0 +} + +func (any *nilAny) ToUint64() uint64 { + return 0 +} + +func (any *nilAny) ToFloat32() float32 { + return 0 +} + +func (any *nilAny) ToFloat64() float64 { + return 0 +} + +func (any *nilAny) ToString() string { + return "" +} + +func (any *nilAny) WriteTo(stream *Stream) { + stream.WriteNil() +} + +func (any *nilAny) Parse() *Iterator { + return nil +} + +func (any *nilAny) GetInterface() interface{} { + return nil +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_number.go b/integration-test/vendor/github.com/json-iterator/go/any_number.go new file mode 100644 index 000000000..9d1e901a6 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_number.go @@ -0,0 +1,123 @@ +package jsoniter + +import ( + "io" + "unsafe" +) + +type numberLazyAny struct { + baseAny + cfg *frozenConfig + buf []byte + err error +} + +func (any *numberLazyAny) ValueType() ValueType { + return NumberValue +} + +func (any *numberLazyAny) MustBeValid() Any { + return any +} + +func (any *numberLazyAny) LastError() error { + return any.err +} + +func (any *numberLazyAny) ToBool() bool { + return any.ToFloat64() != 0 +} + +func (any *numberLazyAny) ToInt() int { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + val := iter.ReadInt() + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } + return val +} + +func (any *numberLazyAny) ToInt32() int32 { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + val := iter.ReadInt32() + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } + return val +} + +func (any *numberLazyAny) ToInt64() int64 { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + val := iter.ReadInt64() + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } + return val +} + +func (any *numberLazyAny) ToUint() uint { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + val := iter.ReadUint() + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } + return val +} + +func (any *numberLazyAny) ToUint32() uint32 { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + val := iter.ReadUint32() + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } + return val +} + +func (any *numberLazyAny) ToUint64() uint64 { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + val := iter.ReadUint64() + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } + return val +} + +func (any *numberLazyAny) ToFloat32() float32 { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + val := iter.ReadFloat32() + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } + return val +} + +func (any *numberLazyAny) ToFloat64() float64 { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + val := iter.ReadFloat64() + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } + return val +} + +func (any *numberLazyAny) ToString() string { + return *(*string)(unsafe.Pointer(&any.buf)) +} + +func (any *numberLazyAny) WriteTo(stream *Stream) { + stream.Write(any.buf) +} + +func (any *numberLazyAny) GetInterface() interface{} { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + return iter.Read() +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_object.go b/integration-test/vendor/github.com/json-iterator/go/any_object.go new file mode 100644 index 000000000..c44ef5c98 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_object.go @@ -0,0 +1,374 @@ +package jsoniter + +import ( + "reflect" + "unsafe" +) + +type objectLazyAny struct { + baseAny + cfg *frozenConfig + buf []byte + err error +} + +func (any *objectLazyAny) ValueType() ValueType { + return ObjectValue +} + +func (any *objectLazyAny) MustBeValid() Any { + return any +} + +func (any *objectLazyAny) LastError() error { + return any.err +} + +func (any *objectLazyAny) ToBool() bool { + return true +} + +func (any *objectLazyAny) ToInt() int { + return 0 +} + +func (any *objectLazyAny) ToInt32() int32 { + return 0 +} + +func (any *objectLazyAny) ToInt64() int64 { + return 0 +} + +func (any *objectLazyAny) ToUint() uint { + return 0 +} + +func (any *objectLazyAny) ToUint32() uint32 { + return 0 +} + +func (any *objectLazyAny) ToUint64() uint64 { + return 0 +} + +func (any *objectLazyAny) ToFloat32() float32 { + return 0 +} + +func (any *objectLazyAny) ToFloat64() float64 { + return 0 +} + +func (any *objectLazyAny) ToString() string { + return *(*string)(unsafe.Pointer(&any.buf)) +} + +func (any *objectLazyAny) ToVal(obj interface{}) { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + iter.ReadVal(obj) +} + +func (any *objectLazyAny) Get(path ...interface{}) Any { + if len(path) == 0 { + return any + } + switch firstPath := path[0].(type) { + case string: + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + valueBytes := locateObjectField(iter, firstPath) + if valueBytes == nil { + return newInvalidAny(path) + } + iter.ResetBytes(valueBytes) + return locatePath(iter, path[1:]) + case int32: + if '*' == firstPath { + mappedAll := map[string]Any{} + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + iter.ReadMapCB(func(iter *Iterator, field string) bool { + mapped := locatePath(iter, path[1:]) + if mapped.ValueType() != InvalidValue { + mappedAll[field] = mapped + } + return true + }) + return wrapMap(mappedAll) + } + return newInvalidAny(path) + default: + return newInvalidAny(path) + } +} + +func (any *objectLazyAny) Keys() []string { + keys := []string{} + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + iter.ReadMapCB(func(iter *Iterator, field string) bool { + iter.Skip() + keys = append(keys, field) + return true + }) + return keys +} + +func (any *objectLazyAny) Size() int { + size := 0 + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + iter.ReadObjectCB(func(iter *Iterator, field string) bool { + iter.Skip() + size++ + return true + }) + return size +} + +func (any *objectLazyAny) WriteTo(stream *Stream) { + stream.Write(any.buf) +} + +func (any *objectLazyAny) GetInterface() interface{} { + iter := any.cfg.BorrowIterator(any.buf) + defer any.cfg.ReturnIterator(iter) + return iter.Read() +} + +type objectAny struct { + baseAny + err error + val reflect.Value +} + +func wrapStruct(val interface{}) *objectAny { + return &objectAny{baseAny{}, nil, reflect.ValueOf(val)} +} + +func (any *objectAny) ValueType() ValueType { + return ObjectValue +} + +func (any *objectAny) MustBeValid() Any { + return any +} + +func (any *objectAny) Parse() *Iterator { + return nil +} + +func (any *objectAny) LastError() error { + return any.err +} + +func (any *objectAny) ToBool() bool { + return any.val.NumField() != 0 +} + +func (any *objectAny) ToInt() int { + return 0 +} + +func (any *objectAny) ToInt32() int32 { + return 0 +} + +func (any *objectAny) ToInt64() int64 { + return 0 +} + +func (any *objectAny) ToUint() uint { + return 0 +} + +func (any *objectAny) ToUint32() uint32 { + return 0 +} + +func (any *objectAny) ToUint64() uint64 { + return 0 +} + +func (any *objectAny) ToFloat32() float32 { + return 0 +} + +func (any *objectAny) ToFloat64() float64 { + return 0 +} + +func (any *objectAny) ToString() string { + str, err := MarshalToString(any.val.Interface()) + any.err = err + return str +} + +func (any *objectAny) Get(path ...interface{}) Any { + if len(path) == 0 { + return any + } + switch firstPath := path[0].(type) { + case string: + field := any.val.FieldByName(firstPath) + if !field.IsValid() { + return newInvalidAny(path) + } + return Wrap(field.Interface()) + case int32: + if '*' == firstPath { + mappedAll := map[string]Any{} + for i := 0; i < any.val.NumField(); i++ { + field := any.val.Field(i) + if field.CanInterface() { + mapped := Wrap(field.Interface()).Get(path[1:]...) + if mapped.ValueType() != InvalidValue { + mappedAll[any.val.Type().Field(i).Name] = mapped + } + } + } + return wrapMap(mappedAll) + } + return newInvalidAny(path) + default: + return newInvalidAny(path) + } +} + +func (any *objectAny) Keys() []string { + keys := make([]string, 0, any.val.NumField()) + for i := 0; i < any.val.NumField(); i++ { + keys = append(keys, any.val.Type().Field(i).Name) + } + return keys +} + +func (any *objectAny) Size() int { + return any.val.NumField() +} + +func (any *objectAny) WriteTo(stream *Stream) { + stream.WriteVal(any.val) +} + +func (any *objectAny) GetInterface() interface{} { + return any.val.Interface() +} + +type mapAny struct { + baseAny + err error + val reflect.Value +} + +func wrapMap(val interface{}) *mapAny { + return &mapAny{baseAny{}, nil, reflect.ValueOf(val)} +} + +func (any *mapAny) ValueType() ValueType { + return ObjectValue +} + +func (any *mapAny) MustBeValid() Any { + return any +} + +func (any *mapAny) Parse() *Iterator { + return nil +} + +func (any *mapAny) LastError() error { + return any.err +} + +func (any *mapAny) ToBool() bool { + return true +} + +func (any *mapAny) ToInt() int { + return 0 +} + +func (any *mapAny) ToInt32() int32 { + return 0 +} + +func (any *mapAny) ToInt64() int64 { + return 0 +} + +func (any *mapAny) ToUint() uint { + return 0 +} + +func (any *mapAny) ToUint32() uint32 { + return 0 +} + +func (any *mapAny) ToUint64() uint64 { + return 0 +} + +func (any *mapAny) ToFloat32() float32 { + return 0 +} + +func (any *mapAny) ToFloat64() float64 { + return 0 +} + +func (any *mapAny) ToString() string { + str, err := MarshalToString(any.val.Interface()) + any.err = err + return str +} + +func (any *mapAny) Get(path ...interface{}) Any { + if len(path) == 0 { + return any + } + switch firstPath := path[0].(type) { + case int32: + if '*' == firstPath { + mappedAll := map[string]Any{} + for _, key := range any.val.MapKeys() { + keyAsStr := key.String() + element := Wrap(any.val.MapIndex(key).Interface()) + mapped := element.Get(path[1:]...) + if mapped.ValueType() != InvalidValue { + mappedAll[keyAsStr] = mapped + } + } + return wrapMap(mappedAll) + } + return newInvalidAny(path) + default: + value := any.val.MapIndex(reflect.ValueOf(firstPath)) + if !value.IsValid() { + return newInvalidAny(path) + } + return Wrap(value.Interface()) + } +} + +func (any *mapAny) Keys() []string { + keys := make([]string, 0, any.val.Len()) + for _, key := range any.val.MapKeys() { + keys = append(keys, key.String()) + } + return keys +} + +func (any *mapAny) Size() int { + return any.val.Len() +} + +func (any *mapAny) WriteTo(stream *Stream) { + stream.WriteVal(any.val) +} + +func (any *mapAny) GetInterface() interface{} { + return any.val.Interface() +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_str.go b/integration-test/vendor/github.com/json-iterator/go/any_str.go new file mode 100644 index 000000000..1f12f6612 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_str.go @@ -0,0 +1,166 @@ +package jsoniter + +import ( + "fmt" + "strconv" +) + +type stringAny struct { + baseAny + val string +} + +func (any *stringAny) Get(path ...interface{}) Any { + if len(path) == 0 { + return any + } + return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} +} + +func (any *stringAny) Parse() *Iterator { + return nil +} + +func (any *stringAny) ValueType() ValueType { + return StringValue +} + +func (any *stringAny) MustBeValid() Any { + return any +} + +func (any *stringAny) LastError() error { + return nil +} + +func (any *stringAny) ToBool() bool { + str := any.ToString() + if str == "0" { + return false + } + for _, c := range str { + switch c { + case ' ', '\n', '\r', '\t': + default: + return true + } + } + return false +} + +func (any *stringAny) ToInt() int { + return int(any.ToInt64()) + +} + +func (any *stringAny) ToInt32() int32 { + return int32(any.ToInt64()) +} + +func (any *stringAny) ToInt64() int64 { + if any.val == "" { + return 0 + } + + flag := 1 + startPos := 0 + if any.val[0] == '+' || any.val[0] == '-' { + startPos = 1 + } + + if any.val[0] == '-' { + flag = -1 + } + + endPos := startPos + for i := startPos; i < len(any.val); i++ { + if any.val[i] >= '0' && any.val[i] <= '9' { + endPos = i + 1 + } else { + break + } + } + parsed, _ := strconv.ParseInt(any.val[startPos:endPos], 10, 64) + return int64(flag) * parsed +} + +func (any *stringAny) ToUint() uint { + return uint(any.ToUint64()) +} + +func (any *stringAny) ToUint32() uint32 { + return uint32(any.ToUint64()) +} + +func (any *stringAny) ToUint64() uint64 { + if any.val == "" { + return 0 + } + + startPos := 0 + + if any.val[0] == '-' { + return 0 + } + if any.val[0] == '+' { + startPos = 1 + } + + endPos := startPos + for i := startPos; i < len(any.val); i++ { + if any.val[i] >= '0' && any.val[i] <= '9' { + endPos = i + 1 + } else { + break + } + } + parsed, _ := strconv.ParseUint(any.val[startPos:endPos], 10, 64) + return parsed +} + +func (any *stringAny) ToFloat32() float32 { + return float32(any.ToFloat64()) +} + +func (any *stringAny) ToFloat64() float64 { + if len(any.val) == 0 { + return 0 + } + + // first char invalid + if any.val[0] != '+' && any.val[0] != '-' && (any.val[0] > '9' || any.val[0] < '0') { + return 0 + } + + // extract valid num expression from string + // eg 123true => 123, -12.12xxa => -12.12 + endPos := 1 + for i := 1; i < len(any.val); i++ { + if any.val[i] == '.' || any.val[i] == 'e' || any.val[i] == 'E' || any.val[i] == '+' || any.val[i] == '-' { + endPos = i + 1 + continue + } + + // end position is the first char which is not digit + if any.val[i] >= '0' && any.val[i] <= '9' { + endPos = i + 1 + } else { + endPos = i + break + } + } + parsed, _ := strconv.ParseFloat(any.val[:endPos], 64) + return parsed +} + +func (any *stringAny) ToString() string { + return any.val +} + +func (any *stringAny) WriteTo(stream *Stream) { + stream.WriteString(any.val) +} + +func (any *stringAny) GetInterface() interface{} { + return any.val +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_uint32.go b/integration-test/vendor/github.com/json-iterator/go/any_uint32.go new file mode 100644 index 000000000..656bbd33d --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_uint32.go @@ -0,0 +1,74 @@ +package jsoniter + +import ( + "strconv" +) + +type uint32Any struct { + baseAny + val uint32 +} + +func (any *uint32Any) LastError() error { + return nil +} + +func (any *uint32Any) ValueType() ValueType { + return NumberValue +} + +func (any *uint32Any) MustBeValid() Any { + return any +} + +func (any *uint32Any) ToBool() bool { + return any.val != 0 +} + +func (any *uint32Any) ToInt() int { + return int(any.val) +} + +func (any *uint32Any) ToInt32() int32 { + return int32(any.val) +} + +func (any *uint32Any) ToInt64() int64 { + return int64(any.val) +} + +func (any *uint32Any) ToUint() uint { + return uint(any.val) +} + +func (any *uint32Any) ToUint32() uint32 { + return any.val +} + +func (any *uint32Any) ToUint64() uint64 { + return uint64(any.val) +} + +func (any *uint32Any) ToFloat32() float32 { + return float32(any.val) +} + +func (any *uint32Any) ToFloat64() float64 { + return float64(any.val) +} + +func (any *uint32Any) ToString() string { + return strconv.FormatInt(int64(any.val), 10) +} + +func (any *uint32Any) WriteTo(stream *Stream) { + stream.WriteUint32(any.val) +} + +func (any *uint32Any) Parse() *Iterator { + return nil +} + +func (any *uint32Any) GetInterface() interface{} { + return any.val +} diff --git a/integration-test/vendor/github.com/json-iterator/go/any_uint64.go b/integration-test/vendor/github.com/json-iterator/go/any_uint64.go new file mode 100644 index 000000000..7df2fce33 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/any_uint64.go @@ -0,0 +1,74 @@ +package jsoniter + +import ( + "strconv" +) + +type uint64Any struct { + baseAny + val uint64 +} + +func (any *uint64Any) LastError() error { + return nil +} + +func (any *uint64Any) ValueType() ValueType { + return NumberValue +} + +func (any *uint64Any) MustBeValid() Any { + return any +} + +func (any *uint64Any) ToBool() bool { + return any.val != 0 +} + +func (any *uint64Any) ToInt() int { + return int(any.val) +} + +func (any *uint64Any) ToInt32() int32 { + return int32(any.val) +} + +func (any *uint64Any) ToInt64() int64 { + return int64(any.val) +} + +func (any *uint64Any) ToUint() uint { + return uint(any.val) +} + +func (any *uint64Any) ToUint32() uint32 { + return uint32(any.val) +} + +func (any *uint64Any) ToUint64() uint64 { + return any.val +} + +func (any *uint64Any) ToFloat32() float32 { + return float32(any.val) +} + +func (any *uint64Any) ToFloat64() float64 { + return float64(any.val) +} + +func (any *uint64Any) ToString() string { + return strconv.FormatUint(any.val, 10) +} + +func (any *uint64Any) WriteTo(stream *Stream) { + stream.WriteUint64(any.val) +} + +func (any *uint64Any) Parse() *Iterator { + return nil +} + +func (any *uint64Any) GetInterface() interface{} { + return any.val +} diff --git a/integration-test/vendor/github.com/json-iterator/go/build.sh b/integration-test/vendor/github.com/json-iterator/go/build.sh new file mode 100644 index 000000000..b45ef6883 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/build.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e +set -x + +if [ ! -d /tmp/build-golang/src/github.com/json-iterator ]; then + mkdir -p /tmp/build-golang/src/github.com/json-iterator + ln -s $PWD /tmp/build-golang/src/github.com/json-iterator/go +fi +export GOPATH=/tmp/build-golang +go get -u github.com/golang/dep/cmd/dep +cd /tmp/build-golang/src/github.com/json-iterator/go +exec $GOPATH/bin/dep ensure -update diff --git a/integration-test/vendor/github.com/json-iterator/go/config.go b/integration-test/vendor/github.com/json-iterator/go/config.go new file mode 100644 index 000000000..2adcdc3b7 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/config.go @@ -0,0 +1,375 @@ +package jsoniter + +import ( + "encoding/json" + "io" + "reflect" + "sync" + "unsafe" + + "github.com/modern-go/concurrent" + "github.com/modern-go/reflect2" +) + +// Config customize how the API should behave. +// The API is created from Config by Froze. +type Config struct { + IndentionStep int + MarshalFloatWith6Digits bool + EscapeHTML bool + SortMapKeys bool + UseNumber bool + DisallowUnknownFields bool + TagKey string + OnlyTaggedField bool + ValidateJsonRawMessage bool + ObjectFieldMustBeSimpleString bool + CaseSensitive bool +} + +// API the public interface of this package. +// Primary Marshal and Unmarshal. +type API interface { + IteratorPool + StreamPool + MarshalToString(v interface{}) (string, error) + Marshal(v interface{}) ([]byte, error) + MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) + UnmarshalFromString(str string, v interface{}) error + Unmarshal(data []byte, v interface{}) error + Get(data []byte, path ...interface{}) Any + NewEncoder(writer io.Writer) *Encoder + NewDecoder(reader io.Reader) *Decoder + Valid(data []byte) bool + RegisterExtension(extension Extension) + DecoderOf(typ reflect2.Type) ValDecoder + EncoderOf(typ reflect2.Type) ValEncoder +} + +// ConfigDefault the default API +var ConfigDefault = Config{ + EscapeHTML: true, +}.Froze() + +// ConfigCompatibleWithStandardLibrary tries to be 100% compatible with standard library behavior +var ConfigCompatibleWithStandardLibrary = Config{ + EscapeHTML: true, + SortMapKeys: true, + ValidateJsonRawMessage: true, +}.Froze() + +// ConfigFastest marshals float with only 6 digits precision +var ConfigFastest = Config{ + EscapeHTML: false, + MarshalFloatWith6Digits: true, // will lose precession + ObjectFieldMustBeSimpleString: true, // do not unescape object field +}.Froze() + +type frozenConfig struct { + configBeforeFrozen Config + sortMapKeys bool + indentionStep int + objectFieldMustBeSimpleString bool + onlyTaggedField bool + disallowUnknownFields bool + decoderCache *concurrent.Map + encoderCache *concurrent.Map + encoderExtension Extension + decoderExtension Extension + extraExtensions []Extension + streamPool *sync.Pool + iteratorPool *sync.Pool + caseSensitive bool +} + +func (cfg *frozenConfig) initCache() { + cfg.decoderCache = concurrent.NewMap() + cfg.encoderCache = concurrent.NewMap() +} + +func (cfg *frozenConfig) addDecoderToCache(cacheKey uintptr, decoder ValDecoder) { + cfg.decoderCache.Store(cacheKey, decoder) +} + +func (cfg *frozenConfig) addEncoderToCache(cacheKey uintptr, encoder ValEncoder) { + cfg.encoderCache.Store(cacheKey, encoder) +} + +func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder { + decoder, found := cfg.decoderCache.Load(cacheKey) + if found { + return decoder.(ValDecoder) + } + return nil +} + +func (cfg *frozenConfig) getEncoderFromCache(cacheKey uintptr) ValEncoder { + encoder, found := cfg.encoderCache.Load(cacheKey) + if found { + return encoder.(ValEncoder) + } + return nil +} + +var cfgCache = concurrent.NewMap() + +func getFrozenConfigFromCache(cfg Config) *frozenConfig { + obj, found := cfgCache.Load(cfg) + if found { + return obj.(*frozenConfig) + } + return nil +} + +func addFrozenConfigToCache(cfg Config, frozenConfig *frozenConfig) { + cfgCache.Store(cfg, frozenConfig) +} + +// Froze forge API from config +func (cfg Config) Froze() API { + api := &frozenConfig{ + sortMapKeys: cfg.SortMapKeys, + indentionStep: cfg.IndentionStep, + objectFieldMustBeSimpleString: cfg.ObjectFieldMustBeSimpleString, + onlyTaggedField: cfg.OnlyTaggedField, + disallowUnknownFields: cfg.DisallowUnknownFields, + caseSensitive: cfg.CaseSensitive, + } + api.streamPool = &sync.Pool{ + New: func() interface{} { + return NewStream(api, nil, 512) + }, + } + api.iteratorPool = &sync.Pool{ + New: func() interface{} { + return NewIterator(api) + }, + } + api.initCache() + encoderExtension := EncoderExtension{} + decoderExtension := DecoderExtension{} + if cfg.MarshalFloatWith6Digits { + api.marshalFloatWith6Digits(encoderExtension) + } + if cfg.EscapeHTML { + api.escapeHTML(encoderExtension) + } + if cfg.UseNumber { + api.useNumber(decoderExtension) + } + if cfg.ValidateJsonRawMessage { + api.validateJsonRawMessage(encoderExtension) + } + api.encoderExtension = encoderExtension + api.decoderExtension = decoderExtension + api.configBeforeFrozen = cfg + return api +} + +func (cfg Config) frozeWithCacheReuse(extraExtensions []Extension) *frozenConfig { + api := getFrozenConfigFromCache(cfg) + if api != nil { + return api + } + api = cfg.Froze().(*frozenConfig) + for _, extension := range extraExtensions { + api.RegisterExtension(extension) + } + addFrozenConfigToCache(cfg, api) + return api +} + +func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) { + encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) { + rawMessage := *(*json.RawMessage)(ptr) + iter := cfg.BorrowIterator([]byte(rawMessage)) + defer cfg.ReturnIterator(iter) + iter.Read() + if iter.Error != nil && iter.Error != io.EOF { + stream.WriteRaw("null") + } else { + stream.WriteRaw(string(rawMessage)) + } + }, func(ptr unsafe.Pointer) bool { + return len(*((*json.RawMessage)(ptr))) == 0 + }} + extension[reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()] = encoder + extension[reflect2.TypeOfPtr((*RawMessage)(nil)).Elem()] = encoder +} + +func (cfg *frozenConfig) useNumber(extension DecoderExtension) { + extension[reflect2.TypeOfPtr((*interface{})(nil)).Elem()] = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { + exitingValue := *((*interface{})(ptr)) + if exitingValue != nil && reflect.TypeOf(exitingValue).Kind() == reflect.Ptr { + iter.ReadVal(exitingValue) + return + } + if iter.WhatIsNext() == NumberValue { + *((*interface{})(ptr)) = json.Number(iter.readNumberAsString()) + } else { + *((*interface{})(ptr)) = iter.Read() + } + }} +} +func (cfg *frozenConfig) getTagKey() string { + tagKey := cfg.configBeforeFrozen.TagKey + if tagKey == "" { + return "json" + } + return tagKey +} + +func (cfg *frozenConfig) RegisterExtension(extension Extension) { + cfg.extraExtensions = append(cfg.extraExtensions, extension) + copied := cfg.configBeforeFrozen + cfg.configBeforeFrozen = copied +} + +type lossyFloat32Encoder struct { +} + +func (encoder *lossyFloat32Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteFloat32Lossy(*((*float32)(ptr))) +} + +func (encoder *lossyFloat32Encoder) IsEmpty(ptr unsafe.Pointer) bool { + return *((*float32)(ptr)) == 0 +} + +type lossyFloat64Encoder struct { +} + +func (encoder *lossyFloat64Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteFloat64Lossy(*((*float64)(ptr))) +} + +func (encoder *lossyFloat64Encoder) IsEmpty(ptr unsafe.Pointer) bool { + return *((*float64)(ptr)) == 0 +} + +// EnableLossyFloatMarshalling keeps 10**(-6) precision +// for float variables for better performance. +func (cfg *frozenConfig) marshalFloatWith6Digits(extension EncoderExtension) { + // for better performance + extension[reflect2.TypeOfPtr((*float32)(nil)).Elem()] = &lossyFloat32Encoder{} + extension[reflect2.TypeOfPtr((*float64)(nil)).Elem()] = &lossyFloat64Encoder{} +} + +type htmlEscapedStringEncoder struct { +} + +func (encoder *htmlEscapedStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + str := *((*string)(ptr)) + stream.WriteStringWithHTMLEscaped(str) +} + +func (encoder *htmlEscapedStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return *((*string)(ptr)) == "" +} + +func (cfg *frozenConfig) escapeHTML(encoderExtension EncoderExtension) { + encoderExtension[reflect2.TypeOfPtr((*string)(nil)).Elem()] = &htmlEscapedStringEncoder{} +} + +func (cfg *frozenConfig) cleanDecoders() { + typeDecoders = map[string]ValDecoder{} + fieldDecoders = map[string]ValDecoder{} + *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig)) +} + +func (cfg *frozenConfig) cleanEncoders() { + typeEncoders = map[string]ValEncoder{} + fieldEncoders = map[string]ValEncoder{} + *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig)) +} + +func (cfg *frozenConfig) MarshalToString(v interface{}) (string, error) { + stream := cfg.BorrowStream(nil) + defer cfg.ReturnStream(stream) + stream.WriteVal(v) + if stream.Error != nil { + return "", stream.Error + } + return string(stream.Buffer()), nil +} + +func (cfg *frozenConfig) Marshal(v interface{}) ([]byte, error) { + stream := cfg.BorrowStream(nil) + defer cfg.ReturnStream(stream) + stream.WriteVal(v) + if stream.Error != nil { + return nil, stream.Error + } + result := stream.Buffer() + copied := make([]byte, len(result)) + copy(copied, result) + return copied, nil +} + +func (cfg *frozenConfig) MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { + if prefix != "" { + panic("prefix is not supported") + } + for _, r := range indent { + if r != ' ' { + panic("indent can only be space") + } + } + newCfg := cfg.configBeforeFrozen + newCfg.IndentionStep = len(indent) + return newCfg.frozeWithCacheReuse(cfg.extraExtensions).Marshal(v) +} + +func (cfg *frozenConfig) UnmarshalFromString(str string, v interface{}) error { + data := []byte(str) + iter := cfg.BorrowIterator(data) + defer cfg.ReturnIterator(iter) + iter.ReadVal(v) + c := iter.nextToken() + if c == 0 { + if iter.Error == io.EOF { + return nil + } + return iter.Error + } + iter.ReportError("Unmarshal", "there are bytes left after unmarshal") + return iter.Error +} + +func (cfg *frozenConfig) Get(data []byte, path ...interface{}) Any { + iter := cfg.BorrowIterator(data) + defer cfg.ReturnIterator(iter) + return locatePath(iter, path) +} + +func (cfg *frozenConfig) Unmarshal(data []byte, v interface{}) error { + iter := cfg.BorrowIterator(data) + defer cfg.ReturnIterator(iter) + iter.ReadVal(v) + c := iter.nextToken() + if c == 0 { + if iter.Error == io.EOF { + return nil + } + return iter.Error + } + iter.ReportError("Unmarshal", "there are bytes left after unmarshal") + return iter.Error +} + +func (cfg *frozenConfig) NewEncoder(writer io.Writer) *Encoder { + stream := NewStream(cfg, writer, 512) + return &Encoder{stream} +} + +func (cfg *frozenConfig) NewDecoder(reader io.Reader) *Decoder { + iter := Parse(cfg, reader, 512) + return &Decoder{iter} +} + +func (cfg *frozenConfig) Valid(data []byte) bool { + iter := cfg.BorrowIterator(data) + defer cfg.ReturnIterator(iter) + iter.Skip() + return iter.Error == nil +} diff --git a/integration-test/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md b/integration-test/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md new file mode 100644 index 000000000..3095662b0 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md @@ -0,0 +1,7 @@ +| json type \ dest type | bool | int | uint | float |string| +| --- | --- | --- | --- |--|--| +| number | positive => true
negative => true
zero => false| 23.2 => 23
-32.1 => -32| 12.1 => 12
-12.1 => 0|as normal|same as origin| +| string | empty string => false
string "0" => false
other strings => true | "123.32" => 123
"-123.4" => -123
"123.23xxxw" => 123
"abcde12" => 0
"-32.1" => -32| 13.2 => 13
-1.1 => 0 |12.1 => 12.1
-12.3 => -12.3
12.4xxa => 12.4
+1.1e2 =>110 |same as origin| +| bool | true => true
false => false| true => 1
false => 0 | true => 1
false => 0 |true => 1
false => 0|true => "true"
false => "false"| +| object | true | 0 | 0 |0|originnal json| +| array | empty array => false
nonempty array => true| [] => 0
[1,2] => 1 | [] => 0
[1,2] => 1 |[] => 0
[1,2] => 1|original json| \ No newline at end of file diff --git a/integration-test/vendor/github.com/json-iterator/go/iter.go b/integration-test/vendor/github.com/json-iterator/go/iter.go new file mode 100644 index 000000000..29b31cf78 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter.go @@ -0,0 +1,349 @@ +package jsoniter + +import ( + "encoding/json" + "fmt" + "io" +) + +// ValueType the type for JSON element +type ValueType int + +const ( + // InvalidValue invalid JSON element + InvalidValue ValueType = iota + // StringValue JSON element "string" + StringValue + // NumberValue JSON element 100 or 0.10 + NumberValue + // NilValue JSON element null + NilValue + // BoolValue JSON element true or false + BoolValue + // ArrayValue JSON element [] + ArrayValue + // ObjectValue JSON element {} + ObjectValue +) + +var hexDigits []byte +var valueTypes []ValueType + +func init() { + hexDigits = make([]byte, 256) + for i := 0; i < len(hexDigits); i++ { + hexDigits[i] = 255 + } + for i := '0'; i <= '9'; i++ { + hexDigits[i] = byte(i - '0') + } + for i := 'a'; i <= 'f'; i++ { + hexDigits[i] = byte((i - 'a') + 10) + } + for i := 'A'; i <= 'F'; i++ { + hexDigits[i] = byte((i - 'A') + 10) + } + valueTypes = make([]ValueType, 256) + for i := 0; i < len(valueTypes); i++ { + valueTypes[i] = InvalidValue + } + valueTypes['"'] = StringValue + valueTypes['-'] = NumberValue + valueTypes['0'] = NumberValue + valueTypes['1'] = NumberValue + valueTypes['2'] = NumberValue + valueTypes['3'] = NumberValue + valueTypes['4'] = NumberValue + valueTypes['5'] = NumberValue + valueTypes['6'] = NumberValue + valueTypes['7'] = NumberValue + valueTypes['8'] = NumberValue + valueTypes['9'] = NumberValue + valueTypes['t'] = BoolValue + valueTypes['f'] = BoolValue + valueTypes['n'] = NilValue + valueTypes['['] = ArrayValue + valueTypes['{'] = ObjectValue +} + +// Iterator is a io.Reader like object, with JSON specific read functions. +// Error is not returned as return value, but stored as Error member on this iterator instance. +type Iterator struct { + cfg *frozenConfig + reader io.Reader + buf []byte + head int + tail int + depth int + captureStartedAt int + captured []byte + Error error + Attachment interface{} // open for customized decoder +} + +// NewIterator creates an empty Iterator instance +func NewIterator(cfg API) *Iterator { + return &Iterator{ + cfg: cfg.(*frozenConfig), + reader: nil, + buf: nil, + head: 0, + tail: 0, + depth: 0, + } +} + +// Parse creates an Iterator instance from io.Reader +func Parse(cfg API, reader io.Reader, bufSize int) *Iterator { + return &Iterator{ + cfg: cfg.(*frozenConfig), + reader: reader, + buf: make([]byte, bufSize), + head: 0, + tail: 0, + depth: 0, + } +} + +// ParseBytes creates an Iterator instance from byte array +func ParseBytes(cfg API, input []byte) *Iterator { + return &Iterator{ + cfg: cfg.(*frozenConfig), + reader: nil, + buf: input, + head: 0, + tail: len(input), + depth: 0, + } +} + +// ParseString creates an Iterator instance from string +func ParseString(cfg API, input string) *Iterator { + return ParseBytes(cfg, []byte(input)) +} + +// Pool returns a pool can provide more iterator with same configuration +func (iter *Iterator) Pool() IteratorPool { + return iter.cfg +} + +// Reset reuse iterator instance by specifying another reader +func (iter *Iterator) Reset(reader io.Reader) *Iterator { + iter.reader = reader + iter.head = 0 + iter.tail = 0 + iter.depth = 0 + return iter +} + +// ResetBytes reuse iterator instance by specifying another byte array as input +func (iter *Iterator) ResetBytes(input []byte) *Iterator { + iter.reader = nil + iter.buf = input + iter.head = 0 + iter.tail = len(input) + iter.depth = 0 + return iter +} + +// WhatIsNext gets ValueType of relatively next json element +func (iter *Iterator) WhatIsNext() ValueType { + valueType := valueTypes[iter.nextToken()] + iter.unreadByte() + return valueType +} + +func (iter *Iterator) skipWhitespacesWithoutLoadMore() bool { + for i := iter.head; i < iter.tail; i++ { + c := iter.buf[i] + switch c { + case ' ', '\n', '\t', '\r': + continue + } + iter.head = i + return false + } + return true +} + +func (iter *Iterator) isObjectEnd() bool { + c := iter.nextToken() + if c == ',' { + return false + } + if c == '}' { + return true + } + iter.ReportError("isObjectEnd", "object ended prematurely, unexpected char "+string([]byte{c})) + return true +} + +func (iter *Iterator) nextToken() byte { + // a variation of skip whitespaces, returning the next non-whitespace token + for { + for i := iter.head; i < iter.tail; i++ { + c := iter.buf[i] + switch c { + case ' ', '\n', '\t', '\r': + continue + } + iter.head = i + 1 + return c + } + if !iter.loadMore() { + return 0 + } + } +} + +// ReportError record a error in iterator instance with current position. +func (iter *Iterator) ReportError(operation string, msg string) { + if iter.Error != nil { + if iter.Error != io.EOF { + return + } + } + peekStart := iter.head - 10 + if peekStart < 0 { + peekStart = 0 + } + peekEnd := iter.head + 10 + if peekEnd > iter.tail { + peekEnd = iter.tail + } + parsing := string(iter.buf[peekStart:peekEnd]) + contextStart := iter.head - 50 + if contextStart < 0 { + contextStart = 0 + } + contextEnd := iter.head + 50 + if contextEnd > iter.tail { + contextEnd = iter.tail + } + context := string(iter.buf[contextStart:contextEnd]) + iter.Error = fmt.Errorf("%s: %s, error found in #%v byte of ...|%s|..., bigger context ...|%s|...", + operation, msg, iter.head-peekStart, parsing, context) +} + +// CurrentBuffer gets current buffer as string for debugging purpose +func (iter *Iterator) CurrentBuffer() string { + peekStart := iter.head - 10 + if peekStart < 0 { + peekStart = 0 + } + return fmt.Sprintf("parsing #%v byte, around ...|%s|..., whole buffer ...|%s|...", iter.head, + string(iter.buf[peekStart:iter.head]), string(iter.buf[0:iter.tail])) +} + +func (iter *Iterator) readByte() (ret byte) { + if iter.head == iter.tail { + if iter.loadMore() { + ret = iter.buf[iter.head] + iter.head++ + return ret + } + return 0 + } + ret = iter.buf[iter.head] + iter.head++ + return ret +} + +func (iter *Iterator) loadMore() bool { + if iter.reader == nil { + if iter.Error == nil { + iter.head = iter.tail + iter.Error = io.EOF + } + return false + } + if iter.captured != nil { + iter.captured = append(iter.captured, + iter.buf[iter.captureStartedAt:iter.tail]...) + iter.captureStartedAt = 0 + } + for { + n, err := iter.reader.Read(iter.buf) + if n == 0 { + if err != nil { + if iter.Error == nil { + iter.Error = err + } + return false + } + } else { + iter.head = 0 + iter.tail = n + return true + } + } +} + +func (iter *Iterator) unreadByte() { + if iter.Error != nil { + return + } + iter.head-- + return +} + +// Read read the next JSON element as generic interface{}. +func (iter *Iterator) Read() interface{} { + valueType := iter.WhatIsNext() + switch valueType { + case StringValue: + return iter.ReadString() + case NumberValue: + if iter.cfg.configBeforeFrozen.UseNumber { + return json.Number(iter.readNumberAsString()) + } + return iter.ReadFloat64() + case NilValue: + iter.skipFourBytes('n', 'u', 'l', 'l') + return nil + case BoolValue: + return iter.ReadBool() + case ArrayValue: + arr := []interface{}{} + iter.ReadArrayCB(func(iter *Iterator) bool { + var elem interface{} + iter.ReadVal(&elem) + arr = append(arr, elem) + return true + }) + return arr + case ObjectValue: + obj := map[string]interface{}{} + iter.ReadMapCB(func(Iter *Iterator, field string) bool { + var elem interface{} + iter.ReadVal(&elem) + obj[field] = elem + return true + }) + return obj + default: + iter.ReportError("Read", fmt.Sprintf("unexpected value type: %v", valueType)) + return nil + } +} + +// limit maximum depth of nesting, as allowed by https://tools.ietf.org/html/rfc7159#section-9 +const maxDepth = 10000 + +func (iter *Iterator) incrementDepth() (success bool) { + iter.depth++ + if iter.depth <= maxDepth { + return true + } + iter.ReportError("incrementDepth", "exceeded max depth") + return false +} + +func (iter *Iterator) decrementDepth() (success bool) { + iter.depth-- + if iter.depth >= 0 { + return true + } + iter.ReportError("decrementDepth", "unexpected negative nesting") + return false +} diff --git a/integration-test/vendor/github.com/json-iterator/go/iter_array.go b/integration-test/vendor/github.com/json-iterator/go/iter_array.go new file mode 100644 index 000000000..204fe0e09 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter_array.go @@ -0,0 +1,64 @@ +package jsoniter + +// ReadArray read array element, tells if the array has more element to read. +func (iter *Iterator) ReadArray() (ret bool) { + c := iter.nextToken() + switch c { + case 'n': + iter.skipThreeBytes('u', 'l', 'l') + return false // null + case '[': + c = iter.nextToken() + if c != ']' { + iter.unreadByte() + return true + } + return false + case ']': + return false + case ',': + return true + default: + iter.ReportError("ReadArray", "expect [ or , or ] or n, but found "+string([]byte{c})) + return + } +} + +// ReadArrayCB read array with callback +func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) { + c := iter.nextToken() + if c == '[' { + if !iter.incrementDepth() { + return false + } + c = iter.nextToken() + if c != ']' { + iter.unreadByte() + if !callback(iter) { + iter.decrementDepth() + return false + } + c = iter.nextToken() + for c == ',' { + if !callback(iter) { + iter.decrementDepth() + return false + } + c = iter.nextToken() + } + if c != ']' { + iter.ReportError("ReadArrayCB", "expect ] in the end, but found "+string([]byte{c})) + iter.decrementDepth() + return false + } + return iter.decrementDepth() + } + return iter.decrementDepth() + } + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + return true // null + } + iter.ReportError("ReadArrayCB", "expect [ or n, but found "+string([]byte{c})) + return false +} diff --git a/integration-test/vendor/github.com/json-iterator/go/iter_float.go b/integration-test/vendor/github.com/json-iterator/go/iter_float.go new file mode 100644 index 000000000..8a3d8b6fb --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter_float.go @@ -0,0 +1,342 @@ +package jsoniter + +import ( + "encoding/json" + "io" + "math/big" + "strconv" + "strings" + "unsafe" +) + +var floatDigits []int8 + +const invalidCharForNumber = int8(-1) +const endOfNumber = int8(-2) +const dotInNumber = int8(-3) + +func init() { + floatDigits = make([]int8, 256) + for i := 0; i < len(floatDigits); i++ { + floatDigits[i] = invalidCharForNumber + } + for i := int8('0'); i <= int8('9'); i++ { + floatDigits[i] = i - int8('0') + } + floatDigits[','] = endOfNumber + floatDigits[']'] = endOfNumber + floatDigits['}'] = endOfNumber + floatDigits[' '] = endOfNumber + floatDigits['\t'] = endOfNumber + floatDigits['\n'] = endOfNumber + floatDigits['.'] = dotInNumber +} + +// ReadBigFloat read big.Float +func (iter *Iterator) ReadBigFloat() (ret *big.Float) { + str := iter.readNumberAsString() + if iter.Error != nil && iter.Error != io.EOF { + return nil + } + prec := 64 + if len(str) > prec { + prec = len(str) + } + val, _, err := big.ParseFloat(str, 10, uint(prec), big.ToZero) + if err != nil { + iter.Error = err + return nil + } + return val +} + +// ReadBigInt read big.Int +func (iter *Iterator) ReadBigInt() (ret *big.Int) { + str := iter.readNumberAsString() + if iter.Error != nil && iter.Error != io.EOF { + return nil + } + ret = big.NewInt(0) + var success bool + ret, success = ret.SetString(str, 10) + if !success { + iter.ReportError("ReadBigInt", "invalid big int") + return nil + } + return ret +} + +//ReadFloat32 read float32 +func (iter *Iterator) ReadFloat32() (ret float32) { + c := iter.nextToken() + if c == '-' { + return -iter.readPositiveFloat32() + } + iter.unreadByte() + return iter.readPositiveFloat32() +} + +func (iter *Iterator) readPositiveFloat32() (ret float32) { + i := iter.head + // first char + if i == iter.tail { + return iter.readFloat32SlowPath() + } + c := iter.buf[i] + i++ + ind := floatDigits[c] + switch ind { + case invalidCharForNumber: + return iter.readFloat32SlowPath() + case endOfNumber: + iter.ReportError("readFloat32", "empty number") + return + case dotInNumber: + iter.ReportError("readFloat32", "leading dot is invalid") + return + case 0: + if i == iter.tail { + return iter.readFloat32SlowPath() + } + c = iter.buf[i] + switch c { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + iter.ReportError("readFloat32", "leading zero is invalid") + return + } + } + value := uint64(ind) + // chars before dot +non_decimal_loop: + for ; i < iter.tail; i++ { + c = iter.buf[i] + ind := floatDigits[c] + switch ind { + case invalidCharForNumber: + return iter.readFloat32SlowPath() + case endOfNumber: + iter.head = i + return float32(value) + case dotInNumber: + break non_decimal_loop + } + if value > uint64SafeToMultiple10 { + return iter.readFloat32SlowPath() + } + value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind; + } + // chars after dot + if c == '.' { + i++ + decimalPlaces := 0 + if i == iter.tail { + return iter.readFloat32SlowPath() + } + for ; i < iter.tail; i++ { + c = iter.buf[i] + ind := floatDigits[c] + switch ind { + case endOfNumber: + if decimalPlaces > 0 && decimalPlaces < len(pow10) { + iter.head = i + return float32(float64(value) / float64(pow10[decimalPlaces])) + } + // too many decimal places + return iter.readFloat32SlowPath() + case invalidCharForNumber, dotInNumber: + return iter.readFloat32SlowPath() + } + decimalPlaces++ + if value > uint64SafeToMultiple10 { + return iter.readFloat32SlowPath() + } + value = (value << 3) + (value << 1) + uint64(ind) + } + } + return iter.readFloat32SlowPath() +} + +func (iter *Iterator) readNumberAsString() (ret string) { + strBuf := [16]byte{} + str := strBuf[0:0] +load_loop: + for { + for i := iter.head; i < iter.tail; i++ { + c := iter.buf[i] + switch c { + case '+', '-', '.', 'e', 'E', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + str = append(str, c) + continue + default: + iter.head = i + break load_loop + } + } + if !iter.loadMore() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF { + return + } + if len(str) == 0 { + iter.ReportError("readNumberAsString", "invalid number") + } + return *(*string)(unsafe.Pointer(&str)) +} + +func (iter *Iterator) readFloat32SlowPath() (ret float32) { + str := iter.readNumberAsString() + if iter.Error != nil && iter.Error != io.EOF { + return + } + errMsg := validateFloat(str) + if errMsg != "" { + iter.ReportError("readFloat32SlowPath", errMsg) + return + } + val, err := strconv.ParseFloat(str, 32) + if err != nil { + iter.Error = err + return + } + return float32(val) +} + +// ReadFloat64 read float64 +func (iter *Iterator) ReadFloat64() (ret float64) { + c := iter.nextToken() + if c == '-' { + return -iter.readPositiveFloat64() + } + iter.unreadByte() + return iter.readPositiveFloat64() +} + +func (iter *Iterator) readPositiveFloat64() (ret float64) { + i := iter.head + // first char + if i == iter.tail { + return iter.readFloat64SlowPath() + } + c := iter.buf[i] + i++ + ind := floatDigits[c] + switch ind { + case invalidCharForNumber: + return iter.readFloat64SlowPath() + case endOfNumber: + iter.ReportError("readFloat64", "empty number") + return + case dotInNumber: + iter.ReportError("readFloat64", "leading dot is invalid") + return + case 0: + if i == iter.tail { + return iter.readFloat64SlowPath() + } + c = iter.buf[i] + switch c { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + iter.ReportError("readFloat64", "leading zero is invalid") + return + } + } + value := uint64(ind) + // chars before dot +non_decimal_loop: + for ; i < iter.tail; i++ { + c = iter.buf[i] + ind := floatDigits[c] + switch ind { + case invalidCharForNumber: + return iter.readFloat64SlowPath() + case endOfNumber: + iter.head = i + return float64(value) + case dotInNumber: + break non_decimal_loop + } + if value > uint64SafeToMultiple10 { + return iter.readFloat64SlowPath() + } + value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind; + } + // chars after dot + if c == '.' { + i++ + decimalPlaces := 0 + if i == iter.tail { + return iter.readFloat64SlowPath() + } + for ; i < iter.tail; i++ { + c = iter.buf[i] + ind := floatDigits[c] + switch ind { + case endOfNumber: + if decimalPlaces > 0 && decimalPlaces < len(pow10) { + iter.head = i + return float64(value) / float64(pow10[decimalPlaces]) + } + // too many decimal places + return iter.readFloat64SlowPath() + case invalidCharForNumber, dotInNumber: + return iter.readFloat64SlowPath() + } + decimalPlaces++ + if value > uint64SafeToMultiple10 { + return iter.readFloat64SlowPath() + } + value = (value << 3) + (value << 1) + uint64(ind) + if value > maxFloat64 { + return iter.readFloat64SlowPath() + } + } + } + return iter.readFloat64SlowPath() +} + +func (iter *Iterator) readFloat64SlowPath() (ret float64) { + str := iter.readNumberAsString() + if iter.Error != nil && iter.Error != io.EOF { + return + } + errMsg := validateFloat(str) + if errMsg != "" { + iter.ReportError("readFloat64SlowPath", errMsg) + return + } + val, err := strconv.ParseFloat(str, 64) + if err != nil { + iter.Error = err + return + } + return val +} + +func validateFloat(str string) string { + // strconv.ParseFloat is not validating `1.` or `1.e1` + if len(str) == 0 { + return "empty number" + } + if str[0] == '-' { + return "-- is not valid" + } + dotPos := strings.IndexByte(str, '.') + if dotPos != -1 { + if dotPos == len(str)-1 { + return "dot can not be last character" + } + switch str[dotPos+1] { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + default: + return "missing digit after dot" + } + } + return "" +} + +// ReadNumber read json.Number +func (iter *Iterator) ReadNumber() (ret json.Number) { + return json.Number(iter.readNumberAsString()) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/iter_int.go b/integration-test/vendor/github.com/json-iterator/go/iter_int.go new file mode 100644 index 000000000..d786a89fe --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter_int.go @@ -0,0 +1,346 @@ +package jsoniter + +import ( + "math" + "strconv" +) + +var intDigits []int8 + +const uint32SafeToMultiply10 = uint32(0xffffffff)/10 - 1 +const uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1 +const maxFloat64 = 1<<53 - 1 + +func init() { + intDigits = make([]int8, 256) + for i := 0; i < len(intDigits); i++ { + intDigits[i] = invalidCharForNumber + } + for i := int8('0'); i <= int8('9'); i++ { + intDigits[i] = i - int8('0') + } +} + +// ReadUint read uint +func (iter *Iterator) ReadUint() uint { + if strconv.IntSize == 32 { + return uint(iter.ReadUint32()) + } + return uint(iter.ReadUint64()) +} + +// ReadInt read int +func (iter *Iterator) ReadInt() int { + if strconv.IntSize == 32 { + return int(iter.ReadInt32()) + } + return int(iter.ReadInt64()) +} + +// ReadInt8 read int8 +func (iter *Iterator) ReadInt8() (ret int8) { + c := iter.nextToken() + if c == '-' { + val := iter.readUint32(iter.readByte()) + if val > math.MaxInt8+1 { + iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10)) + return + } + return -int8(val) + } + val := iter.readUint32(c) + if val > math.MaxInt8 { + iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10)) + return + } + return int8(val) +} + +// ReadUint8 read uint8 +func (iter *Iterator) ReadUint8() (ret uint8) { + val := iter.readUint32(iter.nextToken()) + if val > math.MaxUint8 { + iter.ReportError("ReadUint8", "overflow: "+strconv.FormatInt(int64(val), 10)) + return + } + return uint8(val) +} + +// ReadInt16 read int16 +func (iter *Iterator) ReadInt16() (ret int16) { + c := iter.nextToken() + if c == '-' { + val := iter.readUint32(iter.readByte()) + if val > math.MaxInt16+1 { + iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10)) + return + } + return -int16(val) + } + val := iter.readUint32(c) + if val > math.MaxInt16 { + iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10)) + return + } + return int16(val) +} + +// ReadUint16 read uint16 +func (iter *Iterator) ReadUint16() (ret uint16) { + val := iter.readUint32(iter.nextToken()) + if val > math.MaxUint16 { + iter.ReportError("ReadUint16", "overflow: "+strconv.FormatInt(int64(val), 10)) + return + } + return uint16(val) +} + +// ReadInt32 read int32 +func (iter *Iterator) ReadInt32() (ret int32) { + c := iter.nextToken() + if c == '-' { + val := iter.readUint32(iter.readByte()) + if val > math.MaxInt32+1 { + iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10)) + return + } + return -int32(val) + } + val := iter.readUint32(c) + if val > math.MaxInt32 { + iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10)) + return + } + return int32(val) +} + +// ReadUint32 read uint32 +func (iter *Iterator) ReadUint32() (ret uint32) { + return iter.readUint32(iter.nextToken()) +} + +func (iter *Iterator) readUint32(c byte) (ret uint32) { + ind := intDigits[c] + if ind == 0 { + iter.assertInteger() + return 0 // single zero + } + if ind == invalidCharForNumber { + iter.ReportError("readUint32", "unexpected character: "+string([]byte{byte(ind)})) + return + } + value := uint32(ind) + if iter.tail-iter.head > 10 { + i := iter.head + ind2 := intDigits[iter.buf[i]] + if ind2 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value + } + i++ + ind3 := intDigits[iter.buf[i]] + if ind3 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*10 + uint32(ind2) + } + //iter.head = i + 1 + //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) + i++ + ind4 := intDigits[iter.buf[i]] + if ind4 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*100 + uint32(ind2)*10 + uint32(ind3) + } + i++ + ind5 := intDigits[iter.buf[i]] + if ind5 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*1000 + uint32(ind2)*100 + uint32(ind3)*10 + uint32(ind4) + } + i++ + ind6 := intDigits[iter.buf[i]] + if ind6 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*10000 + uint32(ind2)*1000 + uint32(ind3)*100 + uint32(ind4)*10 + uint32(ind5) + } + i++ + ind7 := intDigits[iter.buf[i]] + if ind7 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*100000 + uint32(ind2)*10000 + uint32(ind3)*1000 + uint32(ind4)*100 + uint32(ind5)*10 + uint32(ind6) + } + i++ + ind8 := intDigits[iter.buf[i]] + if ind8 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*1000000 + uint32(ind2)*100000 + uint32(ind3)*10000 + uint32(ind4)*1000 + uint32(ind5)*100 + uint32(ind6)*10 + uint32(ind7) + } + i++ + ind9 := intDigits[iter.buf[i]] + value = value*10000000 + uint32(ind2)*1000000 + uint32(ind3)*100000 + uint32(ind4)*10000 + uint32(ind5)*1000 + uint32(ind6)*100 + uint32(ind7)*10 + uint32(ind8) + iter.head = i + if ind9 == invalidCharForNumber { + iter.assertInteger() + return value + } + } + for { + for i := iter.head; i < iter.tail; i++ { + ind = intDigits[iter.buf[i]] + if ind == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value + } + if value > uint32SafeToMultiply10 { + value2 := (value << 3) + (value << 1) + uint32(ind) + if value2 < value { + iter.ReportError("readUint32", "overflow") + return + } + value = value2 + continue + } + value = (value << 3) + (value << 1) + uint32(ind) + } + if !iter.loadMore() { + iter.assertInteger() + return value + } + } +} + +// ReadInt64 read int64 +func (iter *Iterator) ReadInt64() (ret int64) { + c := iter.nextToken() + if c == '-' { + val := iter.readUint64(iter.readByte()) + if val > math.MaxInt64+1 { + iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10)) + return + } + return -int64(val) + } + val := iter.readUint64(c) + if val > math.MaxInt64 { + iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10)) + return + } + return int64(val) +} + +// ReadUint64 read uint64 +func (iter *Iterator) ReadUint64() uint64 { + return iter.readUint64(iter.nextToken()) +} + +func (iter *Iterator) readUint64(c byte) (ret uint64) { + ind := intDigits[c] + if ind == 0 { + iter.assertInteger() + return 0 // single zero + } + if ind == invalidCharForNumber { + iter.ReportError("readUint64", "unexpected character: "+string([]byte{byte(ind)})) + return + } + value := uint64(ind) + if iter.tail-iter.head > 10 { + i := iter.head + ind2 := intDigits[iter.buf[i]] + if ind2 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value + } + i++ + ind3 := intDigits[iter.buf[i]] + if ind3 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*10 + uint64(ind2) + } + //iter.head = i + 1 + //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) + i++ + ind4 := intDigits[iter.buf[i]] + if ind4 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*100 + uint64(ind2)*10 + uint64(ind3) + } + i++ + ind5 := intDigits[iter.buf[i]] + if ind5 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*1000 + uint64(ind2)*100 + uint64(ind3)*10 + uint64(ind4) + } + i++ + ind6 := intDigits[iter.buf[i]] + if ind6 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*10000 + uint64(ind2)*1000 + uint64(ind3)*100 + uint64(ind4)*10 + uint64(ind5) + } + i++ + ind7 := intDigits[iter.buf[i]] + if ind7 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*100000 + uint64(ind2)*10000 + uint64(ind3)*1000 + uint64(ind4)*100 + uint64(ind5)*10 + uint64(ind6) + } + i++ + ind8 := intDigits[iter.buf[i]] + if ind8 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*1000000 + uint64(ind2)*100000 + uint64(ind3)*10000 + uint64(ind4)*1000 + uint64(ind5)*100 + uint64(ind6)*10 + uint64(ind7) + } + i++ + ind9 := intDigits[iter.buf[i]] + value = value*10000000 + uint64(ind2)*1000000 + uint64(ind3)*100000 + uint64(ind4)*10000 + uint64(ind5)*1000 + uint64(ind6)*100 + uint64(ind7)*10 + uint64(ind8) + iter.head = i + if ind9 == invalidCharForNumber { + iter.assertInteger() + return value + } + } + for { + for i := iter.head; i < iter.tail; i++ { + ind = intDigits[iter.buf[i]] + if ind == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value + } + if value > uint64SafeToMultiple10 { + value2 := (value << 3) + (value << 1) + uint64(ind) + if value2 < value { + iter.ReportError("readUint64", "overflow") + return + } + value = value2 + continue + } + value = (value << 3) + (value << 1) + uint64(ind) + } + if !iter.loadMore() { + iter.assertInteger() + return value + } + } +} + +func (iter *Iterator) assertInteger() { + if iter.head < iter.tail && iter.buf[iter.head] == '.' { + iter.ReportError("assertInteger", "can not decode float as int") + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/iter_object.go b/integration-test/vendor/github.com/json-iterator/go/iter_object.go new file mode 100644 index 000000000..58ee89c84 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter_object.go @@ -0,0 +1,267 @@ +package jsoniter + +import ( + "fmt" + "strings" +) + +// ReadObject read one field from object. +// If object ended, returns empty string. +// Otherwise, returns the field name. +func (iter *Iterator) ReadObject() (ret string) { + c := iter.nextToken() + switch c { + case 'n': + iter.skipThreeBytes('u', 'l', 'l') + return "" // null + case '{': + c = iter.nextToken() + if c == '"' { + iter.unreadByte() + field := iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) + } + return field + } + if c == '}' { + return "" // end of object + } + iter.ReportError("ReadObject", `expect " after {, but found `+string([]byte{c})) + return + case ',': + field := iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) + } + return field + case '}': + return "" // end of object + default: + iter.ReportError("ReadObject", fmt.Sprintf(`expect { or , or } or n, but found %s`, string([]byte{c}))) + return + } +} + +// CaseInsensitive +func (iter *Iterator) readFieldHash() int64 { + hash := int64(0x811c9dc5) + c := iter.nextToken() + if c != '"' { + iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c})) + return 0 + } + for { + for i := iter.head; i < iter.tail; i++ { + // require ascii string and no escape + b := iter.buf[i] + if b == '\\' { + iter.head = i + for _, b := range iter.readStringSlowPath() { + if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { + b += 'a' - 'A' + } + hash ^= int64(b) + hash *= 0x1000193 + } + c = iter.nextToken() + if c != ':' { + iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) + return 0 + } + return hash + } + if b == '"' { + iter.head = i + 1 + c = iter.nextToken() + if c != ':' { + iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) + return 0 + } + return hash + } + if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { + b += 'a' - 'A' + } + hash ^= int64(b) + hash *= 0x1000193 + } + if !iter.loadMore() { + iter.ReportError("readFieldHash", `incomplete field name`) + return 0 + } + } +} + +func calcHash(str string, caseSensitive bool) int64 { + if !caseSensitive { + str = strings.ToLower(str) + } + hash := int64(0x811c9dc5) + for _, b := range []byte(str) { + hash ^= int64(b) + hash *= 0x1000193 + } + return int64(hash) +} + +// ReadObjectCB read object with callback, the key is ascii only and field name not copied +func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool { + c := iter.nextToken() + var field string + if c == '{' { + if !iter.incrementDepth() { + return false + } + c = iter.nextToken() + if c == '"' { + iter.unreadByte() + field = iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) + } + if !callback(iter, field) { + iter.decrementDepth() + return false + } + c = iter.nextToken() + for c == ',' { + field = iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) + } + if !callback(iter, field) { + iter.decrementDepth() + return false + } + c = iter.nextToken() + } + if c != '}' { + iter.ReportError("ReadObjectCB", `object not ended with }`) + iter.decrementDepth() + return false + } + return iter.decrementDepth() + } + if c == '}' { + return iter.decrementDepth() + } + iter.ReportError("ReadObjectCB", `expect " after {, but found `+string([]byte{c})) + iter.decrementDepth() + return false + } + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + return true // null + } + iter.ReportError("ReadObjectCB", `expect { or n, but found `+string([]byte{c})) + return false +} + +// ReadMapCB read map with callback, the key can be any string +func (iter *Iterator) ReadMapCB(callback func(*Iterator, string) bool) bool { + c := iter.nextToken() + if c == '{' { + if !iter.incrementDepth() { + return false + } + c = iter.nextToken() + if c == '"' { + iter.unreadByte() + field := iter.ReadString() + if iter.nextToken() != ':' { + iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) + iter.decrementDepth() + return false + } + if !callback(iter, field) { + iter.decrementDepth() + return false + } + c = iter.nextToken() + for c == ',' { + field = iter.ReadString() + if iter.nextToken() != ':' { + iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) + iter.decrementDepth() + return false + } + if !callback(iter, field) { + iter.decrementDepth() + return false + } + c = iter.nextToken() + } + if c != '}' { + iter.ReportError("ReadMapCB", `object not ended with }`) + iter.decrementDepth() + return false + } + return iter.decrementDepth() + } + if c == '}' { + return iter.decrementDepth() + } + iter.ReportError("ReadMapCB", `expect " after {, but found `+string([]byte{c})) + iter.decrementDepth() + return false + } + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + return true // null + } + iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) + return false +} + +func (iter *Iterator) readObjectStart() bool { + c := iter.nextToken() + if c == '{' { + c = iter.nextToken() + if c == '}' { + return false + } + iter.unreadByte() + return true + } else if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + return false + } + iter.ReportError("readObjectStart", "expect { or n, but found "+string([]byte{c})) + return false +} + +func (iter *Iterator) readObjectFieldAsBytes() (ret []byte) { + str := iter.ReadStringAsSlice() + if iter.skipWhitespacesWithoutLoadMore() { + if ret == nil { + ret = make([]byte, len(str)) + copy(ret, str) + } + if !iter.loadMore() { + return + } + } + if iter.buf[iter.head] != ':' { + iter.ReportError("readObjectFieldAsBytes", "expect : after object field, but found "+string([]byte{iter.buf[iter.head]})) + return + } + iter.head++ + if iter.skipWhitespacesWithoutLoadMore() { + if ret == nil { + ret = make([]byte, len(str)) + copy(ret, str) + } + if !iter.loadMore() { + return + } + } + if ret == nil { + return str + } + return ret +} diff --git a/integration-test/vendor/github.com/json-iterator/go/iter_skip.go b/integration-test/vendor/github.com/json-iterator/go/iter_skip.go new file mode 100644 index 000000000..e91eefb15 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter_skip.go @@ -0,0 +1,130 @@ +package jsoniter + +import "fmt" + +// ReadNil reads a json object as nil and +// returns whether it's a nil or not +func (iter *Iterator) ReadNil() (ret bool) { + c := iter.nextToken() + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') // null + return true + } + iter.unreadByte() + return false +} + +// ReadBool reads a json object as BoolValue +func (iter *Iterator) ReadBool() (ret bool) { + c := iter.nextToken() + if c == 't' { + iter.skipThreeBytes('r', 'u', 'e') + return true + } + if c == 'f' { + iter.skipFourBytes('a', 'l', 's', 'e') + return false + } + iter.ReportError("ReadBool", "expect t or f, but found "+string([]byte{c})) + return +} + +// SkipAndReturnBytes skip next JSON element, and return its content as []byte. +// The []byte can be kept, it is a copy of data. +func (iter *Iterator) SkipAndReturnBytes() []byte { + iter.startCapture(iter.head) + iter.Skip() + return iter.stopCapture() +} + +// SkipAndAppendBytes skips next JSON element and appends its content to +// buffer, returning the result. +func (iter *Iterator) SkipAndAppendBytes(buf []byte) []byte { + iter.startCaptureTo(buf, iter.head) + iter.Skip() + return iter.stopCapture() +} + +func (iter *Iterator) startCaptureTo(buf []byte, captureStartedAt int) { + if iter.captured != nil { + panic("already in capture mode") + } + iter.captureStartedAt = captureStartedAt + iter.captured = buf +} + +func (iter *Iterator) startCapture(captureStartedAt int) { + iter.startCaptureTo(make([]byte, 0, 32), captureStartedAt) +} + +func (iter *Iterator) stopCapture() []byte { + if iter.captured == nil { + panic("not in capture mode") + } + captured := iter.captured + remaining := iter.buf[iter.captureStartedAt:iter.head] + iter.captureStartedAt = -1 + iter.captured = nil + return append(captured, remaining...) +} + +// Skip skips a json object and positions to relatively the next json object +func (iter *Iterator) Skip() { + c := iter.nextToken() + switch c { + case '"': + iter.skipString() + case 'n': + iter.skipThreeBytes('u', 'l', 'l') // null + case 't': + iter.skipThreeBytes('r', 'u', 'e') // true + case 'f': + iter.skipFourBytes('a', 'l', 's', 'e') // false + case '0': + iter.unreadByte() + iter.ReadFloat32() + case '-', '1', '2', '3', '4', '5', '6', '7', '8', '9': + iter.skipNumber() + case '[': + iter.skipArray() + case '{': + iter.skipObject() + default: + iter.ReportError("Skip", fmt.Sprintf("do not know how to skip: %v", c)) + return + } +} + +func (iter *Iterator) skipFourBytes(b1, b2, b3, b4 byte) { + if iter.readByte() != b1 { + iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) + return + } + if iter.readByte() != b2 { + iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) + return + } + if iter.readByte() != b3 { + iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) + return + } + if iter.readByte() != b4 { + iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) + return + } +} + +func (iter *Iterator) skipThreeBytes(b1, b2, b3 byte) { + if iter.readByte() != b1 { + iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) + return + } + if iter.readByte() != b2 { + iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) + return + } + if iter.readByte() != b3 { + iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) + return + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/iter_skip_sloppy.go b/integration-test/vendor/github.com/json-iterator/go/iter_skip_sloppy.go new file mode 100644 index 000000000..9303de41e --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter_skip_sloppy.go @@ -0,0 +1,163 @@ +//+build jsoniter_sloppy + +package jsoniter + +// sloppy but faster implementation, do not validate the input json + +func (iter *Iterator) skipNumber() { + for { + for i := iter.head; i < iter.tail; i++ { + c := iter.buf[i] + switch c { + case ' ', '\n', '\r', '\t', ',', '}', ']': + iter.head = i + return + } + } + if !iter.loadMore() { + return + } + } +} + +func (iter *Iterator) skipArray() { + level := 1 + if !iter.incrementDepth() { + return + } + for { + for i := iter.head; i < iter.tail; i++ { + switch iter.buf[i] { + case '"': // If inside string, skip it + iter.head = i + 1 + iter.skipString() + i = iter.head - 1 // it will be i++ soon + case '[': // If open symbol, increase level + level++ + if !iter.incrementDepth() { + return + } + case ']': // If close symbol, increase level + level-- + if !iter.decrementDepth() { + return + } + + // If we have returned to the original level, we're done + if level == 0 { + iter.head = i + 1 + return + } + } + } + if !iter.loadMore() { + iter.ReportError("skipObject", "incomplete array") + return + } + } +} + +func (iter *Iterator) skipObject() { + level := 1 + if !iter.incrementDepth() { + return + } + + for { + for i := iter.head; i < iter.tail; i++ { + switch iter.buf[i] { + case '"': // If inside string, skip it + iter.head = i + 1 + iter.skipString() + i = iter.head - 1 // it will be i++ soon + case '{': // If open symbol, increase level + level++ + if !iter.incrementDepth() { + return + } + case '}': // If close symbol, increase level + level-- + if !iter.decrementDepth() { + return + } + + // If we have returned to the original level, we're done + if level == 0 { + iter.head = i + 1 + return + } + } + } + if !iter.loadMore() { + iter.ReportError("skipObject", "incomplete object") + return + } + } +} + +func (iter *Iterator) skipString() { + for { + end, escaped := iter.findStringEnd() + if end == -1 { + if !iter.loadMore() { + iter.ReportError("skipString", "incomplete string") + return + } + if escaped { + iter.head = 1 // skip the first char as last char read is \ + } + } else { + iter.head = end + return + } + } +} + +// adapted from: https://github.com/buger/jsonparser/blob/master/parser.go +// Tries to find the end of string +// Support if string contains escaped quote symbols. +func (iter *Iterator) findStringEnd() (int, bool) { + escaped := false + for i := iter.head; i < iter.tail; i++ { + c := iter.buf[i] + if c == '"' { + if !escaped { + return i + 1, false + } + j := i - 1 + for { + if j < iter.head || iter.buf[j] != '\\' { + // even number of backslashes + // either end of buffer, or " found + return i + 1, true + } + j-- + if j < iter.head || iter.buf[j] != '\\' { + // odd number of backslashes + // it is \" or \\\" + break + } + j-- + } + } else if c == '\\' { + escaped = true + } + } + j := iter.tail - 1 + for { + if j < iter.head || iter.buf[j] != '\\' { + // even number of backslashes + // either end of buffer, or " found + return -1, false // do not end with \ + } + j-- + if j < iter.head || iter.buf[j] != '\\' { + // odd number of backslashes + // it is \" or \\\" + break + } + j-- + + } + return -1, true // end with \ +} diff --git a/integration-test/vendor/github.com/json-iterator/go/iter_skip_strict.go b/integration-test/vendor/github.com/json-iterator/go/iter_skip_strict.go new file mode 100644 index 000000000..6cf66d043 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter_skip_strict.go @@ -0,0 +1,99 @@ +//+build !jsoniter_sloppy + +package jsoniter + +import ( + "fmt" + "io" +) + +func (iter *Iterator) skipNumber() { + if !iter.trySkipNumber() { + iter.unreadByte() + if iter.Error != nil && iter.Error != io.EOF { + return + } + iter.ReadFloat64() + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = nil + iter.ReadBigFloat() + } + } +} + +func (iter *Iterator) trySkipNumber() bool { + dotFound := false + for i := iter.head; i < iter.tail; i++ { + c := iter.buf[i] + switch c { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + case '.': + if dotFound { + iter.ReportError("validateNumber", `more than one dot found in number`) + return true // already failed + } + if i+1 == iter.tail { + return false + } + c = iter.buf[i+1] + switch c { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + default: + iter.ReportError("validateNumber", `missing digit after dot`) + return true // already failed + } + dotFound = true + default: + switch c { + case ',', ']', '}', ' ', '\t', '\n', '\r': + if iter.head == i { + return false // if - without following digits + } + iter.head = i + return true // must be valid + } + return false // may be invalid + } + } + return false +} + +func (iter *Iterator) skipString() { + if !iter.trySkipString() { + iter.unreadByte() + iter.ReadString() + } +} + +func (iter *Iterator) trySkipString() bool { + for i := iter.head; i < iter.tail; i++ { + c := iter.buf[i] + if c == '"' { + iter.head = i + 1 + return true // valid + } else if c == '\\' { + return false + } else if c < ' ' { + iter.ReportError("trySkipString", + fmt.Sprintf(`invalid control character found: %d`, c)) + return true // already failed + } + } + return false +} + +func (iter *Iterator) skipObject() { + iter.unreadByte() + iter.ReadObjectCB(func(iter *Iterator, field string) bool { + iter.Skip() + return true + }) +} + +func (iter *Iterator) skipArray() { + iter.unreadByte() + iter.ReadArrayCB(func(iter *Iterator) bool { + iter.Skip() + return true + }) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/iter_str.go b/integration-test/vendor/github.com/json-iterator/go/iter_str.go new file mode 100644 index 000000000..adc487ea8 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/iter_str.go @@ -0,0 +1,215 @@ +package jsoniter + +import ( + "fmt" + "unicode/utf16" +) + +// ReadString read string from iterator +func (iter *Iterator) ReadString() (ret string) { + c := iter.nextToken() + if c == '"' { + for i := iter.head; i < iter.tail; i++ { + c := iter.buf[i] + if c == '"' { + ret = string(iter.buf[iter.head:i]) + iter.head = i + 1 + return ret + } else if c == '\\' { + break + } else if c < ' ' { + iter.ReportError("ReadString", + fmt.Sprintf(`invalid control character found: %d`, c)) + return + } + } + return iter.readStringSlowPath() + } else if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + return "" + } + iter.ReportError("ReadString", `expects " or n, but found `+string([]byte{c})) + return +} + +func (iter *Iterator) readStringSlowPath() (ret string) { + var str []byte + var c byte + for iter.Error == nil { + c = iter.readByte() + if c == '"' { + return string(str) + } + if c == '\\' { + c = iter.readByte() + str = iter.readEscapedChar(c, str) + } else { + str = append(str, c) + } + } + iter.ReportError("readStringSlowPath", "unexpected end of input") + return +} + +func (iter *Iterator) readEscapedChar(c byte, str []byte) []byte { + switch c { + case 'u': + r := iter.readU4() + if utf16.IsSurrogate(r) { + c = iter.readByte() + if iter.Error != nil { + return nil + } + if c != '\\' { + iter.unreadByte() + str = appendRune(str, r) + return str + } + c = iter.readByte() + if iter.Error != nil { + return nil + } + if c != 'u' { + str = appendRune(str, r) + return iter.readEscapedChar(c, str) + } + r2 := iter.readU4() + if iter.Error != nil { + return nil + } + combined := utf16.DecodeRune(r, r2) + if combined == '\uFFFD' { + str = appendRune(str, r) + str = appendRune(str, r2) + } else { + str = appendRune(str, combined) + } + } else { + str = appendRune(str, r) + } + case '"': + str = append(str, '"') + case '\\': + str = append(str, '\\') + case '/': + str = append(str, '/') + case 'b': + str = append(str, '\b') + case 'f': + str = append(str, '\f') + case 'n': + str = append(str, '\n') + case 'r': + str = append(str, '\r') + case 't': + str = append(str, '\t') + default: + iter.ReportError("readEscapedChar", + `invalid escape char after \`) + return nil + } + return str +} + +// ReadStringAsSlice read string from iterator without copying into string form. +// The []byte can not be kept, as it will change after next iterator call. +func (iter *Iterator) ReadStringAsSlice() (ret []byte) { + c := iter.nextToken() + if c == '"' { + for i := iter.head; i < iter.tail; i++ { + // require ascii string and no escape + // for: field name, base64, number + if iter.buf[i] == '"' { + // fast path: reuse the underlying buffer + ret = iter.buf[iter.head:i] + iter.head = i + 1 + return ret + } + } + readLen := iter.tail - iter.head + copied := make([]byte, readLen, readLen*2) + copy(copied, iter.buf[iter.head:iter.tail]) + iter.head = iter.tail + for iter.Error == nil { + c := iter.readByte() + if c == '"' { + return copied + } + copied = append(copied, c) + } + return copied + } + iter.ReportError("ReadStringAsSlice", `expects " or n, but found `+string([]byte{c})) + return +} + +func (iter *Iterator) readU4() (ret rune) { + for i := 0; i < 4; i++ { + c := iter.readByte() + if iter.Error != nil { + return + } + if c >= '0' && c <= '9' { + ret = ret*16 + rune(c-'0') + } else if c >= 'a' && c <= 'f' { + ret = ret*16 + rune(c-'a'+10) + } else if c >= 'A' && c <= 'F' { + ret = ret*16 + rune(c-'A'+10) + } else { + iter.ReportError("readU4", "expects 0~9 or a~f, but found "+string([]byte{c})) + return + } + } + return ret +} + +const ( + t1 = 0x00 // 0000 0000 + tx = 0x80 // 1000 0000 + t2 = 0xC0 // 1100 0000 + t3 = 0xE0 // 1110 0000 + t4 = 0xF0 // 1111 0000 + t5 = 0xF8 // 1111 1000 + + maskx = 0x3F // 0011 1111 + mask2 = 0x1F // 0001 1111 + mask3 = 0x0F // 0000 1111 + mask4 = 0x07 // 0000 0111 + + rune1Max = 1<<7 - 1 + rune2Max = 1<<11 - 1 + rune3Max = 1<<16 - 1 + + surrogateMin = 0xD800 + surrogateMax = 0xDFFF + + maxRune = '\U0010FFFF' // Maximum valid Unicode code point. + runeError = '\uFFFD' // the "error" Rune or "Unicode replacement character" +) + +func appendRune(p []byte, r rune) []byte { + // Negative values are erroneous. Making it unsigned addresses the problem. + switch i := uint32(r); { + case i <= rune1Max: + p = append(p, byte(r)) + return p + case i <= rune2Max: + p = append(p, t2|byte(r>>6)) + p = append(p, tx|byte(r)&maskx) + return p + case i > maxRune, surrogateMin <= i && i <= surrogateMax: + r = runeError + fallthrough + case i <= rune3Max: + p = append(p, t3|byte(r>>12)) + p = append(p, tx|byte(r>>6)&maskx) + p = append(p, tx|byte(r)&maskx) + return p + default: + p = append(p, t4|byte(r>>18)) + p = append(p, tx|byte(r>>12)&maskx) + p = append(p, tx|byte(r>>6)&maskx) + p = append(p, tx|byte(r)&maskx) + return p + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/jsoniter.go b/integration-test/vendor/github.com/json-iterator/go/jsoniter.go new file mode 100644 index 000000000..c2934f916 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/jsoniter.go @@ -0,0 +1,18 @@ +// Package jsoniter implements encoding and decoding of JSON as defined in +// RFC 4627 and provides interfaces with identical syntax of standard lib encoding/json. +// Converting from encoding/json to jsoniter is no more than replacing the package with jsoniter +// and variable type declarations (if any). +// jsoniter interfaces gives 100% compatibility with code using standard lib. +// +// "JSON and Go" +// (https://golang.org/doc/articles/json_and_go.html) +// gives a description of how Marshal/Unmarshal operate +// between arbitrary or predefined json objects and bytes, +// and it applies to jsoniter.Marshal/Unmarshal as well. +// +// Besides, jsoniter.Iterator provides a different set of interfaces +// iterating given bytes/string/reader +// and yielding parsed elements one by one. +// This set of interfaces reads input as required and gives +// better performance. +package jsoniter diff --git a/integration-test/vendor/github.com/json-iterator/go/pool.go b/integration-test/vendor/github.com/json-iterator/go/pool.go new file mode 100644 index 000000000..e2389b56c --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/pool.go @@ -0,0 +1,42 @@ +package jsoniter + +import ( + "io" +) + +// IteratorPool a thread safe pool of iterators with same configuration +type IteratorPool interface { + BorrowIterator(data []byte) *Iterator + ReturnIterator(iter *Iterator) +} + +// StreamPool a thread safe pool of streams with same configuration +type StreamPool interface { + BorrowStream(writer io.Writer) *Stream + ReturnStream(stream *Stream) +} + +func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream { + stream := cfg.streamPool.Get().(*Stream) + stream.Reset(writer) + return stream +} + +func (cfg *frozenConfig) ReturnStream(stream *Stream) { + stream.out = nil + stream.Error = nil + stream.Attachment = nil + cfg.streamPool.Put(stream) +} + +func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator { + iter := cfg.iteratorPool.Get().(*Iterator) + iter.ResetBytes(data) + return iter +} + +func (cfg *frozenConfig) ReturnIterator(iter *Iterator) { + iter.Error = nil + iter.Attachment = nil + cfg.iteratorPool.Put(iter) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect.go b/integration-test/vendor/github.com/json-iterator/go/reflect.go new file mode 100644 index 000000000..39acb320a --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect.go @@ -0,0 +1,337 @@ +package jsoniter + +import ( + "fmt" + "reflect" + "unsafe" + + "github.com/modern-go/reflect2" +) + +// ValDecoder is an internal type registered to cache as needed. +// Don't confuse jsoniter.ValDecoder with json.Decoder. +// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link). +// +// Reflection on type to create decoders, which is then cached +// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions +// 1. create instance of new value, for example *int will need a int to be allocated +// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New +// 3. assignment to map, both key and value will be reflect.Value +// For a simple struct binding, it will be reflect.Value free and allocation free +type ValDecoder interface { + Decode(ptr unsafe.Pointer, iter *Iterator) +} + +// ValEncoder is an internal type registered to cache as needed. +// Don't confuse jsoniter.ValEncoder with json.Encoder. +// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link). +type ValEncoder interface { + IsEmpty(ptr unsafe.Pointer) bool + Encode(ptr unsafe.Pointer, stream *Stream) +} + +type checkIsEmpty interface { + IsEmpty(ptr unsafe.Pointer) bool +} + +type ctx struct { + *frozenConfig + prefix string + encoders map[reflect2.Type]ValEncoder + decoders map[reflect2.Type]ValDecoder +} + +func (b *ctx) caseSensitive() bool { + if b.frozenConfig == nil { + // default is case-insensitive + return false + } + return b.frozenConfig.caseSensitive +} + +func (b *ctx) append(prefix string) *ctx { + return &ctx{ + frozenConfig: b.frozenConfig, + prefix: b.prefix + " " + prefix, + encoders: b.encoders, + decoders: b.decoders, + } +} + +// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal +func (iter *Iterator) ReadVal(obj interface{}) { + depth := iter.depth + cacheKey := reflect2.RTypeOf(obj) + decoder := iter.cfg.getDecoderFromCache(cacheKey) + if decoder == nil { + typ := reflect2.TypeOf(obj) + if typ == nil || typ.Kind() != reflect.Ptr { + iter.ReportError("ReadVal", "can only unmarshal into pointer") + return + } + decoder = iter.cfg.DecoderOf(typ) + } + ptr := reflect2.PtrOf(obj) + if ptr == nil { + iter.ReportError("ReadVal", "can not read into nil pointer") + return + } + decoder.Decode(ptr, iter) + if iter.depth != depth { + iter.ReportError("ReadVal", "unexpected mismatched nesting") + return + } +} + +// WriteVal copy the go interface into underlying JSON, same as json.Marshal +func (stream *Stream) WriteVal(val interface{}) { + if nil == val { + stream.WriteNil() + return + } + cacheKey := reflect2.RTypeOf(val) + encoder := stream.cfg.getEncoderFromCache(cacheKey) + if encoder == nil { + typ := reflect2.TypeOf(val) + encoder = stream.cfg.EncoderOf(typ) + } + encoder.Encode(reflect2.PtrOf(val), stream) +} + +func (cfg *frozenConfig) DecoderOf(typ reflect2.Type) ValDecoder { + cacheKey := typ.RType() + decoder := cfg.getDecoderFromCache(cacheKey) + if decoder != nil { + return decoder + } + ctx := &ctx{ + frozenConfig: cfg, + prefix: "", + decoders: map[reflect2.Type]ValDecoder{}, + encoders: map[reflect2.Type]ValEncoder{}, + } + ptrType := typ.(*reflect2.UnsafePtrType) + decoder = decoderOfType(ctx, ptrType.Elem()) + cfg.addDecoderToCache(cacheKey, decoder) + return decoder +} + +func decoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := getTypeDecoderFromExtension(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfType(ctx, typ) + for _, extension := range extensions { + decoder = extension.DecorateDecoder(typ, decoder) + } + decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder) + for _, extension := range ctx.extraExtensions { + decoder = extension.DecorateDecoder(typ, decoder) + } + return decoder +} + +func createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := ctx.decoders[typ] + if decoder != nil { + return decoder + } + placeholder := &placeholderDecoder{} + ctx.decoders[typ] = placeholder + decoder = _createDecoderOfType(ctx, typ) + placeholder.decoder = decoder + return decoder +} + +func _createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := createDecoderOfJsonRawMessage(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfJsonNumber(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfMarshaler(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfAny(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfNative(ctx, typ) + if decoder != nil { + return decoder + } + switch typ.Kind() { + case reflect.Interface: + ifaceType, isIFace := typ.(*reflect2.UnsafeIFaceType) + if isIFace { + return &ifaceDecoder{valType: ifaceType} + } + return &efaceDecoder{} + case reflect.Struct: + return decoderOfStruct(ctx, typ) + case reflect.Array: + return decoderOfArray(ctx, typ) + case reflect.Slice: + return decoderOfSlice(ctx, typ) + case reflect.Map: + return decoderOfMap(ctx, typ) + case reflect.Ptr: + return decoderOfOptional(ctx, typ) + default: + return &lazyErrorDecoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} + } +} + +func (cfg *frozenConfig) EncoderOf(typ reflect2.Type) ValEncoder { + cacheKey := typ.RType() + encoder := cfg.getEncoderFromCache(cacheKey) + if encoder != nil { + return encoder + } + ctx := &ctx{ + frozenConfig: cfg, + prefix: "", + decoders: map[reflect2.Type]ValDecoder{}, + encoders: map[reflect2.Type]ValEncoder{}, + } + encoder = encoderOfType(ctx, typ) + if typ.LikePtr() { + encoder = &onePtrEncoder{encoder} + } + cfg.addEncoderToCache(cacheKey, encoder) + return encoder +} + +type onePtrEncoder struct { + encoder ValEncoder +} + +func (encoder *onePtrEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) +} + +func (encoder *onePtrEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) +} + +func encoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := getTypeEncoderFromExtension(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfType(ctx, typ) + for _, extension := range extensions { + encoder = extension.DecorateEncoder(typ, encoder) + } + encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder) + for _, extension := range ctx.extraExtensions { + encoder = extension.DecorateEncoder(typ, encoder) + } + return encoder +} + +func createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := ctx.encoders[typ] + if encoder != nil { + return encoder + } + placeholder := &placeholderEncoder{} + ctx.encoders[typ] = placeholder + encoder = _createEncoderOfType(ctx, typ) + placeholder.encoder = encoder + return encoder +} +func _createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := createEncoderOfJsonRawMessage(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfJsonNumber(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfMarshaler(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfAny(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfNative(ctx, typ) + if encoder != nil { + return encoder + } + kind := typ.Kind() + switch kind { + case reflect.Interface: + return &dynamicEncoder{typ} + case reflect.Struct: + return encoderOfStruct(ctx, typ) + case reflect.Array: + return encoderOfArray(ctx, typ) + case reflect.Slice: + return encoderOfSlice(ctx, typ) + case reflect.Map: + return encoderOfMap(ctx, typ) + case reflect.Ptr: + return encoderOfOptional(ctx, typ) + default: + return &lazyErrorEncoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} + } +} + +type lazyErrorDecoder struct { + err error +} + +func (decoder *lazyErrorDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.WhatIsNext() != NilValue { + if iter.Error == nil { + iter.Error = decoder.err + } + } else { + iter.Skip() + } +} + +type lazyErrorEncoder struct { + err error +} + +func (encoder *lazyErrorEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if ptr == nil { + stream.WriteNil() + } else if stream.Error == nil { + stream.Error = encoder.err + } +} + +func (encoder *lazyErrorEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type placeholderDecoder struct { + decoder ValDecoder +} + +func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.decoder.Decode(ptr, iter) +} + +type placeholderEncoder struct { + encoder ValEncoder +} + +func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(ptr, stream) +} + +func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(ptr) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_array.go b/integration-test/vendor/github.com/json-iterator/go/reflect_array.go new file mode 100644 index 000000000..13a0b7b08 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_array.go @@ -0,0 +1,104 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "io" + "unsafe" +) + +func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder { + arrayType := typ.(*reflect2.UnsafeArrayType) + decoder := decoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) + return &arrayDecoder{arrayType, decoder} +} + +func encoderOfArray(ctx *ctx, typ reflect2.Type) ValEncoder { + arrayType := typ.(*reflect2.UnsafeArrayType) + if arrayType.Len() == 0 { + return emptyArrayEncoder{} + } + encoder := encoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) + return &arrayEncoder{arrayType, encoder} +} + +type emptyArrayEncoder struct{} + +func (encoder emptyArrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteEmptyArray() +} + +func (encoder emptyArrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return true +} + +type arrayEncoder struct { + arrayType *reflect2.UnsafeArrayType + elemEncoder ValEncoder +} + +func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteArrayStart() + elemPtr := unsafe.Pointer(ptr) + encoder.elemEncoder.Encode(elemPtr, stream) + for i := 1; i < encoder.arrayType.Len(); i++ { + stream.WriteMore() + elemPtr = encoder.arrayType.UnsafeGetIndex(ptr, i) + encoder.elemEncoder.Encode(elemPtr, stream) + } + stream.WriteArrayEnd() + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error()) + } +} + +func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type arrayDecoder struct { + arrayType *reflect2.UnsafeArrayType + elemDecoder ValDecoder +} + +func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.doDecode(ptr, iter) + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error()) + } +} + +func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + arrayType := decoder.arrayType + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + return + } + if c != '[' { + iter.ReportError("decode array", "expect [ or n, but found "+string([]byte{c})) + return + } + c = iter.nextToken() + if c == ']' { + return + } + iter.unreadByte() + elemPtr := arrayType.UnsafeGetIndex(ptr, 0) + decoder.elemDecoder.Decode(elemPtr, iter) + length := 1 + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + if length >= arrayType.Len() { + iter.Skip() + continue + } + idx := length + length += 1 + elemPtr = arrayType.UnsafeGetIndex(ptr, idx) + decoder.elemDecoder.Decode(elemPtr, iter) + } + if c != ']' { + iter.ReportError("decode array", "expect ], but found "+string([]byte{c})) + return + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_dynamic.go b/integration-test/vendor/github.com/json-iterator/go/reflect_dynamic.go new file mode 100644 index 000000000..8b6bc8b43 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_dynamic.go @@ -0,0 +1,70 @@ +package jsoniter + +import ( + "github.com/modern-go/reflect2" + "reflect" + "unsafe" +) + +type dynamicEncoder struct { + valType reflect2.Type +} + +func (encoder *dynamicEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + stream.WriteVal(obj) +} + +func (encoder *dynamicEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.valType.UnsafeIndirect(ptr) == nil +} + +type efaceDecoder struct { +} + +func (decoder *efaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + pObj := (*interface{})(ptr) + obj := *pObj + if obj == nil { + *pObj = iter.Read() + return + } + typ := reflect2.TypeOf(obj) + if typ.Kind() != reflect.Ptr { + *pObj = iter.Read() + return + } + ptrType := typ.(*reflect2.UnsafePtrType) + ptrElemType := ptrType.Elem() + if iter.WhatIsNext() == NilValue { + if ptrElemType.Kind() != reflect.Ptr { + iter.skipFourBytes('n', 'u', 'l', 'l') + *pObj = nil + return + } + } + if reflect2.IsNil(obj) { + obj := ptrElemType.New() + iter.ReadVal(obj) + *pObj = obj + return + } + iter.ReadVal(obj) +} + +type ifaceDecoder struct { + valType *reflect2.UnsafeIFaceType +} + +func (decoder *ifaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + decoder.valType.UnsafeSet(ptr, decoder.valType.UnsafeNew()) + return + } + obj := decoder.valType.UnsafeIndirect(ptr) + if reflect2.IsNil(obj) { + iter.ReportError("decode non empty interface", "can not unmarshal into nil") + return + } + iter.ReadVal(obj) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_extension.go b/integration-test/vendor/github.com/json-iterator/go/reflect_extension.go new file mode 100644 index 000000000..74a97bfe5 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_extension.go @@ -0,0 +1,483 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "reflect" + "sort" + "strings" + "unicode" + "unsafe" +) + +var typeDecoders = map[string]ValDecoder{} +var fieldDecoders = map[string]ValDecoder{} +var typeEncoders = map[string]ValEncoder{} +var fieldEncoders = map[string]ValEncoder{} +var extensions = []Extension{} + +// StructDescriptor describe how should we encode/decode the struct +type StructDescriptor struct { + Type reflect2.Type + Fields []*Binding +} + +// GetField get one field from the descriptor by its name. +// Can not use map here to keep field orders. +func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding { + for _, binding := range structDescriptor.Fields { + if binding.Field.Name() == fieldName { + return binding + } + } + return nil +} + +// Binding describe how should we encode/decode the struct field +type Binding struct { + levels []int + Field reflect2.StructField + FromNames []string + ToNames []string + Encoder ValEncoder + Decoder ValDecoder +} + +// Extension the one for all SPI. Customize encoding/decoding by specifying alternate encoder/decoder. +// Can also rename fields by UpdateStructDescriptor. +type Extension interface { + UpdateStructDescriptor(structDescriptor *StructDescriptor) + CreateMapKeyDecoder(typ reflect2.Type) ValDecoder + CreateMapKeyEncoder(typ reflect2.Type) ValEncoder + CreateDecoder(typ reflect2.Type) ValDecoder + CreateEncoder(typ reflect2.Type) ValEncoder + DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder + DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder +} + +// DummyExtension embed this type get dummy implementation for all methods of Extension +type DummyExtension struct { +} + +// UpdateStructDescriptor No-op +func (extension *DummyExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { +} + +// CreateMapKeyDecoder No-op +func (extension *DummyExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateMapKeyEncoder No-op +func (extension *DummyExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// CreateDecoder No-op +func (extension *DummyExtension) CreateDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateEncoder No-op +func (extension *DummyExtension) CreateEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// DecorateDecoder No-op +func (extension *DummyExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { + return decoder +} + +// DecorateEncoder No-op +func (extension *DummyExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { + return encoder +} + +type EncoderExtension map[reflect2.Type]ValEncoder + +// UpdateStructDescriptor No-op +func (extension EncoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { +} + +// CreateDecoder No-op +func (extension EncoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateEncoder get encoder from map +func (extension EncoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { + return extension[typ] +} + +// CreateMapKeyDecoder No-op +func (extension EncoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateMapKeyEncoder No-op +func (extension EncoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// DecorateDecoder No-op +func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { + return decoder +} + +// DecorateEncoder No-op +func (extension EncoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { + return encoder +} + +type DecoderExtension map[reflect2.Type]ValDecoder + +// UpdateStructDescriptor No-op +func (extension DecoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { +} + +// CreateMapKeyDecoder No-op +func (extension DecoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateMapKeyEncoder No-op +func (extension DecoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// CreateDecoder get decoder from map +func (extension DecoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { + return extension[typ] +} + +// CreateEncoder No-op +func (extension DecoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// DecorateDecoder No-op +func (extension DecoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { + return decoder +} + +// DecorateEncoder No-op +func (extension DecoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { + return encoder +} + +type funcDecoder struct { + fun DecoderFunc +} + +func (decoder *funcDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.fun(ptr, iter) +} + +type funcEncoder struct { + fun EncoderFunc + isEmptyFunc func(ptr unsafe.Pointer) bool +} + +func (encoder *funcEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.fun(ptr, stream) +} + +func (encoder *funcEncoder) IsEmpty(ptr unsafe.Pointer) bool { + if encoder.isEmptyFunc == nil { + return false + } + return encoder.isEmptyFunc(ptr) +} + +// DecoderFunc the function form of TypeDecoder +type DecoderFunc func(ptr unsafe.Pointer, iter *Iterator) + +// EncoderFunc the function form of TypeEncoder +type EncoderFunc func(ptr unsafe.Pointer, stream *Stream) + +// RegisterTypeDecoderFunc register TypeDecoder for a type with function +func RegisterTypeDecoderFunc(typ string, fun DecoderFunc) { + typeDecoders[typ] = &funcDecoder{fun} +} + +// RegisterTypeDecoder register TypeDecoder for a typ +func RegisterTypeDecoder(typ string, decoder ValDecoder) { + typeDecoders[typ] = decoder +} + +// RegisterFieldDecoderFunc register TypeDecoder for a struct field with function +func RegisterFieldDecoderFunc(typ string, field string, fun DecoderFunc) { + RegisterFieldDecoder(typ, field, &funcDecoder{fun}) +} + +// RegisterFieldDecoder register TypeDecoder for a struct field +func RegisterFieldDecoder(typ string, field string, decoder ValDecoder) { + fieldDecoders[fmt.Sprintf("%s/%s", typ, field)] = decoder +} + +// RegisterTypeEncoderFunc register TypeEncoder for a type with encode/isEmpty function +func RegisterTypeEncoderFunc(typ string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) { + typeEncoders[typ] = &funcEncoder{fun, isEmptyFunc} +} + +// RegisterTypeEncoder register TypeEncoder for a type +func RegisterTypeEncoder(typ string, encoder ValEncoder) { + typeEncoders[typ] = encoder +} + +// RegisterFieldEncoderFunc register TypeEncoder for a struct field with encode/isEmpty function +func RegisterFieldEncoderFunc(typ string, field string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) { + RegisterFieldEncoder(typ, field, &funcEncoder{fun, isEmptyFunc}) +} + +// RegisterFieldEncoder register TypeEncoder for a struct field +func RegisterFieldEncoder(typ string, field string, encoder ValEncoder) { + fieldEncoders[fmt.Sprintf("%s/%s", typ, field)] = encoder +} + +// RegisterExtension register extension +func RegisterExtension(extension Extension) { + extensions = append(extensions, extension) +} + +func getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := _getTypeDecoderFromExtension(ctx, typ) + if decoder != nil { + for _, extension := range extensions { + decoder = extension.DecorateDecoder(typ, decoder) + } + decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder) + for _, extension := range ctx.extraExtensions { + decoder = extension.DecorateDecoder(typ, decoder) + } + } + return decoder +} +func _getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { + for _, extension := range extensions { + decoder := extension.CreateDecoder(typ) + if decoder != nil { + return decoder + } + } + decoder := ctx.decoderExtension.CreateDecoder(typ) + if decoder != nil { + return decoder + } + for _, extension := range ctx.extraExtensions { + decoder := extension.CreateDecoder(typ) + if decoder != nil { + return decoder + } + } + typeName := typ.String() + decoder = typeDecoders[typeName] + if decoder != nil { + return decoder + } + if typ.Kind() == reflect.Ptr { + ptrType := typ.(*reflect2.UnsafePtrType) + decoder := typeDecoders[ptrType.Elem().String()] + if decoder != nil { + return &OptionalDecoder{ptrType.Elem(), decoder} + } + } + return nil +} + +func getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := _getTypeEncoderFromExtension(ctx, typ) + if encoder != nil { + for _, extension := range extensions { + encoder = extension.DecorateEncoder(typ, encoder) + } + encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder) + for _, extension := range ctx.extraExtensions { + encoder = extension.DecorateEncoder(typ, encoder) + } + } + return encoder +} + +func _getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { + for _, extension := range extensions { + encoder := extension.CreateEncoder(typ) + if encoder != nil { + return encoder + } + } + encoder := ctx.encoderExtension.CreateEncoder(typ) + if encoder != nil { + return encoder + } + for _, extension := range ctx.extraExtensions { + encoder := extension.CreateEncoder(typ) + if encoder != nil { + return encoder + } + } + typeName := typ.String() + encoder = typeEncoders[typeName] + if encoder != nil { + return encoder + } + if typ.Kind() == reflect.Ptr { + typePtr := typ.(*reflect2.UnsafePtrType) + encoder := typeEncoders[typePtr.Elem().String()] + if encoder != nil { + return &OptionalEncoder{encoder} + } + } + return nil +} + +func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor { + structType := typ.(*reflect2.UnsafeStructType) + embeddedBindings := []*Binding{} + bindings := []*Binding{} + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + tag, hastag := field.Tag().Lookup(ctx.getTagKey()) + if ctx.onlyTaggedField && !hastag && !field.Anonymous() { + continue + } + if tag == "-" || field.Name() == "_" { + continue + } + tagParts := strings.Split(tag, ",") + if field.Anonymous() && (tag == "" || tagParts[0] == "") { + if field.Type().Kind() == reflect.Struct { + structDescriptor := describeStruct(ctx, field.Type()) + for _, binding := range structDescriptor.Fields { + binding.levels = append([]int{i}, binding.levels...) + omitempty := binding.Encoder.(*structFieldEncoder).omitempty + binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} + binding.Decoder = &structFieldDecoder{field, binding.Decoder} + embeddedBindings = append(embeddedBindings, binding) + } + continue + } else if field.Type().Kind() == reflect.Ptr { + ptrType := field.Type().(*reflect2.UnsafePtrType) + if ptrType.Elem().Kind() == reflect.Struct { + structDescriptor := describeStruct(ctx, ptrType.Elem()) + for _, binding := range structDescriptor.Fields { + binding.levels = append([]int{i}, binding.levels...) + omitempty := binding.Encoder.(*structFieldEncoder).omitempty + binding.Encoder = &dereferenceEncoder{binding.Encoder} + binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} + binding.Decoder = &dereferenceDecoder{ptrType.Elem(), binding.Decoder} + binding.Decoder = &structFieldDecoder{field, binding.Decoder} + embeddedBindings = append(embeddedBindings, binding) + } + continue + } + } + } + fieldNames := calcFieldNames(field.Name(), tagParts[0], tag) + fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name()) + decoder := fieldDecoders[fieldCacheKey] + if decoder == nil { + decoder = decoderOfType(ctx.append(field.Name()), field.Type()) + } + encoder := fieldEncoders[fieldCacheKey] + if encoder == nil { + encoder = encoderOfType(ctx.append(field.Name()), field.Type()) + } + binding := &Binding{ + Field: field, + FromNames: fieldNames, + ToNames: fieldNames, + Decoder: decoder, + Encoder: encoder, + } + binding.levels = []int{i} + bindings = append(bindings, binding) + } + return createStructDescriptor(ctx, typ, bindings, embeddedBindings) +} +func createStructDescriptor(ctx *ctx, typ reflect2.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { + structDescriptor := &StructDescriptor{ + Type: typ, + Fields: bindings, + } + for _, extension := range extensions { + extension.UpdateStructDescriptor(structDescriptor) + } + ctx.encoderExtension.UpdateStructDescriptor(structDescriptor) + ctx.decoderExtension.UpdateStructDescriptor(structDescriptor) + for _, extension := range ctx.extraExtensions { + extension.UpdateStructDescriptor(structDescriptor) + } + processTags(structDescriptor, ctx.frozenConfig) + // merge normal & embedded bindings & sort with original order + allBindings := sortableBindings(append(embeddedBindings, structDescriptor.Fields...)) + sort.Sort(allBindings) + structDescriptor.Fields = allBindings + return structDescriptor +} + +type sortableBindings []*Binding + +func (bindings sortableBindings) Len() int { + return len(bindings) +} + +func (bindings sortableBindings) Less(i, j int) bool { + left := bindings[i].levels + right := bindings[j].levels + k := 0 + for { + if left[k] < right[k] { + return true + } else if left[k] > right[k] { + return false + } + k++ + } +} + +func (bindings sortableBindings) Swap(i, j int) { + bindings[i], bindings[j] = bindings[j], bindings[i] +} + +func processTags(structDescriptor *StructDescriptor, cfg *frozenConfig) { + for _, binding := range structDescriptor.Fields { + shouldOmitEmpty := false + tagParts := strings.Split(binding.Field.Tag().Get(cfg.getTagKey()), ",") + for _, tagPart := range tagParts[1:] { + if tagPart == "omitempty" { + shouldOmitEmpty = true + } else if tagPart == "string" { + if binding.Field.Type().Kind() == reflect.String { + binding.Decoder = &stringModeStringDecoder{binding.Decoder, cfg} + binding.Encoder = &stringModeStringEncoder{binding.Encoder, cfg} + } else { + binding.Decoder = &stringModeNumberDecoder{binding.Decoder} + binding.Encoder = &stringModeNumberEncoder{binding.Encoder} + } + } + } + binding.Decoder = &structFieldDecoder{binding.Field, binding.Decoder} + binding.Encoder = &structFieldEncoder{binding.Field, binding.Encoder, shouldOmitEmpty} + } +} + +func calcFieldNames(originalFieldName string, tagProvidedFieldName string, wholeTag string) []string { + // ignore? + if wholeTag == "-" { + return []string{} + } + // rename? + var fieldNames []string + if tagProvidedFieldName == "" { + fieldNames = []string{originalFieldName} + } else { + fieldNames = []string{tagProvidedFieldName} + } + // private? + isNotExported := unicode.IsLower(rune(originalFieldName[0])) || originalFieldName[0] == '_' + if isNotExported { + fieldNames = []string{} + } + return fieldNames +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_json_number.go b/integration-test/vendor/github.com/json-iterator/go/reflect_json_number.go new file mode 100644 index 000000000..98d45c1ec --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_json_number.go @@ -0,0 +1,112 @@ +package jsoniter + +import ( + "encoding/json" + "github.com/modern-go/reflect2" + "strconv" + "unsafe" +) + +type Number string + +// String returns the literal text of the number. +func (n Number) String() string { return string(n) } + +// Float64 returns the number as a float64. +func (n Number) Float64() (float64, error) { + return strconv.ParseFloat(string(n), 64) +} + +// Int64 returns the number as an int64. +func (n Number) Int64() (int64, error) { + return strconv.ParseInt(string(n), 10, 64) +} + +func CastJsonNumber(val interface{}) (string, bool) { + switch typedVal := val.(type) { + case json.Number: + return string(typedVal), true + case Number: + return string(typedVal), true + } + return "", false +} + +var jsonNumberType = reflect2.TypeOfPtr((*json.Number)(nil)).Elem() +var jsoniterNumberType = reflect2.TypeOfPtr((*Number)(nil)).Elem() + +func createDecoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ.AssignableTo(jsonNumberType) { + return &jsonNumberCodec{} + } + if typ.AssignableTo(jsoniterNumberType) { + return &jsoniterNumberCodec{} + } + return nil +} + +func createEncoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ.AssignableTo(jsonNumberType) { + return &jsonNumberCodec{} + } + if typ.AssignableTo(jsoniterNumberType) { + return &jsoniterNumberCodec{} + } + return nil +} + +type jsonNumberCodec struct { +} + +func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + switch iter.WhatIsNext() { + case StringValue: + *((*json.Number)(ptr)) = json.Number(iter.ReadString()) + case NilValue: + iter.skipFourBytes('n', 'u', 'l', 'l') + *((*json.Number)(ptr)) = "" + default: + *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString())) + } +} + +func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + number := *((*json.Number)(ptr)) + if len(number) == 0 { + stream.writeByte('0') + } else { + stream.WriteRaw(string(number)) + } +} + +func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*json.Number)(ptr))) == 0 +} + +type jsoniterNumberCodec struct { +} + +func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + switch iter.WhatIsNext() { + case StringValue: + *((*Number)(ptr)) = Number(iter.ReadString()) + case NilValue: + iter.skipFourBytes('n', 'u', 'l', 'l') + *((*Number)(ptr)) = "" + default: + *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString())) + } +} + +func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + number := *((*Number)(ptr)) + if len(number) == 0 { + stream.writeByte('0') + } else { + stream.WriteRaw(string(number)) + } +} + +func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*Number)(ptr))) == 0 +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_json_raw_message.go b/integration-test/vendor/github.com/json-iterator/go/reflect_json_raw_message.go new file mode 100644 index 000000000..eba434f2f --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_json_raw_message.go @@ -0,0 +1,76 @@ +package jsoniter + +import ( + "encoding/json" + "github.com/modern-go/reflect2" + "unsafe" +) + +var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem() +var jsoniterRawMessageType = reflect2.TypeOfPtr((*RawMessage)(nil)).Elem() + +func createEncoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == jsonRawMessageType { + return &jsonRawMessageCodec{} + } + if typ == jsoniterRawMessageType { + return &jsoniterRawMessageCodec{} + } + return nil +} + +func createDecoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ == jsonRawMessageType { + return &jsonRawMessageCodec{} + } + if typ == jsoniterRawMessageType { + return &jsoniterRawMessageCodec{} + } + return nil +} + +type jsonRawMessageCodec struct { +} + +func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + *((*json.RawMessage)(ptr)) = nil + } else { + *((*json.RawMessage)(ptr)) = iter.SkipAndReturnBytes() + } +} + +func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + if *((*json.RawMessage)(ptr)) == nil { + stream.WriteNil() + } else { + stream.WriteRaw(string(*((*json.RawMessage)(ptr)))) + } +} + +func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*json.RawMessage)(ptr))) == 0 +} + +type jsoniterRawMessageCodec struct { +} + +func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + *((*RawMessage)(ptr)) = nil + } else { + *((*RawMessage)(ptr)) = iter.SkipAndReturnBytes() + } +} + +func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + if *((*RawMessage)(ptr)) == nil { + stream.WriteNil() + } else { + stream.WriteRaw(string(*((*RawMessage)(ptr)))) + } +} + +func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*RawMessage)(ptr))) == 0 +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_map.go b/integration-test/vendor/github.com/json-iterator/go/reflect_map.go new file mode 100644 index 000000000..582967130 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_map.go @@ -0,0 +1,346 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "io" + "reflect" + "sort" + "unsafe" +) + +func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder { + mapType := typ.(*reflect2.UnsafeMapType) + keyDecoder := decoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()) + elemDecoder := decoderOfType(ctx.append("[mapElem]"), mapType.Elem()) + return &mapDecoder{ + mapType: mapType, + keyType: mapType.Key(), + elemType: mapType.Elem(), + keyDecoder: keyDecoder, + elemDecoder: elemDecoder, + } +} + +func encoderOfMap(ctx *ctx, typ reflect2.Type) ValEncoder { + mapType := typ.(*reflect2.UnsafeMapType) + if ctx.sortMapKeys { + return &sortKeysMapEncoder{ + mapType: mapType, + keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), + elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), + } + } + return &mapEncoder{ + mapType: mapType, + keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), + elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), + } +} + +func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := ctx.decoderExtension.CreateMapKeyDecoder(typ) + if decoder != nil { + return decoder + } + for _, extension := range ctx.extraExtensions { + decoder := extension.CreateMapKeyDecoder(typ) + if decoder != nil { + return decoder + } + } + + ptrType := reflect2.PtrTo(typ) + if ptrType.Implements(unmarshalerType) { + return &referenceDecoder{ + &unmarshalerDecoder{ + valType: ptrType, + }, + } + } + if typ.Implements(unmarshalerType) { + return &unmarshalerDecoder{ + valType: typ, + } + } + if ptrType.Implements(textUnmarshalerType) { + return &referenceDecoder{ + &textUnmarshalerDecoder{ + valType: ptrType, + }, + } + } + if typ.Implements(textUnmarshalerType) { + return &textUnmarshalerDecoder{ + valType: typ, + } + } + + switch typ.Kind() { + case reflect.String: + return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) + case reflect.Bool, + reflect.Uint8, reflect.Int8, + reflect.Uint16, reflect.Int16, + reflect.Uint32, reflect.Int32, + reflect.Uint64, reflect.Int64, + reflect.Uint, reflect.Int, + reflect.Float32, reflect.Float64, + reflect.Uintptr: + typ = reflect2.DefaultTypeOfKind(typ.Kind()) + return &numericMapKeyDecoder{decoderOfType(ctx, typ)} + default: + return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)} + } +} + +func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := ctx.encoderExtension.CreateMapKeyEncoder(typ) + if encoder != nil { + return encoder + } + for _, extension := range ctx.extraExtensions { + encoder := extension.CreateMapKeyEncoder(typ) + if encoder != nil { + return encoder + } + } + + if typ == textMarshalerType { + return &directTextMarshalerEncoder{ + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + } + if typ.Implements(textMarshalerType) { + return &textMarshalerEncoder{ + valType: typ, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + } + + switch typ.Kind() { + case reflect.String: + return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) + case reflect.Bool, + reflect.Uint8, reflect.Int8, + reflect.Uint16, reflect.Int16, + reflect.Uint32, reflect.Int32, + reflect.Uint64, reflect.Int64, + reflect.Uint, reflect.Int, + reflect.Float32, reflect.Float64, + reflect.Uintptr: + typ = reflect2.DefaultTypeOfKind(typ.Kind()) + return &numericMapKeyEncoder{encoderOfType(ctx, typ)} + default: + if typ.Kind() == reflect.Interface { + return &dynamicMapKeyEncoder{ctx, typ} + } + return &lazyErrorEncoder{err: fmt.Errorf("unsupported map key type: %v", typ)} + } +} + +type mapDecoder struct { + mapType *reflect2.UnsafeMapType + keyType reflect2.Type + elemType reflect2.Type + keyDecoder ValDecoder + elemDecoder ValDecoder +} + +func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + mapType := decoder.mapType + c := iter.nextToken() + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + *(*unsafe.Pointer)(ptr) = nil + mapType.UnsafeSet(ptr, mapType.UnsafeNew()) + return + } + if mapType.UnsafeIsNil(ptr) { + mapType.UnsafeSet(ptr, mapType.UnsafeMakeMap(0)) + } + if c != '{' { + iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) + return + } + c = iter.nextToken() + if c == '}' { + return + } + iter.unreadByte() + key := decoder.keyType.UnsafeNew() + decoder.keyDecoder.Decode(key, iter) + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) + return + } + elem := decoder.elemType.UnsafeNew() + decoder.elemDecoder.Decode(elem, iter) + decoder.mapType.UnsafeSetIndex(ptr, key, elem) + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + key := decoder.keyType.UnsafeNew() + decoder.keyDecoder.Decode(key, iter) + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) + return + } + elem := decoder.elemType.UnsafeNew() + decoder.elemDecoder.Decode(elem, iter) + decoder.mapType.UnsafeSetIndex(ptr, key, elem) + } + if c != '}' { + iter.ReportError("ReadMapCB", `expect }, but found `+string([]byte{c})) + } +} + +type numericMapKeyDecoder struct { + decoder ValDecoder +} + +func (decoder *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + if c != '"' { + iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) + return + } + decoder.decoder.Decode(ptr, iter) + c = iter.nextToken() + if c != '"' { + iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) + return + } +} + +type numericMapKeyEncoder struct { + encoder ValEncoder +} + +func (encoder *numericMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.writeByte('"') + encoder.encoder.Encode(ptr, stream) + stream.writeByte('"') +} + +func (encoder *numericMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type dynamicMapKeyEncoder struct { + ctx *ctx + valType reflect2.Type +} + +func (encoder *dynamicMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).Encode(reflect2.PtrOf(obj), stream) +} + +func (encoder *dynamicMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { + obj := encoder.valType.UnsafeIndirect(ptr) + return encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).IsEmpty(reflect2.PtrOf(obj)) +} + +type mapEncoder struct { + mapType *reflect2.UnsafeMapType + keyEncoder ValEncoder + elemEncoder ValEncoder +} + +func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if *(*unsafe.Pointer)(ptr) == nil { + stream.WriteNil() + return + } + stream.WriteObjectStart() + iter := encoder.mapType.UnsafeIterate(ptr) + for i := 0; iter.HasNext(); i++ { + if i != 0 { + stream.WriteMore() + } + key, elem := iter.UnsafeNext() + encoder.keyEncoder.Encode(key, stream) + if stream.indention > 0 { + stream.writeTwoBytes(byte(':'), byte(' ')) + } else { + stream.writeByte(':') + } + encoder.elemEncoder.Encode(elem, stream) + } + stream.WriteObjectEnd() +} + +func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool { + iter := encoder.mapType.UnsafeIterate(ptr) + return !iter.HasNext() +} + +type sortKeysMapEncoder struct { + mapType *reflect2.UnsafeMapType + keyEncoder ValEncoder + elemEncoder ValEncoder +} + +func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if *(*unsafe.Pointer)(ptr) == nil { + stream.WriteNil() + return + } + stream.WriteObjectStart() + mapIter := encoder.mapType.UnsafeIterate(ptr) + subStream := stream.cfg.BorrowStream(nil) + subStream.Attachment = stream.Attachment + subIter := stream.cfg.BorrowIterator(nil) + keyValues := encodedKeyValues{} + for mapIter.HasNext() { + key, elem := mapIter.UnsafeNext() + subStreamIndex := subStream.Buffered() + encoder.keyEncoder.Encode(key, subStream) + if subStream.Error != nil && subStream.Error != io.EOF && stream.Error == nil { + stream.Error = subStream.Error + } + encodedKey := subStream.Buffer()[subStreamIndex:] + subIter.ResetBytes(encodedKey) + decodedKey := subIter.ReadString() + if stream.indention > 0 { + subStream.writeTwoBytes(byte(':'), byte(' ')) + } else { + subStream.writeByte(':') + } + encoder.elemEncoder.Encode(elem, subStream) + keyValues = append(keyValues, encodedKV{ + key: decodedKey, + keyValue: subStream.Buffer()[subStreamIndex:], + }) + } + sort.Sort(keyValues) + for i, keyValue := range keyValues { + if i != 0 { + stream.WriteMore() + } + stream.Write(keyValue.keyValue) + } + if subStream.Error != nil && stream.Error == nil { + stream.Error = subStream.Error + } + stream.WriteObjectEnd() + stream.cfg.ReturnStream(subStream) + stream.cfg.ReturnIterator(subIter) +} + +func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { + iter := encoder.mapType.UnsafeIterate(ptr) + return !iter.HasNext() +} + +type encodedKeyValues []encodedKV + +type encodedKV struct { + key string + keyValue []byte +} + +func (sv encodedKeyValues) Len() int { return len(sv) } +func (sv encodedKeyValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } +func (sv encodedKeyValues) Less(i, j int) bool { return sv[i].key < sv[j].key } diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_marshaler.go b/integration-test/vendor/github.com/json-iterator/go/reflect_marshaler.go new file mode 100644 index 000000000..3e21f3756 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_marshaler.go @@ -0,0 +1,225 @@ +package jsoniter + +import ( + "encoding" + "encoding/json" + "unsafe" + + "github.com/modern-go/reflect2" +) + +var marshalerType = reflect2.TypeOfPtr((*json.Marshaler)(nil)).Elem() +var unmarshalerType = reflect2.TypeOfPtr((*json.Unmarshaler)(nil)).Elem() +var textMarshalerType = reflect2.TypeOfPtr((*encoding.TextMarshaler)(nil)).Elem() +var textUnmarshalerType = reflect2.TypeOfPtr((*encoding.TextUnmarshaler)(nil)).Elem() + +func createDecoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValDecoder { + ptrType := reflect2.PtrTo(typ) + if ptrType.Implements(unmarshalerType) { + return &referenceDecoder{ + &unmarshalerDecoder{ptrType}, + } + } + if ptrType.Implements(textUnmarshalerType) { + return &referenceDecoder{ + &textUnmarshalerDecoder{ptrType}, + } + } + return nil +} + +func createEncoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == marshalerType { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &directMarshalerEncoder{ + checkIsEmpty: checkIsEmpty, + } + return encoder + } + if typ.Implements(marshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &marshalerEncoder{ + valType: typ, + checkIsEmpty: checkIsEmpty, + } + return encoder + } + ptrType := reflect2.PtrTo(typ) + if ctx.prefix != "" && ptrType.Implements(marshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, ptrType) + var encoder ValEncoder = &marshalerEncoder{ + valType: ptrType, + checkIsEmpty: checkIsEmpty, + } + return &referenceEncoder{encoder} + } + if typ == textMarshalerType { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &directTextMarshalerEncoder{ + checkIsEmpty: checkIsEmpty, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + return encoder + } + if typ.Implements(textMarshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &textMarshalerEncoder{ + valType: typ, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + checkIsEmpty: checkIsEmpty, + } + return encoder + } + // if prefix is empty, the type is the root type + if ctx.prefix != "" && ptrType.Implements(textMarshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, ptrType) + var encoder ValEncoder = &textMarshalerEncoder{ + valType: ptrType, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + checkIsEmpty: checkIsEmpty, + } + return &referenceEncoder{encoder} + } + return nil +} + +type marshalerEncoder struct { + checkIsEmpty checkIsEmpty + valType reflect2.Type +} + +func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + if encoder.valType.IsNullable() && reflect2.IsNil(obj) { + stream.WriteNil() + return + } + marshaler := obj.(json.Marshaler) + bytes, err := marshaler.MarshalJSON() + if err != nil { + stream.Error = err + } else { + // html escape was already done by jsoniter + // but the extra '\n' should be trimed + l := len(bytes) + if l > 0 && bytes[l-1] == '\n' { + bytes = bytes[:l-1] + } + stream.Write(bytes) + } +} + +func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type directMarshalerEncoder struct { + checkIsEmpty checkIsEmpty +} + +func (encoder *directMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + marshaler := *(*json.Marshaler)(ptr) + if marshaler == nil { + stream.WriteNil() + return + } + bytes, err := marshaler.MarshalJSON() + if err != nil { + stream.Error = err + } else { + stream.Write(bytes) + } +} + +func (encoder *directMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type textMarshalerEncoder struct { + valType reflect2.Type + stringEncoder ValEncoder + checkIsEmpty checkIsEmpty +} + +func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + if encoder.valType.IsNullable() && reflect2.IsNil(obj) { + stream.WriteNil() + return + } + marshaler := (obj).(encoding.TextMarshaler) + bytes, err := marshaler.MarshalText() + if err != nil { + stream.Error = err + } else { + str := string(bytes) + encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) + } +} + +func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type directTextMarshalerEncoder struct { + stringEncoder ValEncoder + checkIsEmpty checkIsEmpty +} + +func (encoder *directTextMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + marshaler := *(*encoding.TextMarshaler)(ptr) + if marshaler == nil { + stream.WriteNil() + return + } + bytes, err := marshaler.MarshalText() + if err != nil { + stream.Error = err + } else { + str := string(bytes) + encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) + } +} + +func (encoder *directTextMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type unmarshalerDecoder struct { + valType reflect2.Type +} + +func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + valType := decoder.valType + obj := valType.UnsafeIndirect(ptr) + unmarshaler := obj.(json.Unmarshaler) + iter.nextToken() + iter.unreadByte() // skip spaces + bytes := iter.SkipAndReturnBytes() + err := unmarshaler.UnmarshalJSON(bytes) + if err != nil { + iter.ReportError("unmarshalerDecoder", err.Error()) + } +} + +type textUnmarshalerDecoder struct { + valType reflect2.Type +} + +func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + valType := decoder.valType + obj := valType.UnsafeIndirect(ptr) + if reflect2.IsNil(obj) { + ptrType := valType.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + elem := elemType.UnsafeNew() + ptrType.UnsafeSet(ptr, unsafe.Pointer(&elem)) + obj = valType.UnsafeIndirect(ptr) + } + unmarshaler := (obj).(encoding.TextUnmarshaler) + str := iter.ReadString() + err := unmarshaler.UnmarshalText([]byte(str)) + if err != nil { + iter.ReportError("textUnmarshalerDecoder", err.Error()) + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_native.go b/integration-test/vendor/github.com/json-iterator/go/reflect_native.go new file mode 100644 index 000000000..f88722d14 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_native.go @@ -0,0 +1,453 @@ +package jsoniter + +import ( + "encoding/base64" + "reflect" + "strconv" + "unsafe" + + "github.com/modern-go/reflect2" +) + +const ptrSize = 32 << uintptr(^uintptr(0)>>63) + +func createEncoderOfNative(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { + sliceDecoder := decoderOfSlice(ctx, typ) + return &base64Codec{sliceDecoder: sliceDecoder} + } + typeName := typ.String() + kind := typ.Kind() + switch kind { + case reflect.String: + if typeName != "string" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) + } + return &stringCodec{} + case reflect.Int: + if typeName != "int" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &int32Codec{} + } + return &int64Codec{} + case reflect.Int8: + if typeName != "int8" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) + } + return &int8Codec{} + case reflect.Int16: + if typeName != "int16" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) + } + return &int16Codec{} + case reflect.Int32: + if typeName != "int32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) + } + return &int32Codec{} + case reflect.Int64: + if typeName != "int64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) + } + return &int64Codec{} + case reflect.Uint: + if typeName != "uint" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint8: + if typeName != "uint8" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) + } + return &uint8Codec{} + case reflect.Uint16: + if typeName != "uint16" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) + } + return &uint16Codec{} + case reflect.Uint32: + if typeName != "uint32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) + } + return &uint32Codec{} + case reflect.Uintptr: + if typeName != "uintptr" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) + } + if ptrSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint64: + if typeName != "uint64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) + } + return &uint64Codec{} + case reflect.Float32: + if typeName != "float32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) + } + return &float32Codec{} + case reflect.Float64: + if typeName != "float64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) + } + return &float64Codec{} + case reflect.Bool: + if typeName != "bool" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) + } + return &boolCodec{} + } + return nil +} + +func createDecoderOfNative(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { + sliceDecoder := decoderOfSlice(ctx, typ) + return &base64Codec{sliceDecoder: sliceDecoder} + } + typeName := typ.String() + switch typ.Kind() { + case reflect.String: + if typeName != "string" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) + } + return &stringCodec{} + case reflect.Int: + if typeName != "int" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &int32Codec{} + } + return &int64Codec{} + case reflect.Int8: + if typeName != "int8" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) + } + return &int8Codec{} + case reflect.Int16: + if typeName != "int16" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) + } + return &int16Codec{} + case reflect.Int32: + if typeName != "int32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) + } + return &int32Codec{} + case reflect.Int64: + if typeName != "int64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) + } + return &int64Codec{} + case reflect.Uint: + if typeName != "uint" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint8: + if typeName != "uint8" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) + } + return &uint8Codec{} + case reflect.Uint16: + if typeName != "uint16" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) + } + return &uint16Codec{} + case reflect.Uint32: + if typeName != "uint32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) + } + return &uint32Codec{} + case reflect.Uintptr: + if typeName != "uintptr" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) + } + if ptrSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint64: + if typeName != "uint64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) + } + return &uint64Codec{} + case reflect.Float32: + if typeName != "float32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) + } + return &float32Codec{} + case reflect.Float64: + if typeName != "float64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) + } + return &float64Codec{} + case reflect.Bool: + if typeName != "bool" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) + } + return &boolCodec{} + } + return nil +} + +type stringCodec struct { +} + +func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *((*string)(ptr)) = iter.ReadString() +} + +func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + str := *((*string)(ptr)) + stream.WriteString(str) +} + +func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*string)(ptr)) == "" +} + +type int8Codec struct { +} + +func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int8)(ptr)) = iter.ReadInt8() + } +} + +func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt8(*((*int8)(ptr))) +} + +func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int8)(ptr)) == 0 +} + +type int16Codec struct { +} + +func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int16)(ptr)) = iter.ReadInt16() + } +} + +func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt16(*((*int16)(ptr))) +} + +func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int16)(ptr)) == 0 +} + +type int32Codec struct { +} + +func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int32)(ptr)) = iter.ReadInt32() + } +} + +func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt32(*((*int32)(ptr))) +} + +func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int32)(ptr)) == 0 +} + +type int64Codec struct { +} + +func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int64)(ptr)) = iter.ReadInt64() + } +} + +func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt64(*((*int64)(ptr))) +} + +func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int64)(ptr)) == 0 +} + +type uint8Codec struct { +} + +func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint8)(ptr)) = iter.ReadUint8() + } +} + +func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint8(*((*uint8)(ptr))) +} + +func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint8)(ptr)) == 0 +} + +type uint16Codec struct { +} + +func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint16)(ptr)) = iter.ReadUint16() + } +} + +func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint16(*((*uint16)(ptr))) +} + +func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint16)(ptr)) == 0 +} + +type uint32Codec struct { +} + +func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint32)(ptr)) = iter.ReadUint32() + } +} + +func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint32(*((*uint32)(ptr))) +} + +func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint32)(ptr)) == 0 +} + +type uint64Codec struct { +} + +func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint64)(ptr)) = iter.ReadUint64() + } +} + +func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint64(*((*uint64)(ptr))) +} + +func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint64)(ptr)) == 0 +} + +type float32Codec struct { +} + +func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*float32)(ptr)) = iter.ReadFloat32() + } +} + +func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteFloat32(*((*float32)(ptr))) +} + +func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*float32)(ptr)) == 0 +} + +type float64Codec struct { +} + +func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*float64)(ptr)) = iter.ReadFloat64() + } +} + +func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteFloat64(*((*float64)(ptr))) +} + +func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*float64)(ptr)) == 0 +} + +type boolCodec struct { +} + +func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*bool)(ptr)) = iter.ReadBool() + } +} + +func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteBool(*((*bool)(ptr))) +} + +func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { + return !(*((*bool)(ptr))) +} + +type base64Codec struct { + sliceType *reflect2.UnsafeSliceType + sliceDecoder ValDecoder +} + +func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + codec.sliceType.UnsafeSetNil(ptr) + return + } + switch iter.WhatIsNext() { + case StringValue: + src := iter.ReadString() + dst, err := base64.StdEncoding.DecodeString(src) + if err != nil { + iter.ReportError("decode base64", err.Error()) + } else { + codec.sliceType.UnsafeSet(ptr, unsafe.Pointer(&dst)) + } + case ArrayValue: + codec.sliceDecoder.Decode(ptr, iter) + default: + iter.ReportError("base64Codec", "invalid input") + } +} + +func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + if codec.sliceType.UnsafeIsNil(ptr) { + stream.WriteNil() + return + } + src := *((*[]byte)(ptr)) + encoding := base64.StdEncoding + stream.writeByte('"') + if len(src) != 0 { + size := encoding.EncodedLen(len(src)) + buf := make([]byte, size) + encoding.Encode(buf, src) + stream.buf = append(stream.buf, buf...) + } + stream.writeByte('"') +} + +func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*[]byte)(ptr))) == 0 +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_optional.go b/integration-test/vendor/github.com/json-iterator/go/reflect_optional.go new file mode 100644 index 000000000..fa71f4748 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_optional.go @@ -0,0 +1,129 @@ +package jsoniter + +import ( + "github.com/modern-go/reflect2" + "unsafe" +) + +func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { + ptrType := typ.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + decoder := decoderOfType(ctx, elemType) + return &OptionalDecoder{elemType, decoder} +} + +func encoderOfOptional(ctx *ctx, typ reflect2.Type) ValEncoder { + ptrType := typ.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + elemEncoder := encoderOfType(ctx, elemType) + encoder := &OptionalEncoder{elemEncoder} + return encoder +} + +type OptionalDecoder struct { + ValueType reflect2.Type + ValueDecoder ValDecoder +} + +func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + *((*unsafe.Pointer)(ptr)) = nil + } else { + if *((*unsafe.Pointer)(ptr)) == nil { + //pointer to null, we have to allocate memory to hold the value + newPtr := decoder.ValueType.UnsafeNew() + decoder.ValueDecoder.Decode(newPtr, iter) + *((*unsafe.Pointer)(ptr)) = newPtr + } else { + //reuse existing instance + decoder.ValueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) + } + } +} + +type dereferenceDecoder struct { + // only to deference a pointer + valueType reflect2.Type + valueDecoder ValDecoder +} + +func (decoder *dereferenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if *((*unsafe.Pointer)(ptr)) == nil { + //pointer to null, we have to allocate memory to hold the value + newPtr := decoder.valueType.UnsafeNew() + decoder.valueDecoder.Decode(newPtr, iter) + *((*unsafe.Pointer)(ptr)) = newPtr + } else { + //reuse existing instance + decoder.valueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) + } +} + +type OptionalEncoder struct { + ValueEncoder ValEncoder +} + +func (encoder *OptionalEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if *((*unsafe.Pointer)(ptr)) == nil { + stream.WriteNil() + } else { + encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) + } +} + +func (encoder *OptionalEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return *((*unsafe.Pointer)(ptr)) == nil +} + +type dereferenceEncoder struct { + ValueEncoder ValEncoder +} + +func (encoder *dereferenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if *((*unsafe.Pointer)(ptr)) == nil { + stream.WriteNil() + } else { + encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) + } +} + +func (encoder *dereferenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + dePtr := *((*unsafe.Pointer)(ptr)) + if dePtr == nil { + return true + } + return encoder.ValueEncoder.IsEmpty(dePtr) +} + +func (encoder *dereferenceEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { + deReferenced := *((*unsafe.Pointer)(ptr)) + if deReferenced == nil { + return true + } + isEmbeddedPtrNil, converted := encoder.ValueEncoder.(IsEmbeddedPtrNil) + if !converted { + return false + } + fieldPtr := unsafe.Pointer(deReferenced) + return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) +} + +type referenceEncoder struct { + encoder ValEncoder +} + +func (encoder *referenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) +} + +func (encoder *referenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) +} + +type referenceDecoder struct { + decoder ValDecoder +} + +func (decoder *referenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.decoder.Decode(unsafe.Pointer(&ptr), iter) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_slice.go b/integration-test/vendor/github.com/json-iterator/go/reflect_slice.go new file mode 100644 index 000000000..9441d79df --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_slice.go @@ -0,0 +1,99 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "io" + "unsafe" +) + +func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder { + sliceType := typ.(*reflect2.UnsafeSliceType) + decoder := decoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) + return &sliceDecoder{sliceType, decoder} +} + +func encoderOfSlice(ctx *ctx, typ reflect2.Type) ValEncoder { + sliceType := typ.(*reflect2.UnsafeSliceType) + encoder := encoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) + return &sliceEncoder{sliceType, encoder} +} + +type sliceEncoder struct { + sliceType *reflect2.UnsafeSliceType + elemEncoder ValEncoder +} + +func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if encoder.sliceType.UnsafeIsNil(ptr) { + stream.WriteNil() + return + } + length := encoder.sliceType.UnsafeLengthOf(ptr) + if length == 0 { + stream.WriteEmptyArray() + return + } + stream.WriteArrayStart() + encoder.elemEncoder.Encode(encoder.sliceType.UnsafeGetIndex(ptr, 0), stream) + for i := 1; i < length; i++ { + stream.WriteMore() + elemPtr := encoder.sliceType.UnsafeGetIndex(ptr, i) + encoder.elemEncoder.Encode(elemPtr, stream) + } + stream.WriteArrayEnd() + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error()) + } +} + +func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.sliceType.UnsafeLengthOf(ptr) == 0 +} + +type sliceDecoder struct { + sliceType *reflect2.UnsafeSliceType + elemDecoder ValDecoder +} + +func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.doDecode(ptr, iter) + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error()) + } +} + +func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + sliceType := decoder.sliceType + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + sliceType.UnsafeSetNil(ptr) + return + } + if c != '[' { + iter.ReportError("decode slice", "expect [ or n, but found "+string([]byte{c})) + return + } + c = iter.nextToken() + if c == ']' { + sliceType.UnsafeSet(ptr, sliceType.UnsafeMakeSlice(0, 0)) + return + } + iter.unreadByte() + sliceType.UnsafeGrow(ptr, 1) + elemPtr := sliceType.UnsafeGetIndex(ptr, 0) + decoder.elemDecoder.Decode(elemPtr, iter) + length := 1 + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + idx := length + length += 1 + sliceType.UnsafeGrow(ptr, length) + elemPtr = sliceType.UnsafeGetIndex(ptr, idx) + decoder.elemDecoder.Decode(elemPtr, iter) + } + if c != ']' { + iter.ReportError("decode slice", "expect ], but found "+string([]byte{c})) + return + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_struct_decoder.go b/integration-test/vendor/github.com/json-iterator/go/reflect_struct_decoder.go new file mode 100644 index 000000000..92ae912dc --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_struct_decoder.go @@ -0,0 +1,1097 @@ +package jsoniter + +import ( + "fmt" + "io" + "strings" + "unsafe" + + "github.com/modern-go/reflect2" +) + +func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder { + bindings := map[string]*Binding{} + structDescriptor := describeStruct(ctx, typ) + for _, binding := range structDescriptor.Fields { + for _, fromName := range binding.FromNames { + old := bindings[fromName] + if old == nil { + bindings[fromName] = binding + continue + } + ignoreOld, ignoreNew := resolveConflictBinding(ctx.frozenConfig, old, binding) + if ignoreOld { + delete(bindings, fromName) + } + if !ignoreNew { + bindings[fromName] = binding + } + } + } + fields := map[string]*structFieldDecoder{} + for k, binding := range bindings { + fields[k] = binding.Decoder.(*structFieldDecoder) + } + + if !ctx.caseSensitive() { + for k, binding := range bindings { + if _, found := fields[strings.ToLower(k)]; !found { + fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder) + } + } + } + + return createStructDecoder(ctx, typ, fields) +} + +func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structFieldDecoder) ValDecoder { + if ctx.disallowUnknownFields { + return &generalStructDecoder{typ: typ, fields: fields, disallowUnknownFields: true} + } + knownHash := map[int64]struct{}{ + 0: {}, + } + + switch len(fields) { + case 0: + return &skipObjectDecoder{typ} + case 1: + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + return &oneFieldStructDecoder{typ, fieldHash, fieldDecoder} + } + case 2: + var fieldHash1 int64 + var fieldHash2 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldHash1 == 0 { + fieldHash1 = fieldHash + fieldDecoder1 = fieldDecoder + } else { + fieldHash2 = fieldHash + fieldDecoder2 = fieldDecoder + } + } + return &twoFieldsStructDecoder{typ, fieldHash1, fieldDecoder1, fieldHash2, fieldDecoder2} + case 3: + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + var fieldDecoder3 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldName1 == 0 { + fieldName1 = fieldHash + fieldDecoder1 = fieldDecoder + } else if fieldName2 == 0 { + fieldName2 = fieldHash + fieldDecoder2 = fieldDecoder + } else { + fieldName3 = fieldHash + fieldDecoder3 = fieldDecoder + } + } + return &threeFieldsStructDecoder{typ, + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3} + case 4: + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + var fieldDecoder3 *structFieldDecoder + var fieldDecoder4 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldName1 == 0 { + fieldName1 = fieldHash + fieldDecoder1 = fieldDecoder + } else if fieldName2 == 0 { + fieldName2 = fieldHash + fieldDecoder2 = fieldDecoder + } else if fieldName3 == 0 { + fieldName3 = fieldHash + fieldDecoder3 = fieldDecoder + } else { + fieldName4 = fieldHash + fieldDecoder4 = fieldDecoder + } + } + return &fourFieldsStructDecoder{typ, + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4} + case 5: + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + var fieldDecoder3 *structFieldDecoder + var fieldDecoder4 *structFieldDecoder + var fieldDecoder5 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldName1 == 0 { + fieldName1 = fieldHash + fieldDecoder1 = fieldDecoder + } else if fieldName2 == 0 { + fieldName2 = fieldHash + fieldDecoder2 = fieldDecoder + } else if fieldName3 == 0 { + fieldName3 = fieldHash + fieldDecoder3 = fieldDecoder + } else if fieldName4 == 0 { + fieldName4 = fieldHash + fieldDecoder4 = fieldDecoder + } else { + fieldName5 = fieldHash + fieldDecoder5 = fieldDecoder + } + } + return &fiveFieldsStructDecoder{typ, + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5} + case 6: + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + var fieldDecoder3 *structFieldDecoder + var fieldDecoder4 *structFieldDecoder + var fieldDecoder5 *structFieldDecoder + var fieldDecoder6 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldName1 == 0 { + fieldName1 = fieldHash + fieldDecoder1 = fieldDecoder + } else if fieldName2 == 0 { + fieldName2 = fieldHash + fieldDecoder2 = fieldDecoder + } else if fieldName3 == 0 { + fieldName3 = fieldHash + fieldDecoder3 = fieldDecoder + } else if fieldName4 == 0 { + fieldName4 = fieldHash + fieldDecoder4 = fieldDecoder + } else if fieldName5 == 0 { + fieldName5 = fieldHash + fieldDecoder5 = fieldDecoder + } else { + fieldName6 = fieldHash + fieldDecoder6 = fieldDecoder + } + } + return &sixFieldsStructDecoder{typ, + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6} + case 7: + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + var fieldDecoder3 *structFieldDecoder + var fieldDecoder4 *structFieldDecoder + var fieldDecoder5 *structFieldDecoder + var fieldDecoder6 *structFieldDecoder + var fieldDecoder7 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldName1 == 0 { + fieldName1 = fieldHash + fieldDecoder1 = fieldDecoder + } else if fieldName2 == 0 { + fieldName2 = fieldHash + fieldDecoder2 = fieldDecoder + } else if fieldName3 == 0 { + fieldName3 = fieldHash + fieldDecoder3 = fieldDecoder + } else if fieldName4 == 0 { + fieldName4 = fieldHash + fieldDecoder4 = fieldDecoder + } else if fieldName5 == 0 { + fieldName5 = fieldHash + fieldDecoder5 = fieldDecoder + } else if fieldName6 == 0 { + fieldName6 = fieldHash + fieldDecoder6 = fieldDecoder + } else { + fieldName7 = fieldHash + fieldDecoder7 = fieldDecoder + } + } + return &sevenFieldsStructDecoder{typ, + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6, + fieldName7, fieldDecoder7} + case 8: + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + var fieldDecoder3 *structFieldDecoder + var fieldDecoder4 *structFieldDecoder + var fieldDecoder5 *structFieldDecoder + var fieldDecoder6 *structFieldDecoder + var fieldDecoder7 *structFieldDecoder + var fieldDecoder8 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldName1 == 0 { + fieldName1 = fieldHash + fieldDecoder1 = fieldDecoder + } else if fieldName2 == 0 { + fieldName2 = fieldHash + fieldDecoder2 = fieldDecoder + } else if fieldName3 == 0 { + fieldName3 = fieldHash + fieldDecoder3 = fieldDecoder + } else if fieldName4 == 0 { + fieldName4 = fieldHash + fieldDecoder4 = fieldDecoder + } else if fieldName5 == 0 { + fieldName5 = fieldHash + fieldDecoder5 = fieldDecoder + } else if fieldName6 == 0 { + fieldName6 = fieldHash + fieldDecoder6 = fieldDecoder + } else if fieldName7 == 0 { + fieldName7 = fieldHash + fieldDecoder7 = fieldDecoder + } else { + fieldName8 = fieldHash + fieldDecoder8 = fieldDecoder + } + } + return &eightFieldsStructDecoder{typ, + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6, + fieldName7, fieldDecoder7, + fieldName8, fieldDecoder8} + case 9: + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 + var fieldName9 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + var fieldDecoder3 *structFieldDecoder + var fieldDecoder4 *structFieldDecoder + var fieldDecoder5 *structFieldDecoder + var fieldDecoder6 *structFieldDecoder + var fieldDecoder7 *structFieldDecoder + var fieldDecoder8 *structFieldDecoder + var fieldDecoder9 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldName1 == 0 { + fieldName1 = fieldHash + fieldDecoder1 = fieldDecoder + } else if fieldName2 == 0 { + fieldName2 = fieldHash + fieldDecoder2 = fieldDecoder + } else if fieldName3 == 0 { + fieldName3 = fieldHash + fieldDecoder3 = fieldDecoder + } else if fieldName4 == 0 { + fieldName4 = fieldHash + fieldDecoder4 = fieldDecoder + } else if fieldName5 == 0 { + fieldName5 = fieldHash + fieldDecoder5 = fieldDecoder + } else if fieldName6 == 0 { + fieldName6 = fieldHash + fieldDecoder6 = fieldDecoder + } else if fieldName7 == 0 { + fieldName7 = fieldHash + fieldDecoder7 = fieldDecoder + } else if fieldName8 == 0 { + fieldName8 = fieldHash + fieldDecoder8 = fieldDecoder + } else { + fieldName9 = fieldHash + fieldDecoder9 = fieldDecoder + } + } + return &nineFieldsStructDecoder{typ, + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6, + fieldName7, fieldDecoder7, + fieldName8, fieldDecoder8, + fieldName9, fieldDecoder9} + case 10: + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 + var fieldName9 int64 + var fieldName10 int64 + var fieldDecoder1 *structFieldDecoder + var fieldDecoder2 *structFieldDecoder + var fieldDecoder3 *structFieldDecoder + var fieldDecoder4 *structFieldDecoder + var fieldDecoder5 *structFieldDecoder + var fieldDecoder6 *structFieldDecoder + var fieldDecoder7 *structFieldDecoder + var fieldDecoder8 *structFieldDecoder + var fieldDecoder9 *structFieldDecoder + var fieldDecoder10 *structFieldDecoder + for fieldName, fieldDecoder := range fields { + fieldHash := calcHash(fieldName, ctx.caseSensitive()) + _, known := knownHash[fieldHash] + if known { + return &generalStructDecoder{typ, fields, false} + } + knownHash[fieldHash] = struct{}{} + if fieldName1 == 0 { + fieldName1 = fieldHash + fieldDecoder1 = fieldDecoder + } else if fieldName2 == 0 { + fieldName2 = fieldHash + fieldDecoder2 = fieldDecoder + } else if fieldName3 == 0 { + fieldName3 = fieldHash + fieldDecoder3 = fieldDecoder + } else if fieldName4 == 0 { + fieldName4 = fieldHash + fieldDecoder4 = fieldDecoder + } else if fieldName5 == 0 { + fieldName5 = fieldHash + fieldDecoder5 = fieldDecoder + } else if fieldName6 == 0 { + fieldName6 = fieldHash + fieldDecoder6 = fieldDecoder + } else if fieldName7 == 0 { + fieldName7 = fieldHash + fieldDecoder7 = fieldDecoder + } else if fieldName8 == 0 { + fieldName8 = fieldHash + fieldDecoder8 = fieldDecoder + } else if fieldName9 == 0 { + fieldName9 = fieldHash + fieldDecoder9 = fieldDecoder + } else { + fieldName10 = fieldHash + fieldDecoder10 = fieldDecoder + } + } + return &tenFieldsStructDecoder{typ, + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6, + fieldName7, fieldDecoder7, + fieldName8, fieldDecoder8, + fieldName9, fieldDecoder9, + fieldName10, fieldDecoder10} + } + return &generalStructDecoder{typ, fields, false} +} + +type generalStructDecoder struct { + typ reflect2.Type + fields map[string]*structFieldDecoder + disallowUnknownFields bool +} + +func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + var c byte + for c = ','; c == ','; c = iter.nextToken() { + decoder.decodeOneField(ptr, iter) + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + if c != '}' { + iter.ReportError("struct Decode", `expect }, but found `+string([]byte{c})) + } + iter.decrementDepth() +} + +func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *Iterator) { + var field string + var fieldDecoder *structFieldDecoder + if iter.cfg.objectFieldMustBeSimpleString { + fieldBytes := iter.ReadStringAsSlice() + field = *(*string)(unsafe.Pointer(&fieldBytes)) + fieldDecoder = decoder.fields[field] + if fieldDecoder == nil && !iter.cfg.caseSensitive { + fieldDecoder = decoder.fields[strings.ToLower(field)] + } + } else { + field = iter.ReadString() + fieldDecoder = decoder.fields[field] + if fieldDecoder == nil && !iter.cfg.caseSensitive { + fieldDecoder = decoder.fields[strings.ToLower(field)] + } + } + if fieldDecoder == nil { + if decoder.disallowUnknownFields { + msg := "found unknown field: " + field + iter.ReportError("ReadObject", msg) + } + c := iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) + } + iter.Skip() + return + } + c := iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) + } + fieldDecoder.Decode(ptr, iter) +} + +type skipObjectDecoder struct { + typ reflect2.Type +} + +func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + valueType := iter.WhatIsNext() + if valueType != ObjectValue && valueType != NilValue { + iter.ReportError("skipObjectDecoder", "expect object or null") + return + } + iter.Skip() +} + +type oneFieldStructDecoder struct { + typ reflect2.Type + fieldHash int64 + fieldDecoder *structFieldDecoder +} + +func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + if iter.readFieldHash() == decoder.fieldHash { + decoder.fieldDecoder.Decode(ptr, iter) + } else { + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type twoFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder +} + +func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type threeFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder + fieldHash3 int64 + fieldDecoder3 *structFieldDecoder +} + +func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + case decoder.fieldHash3: + decoder.fieldDecoder3.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type fourFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder + fieldHash3 int64 + fieldDecoder3 *structFieldDecoder + fieldHash4 int64 + fieldDecoder4 *structFieldDecoder +} + +func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + case decoder.fieldHash3: + decoder.fieldDecoder3.Decode(ptr, iter) + case decoder.fieldHash4: + decoder.fieldDecoder4.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type fiveFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder + fieldHash3 int64 + fieldDecoder3 *structFieldDecoder + fieldHash4 int64 + fieldDecoder4 *structFieldDecoder + fieldHash5 int64 + fieldDecoder5 *structFieldDecoder +} + +func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + case decoder.fieldHash3: + decoder.fieldDecoder3.Decode(ptr, iter) + case decoder.fieldHash4: + decoder.fieldDecoder4.Decode(ptr, iter) + case decoder.fieldHash5: + decoder.fieldDecoder5.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type sixFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder + fieldHash3 int64 + fieldDecoder3 *structFieldDecoder + fieldHash4 int64 + fieldDecoder4 *structFieldDecoder + fieldHash5 int64 + fieldDecoder5 *structFieldDecoder + fieldHash6 int64 + fieldDecoder6 *structFieldDecoder +} + +func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + case decoder.fieldHash3: + decoder.fieldDecoder3.Decode(ptr, iter) + case decoder.fieldHash4: + decoder.fieldDecoder4.Decode(ptr, iter) + case decoder.fieldHash5: + decoder.fieldDecoder5.Decode(ptr, iter) + case decoder.fieldHash6: + decoder.fieldDecoder6.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type sevenFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder + fieldHash3 int64 + fieldDecoder3 *structFieldDecoder + fieldHash4 int64 + fieldDecoder4 *structFieldDecoder + fieldHash5 int64 + fieldDecoder5 *structFieldDecoder + fieldHash6 int64 + fieldDecoder6 *structFieldDecoder + fieldHash7 int64 + fieldDecoder7 *structFieldDecoder +} + +func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + case decoder.fieldHash3: + decoder.fieldDecoder3.Decode(ptr, iter) + case decoder.fieldHash4: + decoder.fieldDecoder4.Decode(ptr, iter) + case decoder.fieldHash5: + decoder.fieldDecoder5.Decode(ptr, iter) + case decoder.fieldHash6: + decoder.fieldDecoder6.Decode(ptr, iter) + case decoder.fieldHash7: + decoder.fieldDecoder7.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type eightFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder + fieldHash3 int64 + fieldDecoder3 *structFieldDecoder + fieldHash4 int64 + fieldDecoder4 *structFieldDecoder + fieldHash5 int64 + fieldDecoder5 *structFieldDecoder + fieldHash6 int64 + fieldDecoder6 *structFieldDecoder + fieldHash7 int64 + fieldDecoder7 *structFieldDecoder + fieldHash8 int64 + fieldDecoder8 *structFieldDecoder +} + +func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + case decoder.fieldHash3: + decoder.fieldDecoder3.Decode(ptr, iter) + case decoder.fieldHash4: + decoder.fieldDecoder4.Decode(ptr, iter) + case decoder.fieldHash5: + decoder.fieldDecoder5.Decode(ptr, iter) + case decoder.fieldHash6: + decoder.fieldDecoder6.Decode(ptr, iter) + case decoder.fieldHash7: + decoder.fieldDecoder7.Decode(ptr, iter) + case decoder.fieldHash8: + decoder.fieldDecoder8.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type nineFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder + fieldHash3 int64 + fieldDecoder3 *structFieldDecoder + fieldHash4 int64 + fieldDecoder4 *structFieldDecoder + fieldHash5 int64 + fieldDecoder5 *structFieldDecoder + fieldHash6 int64 + fieldDecoder6 *structFieldDecoder + fieldHash7 int64 + fieldDecoder7 *structFieldDecoder + fieldHash8 int64 + fieldDecoder8 *structFieldDecoder + fieldHash9 int64 + fieldDecoder9 *structFieldDecoder +} + +func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + case decoder.fieldHash3: + decoder.fieldDecoder3.Decode(ptr, iter) + case decoder.fieldHash4: + decoder.fieldDecoder4.Decode(ptr, iter) + case decoder.fieldHash5: + decoder.fieldDecoder5.Decode(ptr, iter) + case decoder.fieldHash6: + decoder.fieldDecoder6.Decode(ptr, iter) + case decoder.fieldHash7: + decoder.fieldDecoder7.Decode(ptr, iter) + case decoder.fieldHash8: + decoder.fieldDecoder8.Decode(ptr, iter) + case decoder.fieldHash9: + decoder.fieldDecoder9.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type tenFieldsStructDecoder struct { + typ reflect2.Type + fieldHash1 int64 + fieldDecoder1 *structFieldDecoder + fieldHash2 int64 + fieldDecoder2 *structFieldDecoder + fieldHash3 int64 + fieldDecoder3 *structFieldDecoder + fieldHash4 int64 + fieldDecoder4 *structFieldDecoder + fieldHash5 int64 + fieldDecoder5 *structFieldDecoder + fieldHash6 int64 + fieldDecoder6 *structFieldDecoder + fieldHash7 int64 + fieldDecoder7 *structFieldDecoder + fieldHash8 int64 + fieldDecoder8 *structFieldDecoder + fieldHash9 int64 + fieldDecoder9 *structFieldDecoder + fieldHash10 int64 + fieldDecoder10 *structFieldDecoder +} + +func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.readObjectStart() { + return + } + if !iter.incrementDepth() { + return + } + for { + switch iter.readFieldHash() { + case decoder.fieldHash1: + decoder.fieldDecoder1.Decode(ptr, iter) + case decoder.fieldHash2: + decoder.fieldDecoder2.Decode(ptr, iter) + case decoder.fieldHash3: + decoder.fieldDecoder3.Decode(ptr, iter) + case decoder.fieldHash4: + decoder.fieldDecoder4.Decode(ptr, iter) + case decoder.fieldHash5: + decoder.fieldDecoder5.Decode(ptr, iter) + case decoder.fieldHash6: + decoder.fieldDecoder6.Decode(ptr, iter) + case decoder.fieldHash7: + decoder.fieldDecoder7.Decode(ptr, iter) + case decoder.fieldHash8: + decoder.fieldDecoder8.Decode(ptr, iter) + case decoder.fieldHash9: + decoder.fieldDecoder9.Decode(ptr, iter) + case decoder.fieldHash10: + decoder.fieldDecoder10.Decode(ptr, iter) + default: + iter.Skip() + } + if iter.isObjectEnd() { + break + } + } + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } + iter.decrementDepth() +} + +type structFieldDecoder struct { + field reflect2.StructField + fieldDecoder ValDecoder +} + +func (decoder *structFieldDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + fieldPtr := decoder.field.UnsafeGet(ptr) + decoder.fieldDecoder.Decode(fieldPtr, iter) + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%s: %s", decoder.field.Name(), iter.Error.Error()) + } +} + +type stringModeStringDecoder struct { + elemDecoder ValDecoder + cfg *frozenConfig +} + +func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.elemDecoder.Decode(ptr, iter) + str := *((*string)(ptr)) + tempIter := decoder.cfg.BorrowIterator([]byte(str)) + defer decoder.cfg.ReturnIterator(tempIter) + *((*string)(ptr)) = tempIter.ReadString() +} + +type stringModeNumberDecoder struct { + elemDecoder ValDecoder +} + +func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.WhatIsNext() == NilValue { + decoder.elemDecoder.Decode(ptr, iter) + return + } + + c := iter.nextToken() + if c != '"' { + iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) + return + } + decoder.elemDecoder.Decode(ptr, iter) + if iter.Error != nil { + return + } + c = iter.readByte() + if c != '"' { + iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) + return + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/reflect_struct_encoder.go b/integration-test/vendor/github.com/json-iterator/go/reflect_struct_encoder.go new file mode 100644 index 000000000..152e3ef5a --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/reflect_struct_encoder.go @@ -0,0 +1,211 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "io" + "reflect" + "unsafe" +) + +func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder { + type bindingTo struct { + binding *Binding + toName string + ignored bool + } + orderedBindings := []*bindingTo{} + structDescriptor := describeStruct(ctx, typ) + for _, binding := range structDescriptor.Fields { + for _, toName := range binding.ToNames { + new := &bindingTo{ + binding: binding, + toName: toName, + } + for _, old := range orderedBindings { + if old.toName != toName { + continue + } + old.ignored, new.ignored = resolveConflictBinding(ctx.frozenConfig, old.binding, new.binding) + } + orderedBindings = append(orderedBindings, new) + } + } + if len(orderedBindings) == 0 { + return &emptyStructEncoder{} + } + finalOrderedFields := []structFieldTo{} + for _, bindingTo := range orderedBindings { + if !bindingTo.ignored { + finalOrderedFields = append(finalOrderedFields, structFieldTo{ + encoder: bindingTo.binding.Encoder.(*structFieldEncoder), + toName: bindingTo.toName, + }) + } + } + return &structEncoder{typ, finalOrderedFields} +} + +func createCheckIsEmpty(ctx *ctx, typ reflect2.Type) checkIsEmpty { + encoder := createEncoderOfNative(ctx, typ) + if encoder != nil { + return encoder + } + kind := typ.Kind() + switch kind { + case reflect.Interface: + return &dynamicEncoder{typ} + case reflect.Struct: + return &structEncoder{typ: typ} + case reflect.Array: + return &arrayEncoder{} + case reflect.Slice: + return &sliceEncoder{} + case reflect.Map: + return encoderOfMap(ctx, typ) + case reflect.Ptr: + return &OptionalEncoder{} + default: + return &lazyErrorEncoder{err: fmt.Errorf("unsupported type: %v", typ)} + } +} + +func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ignoreNew bool) { + newTagged := new.Field.Tag().Get(cfg.getTagKey()) != "" + oldTagged := old.Field.Tag().Get(cfg.getTagKey()) != "" + if newTagged { + if oldTagged { + if len(old.levels) > len(new.levels) { + return true, false + } else if len(new.levels) > len(old.levels) { + return false, true + } else { + return true, true + } + } else { + return true, false + } + } else { + if oldTagged { + return true, false + } + if len(old.levels) > len(new.levels) { + return true, false + } else if len(new.levels) > len(old.levels) { + return false, true + } else { + return true, true + } + } +} + +type structFieldEncoder struct { + field reflect2.StructField + fieldEncoder ValEncoder + omitempty bool +} + +func (encoder *structFieldEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + fieldPtr := encoder.field.UnsafeGet(ptr) + encoder.fieldEncoder.Encode(fieldPtr, stream) + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%s: %s", encoder.field.Name(), stream.Error.Error()) + } +} + +func (encoder *structFieldEncoder) IsEmpty(ptr unsafe.Pointer) bool { + fieldPtr := encoder.field.UnsafeGet(ptr) + return encoder.fieldEncoder.IsEmpty(fieldPtr) +} + +func (encoder *structFieldEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { + isEmbeddedPtrNil, converted := encoder.fieldEncoder.(IsEmbeddedPtrNil) + if !converted { + return false + } + fieldPtr := encoder.field.UnsafeGet(ptr) + return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) +} + +type IsEmbeddedPtrNil interface { + IsEmbeddedPtrNil(ptr unsafe.Pointer) bool +} + +type structEncoder struct { + typ reflect2.Type + fields []structFieldTo +} + +type structFieldTo struct { + encoder *structFieldEncoder + toName string +} + +func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteObjectStart() + isNotFirst := false + for _, field := range encoder.fields { + if field.encoder.omitempty && field.encoder.IsEmpty(ptr) { + continue + } + if field.encoder.IsEmbeddedPtrNil(ptr) { + continue + } + if isNotFirst { + stream.WriteMore() + } + stream.WriteObjectField(field.toName) + field.encoder.Encode(ptr, stream) + isNotFirst = true + } + stream.WriteObjectEnd() + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%v.%s", encoder.typ, stream.Error.Error()) + } +} + +func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type emptyStructEncoder struct { +} + +func (encoder *emptyStructEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteEmptyObject() +} + +func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type stringModeNumberEncoder struct { + elemEncoder ValEncoder +} + +func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.writeByte('"') + encoder.elemEncoder.Encode(ptr, stream) + stream.writeByte('"') +} + +func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.elemEncoder.IsEmpty(ptr) +} + +type stringModeStringEncoder struct { + elemEncoder ValEncoder + cfg *frozenConfig +} + +func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + tempStream := encoder.cfg.BorrowStream(nil) + tempStream.Attachment = stream.Attachment + defer encoder.cfg.ReturnStream(tempStream) + encoder.elemEncoder.Encode(ptr, tempStream) + stream.WriteString(string(tempStream.Buffer())) +} + +func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.elemEncoder.IsEmpty(ptr) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/stream.go b/integration-test/vendor/github.com/json-iterator/go/stream.go new file mode 100644 index 000000000..23d8a3ad6 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/stream.go @@ -0,0 +1,210 @@ +package jsoniter + +import ( + "io" +) + +// stream is a io.Writer like object, with JSON specific write functions. +// Error is not returned as return value, but stored as Error member on this stream instance. +type Stream struct { + cfg *frozenConfig + out io.Writer + buf []byte + Error error + indention int + Attachment interface{} // open for customized encoder +} + +// NewStream create new stream instance. +// cfg can be jsoniter.ConfigDefault. +// out can be nil if write to internal buffer. +// bufSize is the initial size for the internal buffer in bytes. +func NewStream(cfg API, out io.Writer, bufSize int) *Stream { + return &Stream{ + cfg: cfg.(*frozenConfig), + out: out, + buf: make([]byte, 0, bufSize), + Error: nil, + indention: 0, + } +} + +// Pool returns a pool can provide more stream with same configuration +func (stream *Stream) Pool() StreamPool { + return stream.cfg +} + +// Reset reuse this stream instance by assign a new writer +func (stream *Stream) Reset(out io.Writer) { + stream.out = out + stream.buf = stream.buf[:0] +} + +// Available returns how many bytes are unused in the buffer. +func (stream *Stream) Available() int { + return cap(stream.buf) - len(stream.buf) +} + +// Buffered returns the number of bytes that have been written into the current buffer. +func (stream *Stream) Buffered() int { + return len(stream.buf) +} + +// Buffer if writer is nil, use this method to take the result +func (stream *Stream) Buffer() []byte { + return stream.buf +} + +// SetBuffer allows to append to the internal buffer directly +func (stream *Stream) SetBuffer(buf []byte) { + stream.buf = buf +} + +// Write writes the contents of p into the buffer. +// It returns the number of bytes written. +// If nn < len(p), it also returns an error explaining +// why the write is short. +func (stream *Stream) Write(p []byte) (nn int, err error) { + stream.buf = append(stream.buf, p...) + if stream.out != nil { + nn, err = stream.out.Write(stream.buf) + stream.buf = stream.buf[nn:] + return + } + return len(p), nil +} + +// WriteByte writes a single byte. +func (stream *Stream) writeByte(c byte) { + stream.buf = append(stream.buf, c) +} + +func (stream *Stream) writeTwoBytes(c1 byte, c2 byte) { + stream.buf = append(stream.buf, c1, c2) +} + +func (stream *Stream) writeThreeBytes(c1 byte, c2 byte, c3 byte) { + stream.buf = append(stream.buf, c1, c2, c3) +} + +func (stream *Stream) writeFourBytes(c1 byte, c2 byte, c3 byte, c4 byte) { + stream.buf = append(stream.buf, c1, c2, c3, c4) +} + +func (stream *Stream) writeFiveBytes(c1 byte, c2 byte, c3 byte, c4 byte, c5 byte) { + stream.buf = append(stream.buf, c1, c2, c3, c4, c5) +} + +// Flush writes any buffered data to the underlying io.Writer. +func (stream *Stream) Flush() error { + if stream.out == nil { + return nil + } + if stream.Error != nil { + return stream.Error + } + _, err := stream.out.Write(stream.buf) + if err != nil { + if stream.Error == nil { + stream.Error = err + } + return err + } + stream.buf = stream.buf[:0] + return nil +} + +// WriteRaw write string out without quotes, just like []byte +func (stream *Stream) WriteRaw(s string) { + stream.buf = append(stream.buf, s...) +} + +// WriteNil write null to stream +func (stream *Stream) WriteNil() { + stream.writeFourBytes('n', 'u', 'l', 'l') +} + +// WriteTrue write true to stream +func (stream *Stream) WriteTrue() { + stream.writeFourBytes('t', 'r', 'u', 'e') +} + +// WriteFalse write false to stream +func (stream *Stream) WriteFalse() { + stream.writeFiveBytes('f', 'a', 'l', 's', 'e') +} + +// WriteBool write true or false into stream +func (stream *Stream) WriteBool(val bool) { + if val { + stream.WriteTrue() + } else { + stream.WriteFalse() + } +} + +// WriteObjectStart write { with possible indention +func (stream *Stream) WriteObjectStart() { + stream.indention += stream.cfg.indentionStep + stream.writeByte('{') + stream.writeIndention(0) +} + +// WriteObjectField write "field": with possible indention +func (stream *Stream) WriteObjectField(field string) { + stream.WriteString(field) + if stream.indention > 0 { + stream.writeTwoBytes(':', ' ') + } else { + stream.writeByte(':') + } +} + +// WriteObjectEnd write } with possible indention +func (stream *Stream) WriteObjectEnd() { + stream.writeIndention(stream.cfg.indentionStep) + stream.indention -= stream.cfg.indentionStep + stream.writeByte('}') +} + +// WriteEmptyObject write {} +func (stream *Stream) WriteEmptyObject() { + stream.writeByte('{') + stream.writeByte('}') +} + +// WriteMore write , with possible indention +func (stream *Stream) WriteMore() { + stream.writeByte(',') + stream.writeIndention(0) +} + +// WriteArrayStart write [ with possible indention +func (stream *Stream) WriteArrayStart() { + stream.indention += stream.cfg.indentionStep + stream.writeByte('[') + stream.writeIndention(0) +} + +// WriteEmptyArray write [] +func (stream *Stream) WriteEmptyArray() { + stream.writeTwoBytes('[', ']') +} + +// WriteArrayEnd write ] with possible indention +func (stream *Stream) WriteArrayEnd() { + stream.writeIndention(stream.cfg.indentionStep) + stream.indention -= stream.cfg.indentionStep + stream.writeByte(']') +} + +func (stream *Stream) writeIndention(delta int) { + if stream.indention == 0 { + return + } + stream.writeByte('\n') + toWrite := stream.indention - delta + for i := 0; i < toWrite; i++ { + stream.buf = append(stream.buf, ' ') + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/stream_float.go b/integration-test/vendor/github.com/json-iterator/go/stream_float.go new file mode 100644 index 000000000..826aa594a --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/stream_float.go @@ -0,0 +1,111 @@ +package jsoniter + +import ( + "fmt" + "math" + "strconv" +) + +var pow10 []uint64 + +func init() { + pow10 = []uint64{1, 10, 100, 1000, 10000, 100000, 1000000} +} + +// WriteFloat32 write float32 to stream +func (stream *Stream) WriteFloat32(val float32) { + if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { + stream.Error = fmt.Errorf("unsupported value: %f", val) + return + } + abs := math.Abs(float64(val)) + fmt := byte('f') + // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. + if abs != 0 { + if float32(abs) < 1e-6 || float32(abs) >= 1e21 { + fmt = 'e' + } + } + stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 32) +} + +// WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster +func (stream *Stream) WriteFloat32Lossy(val float32) { + if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { + stream.Error = fmt.Errorf("unsupported value: %f", val) + return + } + if val < 0 { + stream.writeByte('-') + val = -val + } + if val > 0x4ffffff { + stream.WriteFloat32(val) + return + } + precision := 6 + exp := uint64(1000000) // 6 + lval := uint64(float64(val)*float64(exp) + 0.5) + stream.WriteUint64(lval / exp) + fval := lval % exp + if fval == 0 { + return + } + stream.writeByte('.') + for p := precision - 1; p > 0 && fval < pow10[p]; p-- { + stream.writeByte('0') + } + stream.WriteUint64(fval) + for stream.buf[len(stream.buf)-1] == '0' { + stream.buf = stream.buf[:len(stream.buf)-1] + } +} + +// WriteFloat64 write float64 to stream +func (stream *Stream) WriteFloat64(val float64) { + if math.IsInf(val, 0) || math.IsNaN(val) { + stream.Error = fmt.Errorf("unsupported value: %f", val) + return + } + abs := math.Abs(val) + fmt := byte('f') + // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. + if abs != 0 { + if abs < 1e-6 || abs >= 1e21 { + fmt = 'e' + } + } + stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 64) +} + +// WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster +func (stream *Stream) WriteFloat64Lossy(val float64) { + if math.IsInf(val, 0) || math.IsNaN(val) { + stream.Error = fmt.Errorf("unsupported value: %f", val) + return + } + if val < 0 { + stream.writeByte('-') + val = -val + } + if val > 0x4ffffff { + stream.WriteFloat64(val) + return + } + precision := 6 + exp := uint64(1000000) // 6 + lval := uint64(val*float64(exp) + 0.5) + stream.WriteUint64(lval / exp) + fval := lval % exp + if fval == 0 { + return + } + stream.writeByte('.') + for p := precision - 1; p > 0 && fval < pow10[p]; p-- { + stream.writeByte('0') + } + stream.WriteUint64(fval) + for stream.buf[len(stream.buf)-1] == '0' { + stream.buf = stream.buf[:len(stream.buf)-1] + } +} diff --git a/integration-test/vendor/github.com/json-iterator/go/stream_int.go b/integration-test/vendor/github.com/json-iterator/go/stream_int.go new file mode 100644 index 000000000..d1059ee4c --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/stream_int.go @@ -0,0 +1,190 @@ +package jsoniter + +var digits []uint32 + +func init() { + digits = make([]uint32, 1000) + for i := uint32(0); i < 1000; i++ { + digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0' + if i < 10 { + digits[i] += 2 << 24 + } else if i < 100 { + digits[i] += 1 << 24 + } + } +} + +func writeFirstBuf(space []byte, v uint32) []byte { + start := v >> 24 + if start == 0 { + space = append(space, byte(v>>16), byte(v>>8)) + } else if start == 1 { + space = append(space, byte(v>>8)) + } + space = append(space, byte(v)) + return space +} + +func writeBuf(buf []byte, v uint32) []byte { + return append(buf, byte(v>>16), byte(v>>8), byte(v)) +} + +// WriteUint8 write uint8 to stream +func (stream *Stream) WriteUint8(val uint8) { + stream.buf = writeFirstBuf(stream.buf, digits[val]) +} + +// WriteInt8 write int8 to stream +func (stream *Stream) WriteInt8(nval int8) { + var val uint8 + if nval < 0 { + val = uint8(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint8(nval) + } + stream.buf = writeFirstBuf(stream.buf, digits[val]) +} + +// WriteUint16 write uint16 to stream +func (stream *Stream) WriteUint16(val uint16) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return +} + +// WriteInt16 write int16 to stream +func (stream *Stream) WriteInt16(nval int16) { + var val uint16 + if nval < 0 { + val = uint16(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint16(nval) + } + stream.WriteUint16(val) +} + +// WriteUint32 write uint32 to stream +func (stream *Stream) WriteUint32(val uint32) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + q2 := q1 / 1000 + if q2 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r2 := q1 - q2*1000 + q3 := q2 / 1000 + if q3 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q2]) + } else { + r3 := q2 - q3*1000 + stream.buf = append(stream.buf, byte(q3+'0')) + stream.buf = writeBuf(stream.buf, digits[r3]) + } + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) +} + +// WriteInt32 write int32 to stream +func (stream *Stream) WriteInt32(nval int32) { + var val uint32 + if nval < 0 { + val = uint32(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint32(nval) + } + stream.WriteUint32(val) +} + +// WriteUint64 write uint64 to stream +func (stream *Stream) WriteUint64(val uint64) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + q2 := q1 / 1000 + if q2 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r2 := q1 - q2*1000 + q3 := q2 / 1000 + if q3 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q2]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r3 := q2 - q3*1000 + q4 := q3 / 1000 + if q4 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q3]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r4 := q3 - q4*1000 + q5 := q4 / 1000 + if q5 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q4]) + stream.buf = writeBuf(stream.buf, digits[r4]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r5 := q4 - q5*1000 + q6 := q5 / 1000 + if q6 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q5]) + } else { + stream.buf = writeFirstBuf(stream.buf, digits[q6]) + r6 := q5 - q6*1000 + stream.buf = writeBuf(stream.buf, digits[r6]) + } + stream.buf = writeBuf(stream.buf, digits[r5]) + stream.buf = writeBuf(stream.buf, digits[r4]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) +} + +// WriteInt64 write int64 to stream +func (stream *Stream) WriteInt64(nval int64) { + var val uint64 + if nval < 0 { + val = uint64(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint64(nval) + } + stream.WriteUint64(val) +} + +// WriteInt write int to stream +func (stream *Stream) WriteInt(val int) { + stream.WriteInt64(int64(val)) +} + +// WriteUint write uint to stream +func (stream *Stream) WriteUint(val uint) { + stream.WriteUint64(uint64(val)) +} diff --git a/integration-test/vendor/github.com/json-iterator/go/stream_str.go b/integration-test/vendor/github.com/json-iterator/go/stream_str.go new file mode 100644 index 000000000..54c2ba0b3 --- /dev/null +++ b/integration-test/vendor/github.com/json-iterator/go/stream_str.go @@ -0,0 +1,372 @@ +package jsoniter + +import ( + "unicode/utf8" +) + +// htmlSafeSet holds the value true if the ASCII character with the given +// array position can be safely represented inside a JSON string, embedded +// inside of HTML