diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 55ca0432..59389690 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -13,7 +13,6 @@ import ( "github.com/zeiss/typhoon/pkg/flow/reconciler/transformation" "github.com/zeiss/typhoon/pkg/flow/reconciler/xmltojsontransformation" "github.com/zeiss/typhoon/pkg/flow/reconciler/xslttransformation" - "github.com/zeiss/typhoon/pkg/routing/reconciler/filter" "github.com/zeiss/typhoon/pkg/routing/reconciler/splitter" "github.com/zeiss/typhoon/pkg/sources/reconciler/azservicebusqueuesource" "github.com/zeiss/typhoon/pkg/sources/reconciler/azservicebussource" @@ -61,7 +60,6 @@ func main() { // extensions function.NewController, // routing - filter.NewController, splitter.NewController, ) } diff --git a/config/200-clusterroles.yaml b/config/200-clusterroles.yaml index bec29087..11686402 100644 --- a/config/200-clusterroles.yaml +++ b/config/200-clusterroles.yaml @@ -225,9 +225,6 @@ rules: # Only multi-tenant components receive permissions via RoleBindings to # interact with the Kubernetes API. resourceNames: - - awssnssource-adapter - - zendesksource-adapter - - filter-adapter - splitter-adapter verbs: - update @@ -421,48 +418,6 @@ rules: --- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: filter-adapter - labels: - app.kubernetes.io/part-of: typhoon -rules: -- apiGroups: - - '' - resources: - - events - verbs: - - create - - patch - - update -- apiGroups: - - '' - resources: - - configmaps - verbs: - - get - - list - - watch -- apiGroups: - - routing.typhoon.zeiss.com - resources: - - filters - verbs: - - get - - list - - watch -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - create - - update - ---- - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/config/202-clusterrolebindings.yaml b/config/202-clusterrolebindings.yaml index c3b196da..ea04f043 100644 --- a/config/202-clusterrolebindings.yaml +++ b/config/202-clusterrolebindings.yaml @@ -54,21 +54,6 @@ roleRef: --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding -metadata: - name: filter-adapter - labels: - app.kubernetes.io/part-of: typhoon -subjects: -- kind: ServiceAccount - name: typhoon-controller - namespace: typhoon -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: filter-adapter ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding metadata: name: splitter-adapter labels: diff --git a/config/500-controller.yaml b/config/500-controller.yaml index 97250268..fc271543 100644 --- a/config/500-controller.yaml +++ b/config/500-controller.yaml @@ -77,8 +77,6 @@ spec: - name: XMLTOJSONTRANSFORMATION_IMAGE value: ko://github.com/zeiss/typhoon/cmd/xmltojsontransformation-adapter # Routing adapters - - name: FILTER_IMAGE - value: ko://github.com/zeiss/typhoon/cmd/filter-adapter - name: SPLITTER_IMAGE value: ko://github.com/zeiss/typhoon/cmd/splitter-adapter # Custom build adapters diff --git a/hack/inc.codegen.mk b/hack/inc.codegen.mk index bfe70092..d5eba1f4 100644 --- a/hack/inc.codegen.mk +++ b/hack/inc.codegen.mk @@ -27,43 +27,40 @@ deepcopy: @echo "+ Generating deepcopy funcs for $(API_GROUPS)" $(GO_RUN_TOOLS) k8s.io/code-generator/cmd/deepcopy-gen \ --go-header-file hack/copyright.go.txt \ - --input-dirs $(subst $(space),$(comma),$(api-import-paths)) \ - --trim-path-prefix $(PKG)/ \ - --output-base . \ - --output-file-base zz_generated.deepcopy + --output-file zz_generated.deepcopy.go \ + $(find_dirs_containing_comment_tags "+k8s:deepcopy-gen=") client: @echo "+ Generating clientsets for $(API_GROUPS)" @rm -rf pkg/client/generated/clientset - $(GO_RUN_TOOLS) k8s.io/code-generator/cmd/client-gen \ - --go-header-file hack/copyright.go.txt \ - --input $(subst $(space),$(comma),$(API_GROUPS)) \ - --input-base $(PKG)/pkg/apis \ - --trim-path-prefix $(PKG)/ \ - --output-base . \ - --output-package $(PKG)/pkg/client/generated/clientset + echo "+ Generating clientsets for $$apigrp" ; \ + $(GO_RUN_TOOLS) k8s.io/code-generator/cmd/client-gen \ + --fake-clientset=true \ + --input $(subst $(space),$(comma),$(API_GROUPS)) \ + --input-base $(PKG)/pkg/apis \ + --go-header-file hack/copyright.go.txt \ + --output-pkg $(PKG)/pkg/client/generated/clientset \ + --output-dir pkg/client/generated/clientset; \ lister: @echo "+ Generating listers for $(API_GROUPS)" @rm -rf pkg/client/generated/listers $(GO_RUN_TOOLS) k8s.io/code-generator/cmd/lister-gen \ --go-header-file hack/copyright.go.txt \ - --input-dirs $(subst $(space),$(comma),$(api-import-paths)) \ - --trim-path-prefix $(PKG)/ \ - --output-base . \ - --output-package $(PKG)/pkg/client/generated/listers + --output-pkg $(PKG)/pkg/client/generated/listers \ + --output-dir pkg/client/generated/listers \ + ${api-import-paths} informer: @echo "+ Generating informers for $(API_GROUPS)" @rm -rf pkg/client/generated/informers $(GO_RUN_TOOLS) k8s.io/code-generator/cmd/informer-gen \ --go-header-file hack/copyright.go.txt \ - --input-dirs $(subst $(space),$(comma),$(api-import-paths)) \ - --output-package $(PKG)/pkg/client/generated/informers \ - --trim-path-prefix $(PKG)/ \ - --output-base . \ + --output-pkg $(PKG)/pkg/client/generated/informers \ + --output-dir pkg/client/generated/informers \ --versioned-clientset-package $(PKG)/pkg/client/generated/clientset/internalclientset \ - --listers-package $(PKG)/pkg/client/generated/listers + --listers-package $(PKG)/pkg/client/generated/listers \ + ${api-import-paths} injection: @echo "+ Generating injection for $(API_GROUPS)" diff --git a/hack/lib/build/archive.sh b/hack/lib/build/archive.sh deleted file mode 100644 index deffb625..00000000 --- a/hack/lib/build/archive.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash - -# This library holds utility functions for archiving -# built binaries and releases. - -function os::build::archive::name() { - echo "${OS_RELEASE_ARCHIVE}-${OS_GIT_VERSION}-$1" | tr '+' '-' -} -readonly -f os::build::archive::name - -function os::build::archive::zip() { - local default_name - default_name="$( os::build::archive::name "${platform}" ).zip" - local archive_name="${archive_name:-$default_name}" - echo "++ Creating ${archive_name}" - for file in "$@"; do - pushd "${release_binpath}" &> /dev/null - sha256sum "${file}" - popd &>/dev/null - zip "${OS_OUTPUT_RELEASEPATH}/${archive_name}" -qj "${release_binpath}/${file}" - done -} -readonly -f os::build::archive::zip - -function os::build::archive::tar() { - local base_name - base_name="$( os::build::archive::name "${platform}" )" - local default_name="${base_name}.tar.gz" - local archive_name="${archive_name:-$default_name}" - echo "++ Creating ${archive_name}" - pushd "${release_binpath}" &> /dev/null - find . -type f -exec sha256sum {} \; - if [[ -n "$(which bsdtar)" ]]; then - bsdtar -czf "${OS_OUTPUT_RELEASEPATH}/${archive_name}" -s ",^\.,${base_name}," $@ - else - tar -czf --xattrs-exclude='LIBARCHIVE.xattr.security.selinux' "${OS_OUTPUT_RELEASEPATH}/${archive_name}" --transform="s,^\.,${base_name}," $@ - fi - popd &>/dev/null -} -readonly -f os::build::archive::tar - -# Checks if the filesystem on a partition that the provided path points to is -# supporting hard links. -# -# Input: -# $1 - the path where the hardlinks support test will be done. -# Returns: -# 0 - if hardlinks are supported -# non-zero - if hardlinks aren't supported -function os::build::archive::internal::is_hardlink_supported() { - local path="$1" - # Determine if FS supports hard links - local temp_file=$(TMPDIR="${path}" mktemp) - ln "${temp_file}" "${temp_file}.link" &> /dev/null && unlink "${temp_file}.link" || local supported=$? - rm -f "${temp_file}" - return ${supported:-0} -} -readonly -f os::build::archive::internal::is_hardlink_supported - -# Extract a tar.gz compressed archive in a given directory. If the -# archive contains hardlinks and the underlying filesystem is not -# supporting hardlinks then the a hard dereference will be done. -# -# Input: -# $1 - path to archive file -# $2 - directory where the archive will be extracted -function os::build::archive::extract_tar() { - local archive_file="$1" - local change_dir="$2" - - if [[ -z "${archive_file}" ]]; then - return 0 - fi - - local tar_flags="--strip-components=1" - - # Unpack archive - echo "++ Extracting $(basename ${archive_file})" - if [[ "${archive_file}" == *.zip ]]; then - unzip -o "${archive_file}" -d "${change_dir}" - return 0 - fi - if os::build::archive::internal::is_hardlink_supported "${change_dir}" ; then - # Ensure that tar won't try to set an owner when extracting to an - # nfs mount. Setting ownership on an nfs mount is likely to fail - # even for root. - local mount_type=$(df -P -T "${change_dir}" | tail -n +2 | awk '{print $2}') - if [[ "${mount_type}" = "nfs" ]]; then - tar_flags="${tar_flags} --no-same-owner" - fi - tar mxzf "${archive_file}" ${tar_flags} -C "${change_dir}" - else - local temp_dir=$(TMPDIR=/dev/shm/ mktemp -d) - tar mxzf "${archive_file}" ${tar_flags} -C "${temp_dir}" - pushd "${temp_dir}" &> /dev/null - tar cO --hard-dereference * | tar xf - -C "${change_dir}" - popd &>/dev/null - rm -rf "${temp_dir}" - fi -} -readonly -f os::build::archive::extract_tar diff --git a/hack/lib/build/binaries.sh b/hack/lib/build/binaries.sh deleted file mode 100644 index 9f9a6d71..00000000 --- a/hack/lib/build/binaries.sh +++ /dev/null @@ -1,416 +0,0 @@ -#!/bin/bash - -# This library holds utility functions for building -# and placing Golang binaries for multiple arches. - -# os::build::binaries_from_targets take a list of build targets and return the -# full go package to be built -function os::build::binaries_from_targets() { - local target - for target; do - if [[ -z "${target}" ]]; then - continue - fi - echo "${OS_GO_PACKAGE}/${target}" - done -} -readonly -f os::build::binaries_from_targets - -# Asks golang what it thinks the host platform is. The go tool chain does some -# slightly different things when the target platform matches the host platform. -function os::build::host_platform() { - echo "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" -} -readonly -f os::build::host_platform - -# Create a user friendly version of host_platform for end users -function os::build::host_platform_friendly() { - local platform=${1:-} - if [[ -z "${platform}" ]]; then - platform=$(os::build::host_platform) - fi - if [[ $platform == "windows/amd64" ]]; then - echo "windows" - elif [[ $platform == "darwin/amd64" ]]; then - echo "mac" - elif [[ $platform == "linux/386" ]]; then - echo "linux-32bit" - elif [[ $platform == "linux/amd64" ]]; then - echo "linux-64bit" - elif [[ $platform == "linux/ppc64le" ]]; then - echo "linux-powerpc64" - elif [[ $platform == "linux/arm64" ]]; then - echo "linux-arm64" - elif [[ $platform == "linux/s390x" ]]; then - echo "linux-s390" - else - echo "$(go env GOHOSTOS)-$(go env GOHOSTARCH)" - fi -} -readonly -f os::build::host_platform_friendly - -# This converts from platform/arch to PLATFORM_ARCH, host platform will be -# considered if no parameter passed -function os::build::platform_arch() { - local platform=${1:-} - if [[ -z "${platform}" ]]; then - platform=$(os::build::host_platform) - fi - - echo $(echo ${platform} | tr '[:lower:]/' '[:upper:]_') -} -readonly -f os::build::platform_arch - -# os::build::setup_env will check that the `go` commands is available in -# ${PATH}. If not running on Travis, it will also check that the Go version is -# good enough for the Kubernetes build. -# -# Output Vars: -# export GOPATH - A modified GOPATH to our created tree along with extra -# stuff. -# export GOBIN - This is actively unset if already set as we want binaries -# placed in a predictable place. -function os::build::setup_env() { - os::util::ensure::system_binary_exists 'go' - - if [[ -z "$(which sha256sum)" ]]; then - sha256sum() { - return 0 - } - fi - - # Travis continuous build uses a head go release that doesn't report - # a version number, so we skip this check on Travis. It's unnecessary - # there anyway. - if [[ "${TRAVIS:-}" != "true" ]]; then - local go_version - go_version=($(go version)) - local expected_order=$(printf "%s\n%s\n" "${OS_REQUIRED_GO_VERSION}" "${go_version[2]}") - local actual_order=$(echo "${expected_order}" | sort --version-sort) - if [[ "${actual_order}" != "${expected_order}" ]]; then - os::log::fatal "Detected Go version: ${go_version[*]}. -Builds require Go version ${OS_REQUIRED_GO_VERSION} or greater." - fi - fi - # For any tools that expect this to be set (it is default in golang 1.6), - # force vendor experiment. - export GO15VENDOREXPERIMENT=1 - - unset GOBIN - - # default to OS_OUTPUT_GOPATH if no GOPATH set - if [[ -z "${GOPATH:-}" ]]; then - export OS_OUTPUT_GOPATH=1 - fi - - # use the regular gopath for building - if [[ -z "${OS_OUTPUT_GOPATH:-}" ]]; then - export OS_TARGET_BIN=${GOPATH}/bin - return - fi - - # create a local GOPATH in _output - GOPATH="${OS_OUTPUT}/go" - OS_TARGET_BIN=${GOPATH}/bin - local go_pkg_dir="${GOPATH}/src/${OS_GO_PACKAGE}" - local go_pkg_basedir=$(dirname "${go_pkg_dir}") - - mkdir -p "${go_pkg_basedir}" - rm -f "${go_pkg_dir}" - - # TODO: This symlink should be relative. - ln -s "${OS_ROOT}" "${go_pkg_dir}" - - # lots of tools "just don't work" unless we're in the GOPATH - cd "${go_pkg_dir}" - - # Append OS_EXTRA_GOPATH to the GOPATH if it is defined. - if [[ -n ${OS_EXTRA_GOPATH:-} ]]; then - GOPATH="${GOPATH}:${OS_EXTRA_GOPATH}" - # TODO: needs to handle multiple directories - OS_TARGET_BIN=${OS_EXTRA_GOPATH}/bin - fi - export GOPATH - export OS_TARGET_BIN -} -readonly -f os::build::setup_env - -# Build static binary targets. -# -# Input: -# $@ - targets and go flags. If no targets are set then all binaries targets -# are built. -# OS_BUILD_PLATFORMS - Incoming variable of targets to build for. If unset -# then just the host architecture is built. -function os::build::build_static_binaries() { - CGO_ENABLED=0 os::build::build_binaries -installsuffix=cgo "$@" -} -readonly -f os::build::build_static_binaries - -# Build binary targets specified -# -# Input: -# $@ - targets and go flags. If no targets are set then all binaries targets -# are built. -# OS_BUILD_PLATFORMS - Incoming variable of targets to build for. If unset -# then just the host architecture is built. -function os::build::build_binaries() { - if [[ $# -eq 0 ]]; then - return - fi - local -a binaries=( "$@" ) - # Create a sub-shell so that we don't pollute the outer environment - ( os::build::internal::build_binaries "${binaries[@]+"${binaries[@]}"}" ) -} - -# Build binary targets specified. Should always be run in a sub-shell so we don't leak GOBIN -# -# Input: -# $@ - targets and go flags. If no targets are set then all binaries targets -# are built. -# OS_BUILD_PLATFORMS - Incoming variable of targets to build for. If unset -# then just the host architecture is built. -os::build::internal::build_binaries() { - # Check for `go` binary and set ${GOPATH}. - os::build::setup_env - - # Fetch the version. - local version_ldflags - version_ldflags=$(os::build::ldflags) - - local goflags - # Use eval to preserve embedded quoted strings. - eval "goflags=(${OS_GOFLAGS:-})" - - local arg - for arg; do - if [[ "${arg}" == -* ]]; then - # Assume arguments starting with a dash are flags to pass to go. - goflags+=("${arg}") - fi - done - - os::build::export_targets "$@" - - if [[ ! "${targets[@]:+${targets[@]}}" || ! "${binaries[@]:+${binaries[@]}}" ]]; then - return 0 - fi - - local -a nonstatics=() - local -a tests=() - for binary in "${binaries[@]-}"; do - if [[ "${binary}" =~ ".test"$ ]]; then - tests+=($binary) - else - nonstatics+=($binary) - fi - done - - local pkgdir="${OS_OUTPUT_PKGDIR}" - if [[ "${CGO_ENABLED-}" == "0" ]]; then - pkgdir+="/static" - fi - - local host_platform=$(os::build::host_platform) - local platform - for platform in "${platforms[@]+"${platforms[@]}"}"; do - echo "++ Building go targets for ${platform}:" "${targets[@]}" - mkdir -p "${OS_OUTPUT_BINPATH}/${platform}" - - # output directly to the desired location - if [[ $platform == $host_platform ]]; then - export GOBIN="${OS_OUTPUT_BINPATH}/${platform}" - else - unset GOBIN - fi - - local platform_gotags_envvar=OS_GOFLAGS_TAGS_$(os::build::platform_arch ${platform}) - local platform_gotags_test_envvar=OS_GOFLAGS_TAGS_TEST_$(os::build::platform_arch ${platform}) - - # work around https://github.com/golang/go/issues/11887 - local local_ldflags="${version_ldflags}" - if [[ "${platform}" == "darwin/amd64" ]]; then - local_ldflags+=" -s" - fi - - #Add Windows File Properties/Version Info and Icon Resource for oc.exe - if [[ "$platform" == "windows/amd64" ]]; then - os::build::generate_windows_versioninfo - fi - - if [[ ${#nonstatics[@]} -gt 0 ]]; then - GOOS=${platform%/*} GOARCH=${platform##*/} go install \ - -pkgdir "${pkgdir}/${platform}" \ - -tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \ - -ldflags="${local_ldflags}" \ - "${goflags[@]:+${goflags[@]}}" \ - "${nonstatics[@]}" - - # GOBIN is not supported on cross-compile in Go 1.5+ - move to the correct target - if [[ $platform != $host_platform ]]; then - local platform_src="/${platform//\//_}" - mv "${OS_TARGET_BIN}/${platform_src}/"* "${OS_OUTPUT_BINPATH}/${platform}/" - fi - fi - - if [[ "$platform" == "windows/amd64" ]]; then - os::build::clean_windows_versioninfo - fi - - for test in "${tests[@]:+${tests[@]}}"; do - local outfile="${OS_OUTPUT_BINPATH}/${platform}/$(basename ${test})" - # disabling cgo allows use of delve - CGO_ENABLED="${OS_TEST_CGO_ENABLED:-}" GOOS=${platform%/*} GOARCH=${platform##*/} go test \ - -pkgdir "${pkgdir}/${platform}" \ - -tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_test_envvar:-}" \ - -ldflags "${local_ldflags}" \ - -i -c -o "${outfile}" \ - "${goflags[@]:+${goflags[@]}}" \ - "$(dirname ${test})" - done - done -} -readonly -f os::build::build_binaries - - # Generates the set of target packages, binaries, and platforms to build for. -# Accepts binaries via $@, and platforms via OS_BUILD_PLATFORMS, or defaults to -# the current platform. -function os::build::export_targets() { - platforms=("${OS_BUILD_PLATFORMS[@]:+${OS_BUILD_PLATFORMS[@]}}") - - targets=() - local arg - for arg; do - if [[ "${arg}" != -* ]]; then - targets+=("${arg}") - fi - done - - binaries=($(os::build::binaries_from_targets "${targets[@]-}")) -} -readonly -f os::build::export_targets - -# This will take $@ from $GOPATH/bin and copy them to the appropriate -# place in ${OS_OUTPUT_BINDIR} -# -# If OS_RELEASE_ARCHIVE is set, tar archives prefixed with OS_RELEASE_ARCHIVE for -# each of OS_BUILD_PLATFORMS are created. -# -# Ideally this wouldn't be necessary and we could just set GOBIN to -# OS_OUTPUT_BINDIR but that won't work in the face of cross compilation. 'go -# install' will place binaries that match the host platform directly in $GOBIN -# while placing cross compiled binaries into `platform_arch` subdirs. This -# complicates pretty much everything else we do around packaging and such. -function os::build::place_bins() { - ( - local host_platform - host_platform=$(os::build::host_platform) - - if [[ "${OS_RELEASE_ARCHIVE-}" != "" ]]; then - os::build::version::get_vars - mkdir -p "${OS_OUTPUT_RELEASEPATH}" - fi - - os::build::export_targets "$@" - for platform in "${platforms[@]+"${platforms[@]}"}"; do - # The substitution on platform_src below will replace all slashes with - # underscores. It'll transform darwin/amd64 -> darwin_amd64. - local platform_src="/${platform//\//_}" - - # Skip this directory if the platform has no binaries. - if [[ ! -d "${OS_OUTPUT_BINPATH}/${platform}" ]]; then - continue - fi - - # Create an array of binaries to release. Append .exe variants if the platform is windows. - local -a binaries=() - for binary in "${targets[@]}"; do - binary=$(basename $binary) - if [[ $platform == "windows/amd64" ]]; then - binaries+=("${binary}.exe") - else - binaries+=("${binary}") - fi - done - done - ) -} -readonly -f os::build::place_bins - -# os::build::ldflag() abstracts ldflag inconsistency across Go versions. -# TODO: remove -function os::build::ldflag() { - local key=${1} - local val=${2} - - echo "-X ${key}=${val}" -} -readonly -f os::build::ldflag - -# os::build::require_clean_tree exits if the current Git tree is not clean. -function os::build::require_clean_tree() { - if ! git diff-index --quiet HEAD -- || test $(git ls-files --exclude-standard --others | wc -l) != 0; then - echo "You can't have any staged or dirty files in $(pwd) for this command." - echo "Either commit them or unstage them to continue." - exit 1 - fi -} -readonly -f os::build::require_clean_tree - -# os::build::commit_range takes one or two arguments - if the first argument is an -# integer, it is assumed to be a pull request and the local origin/pr/# branch is -# used to determine the common range with the second argument. If the first argument -# is not an integer, it is assumed to be a Git commit range and output directly. -function os::build::commit_range() { - local remote - remote="${UPSTREAM_REMOTE:-origin}" - if [[ "$1" =~ ^-?[0-9]+$ ]]; then - local target - target="$(git rev-parse ${remote}/pr/$1)" - if [[ $? -ne 0 ]]; then - echo "Branch does not exist, or you have not configured ${remote}/pr/* style branches from GitHub" 1>&2 - exit 1 - fi - - local base - base="$(git merge-base ${target} $2)" - if [[ $? -ne 0 ]]; then - echo "Branch has no common commits with $2" 1>&2 - exit 1 - fi - if [[ "${base}" == "${target}" ]]; then - - # DO NOT TRUST THIS CODE - merged="$(git rev-list --reverse ${target}..$2 --ancestry-path | head -1)" - if [[ -z "${merged}" ]]; then - echo "Unable to find the commit that merged ${remote}/pr/$1" 1>&2 - exit 1 - fi - #if [[ $? -ne 0 ]]; then - # echo "Unable to find the merge commit for $1: ${merged}" 1>&2 - # exit 1 - #fi - echo "++ pr/$1 appears to have merged at ${merged}" 1>&2 - leftparent="$(git rev-list --parents -n 1 ${merged} | cut -f2 -d ' ')" - if [[ $? -ne 0 ]]; then - echo "Unable to find the left-parent for the merge of for $1" 1>&2 - exit 1 - fi - base="$(git merge-base ${target} ${leftparent})" - if [[ $? -ne 0 ]]; then - echo "Unable to find the common commit between ${leftparent} and $1" 1>&2 - exit 1 - fi - echo "${base}..${target}" - exit 0 - #echo "Branch has already been merged to upstream master, use explicit range instead" 1>&2 - #exit 1 - fi - - echo "${base}...${target}" - exit 0 - fi - - echo "$1" -} -readonly -f os::build::commit_range diff --git a/hack/lib/build/environment.sh b/hack/lib/build/environment.sh deleted file mode 100644 index 70e2e09a..00000000 --- a/hack/lib/build/environment.sh +++ /dev/null @@ -1,281 +0,0 @@ -#!/bin/bash - -# This script holds library functions for setting up the Docker container build environment - -# os::build::environment::create creates a docker container with the default variables. -# arguments are passed directly to the container, OS_BUILD_ENV_GOLANG, OS_BUILD_ENV_IMAGE, -# and OS_RELEASE_DOCKER_ARGS can be used to customize the container. The docker socket -# is mounted by default and the output of the command is the container id. -function os::build::environment::create() { - set -o errexit - local release_image="${OS_BUILD_ENV_IMAGE}" - local additional_context="${OS_BUILD_ENV_DOCKER_ARGS:-}" - - local workingdir - workingdir=$( os::build::environment::release::workingdir ) - additional_context+=" -w ${workingdir}" - - if [[ "${OS_BUILD_ENV_USE_DOCKER:-y}" == "y" ]]; then - additional_context+=" --privileged -v /var/run/docker.sock:/var/run/docker.sock" - - if [[ "${OS_BUILD_ENV_LOCAL_DOCKER:-n}" == "y" ]]; then - # if OS_BUILD_ENV_LOCAL_DOCKER==y, add the local OS_ROOT as the bind mount to the working dir - # and set the running user to the current user - additional_context+=" -v ${OS_ROOT}:${workingdir} -u $(id -u)" - elif [[ -n "${OS_BUILD_ENV_VOLUME:-}" ]]; then - if docker volume inspect "${OS_BUILD_ENV_VOLUME}" >/dev/null 2>&1; then - os::log::debug "Re-using volume ${OS_BUILD_ENV_VOLUME}" - else - # if OS_BUILD_ENV_VOLUME is set and no volume already exists, create a docker volume to - # store the working output so successive iterations can reuse shared code. - os::log::debug "Creating volume ${OS_BUILD_ENV_VOLUME}" - docker volume create --name "${OS_BUILD_ENV_VOLUME}" > /dev/null - fi - - if [[ -n "${OS_BUILD_ENV_TMP_VOLUME:-}" ]]; then - if docker volume inspect "${OS_BUILD_ENV_TMP_VOLUME}" >/dev/null 2>&1; then - os::log::debug "Re-using volume ${OS_BUILD_ENV_TMP_VOLUME}" - else - # if OS_BUILD_ENV_VOLUME is set and no volume already exists, create a docker volume to - # store the working output so successive iterations can reuse shared code. - os::log::debug "Creating volume ${OS_BUILD_ENV_TMP_VOLUME}" - docker volume create --name "${OS_BUILD_ENV_TMP_VOLUME}" >/dev/null - fi - additional_context+=" -v ${OS_BUILD_ENV_TMP_VOLUME}:/tmp" - fi - additional_context+=" -v ${OS_BUILD_ENV_VOLUME}:${workingdir}" - fi - fi - - if [[ -n "${OS_BUILD_ENV_FROM_ARCHIVE-}" ]]; then - additional_context+=" -e OS_VERSION_FILE=/tmp/os-version-defs" - else - additional_context+=" -e OS_VERSION_FILE=" - fi - - declare -a cmd=( ) - declare -a env=( ) - local prefix=1 - for arg in "${@:1}"; do - if [[ "${arg}" != *"="* ]]; then - prefix=0 - fi - if [[ "${prefix}" -eq 1 ]]; then - env+=( "-e" "${arg}" ) - else - cmd+=( "${arg}" ) - fi - done - if [[ -t 0 ]]; then - if [[ "${#cmd[@]}" -eq 0 ]]; then - cmd=( "/bin/sh" ) - fi - if [[ "${cmd[0]}" == "/bin/sh" || "${cmd[0]}" == "/bin/bash" ]]; then - additional_context+=" -it" - else - # container exit races with log collection so we - # need to sleep at the end but preserve the exit - # code of whatever the user asked for us to run - cmd=( '/bin/bash' '-c' "${cmd[*]}; return_code=\$?; sleep 1; exit \${return_code}" ) - fi - fi - - # Create a new container from the release environment - os::log::debug "Creating container: \`docker create ${additional_context} ${env[@]+"${env[@]}"} ${release_image} ${cmd[@]+"${cmd[@]}"}" - docker create ${additional_context} "${env[@]+"${env[@]}"}" "${release_image}" "${cmd[@]+"${cmd[@]}"}" -} -readonly -f os::build::environment::create - -# os::build::environment::release::workingdir calculates the working directory for the current -# release image. -function os::build::environment::release::workingdir() { - if [[ -n "${OS_BUILD_ENV_WORKINGDIR-}" ]]; then - echo "${OS_BUILD_ENV_WORKINGDIR}" - return 0 - fi - set -o errexit - # get working directory - local container - container="$(docker create "${release_image}")" - local workingdir - workingdir="$(docker inspect -f '{{ index . "Config" "WorkingDir" }}' "${container}")" - docker rm "${container}" > /dev/null - echo "${workingdir}" -} -readonly -f os::build::environment::release::workingdir - -# os::build::environment::cleanup stops and removes the container named in the argument -# (unless OS_BUILD_ENV_LEAVE_CONTAINER is set, in which case it will only stop the container). -function os::build::environment::cleanup() { - local container=$1 - local volume=$2 - local tmp_volume=$3 - os::log::debug "Stopping container ${container}" - docker stop --time=0 "${container}" > /dev/null || true - if [[ -z "${OS_BUILD_ENV_LEAVE_CONTAINER:-}" ]]; then - os::log::debug "Removing container ${container}" - docker rm "${container}" > /dev/null - - if [[ -z "${OS_BUILD_ENV_REUSE_TMP_VOLUME:-}" ]]; then - os::log::debug "Removing tmp build volume" - os::build::environment::remove_volume "${tmp_volume}" - fi - if [[ -n "${OS_BUILD_ENV_CLEAN_BUILD_VOLUME:-}" ]]; then - os::log::debug "Removing build volume" - os::build::environment::remove_volume "${volume}" - fi - fi -} -readonly -f os::build::environment::cleanup - -# os::build::environment::start starts the container provided as the first argument -# using whatever content exists in the container already. -function os::build::environment::start() { - local container=$1 - - os::log::debug "Starting container ${container}" - if [[ "$( docker inspect --type container -f '{{ .Config.OpenStdin }}' "${container}" )" == "true" ]]; then - docker start -ia "${container}" - else - docker start "${container}" > /dev/null - os::log::debug "Following container logs" - docker logs -f "${container}" - fi - - local exitcode - exitcode="$( docker inspect --type container -f '{{ .State.ExitCode }}' "${container}" )" - - os::log::debug "Container exited with ${exitcode}" - - # extract content from the image - if [[ -n "${OS_BUILD_ENV_PRESERVE-}" ]]; then - local workingdir - workingdir="$(docker inspect -f '{{ index . "Config" "WorkingDir" }}' "${container}")" - local oldIFS="${IFS}" - IFS=: - for path in ${OS_BUILD_ENV_PRESERVE}; do - local parent=. - if [[ "${path}" != "." ]]; then - parent="$( dirname "${path}" )" - mkdir -p "${parent}" - fi - os::log::debug "Copying from ${container}:${workingdir}/${path} to ${parent}" - if ! output="$( docker cp "${container}:${workingdir}/${path}" "${parent}" 2>&1 )"; then - os::log::warning "Copying ${path} from the container failed!" - os::log::warning "${output}" - fi - done - IFS="${oldIFS}" - fi - return "${exitcode}" -} -readonly -f os::build::environment::start - -# os::build::environment::withsource starts the container provided as the first argument -# after copying in the contents of the current Git repository at HEAD (or, if specified, -# the ref specified in the second argument). -function os::build::environment::withsource() { - local container=$1 - local commit=${2:-HEAD} - - if [[ -n "${OS_BUILD_ENV_LOCAL_DOCKER-}" ]]; then - os::build::environment::start "${container}" - return - fi - - local workingdir - workingdir="$(docker inspect -f '{{ index . "Config" "WorkingDir" }}' "${container}")" - - if [[ -n "${OS_BUILD_ENV_FROM_ARCHIVE-}" ]]; then - # Generate version definitions. Tree state is clean because we are pulling from git directly. - OS_GIT_TREE_STATE=clean os::build::version::get_vars - os::build::version::save_vars > "/tmp/os-version-defs" - - os::log::debug "Generating source code archive" - tar -cf - -C /tmp/ os-version-defs | docker cp - "${container}:/tmp" - git archive --format=tar "${commit}" | docker cp - "${container}:${workingdir}" - os::build::environment::start "${container}" - return - fi - - local excluded=() - local oldIFS="${IFS}" - IFS=: - for exclude in ${OS_BUILD_ENV_EXCLUDE:-_output}; do - excluded+=("--exclude=${exclude}") - done - IFS="${oldIFS}" - if which rsync &>/dev/null && [[ -n "${OS_BUILD_ENV_VOLUME-}" ]]; then - os::log::debug "Syncing source using \`rsync\`" - if ! rsync -a --blocking-io "${excluded[@]}" --delete --omit-dir-times --numeric-ids -e "docker run --rm -i -v \"${OS_BUILD_ENV_VOLUME}:${workingdir}\" --entrypoint=/bin/bash \"${OS_BUILD_ENV_IMAGE}\" -c '\$@'" . remote:"${workingdir}"; then - os::log::debug "Falling back to \`tar\` and \`docker cp\` as \`rsync\` is not in container" - tar -cf - "${excluded[@]}" . | docker cp - "${container}:${workingdir}" - fi - else - os::log::debug "Syncing source using \`tar\` and \`docker cp\`" - tar -cf - "${excluded[@]}" . | docker cp - "${container}:${workingdir}" - fi - - os::build::environment::start "${container}" -} -readonly -f os::build::environment::withsource - -function os::build::environment::volume_name() { - local prefix=$1 - local commit=$2 - local volume=$3 - - if [[ -z "${volume}" ]]; then - volume="${prefix}-$( git rev-parse "${commit}" )" - fi - - echo "${volume}" | tr '[:upper:]' '[:lower:]' -} -readonly -f os::build::environment::volume_name - -function os::build::environment::remove_volume() { - local volume=$1 - - if docker volume inspect "${volume}" >/dev/null 2>&1; then - os::log::debug "Removing volume ${volume}" - docker volume rm "${volume}" >/dev/null - fi -} -readonly -f os::build::environment::remove_volume - -# os::build::environment::run launches the container with the provided arguments and -# the current commit (defaults to HEAD). The container is automatically cleaned up. -function os::build::environment::run() { - local commit="${OS_GIT_COMMIT:-HEAD}" - local volume - local tmp_volume - - volume="$( os::build::environment::volume_name "origin-build" "${commit}" "${OS_BUILD_ENV_REUSE_VOLUME:-}" )" - tmp_volume="$( os::build::environment::volume_name "origin-build-tmp" "${commit}" "${OS_BUILD_ENV_REUSE_TMP_VOLUME:-}" )" - - export OS_BUILD_ENV_VOLUME="${volume}" - export OS_BUILD_ENV_TMP_VOLUME="${tmp_volume}" - - if [[ -n "${OS_BUILD_ENV_VOLUME_FORCE_NEW:-}" ]]; then - os::build::environment::remove_volume "${volume}" - os::build::environment::remove_volume "${tmp_volume}" - fi - - if [[ -n "${OS_BUILD_ENV_PULL_IMAGE:-}" ]]; then - os::log::info "Pulling the ${OS_BUILD_ENV_IMAGE} image to update it..." - docker pull "${OS_BUILD_ENV_IMAGE}" - fi - - os::log::debug "Using commit ${commit}" - os::log::debug "Using volume ${volume}" - os::log::debug "Using tmp volume ${tmp_volume}" - - local container - container="$( os::build::environment::create "$@" )" - trap "os::build::environment::cleanup ${container} ${volume} ${tmp_volume}" EXIT - - os::log::debug "Using container ${container}" - - os::build::environment::withsource "${container}" "${commit}" -} -readonly -f os::build::environment::run diff --git a/hack/lib/build/images.sh b/hack/lib/build/images.sh deleted file mode 100644 index 2865527f..00000000 --- a/hack/lib/build/images.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash - -# This library holds utility functions for building container images. - -# os::build::image builds an image from a directory, to a tag or tags The default -# behavior is to use the imagebuilder binary if it is available on the path with -# fallback to docker build if it is not available. -# -# Globals: -# - OS_BUILD_IMAGE_ARGS -# - OS_BUILD_IMAGE_NUM_RETRIES -# Arguments: -# - 1: the directory in which to build -# - 2: the tag to apply to the image -# Returns: -# None -function os::build::image() { - local tag=$1 - local directory=$2 - local extra_tag - - if [[ ! "${tag}" == *":"* ]]; then - # if no tag was specified in the image name, - # tag with :latest and the release commit, if - # available, falling back to the last commit - # if no release commit is recorded - local release_commit - release_commit="${OS_RELEASE_COMMIT-}" - if [[ -z "${release_commit}" && -f "${OS_OUTPUT_RELEASEPATH}/.commit" ]]; then - release_commit="$( cat "${OS_OUTPUT_RELEASEPATH}/.commit" )" - fi - if [[ -z "${release_commit}" ]]; then - release_commit="$( git log -1 --pretty=%h )" - fi - extra_tag="${tag}:${release_commit}" - - tag="${tag}:latest" - fi - - local result=1 - local image_build_log - image_build_log="$( mktemp "${BASETMPDIR}/imagelogs.XXXXX" )" - for (( i = 0; i < "${OS_BUILD_IMAGE_NUM_RETRIES:-2}"; i++ )); do - if [[ "${i}" -gt 0 ]]; then - os::log::internal::prefix_lines "[${tag%:*}]" "$( cat "${image_build_log}" )" - os::log::warning "Retrying image build for ${tag}, attempt ${i}..." - fi - - if os::build::image::internal::generic "${tag}" "${directory}" "${extra_tag:-}" >"${image_build_log}" 2>&1; then - result=0 - break - fi - done - - os::log::internal::prefix_lines "[${tag%:*}]" "$( cat "${image_build_log}" )" - return "${result}" -} -readonly -f os::build::image - -# os::build::image::internal::generic builds a container image using either imagebuilder -# or docker, defaulting to imagebuilder if present -# -# Globals: -# - OS_BUILD_IMAGE_ARGS -# Arguments: -# - 1: the directory in which to build -# - 2: the tag to apply to the image -# - 3: optionally, extra tags to add -# Returns: -# None -function os::build::image::internal::generic() { - local directory=$2 - - local result=1 - if os::util::find::system_binary 'imagebuilder' >/dev/null; then - if os::build::image::internal::imagebuilder "$@"; then - result=0 - fi - else - os::log::warning "Unable to locate 'imagebuilder' on PATH, falling back to Docker build" - if os::build::image::internal::docker "$@"; then - result=0 - fi - fi - - # ensure the temporary contents are cleaned up - git clean -fdx "${directory}" - return "${result}" -} -readonly -f os::build::image::internal::generic - -# os::build::image::internal::imagebuilder builds a container image using imagebuilder -# -# Globals: -# - OS_BUILD_IMAGE_ARGS -# Arguments: -# - 1: the directory in which to build -# - 2: the tag to apply to the image -# - 3: optionally, extra tags to add -# Returns: -# None -function os::build::image::internal::imagebuilder() { - local tag=$1 - local directory=$2 - local extra_tag="${3-}" - local options=() - - if [[ -n "${OS_BUILD_IMAGE_ARGS:-}" ]]; then - options=( ${OS_BUILD_IMAGE_ARGS} ) - fi - - if [[ -n "${extra_tag}" ]]; then - options+=( -t "${extra_tag}" ) - fi - - imagebuilder "${options[@]:-}" -t "${tag}" "${directory}" -} -readonly -f os::build::image::internal::imagebuilder - -# os::build::image::internal::docker builds a container image using docker -# -# Globals: -# - OS_BUILD_IMAGE_ARGS -# Arguments: -# - 1: the directory in which to build -# - 2: the tag to apply to the image -# - 3: optionally, extra tags to add -# Returns: -# None -function os::build::image::internal::docker() { - local tag=$1 - local directory=$2 - local extra_tag="${3-}" - local options=() - - if ! docker build ${OS_BUILD_IMAGE_ARGS:-} -t "${tag}" "${directory}"; then - return 1 - fi - - if [[ -n "${extra_tag}" ]]; then - docker tag "${tag}" "${extra_tag}" - fi -} -readonly -f os::build::image::internal::docker diff --git a/hack/lib/build/release.sh b/hack/lib/build/release.sh deleted file mode 100644 index 974c539b..00000000 --- a/hack/lib/build/release.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# This library holds utility functions for building releases. - -# os::build::release::check_for_rpms checks that an RPM release has been built -function os::build::release::check_for_rpms() { - if [[ ! -d "${OS_OUTPUT_RPMPATH}" || ! -d "${OS_OUTPUT_RPMPATH}/repodata" ]]; then - relative_release_path="$( os::util::repository_relative_path "${OS_OUTPUT_RELEASEPATH}" )" - relative_bin_path="$( os::util::repository_relative_path "${OS_OUTPUT_BINPATH}" )" - os::log::fatal "No release RPMs have been built! RPMs are necessary to build container images. -Build them with: - $ OS_BUILD_ENV_PRESERVE=${relative_bin_path}:${relative_release_path} hack/env make build-rpms" - fi -} diff --git a/hack/lib/build/rpm.sh b/hack/lib/build/rpm.sh deleted file mode 100644 index babd1983..00000000 --- a/hack/lib/build/rpm.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -# This library holds utilities for building RPMs from Origin. - -# os::build::rpm::generate_nevra_vars determines the NEVRA of the RPMs -# that would be built from the current git state. -# -# Globals: -# - OS_GIT_VERSION -# Arguments: -# - None -# Exports: -# - OS_RPM_VERSION -# - OS_RPM_RELEASE -# - OS_RPM_ARCHITECTURE -function os::build::rpm::get_nvra_vars() { - # the package name can be overwritten but is normally 'origin' - OS_RPM_ARCHITECTURE="$(uname -i)" - - # we can extract the pacakge version from the build version - os::build::version::get_vars - if [[ "${OS_GIT_VERSION}" =~ ^v([0-9](\.[0-9]+)*)(.*) ]]; then - OS_RPM_VERSION="${BASH_REMATCH[1]}" - metadata="${BASH_REMATCH[3]}" - else - os::log::fatal "Malformed \$OS_GIT_VERSION: ${OS_GIT_VERSION}" - fi - - # we can generate the package release from the git version metadata - # OS_GIT_VERSION will always have metadata, but either contain - # pre-release information _and_ build metadata, or only the latter. - # Build metadata may or may not contain the number of commits past - # the last tag. If no commit number exists, we are on a tag and use 0. - # ex. - # -alpha.0+shasums-123-dirty - # -alpha.0+shasums-123 - # -alpha.0+shasums-dirty - # -alpha.0+shasums - # +shasums-123-dirty - # +shasums-123 - # +shasums-dirty - # +shasums - if [[ "${metadata:0:1}" == "+" ]]; then - # we only have build metadata, but need to massage it so - # we can generate a valid RPM release from it - if [[ "${metadata}" =~ ^\+([a-z0-9]{7,40})(-([0-9]+))?(-dirty)?$ ]]; then - build_sha="${BASH_REMATCH[1]}" - build_num="${BASH_REMATCH[3]:-0}" - else - os::log::fatal "Malformed git version metadata: ${metadata}" - fi - OS_RPM_RELEASE="1.${build_num}.${build_sha}" - elif [[ "${metadata:0:1}" == "-" ]]; then - # we have both build metadata and pre-release info - if [[ "${metadata}" =~ ^-([^\+]+)\+([a-z0-9]{7,40})(-([0-9]+))?(-dirty)?$ ]]; then - pre_release="${BASH_REMATCH[1]}" - build_sha="${BASH_REMATCH[2]}" - build_num="${BASH_REMATCH[4]:-0}" - else - os::log::fatal "Malformed git version metadata: ${metadata}" - fi - OS_RPM_RELEASE="0.${pre_release}.${build_num}.${build_sha}" - else - os::log::fatal "Malformed git version metadata: ${metadata}" - fi - - OS_RPM_GIT_VARS=$( os::build::version::save_vars | tr '\n' ' ' ) - - export OS_RPM_VERSION OS_RPM_RELEASE OS_RPM_ARCHITECTURE OS_RPM_GIT_VARS -} - - -# os::build::rpm::format_nvra formats the rpm NVRA vars generated by -# os::build::rpm::get_nvra_vars and will generate them if necessary -# -# Globals: -# - OS_RPM_NAME -# - OS_RPM_VERSION -# - OS_RPM_RELEASE -# - OS_RPM_ARCHITECTURE -# Arguments: -# None -# Returns: -# None -function os::build::rpm::format_nvra() { - if [[ -z "${OS_RPM_VERSION:-}" || -z "${OS_RPM_RELEASE:-}" ]]; then - os::build::rpm::get_nvra_vars - fi - if [[ -z "${OS_RPM_NAME-}" ]]; then - OS_RPM_SPECFILE="$( find "${OS_ROOT}" -name *.spec )" - OS_RPM_NAME="$( rpmspec -q --qf '%{name}\n' "${OS_RPM_SPECFILE}" | head -1 )" - fi - - echo "${OS_RPM_NAME}-${OS_RPM_VERSION}-${OS_RPM_RELEASE}.${OS_RPM_ARCHITECTURE}" -} diff --git a/hack/lib/build/version.sh b/hack/lib/build/version.sh deleted file mode 100644 index c1152cd9..00000000 --- a/hack/lib/build/version.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -# This library holds utility functions for determining -# product versions from Git repository state. - -# os::build::version::get_vars loads the standard version variables as -# ENV vars -function os::build::version::get_vars() { - if [[ -n "${OS_VERSION_FILE-}" ]]; then - if [[ -f "${OS_VERSION_FILE}" ]]; then - source "${OS_VERSION_FILE}" - return - fi - if [[ ! -d "${OS_ROOT}/.git" ]]; then - os::log::fatal "No version file at ${OS_VERSION_FILE}" - fi - os::log::warning "No version file at ${OS_VERSION_FILE}, falling back to git versions" - fi - os::build::version::git_vars -} -readonly -f os::build::version::get_vars - -# os::build::version::git_vars looks up the current Git vars if they have not been calculated. -function os::build::version::git_vars() { - if [[ -n "${OS_GIT_VERSION-}" ]]; then - return 0 - fi - - local git=(git --work-tree "${OS_ROOT}") - - if [[ -n ${OS_GIT_COMMIT-} ]] || OS_GIT_COMMIT=$("${git[@]}" rev-parse --short "HEAD^{commit}" 2>/dev/null); then - if [[ -z ${OS_GIT_TREE_STATE-} ]]; then - # Check if the tree is dirty. default to dirty - if git_status=$("${git[@]}" status --porcelain 2>/dev/null) && [[ -z ${git_status} ]]; then - OS_GIT_TREE_STATE="clean" - else - OS_GIT_TREE_STATE="dirty" - fi - fi - # Use git describe to find the version based on annotated tags. - if [[ -n ${OS_GIT_VERSION-} ]] || OS_GIT_VERSION=$("${git[@]}" describe --long --tags --abbrev=7 --match 'v[0-9]*' "${OS_GIT_COMMIT}^{commit}" 2>/dev/null); then - # Try to match the "git describe" output to a regex to try to extract - # the "major" and "minor" versions and whether this is the exact tagged - # version or whether the tree is between two tagged versions. - if [[ "${OS_GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)(\.[0-9]+)*([-].*)?$ ]]; then - OS_GIT_MAJOR=${BASH_REMATCH[1]} - OS_GIT_MINOR=${BASH_REMATCH[2]} - OS_GIT_PATCH=${BASH_REMATCH[3]} - if [[ -n "${BASH_REMATCH[5]}" ]]; then - OS_GIT_MINOR+="+" - fi - fi - - # This translates the "git describe" to an actual semver.org - # compatible semantic version that looks something like this: - # v1.1.0-alpha.0.6+84c76d1-345 - OS_GIT_VERSION=$(echo "${OS_GIT_VERSION}" | sed "s/-\([0-9]\{1,\}\)-g\([0-9a-f]\{7,40\}\)$/\+\2-\1/") - # If this is an exact tag, remove the last segment. - OS_GIT_VERSION=$(echo "${OS_GIT_VERSION}" | sed "s/-0$//") - if [[ "${OS_GIT_TREE_STATE}" == "dirty" ]]; then - # git describe --dirty only considers changes to existing files, but - # that is problematic since new untracked .go files affect the build, - # so use our idea of "dirty" from git status instead. - OS_GIT_VERSION+="-dirty" - fi - fi - fi -} -readonly -f os::build::version::git_vars - -# Saves the environment flags to $1 -function os::build::version::save_vars() { - cat </dev/null 2>&1; then - os::log::warning "[CLEANUP] No \`docker\` binary found, skipping container cleanup." - return - fi - - os::log::info "[CLEANUP] Stopping docker containers" - for id in $( os::cleanup::internal::list_our_containers ); do - os::log::debug "Stopping ${id}" - docker stop "${id}" >/dev/null - done - - if [[ -n "${SKIP_IMAGE_CLEANUP:-}" ]]; then - return - fi - - os::log::info "[CLEANUP] Removing docker containers" - for id in $( os::cleanup::internal::list_our_containers ); do - os::log::debug "Removing ${id}" - docker rm --volumes "${id}" >/dev/null - done -} -readonly -f os::cleanup::containers - -# os::cleanup::dump_container_logs operates on k8s containers to dump any logs -# from the containers. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# None -function os::cleanup::dump_container_logs() { - if ! os::util::find::system_binary docker >/dev/null 2>&1; then - os::log::warning "[CLEANUP] No \`docker\` binary found, skipping container log harvest." - return - fi - - local container_log_dir="${LOG_DIR}/containers" - mkdir -p "${container_log_dir}" - - os::log::info "[CLEANUP] Dumping container logs to $( os::util::repository_relative_path "${container_log_dir}" )" - for id in $( os::cleanup::internal::list_our_containers ); do - local name; name="$( docker inspect --format '{{ .Name }}' "${id}" )" - os::log::debug "Dumping logs for ${id} to ${name}.log" - docker logs "${id}" >"${container_log_dir}/${name}.log" 2>&1 - done -} -readonly -f os::cleanup::dump_container_logs - -# os::cleanup::internal::list_containers returns a space-delimited list of -# docker containers that match a name regex. -# -# Globals: -# None -# Arguments: -# 1 - regex to match on the name -# Returns: -# None -function os::cleanup::internal::list_containers() { - local regex="$1" - local ids; - for short_id in $( docker ps -aq ); do - local id; id="$( docker inspect --format '{{ .Id }}' "${short_id}" )" - local name; name="$( docker inspect --format '{{ .Name }}' "${id}" )" - if [[ "${name}" =~ ${regex} ]]; then - ids+=( "${id}" ) - fi - done - - echo "${ids[*]:+"${ids[*]}"}" -} -readonly -f os::cleanup::internal::list_containers - -# os::cleanup::tmpdir performs cleanup of temp directories as a precondition for running a test. It tries to -# clean up mounts in the temp directories. -# -# Globals: -# - BASETMPDIR -# - USE_SUDO -# Returns: -# None -function os::cleanup::tmpdir() { - os::log::info "[CLEANUP] Cleaning up temporary directories" - # ensure that the directories are clean - if os::util::find::system_binary "findmnt" &>/dev/null; then - for target in $( ${USE_SUDO:+sudo} findmnt --output TARGET --list ); do - if [[ "${target}" == "${BASETMPDIR}"* ]]; then - ${USE_SUDO:+sudo} umount "${target}" - fi - done - fi - - # delete any sub directory underneath BASETMPDIR - for directory in $( find "${BASETMPDIR}" -mindepth 2 -maxdepth 2 ); do - ${USE_SUDO:+sudo} rm -rf "${directory}" - done -} -readonly -f os::cleanup::tmpdir - -# os::cleanup::truncate_large_logs truncates very large files under -# $LOG_DIR and $ARTIFACT_DIR so we do not upload them to cloud storage -# after CI runs. -# -# Globals: -# - LOG_DIR -# - ARTIFACT_DIR -# Arguments: -# None -# Returns: -# None -function os::cleanup::truncate_large_logs() { - local max_file_size="200M" - os::log::info "[CLEANUP] Truncating log files over ${max_file_size}" - for file in $(find "${ARTIFACT_DIR}" "${LOG_DIR}" -type f -name '*.log' \( -size +${max_file_size} \)); do - mv "${file}" "${file}.tmp" - echo "LOGFILE TOO LONG ($(du -h "${file}.tmp")), PREVIOUS BYTES TRUNCATED. LAST ${max_file_size} OF LOGFILE:" > "${file}" - tail -c ${max_file_size} "${file}.tmp" >> "${file}" - rm "${file}.tmp" - done -} -readonly -f os::cleanup::truncate_large_logs - -# os::cleanup::processes kills all processes created by the test -# script. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# None -function os::cleanup::processes() { - os::log::info "[CLEANUP] Killing child processes" - for job in $( jobs -pr ); do - for child in $( pgrep -P "${job}" ); do - ${USE_SUDO:+sudo} kill "${child}" &> /dev/null - done - ${USE_SUDO:+sudo} kill "${job}" &> /dev/null - done -} -readonly -f os::cleanup::processes diff --git a/hack/lib/cmd.sh b/hack/lib/cmd.sh deleted file mode 100644 index a45a984a..00000000 --- a/hack/lib/cmd.sh +++ /dev/null @@ -1,619 +0,0 @@ -#!/bin/bash -# This utility file contains functions that wrap commands to be tested. All wrapper functions run commands -# in a sub-shell and redirect all output. Tests in test-cmd *must* use these functions for testing. - -# expect_success runs the cmd and expects an exit code of 0 -function os::cmd::expect_success() { - if [[ $# -ne 1 ]]; then echo "os::cmd::expect_success expects only one argument, got $#"; return 1; fi - local cmd=$1 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" -} -readonly -f os::cmd::expect_success - -# expect_failure runs the cmd and expects a non-zero exit code -function os::cmd::expect_failure() { - if [[ $# -ne 1 ]]; then echo "os::cmd::expect_failure expects only one argument, got $#"; return 1; fi - local cmd=$1 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" "os::cmd::internal::failure_func" -} -readonly -f os::cmd::expect_failure - -# expect_success_and_text runs the cmd and expects an exit code of 0 -# as well as running a grep test to find the given string in the output -function os::cmd::expect_success_and_text() { - if [[ $# -ne 2 ]]; then echo "os::cmd::expect_success_and_text expects two arguments, got $#"; return 1; fi - local cmd=$1 - local expected_text=$2 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" "os::cmd::internal::success_func" "${expected_text}" -} -readonly -f os::cmd::expect_success_and_text - -# expect_failure_and_text runs the cmd and expects a non-zero exit code -# as well as running a grep test to find the given string in the output -function os::cmd::expect_failure_and_text() { - if [[ $# -ne 2 ]]; then echo "os::cmd::expect_failure_and_text expects two arguments, got $#"; return 1; fi - local cmd=$1 - local expected_text=$2 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" "os::cmd::internal::failure_func" "${expected_text}" -} -readonly -f os::cmd::expect_failure_and_text - -# expect_success_and_not_text runs the cmd and expects an exit code of 0 -# as well as running a grep test to ensure the given string is not in the output -function os::cmd::expect_success_and_not_text() { - if [[ $# -ne 2 ]]; then echo "os::cmd::expect_success_and_not_text expects two arguments, got $#"; return 1; fi - local cmd=$1 - local expected_text=$2 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" "os::cmd::internal::success_func" "${expected_text}" "os::cmd::internal::failure_func" -} -readonly -f os::cmd::expect_success_and_not_text - -# expect_failure_and_not_text runs the cmd and expects a non-zero exit code -# as well as running a grep test to ensure the given string is not in the output -function os::cmd::expect_failure_and_not_text() { - if [[ $# -ne 2 ]]; then echo "os::cmd::expect_failure_and_not_text expects two arguments, got $#"; return 1; fi - local cmd=$1 - local expected_text=$2 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" "os::cmd::internal::failure_func" "${expected_text}" "os::cmd::internal::failure_func" -} -readonly -f os::cmd::expect_failure_and_not_text - -# expect_code runs the cmd and expects a given exit code -function os::cmd::expect_code() { - if [[ $# -ne 2 ]]; then echo "os::cmd::expect_code expects two arguments, got $#"; return 1; fi - local cmd=$1 - local expected_cmd_code=$2 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" "os::cmd::internal::specific_code_func ${expected_cmd_code}" -} -readonly -f os::cmd::expect_code - -# expect_code_and_text runs the cmd and expects the given exit code -# as well as running a grep test to find the given string in the output -function os::cmd::expect_code_and_text() { - if [[ $# -ne 3 ]]; then echo "os::cmd::expect_code_and_text expects three arguments, got $#"; return 1; fi - local cmd=$1 - local expected_cmd_code=$2 - local expected_text=$3 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" "os::cmd::internal::specific_code_func ${expected_cmd_code}" "${expected_text}" -} -readonly -f os::cmd::expect_code_and_text - -# expect_code_and_not_text runs the cmd and expects the given exit code -# as well as running a grep test to ensure the given string is not in the output -function os::cmd::expect_code_and_not_text() { - if [[ $# -ne 3 ]]; then echo "os::cmd::expect_code_and_not_text expects three arguments, got $#"; return 1; fi - local cmd=$1 - local expected_cmd_code=$2 - local expected_text=$3 - - os::cmd::internal::expect_exit_code_run_grep "${cmd}" "os::cmd::internal::specific_code_func ${expected_cmd_code}" "${expected_text}" "os::cmd::internal::failure_func" -} -readonly -f os::cmd::expect_code_and_not_text - -millisecond=1 -second=$(( 1000 * millisecond )) -minute=$(( 60 * second )) - -# os::cmd::try_until_success runs the cmd in a small interval until either the command succeeds or times out -# the default time-out for os::cmd::try_until_success is 60 seconds. -# the default interval for os::cmd::try_until_success is 200ms -function os::cmd::try_until_success() { - if [[ $# -lt 1 ]]; then echo "os::cmd::try_until_success expects at least one arguments, got $#"; return 1; fi - local cmd=$1 - local duration=${2:-$minute} - local interval=${3:-0.2} - - os::cmd::internal::run_until_exit_code "${cmd}" "os::cmd::internal::success_func" "${duration}" "${interval}" -} -readonly -f os::cmd::try_until_success - -# os::cmd::try_until_failure runs the cmd until either the command fails or times out -# the default time-out for os::cmd::try_until_failure is 60 seconds. -function os::cmd::try_until_failure() { - if [[ $# -lt 1 ]]; then echo "os::cmd::try_until_failure expects at least one argument, got $#"; return 1; fi - local cmd=$1 - local duration=${2:-$minute} - local interval=${3:-0.2} - - os::cmd::internal::run_until_exit_code "${cmd}" "os::cmd::internal::failure_func" "${duration}" "${interval}" -} -readonly -f os::cmd::try_until_failure - -# os::cmd::try_until_text runs the cmd until either the command outputs the desired text or times out -# the default time-out for os::cmd::try_until_text is 60 seconds. -function os::cmd::try_until_text() { - if [[ $# -lt 2 ]]; then echo "os::cmd::try_until_text expects at least two arguments, got $#"; return 1; fi - local cmd=$1 - local text=$2 - local duration=${3:-$minute} - local interval=${4:-0.2} - - os::cmd::internal::run_until_text "${cmd}" "${text}" "os::cmd::internal::success_func" "${duration}" "${interval}" -} -readonly -f os::cmd::try_until_text - -# os::cmd::try_until_not_text runs the cmd until either the command doesnot output the text or times out -# the default time-out for os::cmd::try_until_not_text is 60 seconds. -function os::cmd::try_until_not_text() { - if [[ $# -lt 2 ]]; then echo "os::cmd::try_until_not_text expects at least two arguments, got $#"; return 1; fi - local cmd=$1 - local text=$2 - local duration=${3:-$minute} - local interval=${4:-0.2} - - os::cmd::internal::run_until_text "${cmd}" "${text}" "os::cmd::internal::failure_func" "${duration}" "${interval}" -} -readonly -f os::cmd::try_until_text - -# Functions in the os::cmd::internal namespace are discouraged from being used outside of os::cmd - -# In order to harvest stderr and stdout at the same time into different buckets, we need to stick them into files -# in an intermediate step -os_cmd_internal_tmpdir="${TMPDIR:-"/tmp"}/cmd" -os_cmd_internal_tmpout="${os_cmd_internal_tmpdir}/tmp_stdout.log" -os_cmd_internal_tmperr="${os_cmd_internal_tmpdir}/tmp_stderr.log" - -# os::cmd::internal::expect_exit_code_run_grep runs the provided test command and expects a specific -# exit code from that command as well as the success of a specified `grep` invocation. Output from the -# command to be tested is suppressed unless either `VERBOSE=1` or the test fails. This function bypasses -# any error exiting settings or traps set by upstream callers by masking the return code of the command -# with the return code of setting the result variable on failure. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - VERBOSE -# Arguments: -# - 1: the command to run -# - 2: command evaluation assertion to use -# - 3: text to test for -# - 4: text assertion to use -# Returns: -# - 0: if all assertions met -# - 1: if any assertions fail -function os::cmd::internal::expect_exit_code_run_grep() { - local cmd=$1 - # default expected cmd code to 0 for success - local cmd_eval_func=${2:-os::cmd::internal::success_func} - # default to nothing - local grep_args=${3:-} - # default expected test code to 0 for success - local test_eval_func=${4:-os::cmd::internal::success_func} - - local -a junit_log - - os::cmd::internal::init_tempdir - os::test::junit::declare_test_start - - local name=$(os::cmd::internal::describe_call "${cmd}" "${cmd_eval_func}" "${grep_args}" "${test_eval_func}") - local preamble="Running ${name}..." - echo "${preamble}" - # for ease of parsing, we want the entire declaration on one line, so we replace '\n' with ';' - junit_log+=( "${name//$'\n'/;}" ) - - local start_time=$(os::cmd::internal::seconds_since_epoch) - - local cmd_result=$( os::cmd::internal::run_collecting_output "${cmd}"; echo $? ) - local cmd_succeeded=$( ${cmd_eval_func} "${cmd_result}"; echo $? ) - - local test_result=0 - if [[ -n "${grep_args}" ]]; then - test_result=$( os::cmd::internal::run_collecting_output 'grep -Eq "${grep_args}" <(os::cmd::internal::get_results)'; echo $? ) - fi - local test_succeeded=$( ${test_eval_func} "${test_result}"; echo $? ) - - local end_time=$(os::cmd::internal::seconds_since_epoch) - local time_elapsed=$(echo "scale=3; ${end_time} - ${start_time}" | bc | xargs printf '%5.3f') # in decimal seconds, we need leading zeroes for parsing later - - # clear the preamble so we can print out the success or error message - os::text::clear_string "${preamble}" - - local return_code - if (( cmd_succeeded && test_succeeded )); then - os::text::print_green "SUCCESS after ${time_elapsed}s: ${name}" - junit_log+=( "SUCCESS after ${time_elapsed}s: ${name//$'\n'/;}" ) - - if [[ -n ${VERBOSE-} ]]; then - os::cmd::internal::print_results - fi - return_code=0 - else - local cause=$(os::cmd::internal::assemble_causes "${cmd_succeeded}" "${test_succeeded}") - - os::text::print_red_bold "FAILURE after ${time_elapsed}s: ${name}: ${cause}" - junit_log+=( "FAILURE after ${time_elapsed}s: ${name//$'\n'/;}: ${cause}" ) - - os::text::print_red "$(os::cmd::internal::print_results)" - return_code=1 - fi - - junit_log+=( "$(os::cmd::internal::print_results)" ) - # append inside of a subshell so that IFS doesn't get propagated out - ( IFS=$'\n'; echo "${junit_log[*]}" >> "${JUNIT_REPORT_OUTPUT:-/dev/null}" ) - os::test::junit::declare_test_end - return "${return_code}" -} -readonly -f os::cmd::internal::expect_exit_code_run_grep - -# os::cmd::internal::init_tempdir initializes the temporary directory -function os::cmd::internal::init_tempdir() { - mkdir -p "${os_cmd_internal_tmpdir}" - rm -f "${os_cmd_internal_tmpdir}"/tmp_std{out,err}.log -} -readonly -f os::cmd::internal::init_tempdir - -# os::cmd::internal::describe_call determines the file:line of the latest function call made -# from outside of this file in the call stack, and the name of the function being called from -# that line, returning a string describing the call -function os::cmd::internal::describe_call() { - local cmd=$1 - local cmd_eval_func=$2 - local grep_args=${3:-} - local test_eval_func=${4:-} - - local caller_id=$(os::cmd::internal::determine_caller) - local full_name="${caller_id}: executing '${cmd}'" - - local cmd_expectation=$(os::cmd::internal::describe_expectation "${cmd_eval_func}") - local full_name="${full_name} expecting ${cmd_expectation}" - - if [[ -n "${grep_args}" ]]; then - local text_expecting= - case "${test_eval_func}" in - "os::cmd::internal::success_func") - text_expecting="text" ;; - "os::cmd::internal::failure_func") - text_expecting="not text" ;; - esac - full_name="${full_name} and ${text_expecting} '${grep_args}'" - fi - - echo "${full_name}" -} -readonly -f os::cmd::internal::describe_call - -# os::cmd::internal::determine_caller determines the file relative to the OpenShift Origin root directory -# and line number of the function call to the outer os::cmd wrapper function -function os::cmd::internal::determine_caller() { - local call_depth= - local len_sources="${#BASH_SOURCE[@]}" - for (( i=0; i<${len_sources}; i++ )); do - if [ ! $(echo "${BASH_SOURCE[i]}" | grep "hack/lib/cmd\.sh$") ]; then - call_depth=i - break - fi - done - - local caller_file="${BASH_SOURCE[${call_depth}]}" - caller_file="$( os::util::repository_relative_path "${caller_file}" )" - local caller_line="${BASH_LINENO[${call_depth}-1]}" - echo "${caller_file}:${caller_line}" -} -readonly -f os::cmd::internal::determine_caller - -# os::cmd::internal::describe_expectation describes a command return code evaluation function -function os::cmd::internal::describe_expectation() { - local func=$1 - case "${func}" in - "os::cmd::internal::success_func") - echo "success" ;; - "os::cmd::internal::failure_func") - echo "failure" ;; - "os::cmd::internal::specific_code_func"*[0-9]) - local code=$(echo "${func}" | grep -Eo "[0-9]+$") - echo "exit code ${code}" ;; - "") - echo "any result" - esac -} -readonly -f os::cmd::internal::describe_expectation - -# os::cmd::internal::seconds_since_epoch returns the number of seconds elapsed since the epoch -# with milli-second precision -function os::cmd::internal::seconds_since_epoch() { - local ns=$(date +%s%N) - # if `date` doesn't support nanoseconds, return second precision - if [[ "$ns" == *N ]]; then - date "+%s.000" - return - fi - echo $(bc <<< "scale=3; ${ns}/1000000000") -} -readonly -f os::cmd::internal::seconds_since_epoch - -# os::cmd::internal::run_collecting_output runs the command given, piping stdout and stderr into -# the given files, and returning the exit code of the command -function os::cmd::internal::run_collecting_output() { - local cmd=$1 - - local result= - $( eval "${cmd}" 1>>"${os_cmd_internal_tmpout}" 2>>"${os_cmd_internal_tmperr}" ) || result=$? - local result=${result:-0} # if we haven't set result yet, the command succeeded - - return "${result}" -} -readonly -f os::cmd::internal::run_collecting_output - -# os::cmd::internal::success_func determines if the input exit code denotes success -# this function returns 0 for false and 1 for true to be compatible with arithmetic tests -function os::cmd::internal::success_func() { - local exit_code=$1 - - # use a negated test to get output correct for (( )) - [[ "${exit_code}" -ne "0" ]] - return $? -} -readonly -f os::cmd::internal::success_func - -# os::cmd::internal::failure_func determines if the input exit code denotes failure -# this function returns 0 for false and 1 for true to be compatible with arithmetic tests -function os::cmd::internal::failure_func() { - local exit_code=$1 - - # use a negated test to get output correct for (( )) - [[ "${exit_code}" -eq "0" ]] - return $? -} -readonly -f os::cmd::internal::failure_func - -# os::cmd::internal::specific_code_func determines if the input exit code matches the given code -# this function returns 0 for false and 1 for true to be compatible with arithmetic tests -function os::cmd::internal::specific_code_func() { - local expected_code=$1 - local exit_code=$2 - - # use a negated test to get output correct for (( )) - [[ "${exit_code}" -ne "${expected_code}" ]] - return $? -} -readonly -f os::cmd::internal::specific_code_func - -# os::cmd::internal::get_results prints the stderr and stdout files -function os::cmd::internal::get_results() { - cat "${os_cmd_internal_tmpout}" "${os_cmd_internal_tmperr}" -} -readonly -f os::cmd::internal::get_results - -# os::cmd::internal::get_last_results prints the stderr and stdout from the last attempt -function os::cmd::internal::get_last_results() { - cat "${os_cmd_internal_tmpout}" | awk 'BEGIN { RS = "\x1e" } END { print $0 }' - cat "${os_cmd_internal_tmperr}" | awk 'BEGIN { RS = "\x1e" } END { print $0 }' -} -readonly -f os::cmd::internal::get_last_results - -# os::cmd::internal::mark_attempt marks the end of an attempt in the stdout and stderr log files -# this is used to make the try_until_* output more concise -function os::cmd::internal::mark_attempt() { - echo -e '\x1e' >> "${os_cmd_internal_tmpout}" - echo -e '\x1e' >> "${os_cmd_internal_tmperr}" -} -readonly -f os::cmd::internal::mark_attempt - -# os::cmd::internal::compress_output compresses an output file into timeline representation -function os::cmd::internal::compress_output() { - local logfile=$1 - - awk -f ${OS_ROOT}/hack/lib/compress.awk $logfile -} -readonly -f os::cmd::internal::compress_output - -# os::cmd::internal::print_results pretty-prints the stderr and stdout files. If attempt separators -# are present, this function returns a concise view of the stdout and stderr output files using a -# timeline format, where consecutive output lines that are the same are condensed into one line -# with a counter -function os::cmd::internal::print_results() { - if [[ -s "${os_cmd_internal_tmpout}" ]]; then - echo "Standard output from the command:" - if grep -q $'\x1e' "${os_cmd_internal_tmpout}"; then - os::cmd::internal::compress_output "${os_cmd_internal_tmpout}" - else - cat "${os_cmd_internal_tmpout}"; echo - fi - else - echo "There was no output from the command." - fi - - if [[ -s "${os_cmd_internal_tmperr}" ]]; then - echo "Standard error from the command:" - if grep -q $'\x1e' "${os_cmd_internal_tmperr}"; then - os::cmd::internal::compress_output "${os_cmd_internal_tmperr}" - else - cat "${os_cmd_internal_tmperr}"; echo - fi - else - echo "There was no error output from the command." - fi -} -readonly -f os::cmd::internal::print_results - -# os::cmd::internal::assemble_causes determines from the two input booleans which part of the test -# failed and generates a nice delimited list of failure causes -function os::cmd::internal::assemble_causes() { - local cmd_succeeded=$1 - local test_succeeded=$2 - - local causes=() - if (( ! cmd_succeeded )); then - causes+=("the command returned the wrong error code") - fi - if (( ! test_succeeded )); then - causes+=("the output content test failed") - fi - - local list=$(printf '; %s' "${causes[@]}") - echo "${list:2}" -} -readonly -f os::cmd::internal::assemble_causes - -# os::cmd::internal::run_until_exit_code runs the provided command until the exit code test given -# succeeds or the timeout given runs out. Output from the command to be tested is suppressed unless -# either `VERBOSE=1` or the test fails. This function bypasses any error exiting settings or traps -# set by upstream callers by masking the return code of the command with the return code of setting -# the result variable on failure. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - VERBOSE -# Arguments: -# - 1: the command to run -# - 2: command evaluation assertion to use -# - 3: timeout duration -# - 4: interval duration -# Returns: -# - 0: if all assertions met before timeout -# - 1: if timeout occurs -function os::cmd::internal::run_until_exit_code() { - local cmd=$1 - local cmd_eval_func=$2 - local duration=$3 - local interval=$4 - - local -a junit_log - - os::cmd::internal::init_tempdir - os::test::junit::declare_test_start - - local description=$(os::cmd::internal::describe_call "${cmd}" "${cmd_eval_func}") - local duration_seconds=$(echo "scale=3; $(( duration )) / 1000" | bc | xargs printf '%5.3f') - local description="${description}; re-trying every ${interval}s until completion or ${duration_seconds}s" - local preamble="Running ${description}..." - echo "${preamble}" - # for ease of parsing, we want the entire declaration on one line, so we replace '\n' with ';' - junit_log+=( "${description//$'\n'/;}" ) - - local start_time=$(os::cmd::internal::seconds_since_epoch) - - local deadline=$(( $(date +%s000) + $duration )) - local cmd_succeeded=0 - while [ $(date +%s000) -lt $deadline ]; do - local cmd_result=$( os::cmd::internal::run_collecting_output "${cmd}"; echo $? ) - cmd_succeeded=$( ${cmd_eval_func} "${cmd_result}"; echo $? ) - if (( cmd_succeeded )); then - break - fi - sleep "${interval}" - os::cmd::internal::mark_attempt - done - - local end_time=$(os::cmd::internal::seconds_since_epoch) - local time_elapsed=$(echo "scale=9; ${end_time} - ${start_time}" | bc | xargs printf '%5.3f') # in decimal seconds, we need leading zeroes for parsing later - - # clear the preamble so we can print out the success or error message - os::text::clear_string "${preamble}" - - local return_code - if (( cmd_succeeded )); then - os::text::print_green "SUCCESS after ${time_elapsed}s: ${description}" - junit_log+=( "SUCCESS after ${time_elapsed}s: ${description//$'\n'/;}" ) - - if [[ -n ${VERBOSE-} ]]; then - os::cmd::internal::print_results - fi - return_code=0 - else - os::text::print_red_bold "FAILURE after ${time_elapsed}s: ${description}: the command timed out" - junit_log+=( "FAILURE after ${time_elapsed}s: ${description//$'\n'/;}: the command timed out" ) - - os::text::print_red "$(os::cmd::internal::print_results)" - return_code=1 - fi - - junit_log+=( "$(os::cmd::internal::print_results)" ) - ( IFS=$'\n'; echo "${junit_log[*]}" >> "${JUNIT_REPORT_OUTPUT:-/dev/null}" ) - os::test::junit::declare_test_end - return "${return_code}" -} -readonly -f os::cmd::internal::run_until_exit_code - -# os::cmd::internal::run_until_text runs the provided command until the assertion function succeeds with -# the given text on the command output or the timeout given runs out. This can be used to run until the -# output does or does not contain some text. Output from the command to be tested is suppressed unless -# either `VERBOSE=1` or the test fails. This function bypasses any error exiting settings or traps -# set by upstream callers by masking the return code of the command with the return code of setting -# the result variable on failure. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - VERBOSE -# Arguments: -# - 1: the command to run -# - 2: text to test for -# - 3: text assertion to use -# - 4: timeout duration -# - 5: interval duration -# Returns: -# - 0: if all assertions met before timeout -# - 1: if timeout occurs -function os::cmd::internal::run_until_text() { - local cmd=$1 - local text=$2 - local test_eval_func=${3:-os::cmd::internal::success_func} - local duration=$4 - local interval=$5 - - local -a junit_log - - os::cmd::internal::init_tempdir - os::test::junit::declare_test_start - - local description=$(os::cmd::internal::describe_call "${cmd}" "" "${text}" "${test_eval_func}") - local duration_seconds=$(echo "scale=3; $(( duration )) / 1000" | bc | xargs printf '%5.3f') - local description="${description}; re-trying every ${interval}s until completion or ${duration_seconds}s" - local preamble="Running ${description}..." - echo "${preamble}" - # for ease of parsing, we want the entire declaration on one line, so we replace '\n' with ';' - junit_log+=( "${description//$'\n'/;}" ) - - local start_time=$(os::cmd::internal::seconds_since_epoch) - - local deadline=$(( $(date +%s000) + $duration )) - local test_succeeded=0 - while [ $(date +%s000) -lt $deadline ]; do - local cmd_result=$( os::cmd::internal::run_collecting_output "${cmd}"; echo $? ) - local test_result - test_result=$( os::cmd::internal::run_collecting_output 'grep -Eq "${text}" <(os::cmd::internal::get_last_results)'; echo $? ) - test_succeeded=$( ${test_eval_func} "${test_result}"; echo $? ) - - if (( test_succeeded )); then - break - fi - sleep "${interval}" - os::cmd::internal::mark_attempt - done - - local end_time=$(os::cmd::internal::seconds_since_epoch) - local time_elapsed=$(echo "scale=9; ${end_time} - ${start_time}" | bc | xargs printf '%5.3f') # in decimal seconds, we need leading zeroes for parsing later - - # clear the preamble so we can print out the success or error message - os::text::clear_string "${preamble}" - - local return_code - if (( test_succeeded )); then - os::text::print_green "SUCCESS after ${time_elapsed}s: ${description}" - junit_log+=( "SUCCESS after ${time_elapsed}s: ${description//$'\n'/;}" ) - - if [[ -n ${VERBOSE-} ]]; then - os::cmd::internal::print_results - fi - return_code=0 - else - os::text::print_red_bold "FAILURE after ${time_elapsed}s: ${description}: the command timed out" - junit_log+=( "FAILURE after ${time_elapsed}s: ${description//$'\n'/;}: the command timed out" ) - - os::text::print_red "$(os::cmd::internal::print_results)" - return_code=1 - fi - - junit_log+=( "$(os::cmd::internal::print_results)" ) - ( IFS=$'\n'; echo "${junit_log[*]}" >> "${JUNIT_REPORT_OUTPUT:-/dev/null}" ) - os::test::junit::declare_test_end - return "${return_code}" -} -readonly -f os::cmd::internal::run_until_text diff --git a/hack/lib/compress.awk b/hack/lib/compress.awk deleted file mode 100644 index 386d79b0..00000000 --- a/hack/lib/compress.awk +++ /dev/null @@ -1,41 +0,0 @@ -# Helper functions -function trim(s) { - gsub(/^[ \t\r\n]+|[ \t\r\n]+$/, "", s); - return s; -} - -function printRecordAndCount(record, count) { - print record; - if (count > 1) { - printf("... repeated %d times\n", count) - } -} - -BEGIN { - # Before processing, set the record separator to the ASCII record separator character \x1e - RS = "\x1e"; -} - -# This action is executed for each record -{ - # Build our current var from the trimmed record - current = trim($0); - - # Bump the count of times we have seen it - seen[current]++; - - # Print the previous record and its count (if it is not identical to the current record) - if (previous && previous != current) { - printRecordAndCount(previous, seen[previous]); - } - - # Store the current record as the previous record - previous = current; -} - -END { - # After processing, print the last record and count if it is non-empty - if (previous) { - printRecordAndCount(previous, seen[previous]); - } -} \ No newline at end of file diff --git a/hack/lib/constants.sh b/hack/lib/constants.sh deleted file mode 100644 index 4cce55f2..00000000 --- a/hack/lib/constants.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash - -# This script provides constants for the Golang binary build process - -readonly OS_GO_PACKAGE=sigs.k8s.io/descheduler - -readonly OS_BUILD_ENV_GOLANG="${OS_BUILD_ENV_GOLANG:-1.9}" -readonly OS_BUILD_ENV_IMAGE="${OS_BUILD_ENV_IMAGE:-openshift/origin-release:golang-${OS_BUILD_ENV_GOLANG}}" -readonly OS_REQUIRED_GO_VERSION="go1.9" -readonly OS_BUILD_ENV_WORKINGDIR="/go/${OS_GO_PACKAGE}" - -readonly OS_OUTPUT_BASEPATH="${OS_OUTPUT_BASEPATH:-_output}" -readonly OS_BASE_OUTPUT="${OS_ROOT}/${OS_OUTPUT_BASEPATH}" -readonly OS_OUTPUT_SCRIPTPATH="${OS_OUTPUT_SCRIPTPATH:-"${OS_BASE_OUTPUT}/scripts"}" - -readonly OS_OUTPUT_SUBPATH="${OS_OUTPUT_SUBPATH:-${OS_OUTPUT_BASEPATH}/local}" -readonly OS_OUTPUT="${OS_ROOT}/${OS_OUTPUT_SUBPATH}" -readonly OS_OUTPUT_RELEASEPATH="${OS_OUTPUT}/releases" -readonly OS_OUTPUT_RPMPATH="${OS_OUTPUT_RELEASEPATH}/rpms" -readonly OS_OUTPUT_BINPATH="${OS_OUTPUT}/bin" -readonly OS_OUTPUT_PKGDIR="${OS_OUTPUT}/pkgdir" - -readonly OS_GOFLAGS_TAGS="" - -readonly OS_IMAGE_COMPILE_BINARIES=( ) - -readonly OS_CROSS_COMPILE_TARGETS=( - cmd/descheduler -) -readonly OS_CROSS_COMPILE_BINARIES=("${OS_CROSS_COMPILE_TARGETS[@]##*/}") - -readonly OS_TEST_TARGETS=( ) - -# os::build::get_product_vars exports variables that we expect to change -# depending on the distribution of Origin -function os::build::get_product_vars() { - export OS_BUILD_LDFLAGS_IMAGE_PREFIX="${OS_IMAGE_PREFIX:-"openshift/origin"}" - export OS_BUILD_LDFLAGS_DEFAULT_IMAGE_STREAMS="${OS_BUILD_LDFLAGS_DEFAULT_IMAGE_STREAMS:-"centos7"}" -} - -# os::build::ldflags calculates the -ldflags argument for building OpenShift -function os::build::ldflags() { - # Run this in a subshell to prevent settings/variables from leaking. - set -o errexit - set -o nounset - set -o pipefail - - cd "${OS_ROOT}" - - os::build::version::get_vars - os::build::get_product_vars - - local buildDate="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" - - declare -a ldflags=() - - ldflags+=($(os::build::ldflag "${OS_GO_PACKAGE}/pkg/version.majorFromGit" "${OS_GIT_MAJOR}")) - ldflags+=($(os::build::ldflag "${OS_GO_PACKAGE}/pkg/version.minorFromGit" "${OS_GIT_MINOR}")) - ldflags+=($(os::build::ldflag "${OS_GO_PACKAGE}/pkg/version.versionFromGit" "${OS_GIT_VERSION}")) - ldflags+=($(os::build::ldflag "${OS_GO_PACKAGE}/pkg/version.commitFromGit" "${OS_GIT_COMMIT}")) - ldflags+=($(os::build::ldflag "${OS_GO_PACKAGE}/pkg/version.buildDate" "${buildDate}")) - - # The -ldflags parameter takes a single string, so join the output. - echo "${ldflags[*]-}" -} -readonly -f os::build::ldflags - -# No-op -function os::build::generate_windows_versioninfo() { - : -} -readonly -f os::build::generate_windows_versioninfo - -function os::build::clean_windows_versioninfo() { - : -} -readonly -f os::build::clean_windows_versioninfo - -# os::util::list_go_src_files lists files we consider part of our project -# source code, useful for tools that iterate over source to provide vet- -# ting or linting, etc. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# None -function os::util::list_go_src_files() { - find . -not \( \ - \( \ - -wholename './_output' \ - -o -wholename './.*' \ - -o -wholename '*/vendor/*' \ - \) -prune \ - \) -name '*.go' | sort -u -} -readonly -f os::util::list_go_src_files - -# os::util::list_go_src_dirs lists dirs in origin/ and cmd/ dirs excluding -# doc.go useful for tools that iterate over source to provide vetting or -# linting, or for godep-save etc. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# None -function os::util::list_go_src_dirs() { - os::util::list_go_src_files | cut -d '/' -f 1-2 | grep -v ".go$" | grep -v "^./cmd" | LC_ALL=C sort -u - os::util::list_go_src_files | grep "^./cmd/"| cut -d '/' -f 1-3 | grep -v ".go$" | LC_ALL=C sort -u -} -readonly -f os::util::list_go_src_dirs - -# os::util::list_test_packages_under lists all packages containing Golang test files that we -# want to run as unit tests under the given base dir in the source tree -function os::util::list_test_packages_under() { - local basedir=$* - - # we do not quote ${basedir} to allow for multiple arguments to be passed in as well as to allow for - # arguments that use expansion, e.g. paths containing brace expansion or wildcards - find ${basedir} -not \( \ - \( \ - -path 'vendor' \ - -o -path '*_output' \ - -o -path '*.git' \ - -o -path '*vendor/*' \ - -o -path '*test/*' \ - \) -prune \ - \) -name '*_test.go' | xargs -n1 dirname | sort -u | xargs -n1 printf "${OS_GO_PACKAGE}/%s\n" -} -readonly -f os::util::list_test_packages_under - -# os::util::list_go_deps outputs the list of dependencies for the project. -function os::util::list_go_deps() { - go list -f '{{.ImportPath}}{{.Imports}}' ./pkg/... ./cmd/... | tr '[]' ' ' | - sed -e 's|${OS_GO_PACKAGE}/vendor/||g' -} - -# OS_ALL_IMAGES is the list of images built by os::build::images. -readonly OS_ALL_IMAGES=( - openshift/origin-descheduler -) - -# os::build::images builds all images in this repo. -function os::build::images() { - tag_prefix="${OS_IMAGE_PREFIX:-"openshift/origin"}" - os::build::image "${tag_prefix}-descheduler" images/descheduler -} diff --git a/hack/lib/generator-help.sh b/hack/lib/generator-help.sh deleted file mode 100644 index ca5685b3..00000000 --- a/hack/lib/generator-help.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -# Utility command based on 'find' command. The pipeline is as following: -# 1. find all the go files; (exclude specific path: vendor etc) -# 2. find all the files containing specific tags in contents; -# 3. extract related dirs; -# 4. remove duplicated paths; -# 5. merge all dirs in array with delimiter ,; -# -# Example: -# find_dirs_containing_comment_tags("+k8s:") -# Return: -# sigs.k8s.io/descheduler/a,sigs.k8s.io/descheduler/b,sigs.k8s.io/descheduler/c -function find_dirs_containing_comment_tags() { - array=() - while IFS='' read -r line; do array+=("$line"); done < <( \ - find . -type f -name \*.go -not -path "./vendor/*" -not -path "./_tmp/*" -print0 \ - | xargs -0 grep --color=never -l "$@" \ - | xargs -n1 dirname \ - | LC_ALL=C sort -u \ - ) - - IFS=" "; - printf '%s' "${array[*]}"; -} diff --git a/hack/lib/go.sh b/hack/lib/go.sh deleted file mode 100644 index cdf6068e..00000000 --- a/hack/lib/go.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright 2024 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. - -# go::verify_version verifies the go version is supported by the project. -# descheduler actively supports 3 versions, therefore 3 go versions are supported. -go::verify_version() { - GO_VERSION=($(go version)) - - if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.20|go1.21|go1.22') ]]; then - echo "Unknown go version '${GO_VERSION[2]}', skipping gofmt." - exit 1 - fi -} diff --git a/hack/lib/init.sh b/hack/lib/init.sh deleted file mode 100644 index 03b4c9c8..00000000 --- a/hack/lib/init.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# This script is meant to be the entrypoint for OpenShift Bash scripts to import all of the support -# libraries at once in order to make Bash script preambles as minimal as possible. This script recur- -# sively `source`s *.sh files in this directory tree. As such, no files should be `source`ed outside -# of this script to ensure that we do not attempt to overwrite read-only variables. - -set -o errexit -set -o nounset -set -o pipefail - -OS_SCRIPT_START_TIME="$( date +%s )"; export OS_SCRIPT_START_TIME - -# os::util::absolute_path returns the absolute path to the directory provided -function os::util::absolute_path() { - local relative_path="$1" - local absolute_path - - pushd "${relative_path}" >/dev/null - relative_path="$( pwd )" - if [[ -h "${relative_path}" ]]; then - absolute_path="$( readlink "${relative_path}" )" - else - absolute_path="${relative_path}" - fi - popd >/dev/null - - echo "${absolute_path}" -} -readonly -f os::util::absolute_path - -# find the absolute path to the root of the Origin source tree -init_source="$( dirname "${BASH_SOURCE}" )/../.." -OS_ROOT="$( os::util::absolute_path "${init_source}" )" -export OS_ROOT -cd "${OS_ROOT}" - -for library_file in $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' ); do - source "${library_file}" -done - -unset library_files library_file init_source - -# all of our Bash scripts need to have the stacktrace -# handler installed to deal with errors -os::log::stacktrace::install - -# All of our Bash scripts need to have access to the -# binaries that we build so we don't have to find -# them before every invocation. -os::util::environment::update_path_var - -if [[ -z "${OS_TMP_ENV_SET-}" ]]; then - os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )" -fi - -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - diff --git a/hack/lib/log/output.sh b/hack/lib/log/output.sh deleted file mode 100644 index 9a6f6dd5..00000000 --- a/hack/lib/log/output.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -# This file contains functions used for writing log messages -# to stdout and stderr from scripts while they run. - -# os::log::info writes the message to stdout. -# -# Arguments: -# - all: message to write -function os::log::info() { - local message; message="$( os::log::internal::prefix_lines "[INFO]" "$*" )" - os::log::internal::to_logfile "${message}" - echo "${message}" -} -readonly -f os::log::info - -# os::log::warning writes the message to stderr. -# A warning indicates something went wrong but -# not so wrong that we cannot recover. -# -# Arguments: -# - all: message to write -function os::log::warning() { - local message; message="$( os::log::internal::prefix_lines "[WARNING]" "$*" )" - os::log::internal::to_logfile "${message}" - os::text::print_yellow "${message}" 1>&2 -} -readonly -f os::log::warning - -# os::log::error writes the message to stderr. -# An error indicates that something went wrong -# and we will most likely fail after this. -# -# Arguments: -# - all: message to write -function os::log::error() { - local message; message="$( os::log::internal::prefix_lines "[ERROR]" "$*" )" - os::log::internal::to_logfile "${message}" - os::text::print_red "${message}" 1>&2 -} -readonly -f os::log::error - -# os::log::fatal writes the message to stderr and -# returns a non-zero code to force a process exit. -# A fatal error indicates that there is no chance -# of recovery. -# -# Arguments: -# - all: message to write -function os::log::fatal() { - local message; message="$( os::log::internal::prefix_lines "[FATAL]" "$*" )" - os::log::internal::to_logfile "${message}" - os::text::print_red "${message}" 1>&2 - exit 1 -} -readonly -f os::log::fatal - -# os::log::debug writes the message to stderr if -# the ${OS_DEBUG} variable is set. -# -# Globals: -# - OS_DEBUG -# Arguments: -# - all: message to write -function os::log::debug() { - local message; message="$( os::log::internal::prefix_lines "[DEBUG]" "$*" )" - os::log::internal::to_logfile "${message}" - if [[ -n "${OS_DEBUG:-}" ]]; then - os::text::print_blue "${message}" 1>&2 - fi -} -readonly -f os::log::debug - -# os::log::internal::to_logfile makes a best-effort -# attempt to write the message to the script logfile -# -# Globals: -# - LOG_DIR -# Arguments: -# - all: message to write -function os::log::internal::to_logfile() { - if [[ -n "${LOG_DIR:-}" && -d "${LOG_DIR-}" ]]; then - echo "$*" >>"${LOG_DIR}/scripts.log" - fi -} - -# os::log::internal::prefix_lines prints out the -# original content with the given prefix at the -# start of every line. -# -# Arguments: -# - 1: prefix for lines -# - 2: content to prefix -function os::log::internal::prefix_lines() { - local prefix="$1" - local content="$2" - - local old_ifs="${IFS}" - IFS=$'\n' - for line in ${content}; do - echo "${prefix} ${line}" - done - IFS="${old_ifs}" -} \ No newline at end of file diff --git a/hack/lib/log/stacktrace.sh b/hack/lib/log/stacktrace.sh deleted file mode 100644 index 6f79dc33..00000000 --- a/hack/lib/log/stacktrace.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# This library contains an implementation of a stack trace for Bash scripts. - -# os::log::stacktrace::install installs the stacktrace as a handler for the ERR signal if one -# has not already been installed and sets `set -o errtrace` in order to propagate the handler -# If the ERR trap is not initialized, installing this plugin will initialize it. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# - export OS_USE_STACKTRACE -function os::log::stacktrace::install() { - # setting 'errtrace' propagates our ERR handler to functions, expansions and subshells - set -o errtrace - - # OS_USE_STACKTRACE is read by os::util::trap at runtime to request a stacktrace - export OS_USE_STACKTRACE=true - - os::util::trap::init_err -} -readonly -f os::log::stacktrace::install - -# os::log::stacktrace::print prints the stacktrace and exits with the return code from the script that -# called for a stack trace. This function will always return 0 if it is not handling the signal, and if it -# is handling the signal, this function will always `exit`, not return, the return code it receives as -# its first argument. -# -# Globals: -# - BASH_SOURCE -# - BASH_LINENO -# - FUNCNAME -# Arguments: -# - 1: the return code of the command in the script that generated the ERR signal -# - 2: the last command that ran before handlers were invoked -# - 3: whether or not `set -o errexit` was set in the script that generated the ERR signal -# Returns: -# None -function os::log::stacktrace::print() { - local return_code=$1 - local last_command=$2 - local errexit_set=${3:-} - - if [[ "${return_code}" = "0" ]]; then - # we're not supposed to respond when no error has occurred - return 0 - fi - - if [[ -z "${errexit_set}" ]]; then - # if errexit wasn't set in the shell when the ERR signal was issued, then we can ignore the signal - # as this is not cause for failure - return 0 - fi - - # dump the entire stack for debugging purposes - os::log::debug "$( os::util::repository_relative_path "${BASH_SOURCE[0]}:${LINENO}: ${BASH_COMMAND}" )" - for (( i = 0; i < ${#BASH_LINENO[@]}; i++ )); do - os::log::debug "$( os::util::repository_relative_path "${BASH_SOURCE[$i+1]:-"$( os::util::repository_relative_path "$0" )"}" ):${BASH_LINENO[$i]}: ${FUNCNAME[$i]}" - done - - # iterate backwards through the stack until we leave library files, so we can be sure we start logging - # actual script code and not this handler's call - local stack_begin_index - for (( stack_begin_index = 0; stack_begin_index < ${#BASH_SOURCE[@]}; stack_begin_index++ )); do - if [[ ! "${BASH_SOURCE[${stack_begin_index}]}" =~ hack/lib/(log/stacktrace|util/trap)\.sh ]]; then - break - fi - done - - local preamble_finished - local stack_index=1 - local i - for (( i = stack_begin_index; i < ${#BASH_SOURCE[@]}; i++ )); do - local bash_source - bash_source="$( os::util::repository_relative_path "${BASH_SOURCE[$i]}" )" - if [[ -z "${preamble_finished:-}" ]]; then - preamble_finished=true - os::log::error "PID ${BASHPID:-$$}: ${bash_source}:${BASH_LINENO[$i-1]}: \`${last_command}\` exited with status ${return_code}." >&2 - os::log::info $'\t\t'"Stack Trace: " >&2 - os::log::info $'\t\t'" ${stack_index}: ${bash_source}:${BASH_LINENO[$i-1]}: \`${last_command}\`" >&2 - else - os::log::info $'\t\t'" ${stack_index}: ${bash_source}:${BASH_LINENO[$i-1]}: ${FUNCNAME[$i-1]}" >&2 - fi - stack_index=$(( stack_index + 1 )) - done - - # we know we're the privileged handler in this chain, so we can safely exit the shell without - # starving another handler of the privilege of reacting to this signal - os::log::info " Exiting with code ${return_code}." >&2 - exit "${return_code}" -} -readonly -f os::log::stacktrace::print diff --git a/hack/lib/log/system.sh b/hack/lib/log/system.sh deleted file mode 100644 index a4055644..00000000 --- a/hack/lib/log/system.sh +++ /dev/null @@ -1,243 +0,0 @@ -#!/bin/bash -# -# This library holds all of the system logging functions for OpenShift bash scripts. - -# os::log::system::install_cleanup installs os::log::system::clean_up as a trap on exit. -# If any traps are currently set for these signals, os::log::system::clean_up is prefixed. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# None -function os::log::system::install_cleanup() { - trap "os::log::system::clean_up; $(trap -p EXIT | awk -F"'" '{print $2}')" EXIT -} -readonly -f os::log::system::install_cleanup - -# os::log::system::clean_up should be trapped so that it can stop the logging utility once the script that -# installed it is finished. -# This function stops logging and generates plots of data for easy consumption. -# -# Globals: -# - LOG_DIR -# - LOGGER_PID -# - SAR_LOGFILE -# Arguments: -# None -# Returns: -# None -function os::log::system::clean_up() { - local return_code=$? - - # we don't want failures in this logger to - set +o errexit - - if jobs -pr | grep -q "${LOGGER_PID}"; then - kill -SIGTERM "${LOGGER_PID}" - # give logger ten seconds to gracefully exit before killing it - for (( i = 0; i < 10; i++ )); do - if ! jobs -pr | grep -q "${LOGGER_PID}"; then - # the logger has shutdown, we don't need to wait on it any longer - break - fi - done - - if jobs -pr | grep -q "${LOGGER_PID}"; then - # the logger has not shutdown, so kill it - kill -SIGKILL "${LOGGER_PID}" - fi - fi - - if ! which sadf >/dev/null 2>&1; then - os::log::warning "System logger data could not be unpacked and graphed, 'sadf' binary not found in this environment." - return 0 - fi - - if [[ ! -s "${SAR_LOGFILE:-}" ]]; then - os::log::warning "No system logger data could be found, log file missing." - return 0 - fi - - local log_subset_flags=( "-b" "-B" "-u ALL" "-q" "-r" ) - - local log_subset_names=( "iops" "paging" "cpu" "queue" "memory" ) - - local log_subset_file - local i - for (( i = 0; i < "${#log_subset_flags[@]}"; i++ )); do - log_subset_file="${LOG_DIR}/${log_subset_names[$i]}.txt" - # use sadf utility to extract data into easily-parseable format - sadf -d "${SAR_LOGFILE}" -- ${log_subset_flags[$i]} > "${log_subset_file}" - - local ignored_columns="hostname,interval," - - # special cases for special output from SAR, because the tool often gives us columns full of baloney - if [[ "${log_subset_names[$i]}" == "cpu" ]]; then - ignored_columns="${ignored_columns}CPU," - fi - - os::log::system::internal::prune_datafile "${log_subset_file}" "${ignored_columns}" - os::log::system::internal::plot "${log_subset_file}" - done - - # remove the `sar` log file for space constraints - rm -f "${SAR_LOGFILE}" - - return "${return_code}" -} -readonly -f os::log::system::clean_up - -# os::log::system::internal::prune_datafile removes the given columns from a datafile created by 'sadf -d' -# -# Globals: -# None -# Arguments: -# - 1: datafile -# - 2: comma-delimited columns to remove, with trailing comma -# Returns: -# None -function os::log::system::internal::prune_datafile() { - local datafile=$1 - local column_names=$2 - - if [[ "${#column_names}" -eq 0 ]]; then - return 0 - fi - - local columns_in_order - columns_in_order=( $( head -n 1 "${datafile}" | sed 's/^# //g' | tr ';' ' ' ) ) - - local columns_to_keep - local i - for (( i = 0; i < "${#columns_in_order[@]}"; i++ )); do - if ! echo "${column_names}" | grep -q "${columns_in_order[$i]},"; then - # this is a column we need to keep, adding one as 'cut' is 1-indexed - columns_to_keep+=( "$(( i + 1 ))" ) - fi - done - - # for the proper flag format for 'cut', we join the list delimiting with commas - columns_to_keep="$( IFS=','; echo "${columns_to_keep[*]}" )" - - cut --delimiter=';' -f"${columns_to_keep}" "${datafile}" > "${datafile}.tmp" - sed -i '1s/^/# /' "${datafile}.tmp" - mv "${datafile}.tmp" "${datafile}" -} -readonly -f os::log::system::internal::prune_datafile - -# os::log::system::internal::plot uses gnuplot to make a plot of some data across time points. This function is intended to be used -# on the output of a 'sar -f' read of a sar binary file. Plots will be made of all columns and stacked on each other with one x axis. -# This function needs the non-data columns of the file to be prefixed with comments. -# -# Globals: -# - LOG_DIR -# Arguments: -# - 1: data file -# Returns: -# None -function os::log::system::internal::plot() { - local datafile=$1 - local plotname - plotname="$(basename "${datafile}" .txt)" - - # we are expecting the output of a 'sadf -d' read, so the headers will be on the first line of the file - local headers - headers=( $( head -n 1 "${datafile}" | sed 's/^# //g' | tr ';' ' ' ) ) - - local records - local width - records="$(( $( wc -l < "${datafile}" ) - 1 ))" # one of these lines will be the header comment - if [[ "${records}" -gt 90 ]]; then - width="$(echo "8.5 + ${records}*0.025" | bc )" - else - width="8.5" - fi - - local gnuplot_directive=( "set terminal pdf size ${width}in,$(( 2 * (${#headers[@]} - 1) ))in" \ - "set output \"${LOG_DIR}/${plotname}.pdf\"" \ - "set datafile separator \";\"" \ - "set xdata time" \ - "set timefmt '%Y-%m-%d %H:%M:%S UTC'" \ - "set tmargin 1" \ - "set bmargin 1" \ - "set lmargin 20" \ - "set rmargin 20" \ - "set multiplot layout ${#headers[@]},1 title \"\n${plotname}\n\"" \ - "unset title" ) - - local i - for (( i = 1; i < "${#headers[@]}"; i++ )); do - local header - header="${headers[$i]}" - - if (( i == ${#headers[@]} - 1 )); then - # we need x-tick labels on the bottom plot - gnuplot_directive+=( "set xtics format '%H:%M:%S' rotate by -90" ) - else - gnuplot_directive+=( "set format x ''" ) - fi - - gnuplot_directive+=( "plot \"${datafile}\" using 1:$(( i + 1 )) title \"${header}\" with lines" ) - done - - # concatenate the array with newlines to get the final directive to send to gnuplot - gnuplot_directive="$( IFS=$'\n'; echo "${gnuplot_directive[*]}" )" - - { - printf '$ gnuplot <<< %s\n' "${gnuplot_directive}" - gnuplot <<< "${gnuplot_directive}" 2>&1 - printf '\n\n' - } >> "${LOG_DIR}/gnuplot.log" - - os::log::debug "Stacked plot for log subset \"${plotname}\" written to ${LOG_DIR}/${plotname}.pdf" -} -readonly -f os::log::system::internal::plot - -# os::log::system::start installs the system logger and begins logging -# -# Globals: -# - LOG_DIR -# Arguments: -# None -# Returns: -# - export LOGGER_PID -# - export SAR_LOGFILE -function os::log::system::start() { - if ! which sar >/dev/null 2>&1; then - os::log::debug "System logger could not be started, 'sar' binary not found in this environment." - return 0 - fi - - readonly SAR_LOGFILE="${LOG_DIR}/sar.log" - export SAR_LOGFILE - - os::log::system::internal::run "${SAR_LOGFILE}" "${LOG_DIR}/sar_stderr.log" - - os::log::system::install_cleanup -} -readonly -f os::log::system::start - -# os::log::system::internal::run runs the system logger in the background. -# 'sar' is configured to run once a second for 24 hours, so the cleanup trap should be installed to ensure that -# the process is killed once the parent script is finished. -# -# Globals: -# None -# Arguments: -# - 1: file to log binary outut to -# - 2: file to log stderr of the logger to -# Returns: -# None -function os::log::system::internal::run() { - local binary_logfile=$1 - local stderr_logfile=$2 - - sar -A -o "${binary_logfile}" 1 86400 1>/dev/null 2>"${stderr_logfile}" & - - LOGGER_PID=$! - readonly LOGGER_PID - export LOGGER_PID -} -readonly -f os::log::system::internal::run diff --git a/hack/lib/test/junit.sh b/hack/lib/test/junit.sh deleted file mode 100644 index 21026f89..00000000 --- a/hack/lib/test/junit.sh +++ /dev/null @@ -1,204 +0,0 @@ -#!/bin/bash -# This utility file contains functions that format test output to be parsed into jUnit XML - -# os::test::junit::declare_suite_start prints a message declaring the start of a test suite -# Any number of suites can be in flight at any time, so there is no failure condition for this -# script based on the number of suites in flight. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - NUM_OS_JUNIT_SUITES_IN_FLIGHT -# Arguments: -# - 1: the suite name that is starting -# Returns: -# - increment NUM_OS_JUNIT_SUITES_IN_FLIGHT -function os::test::junit::declare_suite_start() { - local suite_name=$1 - local num_suites=${NUM_OS_JUNIT_SUITES_IN_FLIGHT:-0} - - echo "=== BEGIN TEST SUITE github.com/openshift/origin/test/${suite_name} ===" >> "${JUNIT_REPORT_OUTPUT:-/dev/null}" - NUM_OS_JUNIT_SUITES_IN_FLIGHT=$(( ${num_suites} + 1 )) - export NUM_OS_JUNIT_SUITES_IN_FLIGHT -} -readonly -f os::test::junit::declare_suite_start - -# os::test::junit::declare_suite_end prints a message declaring the end of a test suite -# If there aren't any suites in flight, this function will fail. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - NUM_OS_JUNIT_SUITES_IN_FLIGHT -# Arguments: -# - 1: the suite name that is starting -# Returns: -# - export/decrement NUM_OS_JUNIT_SUITES_IN_FLIGHT -function os::test::junit::declare_suite_end() { - local num_suites=${NUM_OS_JUNIT_SUITES_IN_FLIGHT:-0} - if [[ "${num_suites}" -lt "1" ]]; then - # we can't end a suite if none have been started yet - echo "[ERROR] jUnit suite marker could not be placed, expected suites in flight, got ${num_suites}" - return 1 - fi - - echo "=== END TEST SUITE ===" >> "${JUNIT_REPORT_OUTPUT:-/dev/null}" - NUM_OS_JUNIT_SUITES_IN_FLIGHT=$(( ${num_suites} - 1 )) - export NUM_OS_JUNIT_SUITES_IN_FLIGHT -} -readonly -f os::test::junit::declare_suite_end - -# os::test::junit::declare_test_start prints a message declaring the start of a test case -# If there is already a test marked as being in flight, this function will fail. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - NUM_OS_JUNIT_TESTS_IN_FLIGHT -# Arguments: -# None -# Returns: -# - increment NUM_OS_JUNIT_TESTS_IN_FLIGHT -function os::test::junit::declare_test_start() { - local num_tests=${NUM_OS_JUNIT_TESTS_IN_FLIGHT:-0} - if [[ "${num_tests}" -ne "0" ]]; then - # someone's declaring the starting of a test when a test is already in flight - echo "[ERROR] jUnit test marker could not be placed, expected no tests in flight, got ${num_tests}" - return 1 - fi - - local num_suites=${NUM_OS_JUNIT_SUITES_IN_FLIGHT:-0} - if [[ "${num_suites}" -lt "1" ]]; then - # we can't end a test if no suites are in flight - echo "[ERROR] jUnit test marker could not be placed, expected suites in flight, got ${num_suites}" - return 1 - fi - - echo "=== BEGIN TEST CASE ===" >> "${JUNIT_REPORT_OUTPUT:-/dev/null}" - NUM_OS_JUNIT_TESTS_IN_FLIGHT=$(( ${num_tests} + 1 )) - export NUM_OS_JUNIT_TESTS_IN_FLIGHT -} -readonly -f os::test::junit::declare_test_start - -# os::test::junit::declare_test_end prints a message declaring the end of a test case -# If there is no test marked as being in flight, this function will fail. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - NUM_OS_JUNIT_TESTS_IN_FLIGHT -# Arguments: -# None -# Returns: -# - decrement NUM_OS_JUNIT_TESTS_IN_FLIGHT -function os::test::junit::declare_test_end() { - local num_tests=${NUM_OS_JUNIT_TESTS_IN_FLIGHT:-0} - if [[ "${num_tests}" -ne "1" ]]; then - # someone's declaring the end of a test when a test is not in flight - echo "[ERROR] jUnit test marker could not be placed, expected one test in flight, got ${num_tests}" - return 1 - fi - - echo "=== END TEST CASE ===" >> "${JUNIT_REPORT_OUTPUT:-/dev/null}" - NUM_OS_JUNIT_TESTS_IN_FLIGHT=$(( ${num_tests} - 1 )) - export NUM_OS_JUNIT_TESTS_IN_FLIGHT -} -readonly -f os::test::junit::declare_test_end - -# os::test::junit::check_test_counters checks that we do not have any test suites or test cases in flight -# This function should be called at the very end of any test script using jUnit markers to make sure no error in -# marking has occurred. -# -# Globals: -# - NUM_OS_JUNIT_SUITES_IN_FLIGHT -# - NUM_OS_JUNIT_TESTS_IN_FLIGHT -# Arguments: -# None -# Returns: -# None -function os::test::junit::check_test_counters() { - if [[ "${NUM_OS_JUNIT_SUITES_IN_FLIGHT-}" -ne "0" ]]; then - echo "[ERROR] Expected no test suites to be marked as in-flight at the end of testing, got ${NUM_OS_JUNIT_SUITES_IN_FLIGHT-}" - return 1 - elif [[ "${NUM_OS_JUNIT_TESTS_IN_FLIGHT-}" -ne "0" ]]; then - echo "[ERROR] Expected no test cases to be marked as in-flight at the end of testing, got ${NUM_OS_JUNIT_TESTS_IN_FLIGHT-}" - return 1 - fi -} -readonly -f os::test::junit::check_test_counters - -# os::test::junit::reconcile_output appends the necessary suite and test end statements to the jUnit output file -# in order to ensure that the file is in a consistent state to allow for parsing -# -# Globals: -# - NUM_OS_JUNIT_SUITES_IN_FLIGHT -# - NUM_OS_JUNIT_TESTS_IN_FLIGHT -# Arguments: -# None -# Returns: -# None -function os::test::junit::reconcile_output() { - if [[ "${NUM_OS_JUNIT_TESTS_IN_FLIGHT:-0}" = "1" ]]; then - os::test::junit::declare_test_end - fi - - for (( i = 0; i < ${NUM_OS_JUNIT_SUITES_IN_FLIGHT:-0}; i++ )); do - os::test::junit::declare_suite_end - done -} -readonly -f os::test::junit::reconcile_output - -# os::test::junit::generate_report determines which type of report is to -# be generated and does so from the raw output of the tests. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - ARTIFACT_DIR -# Arguments: -# None -# Returns: -# None -function os::test::junit::generate_report() { - if [[ -z "${JUNIT_REPORT_OUTPUT:-}" || - -n "${JUNIT_REPORT_OUTPUT:-}" && ! -s "${JUNIT_REPORT_OUTPUT:-}" ]]; then - # we can't generate a report - return - fi - - if grep -q "=== END TEST CASE ===" "${JUNIT_REPORT_OUTPUT}"; then - os::test::junit::reconcile_output - os::test::junit::check_test_counters - os::test::junit::internal::generate_report "oscmd" - else - os::test::junit::internal::generate_report "gotest" - fi -} - -# os::test::junit::internal::generate_report generats an XML jUnit -# report for either `os::cmd` or `go test`, based on the passed -# argument. If the `junitreport` binary is not present, it will be built. -# -# Globals: -# - JUNIT_REPORT_OUTPUT -# - ARTIFACT_DIR -# Arguments: -# - 1: specify which type of tests command output should junitreport read -# Returns: -# export JUNIT_REPORT_NUM_FAILED -function os::test::junit::internal::generate_report() { - local report_type="$1" - os::util::ensure::built_binary_exists 'junitreport' - - local report_file - report_file="$( mktemp "${ARTIFACT_DIR}/${report_type}_report_XXXXX" ).xml" - os::log::info "jUnit XML report placed at $( os::util::repository_relative_path ${report_file} )" - junitreport --type "${report_type}" \ - --suites nested \ - --roots github.com/openshift/origin \ - --output "${report_file}" \ - <"${JUNIT_REPORT_OUTPUT}" - - local summary - summary=$( junitreport summarize <"${report_file}" ) - - JUNIT_REPORT_NUM_FAILED="$( grep -oE "[0-9]+ failed" <<<"${summary}" )" - export JUNIT_REPORT_NUM_FAILED - - echo "${summary}" -} \ No newline at end of file diff --git a/hack/lib/util/ensure.sh b/hack/lib/util/ensure.sh deleted file mode 100644 index f8c3d047..00000000 --- a/hack/lib/util/ensure.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -# This script contains helper functions for ensuring that dependencies -# exist on a host system that are required to run Origin scripts. - -# os::util::ensure::system_binary_exists ensures that the -# given binary exists on the system in the $PATH. -# -# Globals: -# None -# Arguments: -# - 1: binary to search for -# Returns: -# None -function os::util::ensure::system_binary_exists() { - local binary="$1" - -if ! os::util::find::system_binary "${binary}" >/dev/null 2>&1; then - os::log::fatal "Required \`${binary}\` binary was not found in \$PATH." - fi -} -readonly -f os::util::ensure::system_binary_exists - -# os::util::ensure::built_binary_exists ensures that the -# given binary exists on the system in the local output -# directory for the current platform. If it doesn't, we -# will attempt to build it if we can determine the correct -# hack/build-go.sh target for the binary. -# -# This function will attempt to determine the correct -# hack/build-go.sh target for the binary, but may not -# be able to do so if the target doesn't live under -# cmd/ or tools/. In that case, one should be given. -# -# Globals: -# - OS_ROOT -# Arguments: -# - 1: binary to search for -# - 2: optional build target for this binary -# Returns: -# None -function os::util::ensure::built_binary_exists() { - local binary="$1" - local target="${2:-}" - - if ! os::util::find::built_binary "${binary}" >/dev/null 2>&1; then - if [[ -z "${target}" ]]; then - if [[ -d "${OS_ROOT}/cmd/${binary}" ]]; then - target="cmd/${binary}" - elif [[ -d "${OS_ROOT}/tools/${binary}" ]]; then - target="tools/${binary}" - elif [[ -d "${OS_ROOT}/tools/rebasehelpers/${binary}" ]]; then - target="tools/rebasehelpers/${binary}" - fi - fi - - if [[ -n "${target}" ]]; then - os::log::info "No compiled \`${binary}\` binary was found. Attempting to build one using: - $ hack/build-go.sh ${target}" - "${OS_ROOT}/hack/build-go.sh" "${target}" - else - os::log::fatal "No compiled \`${binary}\` binary was found and no build target could be determined. -Provide the binary and try running $0 again." - fi - fi -} -readonly -f os::util::ensure::built_binary_exists - -# os::util::ensure::gopath_binary_exists ensures that the -# given binary exists on the system in $GOPATH. If it -# doesn't, we will attempt to build it if we can determine -# the correct install path for the binary. -# -# Globals: -# - GOPATH -# Arguments: -# - 1: binary to search for -# - 2: [optional] path to install from -# Returns: -# None -function os::util::ensure::gopath_binary_exists() { - local binary="$1" - local install_path="${2:-}" - - if ! os::util::find::gopath_binary "${binary}" >/dev/null 2>&1; then - if [[ -n "${install_path:-}" ]]; then - os::log::info "No installed \`${binary}\` was found in \$GOPATH. Attempting to install using: - $ go get ${install_path}" - go get "${install_path}" - else - os::log::fatal "Required \`${binary}\` binary was not found in \$GOPATH." - fi - fi -} -readonly -f os::util::ensure::gopath_binary_exists diff --git a/hack/lib/util/environment.sh b/hack/lib/util/environment.sh deleted file mode 100644 index 6e0ffbf6..00000000 --- a/hack/lib/util/environment.sh +++ /dev/null @@ -1,289 +0,0 @@ -#!/bin/bash - -# This script holds library functions for setting up the shell environment for OpenShift scripts - -# os::util::environment::use_sudo updates $USE_SUDO to be 'true', so that later scripts choosing between -# execution using 'sudo' and execution without it chose to use 'sudo' -# -# Globals: -# None -# Arguments: -# None -# Returns: -# - export USE_SUDO -function os::util::environment::use_sudo() { - USE_SUDO=true - export USE_SUDO -} -readonly -f os::util::environment::use_sudo - -# os::util::environment::setup_time_vars sets up environment variables that describe durations of time -# These variables can be used to specify times for other utility functions -# -# Globals: -# None -# Arguments: -# None -# Returns: -# - export TIME_MS -# - export TIME_SEC -# - export TIME_MIN -function os::util::environment::setup_time_vars() { - TIME_MS=1 - export TIME_MS - TIME_SEC="$(( 1000 * ${TIME_MS} ))" - export TIME_SEC - TIME_MIN="$(( 60 * ${TIME_SEC} ))" - export TIME_MIN -} -readonly -f os::util::environment::setup_time_vars - -# os::util::environment::setup_all_server_vars sets up all environment variables necessary to configure and start an OpenShift server -# -# Globals: -# - OS_ROOT -# - PATH -# - TMPDIR -# - LOG_DIR -# - ARTIFACT_DIR -# - KUBELET_SCHEME -# - KUBELET_BIND_HOST -# - KUBELET_HOST -# - KUBELET_PORT -# - BASETMPDIR -# - ETCD_PORT -# - ETCD_PEER_PORT -# - API_BIND_HOST -# - API_HOST -# - API_PORT -# - API_SCHEME -# - PUBLIC_MASTER_HOST -# - USE_IMAGES -# Arguments: -# - 1: the path under the root temporary directory for OpenShift where these subdirectories should be made -# Returns: -# - export PATH -# - export BASETMPDIR -# - export LOG_DIR -# - export VOLUME_DIR -# - export ARTIFACT_DIR -# - export FAKE_HOME_DIR -# - export KUBELET_SCHEME -# - export KUBELET_BIND_HOST -# - export KUBELET_HOST -# - export KUBELET_PORT -# - export ETCD_PORT -# - export ETCD_PEER_PORT -# - export ETCD_DATA_DIR -# - export API_BIND_HOST -# - export API_HOST -# - export API_PORT -# - export API_SCHEME -# - export SERVER_CONFIG_DIR -# - export MASTER_CONFIG_DIR -# - export NODE_CONFIG_DIR -# - export USE_IMAGES -# - export TAG -function os::util::environment::setup_all_server_vars() { - os::util::environment::setup_kubelet_vars - os::util::environment::setup_etcd_vars - os::util::environment::setup_server_vars - os::util::environment::setup_images_vars -} -readonly -f os::util::environment::setup_all_server_vars - -# os::util::environment::update_path_var updates $PATH so that OpenShift binaries are available -# -# Globals: -# - OS_ROOT -# - PATH -# Arguments: -# None -# Returns: -# - export PATH -function os::util::environment::update_path_var() { - local prefix - if os::util::find::system_binary 'go' >/dev/null 2>&1; then - prefix+="${OS_OUTPUT_BINPATH}/$(os::build::host_platform):" - fi - if [[ -n "${GOPATH:-}" ]]; then - prefix+="${GOPATH}/bin:" - fi - - PATH="${prefix:-}${PATH}" - export PATH -} -readonly -f os::util::environment::update_path_var - -# os::util::environment::setup_tmpdir_vars sets up temporary directory path variables -# -# Globals: -# - TMPDIR -# Arguments: -# - 1: the path under the root temporary directory for OpenShift where these subdirectories should be made -# Returns: -# - export BASETMPDIR -# - export BASEOUTDIR -# - export LOG_DIR -# - export VOLUME_DIR -# - export ARTIFACT_DIR -# - export FAKE_HOME_DIR -# - export OS_TMP_ENV_SET -function os::util::environment::setup_tmpdir_vars() { - local sub_dir=$1 - - BASETMPDIR="${TMPDIR:-/tmp}/openshift/${sub_dir}" - export BASETMPDIR - VOLUME_DIR="${BASETMPDIR}/volumes" - export VOLUME_DIR - - BASEOUTDIR="${OS_OUTPUT_SCRIPTPATH}/${sub_dir}" - export BASEOUTDIR - LOG_DIR="${LOG_DIR:-${BASEOUTDIR}/logs}" - export LOG_DIR - ARTIFACT_DIR="${ARTIFACT_DIR:-${BASEOUTDIR}/artifacts}" - export ARTIFACT_DIR - FAKE_HOME_DIR="${BASEOUTDIR}/openshift.local.home" - export FAKE_HOME_DIR - - mkdir -p "${LOG_DIR}" "${VOLUME_DIR}" "${ARTIFACT_DIR}" "${FAKE_HOME_DIR}" - - export OS_TMP_ENV_SET="${sub_dir}" -} -readonly -f os::util::environment::setup_tmpdir_vars - -# os::util::environment::setup_kubelet_vars sets up environment variables necessary for interacting with the kubelet -# -# Globals: -# - KUBELET_SCHEME -# - KUBELET_BIND_HOST -# - KUBELET_HOST -# - KUBELET_PORT -# Arguments: -# None -# Returns: -# - export KUBELET_SCHEME -# - export KUBELET_BIND_HOST -# - export KUBELET_HOST -# - export KUBELET_PORT -function os::util::environment::setup_kubelet_vars() { - KUBELET_SCHEME="${KUBELET_SCHEME:-https}" - export KUBELET_SCHEME - KUBELET_BIND_HOST="${KUBELET_BIND_HOST:-$(openshift start --print-ip || echo "127.0.0.1")}" - export KUBELET_BIND_HOST - KUBELET_HOST="${KUBELET_HOST:-${KUBELET_BIND_HOST}}" - export KUBELET_HOST - KUBELET_PORT="${KUBELET_PORT:-10250}" - export KUBELET_PORT -} -readonly -f os::util::environment::setup_kubelet_vars - -# os::util::environment::setup_etcd_vars sets up environment variables necessary for interacting with etcd -# -# Globals: -# - BASETMPDIR -# - ETCD_HOST -# - ETCD_PORT -# - ETCD_PEER_PORT -# Arguments: -# None -# Returns: -# - export ETCD_HOST -# - export ETCD_PORT -# - export ETCD_PEER_PORT -# - export ETCD_DATA_DIR -function os::util::environment::setup_etcd_vars() { - ETCD_HOST="${ETCD_HOST:-127.0.0.1}" - export ETCD_HOST - ETCD_PORT="${ETCD_PORT:-4001}" - export ETCD_PORT - ETCD_PEER_PORT="${ETCD_PEER_PORT:-7001}" - export ETCD_PEER_PORT - - ETCD_DATA_DIR="${BASETMPDIR}/etcd" - export ETCD_DATA_DIR - - mkdir -p "${ETCD_DATA_DIR}" -} -readonly -f os::util::environment::setup_etcd_vars - -# os::util::environment::setup_server_vars sets up environment variables necessary for interacting with the server -# -# Globals: -# - BASETMPDIR -# - KUBELET_HOST -# - API_BIND_HOST -# - API_HOST -# - API_PORT -# - API_SCHEME -# - PUBLIC_MASTER_HOST -# Arguments: -# None -# Returns: -# - export API_BIND_HOST -# - export API_HOST -# - export API_PORT -# - export API_SCHEME -# - export SERVER_CONFIG_DIR -# - export MASTER_CONFIG_DIR -# - export NODE_CONFIG_DIR -function os::util::environment::setup_server_vars() { - # turn on cache mutation detector every time we start a server - KUBE_CACHE_MUTATION_DETECTOR="${KUBE_CACHE_MUTATION_DETECTOR:-true}" - export KUBE_CACHE_MUTATION_DETECTOR - - API_BIND_HOST="${API_BIND_HOST:-$(openshift start --print-ip || echo "127.0.0.1")}" - export API_BIND_HOST - API_HOST="${API_HOST:-${API_BIND_HOST}}" - export API_HOST - API_PORT="${API_PORT:-8443}" - export API_PORT - API_SCHEME="${API_SCHEME:-https}" - export API_SCHEME - - MASTER_ADDR="${API_SCHEME}://${API_HOST}:${API_PORT}" - export MASTER_ADDR - PUBLIC_MASTER_HOST="${PUBLIC_MASTER_HOST:-${API_HOST}}" - export PUBLIC_MASTER_HOST - - SERVER_CONFIG_DIR="${BASETMPDIR}/openshift.local.config" - export SERVER_CONFIG_DIR - MASTER_CONFIG_DIR="${SERVER_CONFIG_DIR}/master" - export MASTER_CONFIG_DIR - NODE_CONFIG_DIR="${SERVER_CONFIG_DIR}/node-${KUBELET_HOST}" - export NODE_CONFIG_DIR - - mkdir -p "${SERVER_CONFIG_DIR}" "${MASTER_CONFIG_DIR}" "${NODE_CONFIG_DIR}" -} -readonly -f os::util::environment::setup_server_vars - -# os::util::environment::setup_images_vars sets up environment variables necessary for interacting with release images -# -# Globals: -# - OS_ROOT -# - USE_IMAGES -# Arguments: -# None -# Returns: -# - export USE_IMAGES -# - export TAG -# - export MAX_IMAGES_BULK_IMPORTED_PER_REPOSITORY -function os::util::environment::setup_images_vars() { - # Use either the latest release built images, or latest. - IMAGE_PREFIX="${OS_IMAGE_PREFIX:-"openshift/origin"}" - if [[ -z "${USE_IMAGES-}" ]]; then - TAG='latest' - export TAG - USE_IMAGES="${IMAGE_PREFIX}-\${component}:latest" - export USE_IMAGES - - if [[ -e "${OS_ROOT}/_output/local/releases/.commit" ]]; then - TAG="$(cat "${OS_ROOT}/_output/local/releases/.commit")" - export TAG - USE_IMAGES="${IMAGE_PREFIX}-\${component}:${TAG}" - export USE_IMAGES - fi - fi - export MAX_IMAGES_BULK_IMPORTED_PER_REPOSITORY="${MAX_IMAGES_BULK_IMPORTED_PER_REPOSITORY:-3}" -} -readonly -f os::util::environment::setup_images_vars diff --git a/hack/lib/util/find.sh b/hack/lib/util/find.sh deleted file mode 100644 index 19aa3098..00000000 --- a/hack/lib/util/find.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -# This script contains helper functions for finding components -# in the Origin repository or on the host machine running scripts. - -# os::util::find::system_binary determines the absolute path to a -# system binary, if it exists. -# -# Globals: -# None -# Arguments: -# - 1: binary name -# Returns: -# - location of the binary -function os::util::find::system_binary() { - local binary_name="$1" - - command -v "${binary_name}" -} -readonly -f os::util::find::system_binary - -# os::util::find::built_binary determines the absolute path to a -# built binary for the current platform, if it exists. -# -# Globals: -# - OS_OUTPUT_BINPATH -# Arguments: -# - 1: binary name -# Returns: -# - location of the binary -function os::util::find::built_binary() { - local binary_name="$1" - - local binary_path; binary_path="${OS_OUTPUT_BINPATH}/$( os::build::host_platform )/${binary_name}" - # we need to check that the path leads to a file - # as directories also have the executable bit set - if [[ -f "${binary_path}" && -x "${binary_path}" ]]; then - echo "${binary_path}" - return 0 - else - return 1 - fi -} -readonly -f os::util::find::built_binary - -# os::util::find::gopath_binary determines the absolute path to a -# binary installed through the go toolchain, if it exists. -# -# Globals: -# - GOPATH -# Arguments: -# - 1: binary name -# Returns: -# - location of the binary -function os::util::find::gopath_binary() { - local binary_name="$1" - - local old_ifs="${IFS}" - IFS=":" - for part in ${GOPATH}; do - local binary_path="${part}/bin/${binary_name}" - # we need to check that the path leads to a file - # as directories also have the executable bit set - if [[ -f "${binary_path}" && -x "${binary_path}" ]]; then - echo "${binary_path}" - IFS="${old_ifs}" - return 0 - fi - done - IFS="${old_ifs}" - return 1 -} -readonly -f os::util::find::gopath_binary \ No newline at end of file diff --git a/hack/lib/util/golang.sh b/hack/lib/util/golang.sh deleted file mode 100644 index 3bbb1ebf..00000000 --- a/hack/lib/util/golang.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# This library holds golang related utility functions. - -# os::golang::verify_go_version ensure the go tool exists and is a viable version. -function os::golang::verify_go_version() { - os::util::ensure::system_binary_exists 'go' - - local go_version - go_version=($(go version)) - if [[ "${go_version[2]}" != go1.8* ]]; then - os::log::info "Detected go version: ${go_version[*]}." - if [[ -z "${PERMISSIVE_GO:-}" ]]; then - os::log::fatal "Please install Go version ${OS_REQUIRED_GO_VERSION} or use PERMISSIVE_GO=y to bypass this check." - else - os::log::warning "Detected golang version doesn't match required Go version." - os::log::warning "This version mismatch could lead to differences in execution between this run and the CI systems." - return 0 - fi - fi -} -readonly -f os::golang::verify_go_version diff --git a/hack/lib/util/misc.sh b/hack/lib/util/misc.sh deleted file mode 100644 index 7a1406f4..00000000 --- a/hack/lib/util/misc.sh +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash -# -# This library holds miscellaneous utility functions. If there begin to be groups of functions in this -# file that share intent or are thematically similar, they should be split into their own files. - -# os::util::describe_return_code describes an exit code -# -# Globals: -# - OS_SCRIPT_START_TIME -# Arguments: -# - 1: exit code to describe -# Returns: -# None -function os::util::describe_return_code() { - local return_code=$1 - local message="$( os::util::repository_relative_path $0 ) exited with code ${return_code} " - - if [[ -n "${OS_SCRIPT_START_TIME:-}" ]]; then - local end_time - end_time="$(date +%s)" - local elapsed_time - elapsed_time="$(( end_time - OS_SCRIPT_START_TIME ))" - local formatted_time - formatted_time="$( os::util::format_seconds "${elapsed_time}" )" - message+="after ${formatted_time}" - fi - - if [[ "${return_code}" = "0" ]]; then - os::log::info "${message}" - else - os::log::error "${message}" - fi -} -readonly -f os::util::describe_return_code - -# os::util::install_describe_return_code installs the return code describer for the EXIT trap -# If the EXIT trap is not initialized, installing this plugin will initialize it. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# - export OS_DESCRIBE_RETURN_CODE -# - export OS_SCRIPT_START_TIME -function os::util::install_describe_return_code() { - export OS_DESCRIBE_RETURN_CODE="true" - OS_SCRIPT_START_TIME="$( date +%s )"; export OS_SCRIPT_START_TIME - os::util::trap::init_exit -} -readonly -f os::util::install_describe_return_code - -# OS_ORIGINAL_WD is the original working directory the script sourcing this utility file was called -# from. This is an important directory as if $0 is a relative path, we cannot use the following path -# utility without knowing from where $0 is relative. -if [[ -z "${OS_ORIGINAL_WD:-}" ]]; then - # since this could be sourced in a context where the utilities are already loaded, - # we want to ensure that this is re-entrant, so we only set $OS_ORIGINAL_WD if it - # is not set already - OS_ORIGINAL_WD="$( pwd )" - readonly OS_ORIGINAL_WD - export OS_ORIGINAL_WD -fi - -# os::util::repository_relative_path returns the relative path from the $OS_ROOT directory to the -# given file, if the file is inside of the $OS_ROOT directory. If the file is outside of $OS_ROOT, -# this function will return the absolute path to the file -# -# Globals: -# - OS_ROOT -# Arguments: -# - 1: the path to relativize -# Returns: -# None -function os::util::repository_relative_path() { - local filename=$1 - local directory; directory="$( dirname "${filename}" )" - filename="$( basename "${filename}" )" - - if [[ "${directory}" != "${OS_ROOT}"* ]]; then - pushd "${OS_ORIGINAL_WD}" >/dev/null 2>&1 - directory="$( os::util::absolute_path "${directory}" )" - popd >/dev/null 2>&1 - fi - - directory="${directory##*${OS_ROOT}/}" - - echo "${directory}/${filename}" -} -readonly -f os::util::repository_relative_path - -# os::util::format_seconds formats a duration of time in seconds to print in HHh MMm SSs -# -# Globals: -# None -# Arguments: -# - 1: time in seconds to format -# Return: -# None -function os::util::format_seconds() { - local raw_seconds=$1 - - local hours minutes seconds - (( hours=raw_seconds/3600 )) - (( minutes=(raw_seconds%3600)/60 )) - (( seconds=raw_seconds%60 )) - - printf '%02dh %02dm %02ds' "${hours}" "${minutes}" "${seconds}" -} -readonly -f os::util::format_seconds - -# os::util::sed attempts to make our Bash scripts agnostic to the platform -# on which they run `sed` by glossing over a discrepancy in flag use in GNU. -# -# Globals: -# None -# Arguments: -# - all: arguments to pass to `sed -i` -# Return: -# None -function os::util::sed() { - local sudo="${USE_SUDO:+sudo}" - if LANG=C sed --help 2>&1 | grep -q "GNU sed"; then - ${sudo} sed -i'' "$@" - else - ${sudo} sed -i '' "$@" - fi -} -readonly -f os::util::sed - -# os::util::base64decode attempts to make our Bash scripts agnostic to the platform -# on which they run `base64decode` by glossing over a discrepancy in flag use in GNU. -# -# Globals: -# None -# Arguments: -# - all: arguments to pass to `base64decode` -# Return: -# None -function os::util::base64decode() { - if [[ "$(go env GOHOSTOS)" == "darwin" ]]; then - base64 -D "$@" - else - base64 -d "$@" - fi -} -readonly -f os::util::base64decode diff --git a/hack/lib/util/text.sh b/hack/lib/util/text.sh deleted file mode 100644 index 456aeea2..00000000 --- a/hack/lib/util/text.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/bash - -# This file contains helpful aliases for manipulating the output text to the terminal as -# well as functions for one-command augmented printing. - -# os::text::reset resets the terminal output to default if it is called in a TTY -function os::text::reset() { - if os::text::internal::is_tty; then - tput sgr0 - fi -} -readonly -f os::text::reset - -# os::text::bold sets the terminal output to bold text if it is called in a TTY -function os::text::bold() { - if os::text::internal::is_tty; then - tput bold - fi -} -readonly -f os::text::bold - -# os::text::red sets the terminal output to red text if it is called in a TTY -function os::text::red() { - if os::text::internal::is_tty; then - tput setaf 1 - fi -} -readonly -f os::text::red - -# os::text::green sets the terminal output to green text if it is called in a TTY -function os::text::green() { - if os::text::internal::is_tty; then - tput setaf 2 - fi -} -readonly -f os::text::green - -# os::text::blue sets the terminal output to blue text if it is called in a TTY -function os::text::blue() { - if os::text::internal::is_tty; then - tput setaf 4 - fi -} -readonly -f os::text::blue - -# os::text::yellow sets the terminal output to yellow text if it is called in a TTY -function os::text::yellow() { - if os::text::internal::is_tty; then - tput setaf 11 - fi -} -readonly -f os::text::yellow - -# os::text::clear_last_line clears the text from the last line of output to the -# terminal and leaves the cursor on that line to allow for overwriting that text -# if it is called in a TTY -function os::text::clear_last_line() { - if os::text::internal::is_tty; then - tput cuu 1 - tput el - fi -} -readonly -f os::text::clear_last_line - -# os::text::clear_string attempts to clear the entirety of a string from the terminal. -# If the string contains literal tabs or other characters that take up more than one -# character space in output, or if the window size is changed before this function -# is called, it will not function correctly. -# No action is taken if this is called outside of a TTY -function os::text::clear_string() { - local -r string="$1" - if os::text::internal::is_tty; then - echo "${string}" | while read line; do - # num_lines is the number of terminal lines this one line of output - # would have taken up with the current terminal width in columns - local num_lines=$(( ${#line} / $( tput cols ) )) - for (( i = 0; i <= num_lines; i++ )); do - os::text::clear_last_line - done - done - fi -} - -# os::text::internal::is_tty determines if we are outputting to a TTY -function os::text::internal::is_tty() { - [[ -t 1 && -n "${TERM:-}" ]] -} -readonly -f os::text::internal::is_tty - -# os::text::print_bold prints all input in bold text -function os::text::print_bold() { - os::text::bold - echo "${*}" - os::text::reset -} -readonly -f os::text::print_bold - -# os::text::print_red prints all input in red text -function os::text::print_red() { - os::text::red - echo "${*}" - os::text::reset -} -readonly -f os::text::print_red - -# os::text::print_red_bold prints all input in bold red text -function os::text::print_red_bold() { - os::text::red - os::text::bold - echo "${*}" - os::text::reset -} -readonly -f os::text::print_red_bold - -# os::text::print_green prints all input in green text -function os::text::print_green() { - os::text::green - echo "${*}" - os::text::reset -} -readonly -f os::text::print_green - -# os::text::print_green_bold prints all input in bold green text -function os::text::print_green_bold() { - os::text::green - os::text::bold - echo "${*}" - os::text::reset -} -readonly -f os::text::print_green_bold - -# os::text::print_blue prints all input in blue text -function os::text::print_blue() { - os::text::blue - echo "${*}" - os::text::reset -} -readonly -f os::text::print_blue - -# os::text::print_blue_bold prints all input in bold blue text -function os::text::print_blue_bold() { - os::text::blue - os::text::bold - echo "${*}" - os::text::reset -} -readonly -f os::text::print_blue_bold - -# os::text::print_yellow prints all input in yellow text -function os::text::print_yellow() { - os::text::yellow - echo "${*}" - os::text::reset -} -readonly -f os::text::print_yellow - -# os::text::print_yellow_bold prints all input in bold yellow text -function os::text::print_yellow_bold() { - os::text::yellow - os::text::bold - echo "${*}" - os::text::reset -} -readonly -f os::text::print_yellow_bold diff --git a/hack/lib/util/trap.sh b/hack/lib/util/trap.sh deleted file mode 100644 index 30d25203..00000000 --- a/hack/lib/util/trap.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# -# This library defines the trap handlers for the ERR and EXIT signals. Any new handler for these signals -# must be added to these handlers and activated by the environment variable mechanism that the rest use. -# These functions ensure that no handler can ever alter the exit code that was emitted by a command -# in a test script. - -# os::util::trap::init_err initializes the privileged handler for the ERR signal if it hasn't -# been registered already. This will overwrite any other handlers registered on the signal. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# None -function os::util::trap::init_err() { - if ! trap -p ERR | grep -q 'os::util::trap::err_handler'; then - trap 'os::util::trap::err_handler;' ERR - fi -} -readonly -f os::util::trap::init_err - -# os::util::trap::init_exit initializes the privileged handler for the EXIT signal if it hasn't -# been registered already. This will overwrite any other handlers registered on the signal. -# -# Globals: -# None -# Arguments: -# None -# Returns: -# None -function os::util::trap::init_exit() { - if ! trap -p EXIT | grep -q 'os::util::trap::exit_handler'; then - trap 'os::util::trap::exit_handler;' EXIT - fi -} -readonly -f os::util::trap::init_exit - -# os::util::trap::err_handler is the handler for the ERR signal. -# -# Globals: -# - OS_TRAP_DEBUG -# - OS_USE_STACKTRACE -# Arguments: -# None -# Returns: -# - returns original return code, allows privileged handler to exit if necessary -function os::util::trap::err_handler() { - local -r return_code=$? - local -r last_command="${BASH_COMMAND}" - - if set +o | grep -q '\-o errexit'; then - local -r errexit_set=true - fi - - if [[ "${OS_TRAP_DEBUG:-}" = "true" ]]; then - echo "[DEBUG] Error handler executing with return code \`${return_code}\`, last command \`${last_command}\`, and errexit set \`${errexit_set:-}\`" - fi - - if [[ "${OS_USE_STACKTRACE:-}" = "true" ]]; then - # the OpenShift stacktrace function is treated as a privileged handler for this signal - # and is therefore allowed to run outside of a subshell in order to allow it to `exit` - # if necessary - os::log::stacktrace::print "${return_code}" "${last_command}" "${errexit_set:-}" - fi - - return "${return_code}" -} -readonly -f os::util::trap::err_handler - -# os::util::trap::exit_handler is the handler for the EXIT signal. -# -# Globals: -# - OS_TRAP_DEBUG -# - OS_DESCRIBE_RETURN_CODE -# Arguments: -# None -# Returns: -# - original exit code of the script that exited -function os::util::trap::exit_handler() { - local -r return_code=$? - - # we do not want these traps to be able to trigger more errors, we can let them fail silently - set +o errexit - - if [[ "${OS_TRAP_DEBUG:-}" = "true" ]]; then - echo "[DEBUG] Exit handler executing with return code \`${return_code}\`" - fi - - # the following envars selectively enable optional exit traps, all of which are run inside of - # a subshell in order to sandbox them and not allow them to influence how this script will exit - if [[ "${OS_DESCRIBE_RETURN_CODE:-}" = "true" ]]; then - ( os::util::describe_return_code "${return_code}" ) - fi - - exit "${return_code}" -} -readonly -f os::util::trap::exit_handler diff --git a/hack/update-gen-deepcopy.sh b/hack/update-gen-deepcopy.sh deleted file mode 100755 index ddd4df90..00000000 --- a/hack/update-gen-deepcopy.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -source "$(dirname "${BASH_SOURCE}")/lib/init.sh" -source "$(dirname "${BASH_SOURCE}")/lib/generator-help.sh" - -go run -modfile ./tools/go.mod k8s.io/code-generator/cmd/deepcopy-gen \ - --go-header-file "hack/copyright.go.txt" \ - --output-file zz_generated.deepcopy.go \ - $(find_dirs_containing_comment_tags "+k8s:deepcopy-gen=") diff --git a/helm/charts/typhoon/templates/clusterrolebinding.yaml b/helm/charts/typhoon/templates/clusterrolebinding.yaml index 8b09ea4a..d811258d 100644 --- a/helm/charts/typhoon/templates/clusterrolebinding.yaml +++ b/helm/charts/typhoon/templates/clusterrolebinding.yaml @@ -54,21 +54,6 @@ roleRef: --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding -metadata: - name: filter-adapter - labels: - {{- include "typhoon.controller.labels" . | nindent 4 }} -subjects: - - kind: ServiceAccount - name: {{ include "typhoon.serviceAccountName" . }} - namespace: {{ .Release.Namespace }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: filter-adapter ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding metadata: name: splitter-adapter labels: @@ -116,4 +101,4 @@ roleRef: kind: ClusterRole name: addressable-resolver-typhoon -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/charts/typhoon/templates/clusterroles.yaml b/helm/charts/typhoon/templates/clusterroles.yaml index 3270282f..7411b155 100644 --- a/helm/charts/typhoon/templates/clusterroles.yaml +++ b/helm/charts/typhoon/templates/clusterroles.yaml @@ -364,46 +364,7 @@ rules: - get --- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: filter-adapter - labels: - {{- include "typhoon.controller.labels" . | nindent 4 }} -rules: - - apiGroups: - - '' - resources: - - events - verbs: - - create - - patch - - update - - apiGroups: - - '' - resources: - - configmaps - verbs: - - get - - list - - watch - - apiGroups: - - routing.typhoon.zeiss.com - resources: - - filters - verbs: - - get - - list - - watch - - apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - create - - update ---- + apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: @@ -573,4 +534,4 @@ rules: - list - watch -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/charts/typhoon/templates/deployment.yaml b/helm/charts/typhoon/templates/deployment.yaml index 17840265..0bcfca65 100644 --- a/helm/charts/typhoon/templates/deployment.yaml +++ b/helm/charts/typhoon/templates/deployment.yaml @@ -74,8 +74,6 @@ spec: - name: XMLTOJSONTRANSFORMATION_IMAGE value: "{{ .Values.global.image.repository }}/xmltojsontransformation-adapter:{{ .Values.global.image.tag | default .Chart.AppVersion }}" # Routing adapters - - name: FILTER_IMAGE - value: "{{ .Values.global.image.repository }}/filter-adapter:{{ .Values.global.image.tag | default .Chart.AppVersion }}" - name: SPLITTER_IMAGE value: "{{ .Values.global.image.repository }}/splitter-adapter:{{ .Values.global.image.tag | default .Chart.AppVersion }}" # Custom build adapters @@ -104,4 +102,4 @@ spec: {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/pkg/client/generated/clientset/internalclientset/fake/clientset_generated.go b/pkg/client/generated/clientset/internalclientset/fake/clientset_generated.go index 6175860b..11f8f6c7 100644 --- a/pkg/client/generated/clientset/internalclientset/fake/clientset_generated.go +++ b/pkg/client/generated/clientset/internalclientset/fake/clientset_generated.go @@ -23,8 +23,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { diff --git a/pkg/client/generated/clientset/internalclientset/typed/extensions/v1alpha1/fake/fake_function.go b/pkg/client/generated/clientset/internalclientset/typed/extensions/v1alpha1/fake/fake_function.go index 9f55d668..0c8099f6 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/extensions/v1alpha1/fake/fake_function.go +++ b/pkg/client/generated/clientset/internalclientset/typed/extensions/v1alpha1/fake/fake_function.go @@ -25,22 +25,24 @@ var functionsKind = v1alpha1.SchemeGroupVersion.WithKind("Function") // Get takes name of the function, and returns the corresponding function object, and an error if there is any. func (c *FakeFunctions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Function, err error) { + emptyResult := &v1alpha1.Function{} obj, err := c.Fake. - Invokes(testing.NewGetAction(functionsResource, c.ns, name), &v1alpha1.Function{}) + Invokes(testing.NewGetActionWithOptions(functionsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Function), err } // List takes label and field selectors, and returns the list of Functions that match those selectors. func (c *FakeFunctions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FunctionList, err error) { + emptyResult := &v1alpha1.FunctionList{} obj, err := c.Fake. - Invokes(testing.NewListAction(functionsResource, functionsKind, c.ns, opts), &v1alpha1.FunctionList{}) + Invokes(testing.NewListActionWithOptions(functionsResource, functionsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeFunctions) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested functions. func (c *FakeFunctions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(functionsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(functionsResource, c.ns, opts)) } // Create takes the representation of a function and creates it. Returns the server's representation of the function, and an error, if there is any. func (c *FakeFunctions) Create(ctx context.Context, function *v1alpha1.Function, opts v1.CreateOptions) (result *v1alpha1.Function, err error) { + emptyResult := &v1alpha1.Function{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(functionsResource, c.ns, function), &v1alpha1.Function{}) + Invokes(testing.NewCreateActionWithOptions(functionsResource, c.ns, function, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Function), err } // Update takes the representation of a function and updates it. Returns the server's representation of the function, and an error, if there is any. func (c *FakeFunctions) Update(ctx context.Context, function *v1alpha1.Function, opts v1.UpdateOptions) (result *v1alpha1.Function, err error) { + emptyResult := &v1alpha1.Function{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(functionsResource, c.ns, function), &v1alpha1.Function{}) + Invokes(testing.NewUpdateActionWithOptions(functionsResource, c.ns, function, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Function), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeFunctions) UpdateStatus(ctx context.Context, function *v1alpha1.Function, opts v1.UpdateOptions) (*v1alpha1.Function, error) { +func (c *FakeFunctions) UpdateStatus(ctx context.Context, function *v1alpha1.Function, opts v1.UpdateOptions) (result *v1alpha1.Function, err error) { + emptyResult := &v1alpha1.Function{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(functionsResource, "status", c.ns, function), &v1alpha1.Function{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(functionsResource, "status", c.ns, function, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Function), err } @@ -107,7 +112,7 @@ func (c *FakeFunctions) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeFunctions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(functionsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(functionsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.FunctionList{}) return err @@ -115,11 +120,12 @@ func (c *FakeFunctions) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched function. func (c *FakeFunctions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Function, err error) { + emptyResult := &v1alpha1.Function{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(functionsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Function{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(functionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Function), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/extensions/v1alpha1/function.go b/pkg/client/generated/clientset/internalclientset/typed/extensions/v1alpha1/function.go index 9b70873a..356f68e1 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/extensions/v1alpha1/function.go +++ b/pkg/client/generated/clientset/internalclientset/typed/extensions/v1alpha1/function.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/extensions/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // FunctionsGetter has a method to return a FunctionInterface. @@ -24,6 +23,7 @@ type FunctionsGetter interface { type FunctionInterface interface { Create(ctx context.Context, function *v1alpha1.Function, opts v1.CreateOptions) (*v1alpha1.Function, error) Update(ctx context.Context, function *v1alpha1.Function, opts v1.UpdateOptions) (*v1alpha1.Function, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, function *v1alpha1.Function, opts v1.UpdateOptions) (*v1alpha1.Function, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type FunctionInterface interface { // functions implements FunctionInterface type functions struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Function, *v1alpha1.FunctionList] } // newFunctions returns a Functions func newFunctions(c *ExtensionsV1alpha1Client, namespace string) *functions { return &functions{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Function, *v1alpha1.FunctionList]( + "functions", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Function { return &v1alpha1.Function{} }, + func() *v1alpha1.FunctionList { return &v1alpha1.FunctionList{} }), } } - -// Get takes name of the function, and returns the corresponding function object, and an error if there is any. -func (c *functions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Function, err error) { - result = &v1alpha1.Function{} - err = c.client.Get(). - Namespace(c.ns). - Resource("functions"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Functions that match those selectors. -func (c *functions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FunctionList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.FunctionList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("functions"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested functions. -func (c *functions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("functions"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a function and creates it. Returns the server's representation of the function, and an error, if there is any. -func (c *functions) Create(ctx context.Context, function *v1alpha1.Function, opts v1.CreateOptions) (result *v1alpha1.Function, err error) { - result = &v1alpha1.Function{} - err = c.client.Post(). - Namespace(c.ns). - Resource("functions"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(function). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a function and updates it. Returns the server's representation of the function, and an error, if there is any. -func (c *functions) Update(ctx context.Context, function *v1alpha1.Function, opts v1.UpdateOptions) (result *v1alpha1.Function, err error) { - result = &v1alpha1.Function{} - err = c.client.Put(). - Namespace(c.ns). - Resource("functions"). - Name(function.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(function). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *functions) UpdateStatus(ctx context.Context, function *v1alpha1.Function, opts v1.UpdateOptions) (result *v1alpha1.Function, err error) { - result = &v1alpha1.Function{} - err = c.client.Put(). - Namespace(c.ns). - Resource("functions"). - Name(function.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(function). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the function and deletes it. Returns an error if one occurs. -func (c *functions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("functions"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *functions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("functions"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched function. -func (c *functions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Function, err error) { - result = &v1alpha1.Function{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("functions"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/bridge.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/bridge.go index c8af4ab9..6925ac82 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/bridge.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/bridge.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // BridgesGetter has a method to return a BridgeInterface. @@ -24,6 +23,7 @@ type BridgesGetter interface { type BridgeInterface interface { Create(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.CreateOptions) (*v1alpha1.Bridge, error) Update(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.UpdateOptions) (*v1alpha1.Bridge, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.UpdateOptions) (*v1alpha1.Bridge, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type BridgeInterface interface { // bridges implements BridgeInterface type bridges struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Bridge, *v1alpha1.BridgeList] } // newBridges returns a Bridges func newBridges(c *FlowV1alpha1Client, namespace string) *bridges { return &bridges{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Bridge, *v1alpha1.BridgeList]( + "bridges", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Bridge { return &v1alpha1.Bridge{} }, + func() *v1alpha1.BridgeList { return &v1alpha1.BridgeList{} }), } } - -// Get takes name of the bridge, and returns the corresponding bridge object, and an error if there is any. -func (c *bridges) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Bridge, err error) { - result = &v1alpha1.Bridge{} - err = c.client.Get(). - Namespace(c.ns). - Resource("bridges"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Bridges that match those selectors. -func (c *bridges) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BridgeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.BridgeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("bridges"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested bridges. -func (c *bridges) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("bridges"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a bridge and creates it. Returns the server's representation of the bridge, and an error, if there is any. -func (c *bridges) Create(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.CreateOptions) (result *v1alpha1.Bridge, err error) { - result = &v1alpha1.Bridge{} - err = c.client.Post(). - Namespace(c.ns). - Resource("bridges"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(bridge). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a bridge and updates it. Returns the server's representation of the bridge, and an error, if there is any. -func (c *bridges) Update(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.UpdateOptions) (result *v1alpha1.Bridge, err error) { - result = &v1alpha1.Bridge{} - err = c.client.Put(). - Namespace(c.ns). - Resource("bridges"). - Name(bridge.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(bridge). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *bridges) UpdateStatus(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.UpdateOptions) (result *v1alpha1.Bridge, err error) { - result = &v1alpha1.Bridge{} - err = c.client.Put(). - Namespace(c.ns). - Resource("bridges"). - Name(bridge.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(bridge). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the bridge and deletes it. Returns an error if one occurs. -func (c *bridges) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("bridges"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *bridges) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("bridges"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched bridge. -func (c *bridges) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Bridge, err error) { - result = &v1alpha1.Bridge{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("bridges"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_bridge.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_bridge.go index 658f6fcd..46875385 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_bridge.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_bridge.go @@ -25,22 +25,24 @@ var bridgesKind = v1alpha1.SchemeGroupVersion.WithKind("Bridge") // Get takes name of the bridge, and returns the corresponding bridge object, and an error if there is any. func (c *FakeBridges) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Bridge, err error) { + emptyResult := &v1alpha1.Bridge{} obj, err := c.Fake. - Invokes(testing.NewGetAction(bridgesResource, c.ns, name), &v1alpha1.Bridge{}) + Invokes(testing.NewGetActionWithOptions(bridgesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Bridge), err } // List takes label and field selectors, and returns the list of Bridges that match those selectors. func (c *FakeBridges) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BridgeList, err error) { + emptyResult := &v1alpha1.BridgeList{} obj, err := c.Fake. - Invokes(testing.NewListAction(bridgesResource, bridgesKind, c.ns, opts), &v1alpha1.BridgeList{}) + Invokes(testing.NewListActionWithOptions(bridgesResource, bridgesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeBridges) List(ctx context.Context, opts v1.ListOptions) (result *v1 // Watch returns a watch.Interface that watches the requested bridges. func (c *FakeBridges) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(bridgesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(bridgesResource, c.ns, opts)) } // Create takes the representation of a bridge and creates it. Returns the server's representation of the bridge, and an error, if there is any. func (c *FakeBridges) Create(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.CreateOptions) (result *v1alpha1.Bridge, err error) { + emptyResult := &v1alpha1.Bridge{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(bridgesResource, c.ns, bridge), &v1alpha1.Bridge{}) + Invokes(testing.NewCreateActionWithOptions(bridgesResource, c.ns, bridge, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Bridge), err } // Update takes the representation of a bridge and updates it. Returns the server's representation of the bridge, and an error, if there is any. func (c *FakeBridges) Update(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.UpdateOptions) (result *v1alpha1.Bridge, err error) { + emptyResult := &v1alpha1.Bridge{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(bridgesResource, c.ns, bridge), &v1alpha1.Bridge{}) + Invokes(testing.NewUpdateActionWithOptions(bridgesResource, c.ns, bridge, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Bridge), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeBridges) UpdateStatus(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.UpdateOptions) (*v1alpha1.Bridge, error) { +func (c *FakeBridges) UpdateStatus(ctx context.Context, bridge *v1alpha1.Bridge, opts v1.UpdateOptions) (result *v1alpha1.Bridge, err error) { + emptyResult := &v1alpha1.Bridge{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(bridgesResource, "status", c.ns, bridge), &v1alpha1.Bridge{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(bridgesResource, "status", c.ns, bridge, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Bridge), err } @@ -107,7 +112,7 @@ func (c *FakeBridges) Delete(ctx context.Context, name string, opts v1.DeleteOpt // DeleteCollection deletes a collection of objects. func (c *FakeBridges) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(bridgesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(bridgesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.BridgeList{}) return err @@ -115,11 +120,12 @@ func (c *FakeBridges) DeleteCollection(ctx context.Context, opts v1.DeleteOption // Patch applies the patch and returns the patched bridge. func (c *FakeBridges) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Bridge, err error) { + emptyResult := &v1alpha1.Bridge{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(bridgesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Bridge{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(bridgesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Bridge), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_jqtransformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_jqtransformation.go index fff63935..b789501b 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_jqtransformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_jqtransformation.go @@ -25,22 +25,24 @@ var jqtransformationsKind = v1alpha1.SchemeGroupVersion.WithKind("JQTransformati // Get takes name of the jQTransformation, and returns the corresponding jQTransformation object, and an error if there is any. func (c *FakeJQTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.JQTransformation, err error) { + emptyResult := &v1alpha1.JQTransformation{} obj, err := c.Fake. - Invokes(testing.NewGetAction(jqtransformationsResource, c.ns, name), &v1alpha1.JQTransformation{}) + Invokes(testing.NewGetActionWithOptions(jqtransformationsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JQTransformation), err } // List takes label and field selectors, and returns the list of JQTransformations that match those selectors. func (c *FakeJQTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.JQTransformationList, err error) { + emptyResult := &v1alpha1.JQTransformationList{} obj, err := c.Fake. - Invokes(testing.NewListAction(jqtransformationsResource, jqtransformationsKind, c.ns, opts), &v1alpha1.JQTransformationList{}) + Invokes(testing.NewListActionWithOptions(jqtransformationsResource, jqtransformationsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeJQTransformations) List(ctx context.Context, opts v1.ListOptions) ( // Watch returns a watch.Interface that watches the requested jQTransformations. func (c *FakeJQTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(jqtransformationsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(jqtransformationsResource, c.ns, opts)) } // Create takes the representation of a jQTransformation and creates it. Returns the server's representation of the jQTransformation, and an error, if there is any. func (c *FakeJQTransformations) Create(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.CreateOptions) (result *v1alpha1.JQTransformation, err error) { + emptyResult := &v1alpha1.JQTransformation{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(jqtransformationsResource, c.ns, jQTransformation), &v1alpha1.JQTransformation{}) + Invokes(testing.NewCreateActionWithOptions(jqtransformationsResource, c.ns, jQTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JQTransformation), err } // Update takes the representation of a jQTransformation and updates it. Returns the server's representation of the jQTransformation, and an error, if there is any. func (c *FakeJQTransformations) Update(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.UpdateOptions) (result *v1alpha1.JQTransformation, err error) { + emptyResult := &v1alpha1.JQTransformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(jqtransformationsResource, c.ns, jQTransformation), &v1alpha1.JQTransformation{}) + Invokes(testing.NewUpdateActionWithOptions(jqtransformationsResource, c.ns, jQTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JQTransformation), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeJQTransformations) UpdateStatus(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.UpdateOptions) (*v1alpha1.JQTransformation, error) { +func (c *FakeJQTransformations) UpdateStatus(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.UpdateOptions) (result *v1alpha1.JQTransformation, err error) { + emptyResult := &v1alpha1.JQTransformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(jqtransformationsResource, "status", c.ns, jQTransformation), &v1alpha1.JQTransformation{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(jqtransformationsResource, "status", c.ns, jQTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JQTransformation), err } @@ -107,7 +112,7 @@ func (c *FakeJQTransformations) Delete(ctx context.Context, name string, opts v1 // DeleteCollection deletes a collection of objects. func (c *FakeJQTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(jqtransformationsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(jqtransformationsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.JQTransformationList{}) return err @@ -115,11 +120,12 @@ func (c *FakeJQTransformations) DeleteCollection(ctx context.Context, opts v1.De // Patch applies the patch and returns the patched jQTransformation. func (c *FakeJQTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.JQTransformation, err error) { + emptyResult := &v1alpha1.JQTransformation{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(jqtransformationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.JQTransformation{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(jqtransformationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JQTransformation), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_synchronizer.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_synchronizer.go index 172b91c5..638bfbad 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_synchronizer.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_synchronizer.go @@ -25,22 +25,24 @@ var synchronizersKind = v1alpha1.SchemeGroupVersion.WithKind("Synchronizer") // Get takes name of the synchronizer, and returns the corresponding synchronizer object, and an error if there is any. func (c *FakeSynchronizers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Synchronizer, err error) { + emptyResult := &v1alpha1.Synchronizer{} obj, err := c.Fake. - Invokes(testing.NewGetAction(synchronizersResource, c.ns, name), &v1alpha1.Synchronizer{}) + Invokes(testing.NewGetActionWithOptions(synchronizersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Synchronizer), err } // List takes label and field selectors, and returns the list of Synchronizers that match those selectors. func (c *FakeSynchronizers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SynchronizerList, err error) { + emptyResult := &v1alpha1.SynchronizerList{} obj, err := c.Fake. - Invokes(testing.NewListAction(synchronizersResource, synchronizersKind, c.ns, opts), &v1alpha1.SynchronizerList{}) + Invokes(testing.NewListActionWithOptions(synchronizersResource, synchronizersKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeSynchronizers) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested synchronizers. func (c *FakeSynchronizers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(synchronizersResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(synchronizersResource, c.ns, opts)) } // Create takes the representation of a synchronizer and creates it. Returns the server's representation of the synchronizer, and an error, if there is any. func (c *FakeSynchronizers) Create(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.CreateOptions) (result *v1alpha1.Synchronizer, err error) { + emptyResult := &v1alpha1.Synchronizer{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(synchronizersResource, c.ns, synchronizer), &v1alpha1.Synchronizer{}) + Invokes(testing.NewCreateActionWithOptions(synchronizersResource, c.ns, synchronizer, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Synchronizer), err } // Update takes the representation of a synchronizer and updates it. Returns the server's representation of the synchronizer, and an error, if there is any. func (c *FakeSynchronizers) Update(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.UpdateOptions) (result *v1alpha1.Synchronizer, err error) { + emptyResult := &v1alpha1.Synchronizer{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(synchronizersResource, c.ns, synchronizer), &v1alpha1.Synchronizer{}) + Invokes(testing.NewUpdateActionWithOptions(synchronizersResource, c.ns, synchronizer, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Synchronizer), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSynchronizers) UpdateStatus(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.UpdateOptions) (*v1alpha1.Synchronizer, error) { +func (c *FakeSynchronizers) UpdateStatus(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.UpdateOptions) (result *v1alpha1.Synchronizer, err error) { + emptyResult := &v1alpha1.Synchronizer{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(synchronizersResource, "status", c.ns, synchronizer), &v1alpha1.Synchronizer{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(synchronizersResource, "status", c.ns, synchronizer, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Synchronizer), err } @@ -107,7 +112,7 @@ func (c *FakeSynchronizers) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeSynchronizers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(synchronizersResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(synchronizersResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.SynchronizerList{}) return err @@ -115,11 +120,12 @@ func (c *FakeSynchronizers) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched synchronizer. func (c *FakeSynchronizers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Synchronizer, err error) { + emptyResult := &v1alpha1.Synchronizer{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(synchronizersResource, c.ns, name, pt, data, subresources...), &v1alpha1.Synchronizer{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(synchronizersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Synchronizer), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_transformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_transformation.go index b2346b30..85565a7b 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_transformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_transformation.go @@ -25,22 +25,24 @@ var transformationsKind = v1alpha1.SchemeGroupVersion.WithKind("Transformation") // Get takes name of the transformation, and returns the corresponding transformation object, and an error if there is any. func (c *FakeTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Transformation, err error) { + emptyResult := &v1alpha1.Transformation{} obj, err := c.Fake. - Invokes(testing.NewGetAction(transformationsResource, c.ns, name), &v1alpha1.Transformation{}) + Invokes(testing.NewGetActionWithOptions(transformationsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Transformation), err } // List takes label and field selectors, and returns the list of Transformations that match those selectors. func (c *FakeTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TransformationList, err error) { + emptyResult := &v1alpha1.TransformationList{} obj, err := c.Fake. - Invokes(testing.NewListAction(transformationsResource, transformationsKind, c.ns, opts), &v1alpha1.TransformationList{}) + Invokes(testing.NewListActionWithOptions(transformationsResource, transformationsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeTransformations) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested transformations. func (c *FakeTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(transformationsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(transformationsResource, c.ns, opts)) } // Create takes the representation of a transformation and creates it. Returns the server's representation of the transformation, and an error, if there is any. func (c *FakeTransformations) Create(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.CreateOptions) (result *v1alpha1.Transformation, err error) { + emptyResult := &v1alpha1.Transformation{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(transformationsResource, c.ns, transformation), &v1alpha1.Transformation{}) + Invokes(testing.NewCreateActionWithOptions(transformationsResource, c.ns, transformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Transformation), err } // Update takes the representation of a transformation and updates it. Returns the server's representation of the transformation, and an error, if there is any. func (c *FakeTransformations) Update(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.UpdateOptions) (result *v1alpha1.Transformation, err error) { + emptyResult := &v1alpha1.Transformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(transformationsResource, c.ns, transformation), &v1alpha1.Transformation{}) + Invokes(testing.NewUpdateActionWithOptions(transformationsResource, c.ns, transformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Transformation), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeTransformations) UpdateStatus(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.UpdateOptions) (*v1alpha1.Transformation, error) { +func (c *FakeTransformations) UpdateStatus(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.UpdateOptions) (result *v1alpha1.Transformation, err error) { + emptyResult := &v1alpha1.Transformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(transformationsResource, "status", c.ns, transformation), &v1alpha1.Transformation{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(transformationsResource, "status", c.ns, transformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Transformation), err } @@ -107,7 +112,7 @@ func (c *FakeTransformations) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(transformationsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(transformationsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.TransformationList{}) return err @@ -115,11 +120,12 @@ func (c *FakeTransformations) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched transformation. func (c *FakeTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Transformation, err error) { + emptyResult := &v1alpha1.Transformation{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(transformationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Transformation{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(transformationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Transformation), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_workertransformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_workertransformation.go index 1435dfae..35fae414 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_workertransformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_workertransformation.go @@ -25,22 +25,24 @@ var workertransformationsKind = v1alpha1.SchemeGroupVersion.WithKind("WorkerTran // Get takes name of the workerTransformation, and returns the corresponding workerTransformation object, and an error if there is any. func (c *FakeWorkerTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.WorkerTransformation, err error) { + emptyResult := &v1alpha1.WorkerTransformation{} obj, err := c.Fake. - Invokes(testing.NewGetAction(workertransformationsResource, c.ns, name), &v1alpha1.WorkerTransformation{}) + Invokes(testing.NewGetActionWithOptions(workertransformationsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WorkerTransformation), err } // List takes label and field selectors, and returns the list of WorkerTransformations that match those selectors. func (c *FakeWorkerTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.WorkerTransformationList, err error) { + emptyResult := &v1alpha1.WorkerTransformationList{} obj, err := c.Fake. - Invokes(testing.NewListAction(workertransformationsResource, workertransformationsKind, c.ns, opts), &v1alpha1.WorkerTransformationList{}) + Invokes(testing.NewListActionWithOptions(workertransformationsResource, workertransformationsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeWorkerTransformations) List(ctx context.Context, opts v1.ListOption // Watch returns a watch.Interface that watches the requested workerTransformations. func (c *FakeWorkerTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(workertransformationsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(workertransformationsResource, c.ns, opts)) } // Create takes the representation of a workerTransformation and creates it. Returns the server's representation of the workerTransformation, and an error, if there is any. func (c *FakeWorkerTransformations) Create(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.CreateOptions) (result *v1alpha1.WorkerTransformation, err error) { + emptyResult := &v1alpha1.WorkerTransformation{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(workertransformationsResource, c.ns, workerTransformation), &v1alpha1.WorkerTransformation{}) + Invokes(testing.NewCreateActionWithOptions(workertransformationsResource, c.ns, workerTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WorkerTransformation), err } // Update takes the representation of a workerTransformation and updates it. Returns the server's representation of the workerTransformation, and an error, if there is any. func (c *FakeWorkerTransformations) Update(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.UpdateOptions) (result *v1alpha1.WorkerTransformation, err error) { + emptyResult := &v1alpha1.WorkerTransformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(workertransformationsResource, c.ns, workerTransformation), &v1alpha1.WorkerTransformation{}) + Invokes(testing.NewUpdateActionWithOptions(workertransformationsResource, c.ns, workerTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WorkerTransformation), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWorkerTransformations) UpdateStatus(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.UpdateOptions) (*v1alpha1.WorkerTransformation, error) { +func (c *FakeWorkerTransformations) UpdateStatus(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.UpdateOptions) (result *v1alpha1.WorkerTransformation, err error) { + emptyResult := &v1alpha1.WorkerTransformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(workertransformationsResource, "status", c.ns, workerTransformation), &v1alpha1.WorkerTransformation{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(workertransformationsResource, "status", c.ns, workerTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WorkerTransformation), err } @@ -107,7 +112,7 @@ func (c *FakeWorkerTransformations) Delete(ctx context.Context, name string, opt // DeleteCollection deletes a collection of objects. func (c *FakeWorkerTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(workertransformationsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(workertransformationsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.WorkerTransformationList{}) return err @@ -115,11 +120,12 @@ func (c *FakeWorkerTransformations) DeleteCollection(ctx context.Context, opts v // Patch applies the patch and returns the patched workerTransformation. func (c *FakeWorkerTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.WorkerTransformation, err error) { + emptyResult := &v1alpha1.WorkerTransformation{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(workertransformationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.WorkerTransformation{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(workertransformationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WorkerTransformation), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_xmltojsontransformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_xmltojsontransformation.go index 5dbeaead..ab5ab029 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_xmltojsontransformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_xmltojsontransformation.go @@ -25,22 +25,24 @@ var xmltojsontransformationsKind = v1alpha1.SchemeGroupVersion.WithKind("XMLToJS // Get takes name of the xMLToJSONTransformation, and returns the corresponding xMLToJSONTransformation object, and an error if there is any. func (c *FakeXMLToJSONTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.XMLToJSONTransformation, err error) { + emptyResult := &v1alpha1.XMLToJSONTransformation{} obj, err := c.Fake. - Invokes(testing.NewGetAction(xmltojsontransformationsResource, c.ns, name), &v1alpha1.XMLToJSONTransformation{}) + Invokes(testing.NewGetActionWithOptions(xmltojsontransformationsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XMLToJSONTransformation), err } // List takes label and field selectors, and returns the list of XMLToJSONTransformations that match those selectors. func (c *FakeXMLToJSONTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.XMLToJSONTransformationList, err error) { + emptyResult := &v1alpha1.XMLToJSONTransformationList{} obj, err := c.Fake. - Invokes(testing.NewListAction(xmltojsontransformationsResource, xmltojsontransformationsKind, c.ns, opts), &v1alpha1.XMLToJSONTransformationList{}) + Invokes(testing.NewListActionWithOptions(xmltojsontransformationsResource, xmltojsontransformationsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeXMLToJSONTransformations) List(ctx context.Context, opts v1.ListOpt // Watch returns a watch.Interface that watches the requested xMLToJSONTransformations. func (c *FakeXMLToJSONTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(xmltojsontransformationsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(xmltojsontransformationsResource, c.ns, opts)) } // Create takes the representation of a xMLToJSONTransformation and creates it. Returns the server's representation of the xMLToJSONTransformation, and an error, if there is any. func (c *FakeXMLToJSONTransformations) Create(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.CreateOptions) (result *v1alpha1.XMLToJSONTransformation, err error) { + emptyResult := &v1alpha1.XMLToJSONTransformation{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(xmltojsontransformationsResource, c.ns, xMLToJSONTransformation), &v1alpha1.XMLToJSONTransformation{}) + Invokes(testing.NewCreateActionWithOptions(xmltojsontransformationsResource, c.ns, xMLToJSONTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XMLToJSONTransformation), err } // Update takes the representation of a xMLToJSONTransformation and updates it. Returns the server's representation of the xMLToJSONTransformation, and an error, if there is any. func (c *FakeXMLToJSONTransformations) Update(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.UpdateOptions) (result *v1alpha1.XMLToJSONTransformation, err error) { + emptyResult := &v1alpha1.XMLToJSONTransformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(xmltojsontransformationsResource, c.ns, xMLToJSONTransformation), &v1alpha1.XMLToJSONTransformation{}) + Invokes(testing.NewUpdateActionWithOptions(xmltojsontransformationsResource, c.ns, xMLToJSONTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XMLToJSONTransformation), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeXMLToJSONTransformations) UpdateStatus(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.UpdateOptions) (*v1alpha1.XMLToJSONTransformation, error) { +func (c *FakeXMLToJSONTransformations) UpdateStatus(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.UpdateOptions) (result *v1alpha1.XMLToJSONTransformation, err error) { + emptyResult := &v1alpha1.XMLToJSONTransformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(xmltojsontransformationsResource, "status", c.ns, xMLToJSONTransformation), &v1alpha1.XMLToJSONTransformation{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(xmltojsontransformationsResource, "status", c.ns, xMLToJSONTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XMLToJSONTransformation), err } @@ -107,7 +112,7 @@ func (c *FakeXMLToJSONTransformations) Delete(ctx context.Context, name string, // DeleteCollection deletes a collection of objects. func (c *FakeXMLToJSONTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(xmltojsontransformationsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(xmltojsontransformationsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.XMLToJSONTransformationList{}) return err @@ -115,11 +120,12 @@ func (c *FakeXMLToJSONTransformations) DeleteCollection(ctx context.Context, opt // Patch applies the patch and returns the patched xMLToJSONTransformation. func (c *FakeXMLToJSONTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.XMLToJSONTransformation, err error) { + emptyResult := &v1alpha1.XMLToJSONTransformation{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(xmltojsontransformationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.XMLToJSONTransformation{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(xmltojsontransformationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XMLToJSONTransformation), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_xslttransformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_xslttransformation.go index c42b6c1f..e4c6c734 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_xslttransformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/fake/fake_xslttransformation.go @@ -25,22 +25,24 @@ var xslttransformationsKind = v1alpha1.SchemeGroupVersion.WithKind("XSLTTransfor // Get takes name of the xSLTTransformation, and returns the corresponding xSLTTransformation object, and an error if there is any. func (c *FakeXSLTTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.XSLTTransformation, err error) { + emptyResult := &v1alpha1.XSLTTransformation{} obj, err := c.Fake. - Invokes(testing.NewGetAction(xslttransformationsResource, c.ns, name), &v1alpha1.XSLTTransformation{}) + Invokes(testing.NewGetActionWithOptions(xslttransformationsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XSLTTransformation), err } // List takes label and field selectors, and returns the list of XSLTTransformations that match those selectors. func (c *FakeXSLTTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.XSLTTransformationList, err error) { + emptyResult := &v1alpha1.XSLTTransformationList{} obj, err := c.Fake. - Invokes(testing.NewListAction(xslttransformationsResource, xslttransformationsKind, c.ns, opts), &v1alpha1.XSLTTransformationList{}) + Invokes(testing.NewListActionWithOptions(xslttransformationsResource, xslttransformationsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeXSLTTransformations) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested xSLTTransformations. func (c *FakeXSLTTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(xslttransformationsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(xslttransformationsResource, c.ns, opts)) } // Create takes the representation of a xSLTTransformation and creates it. Returns the server's representation of the xSLTTransformation, and an error, if there is any. func (c *FakeXSLTTransformations) Create(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.CreateOptions) (result *v1alpha1.XSLTTransformation, err error) { + emptyResult := &v1alpha1.XSLTTransformation{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(xslttransformationsResource, c.ns, xSLTTransformation), &v1alpha1.XSLTTransformation{}) + Invokes(testing.NewCreateActionWithOptions(xslttransformationsResource, c.ns, xSLTTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XSLTTransformation), err } // Update takes the representation of a xSLTTransformation and updates it. Returns the server's representation of the xSLTTransformation, and an error, if there is any. func (c *FakeXSLTTransformations) Update(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.UpdateOptions) (result *v1alpha1.XSLTTransformation, err error) { + emptyResult := &v1alpha1.XSLTTransformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(xslttransformationsResource, c.ns, xSLTTransformation), &v1alpha1.XSLTTransformation{}) + Invokes(testing.NewUpdateActionWithOptions(xslttransformationsResource, c.ns, xSLTTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XSLTTransformation), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeXSLTTransformations) UpdateStatus(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.UpdateOptions) (*v1alpha1.XSLTTransformation, error) { +func (c *FakeXSLTTransformations) UpdateStatus(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.UpdateOptions) (result *v1alpha1.XSLTTransformation, err error) { + emptyResult := &v1alpha1.XSLTTransformation{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(xslttransformationsResource, "status", c.ns, xSLTTransformation), &v1alpha1.XSLTTransformation{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(xslttransformationsResource, "status", c.ns, xSLTTransformation, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XSLTTransformation), err } @@ -107,7 +112,7 @@ func (c *FakeXSLTTransformations) Delete(ctx context.Context, name string, opts // DeleteCollection deletes a collection of objects. func (c *FakeXSLTTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(xslttransformationsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(xslttransformationsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.XSLTTransformationList{}) return err @@ -115,11 +120,12 @@ func (c *FakeXSLTTransformations) DeleteCollection(ctx context.Context, opts v1. // Patch applies the patch and returns the patched xSLTTransformation. func (c *FakeXSLTTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.XSLTTransformation, err error) { + emptyResult := &v1alpha1.XSLTTransformation{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(xslttransformationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.XSLTTransformation{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(xslttransformationsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.XSLTTransformation), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/jqtransformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/jqtransformation.go index ca3382e3..ad9f1ce4 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/jqtransformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/jqtransformation.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // JQTransformationsGetter has a method to return a JQTransformationInterface. @@ -24,6 +23,7 @@ type JQTransformationsGetter interface { type JQTransformationInterface interface { Create(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.CreateOptions) (*v1alpha1.JQTransformation, error) Update(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.UpdateOptions) (*v1alpha1.JQTransformation, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.UpdateOptions) (*v1alpha1.JQTransformation, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type JQTransformationInterface interface { // jQTransformations implements JQTransformationInterface type jQTransformations struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.JQTransformation, *v1alpha1.JQTransformationList] } // newJQTransformations returns a JQTransformations func newJQTransformations(c *FlowV1alpha1Client, namespace string) *jQTransformations { return &jQTransformations{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.JQTransformation, *v1alpha1.JQTransformationList]( + "jqtransformations", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.JQTransformation { return &v1alpha1.JQTransformation{} }, + func() *v1alpha1.JQTransformationList { return &v1alpha1.JQTransformationList{} }), } } - -// Get takes name of the jQTransformation, and returns the corresponding jQTransformation object, and an error if there is any. -func (c *jQTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.JQTransformation, err error) { - result = &v1alpha1.JQTransformation{} - err = c.client.Get(). - Namespace(c.ns). - Resource("jqtransformations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of JQTransformations that match those selectors. -func (c *jQTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.JQTransformationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.JQTransformationList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("jqtransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested jQTransformations. -func (c *jQTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("jqtransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a jQTransformation and creates it. Returns the server's representation of the jQTransformation, and an error, if there is any. -func (c *jQTransformations) Create(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.CreateOptions) (result *v1alpha1.JQTransformation, err error) { - result = &v1alpha1.JQTransformation{} - err = c.client.Post(). - Namespace(c.ns). - Resource("jqtransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jQTransformation). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a jQTransformation and updates it. Returns the server's representation of the jQTransformation, and an error, if there is any. -func (c *jQTransformations) Update(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.UpdateOptions) (result *v1alpha1.JQTransformation, err error) { - result = &v1alpha1.JQTransformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("jqtransformations"). - Name(jQTransformation.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jQTransformation). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *jQTransformations) UpdateStatus(ctx context.Context, jQTransformation *v1alpha1.JQTransformation, opts v1.UpdateOptions) (result *v1alpha1.JQTransformation, err error) { - result = &v1alpha1.JQTransformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("jqtransformations"). - Name(jQTransformation.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jQTransformation). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the jQTransformation and deletes it. Returns an error if one occurs. -func (c *jQTransformations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("jqtransformations"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *jQTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("jqtransformations"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched jQTransformation. -func (c *jQTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.JQTransformation, err error) { - result = &v1alpha1.JQTransformation{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("jqtransformations"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/synchronizer.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/synchronizer.go index b4920eb0..ae4fafce 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/synchronizer.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/synchronizer.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // SynchronizersGetter has a method to return a SynchronizerInterface. @@ -24,6 +23,7 @@ type SynchronizersGetter interface { type SynchronizerInterface interface { Create(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.CreateOptions) (*v1alpha1.Synchronizer, error) Update(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.UpdateOptions) (*v1alpha1.Synchronizer, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.UpdateOptions) (*v1alpha1.Synchronizer, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type SynchronizerInterface interface { // synchronizers implements SynchronizerInterface type synchronizers struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Synchronizer, *v1alpha1.SynchronizerList] } // newSynchronizers returns a Synchronizers func newSynchronizers(c *FlowV1alpha1Client, namespace string) *synchronizers { return &synchronizers{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Synchronizer, *v1alpha1.SynchronizerList]( + "synchronizers", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Synchronizer { return &v1alpha1.Synchronizer{} }, + func() *v1alpha1.SynchronizerList { return &v1alpha1.SynchronizerList{} }), } } - -// Get takes name of the synchronizer, and returns the corresponding synchronizer object, and an error if there is any. -func (c *synchronizers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Synchronizer, err error) { - result = &v1alpha1.Synchronizer{} - err = c.client.Get(). - Namespace(c.ns). - Resource("synchronizers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Synchronizers that match those selectors. -func (c *synchronizers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SynchronizerList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.SynchronizerList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("synchronizers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested synchronizers. -func (c *synchronizers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("synchronizers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a synchronizer and creates it. Returns the server's representation of the synchronizer, and an error, if there is any. -func (c *synchronizers) Create(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.CreateOptions) (result *v1alpha1.Synchronizer, err error) { - result = &v1alpha1.Synchronizer{} - err = c.client.Post(). - Namespace(c.ns). - Resource("synchronizers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(synchronizer). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a synchronizer and updates it. Returns the server's representation of the synchronizer, and an error, if there is any. -func (c *synchronizers) Update(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.UpdateOptions) (result *v1alpha1.Synchronizer, err error) { - result = &v1alpha1.Synchronizer{} - err = c.client.Put(). - Namespace(c.ns). - Resource("synchronizers"). - Name(synchronizer.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(synchronizer). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *synchronizers) UpdateStatus(ctx context.Context, synchronizer *v1alpha1.Synchronizer, opts v1.UpdateOptions) (result *v1alpha1.Synchronizer, err error) { - result = &v1alpha1.Synchronizer{} - err = c.client.Put(). - Namespace(c.ns). - Resource("synchronizers"). - Name(synchronizer.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(synchronizer). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the synchronizer and deletes it. Returns an error if one occurs. -func (c *synchronizers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("synchronizers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *synchronizers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("synchronizers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched synchronizer. -func (c *synchronizers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Synchronizer, err error) { - result = &v1alpha1.Synchronizer{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("synchronizers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/transformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/transformation.go index eb59fa16..8abb850b 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/transformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/transformation.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TransformationsGetter has a method to return a TransformationInterface. @@ -24,6 +23,7 @@ type TransformationsGetter interface { type TransformationInterface interface { Create(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.CreateOptions) (*v1alpha1.Transformation, error) Update(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.UpdateOptions) (*v1alpha1.Transformation, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.UpdateOptions) (*v1alpha1.Transformation, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type TransformationInterface interface { // transformations implements TransformationInterface type transformations struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Transformation, *v1alpha1.TransformationList] } // newTransformations returns a Transformations func newTransformations(c *FlowV1alpha1Client, namespace string) *transformations { return &transformations{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Transformation, *v1alpha1.TransformationList]( + "transformations", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Transformation { return &v1alpha1.Transformation{} }, + func() *v1alpha1.TransformationList { return &v1alpha1.TransformationList{} }), } } - -// Get takes name of the transformation, and returns the corresponding transformation object, and an error if there is any. -func (c *transformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Transformation, err error) { - result = &v1alpha1.Transformation{} - err = c.client.Get(). - Namespace(c.ns). - Resource("transformations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Transformations that match those selectors. -func (c *transformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TransformationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.TransformationList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("transformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested transformations. -func (c *transformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("transformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a transformation and creates it. Returns the server's representation of the transformation, and an error, if there is any. -func (c *transformations) Create(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.CreateOptions) (result *v1alpha1.Transformation, err error) { - result = &v1alpha1.Transformation{} - err = c.client.Post(). - Namespace(c.ns). - Resource("transformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(transformation). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a transformation and updates it. Returns the server's representation of the transformation, and an error, if there is any. -func (c *transformations) Update(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.UpdateOptions) (result *v1alpha1.Transformation, err error) { - result = &v1alpha1.Transformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("transformations"). - Name(transformation.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(transformation). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *transformations) UpdateStatus(ctx context.Context, transformation *v1alpha1.Transformation, opts v1.UpdateOptions) (result *v1alpha1.Transformation, err error) { - result = &v1alpha1.Transformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("transformations"). - Name(transformation.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(transformation). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the transformation and deletes it. Returns an error if one occurs. -func (c *transformations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("transformations"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *transformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("transformations"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched transformation. -func (c *transformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Transformation, err error) { - result = &v1alpha1.Transformation{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("transformations"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/workertransformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/workertransformation.go index 330592b3..800e303f 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/workertransformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/workertransformation.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // WorkerTransformationsGetter has a method to return a WorkerTransformationInterface. @@ -24,6 +23,7 @@ type WorkerTransformationsGetter interface { type WorkerTransformationInterface interface { Create(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.CreateOptions) (*v1alpha1.WorkerTransformation, error) Update(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.UpdateOptions) (*v1alpha1.WorkerTransformation, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.UpdateOptions) (*v1alpha1.WorkerTransformation, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type WorkerTransformationInterface interface { // workerTransformations implements WorkerTransformationInterface type workerTransformations struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.WorkerTransformation, *v1alpha1.WorkerTransformationList] } // newWorkerTransformations returns a WorkerTransformations func newWorkerTransformations(c *FlowV1alpha1Client, namespace string) *workerTransformations { return &workerTransformations{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.WorkerTransformation, *v1alpha1.WorkerTransformationList]( + "workertransformations", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.WorkerTransformation { return &v1alpha1.WorkerTransformation{} }, + func() *v1alpha1.WorkerTransformationList { return &v1alpha1.WorkerTransformationList{} }), } } - -// Get takes name of the workerTransformation, and returns the corresponding workerTransformation object, and an error if there is any. -func (c *workerTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.WorkerTransformation, err error) { - result = &v1alpha1.WorkerTransformation{} - err = c.client.Get(). - Namespace(c.ns). - Resource("workertransformations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of WorkerTransformations that match those selectors. -func (c *workerTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.WorkerTransformationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.WorkerTransformationList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("workertransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested workerTransformations. -func (c *workerTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("workertransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a workerTransformation and creates it. Returns the server's representation of the workerTransformation, and an error, if there is any. -func (c *workerTransformations) Create(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.CreateOptions) (result *v1alpha1.WorkerTransformation, err error) { - result = &v1alpha1.WorkerTransformation{} - err = c.client.Post(). - Namespace(c.ns). - Resource("workertransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(workerTransformation). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a workerTransformation and updates it. Returns the server's representation of the workerTransformation, and an error, if there is any. -func (c *workerTransformations) Update(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.UpdateOptions) (result *v1alpha1.WorkerTransformation, err error) { - result = &v1alpha1.WorkerTransformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("workertransformations"). - Name(workerTransformation.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(workerTransformation). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *workerTransformations) UpdateStatus(ctx context.Context, workerTransformation *v1alpha1.WorkerTransformation, opts v1.UpdateOptions) (result *v1alpha1.WorkerTransformation, err error) { - result = &v1alpha1.WorkerTransformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("workertransformations"). - Name(workerTransformation.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(workerTransformation). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the workerTransformation and deletes it. Returns an error if one occurs. -func (c *workerTransformations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("workertransformations"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *workerTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("workertransformations"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched workerTransformation. -func (c *workerTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.WorkerTransformation, err error) { - result = &v1alpha1.WorkerTransformation{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("workertransformations"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/xmltojsontransformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/xmltojsontransformation.go index b7d92669..2eb10341 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/xmltojsontransformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/xmltojsontransformation.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // XMLToJSONTransformationsGetter has a method to return a XMLToJSONTransformationInterface. @@ -24,6 +23,7 @@ type XMLToJSONTransformationsGetter interface { type XMLToJSONTransformationInterface interface { Create(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.CreateOptions) (*v1alpha1.XMLToJSONTransformation, error) Update(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.UpdateOptions) (*v1alpha1.XMLToJSONTransformation, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.UpdateOptions) (*v1alpha1.XMLToJSONTransformation, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type XMLToJSONTransformationInterface interface { // xMLToJSONTransformations implements XMLToJSONTransformationInterface type xMLToJSONTransformations struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.XMLToJSONTransformation, *v1alpha1.XMLToJSONTransformationList] } // newXMLToJSONTransformations returns a XMLToJSONTransformations func newXMLToJSONTransformations(c *FlowV1alpha1Client, namespace string) *xMLToJSONTransformations { return &xMLToJSONTransformations{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.XMLToJSONTransformation, *v1alpha1.XMLToJSONTransformationList]( + "xmltojsontransformations", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.XMLToJSONTransformation { return &v1alpha1.XMLToJSONTransformation{} }, + func() *v1alpha1.XMLToJSONTransformationList { return &v1alpha1.XMLToJSONTransformationList{} }), } } - -// Get takes name of the xMLToJSONTransformation, and returns the corresponding xMLToJSONTransformation object, and an error if there is any. -func (c *xMLToJSONTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.XMLToJSONTransformation, err error) { - result = &v1alpha1.XMLToJSONTransformation{} - err = c.client.Get(). - Namespace(c.ns). - Resource("xmltojsontransformations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of XMLToJSONTransformations that match those selectors. -func (c *xMLToJSONTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.XMLToJSONTransformationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.XMLToJSONTransformationList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("xmltojsontransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested xMLToJSONTransformations. -func (c *xMLToJSONTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("xmltojsontransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a xMLToJSONTransformation and creates it. Returns the server's representation of the xMLToJSONTransformation, and an error, if there is any. -func (c *xMLToJSONTransformations) Create(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.CreateOptions) (result *v1alpha1.XMLToJSONTransformation, err error) { - result = &v1alpha1.XMLToJSONTransformation{} - err = c.client.Post(). - Namespace(c.ns). - Resource("xmltojsontransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(xMLToJSONTransformation). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a xMLToJSONTransformation and updates it. Returns the server's representation of the xMLToJSONTransformation, and an error, if there is any. -func (c *xMLToJSONTransformations) Update(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.UpdateOptions) (result *v1alpha1.XMLToJSONTransformation, err error) { - result = &v1alpha1.XMLToJSONTransformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("xmltojsontransformations"). - Name(xMLToJSONTransformation.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(xMLToJSONTransformation). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *xMLToJSONTransformations) UpdateStatus(ctx context.Context, xMLToJSONTransformation *v1alpha1.XMLToJSONTransformation, opts v1.UpdateOptions) (result *v1alpha1.XMLToJSONTransformation, err error) { - result = &v1alpha1.XMLToJSONTransformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("xmltojsontransformations"). - Name(xMLToJSONTransformation.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(xMLToJSONTransformation). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the xMLToJSONTransformation and deletes it. Returns an error if one occurs. -func (c *xMLToJSONTransformations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("xmltojsontransformations"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *xMLToJSONTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("xmltojsontransformations"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched xMLToJSONTransformation. -func (c *xMLToJSONTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.XMLToJSONTransformation, err error) { - result = &v1alpha1.XMLToJSONTransformation{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("xmltojsontransformations"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/xslttransformation.go b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/xslttransformation.go index 1b53071a..336a62b7 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/xslttransformation.go +++ b/pkg/client/generated/clientset/internalclientset/typed/flow/v1alpha1/xslttransformation.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // XSLTTransformationsGetter has a method to return a XSLTTransformationInterface. @@ -24,6 +23,7 @@ type XSLTTransformationsGetter interface { type XSLTTransformationInterface interface { Create(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.CreateOptions) (*v1alpha1.XSLTTransformation, error) Update(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.UpdateOptions) (*v1alpha1.XSLTTransformation, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.UpdateOptions) (*v1alpha1.XSLTTransformation, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type XSLTTransformationInterface interface { // xSLTTransformations implements XSLTTransformationInterface type xSLTTransformations struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.XSLTTransformation, *v1alpha1.XSLTTransformationList] } // newXSLTTransformations returns a XSLTTransformations func newXSLTTransformations(c *FlowV1alpha1Client, namespace string) *xSLTTransformations { return &xSLTTransformations{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.XSLTTransformation, *v1alpha1.XSLTTransformationList]( + "xslttransformations", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.XSLTTransformation { return &v1alpha1.XSLTTransformation{} }, + func() *v1alpha1.XSLTTransformationList { return &v1alpha1.XSLTTransformationList{} }), } } - -// Get takes name of the xSLTTransformation, and returns the corresponding xSLTTransformation object, and an error if there is any. -func (c *xSLTTransformations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.XSLTTransformation, err error) { - result = &v1alpha1.XSLTTransformation{} - err = c.client.Get(). - Namespace(c.ns). - Resource("xslttransformations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of XSLTTransformations that match those selectors. -func (c *xSLTTransformations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.XSLTTransformationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.XSLTTransformationList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("xslttransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested xSLTTransformations. -func (c *xSLTTransformations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("xslttransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a xSLTTransformation and creates it. Returns the server's representation of the xSLTTransformation, and an error, if there is any. -func (c *xSLTTransformations) Create(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.CreateOptions) (result *v1alpha1.XSLTTransformation, err error) { - result = &v1alpha1.XSLTTransformation{} - err = c.client.Post(). - Namespace(c.ns). - Resource("xslttransformations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(xSLTTransformation). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a xSLTTransformation and updates it. Returns the server's representation of the xSLTTransformation, and an error, if there is any. -func (c *xSLTTransformations) Update(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.UpdateOptions) (result *v1alpha1.XSLTTransformation, err error) { - result = &v1alpha1.XSLTTransformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("xslttransformations"). - Name(xSLTTransformation.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(xSLTTransformation). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *xSLTTransformations) UpdateStatus(ctx context.Context, xSLTTransformation *v1alpha1.XSLTTransformation, opts v1.UpdateOptions) (result *v1alpha1.XSLTTransformation, err error) { - result = &v1alpha1.XSLTTransformation{} - err = c.client.Put(). - Namespace(c.ns). - Resource("xslttransformations"). - Name(xSLTTransformation.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(xSLTTransformation). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the xSLTTransformation and deletes it. Returns an error if one occurs. -func (c *xSLTTransformations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("xslttransformations"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *xSLTTransformations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("xslttransformations"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched xSLTTransformation. -func (c *xSLTTransformations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.XSLTTransformation, err error) { - result = &v1alpha1.XSLTTransformation{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("xslttransformations"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/fake/fake_filter.go b/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/fake/fake_filter.go index d42fcf7e..d615984d 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/fake/fake_filter.go +++ b/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/fake/fake_filter.go @@ -25,22 +25,24 @@ var filtersKind = v1alpha1.SchemeGroupVersion.WithKind("Filter") // Get takes name of the filter, and returns the corresponding filter object, and an error if there is any. func (c *FakeFilters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Filter, err error) { + emptyResult := &v1alpha1.Filter{} obj, err := c.Fake. - Invokes(testing.NewGetAction(filtersResource, c.ns, name), &v1alpha1.Filter{}) + Invokes(testing.NewGetActionWithOptions(filtersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Filter), err } // List takes label and field selectors, and returns the list of Filters that match those selectors. func (c *FakeFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FilterList, err error) { + emptyResult := &v1alpha1.FilterList{} obj, err := c.Fake. - Invokes(testing.NewListAction(filtersResource, filtersKind, c.ns, opts), &v1alpha1.FilterList{}) + Invokes(testing.NewListActionWithOptions(filtersResource, filtersKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeFilters) List(ctx context.Context, opts v1.ListOptions) (result *v1 // Watch returns a watch.Interface that watches the requested filters. func (c *FakeFilters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(filtersResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(filtersResource, c.ns, opts)) } // Create takes the representation of a filter and creates it. Returns the server's representation of the filter, and an error, if there is any. func (c *FakeFilters) Create(ctx context.Context, filter *v1alpha1.Filter, opts v1.CreateOptions) (result *v1alpha1.Filter, err error) { + emptyResult := &v1alpha1.Filter{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(filtersResource, c.ns, filter), &v1alpha1.Filter{}) + Invokes(testing.NewCreateActionWithOptions(filtersResource, c.ns, filter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Filter), err } // Update takes the representation of a filter and updates it. Returns the server's representation of the filter, and an error, if there is any. func (c *FakeFilters) Update(ctx context.Context, filter *v1alpha1.Filter, opts v1.UpdateOptions) (result *v1alpha1.Filter, err error) { + emptyResult := &v1alpha1.Filter{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(filtersResource, c.ns, filter), &v1alpha1.Filter{}) + Invokes(testing.NewUpdateActionWithOptions(filtersResource, c.ns, filter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Filter), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeFilters) UpdateStatus(ctx context.Context, filter *v1alpha1.Filter, opts v1.UpdateOptions) (*v1alpha1.Filter, error) { +func (c *FakeFilters) UpdateStatus(ctx context.Context, filter *v1alpha1.Filter, opts v1.UpdateOptions) (result *v1alpha1.Filter, err error) { + emptyResult := &v1alpha1.Filter{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(filtersResource, "status", c.ns, filter), &v1alpha1.Filter{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(filtersResource, "status", c.ns, filter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Filter), err } @@ -107,7 +112,7 @@ func (c *FakeFilters) Delete(ctx context.Context, name string, opts v1.DeleteOpt // DeleteCollection deletes a collection of objects. func (c *FakeFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(filtersResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(filtersResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.FilterList{}) return err @@ -115,11 +120,12 @@ func (c *FakeFilters) DeleteCollection(ctx context.Context, opts v1.DeleteOption // Patch applies the patch and returns the patched filter. func (c *FakeFilters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Filter, err error) { + emptyResult := &v1alpha1.Filter{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(filtersResource, c.ns, name, pt, data, subresources...), &v1alpha1.Filter{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(filtersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Filter), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/fake/fake_splitter.go b/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/fake/fake_splitter.go index d0395fb9..930af7a7 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/fake/fake_splitter.go +++ b/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/fake/fake_splitter.go @@ -25,22 +25,24 @@ var splittersKind = v1alpha1.SchemeGroupVersion.WithKind("Splitter") // Get takes name of the splitter, and returns the corresponding splitter object, and an error if there is any. func (c *FakeSplitters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Splitter, err error) { + emptyResult := &v1alpha1.Splitter{} obj, err := c.Fake. - Invokes(testing.NewGetAction(splittersResource, c.ns, name), &v1alpha1.Splitter{}) + Invokes(testing.NewGetActionWithOptions(splittersResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Splitter), err } // List takes label and field selectors, and returns the list of Splitters that match those selectors. func (c *FakeSplitters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SplitterList, err error) { + emptyResult := &v1alpha1.SplitterList{} obj, err := c.Fake. - Invokes(testing.NewListAction(splittersResource, splittersKind, c.ns, opts), &v1alpha1.SplitterList{}) + Invokes(testing.NewListActionWithOptions(splittersResource, splittersKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeSplitters) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested splitters. func (c *FakeSplitters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(splittersResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(splittersResource, c.ns, opts)) } // Create takes the representation of a splitter and creates it. Returns the server's representation of the splitter, and an error, if there is any. func (c *FakeSplitters) Create(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.CreateOptions) (result *v1alpha1.Splitter, err error) { + emptyResult := &v1alpha1.Splitter{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(splittersResource, c.ns, splitter), &v1alpha1.Splitter{}) + Invokes(testing.NewCreateActionWithOptions(splittersResource, c.ns, splitter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Splitter), err } // Update takes the representation of a splitter and updates it. Returns the server's representation of the splitter, and an error, if there is any. func (c *FakeSplitters) Update(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.UpdateOptions) (result *v1alpha1.Splitter, err error) { + emptyResult := &v1alpha1.Splitter{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(splittersResource, c.ns, splitter), &v1alpha1.Splitter{}) + Invokes(testing.NewUpdateActionWithOptions(splittersResource, c.ns, splitter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Splitter), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSplitters) UpdateStatus(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.UpdateOptions) (*v1alpha1.Splitter, error) { +func (c *FakeSplitters) UpdateStatus(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.UpdateOptions) (result *v1alpha1.Splitter, err error) { + emptyResult := &v1alpha1.Splitter{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(splittersResource, "status", c.ns, splitter), &v1alpha1.Splitter{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(splittersResource, "status", c.ns, splitter, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Splitter), err } @@ -107,7 +112,7 @@ func (c *FakeSplitters) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeSplitters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(splittersResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(splittersResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.SplitterList{}) return err @@ -115,11 +120,12 @@ func (c *FakeSplitters) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched splitter. func (c *FakeSplitters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Splitter, err error) { + emptyResult := &v1alpha1.Splitter{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(splittersResource, c.ns, name, pt, data, subresources...), &v1alpha1.Splitter{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(splittersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.Splitter), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/filter.go b/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/filter.go index 076df7fc..a46d9674 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/filter.go +++ b/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/filter.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // FiltersGetter has a method to return a FilterInterface. @@ -24,6 +23,7 @@ type FiltersGetter interface { type FilterInterface interface { Create(ctx context.Context, filter *v1alpha1.Filter, opts v1.CreateOptions) (*v1alpha1.Filter, error) Update(ctx context.Context, filter *v1alpha1.Filter, opts v1.UpdateOptions) (*v1alpha1.Filter, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, filter *v1alpha1.Filter, opts v1.UpdateOptions) (*v1alpha1.Filter, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type FilterInterface interface { // filters implements FilterInterface type filters struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Filter, *v1alpha1.FilterList] } // newFilters returns a Filters func newFilters(c *RoutingV1alpha1Client, namespace string) *filters { return &filters{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Filter, *v1alpha1.FilterList]( + "filters", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Filter { return &v1alpha1.Filter{} }, + func() *v1alpha1.FilterList { return &v1alpha1.FilterList{} }), } } - -// Get takes name of the filter, and returns the corresponding filter object, and an error if there is any. -func (c *filters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Filter, err error) { - result = &v1alpha1.Filter{} - err = c.client.Get(). - Namespace(c.ns). - Resource("filters"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Filters that match those selectors. -func (c *filters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FilterList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.FilterList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("filters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested filters. -func (c *filters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("filters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a filter and creates it. Returns the server's representation of the filter, and an error, if there is any. -func (c *filters) Create(ctx context.Context, filter *v1alpha1.Filter, opts v1.CreateOptions) (result *v1alpha1.Filter, err error) { - result = &v1alpha1.Filter{} - err = c.client.Post(). - Namespace(c.ns). - Resource("filters"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(filter). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a filter and updates it. Returns the server's representation of the filter, and an error, if there is any. -func (c *filters) Update(ctx context.Context, filter *v1alpha1.Filter, opts v1.UpdateOptions) (result *v1alpha1.Filter, err error) { - result = &v1alpha1.Filter{} - err = c.client.Put(). - Namespace(c.ns). - Resource("filters"). - Name(filter.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(filter). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *filters) UpdateStatus(ctx context.Context, filter *v1alpha1.Filter, opts v1.UpdateOptions) (result *v1alpha1.Filter, err error) { - result = &v1alpha1.Filter{} - err = c.client.Put(). - Namespace(c.ns). - Resource("filters"). - Name(filter.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(filter). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the filter and deletes it. Returns an error if one occurs. -func (c *filters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("filters"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *filters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("filters"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched filter. -func (c *filters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Filter, err error) { - result = &v1alpha1.Filter{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("filters"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/splitter.go b/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/splitter.go index 4fce3348..fecadf0f 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/splitter.go +++ b/pkg/client/generated/clientset/internalclientset/typed/routing/v1alpha1/splitter.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // SplittersGetter has a method to return a SplitterInterface. @@ -24,6 +23,7 @@ type SplittersGetter interface { type SplitterInterface interface { Create(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.CreateOptions) (*v1alpha1.Splitter, error) Update(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.UpdateOptions) (*v1alpha1.Splitter, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.UpdateOptions) (*v1alpha1.Splitter, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type SplitterInterface interface { // splitters implements SplitterInterface type splitters struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.Splitter, *v1alpha1.SplitterList] } // newSplitters returns a Splitters func newSplitters(c *RoutingV1alpha1Client, namespace string) *splitters { return &splitters{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.Splitter, *v1alpha1.SplitterList]( + "splitters", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Splitter { return &v1alpha1.Splitter{} }, + func() *v1alpha1.SplitterList { return &v1alpha1.SplitterList{} }), } } - -// Get takes name of the splitter, and returns the corresponding splitter object, and an error if there is any. -func (c *splitters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Splitter, err error) { - result = &v1alpha1.Splitter{} - err = c.client.Get(). - Namespace(c.ns). - Resource("splitters"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Splitters that match those selectors. -func (c *splitters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SplitterList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.SplitterList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("splitters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested splitters. -func (c *splitters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("splitters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a splitter and creates it. Returns the server's representation of the splitter, and an error, if there is any. -func (c *splitters) Create(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.CreateOptions) (result *v1alpha1.Splitter, err error) { - result = &v1alpha1.Splitter{} - err = c.client.Post(). - Namespace(c.ns). - Resource("splitters"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(splitter). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a splitter and updates it. Returns the server's representation of the splitter, and an error, if there is any. -func (c *splitters) Update(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.UpdateOptions) (result *v1alpha1.Splitter, err error) { - result = &v1alpha1.Splitter{} - err = c.client.Put(). - Namespace(c.ns). - Resource("splitters"). - Name(splitter.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(splitter). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *splitters) UpdateStatus(ctx context.Context, splitter *v1alpha1.Splitter, opts v1.UpdateOptions) (result *v1alpha1.Splitter, err error) { - result = &v1alpha1.Splitter{} - err = c.client.Put(). - Namespace(c.ns). - Resource("splitters"). - Name(splitter.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(splitter). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the splitter and deletes it. Returns an error if one occurs. -func (c *splitters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("splitters"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *splitters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("splitters"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched splitter. -func (c *splitters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Splitter, err error) { - result = &v1alpha1.Splitter{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("splitters"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebusqueuesource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebusqueuesource.go index bce9db55..1efeef9e 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebusqueuesource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebusqueuesource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AzureServiceBusQueueSourcesGetter has a method to return a AzureServiceBusQueueSourceInterface. @@ -24,6 +23,7 @@ type AzureServiceBusQueueSourcesGetter interface { type AzureServiceBusQueueSourceInterface interface { Create(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.CreateOptions) (*v1alpha1.AzureServiceBusQueueSource, error) Update(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusQueueSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusQueueSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type AzureServiceBusQueueSourceInterface interface { // azureServiceBusQueueSources implements AzureServiceBusQueueSourceInterface type azureServiceBusQueueSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.AzureServiceBusQueueSource, *v1alpha1.AzureServiceBusQueueSourceList] } // newAzureServiceBusQueueSources returns a AzureServiceBusQueueSources func newAzureServiceBusQueueSources(c *SourcesV1alpha1Client, namespace string) *azureServiceBusQueueSources { return &azureServiceBusQueueSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.AzureServiceBusQueueSource, *v1alpha1.AzureServiceBusQueueSourceList]( + "azureservicebusqueuesources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.AzureServiceBusQueueSource { return &v1alpha1.AzureServiceBusQueueSource{} }, + func() *v1alpha1.AzureServiceBusQueueSourceList { return &v1alpha1.AzureServiceBusQueueSourceList{} }), } } - -// Get takes name of the azureServiceBusQueueSource, and returns the corresponding azureServiceBusQueueSource object, and an error if there is any. -func (c *azureServiceBusQueueSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AzureServiceBusQueueSource, err error) { - result = &v1alpha1.AzureServiceBusQueueSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AzureServiceBusQueueSources that match those selectors. -func (c *azureServiceBusQueueSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureServiceBusQueueSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.AzureServiceBusQueueSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested azureServiceBusQueueSources. -func (c *azureServiceBusQueueSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a azureServiceBusQueueSource and creates it. Returns the server's representation of the azureServiceBusQueueSource, and an error, if there is any. -func (c *azureServiceBusQueueSources) Create(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.CreateOptions) (result *v1alpha1.AzureServiceBusQueueSource, err error) { - result = &v1alpha1.AzureServiceBusQueueSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusQueueSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a azureServiceBusQueueSource and updates it. Returns the server's representation of the azureServiceBusQueueSource, and an error, if there is any. -func (c *azureServiceBusQueueSources) Update(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusQueueSource, err error) { - result = &v1alpha1.AzureServiceBusQueueSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - Name(azureServiceBusQueueSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusQueueSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *azureServiceBusQueueSources) UpdateStatus(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusQueueSource, err error) { - result = &v1alpha1.AzureServiceBusQueueSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - Name(azureServiceBusQueueSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusQueueSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the azureServiceBusQueueSource and deletes it. Returns an error if one occurs. -func (c *azureServiceBusQueueSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *azureServiceBusQueueSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched azureServiceBusQueueSource. -func (c *azureServiceBusQueueSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureServiceBusQueueSource, err error) { - result = &v1alpha1.AzureServiceBusQueueSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("azureservicebusqueuesources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebussource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebussource.go index 6c528ab4..9e72332f 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebussource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebussource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AzureServiceBusSourcesGetter has a method to return a AzureServiceBusSourceInterface. @@ -24,6 +23,7 @@ type AzureServiceBusSourcesGetter interface { type AzureServiceBusSourceInterface interface { Create(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.CreateOptions) (*v1alpha1.AzureServiceBusSource, error) Update(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type AzureServiceBusSourceInterface interface { // azureServiceBusSources implements AzureServiceBusSourceInterface type azureServiceBusSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.AzureServiceBusSource, *v1alpha1.AzureServiceBusSourceList] } // newAzureServiceBusSources returns a AzureServiceBusSources func newAzureServiceBusSources(c *SourcesV1alpha1Client, namespace string) *azureServiceBusSources { return &azureServiceBusSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.AzureServiceBusSource, *v1alpha1.AzureServiceBusSourceList]( + "azureservicebussources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.AzureServiceBusSource { return &v1alpha1.AzureServiceBusSource{} }, + func() *v1alpha1.AzureServiceBusSourceList { return &v1alpha1.AzureServiceBusSourceList{} }), } } - -// Get takes name of the azureServiceBusSource, and returns the corresponding azureServiceBusSource object, and an error if there is any. -func (c *azureServiceBusSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AzureServiceBusSource, err error) { - result = &v1alpha1.AzureServiceBusSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("azureservicebussources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AzureServiceBusSources that match those selectors. -func (c *azureServiceBusSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureServiceBusSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.AzureServiceBusSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("azureservicebussources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested azureServiceBusSources. -func (c *azureServiceBusSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("azureservicebussources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a azureServiceBusSource and creates it. Returns the server's representation of the azureServiceBusSource, and an error, if there is any. -func (c *azureServiceBusSources) Create(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.CreateOptions) (result *v1alpha1.AzureServiceBusSource, err error) { - result = &v1alpha1.AzureServiceBusSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("azureservicebussources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a azureServiceBusSource and updates it. Returns the server's representation of the azureServiceBusSource, and an error, if there is any. -func (c *azureServiceBusSources) Update(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusSource, err error) { - result = &v1alpha1.AzureServiceBusSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("azureservicebussources"). - Name(azureServiceBusSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *azureServiceBusSources) UpdateStatus(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusSource, err error) { - result = &v1alpha1.AzureServiceBusSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("azureservicebussources"). - Name(azureServiceBusSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the azureServiceBusSource and deletes it. Returns an error if one occurs. -func (c *azureServiceBusSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("azureservicebussources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *azureServiceBusSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("azureservicebussources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched azureServiceBusSource. -func (c *azureServiceBusSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureServiceBusSource, err error) { - result = &v1alpha1.AzureServiceBusSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("azureservicebussources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebustopicsource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebustopicsource.go index 89ead772..ee7ff5dc 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebustopicsource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/azureservicebustopicsource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // AzureServiceBusTopicSourcesGetter has a method to return a AzureServiceBusTopicSourceInterface. @@ -24,6 +23,7 @@ type AzureServiceBusTopicSourcesGetter interface { type AzureServiceBusTopicSourceInterface interface { Create(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.CreateOptions) (*v1alpha1.AzureServiceBusTopicSource, error) Update(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusTopicSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusTopicSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type AzureServiceBusTopicSourceInterface interface { // azureServiceBusTopicSources implements AzureServiceBusTopicSourceInterface type azureServiceBusTopicSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.AzureServiceBusTopicSource, *v1alpha1.AzureServiceBusTopicSourceList] } // newAzureServiceBusTopicSources returns a AzureServiceBusTopicSources func newAzureServiceBusTopicSources(c *SourcesV1alpha1Client, namespace string) *azureServiceBusTopicSources { return &azureServiceBusTopicSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.AzureServiceBusTopicSource, *v1alpha1.AzureServiceBusTopicSourceList]( + "azureservicebustopicsources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.AzureServiceBusTopicSource { return &v1alpha1.AzureServiceBusTopicSource{} }, + func() *v1alpha1.AzureServiceBusTopicSourceList { return &v1alpha1.AzureServiceBusTopicSourceList{} }), } } - -// Get takes name of the azureServiceBusTopicSource, and returns the corresponding azureServiceBusTopicSource object, and an error if there is any. -func (c *azureServiceBusTopicSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AzureServiceBusTopicSource, err error) { - result = &v1alpha1.AzureServiceBusTopicSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of AzureServiceBusTopicSources that match those selectors. -func (c *azureServiceBusTopicSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureServiceBusTopicSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.AzureServiceBusTopicSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested azureServiceBusTopicSources. -func (c *azureServiceBusTopicSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a azureServiceBusTopicSource and creates it. Returns the server's representation of the azureServiceBusTopicSource, and an error, if there is any. -func (c *azureServiceBusTopicSources) Create(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.CreateOptions) (result *v1alpha1.AzureServiceBusTopicSource, err error) { - result = &v1alpha1.AzureServiceBusTopicSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusTopicSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a azureServiceBusTopicSource and updates it. Returns the server's representation of the azureServiceBusTopicSource, and an error, if there is any. -func (c *azureServiceBusTopicSources) Update(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusTopicSource, err error) { - result = &v1alpha1.AzureServiceBusTopicSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - Name(azureServiceBusTopicSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusTopicSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *azureServiceBusTopicSources) UpdateStatus(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusTopicSource, err error) { - result = &v1alpha1.AzureServiceBusTopicSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - Name(azureServiceBusTopicSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(azureServiceBusTopicSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the azureServiceBusTopicSource and deletes it. Returns an error if one occurs. -func (c *azureServiceBusTopicSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *azureServiceBusTopicSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched azureServiceBusTopicSource. -func (c *azureServiceBusTopicSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureServiceBusTopicSource, err error) { - result = &v1alpha1.AzureServiceBusTopicSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("azureservicebustopicsources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/cloudeventssource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/cloudeventssource.go index 834d5f74..002400cc 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/cloudeventssource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/cloudeventssource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CloudEventsSourcesGetter has a method to return a CloudEventsSourceInterface. @@ -24,6 +23,7 @@ type CloudEventsSourcesGetter interface { type CloudEventsSourceInterface interface { Create(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.CreateOptions) (*v1alpha1.CloudEventsSource, error) Update(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.UpdateOptions) (*v1alpha1.CloudEventsSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.UpdateOptions) (*v1alpha1.CloudEventsSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type CloudEventsSourceInterface interface { // cloudEventsSources implements CloudEventsSourceInterface type cloudEventsSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.CloudEventsSource, *v1alpha1.CloudEventsSourceList] } // newCloudEventsSources returns a CloudEventsSources func newCloudEventsSources(c *SourcesV1alpha1Client, namespace string) *cloudEventsSources { return &cloudEventsSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.CloudEventsSource, *v1alpha1.CloudEventsSourceList]( + "cloudeventssources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.CloudEventsSource { return &v1alpha1.CloudEventsSource{} }, + func() *v1alpha1.CloudEventsSourceList { return &v1alpha1.CloudEventsSourceList{} }), } } - -// Get takes name of the cloudEventsSource, and returns the corresponding cloudEventsSource object, and an error if there is any. -func (c *cloudEventsSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CloudEventsSource, err error) { - result = &v1alpha1.CloudEventsSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cloudeventssources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CloudEventsSources that match those selectors. -func (c *cloudEventsSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CloudEventsSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.CloudEventsSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cloudeventssources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cloudEventsSources. -func (c *cloudEventsSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cloudeventssources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cloudEventsSource and creates it. Returns the server's representation of the cloudEventsSource, and an error, if there is any. -func (c *cloudEventsSources) Create(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.CreateOptions) (result *v1alpha1.CloudEventsSource, err error) { - result = &v1alpha1.CloudEventsSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cloudeventssources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cloudEventsSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cloudEventsSource and updates it. Returns the server's representation of the cloudEventsSource, and an error, if there is any. -func (c *cloudEventsSources) Update(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.UpdateOptions) (result *v1alpha1.CloudEventsSource, err error) { - result = &v1alpha1.CloudEventsSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cloudeventssources"). - Name(cloudEventsSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cloudEventsSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *cloudEventsSources) UpdateStatus(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.UpdateOptions) (result *v1alpha1.CloudEventsSource, err error) { - result = &v1alpha1.CloudEventsSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cloudeventssources"). - Name(cloudEventsSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cloudEventsSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cloudEventsSource and deletes it. Returns an error if one occurs. -func (c *cloudEventsSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cloudeventssources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cloudEventsSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cloudeventssources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cloudEventsSource. -func (c *cloudEventsSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CloudEventsSource, err error) { - result = &v1alpha1.CloudEventsSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cloudeventssources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebusqueuesource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebusqueuesource.go index 851e40df..49fa1df9 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebusqueuesource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebusqueuesource.go @@ -25,22 +25,24 @@ var azureservicebusqueuesourcesKind = v1alpha1.SchemeGroupVersion.WithKind("Azur // Get takes name of the azureServiceBusQueueSource, and returns the corresponding azureServiceBusQueueSource object, and an error if there is any. func (c *FakeAzureServiceBusQueueSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AzureServiceBusQueueSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusQueueSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(azureservicebusqueuesourcesResource, c.ns, name), &v1alpha1.AzureServiceBusQueueSource{}) + Invokes(testing.NewGetActionWithOptions(azureservicebusqueuesourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusQueueSource), err } // List takes label and field selectors, and returns the list of AzureServiceBusQueueSources that match those selectors. func (c *FakeAzureServiceBusQueueSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureServiceBusQueueSourceList, err error) { + emptyResult := &v1alpha1.AzureServiceBusQueueSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(azureservicebusqueuesourcesResource, azureservicebusqueuesourcesKind, c.ns, opts), &v1alpha1.AzureServiceBusQueueSourceList{}) + Invokes(testing.NewListActionWithOptions(azureservicebusqueuesourcesResource, azureservicebusqueuesourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeAzureServiceBusQueueSources) List(ctx context.Context, opts v1.List // Watch returns a watch.Interface that watches the requested azureServiceBusQueueSources. func (c *FakeAzureServiceBusQueueSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(azureservicebusqueuesourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(azureservicebusqueuesourcesResource, c.ns, opts)) } // Create takes the representation of a azureServiceBusQueueSource and creates it. Returns the server's representation of the azureServiceBusQueueSource, and an error, if there is any. func (c *FakeAzureServiceBusQueueSources) Create(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.CreateOptions) (result *v1alpha1.AzureServiceBusQueueSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusQueueSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(azureservicebusqueuesourcesResource, c.ns, azureServiceBusQueueSource), &v1alpha1.AzureServiceBusQueueSource{}) + Invokes(testing.NewCreateActionWithOptions(azureservicebusqueuesourcesResource, c.ns, azureServiceBusQueueSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusQueueSource), err } // Update takes the representation of a azureServiceBusQueueSource and updates it. Returns the server's representation of the azureServiceBusQueueSource, and an error, if there is any. func (c *FakeAzureServiceBusQueueSources) Update(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusQueueSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusQueueSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(azureservicebusqueuesourcesResource, c.ns, azureServiceBusQueueSource), &v1alpha1.AzureServiceBusQueueSource{}) + Invokes(testing.NewUpdateActionWithOptions(azureservicebusqueuesourcesResource, c.ns, azureServiceBusQueueSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusQueueSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeAzureServiceBusQueueSources) UpdateStatus(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusQueueSource, error) { +func (c *FakeAzureServiceBusQueueSources) UpdateStatus(ctx context.Context, azureServiceBusQueueSource *v1alpha1.AzureServiceBusQueueSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusQueueSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusQueueSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(azureservicebusqueuesourcesResource, "status", c.ns, azureServiceBusQueueSource), &v1alpha1.AzureServiceBusQueueSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(azureservicebusqueuesourcesResource, "status", c.ns, azureServiceBusQueueSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusQueueSource), err } @@ -107,7 +112,7 @@ func (c *FakeAzureServiceBusQueueSources) Delete(ctx context.Context, name strin // DeleteCollection deletes a collection of objects. func (c *FakeAzureServiceBusQueueSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(azureservicebusqueuesourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(azureservicebusqueuesourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.AzureServiceBusQueueSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeAzureServiceBusQueueSources) DeleteCollection(ctx context.Context, // Patch applies the patch and returns the patched azureServiceBusQueueSource. func (c *FakeAzureServiceBusQueueSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureServiceBusQueueSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusQueueSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(azureservicebusqueuesourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.AzureServiceBusQueueSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(azureservicebusqueuesourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusQueueSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebussource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebussource.go index abb8cdaa..6bc3ab8d 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebussource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebussource.go @@ -25,22 +25,24 @@ var azureservicebussourcesKind = v1alpha1.SchemeGroupVersion.WithKind("AzureServ // Get takes name of the azureServiceBusSource, and returns the corresponding azureServiceBusSource object, and an error if there is any. func (c *FakeAzureServiceBusSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AzureServiceBusSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(azureservicebussourcesResource, c.ns, name), &v1alpha1.AzureServiceBusSource{}) + Invokes(testing.NewGetActionWithOptions(azureservicebussourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusSource), err } // List takes label and field selectors, and returns the list of AzureServiceBusSources that match those selectors. func (c *FakeAzureServiceBusSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureServiceBusSourceList, err error) { + emptyResult := &v1alpha1.AzureServiceBusSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(azureservicebussourcesResource, azureservicebussourcesKind, c.ns, opts), &v1alpha1.AzureServiceBusSourceList{}) + Invokes(testing.NewListActionWithOptions(azureservicebussourcesResource, azureservicebussourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeAzureServiceBusSources) List(ctx context.Context, opts v1.ListOptio // Watch returns a watch.Interface that watches the requested azureServiceBusSources. func (c *FakeAzureServiceBusSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(azureservicebussourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(azureservicebussourcesResource, c.ns, opts)) } // Create takes the representation of a azureServiceBusSource and creates it. Returns the server's representation of the azureServiceBusSource, and an error, if there is any. func (c *FakeAzureServiceBusSources) Create(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.CreateOptions) (result *v1alpha1.AzureServiceBusSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(azureservicebussourcesResource, c.ns, azureServiceBusSource), &v1alpha1.AzureServiceBusSource{}) + Invokes(testing.NewCreateActionWithOptions(azureservicebussourcesResource, c.ns, azureServiceBusSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusSource), err } // Update takes the representation of a azureServiceBusSource and updates it. Returns the server's representation of the azureServiceBusSource, and an error, if there is any. func (c *FakeAzureServiceBusSources) Update(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(azureservicebussourcesResource, c.ns, azureServiceBusSource), &v1alpha1.AzureServiceBusSource{}) + Invokes(testing.NewUpdateActionWithOptions(azureservicebussourcesResource, c.ns, azureServiceBusSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeAzureServiceBusSources) UpdateStatus(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusSource, error) { +func (c *FakeAzureServiceBusSources) UpdateStatus(ctx context.Context, azureServiceBusSource *v1alpha1.AzureServiceBusSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(azureservicebussourcesResource, "status", c.ns, azureServiceBusSource), &v1alpha1.AzureServiceBusSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(azureservicebussourcesResource, "status", c.ns, azureServiceBusSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusSource), err } @@ -107,7 +112,7 @@ func (c *FakeAzureServiceBusSources) Delete(ctx context.Context, name string, op // DeleteCollection deletes a collection of objects. func (c *FakeAzureServiceBusSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(azureservicebussourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(azureservicebussourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.AzureServiceBusSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeAzureServiceBusSources) DeleteCollection(ctx context.Context, opts // Patch applies the patch and returns the patched azureServiceBusSource. func (c *FakeAzureServiceBusSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureServiceBusSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(azureservicebussourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.AzureServiceBusSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(azureservicebussourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebustopicsource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebustopicsource.go index 2daa62bd..9b9df6bd 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebustopicsource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_azureservicebustopicsource.go @@ -25,22 +25,24 @@ var azureservicebustopicsourcesKind = v1alpha1.SchemeGroupVersion.WithKind("Azur // Get takes name of the azureServiceBusTopicSource, and returns the corresponding azureServiceBusTopicSource object, and an error if there is any. func (c *FakeAzureServiceBusTopicSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AzureServiceBusTopicSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusTopicSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(azureservicebustopicsourcesResource, c.ns, name), &v1alpha1.AzureServiceBusTopicSource{}) + Invokes(testing.NewGetActionWithOptions(azureservicebustopicsourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusTopicSource), err } // List takes label and field selectors, and returns the list of AzureServiceBusTopicSources that match those selectors. func (c *FakeAzureServiceBusTopicSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureServiceBusTopicSourceList, err error) { + emptyResult := &v1alpha1.AzureServiceBusTopicSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(azureservicebustopicsourcesResource, azureservicebustopicsourcesKind, c.ns, opts), &v1alpha1.AzureServiceBusTopicSourceList{}) + Invokes(testing.NewListActionWithOptions(azureservicebustopicsourcesResource, azureservicebustopicsourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeAzureServiceBusTopicSources) List(ctx context.Context, opts v1.List // Watch returns a watch.Interface that watches the requested azureServiceBusTopicSources. func (c *FakeAzureServiceBusTopicSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(azureservicebustopicsourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(azureservicebustopicsourcesResource, c.ns, opts)) } // Create takes the representation of a azureServiceBusTopicSource and creates it. Returns the server's representation of the azureServiceBusTopicSource, and an error, if there is any. func (c *FakeAzureServiceBusTopicSources) Create(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.CreateOptions) (result *v1alpha1.AzureServiceBusTopicSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusTopicSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(azureservicebustopicsourcesResource, c.ns, azureServiceBusTopicSource), &v1alpha1.AzureServiceBusTopicSource{}) + Invokes(testing.NewCreateActionWithOptions(azureservicebustopicsourcesResource, c.ns, azureServiceBusTopicSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusTopicSource), err } // Update takes the representation of a azureServiceBusTopicSource and updates it. Returns the server's representation of the azureServiceBusTopicSource, and an error, if there is any. func (c *FakeAzureServiceBusTopicSources) Update(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusTopicSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusTopicSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(azureservicebustopicsourcesResource, c.ns, azureServiceBusTopicSource), &v1alpha1.AzureServiceBusTopicSource{}) + Invokes(testing.NewUpdateActionWithOptions(azureservicebustopicsourcesResource, c.ns, azureServiceBusTopicSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusTopicSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeAzureServiceBusTopicSources) UpdateStatus(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.UpdateOptions) (*v1alpha1.AzureServiceBusTopicSource, error) { +func (c *FakeAzureServiceBusTopicSources) UpdateStatus(ctx context.Context, azureServiceBusTopicSource *v1alpha1.AzureServiceBusTopicSource, opts v1.UpdateOptions) (result *v1alpha1.AzureServiceBusTopicSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusTopicSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(azureservicebustopicsourcesResource, "status", c.ns, azureServiceBusTopicSource), &v1alpha1.AzureServiceBusTopicSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(azureservicebustopicsourcesResource, "status", c.ns, azureServiceBusTopicSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusTopicSource), err } @@ -107,7 +112,7 @@ func (c *FakeAzureServiceBusTopicSources) Delete(ctx context.Context, name strin // DeleteCollection deletes a collection of objects. func (c *FakeAzureServiceBusTopicSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(azureservicebustopicsourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(azureservicebustopicsourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.AzureServiceBusTopicSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeAzureServiceBusTopicSources) DeleteCollection(ctx context.Context, // Patch applies the patch and returns the patched azureServiceBusTopicSource. func (c *FakeAzureServiceBusTopicSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureServiceBusTopicSource, err error) { + emptyResult := &v1alpha1.AzureServiceBusTopicSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(azureservicebustopicsourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.AzureServiceBusTopicSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(azureservicebustopicsourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.AzureServiceBusTopicSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_cloudeventssource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_cloudeventssource.go index 938bf089..fecf6db6 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_cloudeventssource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_cloudeventssource.go @@ -25,22 +25,24 @@ var cloudeventssourcesKind = v1alpha1.SchemeGroupVersion.WithKind("CloudEventsSo // Get takes name of the cloudEventsSource, and returns the corresponding cloudEventsSource object, and an error if there is any. func (c *FakeCloudEventsSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CloudEventsSource, err error) { + emptyResult := &v1alpha1.CloudEventsSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cloudeventssourcesResource, c.ns, name), &v1alpha1.CloudEventsSource{}) + Invokes(testing.NewGetActionWithOptions(cloudeventssourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsSource), err } // List takes label and field selectors, and returns the list of CloudEventsSources that match those selectors. func (c *FakeCloudEventsSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CloudEventsSourceList, err error) { + emptyResult := &v1alpha1.CloudEventsSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cloudeventssourcesResource, cloudeventssourcesKind, c.ns, opts), &v1alpha1.CloudEventsSourceList{}) + Invokes(testing.NewListActionWithOptions(cloudeventssourcesResource, cloudeventssourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeCloudEventsSources) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested cloudEventsSources. func (c *FakeCloudEventsSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cloudeventssourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cloudeventssourcesResource, c.ns, opts)) } // Create takes the representation of a cloudEventsSource and creates it. Returns the server's representation of the cloudEventsSource, and an error, if there is any. func (c *FakeCloudEventsSources) Create(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.CreateOptions) (result *v1alpha1.CloudEventsSource, err error) { + emptyResult := &v1alpha1.CloudEventsSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cloudeventssourcesResource, c.ns, cloudEventsSource), &v1alpha1.CloudEventsSource{}) + Invokes(testing.NewCreateActionWithOptions(cloudeventssourcesResource, c.ns, cloudEventsSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsSource), err } // Update takes the representation of a cloudEventsSource and updates it. Returns the server's representation of the cloudEventsSource, and an error, if there is any. func (c *FakeCloudEventsSources) Update(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.UpdateOptions) (result *v1alpha1.CloudEventsSource, err error) { + emptyResult := &v1alpha1.CloudEventsSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cloudeventssourcesResource, c.ns, cloudEventsSource), &v1alpha1.CloudEventsSource{}) + Invokes(testing.NewUpdateActionWithOptions(cloudeventssourcesResource, c.ns, cloudEventsSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCloudEventsSources) UpdateStatus(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.UpdateOptions) (*v1alpha1.CloudEventsSource, error) { +func (c *FakeCloudEventsSources) UpdateStatus(ctx context.Context, cloudEventsSource *v1alpha1.CloudEventsSource, opts v1.UpdateOptions) (result *v1alpha1.CloudEventsSource, err error) { + emptyResult := &v1alpha1.CloudEventsSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(cloudeventssourcesResource, "status", c.ns, cloudEventsSource), &v1alpha1.CloudEventsSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(cloudeventssourcesResource, "status", c.ns, cloudEventsSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsSource), err } @@ -107,7 +112,7 @@ func (c *FakeCloudEventsSources) Delete(ctx context.Context, name string, opts v // DeleteCollection deletes a collection of objects. func (c *FakeCloudEventsSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cloudeventssourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(cloudeventssourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.CloudEventsSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeCloudEventsSources) DeleteCollection(ctx context.Context, opts v1.D // Patch applies the patch and returns the patched cloudEventsSource. func (c *FakeCloudEventsSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CloudEventsSource, err error) { + emptyResult := &v1alpha1.CloudEventsSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cloudeventssourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.CloudEventsSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cloudeventssourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_httppollersource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_httppollersource.go index 469d2957..66cc20a8 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_httppollersource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_httppollersource.go @@ -25,22 +25,24 @@ var httppollersourcesKind = v1alpha1.SchemeGroupVersion.WithKind("HTTPPollerSour // Get takes name of the hTTPPollerSource, and returns the corresponding hTTPPollerSource object, and an error if there is any. func (c *FakeHTTPPollerSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.HTTPPollerSource, err error) { + emptyResult := &v1alpha1.HTTPPollerSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(httppollersourcesResource, c.ns, name), &v1alpha1.HTTPPollerSource{}) + Invokes(testing.NewGetActionWithOptions(httppollersourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPPollerSource), err } // List takes label and field selectors, and returns the list of HTTPPollerSources that match those selectors. func (c *FakeHTTPPollerSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.HTTPPollerSourceList, err error) { + emptyResult := &v1alpha1.HTTPPollerSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(httppollersourcesResource, httppollersourcesKind, c.ns, opts), &v1alpha1.HTTPPollerSourceList{}) + Invokes(testing.NewListActionWithOptions(httppollersourcesResource, httppollersourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeHTTPPollerSources) List(ctx context.Context, opts v1.ListOptions) ( // Watch returns a watch.Interface that watches the requested hTTPPollerSources. func (c *FakeHTTPPollerSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(httppollersourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(httppollersourcesResource, c.ns, opts)) } // Create takes the representation of a hTTPPollerSource and creates it. Returns the server's representation of the hTTPPollerSource, and an error, if there is any. func (c *FakeHTTPPollerSources) Create(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.CreateOptions) (result *v1alpha1.HTTPPollerSource, err error) { + emptyResult := &v1alpha1.HTTPPollerSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(httppollersourcesResource, c.ns, hTTPPollerSource), &v1alpha1.HTTPPollerSource{}) + Invokes(testing.NewCreateActionWithOptions(httppollersourcesResource, c.ns, hTTPPollerSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPPollerSource), err } // Update takes the representation of a hTTPPollerSource and updates it. Returns the server's representation of the hTTPPollerSource, and an error, if there is any. func (c *FakeHTTPPollerSources) Update(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.UpdateOptions) (result *v1alpha1.HTTPPollerSource, err error) { + emptyResult := &v1alpha1.HTTPPollerSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(httppollersourcesResource, c.ns, hTTPPollerSource), &v1alpha1.HTTPPollerSource{}) + Invokes(testing.NewUpdateActionWithOptions(httppollersourcesResource, c.ns, hTTPPollerSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPPollerSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeHTTPPollerSources) UpdateStatus(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.UpdateOptions) (*v1alpha1.HTTPPollerSource, error) { +func (c *FakeHTTPPollerSources) UpdateStatus(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.UpdateOptions) (result *v1alpha1.HTTPPollerSource, err error) { + emptyResult := &v1alpha1.HTTPPollerSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(httppollersourcesResource, "status", c.ns, hTTPPollerSource), &v1alpha1.HTTPPollerSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(httppollersourcesResource, "status", c.ns, hTTPPollerSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPPollerSource), err } @@ -107,7 +112,7 @@ func (c *FakeHTTPPollerSources) Delete(ctx context.Context, name string, opts v1 // DeleteCollection deletes a collection of objects. func (c *FakeHTTPPollerSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(httppollersourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(httppollersourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.HTTPPollerSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeHTTPPollerSources) DeleteCollection(ctx context.Context, opts v1.De // Patch applies the patch and returns the patched hTTPPollerSource. func (c *FakeHTTPPollerSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.HTTPPollerSource, err error) { + emptyResult := &v1alpha1.HTTPPollerSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httppollersourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.HTTPPollerSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httppollersourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPPollerSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_kafkasource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_kafkasource.go index ecbd793c..379a029c 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_kafkasource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_kafkasource.go @@ -25,22 +25,24 @@ var kafkasourcesKind = v1alpha1.SchemeGroupVersion.WithKind("KafkaSource") // Get takes name of the kafkaSource, and returns the corresponding kafkaSource object, and an error if there is any. func (c *FakeKafkaSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KafkaSource, err error) { + emptyResult := &v1alpha1.KafkaSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(kafkasourcesResource, c.ns, name), &v1alpha1.KafkaSource{}) + Invokes(testing.NewGetActionWithOptions(kafkasourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaSource), err } // List takes label and field selectors, and returns the list of KafkaSources that match those selectors. func (c *FakeKafkaSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KafkaSourceList, err error) { + emptyResult := &v1alpha1.KafkaSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(kafkasourcesResource, kafkasourcesKind, c.ns, opts), &v1alpha1.KafkaSourceList{}) + Invokes(testing.NewListActionWithOptions(kafkasourcesResource, kafkasourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeKafkaSources) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested kafkaSources. func (c *FakeKafkaSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(kafkasourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(kafkasourcesResource, c.ns, opts)) } // Create takes the representation of a kafkaSource and creates it. Returns the server's representation of the kafkaSource, and an error, if there is any. func (c *FakeKafkaSources) Create(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.CreateOptions) (result *v1alpha1.KafkaSource, err error) { + emptyResult := &v1alpha1.KafkaSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(kafkasourcesResource, c.ns, kafkaSource), &v1alpha1.KafkaSource{}) + Invokes(testing.NewCreateActionWithOptions(kafkasourcesResource, c.ns, kafkaSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaSource), err } // Update takes the representation of a kafkaSource and updates it. Returns the server's representation of the kafkaSource, and an error, if there is any. func (c *FakeKafkaSources) Update(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.UpdateOptions) (result *v1alpha1.KafkaSource, err error) { + emptyResult := &v1alpha1.KafkaSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(kafkasourcesResource, c.ns, kafkaSource), &v1alpha1.KafkaSource{}) + Invokes(testing.NewUpdateActionWithOptions(kafkasourcesResource, c.ns, kafkaSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeKafkaSources) UpdateStatus(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.UpdateOptions) (*v1alpha1.KafkaSource, error) { +func (c *FakeKafkaSources) UpdateStatus(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.UpdateOptions) (result *v1alpha1.KafkaSource, err error) { + emptyResult := &v1alpha1.KafkaSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(kafkasourcesResource, "status", c.ns, kafkaSource), &v1alpha1.KafkaSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(kafkasourcesResource, "status", c.ns, kafkaSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaSource), err } @@ -107,7 +112,7 @@ func (c *FakeKafkaSources) Delete(ctx context.Context, name string, opts v1.Dele // DeleteCollection deletes a collection of objects. func (c *FakeKafkaSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(kafkasourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(kafkasourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.KafkaSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeKafkaSources) DeleteCollection(ctx context.Context, opts v1.DeleteO // Patch applies the patch and returns the patched kafkaSource. func (c *FakeKafkaSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KafkaSource, err error) { + emptyResult := &v1alpha1.KafkaSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(kafkasourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.KafkaSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(kafkasourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_ocimetricssource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_ocimetricssource.go index 143415e5..f62b73d9 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_ocimetricssource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_ocimetricssource.go @@ -25,22 +25,24 @@ var ocimetricssourcesKind = v1alpha1.SchemeGroupVersion.WithKind("OCIMetricsSour // Get takes name of the oCIMetricsSource, and returns the corresponding oCIMetricsSource object, and an error if there is any. func (c *FakeOCIMetricsSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.OCIMetricsSource, err error) { + emptyResult := &v1alpha1.OCIMetricsSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(ocimetricssourcesResource, c.ns, name), &v1alpha1.OCIMetricsSource{}) + Invokes(testing.NewGetActionWithOptions(ocimetricssourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.OCIMetricsSource), err } // List takes label and field selectors, and returns the list of OCIMetricsSources that match those selectors. func (c *FakeOCIMetricsSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.OCIMetricsSourceList, err error) { + emptyResult := &v1alpha1.OCIMetricsSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(ocimetricssourcesResource, ocimetricssourcesKind, c.ns, opts), &v1alpha1.OCIMetricsSourceList{}) + Invokes(testing.NewListActionWithOptions(ocimetricssourcesResource, ocimetricssourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeOCIMetricsSources) List(ctx context.Context, opts v1.ListOptions) ( // Watch returns a watch.Interface that watches the requested oCIMetricsSources. func (c *FakeOCIMetricsSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(ocimetricssourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(ocimetricssourcesResource, c.ns, opts)) } // Create takes the representation of a oCIMetricsSource and creates it. Returns the server's representation of the oCIMetricsSource, and an error, if there is any. func (c *FakeOCIMetricsSources) Create(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.CreateOptions) (result *v1alpha1.OCIMetricsSource, err error) { + emptyResult := &v1alpha1.OCIMetricsSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(ocimetricssourcesResource, c.ns, oCIMetricsSource), &v1alpha1.OCIMetricsSource{}) + Invokes(testing.NewCreateActionWithOptions(ocimetricssourcesResource, c.ns, oCIMetricsSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.OCIMetricsSource), err } // Update takes the representation of a oCIMetricsSource and updates it. Returns the server's representation of the oCIMetricsSource, and an error, if there is any. func (c *FakeOCIMetricsSources) Update(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.UpdateOptions) (result *v1alpha1.OCIMetricsSource, err error) { + emptyResult := &v1alpha1.OCIMetricsSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ocimetricssourcesResource, c.ns, oCIMetricsSource), &v1alpha1.OCIMetricsSource{}) + Invokes(testing.NewUpdateActionWithOptions(ocimetricssourcesResource, c.ns, oCIMetricsSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.OCIMetricsSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeOCIMetricsSources) UpdateStatus(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.UpdateOptions) (*v1alpha1.OCIMetricsSource, error) { +func (c *FakeOCIMetricsSources) UpdateStatus(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.UpdateOptions) (result *v1alpha1.OCIMetricsSource, err error) { + emptyResult := &v1alpha1.OCIMetricsSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ocimetricssourcesResource, "status", c.ns, oCIMetricsSource), &v1alpha1.OCIMetricsSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(ocimetricssourcesResource, "status", c.ns, oCIMetricsSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.OCIMetricsSource), err } @@ -107,7 +112,7 @@ func (c *FakeOCIMetricsSources) Delete(ctx context.Context, name string, opts v1 // DeleteCollection deletes a collection of objects. func (c *FakeOCIMetricsSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ocimetricssourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(ocimetricssourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.OCIMetricsSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeOCIMetricsSources) DeleteCollection(ctx context.Context, opts v1.De // Patch applies the patch and returns the patched oCIMetricsSource. func (c *FakeOCIMetricsSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.OCIMetricsSource, err error) { + emptyResult := &v1alpha1.OCIMetricsSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ocimetricssourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.OCIMetricsSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(ocimetricssourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.OCIMetricsSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_salesforcesource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_salesforcesource.go index 01452ef1..6518b693 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_salesforcesource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_salesforcesource.go @@ -25,22 +25,24 @@ var salesforcesourcesKind = v1alpha1.SchemeGroupVersion.WithKind("SalesforceSour // Get takes name of the salesforceSource, and returns the corresponding salesforceSource object, and an error if there is any. func (c *FakeSalesforceSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SalesforceSource, err error) { + emptyResult := &v1alpha1.SalesforceSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(salesforcesourcesResource, c.ns, name), &v1alpha1.SalesforceSource{}) + Invokes(testing.NewGetActionWithOptions(salesforcesourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceSource), err } // List takes label and field selectors, and returns the list of SalesforceSources that match those selectors. func (c *FakeSalesforceSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SalesforceSourceList, err error) { + emptyResult := &v1alpha1.SalesforceSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(salesforcesourcesResource, salesforcesourcesKind, c.ns, opts), &v1alpha1.SalesforceSourceList{}) + Invokes(testing.NewListActionWithOptions(salesforcesourcesResource, salesforcesourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeSalesforceSources) List(ctx context.Context, opts v1.ListOptions) ( // Watch returns a watch.Interface that watches the requested salesforceSources. func (c *FakeSalesforceSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(salesforcesourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(salesforcesourcesResource, c.ns, opts)) } // Create takes the representation of a salesforceSource and creates it. Returns the server's representation of the salesforceSource, and an error, if there is any. func (c *FakeSalesforceSources) Create(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.CreateOptions) (result *v1alpha1.SalesforceSource, err error) { + emptyResult := &v1alpha1.SalesforceSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(salesforcesourcesResource, c.ns, salesforceSource), &v1alpha1.SalesforceSource{}) + Invokes(testing.NewCreateActionWithOptions(salesforcesourcesResource, c.ns, salesforceSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceSource), err } // Update takes the representation of a salesforceSource and updates it. Returns the server's representation of the salesforceSource, and an error, if there is any. func (c *FakeSalesforceSources) Update(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.UpdateOptions) (result *v1alpha1.SalesforceSource, err error) { + emptyResult := &v1alpha1.SalesforceSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(salesforcesourcesResource, c.ns, salesforceSource), &v1alpha1.SalesforceSource{}) + Invokes(testing.NewUpdateActionWithOptions(salesforcesourcesResource, c.ns, salesforceSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSalesforceSources) UpdateStatus(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.UpdateOptions) (*v1alpha1.SalesforceSource, error) { +func (c *FakeSalesforceSources) UpdateStatus(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.UpdateOptions) (result *v1alpha1.SalesforceSource, err error) { + emptyResult := &v1alpha1.SalesforceSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(salesforcesourcesResource, "status", c.ns, salesforceSource), &v1alpha1.SalesforceSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(salesforcesourcesResource, "status", c.ns, salesforceSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceSource), err } @@ -107,7 +112,7 @@ func (c *FakeSalesforceSources) Delete(ctx context.Context, name string, opts v1 // DeleteCollection deletes a collection of objects. func (c *FakeSalesforceSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(salesforcesourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(salesforcesourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.SalesforceSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeSalesforceSources) DeleteCollection(ctx context.Context, opts v1.De // Patch applies the patch and returns the patched salesforceSource. func (c *FakeSalesforceSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SalesforceSource, err error) { + emptyResult := &v1alpha1.SalesforceSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(salesforcesourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.SalesforceSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(salesforcesourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_webhooksource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_webhooksource.go index 87a84ca6..21b7be26 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_webhooksource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/fake/fake_webhooksource.go @@ -25,22 +25,24 @@ var webhooksourcesKind = v1alpha1.SchemeGroupVersion.WithKind("WebhookSource") // Get takes name of the webhookSource, and returns the corresponding webhookSource object, and an error if there is any. func (c *FakeWebhookSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.WebhookSource, err error) { + emptyResult := &v1alpha1.WebhookSource{} obj, err := c.Fake. - Invokes(testing.NewGetAction(webhooksourcesResource, c.ns, name), &v1alpha1.WebhookSource{}) + Invokes(testing.NewGetActionWithOptions(webhooksourcesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WebhookSource), err } // List takes label and field selectors, and returns the list of WebhookSources that match those selectors. func (c *FakeWebhookSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.WebhookSourceList, err error) { + emptyResult := &v1alpha1.WebhookSourceList{} obj, err := c.Fake. - Invokes(testing.NewListAction(webhooksourcesResource, webhooksourcesKind, c.ns, opts), &v1alpha1.WebhookSourceList{}) + Invokes(testing.NewListActionWithOptions(webhooksourcesResource, webhooksourcesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeWebhookSources) List(ctx context.Context, opts v1.ListOptions) (res // Watch returns a watch.Interface that watches the requested webhookSources. func (c *FakeWebhookSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(webhooksourcesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(webhooksourcesResource, c.ns, opts)) } // Create takes the representation of a webhookSource and creates it. Returns the server's representation of the webhookSource, and an error, if there is any. func (c *FakeWebhookSources) Create(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.CreateOptions) (result *v1alpha1.WebhookSource, err error) { + emptyResult := &v1alpha1.WebhookSource{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(webhooksourcesResource, c.ns, webhookSource), &v1alpha1.WebhookSource{}) + Invokes(testing.NewCreateActionWithOptions(webhooksourcesResource, c.ns, webhookSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WebhookSource), err } // Update takes the representation of a webhookSource and updates it. Returns the server's representation of the webhookSource, and an error, if there is any. func (c *FakeWebhookSources) Update(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.UpdateOptions) (result *v1alpha1.WebhookSource, err error) { + emptyResult := &v1alpha1.WebhookSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(webhooksourcesResource, c.ns, webhookSource), &v1alpha1.WebhookSource{}) + Invokes(testing.NewUpdateActionWithOptions(webhooksourcesResource, c.ns, webhookSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WebhookSource), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWebhookSources) UpdateStatus(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.UpdateOptions) (*v1alpha1.WebhookSource, error) { +func (c *FakeWebhookSources) UpdateStatus(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.UpdateOptions) (result *v1alpha1.WebhookSource, err error) { + emptyResult := &v1alpha1.WebhookSource{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(webhooksourcesResource, "status", c.ns, webhookSource), &v1alpha1.WebhookSource{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(webhooksourcesResource, "status", c.ns, webhookSource, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WebhookSource), err } @@ -107,7 +112,7 @@ func (c *FakeWebhookSources) Delete(ctx context.Context, name string, opts v1.De // DeleteCollection deletes a collection of objects. func (c *FakeWebhookSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(webhooksourcesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(webhooksourcesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.WebhookSourceList{}) return err @@ -115,11 +120,12 @@ func (c *FakeWebhookSources) DeleteCollection(ctx context.Context, opts v1.Delet // Patch applies the patch and returns the patched webhookSource. func (c *FakeWebhookSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.WebhookSource, err error) { + emptyResult := &v1alpha1.WebhookSource{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(webhooksourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.WebhookSource{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(webhooksourcesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.WebhookSource), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/httppollersource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/httppollersource.go index 504e9909..8fdab7de 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/httppollersource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/httppollersource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // HTTPPollerSourcesGetter has a method to return a HTTPPollerSourceInterface. @@ -24,6 +23,7 @@ type HTTPPollerSourcesGetter interface { type HTTPPollerSourceInterface interface { Create(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.CreateOptions) (*v1alpha1.HTTPPollerSource, error) Update(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.UpdateOptions) (*v1alpha1.HTTPPollerSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.UpdateOptions) (*v1alpha1.HTTPPollerSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type HTTPPollerSourceInterface interface { // hTTPPollerSources implements HTTPPollerSourceInterface type hTTPPollerSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.HTTPPollerSource, *v1alpha1.HTTPPollerSourceList] } // newHTTPPollerSources returns a HTTPPollerSources func newHTTPPollerSources(c *SourcesV1alpha1Client, namespace string) *hTTPPollerSources { return &hTTPPollerSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.HTTPPollerSource, *v1alpha1.HTTPPollerSourceList]( + "httppollersources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.HTTPPollerSource { return &v1alpha1.HTTPPollerSource{} }, + func() *v1alpha1.HTTPPollerSourceList { return &v1alpha1.HTTPPollerSourceList{} }), } } - -// Get takes name of the hTTPPollerSource, and returns the corresponding hTTPPollerSource object, and an error if there is any. -func (c *hTTPPollerSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.HTTPPollerSource, err error) { - result = &v1alpha1.HTTPPollerSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httppollersources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of HTTPPollerSources that match those selectors. -func (c *hTTPPollerSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.HTTPPollerSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.HTTPPollerSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httppollersources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested hTTPPollerSources. -func (c *hTTPPollerSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("httppollersources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a hTTPPollerSource and creates it. Returns the server's representation of the hTTPPollerSource, and an error, if there is any. -func (c *hTTPPollerSources) Create(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.CreateOptions) (result *v1alpha1.HTTPPollerSource, err error) { - result = &v1alpha1.HTTPPollerSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("httppollersources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPPollerSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a hTTPPollerSource and updates it. Returns the server's representation of the hTTPPollerSource, and an error, if there is any. -func (c *hTTPPollerSources) Update(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.UpdateOptions) (result *v1alpha1.HTTPPollerSource, err error) { - result = &v1alpha1.HTTPPollerSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httppollersources"). - Name(hTTPPollerSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPPollerSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *hTTPPollerSources) UpdateStatus(ctx context.Context, hTTPPollerSource *v1alpha1.HTTPPollerSource, opts v1.UpdateOptions) (result *v1alpha1.HTTPPollerSource, err error) { - result = &v1alpha1.HTTPPollerSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httppollersources"). - Name(hTTPPollerSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPPollerSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the hTTPPollerSource and deletes it. Returns an error if one occurs. -func (c *hTTPPollerSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("httppollersources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *hTTPPollerSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("httppollersources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched hTTPPollerSource. -func (c *hTTPPollerSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.HTTPPollerSource, err error) { - result = &v1alpha1.HTTPPollerSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("httppollersources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/kafkasource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/kafkasource.go index c283b4ee..81916ae9 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/kafkasource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/kafkasource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // KafkaSourcesGetter has a method to return a KafkaSourceInterface. @@ -24,6 +23,7 @@ type KafkaSourcesGetter interface { type KafkaSourceInterface interface { Create(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.CreateOptions) (*v1alpha1.KafkaSource, error) Update(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.UpdateOptions) (*v1alpha1.KafkaSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.UpdateOptions) (*v1alpha1.KafkaSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type KafkaSourceInterface interface { // kafkaSources implements KafkaSourceInterface type kafkaSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.KafkaSource, *v1alpha1.KafkaSourceList] } // newKafkaSources returns a KafkaSources func newKafkaSources(c *SourcesV1alpha1Client, namespace string) *kafkaSources { return &kafkaSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.KafkaSource, *v1alpha1.KafkaSourceList]( + "kafkasources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.KafkaSource { return &v1alpha1.KafkaSource{} }, + func() *v1alpha1.KafkaSourceList { return &v1alpha1.KafkaSourceList{} }), } } - -// Get takes name of the kafkaSource, and returns the corresponding kafkaSource object, and an error if there is any. -func (c *kafkaSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KafkaSource, err error) { - result = &v1alpha1.KafkaSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("kafkasources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of KafkaSources that match those selectors. -func (c *kafkaSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KafkaSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.KafkaSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("kafkasources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested kafkaSources. -func (c *kafkaSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("kafkasources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a kafkaSource and creates it. Returns the server's representation of the kafkaSource, and an error, if there is any. -func (c *kafkaSources) Create(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.CreateOptions) (result *v1alpha1.KafkaSource, err error) { - result = &v1alpha1.KafkaSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("kafkasources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(kafkaSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a kafkaSource and updates it. Returns the server's representation of the kafkaSource, and an error, if there is any. -func (c *kafkaSources) Update(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.UpdateOptions) (result *v1alpha1.KafkaSource, err error) { - result = &v1alpha1.KafkaSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("kafkasources"). - Name(kafkaSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(kafkaSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *kafkaSources) UpdateStatus(ctx context.Context, kafkaSource *v1alpha1.KafkaSource, opts v1.UpdateOptions) (result *v1alpha1.KafkaSource, err error) { - result = &v1alpha1.KafkaSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("kafkasources"). - Name(kafkaSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(kafkaSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the kafkaSource and deletes it. Returns an error if one occurs. -func (c *kafkaSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("kafkasources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *kafkaSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("kafkasources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched kafkaSource. -func (c *kafkaSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KafkaSource, err error) { - result = &v1alpha1.KafkaSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("kafkasources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/ocimetricssource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/ocimetricssource.go index e7f92590..fa6f4600 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/ocimetricssource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/ocimetricssource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // OCIMetricsSourcesGetter has a method to return a OCIMetricsSourceInterface. @@ -24,6 +23,7 @@ type OCIMetricsSourcesGetter interface { type OCIMetricsSourceInterface interface { Create(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.CreateOptions) (*v1alpha1.OCIMetricsSource, error) Update(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.UpdateOptions) (*v1alpha1.OCIMetricsSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.UpdateOptions) (*v1alpha1.OCIMetricsSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type OCIMetricsSourceInterface interface { // oCIMetricsSources implements OCIMetricsSourceInterface type oCIMetricsSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.OCIMetricsSource, *v1alpha1.OCIMetricsSourceList] } // newOCIMetricsSources returns a OCIMetricsSources func newOCIMetricsSources(c *SourcesV1alpha1Client, namespace string) *oCIMetricsSources { return &oCIMetricsSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.OCIMetricsSource, *v1alpha1.OCIMetricsSourceList]( + "ocimetricssources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.OCIMetricsSource { return &v1alpha1.OCIMetricsSource{} }, + func() *v1alpha1.OCIMetricsSourceList { return &v1alpha1.OCIMetricsSourceList{} }), } } - -// Get takes name of the oCIMetricsSource, and returns the corresponding oCIMetricsSource object, and an error if there is any. -func (c *oCIMetricsSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.OCIMetricsSource, err error) { - result = &v1alpha1.OCIMetricsSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ocimetricssources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of OCIMetricsSources that match those selectors. -func (c *oCIMetricsSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.OCIMetricsSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.OCIMetricsSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ocimetricssources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested oCIMetricsSources. -func (c *oCIMetricsSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ocimetricssources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a oCIMetricsSource and creates it. Returns the server's representation of the oCIMetricsSource, and an error, if there is any. -func (c *oCIMetricsSources) Create(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.CreateOptions) (result *v1alpha1.OCIMetricsSource, err error) { - result = &v1alpha1.OCIMetricsSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ocimetricssources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(oCIMetricsSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a oCIMetricsSource and updates it. Returns the server's representation of the oCIMetricsSource, and an error, if there is any. -func (c *oCIMetricsSources) Update(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.UpdateOptions) (result *v1alpha1.OCIMetricsSource, err error) { - result = &v1alpha1.OCIMetricsSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ocimetricssources"). - Name(oCIMetricsSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(oCIMetricsSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *oCIMetricsSources) UpdateStatus(ctx context.Context, oCIMetricsSource *v1alpha1.OCIMetricsSource, opts v1.UpdateOptions) (result *v1alpha1.OCIMetricsSource, err error) { - result = &v1alpha1.OCIMetricsSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ocimetricssources"). - Name(oCIMetricsSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(oCIMetricsSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the oCIMetricsSource and deletes it. Returns an error if one occurs. -func (c *oCIMetricsSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ocimetricssources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *oCIMetricsSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ocimetricssources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched oCIMetricsSource. -func (c *oCIMetricsSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.OCIMetricsSource, err error) { - result = &v1alpha1.OCIMetricsSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ocimetricssources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/salesforcesource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/salesforcesource.go index 68b3e8aa..c50fb7b9 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/salesforcesource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/salesforcesource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // SalesforceSourcesGetter has a method to return a SalesforceSourceInterface. @@ -24,6 +23,7 @@ type SalesforceSourcesGetter interface { type SalesforceSourceInterface interface { Create(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.CreateOptions) (*v1alpha1.SalesforceSource, error) Update(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.UpdateOptions) (*v1alpha1.SalesforceSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.UpdateOptions) (*v1alpha1.SalesforceSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type SalesforceSourceInterface interface { // salesforceSources implements SalesforceSourceInterface type salesforceSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.SalesforceSource, *v1alpha1.SalesforceSourceList] } // newSalesforceSources returns a SalesforceSources func newSalesforceSources(c *SourcesV1alpha1Client, namespace string) *salesforceSources { return &salesforceSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.SalesforceSource, *v1alpha1.SalesforceSourceList]( + "salesforcesources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.SalesforceSource { return &v1alpha1.SalesforceSource{} }, + func() *v1alpha1.SalesforceSourceList { return &v1alpha1.SalesforceSourceList{} }), } } - -// Get takes name of the salesforceSource, and returns the corresponding salesforceSource object, and an error if there is any. -func (c *salesforceSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SalesforceSource, err error) { - result = &v1alpha1.SalesforceSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("salesforcesources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SalesforceSources that match those selectors. -func (c *salesforceSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SalesforceSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.SalesforceSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("salesforcesources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested salesforceSources. -func (c *salesforceSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("salesforcesources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a salesforceSource and creates it. Returns the server's representation of the salesforceSource, and an error, if there is any. -func (c *salesforceSources) Create(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.CreateOptions) (result *v1alpha1.SalesforceSource, err error) { - result = &v1alpha1.SalesforceSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("salesforcesources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(salesforceSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a salesforceSource and updates it. Returns the server's representation of the salesforceSource, and an error, if there is any. -func (c *salesforceSources) Update(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.UpdateOptions) (result *v1alpha1.SalesforceSource, err error) { - result = &v1alpha1.SalesforceSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("salesforcesources"). - Name(salesforceSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(salesforceSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *salesforceSources) UpdateStatus(ctx context.Context, salesforceSource *v1alpha1.SalesforceSource, opts v1.UpdateOptions) (result *v1alpha1.SalesforceSource, err error) { - result = &v1alpha1.SalesforceSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("salesforcesources"). - Name(salesforceSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(salesforceSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the salesforceSource and deletes it. Returns an error if one occurs. -func (c *salesforceSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("salesforcesources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *salesforceSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("salesforcesources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched salesforceSource. -func (c *salesforceSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SalesforceSource, err error) { - result = &v1alpha1.SalesforceSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("salesforcesources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/webhooksource.go b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/webhooksource.go index 0e53be17..0b34eb88 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/webhooksource.go +++ b/pkg/client/generated/clientset/internalclientset/typed/sources/v1alpha1/webhooksource.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // WebhookSourcesGetter has a method to return a WebhookSourceInterface. @@ -24,6 +23,7 @@ type WebhookSourcesGetter interface { type WebhookSourceInterface interface { Create(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.CreateOptions) (*v1alpha1.WebhookSource, error) Update(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.UpdateOptions) (*v1alpha1.WebhookSource, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.UpdateOptions) (*v1alpha1.WebhookSource, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type WebhookSourceInterface interface { // webhookSources implements WebhookSourceInterface type webhookSources struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.WebhookSource, *v1alpha1.WebhookSourceList] } // newWebhookSources returns a WebhookSources func newWebhookSources(c *SourcesV1alpha1Client, namespace string) *webhookSources { return &webhookSources{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.WebhookSource, *v1alpha1.WebhookSourceList]( + "webhooksources", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.WebhookSource { return &v1alpha1.WebhookSource{} }, + func() *v1alpha1.WebhookSourceList { return &v1alpha1.WebhookSourceList{} }), } } - -// Get takes name of the webhookSource, and returns the corresponding webhookSource object, and an error if there is any. -func (c *webhookSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.WebhookSource, err error) { - result = &v1alpha1.WebhookSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("webhooksources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of WebhookSources that match those selectors. -func (c *webhookSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.WebhookSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.WebhookSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("webhooksources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested webhookSources. -func (c *webhookSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("webhooksources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a webhookSource and creates it. Returns the server's representation of the webhookSource, and an error, if there is any. -func (c *webhookSources) Create(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.CreateOptions) (result *v1alpha1.WebhookSource, err error) { - result = &v1alpha1.WebhookSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("webhooksources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a webhookSource and updates it. Returns the server's representation of the webhookSource, and an error, if there is any. -func (c *webhookSources) Update(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.UpdateOptions) (result *v1alpha1.WebhookSource, err error) { - result = &v1alpha1.WebhookSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("webhooksources"). - Name(webhookSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *webhookSources) UpdateStatus(ctx context.Context, webhookSource *v1alpha1.WebhookSource, opts v1.UpdateOptions) (result *v1alpha1.WebhookSource, err error) { - result = &v1alpha1.WebhookSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("webhooksources"). - Name(webhookSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the webhookSource and deletes it. Returns an error if one occurs. -func (c *webhookSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("webhooksources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *webhookSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("webhooksources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched webhookSource. -func (c *webhookSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.WebhookSource, err error) { - result = &v1alpha1.WebhookSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("webhooksources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/cloudeventstarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/cloudeventstarget.go index 755204b1..3a2f0e42 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/cloudeventstarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/cloudeventstarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // CloudEventsTargetsGetter has a method to return a CloudEventsTargetInterface. @@ -24,6 +23,7 @@ type CloudEventsTargetsGetter interface { type CloudEventsTargetInterface interface { Create(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.CreateOptions) (*v1alpha1.CloudEventsTarget, error) Update(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.UpdateOptions) (*v1alpha1.CloudEventsTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.UpdateOptions) (*v1alpha1.CloudEventsTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type CloudEventsTargetInterface interface { // cloudEventsTargets implements CloudEventsTargetInterface type cloudEventsTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.CloudEventsTarget, *v1alpha1.CloudEventsTargetList] } // newCloudEventsTargets returns a CloudEventsTargets func newCloudEventsTargets(c *TargetsV1alpha1Client, namespace string) *cloudEventsTargets { return &cloudEventsTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.CloudEventsTarget, *v1alpha1.CloudEventsTargetList]( + "cloudeventstargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.CloudEventsTarget { return &v1alpha1.CloudEventsTarget{} }, + func() *v1alpha1.CloudEventsTargetList { return &v1alpha1.CloudEventsTargetList{} }), } } - -// Get takes name of the cloudEventsTarget, and returns the corresponding cloudEventsTarget object, and an error if there is any. -func (c *cloudEventsTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CloudEventsTarget, err error) { - result = &v1alpha1.CloudEventsTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cloudeventstargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CloudEventsTargets that match those selectors. -func (c *cloudEventsTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CloudEventsTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.CloudEventsTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("cloudeventstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cloudEventsTargets. -func (c *cloudEventsTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("cloudeventstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cloudEventsTarget and creates it. Returns the server's representation of the cloudEventsTarget, and an error, if there is any. -func (c *cloudEventsTargets) Create(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.CreateOptions) (result *v1alpha1.CloudEventsTarget, err error) { - result = &v1alpha1.CloudEventsTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("cloudeventstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cloudEventsTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cloudEventsTarget and updates it. Returns the server's representation of the cloudEventsTarget, and an error, if there is any. -func (c *cloudEventsTargets) Update(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.UpdateOptions) (result *v1alpha1.CloudEventsTarget, err error) { - result = &v1alpha1.CloudEventsTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cloudeventstargets"). - Name(cloudEventsTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cloudEventsTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *cloudEventsTargets) UpdateStatus(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.UpdateOptions) (result *v1alpha1.CloudEventsTarget, err error) { - result = &v1alpha1.CloudEventsTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("cloudeventstargets"). - Name(cloudEventsTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cloudEventsTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cloudEventsTarget and deletes it. Returns an error if one occurs. -func (c *cloudEventsTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("cloudeventstargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cloudEventsTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("cloudeventstargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cloudEventsTarget. -func (c *cloudEventsTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CloudEventsTarget, err error) { - result = &v1alpha1.CloudEventsTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("cloudeventstargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/datadogtarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/datadogtarget.go index 0ceef2fa..a570bdce 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/datadogtarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/datadogtarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // DatadogTargetsGetter has a method to return a DatadogTargetInterface. @@ -24,6 +23,7 @@ type DatadogTargetsGetter interface { type DatadogTargetInterface interface { Create(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.CreateOptions) (*v1alpha1.DatadogTarget, error) Update(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.UpdateOptions) (*v1alpha1.DatadogTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.UpdateOptions) (*v1alpha1.DatadogTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type DatadogTargetInterface interface { // datadogTargets implements DatadogTargetInterface type datadogTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.DatadogTarget, *v1alpha1.DatadogTargetList] } // newDatadogTargets returns a DatadogTargets func newDatadogTargets(c *TargetsV1alpha1Client, namespace string) *datadogTargets { return &datadogTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.DatadogTarget, *v1alpha1.DatadogTargetList]( + "datadogtargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.DatadogTarget { return &v1alpha1.DatadogTarget{} }, + func() *v1alpha1.DatadogTargetList { return &v1alpha1.DatadogTargetList{} }), } } - -// Get takes name of the datadogTarget, and returns the corresponding datadogTarget object, and an error if there is any. -func (c *datadogTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DatadogTarget, err error) { - result = &v1alpha1.DatadogTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datadogtargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DatadogTargets that match those selectors. -func (c *datadogTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.DatadogTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.DatadogTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datadogtargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested datadogTargets. -func (c *datadogTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("datadogtargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a datadogTarget and creates it. Returns the server's representation of the datadogTarget, and an error, if there is any. -func (c *datadogTargets) Create(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.CreateOptions) (result *v1alpha1.DatadogTarget, err error) { - result = &v1alpha1.DatadogTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("datadogtargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(datadogTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a datadogTarget and updates it. Returns the server's representation of the datadogTarget, and an error, if there is any. -func (c *datadogTargets) Update(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.UpdateOptions) (result *v1alpha1.DatadogTarget, err error) { - result = &v1alpha1.DatadogTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datadogtargets"). - Name(datadogTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(datadogTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *datadogTargets) UpdateStatus(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.UpdateOptions) (result *v1alpha1.DatadogTarget, err error) { - result = &v1alpha1.DatadogTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datadogtargets"). - Name(datadogTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(datadogTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the datadogTarget and deletes it. Returns an error if one occurs. -func (c *datadogTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("datadogtargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *datadogTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("datadogtargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched datadogTarget. -func (c *datadogTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DatadogTarget, err error) { - result = &v1alpha1.DatadogTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("datadogtargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_cloudeventstarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_cloudeventstarget.go index 19ca314c..2772c32a 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_cloudeventstarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_cloudeventstarget.go @@ -25,22 +25,24 @@ var cloudeventstargetsKind = v1alpha1.SchemeGroupVersion.WithKind("CloudEventsTa // Get takes name of the cloudEventsTarget, and returns the corresponding cloudEventsTarget object, and an error if there is any. func (c *FakeCloudEventsTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CloudEventsTarget, err error) { + emptyResult := &v1alpha1.CloudEventsTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(cloudeventstargetsResource, c.ns, name), &v1alpha1.CloudEventsTarget{}) + Invokes(testing.NewGetActionWithOptions(cloudeventstargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsTarget), err } // List takes label and field selectors, and returns the list of CloudEventsTargets that match those selectors. func (c *FakeCloudEventsTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CloudEventsTargetList, err error) { + emptyResult := &v1alpha1.CloudEventsTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(cloudeventstargetsResource, cloudeventstargetsKind, c.ns, opts), &v1alpha1.CloudEventsTargetList{}) + Invokes(testing.NewListActionWithOptions(cloudeventstargetsResource, cloudeventstargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeCloudEventsTargets) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested cloudEventsTargets. func (c *FakeCloudEventsTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(cloudeventstargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(cloudeventstargetsResource, c.ns, opts)) } // Create takes the representation of a cloudEventsTarget and creates it. Returns the server's representation of the cloudEventsTarget, and an error, if there is any. func (c *FakeCloudEventsTargets) Create(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.CreateOptions) (result *v1alpha1.CloudEventsTarget, err error) { + emptyResult := &v1alpha1.CloudEventsTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(cloudeventstargetsResource, c.ns, cloudEventsTarget), &v1alpha1.CloudEventsTarget{}) + Invokes(testing.NewCreateActionWithOptions(cloudeventstargetsResource, c.ns, cloudEventsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsTarget), err } // Update takes the representation of a cloudEventsTarget and updates it. Returns the server's representation of the cloudEventsTarget, and an error, if there is any. func (c *FakeCloudEventsTargets) Update(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.UpdateOptions) (result *v1alpha1.CloudEventsTarget, err error) { + emptyResult := &v1alpha1.CloudEventsTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(cloudeventstargetsResource, c.ns, cloudEventsTarget), &v1alpha1.CloudEventsTarget{}) + Invokes(testing.NewUpdateActionWithOptions(cloudeventstargetsResource, c.ns, cloudEventsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCloudEventsTargets) UpdateStatus(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.UpdateOptions) (*v1alpha1.CloudEventsTarget, error) { +func (c *FakeCloudEventsTargets) UpdateStatus(ctx context.Context, cloudEventsTarget *v1alpha1.CloudEventsTarget, opts v1.UpdateOptions) (result *v1alpha1.CloudEventsTarget, err error) { + emptyResult := &v1alpha1.CloudEventsTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(cloudeventstargetsResource, "status", c.ns, cloudEventsTarget), &v1alpha1.CloudEventsTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(cloudeventstargetsResource, "status", c.ns, cloudEventsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsTarget), err } @@ -107,7 +112,7 @@ func (c *FakeCloudEventsTargets) Delete(ctx context.Context, name string, opts v // DeleteCollection deletes a collection of objects. func (c *FakeCloudEventsTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(cloudeventstargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(cloudeventstargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.CloudEventsTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeCloudEventsTargets) DeleteCollection(ctx context.Context, opts v1.D // Patch applies the patch and returns the patched cloudEventsTarget. func (c *FakeCloudEventsTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CloudEventsTarget, err error) { + emptyResult := &v1alpha1.CloudEventsTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(cloudeventstargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.CloudEventsTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(cloudeventstargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.CloudEventsTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_datadogtarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_datadogtarget.go index 86d7ede2..c52f3771 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_datadogtarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_datadogtarget.go @@ -25,22 +25,24 @@ var datadogtargetsKind = v1alpha1.SchemeGroupVersion.WithKind("DatadogTarget") // Get takes name of the datadogTarget, and returns the corresponding datadogTarget object, and an error if there is any. func (c *FakeDatadogTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DatadogTarget, err error) { + emptyResult := &v1alpha1.DatadogTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(datadogtargetsResource, c.ns, name), &v1alpha1.DatadogTarget{}) + Invokes(testing.NewGetActionWithOptions(datadogtargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.DatadogTarget), err } // List takes label and field selectors, and returns the list of DatadogTargets that match those selectors. func (c *FakeDatadogTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.DatadogTargetList, err error) { + emptyResult := &v1alpha1.DatadogTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(datadogtargetsResource, datadogtargetsKind, c.ns, opts), &v1alpha1.DatadogTargetList{}) + Invokes(testing.NewListActionWithOptions(datadogtargetsResource, datadogtargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeDatadogTargets) List(ctx context.Context, opts v1.ListOptions) (res // Watch returns a watch.Interface that watches the requested datadogTargets. func (c *FakeDatadogTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(datadogtargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(datadogtargetsResource, c.ns, opts)) } // Create takes the representation of a datadogTarget and creates it. Returns the server's representation of the datadogTarget, and an error, if there is any. func (c *FakeDatadogTargets) Create(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.CreateOptions) (result *v1alpha1.DatadogTarget, err error) { + emptyResult := &v1alpha1.DatadogTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(datadogtargetsResource, c.ns, datadogTarget), &v1alpha1.DatadogTarget{}) + Invokes(testing.NewCreateActionWithOptions(datadogtargetsResource, c.ns, datadogTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.DatadogTarget), err } // Update takes the representation of a datadogTarget and updates it. Returns the server's representation of the datadogTarget, and an error, if there is any. func (c *FakeDatadogTargets) Update(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.UpdateOptions) (result *v1alpha1.DatadogTarget, err error) { + emptyResult := &v1alpha1.DatadogTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(datadogtargetsResource, c.ns, datadogTarget), &v1alpha1.DatadogTarget{}) + Invokes(testing.NewUpdateActionWithOptions(datadogtargetsResource, c.ns, datadogTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.DatadogTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDatadogTargets) UpdateStatus(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.UpdateOptions) (*v1alpha1.DatadogTarget, error) { +func (c *FakeDatadogTargets) UpdateStatus(ctx context.Context, datadogTarget *v1alpha1.DatadogTarget, opts v1.UpdateOptions) (result *v1alpha1.DatadogTarget, err error) { + emptyResult := &v1alpha1.DatadogTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(datadogtargetsResource, "status", c.ns, datadogTarget), &v1alpha1.DatadogTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(datadogtargetsResource, "status", c.ns, datadogTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.DatadogTarget), err } @@ -107,7 +112,7 @@ func (c *FakeDatadogTargets) Delete(ctx context.Context, name string, opts v1.De // DeleteCollection deletes a collection of objects. func (c *FakeDatadogTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(datadogtargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(datadogtargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.DatadogTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeDatadogTargets) DeleteCollection(ctx context.Context, opts v1.Delet // Patch applies the patch and returns the patched datadogTarget. func (c *FakeDatadogTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DatadogTarget, err error) { + emptyResult := &v1alpha1.DatadogTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(datadogtargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.DatadogTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(datadogtargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.DatadogTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_httptarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_httptarget.go index dec5c606..0ef6b25f 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_httptarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_httptarget.go @@ -25,22 +25,24 @@ var httptargetsKind = v1alpha1.SchemeGroupVersion.WithKind("HTTPTarget") // Get takes name of the hTTPTarget, and returns the corresponding hTTPTarget object, and an error if there is any. func (c *FakeHTTPTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.HTTPTarget, err error) { + emptyResult := &v1alpha1.HTTPTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(httptargetsResource, c.ns, name), &v1alpha1.HTTPTarget{}) + Invokes(testing.NewGetActionWithOptions(httptargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPTarget), err } // List takes label and field selectors, and returns the list of HTTPTargets that match those selectors. func (c *FakeHTTPTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.HTTPTargetList, err error) { + emptyResult := &v1alpha1.HTTPTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(httptargetsResource, httptargetsKind, c.ns, opts), &v1alpha1.HTTPTargetList{}) + Invokes(testing.NewListActionWithOptions(httptargetsResource, httptargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeHTTPTargets) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested hTTPTargets. func (c *FakeHTTPTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(httptargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(httptargetsResource, c.ns, opts)) } // Create takes the representation of a hTTPTarget and creates it. Returns the server's representation of the hTTPTarget, and an error, if there is any. func (c *FakeHTTPTargets) Create(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.CreateOptions) (result *v1alpha1.HTTPTarget, err error) { + emptyResult := &v1alpha1.HTTPTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(httptargetsResource, c.ns, hTTPTarget), &v1alpha1.HTTPTarget{}) + Invokes(testing.NewCreateActionWithOptions(httptargetsResource, c.ns, hTTPTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPTarget), err } // Update takes the representation of a hTTPTarget and updates it. Returns the server's representation of the hTTPTarget, and an error, if there is any. func (c *FakeHTTPTargets) Update(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.UpdateOptions) (result *v1alpha1.HTTPTarget, err error) { + emptyResult := &v1alpha1.HTTPTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(httptargetsResource, c.ns, hTTPTarget), &v1alpha1.HTTPTarget{}) + Invokes(testing.NewUpdateActionWithOptions(httptargetsResource, c.ns, hTTPTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeHTTPTargets) UpdateStatus(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.UpdateOptions) (*v1alpha1.HTTPTarget, error) { +func (c *FakeHTTPTargets) UpdateStatus(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.UpdateOptions) (result *v1alpha1.HTTPTarget, err error) { + emptyResult := &v1alpha1.HTTPTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(httptargetsResource, "status", c.ns, hTTPTarget), &v1alpha1.HTTPTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(httptargetsResource, "status", c.ns, hTTPTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPTarget), err } @@ -107,7 +112,7 @@ func (c *FakeHTTPTargets) Delete(ctx context.Context, name string, opts v1.Delet // DeleteCollection deletes a collection of objects. func (c *FakeHTTPTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(httptargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(httptargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.HTTPTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeHTTPTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOp // Patch applies the patch and returns the patched hTTPTarget. func (c *FakeHTTPTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.HTTPTarget, err error) { + emptyResult := &v1alpha1.HTTPTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httptargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.HTTPTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httptargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.HTTPTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_jiratarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_jiratarget.go index 7dfe9919..01147134 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_jiratarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_jiratarget.go @@ -25,22 +25,24 @@ var jiratargetsKind = v1alpha1.SchemeGroupVersion.WithKind("JiraTarget") // Get takes name of the jiraTarget, and returns the corresponding jiraTarget object, and an error if there is any. func (c *FakeJiraTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.JiraTarget, err error) { + emptyResult := &v1alpha1.JiraTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(jiratargetsResource, c.ns, name), &v1alpha1.JiraTarget{}) + Invokes(testing.NewGetActionWithOptions(jiratargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JiraTarget), err } // List takes label and field selectors, and returns the list of JiraTargets that match those selectors. func (c *FakeJiraTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.JiraTargetList, err error) { + emptyResult := &v1alpha1.JiraTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(jiratargetsResource, jiratargetsKind, c.ns, opts), &v1alpha1.JiraTargetList{}) + Invokes(testing.NewListActionWithOptions(jiratargetsResource, jiratargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeJiraTargets) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested jiraTargets. func (c *FakeJiraTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(jiratargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(jiratargetsResource, c.ns, opts)) } // Create takes the representation of a jiraTarget and creates it. Returns the server's representation of the jiraTarget, and an error, if there is any. func (c *FakeJiraTargets) Create(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.CreateOptions) (result *v1alpha1.JiraTarget, err error) { + emptyResult := &v1alpha1.JiraTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(jiratargetsResource, c.ns, jiraTarget), &v1alpha1.JiraTarget{}) + Invokes(testing.NewCreateActionWithOptions(jiratargetsResource, c.ns, jiraTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JiraTarget), err } // Update takes the representation of a jiraTarget and updates it. Returns the server's representation of the jiraTarget, and an error, if there is any. func (c *FakeJiraTargets) Update(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.UpdateOptions) (result *v1alpha1.JiraTarget, err error) { + emptyResult := &v1alpha1.JiraTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(jiratargetsResource, c.ns, jiraTarget), &v1alpha1.JiraTarget{}) + Invokes(testing.NewUpdateActionWithOptions(jiratargetsResource, c.ns, jiraTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JiraTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeJiraTargets) UpdateStatus(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.UpdateOptions) (*v1alpha1.JiraTarget, error) { +func (c *FakeJiraTargets) UpdateStatus(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.UpdateOptions) (result *v1alpha1.JiraTarget, err error) { + emptyResult := &v1alpha1.JiraTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(jiratargetsResource, "status", c.ns, jiraTarget), &v1alpha1.JiraTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(jiratargetsResource, "status", c.ns, jiraTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JiraTarget), err } @@ -107,7 +112,7 @@ func (c *FakeJiraTargets) Delete(ctx context.Context, name string, opts v1.Delet // DeleteCollection deletes a collection of objects. func (c *FakeJiraTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(jiratargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(jiratargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.JiraTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeJiraTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOp // Patch applies the patch and returns the patched jiraTarget. func (c *FakeJiraTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.JiraTarget, err error) { + emptyResult := &v1alpha1.JiraTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(jiratargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.JiraTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(jiratargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.JiraTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_kafkatarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_kafkatarget.go index 92442ecc..8f65cbf7 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_kafkatarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_kafkatarget.go @@ -25,22 +25,24 @@ var kafkatargetsKind = v1alpha1.SchemeGroupVersion.WithKind("KafkaTarget") // Get takes name of the kafkaTarget, and returns the corresponding kafkaTarget object, and an error if there is any. func (c *FakeKafkaTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KafkaTarget, err error) { + emptyResult := &v1alpha1.KafkaTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(kafkatargetsResource, c.ns, name), &v1alpha1.KafkaTarget{}) + Invokes(testing.NewGetActionWithOptions(kafkatargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaTarget), err } // List takes label and field selectors, and returns the list of KafkaTargets that match those selectors. func (c *FakeKafkaTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KafkaTargetList, err error) { + emptyResult := &v1alpha1.KafkaTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(kafkatargetsResource, kafkatargetsKind, c.ns, opts), &v1alpha1.KafkaTargetList{}) + Invokes(testing.NewListActionWithOptions(kafkatargetsResource, kafkatargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeKafkaTargets) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested kafkaTargets. func (c *FakeKafkaTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(kafkatargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(kafkatargetsResource, c.ns, opts)) } // Create takes the representation of a kafkaTarget and creates it. Returns the server's representation of the kafkaTarget, and an error, if there is any. func (c *FakeKafkaTargets) Create(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.CreateOptions) (result *v1alpha1.KafkaTarget, err error) { + emptyResult := &v1alpha1.KafkaTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(kafkatargetsResource, c.ns, kafkaTarget), &v1alpha1.KafkaTarget{}) + Invokes(testing.NewCreateActionWithOptions(kafkatargetsResource, c.ns, kafkaTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaTarget), err } // Update takes the representation of a kafkaTarget and updates it. Returns the server's representation of the kafkaTarget, and an error, if there is any. func (c *FakeKafkaTargets) Update(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.UpdateOptions) (result *v1alpha1.KafkaTarget, err error) { + emptyResult := &v1alpha1.KafkaTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(kafkatargetsResource, c.ns, kafkaTarget), &v1alpha1.KafkaTarget{}) + Invokes(testing.NewUpdateActionWithOptions(kafkatargetsResource, c.ns, kafkaTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeKafkaTargets) UpdateStatus(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.UpdateOptions) (*v1alpha1.KafkaTarget, error) { +func (c *FakeKafkaTargets) UpdateStatus(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.UpdateOptions) (result *v1alpha1.KafkaTarget, err error) { + emptyResult := &v1alpha1.KafkaTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(kafkatargetsResource, "status", c.ns, kafkaTarget), &v1alpha1.KafkaTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(kafkatargetsResource, "status", c.ns, kafkaTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaTarget), err } @@ -107,7 +112,7 @@ func (c *FakeKafkaTargets) Delete(ctx context.Context, name string, opts v1.Dele // DeleteCollection deletes a collection of objects. func (c *FakeKafkaTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(kafkatargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(kafkatargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.KafkaTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeKafkaTargets) DeleteCollection(ctx context.Context, opts v1.DeleteO // Patch applies the patch and returns the patched kafkaTarget. func (c *FakeKafkaTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KafkaTarget, err error) { + emptyResult := &v1alpha1.KafkaTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(kafkatargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.KafkaTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(kafkatargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.KafkaTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_logzmetricstarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_logzmetricstarget.go index a7ed6b8f..9a6e01bf 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_logzmetricstarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_logzmetricstarget.go @@ -25,22 +25,24 @@ var logzmetricstargetsKind = v1alpha1.SchemeGroupVersion.WithKind("LogzMetricsTa // Get takes name of the logzMetricsTarget, and returns the corresponding logzMetricsTarget object, and an error if there is any. func (c *FakeLogzMetricsTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LogzMetricsTarget, err error) { + emptyResult := &v1alpha1.LogzMetricsTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(logzmetricstargetsResource, c.ns, name), &v1alpha1.LogzMetricsTarget{}) + Invokes(testing.NewGetActionWithOptions(logzmetricstargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzMetricsTarget), err } // List takes label and field selectors, and returns the list of LogzMetricsTargets that match those selectors. func (c *FakeLogzMetricsTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LogzMetricsTargetList, err error) { + emptyResult := &v1alpha1.LogzMetricsTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(logzmetricstargetsResource, logzmetricstargetsKind, c.ns, opts), &v1alpha1.LogzMetricsTargetList{}) + Invokes(testing.NewListActionWithOptions(logzmetricstargetsResource, logzmetricstargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeLogzMetricsTargets) List(ctx context.Context, opts v1.ListOptions) // Watch returns a watch.Interface that watches the requested logzMetricsTargets. func (c *FakeLogzMetricsTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(logzmetricstargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(logzmetricstargetsResource, c.ns, opts)) } // Create takes the representation of a logzMetricsTarget and creates it. Returns the server's representation of the logzMetricsTarget, and an error, if there is any. func (c *FakeLogzMetricsTargets) Create(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.CreateOptions) (result *v1alpha1.LogzMetricsTarget, err error) { + emptyResult := &v1alpha1.LogzMetricsTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(logzmetricstargetsResource, c.ns, logzMetricsTarget), &v1alpha1.LogzMetricsTarget{}) + Invokes(testing.NewCreateActionWithOptions(logzmetricstargetsResource, c.ns, logzMetricsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzMetricsTarget), err } // Update takes the representation of a logzMetricsTarget and updates it. Returns the server's representation of the logzMetricsTarget, and an error, if there is any. func (c *FakeLogzMetricsTargets) Update(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.UpdateOptions) (result *v1alpha1.LogzMetricsTarget, err error) { + emptyResult := &v1alpha1.LogzMetricsTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(logzmetricstargetsResource, c.ns, logzMetricsTarget), &v1alpha1.LogzMetricsTarget{}) + Invokes(testing.NewUpdateActionWithOptions(logzmetricstargetsResource, c.ns, logzMetricsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzMetricsTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeLogzMetricsTargets) UpdateStatus(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.UpdateOptions) (*v1alpha1.LogzMetricsTarget, error) { +func (c *FakeLogzMetricsTargets) UpdateStatus(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.UpdateOptions) (result *v1alpha1.LogzMetricsTarget, err error) { + emptyResult := &v1alpha1.LogzMetricsTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(logzmetricstargetsResource, "status", c.ns, logzMetricsTarget), &v1alpha1.LogzMetricsTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(logzmetricstargetsResource, "status", c.ns, logzMetricsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzMetricsTarget), err } @@ -107,7 +112,7 @@ func (c *FakeLogzMetricsTargets) Delete(ctx context.Context, name string, opts v // DeleteCollection deletes a collection of objects. func (c *FakeLogzMetricsTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(logzmetricstargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(logzmetricstargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.LogzMetricsTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeLogzMetricsTargets) DeleteCollection(ctx context.Context, opts v1.D // Patch applies the patch and returns the patched logzMetricsTarget. func (c *FakeLogzMetricsTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LogzMetricsTarget, err error) { + emptyResult := &v1alpha1.LogzMetricsTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(logzmetricstargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.LogzMetricsTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(logzmetricstargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzMetricsTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_logztarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_logztarget.go index 31050c2e..bf044dc1 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_logztarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_logztarget.go @@ -25,22 +25,24 @@ var logztargetsKind = v1alpha1.SchemeGroupVersion.WithKind("LogzTarget") // Get takes name of the logzTarget, and returns the corresponding logzTarget object, and an error if there is any. func (c *FakeLogzTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LogzTarget, err error) { + emptyResult := &v1alpha1.LogzTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(logztargetsResource, c.ns, name), &v1alpha1.LogzTarget{}) + Invokes(testing.NewGetActionWithOptions(logztargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzTarget), err } // List takes label and field selectors, and returns the list of LogzTargets that match those selectors. func (c *FakeLogzTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LogzTargetList, err error) { + emptyResult := &v1alpha1.LogzTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(logztargetsResource, logztargetsKind, c.ns, opts), &v1alpha1.LogzTargetList{}) + Invokes(testing.NewListActionWithOptions(logztargetsResource, logztargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeLogzTargets) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested logzTargets. func (c *FakeLogzTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(logztargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(logztargetsResource, c.ns, opts)) } // Create takes the representation of a logzTarget and creates it. Returns the server's representation of the logzTarget, and an error, if there is any. func (c *FakeLogzTargets) Create(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.CreateOptions) (result *v1alpha1.LogzTarget, err error) { + emptyResult := &v1alpha1.LogzTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(logztargetsResource, c.ns, logzTarget), &v1alpha1.LogzTarget{}) + Invokes(testing.NewCreateActionWithOptions(logztargetsResource, c.ns, logzTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzTarget), err } // Update takes the representation of a logzTarget and updates it. Returns the server's representation of the logzTarget, and an error, if there is any. func (c *FakeLogzTargets) Update(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.UpdateOptions) (result *v1alpha1.LogzTarget, err error) { + emptyResult := &v1alpha1.LogzTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(logztargetsResource, c.ns, logzTarget), &v1alpha1.LogzTarget{}) + Invokes(testing.NewUpdateActionWithOptions(logztargetsResource, c.ns, logzTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeLogzTargets) UpdateStatus(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.UpdateOptions) (*v1alpha1.LogzTarget, error) { +func (c *FakeLogzTargets) UpdateStatus(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.UpdateOptions) (result *v1alpha1.LogzTarget, err error) { + emptyResult := &v1alpha1.LogzTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(logztargetsResource, "status", c.ns, logzTarget), &v1alpha1.LogzTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(logztargetsResource, "status", c.ns, logzTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzTarget), err } @@ -107,7 +112,7 @@ func (c *FakeLogzTargets) Delete(ctx context.Context, name string, opts v1.Delet // DeleteCollection deletes a collection of objects. func (c *FakeLogzTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(logztargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(logztargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.LogzTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeLogzTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOp // Patch applies the patch and returns the patched logzTarget. func (c *FakeLogzTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LogzTarget, err error) { + emptyResult := &v1alpha1.LogzTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(logztargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.LogzTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(logztargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.LogzTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_natstarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_natstarget.go index 309f1300..0cc5deb3 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_natstarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_natstarget.go @@ -25,22 +25,24 @@ var natstargetsKind = v1alpha1.SchemeGroupVersion.WithKind("NatsTarget") // Get takes name of the natsTarget, and returns the corresponding natsTarget object, and an error if there is any. func (c *FakeNatsTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NatsTarget, err error) { + emptyResult := &v1alpha1.NatsTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(natstargetsResource, c.ns, name), &v1alpha1.NatsTarget{}) + Invokes(testing.NewGetActionWithOptions(natstargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NatsTarget), err } // List takes label and field selectors, and returns the list of NatsTargets that match those selectors. func (c *FakeNatsTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NatsTargetList, err error) { + emptyResult := &v1alpha1.NatsTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(natstargetsResource, natstargetsKind, c.ns, opts), &v1alpha1.NatsTargetList{}) + Invokes(testing.NewListActionWithOptions(natstargetsResource, natstargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeNatsTargets) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested natsTargets. func (c *FakeNatsTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(natstargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(natstargetsResource, c.ns, opts)) } // Create takes the representation of a natsTarget and creates it. Returns the server's representation of the natsTarget, and an error, if there is any. func (c *FakeNatsTargets) Create(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.CreateOptions) (result *v1alpha1.NatsTarget, err error) { + emptyResult := &v1alpha1.NatsTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(natstargetsResource, c.ns, natsTarget), &v1alpha1.NatsTarget{}) + Invokes(testing.NewCreateActionWithOptions(natstargetsResource, c.ns, natsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NatsTarget), err } // Update takes the representation of a natsTarget and updates it. Returns the server's representation of the natsTarget, and an error, if there is any. func (c *FakeNatsTargets) Update(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.UpdateOptions) (result *v1alpha1.NatsTarget, err error) { + emptyResult := &v1alpha1.NatsTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(natstargetsResource, c.ns, natsTarget), &v1alpha1.NatsTarget{}) + Invokes(testing.NewUpdateActionWithOptions(natstargetsResource, c.ns, natsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NatsTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeNatsTargets) UpdateStatus(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.UpdateOptions) (*v1alpha1.NatsTarget, error) { +func (c *FakeNatsTargets) UpdateStatus(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.UpdateOptions) (result *v1alpha1.NatsTarget, err error) { + emptyResult := &v1alpha1.NatsTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(natstargetsResource, "status", c.ns, natsTarget), &v1alpha1.NatsTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(natstargetsResource, "status", c.ns, natsTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NatsTarget), err } @@ -107,7 +112,7 @@ func (c *FakeNatsTargets) Delete(ctx context.Context, name string, opts v1.Delet // DeleteCollection deletes a collection of objects. func (c *FakeNatsTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(natstargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(natstargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.NatsTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeNatsTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOp // Patch applies the patch and returns the patched natsTarget. func (c *FakeNatsTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NatsTarget, err error) { + emptyResult := &v1alpha1.NatsTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(natstargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.NatsTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(natstargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NatsTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_salesforcetarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_salesforcetarget.go index 9559704d..b079c7c7 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_salesforcetarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_salesforcetarget.go @@ -25,22 +25,24 @@ var salesforcetargetsKind = v1alpha1.SchemeGroupVersion.WithKind("SalesforceTarg // Get takes name of the salesforceTarget, and returns the corresponding salesforceTarget object, and an error if there is any. func (c *FakeSalesforceTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SalesforceTarget, err error) { + emptyResult := &v1alpha1.SalesforceTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(salesforcetargetsResource, c.ns, name), &v1alpha1.SalesforceTarget{}) + Invokes(testing.NewGetActionWithOptions(salesforcetargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceTarget), err } // List takes label and field selectors, and returns the list of SalesforceTargets that match those selectors. func (c *FakeSalesforceTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SalesforceTargetList, err error) { + emptyResult := &v1alpha1.SalesforceTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(salesforcetargetsResource, salesforcetargetsKind, c.ns, opts), &v1alpha1.SalesforceTargetList{}) + Invokes(testing.NewListActionWithOptions(salesforcetargetsResource, salesforcetargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeSalesforceTargets) List(ctx context.Context, opts v1.ListOptions) ( // Watch returns a watch.Interface that watches the requested salesforceTargets. func (c *FakeSalesforceTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(salesforcetargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(salesforcetargetsResource, c.ns, opts)) } // Create takes the representation of a salesforceTarget and creates it. Returns the server's representation of the salesforceTarget, and an error, if there is any. func (c *FakeSalesforceTargets) Create(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.CreateOptions) (result *v1alpha1.SalesforceTarget, err error) { + emptyResult := &v1alpha1.SalesforceTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(salesforcetargetsResource, c.ns, salesforceTarget), &v1alpha1.SalesforceTarget{}) + Invokes(testing.NewCreateActionWithOptions(salesforcetargetsResource, c.ns, salesforceTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceTarget), err } // Update takes the representation of a salesforceTarget and updates it. Returns the server's representation of the salesforceTarget, and an error, if there is any. func (c *FakeSalesforceTargets) Update(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.UpdateOptions) (result *v1alpha1.SalesforceTarget, err error) { + emptyResult := &v1alpha1.SalesforceTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(salesforcetargetsResource, c.ns, salesforceTarget), &v1alpha1.SalesforceTarget{}) + Invokes(testing.NewUpdateActionWithOptions(salesforcetargetsResource, c.ns, salesforceTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSalesforceTargets) UpdateStatus(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.UpdateOptions) (*v1alpha1.SalesforceTarget, error) { +func (c *FakeSalesforceTargets) UpdateStatus(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.UpdateOptions) (result *v1alpha1.SalesforceTarget, err error) { + emptyResult := &v1alpha1.SalesforceTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(salesforcetargetsResource, "status", c.ns, salesforceTarget), &v1alpha1.SalesforceTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(salesforcetargetsResource, "status", c.ns, salesforceTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceTarget), err } @@ -107,7 +112,7 @@ func (c *FakeSalesforceTargets) Delete(ctx context.Context, name string, opts v1 // DeleteCollection deletes a collection of objects. func (c *FakeSalesforceTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(salesforcetargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(salesforcetargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.SalesforceTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeSalesforceTargets) DeleteCollection(ctx context.Context, opts v1.De // Patch applies the patch and returns the patched salesforceTarget. func (c *FakeSalesforceTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SalesforceTarget, err error) { + emptyResult := &v1alpha1.SalesforceTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(salesforcetargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.SalesforceTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(salesforcetargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SalesforceTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_servicenowtarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_servicenowtarget.go index a5ec3e0a..94e8b6a8 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_servicenowtarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_servicenowtarget.go @@ -25,22 +25,24 @@ var servicenowtargetsKind = v1alpha1.SchemeGroupVersion.WithKind("ServiceNowTarg // Get takes name of the serviceNowTarget, and returns the corresponding serviceNowTarget object, and an error if there is any. func (c *FakeServiceNowTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ServiceNowTarget, err error) { + emptyResult := &v1alpha1.ServiceNowTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(servicenowtargetsResource, c.ns, name), &v1alpha1.ServiceNowTarget{}) + Invokes(testing.NewGetActionWithOptions(servicenowtargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServiceNowTarget), err } // List takes label and field selectors, and returns the list of ServiceNowTargets that match those selectors. func (c *FakeServiceNowTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ServiceNowTargetList, err error) { + emptyResult := &v1alpha1.ServiceNowTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(servicenowtargetsResource, servicenowtargetsKind, c.ns, opts), &v1alpha1.ServiceNowTargetList{}) + Invokes(testing.NewListActionWithOptions(servicenowtargetsResource, servicenowtargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeServiceNowTargets) List(ctx context.Context, opts v1.ListOptions) ( // Watch returns a watch.Interface that watches the requested serviceNowTargets. func (c *FakeServiceNowTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(servicenowtargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(servicenowtargetsResource, c.ns, opts)) } // Create takes the representation of a serviceNowTarget and creates it. Returns the server's representation of the serviceNowTarget, and an error, if there is any. func (c *FakeServiceNowTargets) Create(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.CreateOptions) (result *v1alpha1.ServiceNowTarget, err error) { + emptyResult := &v1alpha1.ServiceNowTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(servicenowtargetsResource, c.ns, serviceNowTarget), &v1alpha1.ServiceNowTarget{}) + Invokes(testing.NewCreateActionWithOptions(servicenowtargetsResource, c.ns, serviceNowTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServiceNowTarget), err } // Update takes the representation of a serviceNowTarget and updates it. Returns the server's representation of the serviceNowTarget, and an error, if there is any. func (c *FakeServiceNowTargets) Update(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.UpdateOptions) (result *v1alpha1.ServiceNowTarget, err error) { + emptyResult := &v1alpha1.ServiceNowTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(servicenowtargetsResource, c.ns, serviceNowTarget), &v1alpha1.ServiceNowTarget{}) + Invokes(testing.NewUpdateActionWithOptions(servicenowtargetsResource, c.ns, serviceNowTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServiceNowTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeServiceNowTargets) UpdateStatus(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.UpdateOptions) (*v1alpha1.ServiceNowTarget, error) { +func (c *FakeServiceNowTargets) UpdateStatus(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.UpdateOptions) (result *v1alpha1.ServiceNowTarget, err error) { + emptyResult := &v1alpha1.ServiceNowTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(servicenowtargetsResource, "status", c.ns, serviceNowTarget), &v1alpha1.ServiceNowTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(servicenowtargetsResource, "status", c.ns, serviceNowTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServiceNowTarget), err } @@ -107,7 +112,7 @@ func (c *FakeServiceNowTargets) Delete(ctx context.Context, name string, opts v1 // DeleteCollection deletes a collection of objects. func (c *FakeServiceNowTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(servicenowtargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(servicenowtargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ServiceNowTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeServiceNowTargets) DeleteCollection(ctx context.Context, opts v1.De // Patch applies the patch and returns the patched serviceNowTarget. func (c *FakeServiceNowTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServiceNowTarget, err error) { + emptyResult := &v1alpha1.ServiceNowTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(servicenowtargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ServiceNowTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(servicenowtargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ServiceNowTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_splunktarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_splunktarget.go index 53c28fb5..57723bce 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_splunktarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/fake/fake_splunktarget.go @@ -25,22 +25,24 @@ var splunktargetsKind = v1alpha1.SchemeGroupVersion.WithKind("SplunkTarget") // Get takes name of the splunkTarget, and returns the corresponding splunkTarget object, and an error if there is any. func (c *FakeSplunkTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SplunkTarget, err error) { + emptyResult := &v1alpha1.SplunkTarget{} obj, err := c.Fake. - Invokes(testing.NewGetAction(splunktargetsResource, c.ns, name), &v1alpha1.SplunkTarget{}) + Invokes(testing.NewGetActionWithOptions(splunktargetsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SplunkTarget), err } // List takes label and field selectors, and returns the list of SplunkTargets that match those selectors. func (c *FakeSplunkTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SplunkTargetList, err error) { + emptyResult := &v1alpha1.SplunkTargetList{} obj, err := c.Fake. - Invokes(testing.NewListAction(splunktargetsResource, splunktargetsKind, c.ns, opts), &v1alpha1.SplunkTargetList{}) + Invokes(testing.NewListActionWithOptions(splunktargetsResource, splunktargetsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -59,40 +61,43 @@ func (c *FakeSplunkTargets) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested splunkTargets. func (c *FakeSplunkTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(splunktargetsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(splunktargetsResource, c.ns, opts)) } // Create takes the representation of a splunkTarget and creates it. Returns the server's representation of the splunkTarget, and an error, if there is any. func (c *FakeSplunkTargets) Create(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.CreateOptions) (result *v1alpha1.SplunkTarget, err error) { + emptyResult := &v1alpha1.SplunkTarget{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(splunktargetsResource, c.ns, splunkTarget), &v1alpha1.SplunkTarget{}) + Invokes(testing.NewCreateActionWithOptions(splunktargetsResource, c.ns, splunkTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SplunkTarget), err } // Update takes the representation of a splunkTarget and updates it. Returns the server's representation of the splunkTarget, and an error, if there is any. func (c *FakeSplunkTargets) Update(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.UpdateOptions) (result *v1alpha1.SplunkTarget, err error) { + emptyResult := &v1alpha1.SplunkTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(splunktargetsResource, c.ns, splunkTarget), &v1alpha1.SplunkTarget{}) + Invokes(testing.NewUpdateActionWithOptions(splunktargetsResource, c.ns, splunkTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SplunkTarget), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSplunkTargets) UpdateStatus(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.UpdateOptions) (*v1alpha1.SplunkTarget, error) { +func (c *FakeSplunkTargets) UpdateStatus(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.UpdateOptions) (result *v1alpha1.SplunkTarget, err error) { + emptyResult := &v1alpha1.SplunkTarget{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(splunktargetsResource, "status", c.ns, splunkTarget), &v1alpha1.SplunkTarget{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(splunktargetsResource, "status", c.ns, splunkTarget, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SplunkTarget), err } @@ -107,7 +112,7 @@ func (c *FakeSplunkTargets) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeSplunkTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(splunktargetsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(splunktargetsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.SplunkTargetList{}) return err @@ -115,11 +120,12 @@ func (c *FakeSplunkTargets) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched splunkTarget. func (c *FakeSplunkTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SplunkTarget, err error) { + emptyResult := &v1alpha1.SplunkTarget{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(splunktargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.SplunkTarget{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(splunktargetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.SplunkTarget), err } diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/httptarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/httptarget.go index fa3e3c0e..f429fd17 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/httptarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/httptarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // HTTPTargetsGetter has a method to return a HTTPTargetInterface. @@ -24,6 +23,7 @@ type HTTPTargetsGetter interface { type HTTPTargetInterface interface { Create(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.CreateOptions) (*v1alpha1.HTTPTarget, error) Update(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.UpdateOptions) (*v1alpha1.HTTPTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.UpdateOptions) (*v1alpha1.HTTPTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type HTTPTargetInterface interface { // hTTPTargets implements HTTPTargetInterface type hTTPTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.HTTPTarget, *v1alpha1.HTTPTargetList] } // newHTTPTargets returns a HTTPTargets func newHTTPTargets(c *TargetsV1alpha1Client, namespace string) *hTTPTargets { return &hTTPTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.HTTPTarget, *v1alpha1.HTTPTargetList]( + "httptargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.HTTPTarget { return &v1alpha1.HTTPTarget{} }, + func() *v1alpha1.HTTPTargetList { return &v1alpha1.HTTPTargetList{} }), } } - -// Get takes name of the hTTPTarget, and returns the corresponding hTTPTarget object, and an error if there is any. -func (c *hTTPTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.HTTPTarget, err error) { - result = &v1alpha1.HTTPTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httptargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of HTTPTargets that match those selectors. -func (c *hTTPTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.HTTPTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.HTTPTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("httptargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested hTTPTargets. -func (c *hTTPTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("httptargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a hTTPTarget and creates it. Returns the server's representation of the hTTPTarget, and an error, if there is any. -func (c *hTTPTargets) Create(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.CreateOptions) (result *v1alpha1.HTTPTarget, err error) { - result = &v1alpha1.HTTPTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("httptargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a hTTPTarget and updates it. Returns the server's representation of the hTTPTarget, and an error, if there is any. -func (c *hTTPTargets) Update(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.UpdateOptions) (result *v1alpha1.HTTPTarget, err error) { - result = &v1alpha1.HTTPTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httptargets"). - Name(hTTPTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *hTTPTargets) UpdateStatus(ctx context.Context, hTTPTarget *v1alpha1.HTTPTarget, opts v1.UpdateOptions) (result *v1alpha1.HTTPTarget, err error) { - result = &v1alpha1.HTTPTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("httptargets"). - Name(hTTPTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(hTTPTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the hTTPTarget and deletes it. Returns an error if one occurs. -func (c *hTTPTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("httptargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *hTTPTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("httptargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched hTTPTarget. -func (c *hTTPTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.HTTPTarget, err error) { - result = &v1alpha1.HTTPTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("httptargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/jiratarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/jiratarget.go index d51d92bd..747f9cef 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/jiratarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/jiratarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // JiraTargetsGetter has a method to return a JiraTargetInterface. @@ -24,6 +23,7 @@ type JiraTargetsGetter interface { type JiraTargetInterface interface { Create(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.CreateOptions) (*v1alpha1.JiraTarget, error) Update(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.UpdateOptions) (*v1alpha1.JiraTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.UpdateOptions) (*v1alpha1.JiraTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type JiraTargetInterface interface { // jiraTargets implements JiraTargetInterface type jiraTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.JiraTarget, *v1alpha1.JiraTargetList] } // newJiraTargets returns a JiraTargets func newJiraTargets(c *TargetsV1alpha1Client, namespace string) *jiraTargets { return &jiraTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.JiraTarget, *v1alpha1.JiraTargetList]( + "jiratargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.JiraTarget { return &v1alpha1.JiraTarget{} }, + func() *v1alpha1.JiraTargetList { return &v1alpha1.JiraTargetList{} }), } } - -// Get takes name of the jiraTarget, and returns the corresponding jiraTarget object, and an error if there is any. -func (c *jiraTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.JiraTarget, err error) { - result = &v1alpha1.JiraTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("jiratargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of JiraTargets that match those selectors. -func (c *jiraTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.JiraTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.JiraTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("jiratargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested jiraTargets. -func (c *jiraTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("jiratargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a jiraTarget and creates it. Returns the server's representation of the jiraTarget, and an error, if there is any. -func (c *jiraTargets) Create(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.CreateOptions) (result *v1alpha1.JiraTarget, err error) { - result = &v1alpha1.JiraTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("jiratargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jiraTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a jiraTarget and updates it. Returns the server's representation of the jiraTarget, and an error, if there is any. -func (c *jiraTargets) Update(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.UpdateOptions) (result *v1alpha1.JiraTarget, err error) { - result = &v1alpha1.JiraTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("jiratargets"). - Name(jiraTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jiraTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *jiraTargets) UpdateStatus(ctx context.Context, jiraTarget *v1alpha1.JiraTarget, opts v1.UpdateOptions) (result *v1alpha1.JiraTarget, err error) { - result = &v1alpha1.JiraTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("jiratargets"). - Name(jiraTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(jiraTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the jiraTarget and deletes it. Returns an error if one occurs. -func (c *jiraTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("jiratargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *jiraTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("jiratargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched jiraTarget. -func (c *jiraTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.JiraTarget, err error) { - result = &v1alpha1.JiraTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("jiratargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/kafkatarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/kafkatarget.go index c9de08b4..bc2221a3 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/kafkatarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/kafkatarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // KafkaTargetsGetter has a method to return a KafkaTargetInterface. @@ -24,6 +23,7 @@ type KafkaTargetsGetter interface { type KafkaTargetInterface interface { Create(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.CreateOptions) (*v1alpha1.KafkaTarget, error) Update(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.UpdateOptions) (*v1alpha1.KafkaTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.UpdateOptions) (*v1alpha1.KafkaTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type KafkaTargetInterface interface { // kafkaTargets implements KafkaTargetInterface type kafkaTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.KafkaTarget, *v1alpha1.KafkaTargetList] } // newKafkaTargets returns a KafkaTargets func newKafkaTargets(c *TargetsV1alpha1Client, namespace string) *kafkaTargets { return &kafkaTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.KafkaTarget, *v1alpha1.KafkaTargetList]( + "kafkatargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.KafkaTarget { return &v1alpha1.KafkaTarget{} }, + func() *v1alpha1.KafkaTargetList { return &v1alpha1.KafkaTargetList{} }), } } - -// Get takes name of the kafkaTarget, and returns the corresponding kafkaTarget object, and an error if there is any. -func (c *kafkaTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KafkaTarget, err error) { - result = &v1alpha1.KafkaTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("kafkatargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of KafkaTargets that match those selectors. -func (c *kafkaTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KafkaTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.KafkaTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("kafkatargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested kafkaTargets. -func (c *kafkaTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("kafkatargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a kafkaTarget and creates it. Returns the server's representation of the kafkaTarget, and an error, if there is any. -func (c *kafkaTargets) Create(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.CreateOptions) (result *v1alpha1.KafkaTarget, err error) { - result = &v1alpha1.KafkaTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("kafkatargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(kafkaTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a kafkaTarget and updates it. Returns the server's representation of the kafkaTarget, and an error, if there is any. -func (c *kafkaTargets) Update(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.UpdateOptions) (result *v1alpha1.KafkaTarget, err error) { - result = &v1alpha1.KafkaTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("kafkatargets"). - Name(kafkaTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(kafkaTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *kafkaTargets) UpdateStatus(ctx context.Context, kafkaTarget *v1alpha1.KafkaTarget, opts v1.UpdateOptions) (result *v1alpha1.KafkaTarget, err error) { - result = &v1alpha1.KafkaTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("kafkatargets"). - Name(kafkaTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(kafkaTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the kafkaTarget and deletes it. Returns an error if one occurs. -func (c *kafkaTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("kafkatargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *kafkaTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("kafkatargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched kafkaTarget. -func (c *kafkaTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KafkaTarget, err error) { - result = &v1alpha1.KafkaTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("kafkatargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/logzmetricstarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/logzmetricstarget.go index 4d450446..60186a05 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/logzmetricstarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/logzmetricstarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // LogzMetricsTargetsGetter has a method to return a LogzMetricsTargetInterface. @@ -24,6 +23,7 @@ type LogzMetricsTargetsGetter interface { type LogzMetricsTargetInterface interface { Create(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.CreateOptions) (*v1alpha1.LogzMetricsTarget, error) Update(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.UpdateOptions) (*v1alpha1.LogzMetricsTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.UpdateOptions) (*v1alpha1.LogzMetricsTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type LogzMetricsTargetInterface interface { // logzMetricsTargets implements LogzMetricsTargetInterface type logzMetricsTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.LogzMetricsTarget, *v1alpha1.LogzMetricsTargetList] } // newLogzMetricsTargets returns a LogzMetricsTargets func newLogzMetricsTargets(c *TargetsV1alpha1Client, namespace string) *logzMetricsTargets { return &logzMetricsTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.LogzMetricsTarget, *v1alpha1.LogzMetricsTargetList]( + "logzmetricstargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.LogzMetricsTarget { return &v1alpha1.LogzMetricsTarget{} }, + func() *v1alpha1.LogzMetricsTargetList { return &v1alpha1.LogzMetricsTargetList{} }), } } - -// Get takes name of the logzMetricsTarget, and returns the corresponding logzMetricsTarget object, and an error if there is any. -func (c *logzMetricsTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LogzMetricsTarget, err error) { - result = &v1alpha1.LogzMetricsTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("logzmetricstargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of LogzMetricsTargets that match those selectors. -func (c *logzMetricsTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LogzMetricsTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.LogzMetricsTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("logzmetricstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested logzMetricsTargets. -func (c *logzMetricsTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("logzmetricstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a logzMetricsTarget and creates it. Returns the server's representation of the logzMetricsTarget, and an error, if there is any. -func (c *logzMetricsTargets) Create(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.CreateOptions) (result *v1alpha1.LogzMetricsTarget, err error) { - result = &v1alpha1.LogzMetricsTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("logzmetricstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(logzMetricsTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a logzMetricsTarget and updates it. Returns the server's representation of the logzMetricsTarget, and an error, if there is any. -func (c *logzMetricsTargets) Update(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.UpdateOptions) (result *v1alpha1.LogzMetricsTarget, err error) { - result = &v1alpha1.LogzMetricsTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("logzmetricstargets"). - Name(logzMetricsTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(logzMetricsTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *logzMetricsTargets) UpdateStatus(ctx context.Context, logzMetricsTarget *v1alpha1.LogzMetricsTarget, opts v1.UpdateOptions) (result *v1alpha1.LogzMetricsTarget, err error) { - result = &v1alpha1.LogzMetricsTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("logzmetricstargets"). - Name(logzMetricsTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(logzMetricsTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the logzMetricsTarget and deletes it. Returns an error if one occurs. -func (c *logzMetricsTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("logzmetricstargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *logzMetricsTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("logzmetricstargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched logzMetricsTarget. -func (c *logzMetricsTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LogzMetricsTarget, err error) { - result = &v1alpha1.LogzMetricsTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("logzmetricstargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/logztarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/logztarget.go index 69d99b63..9d4d538d 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/logztarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/logztarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // LogzTargetsGetter has a method to return a LogzTargetInterface. @@ -24,6 +23,7 @@ type LogzTargetsGetter interface { type LogzTargetInterface interface { Create(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.CreateOptions) (*v1alpha1.LogzTarget, error) Update(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.UpdateOptions) (*v1alpha1.LogzTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.UpdateOptions) (*v1alpha1.LogzTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type LogzTargetInterface interface { // logzTargets implements LogzTargetInterface type logzTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.LogzTarget, *v1alpha1.LogzTargetList] } // newLogzTargets returns a LogzTargets func newLogzTargets(c *TargetsV1alpha1Client, namespace string) *logzTargets { return &logzTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.LogzTarget, *v1alpha1.LogzTargetList]( + "logztargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.LogzTarget { return &v1alpha1.LogzTarget{} }, + func() *v1alpha1.LogzTargetList { return &v1alpha1.LogzTargetList{} }), } } - -// Get takes name of the logzTarget, and returns the corresponding logzTarget object, and an error if there is any. -func (c *logzTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LogzTarget, err error) { - result = &v1alpha1.LogzTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("logztargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of LogzTargets that match those selectors. -func (c *logzTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LogzTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.LogzTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("logztargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested logzTargets. -func (c *logzTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("logztargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a logzTarget and creates it. Returns the server's representation of the logzTarget, and an error, if there is any. -func (c *logzTargets) Create(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.CreateOptions) (result *v1alpha1.LogzTarget, err error) { - result = &v1alpha1.LogzTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("logztargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(logzTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a logzTarget and updates it. Returns the server's representation of the logzTarget, and an error, if there is any. -func (c *logzTargets) Update(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.UpdateOptions) (result *v1alpha1.LogzTarget, err error) { - result = &v1alpha1.LogzTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("logztargets"). - Name(logzTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(logzTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *logzTargets) UpdateStatus(ctx context.Context, logzTarget *v1alpha1.LogzTarget, opts v1.UpdateOptions) (result *v1alpha1.LogzTarget, err error) { - result = &v1alpha1.LogzTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("logztargets"). - Name(logzTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(logzTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the logzTarget and deletes it. Returns an error if one occurs. -func (c *logzTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("logztargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *logzTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("logztargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched logzTarget. -func (c *logzTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LogzTarget, err error) { - result = &v1alpha1.LogzTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("logztargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/natstarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/natstarget.go index c56103d0..25240664 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/natstarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/natstarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // NatsTargetsGetter has a method to return a NatsTargetInterface. @@ -24,6 +23,7 @@ type NatsTargetsGetter interface { type NatsTargetInterface interface { Create(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.CreateOptions) (*v1alpha1.NatsTarget, error) Update(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.UpdateOptions) (*v1alpha1.NatsTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.UpdateOptions) (*v1alpha1.NatsTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type NatsTargetInterface interface { // natsTargets implements NatsTargetInterface type natsTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.NatsTarget, *v1alpha1.NatsTargetList] } // newNatsTargets returns a NatsTargets func newNatsTargets(c *TargetsV1alpha1Client, namespace string) *natsTargets { return &natsTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.NatsTarget, *v1alpha1.NatsTargetList]( + "natstargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.NatsTarget { return &v1alpha1.NatsTarget{} }, + func() *v1alpha1.NatsTargetList { return &v1alpha1.NatsTargetList{} }), } } - -// Get takes name of the natsTarget, and returns the corresponding natsTarget object, and an error if there is any. -func (c *natsTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NatsTarget, err error) { - result = &v1alpha1.NatsTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("natstargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NatsTargets that match those selectors. -func (c *natsTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NatsTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NatsTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("natstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested natsTargets. -func (c *natsTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("natstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a natsTarget and creates it. Returns the server's representation of the natsTarget, and an error, if there is any. -func (c *natsTargets) Create(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.CreateOptions) (result *v1alpha1.NatsTarget, err error) { - result = &v1alpha1.NatsTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("natstargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(natsTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a natsTarget and updates it. Returns the server's representation of the natsTarget, and an error, if there is any. -func (c *natsTargets) Update(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.UpdateOptions) (result *v1alpha1.NatsTarget, err error) { - result = &v1alpha1.NatsTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("natstargets"). - Name(natsTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(natsTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *natsTargets) UpdateStatus(ctx context.Context, natsTarget *v1alpha1.NatsTarget, opts v1.UpdateOptions) (result *v1alpha1.NatsTarget, err error) { - result = &v1alpha1.NatsTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("natstargets"). - Name(natsTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(natsTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the natsTarget and deletes it. Returns an error if one occurs. -func (c *natsTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("natstargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *natsTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("natstargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched natsTarget. -func (c *natsTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NatsTarget, err error) { - result = &v1alpha1.NatsTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("natstargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/salesforcetarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/salesforcetarget.go index 4a0e828e..d37d57d7 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/salesforcetarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/salesforcetarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // SalesforceTargetsGetter has a method to return a SalesforceTargetInterface. @@ -24,6 +23,7 @@ type SalesforceTargetsGetter interface { type SalesforceTargetInterface interface { Create(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.CreateOptions) (*v1alpha1.SalesforceTarget, error) Update(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.UpdateOptions) (*v1alpha1.SalesforceTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.UpdateOptions) (*v1alpha1.SalesforceTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type SalesforceTargetInterface interface { // salesforceTargets implements SalesforceTargetInterface type salesforceTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.SalesforceTarget, *v1alpha1.SalesforceTargetList] } // newSalesforceTargets returns a SalesforceTargets func newSalesforceTargets(c *TargetsV1alpha1Client, namespace string) *salesforceTargets { return &salesforceTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.SalesforceTarget, *v1alpha1.SalesforceTargetList]( + "salesforcetargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.SalesforceTarget { return &v1alpha1.SalesforceTarget{} }, + func() *v1alpha1.SalesforceTargetList { return &v1alpha1.SalesforceTargetList{} }), } } - -// Get takes name of the salesforceTarget, and returns the corresponding salesforceTarget object, and an error if there is any. -func (c *salesforceTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SalesforceTarget, err error) { - result = &v1alpha1.SalesforceTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("salesforcetargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SalesforceTargets that match those selectors. -func (c *salesforceTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SalesforceTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.SalesforceTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("salesforcetargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested salesforceTargets. -func (c *salesforceTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("salesforcetargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a salesforceTarget and creates it. Returns the server's representation of the salesforceTarget, and an error, if there is any. -func (c *salesforceTargets) Create(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.CreateOptions) (result *v1alpha1.SalesforceTarget, err error) { - result = &v1alpha1.SalesforceTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("salesforcetargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(salesforceTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a salesforceTarget and updates it. Returns the server's representation of the salesforceTarget, and an error, if there is any. -func (c *salesforceTargets) Update(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.UpdateOptions) (result *v1alpha1.SalesforceTarget, err error) { - result = &v1alpha1.SalesforceTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("salesforcetargets"). - Name(salesforceTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(salesforceTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *salesforceTargets) UpdateStatus(ctx context.Context, salesforceTarget *v1alpha1.SalesforceTarget, opts v1.UpdateOptions) (result *v1alpha1.SalesforceTarget, err error) { - result = &v1alpha1.SalesforceTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("salesforcetargets"). - Name(salesforceTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(salesforceTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the salesforceTarget and deletes it. Returns an error if one occurs. -func (c *salesforceTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("salesforcetargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *salesforceTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("salesforcetargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched salesforceTarget. -func (c *salesforceTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SalesforceTarget, err error) { - result = &v1alpha1.SalesforceTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("salesforcetargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/servicenowtarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/servicenowtarget.go index 65236467..314b060a 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/servicenowtarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/servicenowtarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ServiceNowTargetsGetter has a method to return a ServiceNowTargetInterface. @@ -24,6 +23,7 @@ type ServiceNowTargetsGetter interface { type ServiceNowTargetInterface interface { Create(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.CreateOptions) (*v1alpha1.ServiceNowTarget, error) Update(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.UpdateOptions) (*v1alpha1.ServiceNowTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.UpdateOptions) (*v1alpha1.ServiceNowTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type ServiceNowTargetInterface interface { // serviceNowTargets implements ServiceNowTargetInterface type serviceNowTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.ServiceNowTarget, *v1alpha1.ServiceNowTargetList] } // newServiceNowTargets returns a ServiceNowTargets func newServiceNowTargets(c *TargetsV1alpha1Client, namespace string) *serviceNowTargets { return &serviceNowTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.ServiceNowTarget, *v1alpha1.ServiceNowTargetList]( + "servicenowtargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ServiceNowTarget { return &v1alpha1.ServiceNowTarget{} }, + func() *v1alpha1.ServiceNowTargetList { return &v1alpha1.ServiceNowTargetList{} }), } } - -// Get takes name of the serviceNowTarget, and returns the corresponding serviceNowTarget object, and an error if there is any. -func (c *serviceNowTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ServiceNowTarget, err error) { - result = &v1alpha1.ServiceNowTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("servicenowtargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ServiceNowTargets that match those selectors. -func (c *serviceNowTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ServiceNowTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ServiceNowTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("servicenowtargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested serviceNowTargets. -func (c *serviceNowTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("servicenowtargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a serviceNowTarget and creates it. Returns the server's representation of the serviceNowTarget, and an error, if there is any. -func (c *serviceNowTargets) Create(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.CreateOptions) (result *v1alpha1.ServiceNowTarget, err error) { - result = &v1alpha1.ServiceNowTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("servicenowtargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serviceNowTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a serviceNowTarget and updates it. Returns the server's representation of the serviceNowTarget, and an error, if there is any. -func (c *serviceNowTargets) Update(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.UpdateOptions) (result *v1alpha1.ServiceNowTarget, err error) { - result = &v1alpha1.ServiceNowTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("servicenowtargets"). - Name(serviceNowTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serviceNowTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *serviceNowTargets) UpdateStatus(ctx context.Context, serviceNowTarget *v1alpha1.ServiceNowTarget, opts v1.UpdateOptions) (result *v1alpha1.ServiceNowTarget, err error) { - result = &v1alpha1.ServiceNowTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("servicenowtargets"). - Name(serviceNowTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serviceNowTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the serviceNowTarget and deletes it. Returns an error if one occurs. -func (c *serviceNowTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("servicenowtargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *serviceNowTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("servicenowtargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched serviceNowTarget. -func (c *serviceNowTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServiceNowTarget, err error) { - result = &v1alpha1.ServiceNowTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("servicenowtargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/splunktarget.go b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/splunktarget.go index 899d2b87..4e048c79 100644 --- a/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/splunktarget.go +++ b/pkg/client/generated/clientset/internalclientset/typed/targets/v1alpha1/splunktarget.go @@ -4,14 +4,13 @@ package v1alpha1 import ( "context" - "time" v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" scheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // SplunkTargetsGetter has a method to return a SplunkTargetInterface. @@ -24,6 +23,7 @@ type SplunkTargetsGetter interface { type SplunkTargetInterface interface { Create(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.CreateOptions) (*v1alpha1.SplunkTarget, error) Update(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.UpdateOptions) (*v1alpha1.SplunkTarget, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.UpdateOptions) (*v1alpha1.SplunkTarget, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -36,144 +36,18 @@ type SplunkTargetInterface interface { // splunkTargets implements SplunkTargetInterface type splunkTargets struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.SplunkTarget, *v1alpha1.SplunkTargetList] } // newSplunkTargets returns a SplunkTargets func newSplunkTargets(c *TargetsV1alpha1Client, namespace string) *splunkTargets { return &splunkTargets{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.SplunkTarget, *v1alpha1.SplunkTargetList]( + "splunktargets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.SplunkTarget { return &v1alpha1.SplunkTarget{} }, + func() *v1alpha1.SplunkTargetList { return &v1alpha1.SplunkTargetList{} }), } } - -// Get takes name of the splunkTarget, and returns the corresponding splunkTarget object, and an error if there is any. -func (c *splunkTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SplunkTarget, err error) { - result = &v1alpha1.SplunkTarget{} - err = c.client.Get(). - Namespace(c.ns). - Resource("splunktargets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SplunkTargets that match those selectors. -func (c *splunkTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SplunkTargetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.SplunkTargetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("splunktargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested splunkTargets. -func (c *splunkTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("splunktargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a splunkTarget and creates it. Returns the server's representation of the splunkTarget, and an error, if there is any. -func (c *splunkTargets) Create(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.CreateOptions) (result *v1alpha1.SplunkTarget, err error) { - result = &v1alpha1.SplunkTarget{} - err = c.client.Post(). - Namespace(c.ns). - Resource("splunktargets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(splunkTarget). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a splunkTarget and updates it. Returns the server's representation of the splunkTarget, and an error, if there is any. -func (c *splunkTargets) Update(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.UpdateOptions) (result *v1alpha1.SplunkTarget, err error) { - result = &v1alpha1.SplunkTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("splunktargets"). - Name(splunkTarget.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(splunkTarget). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *splunkTargets) UpdateStatus(ctx context.Context, splunkTarget *v1alpha1.SplunkTarget, opts v1.UpdateOptions) (result *v1alpha1.SplunkTarget, err error) { - result = &v1alpha1.SplunkTarget{} - err = c.client.Put(). - Namespace(c.ns). - Resource("splunktargets"). - Name(splunkTarget.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(splunkTarget). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the splunkTarget and deletes it. Returns an error if one occurs. -func (c *splunkTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("splunktargets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *splunkTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("splunktargets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched splunkTarget. -func (c *splunkTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.SplunkTarget, err error) { - result = &v1alpha1.SplunkTarget{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("splunktargets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/generated/informers/externalversions/factory.go b/pkg/client/generated/informers/externalversions/factory.go index d7daa606..2bd96006 100644 --- a/pkg/client/generated/informers/externalversions/factory.go +++ b/pkg/client/generated/informers/externalversions/factory.go @@ -216,6 +216,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/controller.go b/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/controller.go deleted file mode 100644 index 0478da13..00000000 --- a/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/controller.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by injection-gen. DO NOT EDIT. - -package filter - -import ( - context "context" - fmt "fmt" - reflect "reflect" - strings "strings" - - internalclientsetscheme "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset/scheme" - client "github.com/zeiss/typhoon/pkg/client/generated/injection/client" - filter "github.com/zeiss/typhoon/pkg/client/generated/injection/informers/routing/v1alpha1/filter" - zap "go.uber.org/zap" - corev1 "k8s.io/api/core/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - scheme "k8s.io/client-go/kubernetes/scheme" - v1 "k8s.io/client-go/kubernetes/typed/core/v1" - record "k8s.io/client-go/tools/record" - kubeclient "knative.dev/pkg/client/injection/kube/client" - controller "knative.dev/pkg/controller" - logging "knative.dev/pkg/logging" - logkey "knative.dev/pkg/logging/logkey" - reconciler "knative.dev/pkg/reconciler" -) - -const ( - defaultControllerAgentName = "filter-controller" - defaultFinalizerName = "filters.routing.typhoon.zeiss.com" -) - -// NewImpl returns a controller.Impl that handles queuing and feeding work from -// the queue through an implementation of controller.Reconciler, delegating to -// the provided Interface and optional Finalizer methods. OptionsFn is used to return -// controller.ControllerOptions to be used by the internal reconciler. -func NewImpl(ctx context.Context, r Interface, optionsFns ...controller.OptionsFn) *controller.Impl { - logger := logging.FromContext(ctx) - - // Check the options function input. It should be 0 or 1. - if len(optionsFns) > 1 { - logger.Fatal("Up to one options function is supported, found: ", len(optionsFns)) - } - - filterInformer := filter.Get(ctx) - - lister := filterInformer.Lister() - - var promoteFilterFunc func(obj interface{}) bool - var promoteFunc = func(bkt reconciler.Bucket) {} - - rec := &reconcilerImpl{ - LeaderAwareFuncs: reconciler.LeaderAwareFuncs{ - PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error { - - // Signal promotion event - promoteFunc(bkt) - - all, err := lister.List(labels.Everything()) - if err != nil { - return err - } - for _, elt := range all { - if promoteFilterFunc != nil { - if ok := promoteFilterFunc(elt); !ok { - continue - } - } - enq(bkt, types.NamespacedName{ - Namespace: elt.GetNamespace(), - Name: elt.GetName(), - }) - } - return nil - }, - }, - Client: client.Get(ctx), - Lister: lister, - reconciler: r, - finalizerName: defaultFinalizerName, - } - - ctrType := reflect.TypeOf(r).Elem() - ctrTypeName := fmt.Sprintf("%s.%s", ctrType.PkgPath(), ctrType.Name()) - ctrTypeName = strings.ReplaceAll(ctrTypeName, "/", ".") - - logger = logger.With( - zap.String(logkey.ControllerType, ctrTypeName), - zap.String(logkey.Kind, "routing.typhoon.zeiss.com.Filter"), - ) - - impl := controller.NewContext(ctx, rec, controller.ControllerOptions{WorkQueueName: ctrTypeName, Logger: logger}) - agentName := defaultControllerAgentName - - // Pass impl to the options. Save any optional results. - for _, fn := range optionsFns { - opts := fn(impl) - if opts.ConfigStore != nil { - rec.configStore = opts.ConfigStore - } - if opts.FinalizerName != "" { - rec.finalizerName = opts.FinalizerName - } - if opts.AgentName != "" { - agentName = opts.AgentName - } - if opts.SkipStatusUpdates { - rec.skipStatusUpdates = true - } - if opts.DemoteFunc != nil { - rec.DemoteFunc = opts.DemoteFunc - } - if opts.PromoteFilterFunc != nil { - promoteFilterFunc = opts.PromoteFilterFunc - } - if opts.PromoteFunc != nil { - promoteFunc = opts.PromoteFunc - } - } - - rec.Recorder = createRecorder(ctx, agentName) - - return impl -} - -func createRecorder(ctx context.Context, agentName string) record.EventRecorder { - logger := logging.FromContext(ctx) - - recorder := controller.GetEventRecorder(ctx) - if recorder == nil { - // Create event broadcaster - logger.Debug("Creating event broadcaster") - eventBroadcaster := record.NewBroadcaster() - watches := []watch.Interface{ - eventBroadcaster.StartLogging(logger.Named("event-broadcaster").Infof), - eventBroadcaster.StartRecordingToSink( - &v1.EventSinkImpl{Interface: kubeclient.Get(ctx).CoreV1().Events("")}), - } - recorder = eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: agentName}) - go func() { - <-ctx.Done() - for _, w := range watches { - w.Stop() - } - }() - } - - return recorder -} - -func init() { - internalclientsetscheme.AddToScheme(scheme.Scheme) -} diff --git a/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/reconciler.go b/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/reconciler.go deleted file mode 100644 index 10bc6ff4..00000000 --- a/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/reconciler.go +++ /dev/null @@ -1,424 +0,0 @@ -// Code generated by injection-gen. DO NOT EDIT. - -package filter - -import ( - context "context" - json "encoding/json" - fmt "fmt" - - v1alpha1 "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" - internalclientset "github.com/zeiss/typhoon/pkg/client/generated/clientset/internalclientset" - routingv1alpha1 "github.com/zeiss/typhoon/pkg/client/generated/listers/routing/v1alpha1" - zap "go.uber.org/zap" - "go.uber.org/zap/zapcore" - v1 "k8s.io/api/core/v1" - equality "k8s.io/apimachinery/pkg/api/equality" - errors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - sets "k8s.io/apimachinery/pkg/util/sets" - record "k8s.io/client-go/tools/record" - controller "knative.dev/pkg/controller" - kmp "knative.dev/pkg/kmp" - logging "knative.dev/pkg/logging" - reconciler "knative.dev/pkg/reconciler" -) - -// Interface defines the strongly typed interfaces to be implemented by a -// controller reconciling v1alpha1.Filter. -type Interface interface { - // ReconcileKind implements custom logic to reconcile v1alpha1.Filter. Any changes - // to the objects .Status or .Finalizers will be propagated to the stored - // object. It is recommended that implementors do not call any update calls - // for the Kind inside of ReconcileKind, it is the responsibility of the calling - // controller to propagate those properties. The resource passed to ReconcileKind - // will always have an empty deletion timestamp. - ReconcileKind(ctx context.Context, o *v1alpha1.Filter) reconciler.Event -} - -// Finalizer defines the strongly typed interfaces to be implemented by a -// controller finalizing v1alpha1.Filter. -type Finalizer interface { - // FinalizeKind implements custom logic to finalize v1alpha1.Filter. Any changes - // to the objects .Status or .Finalizers will be ignored. Returning a nil or - // Normal type reconciler.Event will allow the finalizer to be deleted on - // the resource. The resource passed to FinalizeKind will always have a set - // deletion timestamp. - FinalizeKind(ctx context.Context, o *v1alpha1.Filter) reconciler.Event -} - -// ReadOnlyInterface defines the strongly typed interfaces to be implemented by a -// controller reconciling v1alpha1.Filter if they want to process resources for which -// they are not the leader. -type ReadOnlyInterface interface { - // ObserveKind implements logic to observe v1alpha1.Filter. - // This method should not write to the API. - ObserveKind(ctx context.Context, o *v1alpha1.Filter) reconciler.Event -} - -type doReconcile func(ctx context.Context, o *v1alpha1.Filter) reconciler.Event - -// reconcilerImpl implements controller.Reconciler for v1alpha1.Filter resources. -type reconcilerImpl struct { - // LeaderAwareFuncs is inlined to help us implement reconciler.LeaderAware. - reconciler.LeaderAwareFuncs - - // Client is used to write back status updates. - Client internalclientset.Interface - - // Listers index properties about resources. - Lister routingv1alpha1.FilterLister - - // Recorder is an event recorder for recording Event resources to the - // Kubernetes API. - Recorder record.EventRecorder - - // configStore allows for decorating a context with config maps. - // +optional - configStore reconciler.ConfigStore - - // reconciler is the implementation of the business logic of the resource. - reconciler Interface - - // finalizerName is the name of the finalizer to reconcile. - finalizerName string - - // skipStatusUpdates configures whether or not this reconciler automatically updates - // the status of the reconciled resource. - skipStatusUpdates bool -} - -// Check that our Reconciler implements controller.Reconciler. -var _ controller.Reconciler = (*reconcilerImpl)(nil) - -// Check that our generated Reconciler is always LeaderAware. -var _ reconciler.LeaderAware = (*reconcilerImpl)(nil) - -func NewReconciler(ctx context.Context, logger *zap.SugaredLogger, client internalclientset.Interface, lister routingv1alpha1.FilterLister, recorder record.EventRecorder, r Interface, options ...controller.Options) controller.Reconciler { - // Check the options function input. It should be 0 or 1. - if len(options) > 1 { - logger.Fatal("Up to one options struct is supported, found: ", len(options)) - } - - // Fail fast when users inadvertently implement the other LeaderAware interface. - // For the typed reconcilers, Promote shouldn't take any arguments. - if _, ok := r.(reconciler.LeaderAware); ok { - logger.Fatalf("%T implements the incorrect LeaderAware interface. Promote() should not take an argument as genreconciler handles the enqueuing automatically.", r) - } - - rec := &reconcilerImpl{ - LeaderAwareFuncs: reconciler.LeaderAwareFuncs{ - PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error { - all, err := lister.List(labels.Everything()) - if err != nil { - return err - } - for _, elt := range all { - // TODO: Consider letting users specify a filter in options. - enq(bkt, types.NamespacedName{ - Namespace: elt.GetNamespace(), - Name: elt.GetName(), - }) - } - return nil - }, - }, - Client: client, - Lister: lister, - Recorder: recorder, - reconciler: r, - finalizerName: defaultFinalizerName, - } - - for _, opts := range options { - if opts.ConfigStore != nil { - rec.configStore = opts.ConfigStore - } - if opts.FinalizerName != "" { - rec.finalizerName = opts.FinalizerName - } - if opts.SkipStatusUpdates { - rec.skipStatusUpdates = true - } - if opts.DemoteFunc != nil { - rec.DemoteFunc = opts.DemoteFunc - } - } - - return rec -} - -// Reconcile implements controller.Reconciler -func (r *reconcilerImpl) Reconcile(ctx context.Context, key string) error { - logger := logging.FromContext(ctx) - - // Initialize the reconciler state. This will convert the namespace/name - // string into a distinct namespace and name, determine if this instance of - // the reconciler is the leader, and any additional interfaces implemented - // by the reconciler. Returns an error is the resource key is invalid. - s, err := newState(key, r) - if err != nil { - logger.Error("Invalid resource key: ", key) - return nil - } - - // If we are not the leader, and we don't implement either ReadOnly - // observer interfaces, then take a fast-path out. - if s.isNotLeaderNorObserver() { - return controller.NewSkipKey(key) - } - - // If configStore is set, attach the frozen configuration to the context. - if r.configStore != nil { - ctx = r.configStore.ToContext(ctx) - } - - // Add the recorder to context. - ctx = controller.WithEventRecorder(ctx, r.Recorder) - - // Get the resource with this namespace/name. - - getter := r.Lister.Filters(s.namespace) - - original, err := getter.Get(s.name) - - if errors.IsNotFound(err) { - // The resource may no longer exist, in which case we stop processing and call - // the ObserveDeletion handler if appropriate. - logger.Debugf("Resource %q no longer exists", key) - if del, ok := r.reconciler.(reconciler.OnDeletionInterface); ok { - return del.ObserveDeletion(ctx, types.NamespacedName{ - Namespace: s.namespace, - Name: s.name, - }) - } - return nil - } else if err != nil { - return err - } - - // Don't modify the informers copy. - resource := original.DeepCopy() - - var reconcileEvent reconciler.Event - - name, do := s.reconcileMethodFor(resource) - // Append the target method to the logger. - logger = logger.With(zap.String("targetMethod", name)) - switch name { - case reconciler.DoReconcileKind: - // Set and update the finalizer on resource if r.reconciler - // implements Finalizer. - if resource, err = r.setFinalizerIfFinalizer(ctx, resource); err != nil { - return fmt.Errorf("failed to set finalizers: %w", err) - } - - if !r.skipStatusUpdates { - reconciler.PreProcessReconcile(ctx, resource) - } - - // Reconcile this copy of the resource and then write back any status - // updates regardless of whether the reconciliation errored out. - reconcileEvent = do(ctx, resource) - - if !r.skipStatusUpdates { - reconciler.PostProcessReconcile(ctx, resource, original) - } - - case reconciler.DoFinalizeKind: - // For finalizing reconcilers, if this resource being marked for deletion - // and reconciled cleanly (nil or normal event), remove the finalizer. - reconcileEvent = do(ctx, resource) - - if resource, err = r.clearFinalizer(ctx, resource, reconcileEvent); err != nil { - return fmt.Errorf("failed to clear finalizers: %w", err) - } - - case reconciler.DoObserveKind: - // Observe any changes to this resource, since we are not the leader. - reconcileEvent = do(ctx, resource) - - } - - // Synchronize the status. - switch { - case r.skipStatusUpdates: - // This reconciler implementation is configured to skip resource updates. - // This may mean this reconciler does not observe spec, but reconciles external changes. - case equality.Semantic.DeepEqual(original.Status, resource.Status): - // If we didn't change anything then don't call updateStatus. - // This is important because the copy we loaded from the injectionInformer's - // cache may be stale and we don't want to overwrite a prior update - // to status with this stale state. - case !s.isLeader: - // High-availability reconcilers may have many replicas watching the resource, but only - // the elected leader is expected to write modifications. - logger.Warn("Saw status changes when we aren't the leader!") - default: - if err = r.updateStatus(ctx, logger, original, resource); err != nil { - logger.Warnw("Failed to update resource status", zap.Error(err)) - r.Recorder.Eventf(resource, v1.EventTypeWarning, "UpdateFailed", - "Failed to update status for %q: %v", resource.Name, err) - return err - } - } - - // Report the reconciler event, if any. - if reconcileEvent != nil { - var event *reconciler.ReconcilerEvent - if reconciler.EventAs(reconcileEvent, &event) { - logger.Infow("Returned an event", zap.Any("event", reconcileEvent)) - r.Recorder.Event(resource, event.EventType, event.Reason, event.Error()) - - // the event was wrapped inside an error, consider the reconciliation as failed - if _, isEvent := reconcileEvent.(*reconciler.ReconcilerEvent); !isEvent { - return reconcileEvent - } - return nil - } - - if controller.IsSkipKey(reconcileEvent) { - // This is a wrapped error, don't emit an event. - } else if ok, _ := controller.IsRequeueKey(reconcileEvent); ok { - // This is a wrapped error, don't emit an event. - } else { - logger.Errorw("Returned an error", zap.Error(reconcileEvent)) - r.Recorder.Event(resource, v1.EventTypeWarning, "InternalError", reconcileEvent.Error()) - } - return reconcileEvent - } - - return nil -} - -func (r *reconcilerImpl) updateStatus(ctx context.Context, logger *zap.SugaredLogger, existing *v1alpha1.Filter, desired *v1alpha1.Filter) error { - existing = existing.DeepCopy() - return reconciler.RetryUpdateConflicts(func(attempts int) (err error) { - // The first iteration tries to use the injectionInformer's state, subsequent attempts fetch the latest state via API. - if attempts > 0 { - - getter := r.Client.RoutingV1alpha1().Filters(desired.Namespace) - - existing, err = getter.Get(ctx, desired.Name, metav1.GetOptions{}) - if err != nil { - return err - } - } - - // If there's nothing to update, just return. - if equality.Semantic.DeepEqual(existing.Status, desired.Status) { - return nil - } - - if logger.Desugar().Core().Enabled(zapcore.DebugLevel) { - if diff, err := kmp.SafeDiff(existing.Status, desired.Status); err == nil && diff != "" { - logger.Debug("Updating status with: ", diff) - } - } - - existing.Status = desired.Status - - updater := r.Client.RoutingV1alpha1().Filters(existing.Namespace) - - _, err = updater.UpdateStatus(ctx, existing, metav1.UpdateOptions{}) - return err - }) -} - -// updateFinalizersFiltered will update the Finalizers of the resource. -// TODO: this method could be generic and sync all finalizers. For now it only -// updates defaultFinalizerName or its override. -func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.Filter, desiredFinalizers sets.Set[string]) (*v1alpha1.Filter, error) { - // Don't modify the informers copy. - existing := resource.DeepCopy() - - var finalizers []string - - // If there's nothing to update, just return. - existingFinalizers := sets.New[string](existing.Finalizers...) - - if desiredFinalizers.Has(r.finalizerName) { - if existingFinalizers.Has(r.finalizerName) { - // Nothing to do. - return resource, nil - } - // Add the finalizer. - finalizers = append(existing.Finalizers, r.finalizerName) - } else { - if !existingFinalizers.Has(r.finalizerName) { - // Nothing to do. - return resource, nil - } - // Remove the finalizer. - existingFinalizers.Delete(r.finalizerName) - finalizers = sets.List(existingFinalizers) - } - - mergePatch := map[string]interface{}{ - "metadata": map[string]interface{}{ - "finalizers": finalizers, - "resourceVersion": existing.ResourceVersion, - }, - } - - patch, err := json.Marshal(mergePatch) - if err != nil { - return resource, err - } - - patcher := r.Client.RoutingV1alpha1().Filters(resource.Namespace) - - resourceName := resource.Name - updated, err := patcher.Patch(ctx, resourceName, types.MergePatchType, patch, metav1.PatchOptions{}) - if err != nil { - r.Recorder.Eventf(existing, v1.EventTypeWarning, "FinalizerUpdateFailed", - "Failed to update finalizers for %q: %v", resourceName, err) - } else { - r.Recorder.Eventf(updated, v1.EventTypeNormal, "FinalizerUpdate", - "Updated %q finalizers", resource.GetName()) - } - return updated, err -} - -func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource *v1alpha1.Filter) (*v1alpha1.Filter, error) { - if _, ok := r.reconciler.(Finalizer); !ok { - return resource, nil - } - - finalizers := sets.New[string](resource.Finalizers...) - - // If this resource is not being deleted, mark the finalizer. - if resource.GetDeletionTimestamp().IsZero() { - finalizers.Insert(r.finalizerName) - } - - // Synchronize the finalizers filtered by r.finalizerName. - return r.updateFinalizersFiltered(ctx, resource, finalizers) -} - -func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1alpha1.Filter, reconcileEvent reconciler.Event) (*v1alpha1.Filter, error) { - if _, ok := r.reconciler.(Finalizer); !ok { - return resource, nil - } - if resource.GetDeletionTimestamp().IsZero() { - return resource, nil - } - - finalizers := sets.New[string](resource.Finalizers...) - - if reconcileEvent != nil { - var event *reconciler.ReconcilerEvent - if reconciler.EventAs(reconcileEvent, &event) { - if event.EventType == v1.EventTypeNormal { - finalizers.Delete(r.finalizerName) - } - } - } else { - finalizers.Delete(r.finalizerName) - } - - // Synchronize the finalizers filtered by r.finalizerName. - return r.updateFinalizersFiltered(ctx, resource, finalizers) -} diff --git a/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/state.go b/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/state.go deleted file mode 100644 index 217cddc6..00000000 --- a/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter/state.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by injection-gen. DO NOT EDIT. - -package filter - -import ( - fmt "fmt" - - v1alpha1 "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" - types "k8s.io/apimachinery/pkg/types" - cache "k8s.io/client-go/tools/cache" - reconciler "knative.dev/pkg/reconciler" -) - -// state is used to track the state of a reconciler in a single run. -type state struct { - // key is the original reconciliation key from the queue. - key string - // namespace is the namespace split from the reconciliation key. - namespace string - // name is the name split from the reconciliation key. - name string - // reconciler is the reconciler. - reconciler Interface - // roi is the read only interface cast of the reconciler. - roi ReadOnlyInterface - // isROI (Read Only Interface) the reconciler only observes reconciliation. - isROI bool - // isLeader the instance of the reconciler is the elected leader. - isLeader bool -} - -func newState(key string, r *reconcilerImpl) (*state, error) { - // Convert the namespace/name string into a distinct namespace and name. - namespace, name, err := cache.SplitMetaNamespaceKey(key) - if err != nil { - return nil, fmt.Errorf("invalid resource key: %s", key) - } - - roi, isROI := r.reconciler.(ReadOnlyInterface) - - isLeader := r.IsLeaderFor(types.NamespacedName{ - Namespace: namespace, - Name: name, - }) - - return &state{ - key: key, - namespace: namespace, - name: name, - reconciler: r.reconciler, - roi: roi, - isROI: isROI, - isLeader: isLeader, - }, nil -} - -// isNotLeaderNorObserver checks to see if this reconciler with the current -// state is enabled to do any work or not. -// isNotLeaderNorObserver returns true when there is no work possible for the -// reconciler. -func (s *state) isNotLeaderNorObserver() bool { - if !s.isLeader && !s.isROI { - // If we are not the leader, and we don't implement the ReadOnly - // interface, then take a fast-path out. - return true - } - return false -} - -func (s *state) reconcileMethodFor(o *v1alpha1.Filter) (string, doReconcile) { - if o.GetDeletionTimestamp().IsZero() { - if s.isLeader { - return reconciler.DoReconcileKind, s.reconciler.ReconcileKind - } else if s.isROI { - return reconciler.DoObserveKind, s.roi.ObserveKind - } - } else if fin, ok := s.reconciler.(Finalizer); s.isLeader && ok { - return reconciler.DoFinalizeKind, fin.FinalizeKind - } - return "unknown", nil -} diff --git a/pkg/client/generated/listers/extensions/v1alpha1/function.go b/pkg/client/generated/listers/extensions/v1alpha1/function.go index 042167d6..f5020868 100644 --- a/pkg/client/generated/listers/extensions/v1alpha1/function.go +++ b/pkg/client/generated/listers/extensions/v1alpha1/function.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/extensions/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type FunctionLister interface { // functionLister implements the FunctionLister interface. type functionLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Function] } // NewFunctionLister returns a new FunctionLister. func NewFunctionLister(indexer cache.Indexer) FunctionLister { - return &functionLister{indexer: indexer} -} - -// List lists all Functions in the indexer. -func (s *functionLister) List(selector labels.Selector) (ret []*v1alpha1.Function, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Function)) - }) - return ret, err + return &functionLister{listers.New[*v1alpha1.Function](indexer, v1alpha1.Resource("function"))} } // Functions returns an object that can list and get Functions. func (s *functionLister) Functions(namespace string) FunctionNamespaceLister { - return functionNamespaceLister{indexer: s.indexer, namespace: namespace} + return functionNamespaceLister{listers.NewNamespaced[*v1alpha1.Function](s.ResourceIndexer, namespace)} } // FunctionNamespaceLister helps list and get Functions. @@ -58,26 +50,5 @@ type FunctionNamespaceLister interface { // functionNamespaceLister implements the FunctionNamespaceLister // interface. type functionNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Functions in the indexer for a given namespace. -func (s functionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Function, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Function)) - }) - return ret, err -} - -// Get retrieves the Function from the indexer for a given namespace and name. -func (s functionNamespaceLister) Get(name string) (*v1alpha1.Function, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("function"), name) - } - return obj.(*v1alpha1.Function), nil + listers.ResourceIndexer[*v1alpha1.Function] } diff --git a/pkg/client/generated/listers/flow/v1alpha1/bridge.go b/pkg/client/generated/listers/flow/v1alpha1/bridge.go index 37f5eb37..08af5376 100644 --- a/pkg/client/generated/listers/flow/v1alpha1/bridge.go +++ b/pkg/client/generated/listers/flow/v1alpha1/bridge.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type BridgeLister interface { // bridgeLister implements the BridgeLister interface. type bridgeLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Bridge] } // NewBridgeLister returns a new BridgeLister. func NewBridgeLister(indexer cache.Indexer) BridgeLister { - return &bridgeLister{indexer: indexer} -} - -// List lists all Bridges in the indexer. -func (s *bridgeLister) List(selector labels.Selector) (ret []*v1alpha1.Bridge, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Bridge)) - }) - return ret, err + return &bridgeLister{listers.New[*v1alpha1.Bridge](indexer, v1alpha1.Resource("bridge"))} } // Bridges returns an object that can list and get Bridges. func (s *bridgeLister) Bridges(namespace string) BridgeNamespaceLister { - return bridgeNamespaceLister{indexer: s.indexer, namespace: namespace} + return bridgeNamespaceLister{listers.NewNamespaced[*v1alpha1.Bridge](s.ResourceIndexer, namespace)} } // BridgeNamespaceLister helps list and get Bridges. @@ -58,26 +50,5 @@ type BridgeNamespaceLister interface { // bridgeNamespaceLister implements the BridgeNamespaceLister // interface. type bridgeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Bridges in the indexer for a given namespace. -func (s bridgeNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Bridge, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Bridge)) - }) - return ret, err -} - -// Get retrieves the Bridge from the indexer for a given namespace and name. -func (s bridgeNamespaceLister) Get(name string) (*v1alpha1.Bridge, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("bridge"), name) - } - return obj.(*v1alpha1.Bridge), nil + listers.ResourceIndexer[*v1alpha1.Bridge] } diff --git a/pkg/client/generated/listers/flow/v1alpha1/jqtransformation.go b/pkg/client/generated/listers/flow/v1alpha1/jqtransformation.go index 50dffd97..cb466cb1 100644 --- a/pkg/client/generated/listers/flow/v1alpha1/jqtransformation.go +++ b/pkg/client/generated/listers/flow/v1alpha1/jqtransformation.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type JQTransformationLister interface { // jQTransformationLister implements the JQTransformationLister interface. type jQTransformationLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.JQTransformation] } // NewJQTransformationLister returns a new JQTransformationLister. func NewJQTransformationLister(indexer cache.Indexer) JQTransformationLister { - return &jQTransformationLister{indexer: indexer} -} - -// List lists all JQTransformations in the indexer. -func (s *jQTransformationLister) List(selector labels.Selector) (ret []*v1alpha1.JQTransformation, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.JQTransformation)) - }) - return ret, err + return &jQTransformationLister{listers.New[*v1alpha1.JQTransformation](indexer, v1alpha1.Resource("jqtransformation"))} } // JQTransformations returns an object that can list and get JQTransformations. func (s *jQTransformationLister) JQTransformations(namespace string) JQTransformationNamespaceLister { - return jQTransformationNamespaceLister{indexer: s.indexer, namespace: namespace} + return jQTransformationNamespaceLister{listers.NewNamespaced[*v1alpha1.JQTransformation](s.ResourceIndexer, namespace)} } // JQTransformationNamespaceLister helps list and get JQTransformations. @@ -58,26 +50,5 @@ type JQTransformationNamespaceLister interface { // jQTransformationNamespaceLister implements the JQTransformationNamespaceLister // interface. type jQTransformationNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all JQTransformations in the indexer for a given namespace. -func (s jQTransformationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.JQTransformation, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.JQTransformation)) - }) - return ret, err -} - -// Get retrieves the JQTransformation from the indexer for a given namespace and name. -func (s jQTransformationNamespaceLister) Get(name string) (*v1alpha1.JQTransformation, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("jqtransformation"), name) - } - return obj.(*v1alpha1.JQTransformation), nil + listers.ResourceIndexer[*v1alpha1.JQTransformation] } diff --git a/pkg/client/generated/listers/flow/v1alpha1/synchronizer.go b/pkg/client/generated/listers/flow/v1alpha1/synchronizer.go index dd743a87..d7239d44 100644 --- a/pkg/client/generated/listers/flow/v1alpha1/synchronizer.go +++ b/pkg/client/generated/listers/flow/v1alpha1/synchronizer.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type SynchronizerLister interface { // synchronizerLister implements the SynchronizerLister interface. type synchronizerLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Synchronizer] } // NewSynchronizerLister returns a new SynchronizerLister. func NewSynchronizerLister(indexer cache.Indexer) SynchronizerLister { - return &synchronizerLister{indexer: indexer} -} - -// List lists all Synchronizers in the indexer. -func (s *synchronizerLister) List(selector labels.Selector) (ret []*v1alpha1.Synchronizer, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Synchronizer)) - }) - return ret, err + return &synchronizerLister{listers.New[*v1alpha1.Synchronizer](indexer, v1alpha1.Resource("synchronizer"))} } // Synchronizers returns an object that can list and get Synchronizers. func (s *synchronizerLister) Synchronizers(namespace string) SynchronizerNamespaceLister { - return synchronizerNamespaceLister{indexer: s.indexer, namespace: namespace} + return synchronizerNamespaceLister{listers.NewNamespaced[*v1alpha1.Synchronizer](s.ResourceIndexer, namespace)} } // SynchronizerNamespaceLister helps list and get Synchronizers. @@ -58,26 +50,5 @@ type SynchronizerNamespaceLister interface { // synchronizerNamespaceLister implements the SynchronizerNamespaceLister // interface. type synchronizerNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Synchronizers in the indexer for a given namespace. -func (s synchronizerNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Synchronizer, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Synchronizer)) - }) - return ret, err -} - -// Get retrieves the Synchronizer from the indexer for a given namespace and name. -func (s synchronizerNamespaceLister) Get(name string) (*v1alpha1.Synchronizer, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("synchronizer"), name) - } - return obj.(*v1alpha1.Synchronizer), nil + listers.ResourceIndexer[*v1alpha1.Synchronizer] } diff --git a/pkg/client/generated/listers/flow/v1alpha1/transformation.go b/pkg/client/generated/listers/flow/v1alpha1/transformation.go index 2c651042..c5045320 100644 --- a/pkg/client/generated/listers/flow/v1alpha1/transformation.go +++ b/pkg/client/generated/listers/flow/v1alpha1/transformation.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type TransformationLister interface { // transformationLister implements the TransformationLister interface. type transformationLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Transformation] } // NewTransformationLister returns a new TransformationLister. func NewTransformationLister(indexer cache.Indexer) TransformationLister { - return &transformationLister{indexer: indexer} -} - -// List lists all Transformations in the indexer. -func (s *transformationLister) List(selector labels.Selector) (ret []*v1alpha1.Transformation, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Transformation)) - }) - return ret, err + return &transformationLister{listers.New[*v1alpha1.Transformation](indexer, v1alpha1.Resource("transformation"))} } // Transformations returns an object that can list and get Transformations. func (s *transformationLister) Transformations(namespace string) TransformationNamespaceLister { - return transformationNamespaceLister{indexer: s.indexer, namespace: namespace} + return transformationNamespaceLister{listers.NewNamespaced[*v1alpha1.Transformation](s.ResourceIndexer, namespace)} } // TransformationNamespaceLister helps list and get Transformations. @@ -58,26 +50,5 @@ type TransformationNamespaceLister interface { // transformationNamespaceLister implements the TransformationNamespaceLister // interface. type transformationNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Transformations in the indexer for a given namespace. -func (s transformationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Transformation, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Transformation)) - }) - return ret, err -} - -// Get retrieves the Transformation from the indexer for a given namespace and name. -func (s transformationNamespaceLister) Get(name string) (*v1alpha1.Transformation, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("transformation"), name) - } - return obj.(*v1alpha1.Transformation), nil + listers.ResourceIndexer[*v1alpha1.Transformation] } diff --git a/pkg/client/generated/listers/flow/v1alpha1/workertransformation.go b/pkg/client/generated/listers/flow/v1alpha1/workertransformation.go index 51b9a386..83a7a23f 100644 --- a/pkg/client/generated/listers/flow/v1alpha1/workertransformation.go +++ b/pkg/client/generated/listers/flow/v1alpha1/workertransformation.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type WorkerTransformationLister interface { // workerTransformationLister implements the WorkerTransformationLister interface. type workerTransformationLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.WorkerTransformation] } // NewWorkerTransformationLister returns a new WorkerTransformationLister. func NewWorkerTransformationLister(indexer cache.Indexer) WorkerTransformationLister { - return &workerTransformationLister{indexer: indexer} -} - -// List lists all WorkerTransformations in the indexer. -func (s *workerTransformationLister) List(selector labels.Selector) (ret []*v1alpha1.WorkerTransformation, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.WorkerTransformation)) - }) - return ret, err + return &workerTransformationLister{listers.New[*v1alpha1.WorkerTransformation](indexer, v1alpha1.Resource("workertransformation"))} } // WorkerTransformations returns an object that can list and get WorkerTransformations. func (s *workerTransformationLister) WorkerTransformations(namespace string) WorkerTransformationNamespaceLister { - return workerTransformationNamespaceLister{indexer: s.indexer, namespace: namespace} + return workerTransformationNamespaceLister{listers.NewNamespaced[*v1alpha1.WorkerTransformation](s.ResourceIndexer, namespace)} } // WorkerTransformationNamespaceLister helps list and get WorkerTransformations. @@ -58,26 +50,5 @@ type WorkerTransformationNamespaceLister interface { // workerTransformationNamespaceLister implements the WorkerTransformationNamespaceLister // interface. type workerTransformationNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all WorkerTransformations in the indexer for a given namespace. -func (s workerTransformationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.WorkerTransformation, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.WorkerTransformation)) - }) - return ret, err -} - -// Get retrieves the WorkerTransformation from the indexer for a given namespace and name. -func (s workerTransformationNamespaceLister) Get(name string) (*v1alpha1.WorkerTransformation, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("workertransformation"), name) - } - return obj.(*v1alpha1.WorkerTransformation), nil + listers.ResourceIndexer[*v1alpha1.WorkerTransformation] } diff --git a/pkg/client/generated/listers/flow/v1alpha1/xmltojsontransformation.go b/pkg/client/generated/listers/flow/v1alpha1/xmltojsontransformation.go index 4c00883d..0d34dce5 100644 --- a/pkg/client/generated/listers/flow/v1alpha1/xmltojsontransformation.go +++ b/pkg/client/generated/listers/flow/v1alpha1/xmltojsontransformation.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type XMLToJSONTransformationLister interface { // xMLToJSONTransformationLister implements the XMLToJSONTransformationLister interface. type xMLToJSONTransformationLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.XMLToJSONTransformation] } // NewXMLToJSONTransformationLister returns a new XMLToJSONTransformationLister. func NewXMLToJSONTransformationLister(indexer cache.Indexer) XMLToJSONTransformationLister { - return &xMLToJSONTransformationLister{indexer: indexer} -} - -// List lists all XMLToJSONTransformations in the indexer. -func (s *xMLToJSONTransformationLister) List(selector labels.Selector) (ret []*v1alpha1.XMLToJSONTransformation, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.XMLToJSONTransformation)) - }) - return ret, err + return &xMLToJSONTransformationLister{listers.New[*v1alpha1.XMLToJSONTransformation](indexer, v1alpha1.Resource("xmltojsontransformation"))} } // XMLToJSONTransformations returns an object that can list and get XMLToJSONTransformations. func (s *xMLToJSONTransformationLister) XMLToJSONTransformations(namespace string) XMLToJSONTransformationNamespaceLister { - return xMLToJSONTransformationNamespaceLister{indexer: s.indexer, namespace: namespace} + return xMLToJSONTransformationNamespaceLister{listers.NewNamespaced[*v1alpha1.XMLToJSONTransformation](s.ResourceIndexer, namespace)} } // XMLToJSONTransformationNamespaceLister helps list and get XMLToJSONTransformations. @@ -58,26 +50,5 @@ type XMLToJSONTransformationNamespaceLister interface { // xMLToJSONTransformationNamespaceLister implements the XMLToJSONTransformationNamespaceLister // interface. type xMLToJSONTransformationNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all XMLToJSONTransformations in the indexer for a given namespace. -func (s xMLToJSONTransformationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.XMLToJSONTransformation, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.XMLToJSONTransformation)) - }) - return ret, err -} - -// Get retrieves the XMLToJSONTransformation from the indexer for a given namespace and name. -func (s xMLToJSONTransformationNamespaceLister) Get(name string) (*v1alpha1.XMLToJSONTransformation, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("xmltojsontransformation"), name) - } - return obj.(*v1alpha1.XMLToJSONTransformation), nil + listers.ResourceIndexer[*v1alpha1.XMLToJSONTransformation] } diff --git a/pkg/client/generated/listers/flow/v1alpha1/xslttransformation.go b/pkg/client/generated/listers/flow/v1alpha1/xslttransformation.go index 597fddb7..371b5c1b 100644 --- a/pkg/client/generated/listers/flow/v1alpha1/xslttransformation.go +++ b/pkg/client/generated/listers/flow/v1alpha1/xslttransformation.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type XSLTTransformationLister interface { // xSLTTransformationLister implements the XSLTTransformationLister interface. type xSLTTransformationLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.XSLTTransformation] } // NewXSLTTransformationLister returns a new XSLTTransformationLister. func NewXSLTTransformationLister(indexer cache.Indexer) XSLTTransformationLister { - return &xSLTTransformationLister{indexer: indexer} -} - -// List lists all XSLTTransformations in the indexer. -func (s *xSLTTransformationLister) List(selector labels.Selector) (ret []*v1alpha1.XSLTTransformation, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.XSLTTransformation)) - }) - return ret, err + return &xSLTTransformationLister{listers.New[*v1alpha1.XSLTTransformation](indexer, v1alpha1.Resource("xslttransformation"))} } // XSLTTransformations returns an object that can list and get XSLTTransformations. func (s *xSLTTransformationLister) XSLTTransformations(namespace string) XSLTTransformationNamespaceLister { - return xSLTTransformationNamespaceLister{indexer: s.indexer, namespace: namespace} + return xSLTTransformationNamespaceLister{listers.NewNamespaced[*v1alpha1.XSLTTransformation](s.ResourceIndexer, namespace)} } // XSLTTransformationNamespaceLister helps list and get XSLTTransformations. @@ -58,26 +50,5 @@ type XSLTTransformationNamespaceLister interface { // xSLTTransformationNamespaceLister implements the XSLTTransformationNamespaceLister // interface. type xSLTTransformationNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all XSLTTransformations in the indexer for a given namespace. -func (s xSLTTransformationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.XSLTTransformation, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.XSLTTransformation)) - }) - return ret, err -} - -// Get retrieves the XSLTTransformation from the indexer for a given namespace and name. -func (s xSLTTransformationNamespaceLister) Get(name string) (*v1alpha1.XSLTTransformation, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("xslttransformation"), name) - } - return obj.(*v1alpha1.XSLTTransformation), nil + listers.ResourceIndexer[*v1alpha1.XSLTTransformation] } diff --git a/pkg/client/generated/listers/routing/v1alpha1/filter.go b/pkg/client/generated/listers/routing/v1alpha1/filter.go index 62a6a549..5d3b5404 100644 --- a/pkg/client/generated/listers/routing/v1alpha1/filter.go +++ b/pkg/client/generated/listers/routing/v1alpha1/filter.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type FilterLister interface { // filterLister implements the FilterLister interface. type filterLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Filter] } // NewFilterLister returns a new FilterLister. func NewFilterLister(indexer cache.Indexer) FilterLister { - return &filterLister{indexer: indexer} -} - -// List lists all Filters in the indexer. -func (s *filterLister) List(selector labels.Selector) (ret []*v1alpha1.Filter, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Filter)) - }) - return ret, err + return &filterLister{listers.New[*v1alpha1.Filter](indexer, v1alpha1.Resource("filter"))} } // Filters returns an object that can list and get Filters. func (s *filterLister) Filters(namespace string) FilterNamespaceLister { - return filterNamespaceLister{indexer: s.indexer, namespace: namespace} + return filterNamespaceLister{listers.NewNamespaced[*v1alpha1.Filter](s.ResourceIndexer, namespace)} } // FilterNamespaceLister helps list and get Filters. @@ -58,26 +50,5 @@ type FilterNamespaceLister interface { // filterNamespaceLister implements the FilterNamespaceLister // interface. type filterNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Filters in the indexer for a given namespace. -func (s filterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Filter, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Filter)) - }) - return ret, err -} - -// Get retrieves the Filter from the indexer for a given namespace and name. -func (s filterNamespaceLister) Get(name string) (*v1alpha1.Filter, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("filter"), name) - } - return obj.(*v1alpha1.Filter), nil + listers.ResourceIndexer[*v1alpha1.Filter] } diff --git a/pkg/client/generated/listers/routing/v1alpha1/splitter.go b/pkg/client/generated/listers/routing/v1alpha1/splitter.go index 49ac7aba..ca363fb3 100644 --- a/pkg/client/generated/listers/routing/v1alpha1/splitter.go +++ b/pkg/client/generated/listers/routing/v1alpha1/splitter.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type SplitterLister interface { // splitterLister implements the SplitterLister interface. type splitterLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.Splitter] } // NewSplitterLister returns a new SplitterLister. func NewSplitterLister(indexer cache.Indexer) SplitterLister { - return &splitterLister{indexer: indexer} -} - -// List lists all Splitters in the indexer. -func (s *splitterLister) List(selector labels.Selector) (ret []*v1alpha1.Splitter, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Splitter)) - }) - return ret, err + return &splitterLister{listers.New[*v1alpha1.Splitter](indexer, v1alpha1.Resource("splitter"))} } // Splitters returns an object that can list and get Splitters. func (s *splitterLister) Splitters(namespace string) SplitterNamespaceLister { - return splitterNamespaceLister{indexer: s.indexer, namespace: namespace} + return splitterNamespaceLister{listers.NewNamespaced[*v1alpha1.Splitter](s.ResourceIndexer, namespace)} } // SplitterNamespaceLister helps list and get Splitters. @@ -58,26 +50,5 @@ type SplitterNamespaceLister interface { // splitterNamespaceLister implements the SplitterNamespaceLister // interface. type splitterNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Splitters in the indexer for a given namespace. -func (s splitterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Splitter, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Splitter)) - }) - return ret, err -} - -// Get retrieves the Splitter from the indexer for a given namespace and name. -func (s splitterNamespaceLister) Get(name string) (*v1alpha1.Splitter, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("splitter"), name) - } - return obj.(*v1alpha1.Splitter), nil + listers.ResourceIndexer[*v1alpha1.Splitter] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/azureservicebusqueuesource.go b/pkg/client/generated/listers/sources/v1alpha1/azureservicebusqueuesource.go index 170f0f76..3d4c96fc 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/azureservicebusqueuesource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/azureservicebusqueuesource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type AzureServiceBusQueueSourceLister interface { // azureServiceBusQueueSourceLister implements the AzureServiceBusQueueSourceLister interface. type azureServiceBusQueueSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.AzureServiceBusQueueSource] } // NewAzureServiceBusQueueSourceLister returns a new AzureServiceBusQueueSourceLister. func NewAzureServiceBusQueueSourceLister(indexer cache.Indexer) AzureServiceBusQueueSourceLister { - return &azureServiceBusQueueSourceLister{indexer: indexer} -} - -// List lists all AzureServiceBusQueueSources in the indexer. -func (s *azureServiceBusQueueSourceLister) List(selector labels.Selector) (ret []*v1alpha1.AzureServiceBusQueueSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.AzureServiceBusQueueSource)) - }) - return ret, err + return &azureServiceBusQueueSourceLister{listers.New[*v1alpha1.AzureServiceBusQueueSource](indexer, v1alpha1.Resource("azureservicebusqueuesource"))} } // AzureServiceBusQueueSources returns an object that can list and get AzureServiceBusQueueSources. func (s *azureServiceBusQueueSourceLister) AzureServiceBusQueueSources(namespace string) AzureServiceBusQueueSourceNamespaceLister { - return azureServiceBusQueueSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return azureServiceBusQueueSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.AzureServiceBusQueueSource](s.ResourceIndexer, namespace)} } // AzureServiceBusQueueSourceNamespaceLister helps list and get AzureServiceBusQueueSources. @@ -58,26 +50,5 @@ type AzureServiceBusQueueSourceNamespaceLister interface { // azureServiceBusQueueSourceNamespaceLister implements the AzureServiceBusQueueSourceNamespaceLister // interface. type azureServiceBusQueueSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all AzureServiceBusQueueSources in the indexer for a given namespace. -func (s azureServiceBusQueueSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AzureServiceBusQueueSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.AzureServiceBusQueueSource)) - }) - return ret, err -} - -// Get retrieves the AzureServiceBusQueueSource from the indexer for a given namespace and name. -func (s azureServiceBusQueueSourceNamespaceLister) Get(name string) (*v1alpha1.AzureServiceBusQueueSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("azureservicebusqueuesource"), name) - } - return obj.(*v1alpha1.AzureServiceBusQueueSource), nil + listers.ResourceIndexer[*v1alpha1.AzureServiceBusQueueSource] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/azureservicebussource.go b/pkg/client/generated/listers/sources/v1alpha1/azureservicebussource.go index 7142fb59..cca6bd4d 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/azureservicebussource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/azureservicebussource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type AzureServiceBusSourceLister interface { // azureServiceBusSourceLister implements the AzureServiceBusSourceLister interface. type azureServiceBusSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.AzureServiceBusSource] } // NewAzureServiceBusSourceLister returns a new AzureServiceBusSourceLister. func NewAzureServiceBusSourceLister(indexer cache.Indexer) AzureServiceBusSourceLister { - return &azureServiceBusSourceLister{indexer: indexer} -} - -// List lists all AzureServiceBusSources in the indexer. -func (s *azureServiceBusSourceLister) List(selector labels.Selector) (ret []*v1alpha1.AzureServiceBusSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.AzureServiceBusSource)) - }) - return ret, err + return &azureServiceBusSourceLister{listers.New[*v1alpha1.AzureServiceBusSource](indexer, v1alpha1.Resource("azureservicebussource"))} } // AzureServiceBusSources returns an object that can list and get AzureServiceBusSources. func (s *azureServiceBusSourceLister) AzureServiceBusSources(namespace string) AzureServiceBusSourceNamespaceLister { - return azureServiceBusSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return azureServiceBusSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.AzureServiceBusSource](s.ResourceIndexer, namespace)} } // AzureServiceBusSourceNamespaceLister helps list and get AzureServiceBusSources. @@ -58,26 +50,5 @@ type AzureServiceBusSourceNamespaceLister interface { // azureServiceBusSourceNamespaceLister implements the AzureServiceBusSourceNamespaceLister // interface. type azureServiceBusSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all AzureServiceBusSources in the indexer for a given namespace. -func (s azureServiceBusSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AzureServiceBusSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.AzureServiceBusSource)) - }) - return ret, err -} - -// Get retrieves the AzureServiceBusSource from the indexer for a given namespace and name. -func (s azureServiceBusSourceNamespaceLister) Get(name string) (*v1alpha1.AzureServiceBusSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("azureservicebussource"), name) - } - return obj.(*v1alpha1.AzureServiceBusSource), nil + listers.ResourceIndexer[*v1alpha1.AzureServiceBusSource] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/azureservicebustopicsource.go b/pkg/client/generated/listers/sources/v1alpha1/azureservicebustopicsource.go index 0c475bfb..4bebd121 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/azureservicebustopicsource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/azureservicebustopicsource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type AzureServiceBusTopicSourceLister interface { // azureServiceBusTopicSourceLister implements the AzureServiceBusTopicSourceLister interface. type azureServiceBusTopicSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.AzureServiceBusTopicSource] } // NewAzureServiceBusTopicSourceLister returns a new AzureServiceBusTopicSourceLister. func NewAzureServiceBusTopicSourceLister(indexer cache.Indexer) AzureServiceBusTopicSourceLister { - return &azureServiceBusTopicSourceLister{indexer: indexer} -} - -// List lists all AzureServiceBusTopicSources in the indexer. -func (s *azureServiceBusTopicSourceLister) List(selector labels.Selector) (ret []*v1alpha1.AzureServiceBusTopicSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.AzureServiceBusTopicSource)) - }) - return ret, err + return &azureServiceBusTopicSourceLister{listers.New[*v1alpha1.AzureServiceBusTopicSource](indexer, v1alpha1.Resource("azureservicebustopicsource"))} } // AzureServiceBusTopicSources returns an object that can list and get AzureServiceBusTopicSources. func (s *azureServiceBusTopicSourceLister) AzureServiceBusTopicSources(namespace string) AzureServiceBusTopicSourceNamespaceLister { - return azureServiceBusTopicSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return azureServiceBusTopicSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.AzureServiceBusTopicSource](s.ResourceIndexer, namespace)} } // AzureServiceBusTopicSourceNamespaceLister helps list and get AzureServiceBusTopicSources. @@ -58,26 +50,5 @@ type AzureServiceBusTopicSourceNamespaceLister interface { // azureServiceBusTopicSourceNamespaceLister implements the AzureServiceBusTopicSourceNamespaceLister // interface. type azureServiceBusTopicSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all AzureServiceBusTopicSources in the indexer for a given namespace. -func (s azureServiceBusTopicSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AzureServiceBusTopicSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.AzureServiceBusTopicSource)) - }) - return ret, err -} - -// Get retrieves the AzureServiceBusTopicSource from the indexer for a given namespace and name. -func (s azureServiceBusTopicSourceNamespaceLister) Get(name string) (*v1alpha1.AzureServiceBusTopicSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("azureservicebustopicsource"), name) - } - return obj.(*v1alpha1.AzureServiceBusTopicSource), nil + listers.ResourceIndexer[*v1alpha1.AzureServiceBusTopicSource] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/cloudeventssource.go b/pkg/client/generated/listers/sources/v1alpha1/cloudeventssource.go index 332032b6..9fcd5b8e 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/cloudeventssource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/cloudeventssource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type CloudEventsSourceLister interface { // cloudEventsSourceLister implements the CloudEventsSourceLister interface. type cloudEventsSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.CloudEventsSource] } // NewCloudEventsSourceLister returns a new CloudEventsSourceLister. func NewCloudEventsSourceLister(indexer cache.Indexer) CloudEventsSourceLister { - return &cloudEventsSourceLister{indexer: indexer} -} - -// List lists all CloudEventsSources in the indexer. -func (s *cloudEventsSourceLister) List(selector labels.Selector) (ret []*v1alpha1.CloudEventsSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.CloudEventsSource)) - }) - return ret, err + return &cloudEventsSourceLister{listers.New[*v1alpha1.CloudEventsSource](indexer, v1alpha1.Resource("cloudeventssource"))} } // CloudEventsSources returns an object that can list and get CloudEventsSources. func (s *cloudEventsSourceLister) CloudEventsSources(namespace string) CloudEventsSourceNamespaceLister { - return cloudEventsSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return cloudEventsSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.CloudEventsSource](s.ResourceIndexer, namespace)} } // CloudEventsSourceNamespaceLister helps list and get CloudEventsSources. @@ -58,26 +50,5 @@ type CloudEventsSourceNamespaceLister interface { // cloudEventsSourceNamespaceLister implements the CloudEventsSourceNamespaceLister // interface. type cloudEventsSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CloudEventsSources in the indexer for a given namespace. -func (s cloudEventsSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CloudEventsSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.CloudEventsSource)) - }) - return ret, err -} - -// Get retrieves the CloudEventsSource from the indexer for a given namespace and name. -func (s cloudEventsSourceNamespaceLister) Get(name string) (*v1alpha1.CloudEventsSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("cloudeventssource"), name) - } - return obj.(*v1alpha1.CloudEventsSource), nil + listers.ResourceIndexer[*v1alpha1.CloudEventsSource] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/httppollersource.go b/pkg/client/generated/listers/sources/v1alpha1/httppollersource.go index 3f946985..5f23a191 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/httppollersource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/httppollersource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type HTTPPollerSourceLister interface { // hTTPPollerSourceLister implements the HTTPPollerSourceLister interface. type hTTPPollerSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.HTTPPollerSource] } // NewHTTPPollerSourceLister returns a new HTTPPollerSourceLister. func NewHTTPPollerSourceLister(indexer cache.Indexer) HTTPPollerSourceLister { - return &hTTPPollerSourceLister{indexer: indexer} -} - -// List lists all HTTPPollerSources in the indexer. -func (s *hTTPPollerSourceLister) List(selector labels.Selector) (ret []*v1alpha1.HTTPPollerSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.HTTPPollerSource)) - }) - return ret, err + return &hTTPPollerSourceLister{listers.New[*v1alpha1.HTTPPollerSource](indexer, v1alpha1.Resource("httppollersource"))} } // HTTPPollerSources returns an object that can list and get HTTPPollerSources. func (s *hTTPPollerSourceLister) HTTPPollerSources(namespace string) HTTPPollerSourceNamespaceLister { - return hTTPPollerSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return hTTPPollerSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.HTTPPollerSource](s.ResourceIndexer, namespace)} } // HTTPPollerSourceNamespaceLister helps list and get HTTPPollerSources. @@ -58,26 +50,5 @@ type HTTPPollerSourceNamespaceLister interface { // hTTPPollerSourceNamespaceLister implements the HTTPPollerSourceNamespaceLister // interface. type hTTPPollerSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all HTTPPollerSources in the indexer for a given namespace. -func (s hTTPPollerSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.HTTPPollerSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.HTTPPollerSource)) - }) - return ret, err -} - -// Get retrieves the HTTPPollerSource from the indexer for a given namespace and name. -func (s hTTPPollerSourceNamespaceLister) Get(name string) (*v1alpha1.HTTPPollerSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("httppollersource"), name) - } - return obj.(*v1alpha1.HTTPPollerSource), nil + listers.ResourceIndexer[*v1alpha1.HTTPPollerSource] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/kafkasource.go b/pkg/client/generated/listers/sources/v1alpha1/kafkasource.go index ecb8ba31..5317c042 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/kafkasource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/kafkasource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type KafkaSourceLister interface { // kafkaSourceLister implements the KafkaSourceLister interface. type kafkaSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.KafkaSource] } // NewKafkaSourceLister returns a new KafkaSourceLister. func NewKafkaSourceLister(indexer cache.Indexer) KafkaSourceLister { - return &kafkaSourceLister{indexer: indexer} -} - -// List lists all KafkaSources in the indexer. -func (s *kafkaSourceLister) List(selector labels.Selector) (ret []*v1alpha1.KafkaSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.KafkaSource)) - }) - return ret, err + return &kafkaSourceLister{listers.New[*v1alpha1.KafkaSource](indexer, v1alpha1.Resource("kafkasource"))} } // KafkaSources returns an object that can list and get KafkaSources. func (s *kafkaSourceLister) KafkaSources(namespace string) KafkaSourceNamespaceLister { - return kafkaSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return kafkaSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.KafkaSource](s.ResourceIndexer, namespace)} } // KafkaSourceNamespaceLister helps list and get KafkaSources. @@ -58,26 +50,5 @@ type KafkaSourceNamespaceLister interface { // kafkaSourceNamespaceLister implements the KafkaSourceNamespaceLister // interface. type kafkaSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all KafkaSources in the indexer for a given namespace. -func (s kafkaSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.KafkaSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.KafkaSource)) - }) - return ret, err -} - -// Get retrieves the KafkaSource from the indexer for a given namespace and name. -func (s kafkaSourceNamespaceLister) Get(name string) (*v1alpha1.KafkaSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("kafkasource"), name) - } - return obj.(*v1alpha1.KafkaSource), nil + listers.ResourceIndexer[*v1alpha1.KafkaSource] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/ocimetricssource.go b/pkg/client/generated/listers/sources/v1alpha1/ocimetricssource.go index 90b6539d..f15856f3 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/ocimetricssource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/ocimetricssource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type OCIMetricsSourceLister interface { // oCIMetricsSourceLister implements the OCIMetricsSourceLister interface. type oCIMetricsSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.OCIMetricsSource] } // NewOCIMetricsSourceLister returns a new OCIMetricsSourceLister. func NewOCIMetricsSourceLister(indexer cache.Indexer) OCIMetricsSourceLister { - return &oCIMetricsSourceLister{indexer: indexer} -} - -// List lists all OCIMetricsSources in the indexer. -func (s *oCIMetricsSourceLister) List(selector labels.Selector) (ret []*v1alpha1.OCIMetricsSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.OCIMetricsSource)) - }) - return ret, err + return &oCIMetricsSourceLister{listers.New[*v1alpha1.OCIMetricsSource](indexer, v1alpha1.Resource("ocimetricssource"))} } // OCIMetricsSources returns an object that can list and get OCIMetricsSources. func (s *oCIMetricsSourceLister) OCIMetricsSources(namespace string) OCIMetricsSourceNamespaceLister { - return oCIMetricsSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return oCIMetricsSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.OCIMetricsSource](s.ResourceIndexer, namespace)} } // OCIMetricsSourceNamespaceLister helps list and get OCIMetricsSources. @@ -58,26 +50,5 @@ type OCIMetricsSourceNamespaceLister interface { // oCIMetricsSourceNamespaceLister implements the OCIMetricsSourceNamespaceLister // interface. type oCIMetricsSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all OCIMetricsSources in the indexer for a given namespace. -func (s oCIMetricsSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.OCIMetricsSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.OCIMetricsSource)) - }) - return ret, err -} - -// Get retrieves the OCIMetricsSource from the indexer for a given namespace and name. -func (s oCIMetricsSourceNamespaceLister) Get(name string) (*v1alpha1.OCIMetricsSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ocimetricssource"), name) - } - return obj.(*v1alpha1.OCIMetricsSource), nil + listers.ResourceIndexer[*v1alpha1.OCIMetricsSource] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/salesforcesource.go b/pkg/client/generated/listers/sources/v1alpha1/salesforcesource.go index 1dbe64fb..a70b27e8 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/salesforcesource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/salesforcesource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type SalesforceSourceLister interface { // salesforceSourceLister implements the SalesforceSourceLister interface. type salesforceSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.SalesforceSource] } // NewSalesforceSourceLister returns a new SalesforceSourceLister. func NewSalesforceSourceLister(indexer cache.Indexer) SalesforceSourceLister { - return &salesforceSourceLister{indexer: indexer} -} - -// List lists all SalesforceSources in the indexer. -func (s *salesforceSourceLister) List(selector labels.Selector) (ret []*v1alpha1.SalesforceSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.SalesforceSource)) - }) - return ret, err + return &salesforceSourceLister{listers.New[*v1alpha1.SalesforceSource](indexer, v1alpha1.Resource("salesforcesource"))} } // SalesforceSources returns an object that can list and get SalesforceSources. func (s *salesforceSourceLister) SalesforceSources(namespace string) SalesforceSourceNamespaceLister { - return salesforceSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return salesforceSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.SalesforceSource](s.ResourceIndexer, namespace)} } // SalesforceSourceNamespaceLister helps list and get SalesforceSources. @@ -58,26 +50,5 @@ type SalesforceSourceNamespaceLister interface { // salesforceSourceNamespaceLister implements the SalesforceSourceNamespaceLister // interface. type salesforceSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all SalesforceSources in the indexer for a given namespace. -func (s salesforceSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SalesforceSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.SalesforceSource)) - }) - return ret, err -} - -// Get retrieves the SalesforceSource from the indexer for a given namespace and name. -func (s salesforceSourceNamespaceLister) Get(name string) (*v1alpha1.SalesforceSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("salesforcesource"), name) - } - return obj.(*v1alpha1.SalesforceSource), nil + listers.ResourceIndexer[*v1alpha1.SalesforceSource] } diff --git a/pkg/client/generated/listers/sources/v1alpha1/webhooksource.go b/pkg/client/generated/listers/sources/v1alpha1/webhooksource.go index 234beb9f..43026858 100644 --- a/pkg/client/generated/listers/sources/v1alpha1/webhooksource.go +++ b/pkg/client/generated/listers/sources/v1alpha1/webhooksource.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type WebhookSourceLister interface { // webhookSourceLister implements the WebhookSourceLister interface. type webhookSourceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.WebhookSource] } // NewWebhookSourceLister returns a new WebhookSourceLister. func NewWebhookSourceLister(indexer cache.Indexer) WebhookSourceLister { - return &webhookSourceLister{indexer: indexer} -} - -// List lists all WebhookSources in the indexer. -func (s *webhookSourceLister) List(selector labels.Selector) (ret []*v1alpha1.WebhookSource, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.WebhookSource)) - }) - return ret, err + return &webhookSourceLister{listers.New[*v1alpha1.WebhookSource](indexer, v1alpha1.Resource("webhooksource"))} } // WebhookSources returns an object that can list and get WebhookSources. func (s *webhookSourceLister) WebhookSources(namespace string) WebhookSourceNamespaceLister { - return webhookSourceNamespaceLister{indexer: s.indexer, namespace: namespace} + return webhookSourceNamespaceLister{listers.NewNamespaced[*v1alpha1.WebhookSource](s.ResourceIndexer, namespace)} } // WebhookSourceNamespaceLister helps list and get WebhookSources. @@ -58,26 +50,5 @@ type WebhookSourceNamespaceLister interface { // webhookSourceNamespaceLister implements the WebhookSourceNamespaceLister // interface. type webhookSourceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all WebhookSources in the indexer for a given namespace. -func (s webhookSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.WebhookSource, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.WebhookSource)) - }) - return ret, err -} - -// Get retrieves the WebhookSource from the indexer for a given namespace and name. -func (s webhookSourceNamespaceLister) Get(name string) (*v1alpha1.WebhookSource, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("webhooksource"), name) - } - return obj.(*v1alpha1.WebhookSource), nil + listers.ResourceIndexer[*v1alpha1.WebhookSource] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/cloudeventstarget.go b/pkg/client/generated/listers/targets/v1alpha1/cloudeventstarget.go index 5ee3c8e2..45931993 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/cloudeventstarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/cloudeventstarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type CloudEventsTargetLister interface { // cloudEventsTargetLister implements the CloudEventsTargetLister interface. type cloudEventsTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.CloudEventsTarget] } // NewCloudEventsTargetLister returns a new CloudEventsTargetLister. func NewCloudEventsTargetLister(indexer cache.Indexer) CloudEventsTargetLister { - return &cloudEventsTargetLister{indexer: indexer} -} - -// List lists all CloudEventsTargets in the indexer. -func (s *cloudEventsTargetLister) List(selector labels.Selector) (ret []*v1alpha1.CloudEventsTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.CloudEventsTarget)) - }) - return ret, err + return &cloudEventsTargetLister{listers.New[*v1alpha1.CloudEventsTarget](indexer, v1alpha1.Resource("cloudeventstarget"))} } // CloudEventsTargets returns an object that can list and get CloudEventsTargets. func (s *cloudEventsTargetLister) CloudEventsTargets(namespace string) CloudEventsTargetNamespaceLister { - return cloudEventsTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return cloudEventsTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.CloudEventsTarget](s.ResourceIndexer, namespace)} } // CloudEventsTargetNamespaceLister helps list and get CloudEventsTargets. @@ -58,26 +50,5 @@ type CloudEventsTargetNamespaceLister interface { // cloudEventsTargetNamespaceLister implements the CloudEventsTargetNamespaceLister // interface. type cloudEventsTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all CloudEventsTargets in the indexer for a given namespace. -func (s cloudEventsTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CloudEventsTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.CloudEventsTarget)) - }) - return ret, err -} - -// Get retrieves the CloudEventsTarget from the indexer for a given namespace and name. -func (s cloudEventsTargetNamespaceLister) Get(name string) (*v1alpha1.CloudEventsTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("cloudeventstarget"), name) - } - return obj.(*v1alpha1.CloudEventsTarget), nil + listers.ResourceIndexer[*v1alpha1.CloudEventsTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/datadogtarget.go b/pkg/client/generated/listers/targets/v1alpha1/datadogtarget.go index 28d862a0..fdf53a8c 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/datadogtarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/datadogtarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type DatadogTargetLister interface { // datadogTargetLister implements the DatadogTargetLister interface. type datadogTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.DatadogTarget] } // NewDatadogTargetLister returns a new DatadogTargetLister. func NewDatadogTargetLister(indexer cache.Indexer) DatadogTargetLister { - return &datadogTargetLister{indexer: indexer} -} - -// List lists all DatadogTargets in the indexer. -func (s *datadogTargetLister) List(selector labels.Selector) (ret []*v1alpha1.DatadogTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.DatadogTarget)) - }) - return ret, err + return &datadogTargetLister{listers.New[*v1alpha1.DatadogTarget](indexer, v1alpha1.Resource("datadogtarget"))} } // DatadogTargets returns an object that can list and get DatadogTargets. func (s *datadogTargetLister) DatadogTargets(namespace string) DatadogTargetNamespaceLister { - return datadogTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return datadogTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.DatadogTarget](s.ResourceIndexer, namespace)} } // DatadogTargetNamespaceLister helps list and get DatadogTargets. @@ -58,26 +50,5 @@ type DatadogTargetNamespaceLister interface { // datadogTargetNamespaceLister implements the DatadogTargetNamespaceLister // interface. type datadogTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all DatadogTargets in the indexer for a given namespace. -func (s datadogTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.DatadogTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.DatadogTarget)) - }) - return ret, err -} - -// Get retrieves the DatadogTarget from the indexer for a given namespace and name. -func (s datadogTargetNamespaceLister) Get(name string) (*v1alpha1.DatadogTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("datadogtarget"), name) - } - return obj.(*v1alpha1.DatadogTarget), nil + listers.ResourceIndexer[*v1alpha1.DatadogTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/httptarget.go b/pkg/client/generated/listers/targets/v1alpha1/httptarget.go index f557b3a4..ee380625 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/httptarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/httptarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type HTTPTargetLister interface { // hTTPTargetLister implements the HTTPTargetLister interface. type hTTPTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.HTTPTarget] } // NewHTTPTargetLister returns a new HTTPTargetLister. func NewHTTPTargetLister(indexer cache.Indexer) HTTPTargetLister { - return &hTTPTargetLister{indexer: indexer} -} - -// List lists all HTTPTargets in the indexer. -func (s *hTTPTargetLister) List(selector labels.Selector) (ret []*v1alpha1.HTTPTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.HTTPTarget)) - }) - return ret, err + return &hTTPTargetLister{listers.New[*v1alpha1.HTTPTarget](indexer, v1alpha1.Resource("httptarget"))} } // HTTPTargets returns an object that can list and get HTTPTargets. func (s *hTTPTargetLister) HTTPTargets(namespace string) HTTPTargetNamespaceLister { - return hTTPTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return hTTPTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.HTTPTarget](s.ResourceIndexer, namespace)} } // HTTPTargetNamespaceLister helps list and get HTTPTargets. @@ -58,26 +50,5 @@ type HTTPTargetNamespaceLister interface { // hTTPTargetNamespaceLister implements the HTTPTargetNamespaceLister // interface. type hTTPTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all HTTPTargets in the indexer for a given namespace. -func (s hTTPTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.HTTPTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.HTTPTarget)) - }) - return ret, err -} - -// Get retrieves the HTTPTarget from the indexer for a given namespace and name. -func (s hTTPTargetNamespaceLister) Get(name string) (*v1alpha1.HTTPTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("httptarget"), name) - } - return obj.(*v1alpha1.HTTPTarget), nil + listers.ResourceIndexer[*v1alpha1.HTTPTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/jiratarget.go b/pkg/client/generated/listers/targets/v1alpha1/jiratarget.go index ca85ac77..43c8e424 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/jiratarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/jiratarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type JiraTargetLister interface { // jiraTargetLister implements the JiraTargetLister interface. type jiraTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.JiraTarget] } // NewJiraTargetLister returns a new JiraTargetLister. func NewJiraTargetLister(indexer cache.Indexer) JiraTargetLister { - return &jiraTargetLister{indexer: indexer} -} - -// List lists all JiraTargets in the indexer. -func (s *jiraTargetLister) List(selector labels.Selector) (ret []*v1alpha1.JiraTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.JiraTarget)) - }) - return ret, err + return &jiraTargetLister{listers.New[*v1alpha1.JiraTarget](indexer, v1alpha1.Resource("jiratarget"))} } // JiraTargets returns an object that can list and get JiraTargets. func (s *jiraTargetLister) JiraTargets(namespace string) JiraTargetNamespaceLister { - return jiraTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return jiraTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.JiraTarget](s.ResourceIndexer, namespace)} } // JiraTargetNamespaceLister helps list and get JiraTargets. @@ -58,26 +50,5 @@ type JiraTargetNamespaceLister interface { // jiraTargetNamespaceLister implements the JiraTargetNamespaceLister // interface. type jiraTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all JiraTargets in the indexer for a given namespace. -func (s jiraTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.JiraTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.JiraTarget)) - }) - return ret, err -} - -// Get retrieves the JiraTarget from the indexer for a given namespace and name. -func (s jiraTargetNamespaceLister) Get(name string) (*v1alpha1.JiraTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("jiratarget"), name) - } - return obj.(*v1alpha1.JiraTarget), nil + listers.ResourceIndexer[*v1alpha1.JiraTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/kafkatarget.go b/pkg/client/generated/listers/targets/v1alpha1/kafkatarget.go index d9865277..d93dc8a9 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/kafkatarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/kafkatarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type KafkaTargetLister interface { // kafkaTargetLister implements the KafkaTargetLister interface. type kafkaTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.KafkaTarget] } // NewKafkaTargetLister returns a new KafkaTargetLister. func NewKafkaTargetLister(indexer cache.Indexer) KafkaTargetLister { - return &kafkaTargetLister{indexer: indexer} -} - -// List lists all KafkaTargets in the indexer. -func (s *kafkaTargetLister) List(selector labels.Selector) (ret []*v1alpha1.KafkaTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.KafkaTarget)) - }) - return ret, err + return &kafkaTargetLister{listers.New[*v1alpha1.KafkaTarget](indexer, v1alpha1.Resource("kafkatarget"))} } // KafkaTargets returns an object that can list and get KafkaTargets. func (s *kafkaTargetLister) KafkaTargets(namespace string) KafkaTargetNamespaceLister { - return kafkaTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return kafkaTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.KafkaTarget](s.ResourceIndexer, namespace)} } // KafkaTargetNamespaceLister helps list and get KafkaTargets. @@ -58,26 +50,5 @@ type KafkaTargetNamespaceLister interface { // kafkaTargetNamespaceLister implements the KafkaTargetNamespaceLister // interface. type kafkaTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all KafkaTargets in the indexer for a given namespace. -func (s kafkaTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.KafkaTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.KafkaTarget)) - }) - return ret, err -} - -// Get retrieves the KafkaTarget from the indexer for a given namespace and name. -func (s kafkaTargetNamespaceLister) Get(name string) (*v1alpha1.KafkaTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("kafkatarget"), name) - } - return obj.(*v1alpha1.KafkaTarget), nil + listers.ResourceIndexer[*v1alpha1.KafkaTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/logzmetricstarget.go b/pkg/client/generated/listers/targets/v1alpha1/logzmetricstarget.go index dc7ff193..dc325050 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/logzmetricstarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/logzmetricstarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type LogzMetricsTargetLister interface { // logzMetricsTargetLister implements the LogzMetricsTargetLister interface. type logzMetricsTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.LogzMetricsTarget] } // NewLogzMetricsTargetLister returns a new LogzMetricsTargetLister. func NewLogzMetricsTargetLister(indexer cache.Indexer) LogzMetricsTargetLister { - return &logzMetricsTargetLister{indexer: indexer} -} - -// List lists all LogzMetricsTargets in the indexer. -func (s *logzMetricsTargetLister) List(selector labels.Selector) (ret []*v1alpha1.LogzMetricsTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.LogzMetricsTarget)) - }) - return ret, err + return &logzMetricsTargetLister{listers.New[*v1alpha1.LogzMetricsTarget](indexer, v1alpha1.Resource("logzmetricstarget"))} } // LogzMetricsTargets returns an object that can list and get LogzMetricsTargets. func (s *logzMetricsTargetLister) LogzMetricsTargets(namespace string) LogzMetricsTargetNamespaceLister { - return logzMetricsTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return logzMetricsTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.LogzMetricsTarget](s.ResourceIndexer, namespace)} } // LogzMetricsTargetNamespaceLister helps list and get LogzMetricsTargets. @@ -58,26 +50,5 @@ type LogzMetricsTargetNamespaceLister interface { // logzMetricsTargetNamespaceLister implements the LogzMetricsTargetNamespaceLister // interface. type logzMetricsTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all LogzMetricsTargets in the indexer for a given namespace. -func (s logzMetricsTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.LogzMetricsTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.LogzMetricsTarget)) - }) - return ret, err -} - -// Get retrieves the LogzMetricsTarget from the indexer for a given namespace and name. -func (s logzMetricsTargetNamespaceLister) Get(name string) (*v1alpha1.LogzMetricsTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("logzmetricstarget"), name) - } - return obj.(*v1alpha1.LogzMetricsTarget), nil + listers.ResourceIndexer[*v1alpha1.LogzMetricsTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/logztarget.go b/pkg/client/generated/listers/targets/v1alpha1/logztarget.go index 8b44c160..e73a1a2f 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/logztarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/logztarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type LogzTargetLister interface { // logzTargetLister implements the LogzTargetLister interface. type logzTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.LogzTarget] } // NewLogzTargetLister returns a new LogzTargetLister. func NewLogzTargetLister(indexer cache.Indexer) LogzTargetLister { - return &logzTargetLister{indexer: indexer} -} - -// List lists all LogzTargets in the indexer. -func (s *logzTargetLister) List(selector labels.Selector) (ret []*v1alpha1.LogzTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.LogzTarget)) - }) - return ret, err + return &logzTargetLister{listers.New[*v1alpha1.LogzTarget](indexer, v1alpha1.Resource("logztarget"))} } // LogzTargets returns an object that can list and get LogzTargets. func (s *logzTargetLister) LogzTargets(namespace string) LogzTargetNamespaceLister { - return logzTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return logzTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.LogzTarget](s.ResourceIndexer, namespace)} } // LogzTargetNamespaceLister helps list and get LogzTargets. @@ -58,26 +50,5 @@ type LogzTargetNamespaceLister interface { // logzTargetNamespaceLister implements the LogzTargetNamespaceLister // interface. type logzTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all LogzTargets in the indexer for a given namespace. -func (s logzTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.LogzTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.LogzTarget)) - }) - return ret, err -} - -// Get retrieves the LogzTarget from the indexer for a given namespace and name. -func (s logzTargetNamespaceLister) Get(name string) (*v1alpha1.LogzTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("logztarget"), name) - } - return obj.(*v1alpha1.LogzTarget), nil + listers.ResourceIndexer[*v1alpha1.LogzTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/natstarget.go b/pkg/client/generated/listers/targets/v1alpha1/natstarget.go index 75368793..0d604896 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/natstarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/natstarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type NatsTargetLister interface { // natsTargetLister implements the NatsTargetLister interface. type natsTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.NatsTarget] } // NewNatsTargetLister returns a new NatsTargetLister. func NewNatsTargetLister(indexer cache.Indexer) NatsTargetLister { - return &natsTargetLister{indexer: indexer} -} - -// List lists all NatsTargets in the indexer. -func (s *natsTargetLister) List(selector labels.Selector) (ret []*v1alpha1.NatsTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NatsTarget)) - }) - return ret, err + return &natsTargetLister{listers.New[*v1alpha1.NatsTarget](indexer, v1alpha1.Resource("natstarget"))} } // NatsTargets returns an object that can list and get NatsTargets. func (s *natsTargetLister) NatsTargets(namespace string) NatsTargetNamespaceLister { - return natsTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return natsTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.NatsTarget](s.ResourceIndexer, namespace)} } // NatsTargetNamespaceLister helps list and get NatsTargets. @@ -58,26 +50,5 @@ type NatsTargetNamespaceLister interface { // natsTargetNamespaceLister implements the NatsTargetNamespaceLister // interface. type natsTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all NatsTargets in the indexer for a given namespace. -func (s natsTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NatsTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NatsTarget)) - }) - return ret, err -} - -// Get retrieves the NatsTarget from the indexer for a given namespace and name. -func (s natsTargetNamespaceLister) Get(name string) (*v1alpha1.NatsTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("natstarget"), name) - } - return obj.(*v1alpha1.NatsTarget), nil + listers.ResourceIndexer[*v1alpha1.NatsTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/salesforcetarget.go b/pkg/client/generated/listers/targets/v1alpha1/salesforcetarget.go index d7bcbeea..8eaad488 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/salesforcetarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/salesforcetarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type SalesforceTargetLister interface { // salesforceTargetLister implements the SalesforceTargetLister interface. type salesforceTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.SalesforceTarget] } // NewSalesforceTargetLister returns a new SalesforceTargetLister. func NewSalesforceTargetLister(indexer cache.Indexer) SalesforceTargetLister { - return &salesforceTargetLister{indexer: indexer} -} - -// List lists all SalesforceTargets in the indexer. -func (s *salesforceTargetLister) List(selector labels.Selector) (ret []*v1alpha1.SalesforceTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.SalesforceTarget)) - }) - return ret, err + return &salesforceTargetLister{listers.New[*v1alpha1.SalesforceTarget](indexer, v1alpha1.Resource("salesforcetarget"))} } // SalesforceTargets returns an object that can list and get SalesforceTargets. func (s *salesforceTargetLister) SalesforceTargets(namespace string) SalesforceTargetNamespaceLister { - return salesforceTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return salesforceTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.SalesforceTarget](s.ResourceIndexer, namespace)} } // SalesforceTargetNamespaceLister helps list and get SalesforceTargets. @@ -58,26 +50,5 @@ type SalesforceTargetNamespaceLister interface { // salesforceTargetNamespaceLister implements the SalesforceTargetNamespaceLister // interface. type salesforceTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all SalesforceTargets in the indexer for a given namespace. -func (s salesforceTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SalesforceTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.SalesforceTarget)) - }) - return ret, err -} - -// Get retrieves the SalesforceTarget from the indexer for a given namespace and name. -func (s salesforceTargetNamespaceLister) Get(name string) (*v1alpha1.SalesforceTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("salesforcetarget"), name) - } - return obj.(*v1alpha1.SalesforceTarget), nil + listers.ResourceIndexer[*v1alpha1.SalesforceTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/servicenowtarget.go b/pkg/client/generated/listers/targets/v1alpha1/servicenowtarget.go index 8353d4c4..0736b79e 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/servicenowtarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/servicenowtarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type ServiceNowTargetLister interface { // serviceNowTargetLister implements the ServiceNowTargetLister interface. type serviceNowTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ServiceNowTarget] } // NewServiceNowTargetLister returns a new ServiceNowTargetLister. func NewServiceNowTargetLister(indexer cache.Indexer) ServiceNowTargetLister { - return &serviceNowTargetLister{indexer: indexer} -} - -// List lists all ServiceNowTargets in the indexer. -func (s *serviceNowTargetLister) List(selector labels.Selector) (ret []*v1alpha1.ServiceNowTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ServiceNowTarget)) - }) - return ret, err + return &serviceNowTargetLister{listers.New[*v1alpha1.ServiceNowTarget](indexer, v1alpha1.Resource("servicenowtarget"))} } // ServiceNowTargets returns an object that can list and get ServiceNowTargets. func (s *serviceNowTargetLister) ServiceNowTargets(namespace string) ServiceNowTargetNamespaceLister { - return serviceNowTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return serviceNowTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.ServiceNowTarget](s.ResourceIndexer, namespace)} } // ServiceNowTargetNamespaceLister helps list and get ServiceNowTargets. @@ -58,26 +50,5 @@ type ServiceNowTargetNamespaceLister interface { // serviceNowTargetNamespaceLister implements the ServiceNowTargetNamespaceLister // interface. type serviceNowTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ServiceNowTargets in the indexer for a given namespace. -func (s serviceNowTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ServiceNowTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ServiceNowTarget)) - }) - return ret, err -} - -// Get retrieves the ServiceNowTarget from the indexer for a given namespace and name. -func (s serviceNowTargetNamespaceLister) Get(name string) (*v1alpha1.ServiceNowTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("servicenowtarget"), name) - } - return obj.(*v1alpha1.ServiceNowTarget), nil + listers.ResourceIndexer[*v1alpha1.ServiceNowTarget] } diff --git a/pkg/client/generated/listers/targets/v1alpha1/splunktarget.go b/pkg/client/generated/listers/targets/v1alpha1/splunktarget.go index 7372ccef..e69fee69 100644 --- a/pkg/client/generated/listers/targets/v1alpha1/splunktarget.go +++ b/pkg/client/generated/listers/targets/v1alpha1/splunktarget.go @@ -4,8 +4,8 @@ package v1alpha1 import ( v1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -22,25 +22,17 @@ type SplunkTargetLister interface { // splunkTargetLister implements the SplunkTargetLister interface. type splunkTargetLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.SplunkTarget] } // NewSplunkTargetLister returns a new SplunkTargetLister. func NewSplunkTargetLister(indexer cache.Indexer) SplunkTargetLister { - return &splunkTargetLister{indexer: indexer} -} - -// List lists all SplunkTargets in the indexer. -func (s *splunkTargetLister) List(selector labels.Selector) (ret []*v1alpha1.SplunkTarget, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.SplunkTarget)) - }) - return ret, err + return &splunkTargetLister{listers.New[*v1alpha1.SplunkTarget](indexer, v1alpha1.Resource("splunktarget"))} } // SplunkTargets returns an object that can list and get SplunkTargets. func (s *splunkTargetLister) SplunkTargets(namespace string) SplunkTargetNamespaceLister { - return splunkTargetNamespaceLister{indexer: s.indexer, namespace: namespace} + return splunkTargetNamespaceLister{listers.NewNamespaced[*v1alpha1.SplunkTarget](s.ResourceIndexer, namespace)} } // SplunkTargetNamespaceLister helps list and get SplunkTargets. @@ -58,26 +50,5 @@ type SplunkTargetNamespaceLister interface { // splunkTargetNamespaceLister implements the SplunkTargetNamespaceLister // interface. type splunkTargetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all SplunkTargets in the indexer for a given namespace. -func (s splunkTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SplunkTarget, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.SplunkTarget)) - }) - return ret, err -} - -// Get retrieves the SplunkTarget from the indexer for a given namespace and name. -func (s splunkTargetNamespaceLister) Get(name string) (*v1alpha1.SplunkTarget, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("splunktarget"), name) - } - return obj.(*v1alpha1.SplunkTarget), nil + listers.ResourceIndexer[*v1alpha1.SplunkTarget] } diff --git a/pkg/routing/reconciler/filter/adapter.go b/pkg/routing/reconciler/filter/adapter.go deleted file mode 100644 index 3efcedc2..00000000 --- a/pkg/routing/reconciler/filter/adapter.go +++ /dev/null @@ -1,32 +0,0 @@ -package filter - -import ( - "knative.dev/eventing/pkg/reconciler/source" - "knative.dev/pkg/apis" - servingv1 "knative.dev/serving/pkg/apis/serving/v1" - - commonv1alpha1 "github.com/zeiss/typhoon/pkg/apis/common/v1alpha1" - common "github.com/zeiss/typhoon/pkg/reconciler" - "github.com/zeiss/typhoon/pkg/reconciler/resource" -) - -// adapterConfig contains properties used to configure the router's adapter. -// These are automatically populated by envconfig. -type adapterConfig struct { - // Container image - Image string `default:"gchr.io/zeiss/typhoon/filter-adapter"` - - // Configuration accessor for logging/metrics/tracing - configs source.ConfigAccessor -} - -// Verify that Reconciler implements common.AdapterBuilder. -var _ common.AdapterBuilder[*servingv1.Service] = (*Reconciler)(nil) - -// BuildAdapter implements common.AdapterBuilder. -func (r *Reconciler) BuildAdapter(rtr commonv1alpha1.Reconcilable, _ *apis.URL) (*servingv1.Service, error) { - return common.NewMTAdapterKnService(rtr, - resource.Image(r.adapterCfg.Image), - resource.EnvVars(r.adapterCfg.configs.ToEnvVars()...), - ), nil -} diff --git a/pkg/routing/reconciler/filter/controller.go b/pkg/routing/reconciler/filter/controller.go deleted file mode 100644 index 82676237..00000000 --- a/pkg/routing/reconciler/filter/controller.go +++ /dev/null @@ -1,53 +0,0 @@ -package filter - -import ( - "context" - - "knative.dev/eventing/pkg/reconciler/source" - "knative.dev/pkg/configmap" - "knative.dev/pkg/controller" - "knative.dev/pkg/logging" - - "github.com/kelseyhightower/envconfig" - "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" - informerv1alpha1 "github.com/zeiss/typhoon/pkg/client/generated/injection/informers/routing/v1alpha1/filter" - reconcilerv1alpha1 "github.com/zeiss/typhoon/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter" - common "github.com/zeiss/typhoon/pkg/reconciler" -) - -// NewController creates a Reconciler and returns the result of NewImpl. -func NewController( - ctx context.Context, - cmw configmap.Watcher, -) *controller.Impl { - typ := (*v1alpha1.Filter)(nil) - app := common.ComponentName(typ) - - // Calling envconfig.Process() with a prefix appends that prefix - // (uppercased) to the Go field name, e.g. MYSOURCE_IMAGE. - adapterCfg := &adapterConfig{ - configs: source.WatchConfigurations(ctx, app, cmw), - } - envconfig.MustProcess(app, adapterCfg) - - informer := informerv1alpha1.Get(ctx) - - r := &Reconciler{ - adapterCfg: adapterCfg, - } - impl := reconcilerv1alpha1.NewImpl(ctx, r) - - logger := logging.FromContext(ctx) - - r.base = common.NewMTGenericServiceReconciler[*v1alpha1.Filter]( - ctx, - typ, - impl.Tracker, - common.EnqueueObjectsInNamespaceOf(informer.Informer(), impl.FilteredGlobalResync, logger), - informer.Lister().Filters, - ) - - informer.Informer().AddEventHandler(controller.HandleAll(impl.Enqueue)) - - return impl -} diff --git a/pkg/routing/reconciler/filter/reconciler.go b/pkg/routing/reconciler/filter/reconciler.go deleted file mode 100644 index 5f364cbb..00000000 --- a/pkg/routing/reconciler/filter/reconciler.go +++ /dev/null @@ -1,31 +0,0 @@ -package filter - -import ( - "context" - - "knative.dev/pkg/reconciler" - - commonv1alpha1 "github.com/zeiss/typhoon/pkg/apis/common/v1alpha1" - "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" - reconcilerv1alpha1 "github.com/zeiss/typhoon/pkg/client/generated/injection/reconciler/routing/v1alpha1/filter" - listersv1alpha1 "github.com/zeiss/typhoon/pkg/client/generated/listers/routing/v1alpha1" - common "github.com/zeiss/typhoon/pkg/reconciler" -) - -// Reconciler implements addressableservicereconciler.Interface for -// AddressableService resources. -type Reconciler struct { - base common.GenericServiceReconciler[*v1alpha1.Filter, listersv1alpha1.FilterNamespaceLister] - adapterCfg *adapterConfig -} - -// Check that our Reconciler implements Interface -var _ reconcilerv1alpha1.Interface = (*Reconciler)(nil) - -// ReconcileKind implements Interface.ReconcileKind. -func (r *Reconciler) ReconcileKind(ctx context.Context, o *v1alpha1.Filter) reconciler.Event { - // inject component instance into context for usage in reconciliation logic - ctx = commonv1alpha1.WithReconcilable(ctx, o) - - return r.base.ReconcileAdapter(ctx, r) -} diff --git a/tools/go.mod b/tools/go.mod index 8f379637..f80b6c7d 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -13,7 +13,7 @@ require ( github.com/zeiss/pkg v0.1.19 gotest.tools/gotestsum v1.12.0 k8s.io/code-generator v0.31.3 - knative.dev/pkg v0.0.0-20240222182851-7594067e0eac + knative.dev/pkg v0.0.0-20241128013618-f3ab5605e542 mvdan.cc/gofumpt v0.7.0 ) @@ -166,7 +166,7 @@ require ( github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/elliotchance/orderedmap/v2 v2.2.0 // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/envoyproxy/go-control-plane v0.13.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect @@ -285,7 +285,6 @@ require ( github.com/jjti/go-spancheck v0.6.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect github.com/julz/importas v0.1.0 // indirect github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect @@ -321,8 +320,6 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/moricho/tparallel v0.3.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect @@ -469,7 +466,7 @@ require ( google.golang.org/genproto v0.0.0-20241113202542-65e8d215514f // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect - google.golang.org/grpc v1.67.1 // indirect + google.golang.org/grpc v1.68.0 // indirect google.golang.org/grpc/stats/opentelemetry v0.0.0-20240907200651-3ffb98b2c93a // indirect google.golang.org/protobuf v1.35.2 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect @@ -481,11 +478,11 @@ require ( helm.sh/helm v2.17.0+incompatible // indirect honnef.co/go/tools v0.5.1 // indirect k8s.io/apimachinery v0.31.3 // indirect - k8s.io/gengo v0.0.0-20240129211411-f967bbeff4b4 // indirect + k8s.io/gengo v0.0.0-20240404160639-a0386bf69313 // indirect k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect k8s.io/helm v2.17.0+incompatible // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect + k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect lukechampine.com/blake3 v1.2.1 // indirect mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect diff --git a/tools/go.sum b/tools/go.sum index 6140c8dd..cc15c584 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -364,8 +364,8 @@ github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcej github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/elliotchance/orderedmap/v2 v2.2.0 h1:7/2iwO98kYT4XkOjA9mBEIwvi4KpGB4cyHeOFOnj4Vk= github.com/elliotchance/orderedmap/v2 v2.2.0/go.mod h1:85lZyVbpGaGvHvnKa7Qhx7zncAdBIBq6u56Hb1PRU5Q= -github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= +github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -721,7 +721,6 @@ github.com/jmhodges/clock v1.2.0 h1:eq4kys+NI0PLngzaHEe7AmPT90XMGIEySD1JfV1PDIs= github.com/jmhodges/clock v1.2.0/go.mod h1:qKjhA7x7u/lQpPB1XAqX1b1lCI/w3/fNuYpI/ZjLynI= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= @@ -821,9 +820,7 @@ github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4 github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= 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 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= @@ -1456,8 +1453,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= +google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= google.golang.org/grpc/stats/opentelemetry v0.0.0-20240907200651-3ffb98b2c93a h1:UIpYSuWdWHSzjwcAFRLjKcPXFZVVLXGEM23W+NWqipw= google.golang.org/grpc/stats/opentelemetry v0.0.0-20240907200651-3ffb98b2c93a/go.mod h1:9i1T9n4ZinTUZGgzENMi8MDDgbGC5mqTS75JAv6xN3A= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1517,8 +1514,8 @@ k8s.io/apimachinery v0.31.3 h1:6l0WhcYgasZ/wk9ktLq5vLaoXJJr5ts6lkaQzgeYPq4= k8s.io/apimachinery v0.31.3/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/code-generator v0.31.3 h1:Pj0fYOBms+ZrsulLi4DMsCEx1jG8fWKRLy44onHsLBI= k8s.io/code-generator v0.31.3/go.mod h1:/umCIlT84g1+Yu5ZXtP1KGSRTnGiIzzX5AzUAxsNlts= -k8s.io/gengo v0.0.0-20240129211411-f967bbeff4b4 h1:izq7u3SJBdOAuA5YYe1/PIp9jczrih/jGlKRRt0G7bQ= -k8s.io/gengo v0.0.0-20240129211411-f967bbeff4b4/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20240404160639-a0386bf69313 h1:wBIDZID8ju9pwOiLlV22YYKjFGtiNSWgHf5CnKLRUuM= +k8s.io/gengo v0.0.0-20240404160639-a0386bf69313/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= k8s.io/helm v2.17.0+incompatible h1:Bpn6o1wKLYqKM3+Osh8e+1/K2g/GsQJ4F4yNF2+deao= @@ -1526,12 +1523,12 @@ k8s.io/helm v2.17.0+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 h1:1Wof1cGQgA5pqgo8MxKPtf+qN6Sh/0JzznmeGPm1HnE= +k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8/go.mod h1:Os6V6dZwLNii3vxFpxcNaTmH8LJJBkOTg1N0tOA0fvA= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -knative.dev/pkg v0.0.0-20240222182851-7594067e0eac h1:YCcILEB2e7ve99eEYyIiF6wYwQAnYWTZ/ukn3CoOvus= -knative.dev/pkg v0.0.0-20240222182851-7594067e0eac/go.mod h1:ShEiTxuj4Dxg5pz7A0eNRdiyurQHImirTUP9trki6Xo= +knative.dev/pkg v0.0.0-20241128013618-f3ab5605e542 h1:x5cEwa34aOgQDnSTEE+UtRk5lND0cvb8KbVBUShwNuI= +knative.dev/pkg v0.0.0-20241128013618-f3ab5605e542/go.mod h1:C2dxK66GlycMOS0SKqv0SMAnWkxsYbG4hkH32Xg1qD0= lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=