From f2baa1763a7e418b86e6d2e3969012e8a7d19e5d Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Fri, 26 Jun 2020 12:49:28 -0700 Subject: [PATCH] [master] Auto-update dependencies (#1353) Produced via: `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh` /assign grantr ian-mi nachocano /cc grantr ian-mi nachocano --- go.mod | 8 +- go.sum | 21 +- .../eventing/pkg/apis/flows/v1/doc.go | 20 + .../pkg/apis/flows/v1/parallel_conversion.go | 34 ++ .../pkg/apis/flows/v1/parallel_defaults.go | 56 +++ .../pkg/apis/flows/v1/parallel_lifecycle.go | 205 +++++++++ .../pkg/apis/flows/v1/parallel_types.go | 164 +++++++ .../pkg/apis/flows/v1/parallel_validation.go | 68 +++ .../eventing/pkg/apis/flows/v1/register.go | 55 +++ .../pkg/apis/flows/v1/sequence_conversion.go | 34 ++ .../pkg/apis/flows/v1/sequence_defaults.go | 58 +++ .../pkg/apis/flows/v1/sequence_lifecycle.go | 174 +++++++ .../pkg/apis/flows/v1/sequence_types.go | 145 ++++++ .../pkg/apis/flows/v1/sequence_validation.go | 72 +++ .../pkg/apis/flows/v1/test_helpers.go | 37 ++ .../apis/flows/v1/zz_generated.deepcopy.go | 419 +++++++++++++++++ .../apis/messaging/v1/channel_conversion.go | 34 ++ .../pkg/apis/messaging/v1/channel_defaults.go | 58 +++ .../apis/messaging/v1/channel_lifecycle.go | 124 +++++ .../messaging/v1/channel_template_types.go | 47 ++ .../pkg/apis/messaging/v1/channel_types.go | 97 ++++ .../apis/messaging/v1/channel_validation.go | 81 ++++ .../eventing/pkg/apis/messaging/v1/doc.go | 24 + .../v1/in_memory_channel_conversion.go | 34 ++ .../v1/in_memory_channel_defaults.go | 43 ++ .../v1/in_memory_channel_lifecycle.go | 152 ++++++ .../messaging/v1/in_memory_channel_types.go | 91 ++++ .../v1/in_memory_channel_validation.go | 56 +++ .../pkg/apis/messaging/v1/register.go | 57 +++ .../v1/subscribable_channelable_validation.go | 85 ++++ .../messaging/v1/subscription_conversion.go | 34 ++ .../messaging/v1/subscription_defaults.go | 29 ++ .../messaging/v1/subscription_lifecycle.go | 115 +++++ .../apis/messaging/v1/subscription_types.go | 156 +++++++ .../messaging/v1/subscription_validation.go | 94 ++++ .../messaging/v1/zz_generated.deepcopy.go | 431 ++++++++++++++++++ .../messaging/v1beta1/channel_conversion.go | 81 +++- .../client/clientset/versioned/clientset.go | 28 ++ .../versioned/fake/clientset_generated.go | 14 + .../clientset/versioned/fake/register.go | 4 + .../clientset/versioned/scheme/register.go | 4 + .../clientset/versioned/typed/flows/v1/doc.go | 20 + .../versioned/typed/flows/v1/fake/doc.go | 20 + .../typed/flows/v1/fake/fake_flows_client.go | 44 ++ .../typed/flows/v1/fake/fake_parallel.go | 140 ++++++ .../typed/flows/v1/fake/fake_sequence.go | 140 ++++++ .../versioned/typed/flows/v1/flows_client.go | 94 ++++ .../typed/flows/v1/generated_expansion.go | 23 + .../versioned/typed/flows/v1/parallel.go | 191 ++++++++ .../versioned/typed/flows/v1/sequence.go | 191 ++++++++ .../versioned/typed/messaging/v1/channel.go | 191 ++++++++ .../versioned/typed/messaging/v1/doc.go | 20 + .../versioned/typed/messaging/v1/fake/doc.go | 20 + .../typed/messaging/v1/fake/fake_channel.go | 140 ++++++ .../messaging/v1/fake/fake_inmemorychannel.go | 140 ++++++ .../v1/fake/fake_messaging_client.go | 48 ++ .../messaging/v1/fake/fake_subscription.go | 140 ++++++ .../typed/messaging/v1/generated_expansion.go | 25 + .../typed/messaging/v1/inmemorychannel.go | 191 ++++++++ .../typed/messaging/v1/messaging_client.go | 99 ++++ .../typed/messaging/v1/subscription.go | 191 ++++++++ .../externalversions/flows/interface.go | 8 + .../externalversions/flows/v1/interface.go | 52 +++ .../externalversions/flows/v1/parallel.go | 89 ++++ .../externalversions/flows/v1/sequence.go | 89 ++++ .../informers/externalversions/generic.go | 16 + .../externalversions/messaging/interface.go | 8 + .../externalversions/messaging/v1/channel.go | 89 ++++ .../messaging/v1/inmemorychannel.go | 89 ++++ .../messaging/v1/interface.go | 59 +++ .../messaging/v1/subscription.go | 89 ++++ .../listers/flows/v1/expansion_generated.go | 35 ++ .../pkg/client/listers/flows/v1/parallel.go | 94 ++++ .../pkg/client/listers/flows/v1/sequence.go | 94 ++++ .../client/listers/messaging/v1/channel.go | 94 ++++ .../messaging/v1/expansion_generated.go | 43 ++ .../listers/messaging/v1/inmemorychannel.go | 94 ++++ .../listers/messaging/v1/subscription.go | 94 ++++ .../knative.dev/pkg/leaderelection/config.go | 8 + .../knative.dev/pkg/leaderelection/context.go | 59 ++- .../knative.dev/pkg/leaderelection/ordinal.go | 39 ++ vendor/modules.txt | 20 +- 82 files changed, 6835 insertions(+), 38 deletions(-) create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/doc.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_conversion.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_defaults.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_types.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_validation.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/register.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_conversion.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_defaults.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_types.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_validation.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/test_helpers.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/flows/v1/zz_generated.deepcopy.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_conversion.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_defaults.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_lifecycle.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_template_types.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_types.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_validation.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/doc.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_conversion.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_defaults.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_lifecycle.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_types.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_validation.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/register.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscribable_channelable_validation.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_conversion.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_defaults.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_lifecycle.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_types.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_validation.go create mode 100644 vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/doc.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/doc.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_flows_client.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_parallel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_sequence.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/flows_client.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/generated_expansion.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/parallel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/sequence.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/channel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/doc.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/doc.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_channel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_inmemorychannel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_messaging_client.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_subscription.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/generated_expansion.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/inmemorychannel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/messaging_client.go create mode 100644 vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/subscription.go create mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/interface.go create mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/parallel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/sequence.go create mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/channel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/inmemorychannel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/interface.go create mode 100644 vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/subscription.go create mode 100644 vendor/knative.dev/eventing/pkg/client/listers/flows/v1/expansion_generated.go create mode 100644 vendor/knative.dev/eventing/pkg/client/listers/flows/v1/parallel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/listers/flows/v1/sequence.go create mode 100644 vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/channel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/expansion_generated.go create mode 100644 vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/inmemorychannel.go create mode 100644 vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/subscription.go create mode 100644 vendor/knative.dev/pkg/leaderelection/ordinal.go diff --git a/go.mod b/go.mod index 36bb7c6257..3a9818046f 100644 --- a/go.mod +++ b/go.mod @@ -30,10 +30,10 @@ require ( k8s.io/api v0.18.1 k8s.io/apimachinery v0.18.1 k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible - knative.dev/eventing v0.15.1-0.20200625112228-88aa030c747f - knative.dev/pkg v0.0.0-20200624210428-eb05e8dd5b5b - knative.dev/serving v0.15.1-0.20200625123828-2949259bd49e - knative.dev/test-infra v0.0.0-20200624184627-7eae2aae38e4 // indirect + knative.dev/eventing v0.15.1-0.20200625220028-1e3a03b620b6 + knative.dev/pkg v0.0.0-20200626022628-f1ee372577e1 + knative.dev/serving v0.15.1-0.20200626061427-ce9c1723e56a + knative.dev/test-infra v0.0.0-20200625195728-62651036b559 // indirect sigs.k8s.io/yaml v1.2.0 ) diff --git a/go.sum b/go.sum index df4d3ef0d7..26dade27ad 100644 --- a/go.sum +++ b/go.sum @@ -1548,12 +1548,12 @@ k8s.io/utils v0.0.0-20200124190032-861946025e34/go.mod h1:sZAwmy6armz5eXlNoLmJcl knative.dev/caching v0.0.0-20190719140829-2032732871ff/go.mod h1:dHXFU6CGlLlbzaWc32g80cR92iuBSpsslDNBWI8C7eg= knative.dev/caching v0.0.0-20200116200605-67bca2c83dfa/go.mod h1:dHXFU6CGlLlbzaWc32g80cR92iuBSpsslDNBWI8C7eg= knative.dev/caching v0.0.0-20200606210318-787aec80f71c/go.mod h1:rWD+0zSqcE7L//jJyt866xtXsOi9hCdB0FoD4w2Rygg= -knative.dev/eventing v0.15.1-0.20200625112228-88aa030c747f h1:8/VL8zHWQxa2VRsA1MC2OT2Hig1Yji8W+2bpV/F1Z78= -knative.dev/eventing v0.15.1-0.20200625112228-88aa030c747f/go.mod h1:hEWmYlRB75MtTa7rPhenkl4HACHd1VkKsgDB52uu1Z0= +knative.dev/eventing v0.15.1-0.20200625220028-1e3a03b620b6 h1:pdpg/78idzQcmb4SLDgCdVhn6E/rnax8sL0kFYPWcIE= +knative.dev/eventing v0.15.1-0.20200625220028-1e3a03b620b6/go.mod h1:ukYDH75Mpnr7kcLVfqh9z4zVeXKbUOzhVpciOndB95w= knative.dev/eventing-contrib v0.6.1-0.20190723221543-5ce18048c08b/go.mod h1:SnXZgSGgMSMLNFTwTnpaOH7hXDzTFtw0J8OmHflNx3g= knative.dev/eventing-contrib v0.11.2/go.mod h1:SnXZgSGgMSMLNFTwTnpaOH7hXDzTFtw0J8OmHflNx3g= -knative.dev/networking v0.0.0-20200623230227-53e376c3ec4c h1:X3745bB+9kan4DEjW55cZGZmo1OF5b92hINooN3BjQI= -knative.dev/networking v0.0.0-20200623230227-53e376c3ec4c/go.mod h1:MkVj0cihXadJkbhF8FT7fKr/pjU5oErvD687/Z07UeE= +knative.dev/networking v0.0.0-20200624161427-341a83759c17 h1:3t4xgm1d46lqNYbR4jeVj7EbEnwuHQOAag5QbnFY2Qo= +knative.dev/networking v0.0.0-20200624161427-341a83759c17/go.mod h1:490TiiMziOMk4zEAFQ+qo0dN1vKrW+dMARgJrJ+JOpQ= knative.dev/pkg v0.0.0-20191101194912-56c2594e4f11/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q= knative.dev/pkg v0.0.0-20191111150521-6d806b998379/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q= knative.dev/pkg v0.0.0-20200207155214-fef852970f43/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q= @@ -1567,16 +1567,16 @@ knative.dev/pkg v0.0.0-20200520073958-94316e20e860/go.mod h1:QgNZTxnwpB/oSpNcfnL knative.dev/pkg v0.0.0-20200603222317-b79e4a24ca50 h1:sbJMCCtOENPgfE5dUSwBUxZtJzhfqORhExyWFX7L0Fk= knative.dev/pkg v0.0.0-20200603222317-b79e4a24ca50/go.mod h1:8IfPj/lpuKHHg82xZCl2wuFZ3BM96To72sN1W8T9wjQ= knative.dev/pkg v0.0.0-20200611204322-2ddcfef739a2/go.mod h1:rA+FklsrVahwF4a+D63NyHJlzDoAFH81K4J5CYuE3bA= -knative.dev/pkg v0.0.0-20200619020725-7df8fc5d7743/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= knative.dev/pkg v0.0.0-20200623024526-fb0320d9287e h1:fmsw4i/We4S9yyaZadL2z8DKDIz7XzcY/v4yPGUmUA4= knative.dev/pkg v0.0.0-20200623024526-fb0320d9287e/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= knative.dev/pkg v0.0.0-20200623204627-e0a0d63a9e86/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= -knative.dev/pkg v0.0.0-20200624155427-5be32bbb99ab/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= knative.dev/pkg v0.0.0-20200624210428-eb05e8dd5b5b h1:NFi5BVmuZ81bWigwn3s/NNaf+GeeOGtNlADAbXPYg+E= knative.dev/pkg v0.0.0-20200624210428-eb05e8dd5b5b/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= +knative.dev/pkg v0.0.0-20200626022628-f1ee372577e1 h1:4Fi/WnI7uwbop8gjebSfJbPdJd20XWt66ugzEYunlUA= +knative.dev/pkg v0.0.0-20200626022628-f1ee372577e1/go.mod h1:DquzK0hsLDcg2q63Sn+CngAyRwv4cKMpt5F19YzBfb0= knative.dev/sample-controller v0.0.0-20200510050845-bf7c19498b7e/go.mod h1:D2ZDLrR9Dq9LiiVN7TatzI7WMcEPgk1MHbbhgBKE6W8= -knative.dev/serving v0.15.1-0.20200625123828-2949259bd49e h1:x8ICcdUlkB7NQiGpT9/lpjQR3YVy9iPck0k1D1wbl2o= -knative.dev/serving v0.15.1-0.20200625123828-2949259bd49e/go.mod h1:FtRBxbs8obwxnQKKM6GXHxAdVpmum7acaeUu6KSSfDw= +knative.dev/serving v0.15.1-0.20200626061427-ce9c1723e56a h1:d/4jWE5/Upn2EkXwRNFtZXEMgx0nqBVNFrEZG6AUJ80= +knative.dev/serving v0.15.1-0.20200626061427-ce9c1723e56a/go.mod h1:sA9NfYRrX2qLfdVUUnjqkqr5ojU2t8gnPK0ixcNXW9M= knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ= knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU= knative.dev/test-infra v0.0.0-20200508015845-8d7d46a46176/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE= @@ -1588,12 +1588,11 @@ knative.dev/test-infra v0.0.0-20200522180958-6a0a9b9d893a/go.mod h1:n9eQkzmSNj8B knative.dev/test-infra v0.0.0-20200606045118-14ebc4a42974/go.mod h1://I6IZIF0QDgs5wotU243ZZ5cTpm6/GthayjUenBBc0= knative.dev/test-infra v0.0.0-20200617235125-6382dba95484 h1:5D1Fm6aA1T1QQXLb1HkJ5t8gB9pTkhLYak1CCqIP+pE= knative.dev/test-infra v0.0.0-20200617235125-6382dba95484/go.mod h1:+BfrTJpc++rH30gX/C0QY6NT2eYVzycll52uw6CrQnc= -knative.dev/test-infra v0.0.0-20200623005026-1f7e5f05c52b h1:qQTd9xCiV3/PVt2LsmELMVL2gT4eAScMaFrPqiQnt1I= -knative.dev/test-infra v0.0.0-20200623005026-1f7e5f05c52b/go.mod h1:H8QEB2Y35+vAuVtDbn7QBD+NQr9zQbbxNiovCLNH7F4= knative.dev/test-infra v0.0.0-20200623231727-6d5d6aeb457c/go.mod h1:qKM6vO6hD6aa0ZYGDdyr5YiXPQMhbix1K8UWPUvVlIE= -knative.dev/test-infra v0.0.0-20200624170028-94d227b0f50c/go.mod h1:6w3uf0+KfozLkrysBm3QqONrEMC6Uo/oEgS2BCdHJXo= knative.dev/test-infra v0.0.0-20200624184627-7eae2aae38e4 h1:eB6B7ER/QPKNC2bBtkWmwzcGBp9f0/DQhRdNvxxuEt8= knative.dev/test-infra v0.0.0-20200624184627-7eae2aae38e4/go.mod h1:6w3uf0+KfozLkrysBm3QqONrEMC6Uo/oEgS2BCdHJXo= +knative.dev/test-infra v0.0.0-20200625195728-62651036b559 h1:UnUP8ygaXWLi3LWSpoOvhLcHbOE/yf2De57/aBZIzTQ= +knative.dev/test-infra v0.0.0-20200625195728-62651036b559/go.mod h1:HZw00KOJoOIzWOSF6tn+0jfJZHpXRCIZkHooc+hh7yg= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/doc.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/doc.go new file mode 100644 index 0000000000..ab319b35b3 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1 is the v1 version of the API. +// +k8s:deepcopy-gen=package +// +groupName=flows.knative.dev +package v1 diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_conversion.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_conversion.go new file mode 100644 index 0000000000..3b0f9f85cd --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_conversion.go @@ -0,0 +1,34 @@ +/* +Copyright 2020 The Knative Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + "fmt" + + "knative.dev/pkg/apis" +) + +// ConvertTo implements apis.Convertible +func (source *Parallel) ConvertTo(ctx context.Context, sink apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", sink) +} + +// ConvertFrom implements apis.Convertible +func (sink *Parallel) ConvertFrom(ctx context.Context, source apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", source) +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_defaults.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_defaults.go new file mode 100644 index 0000000000..9f19c3b5a2 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_defaults.go @@ -0,0 +1,56 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "context" + + "knative.dev/eventing/pkg/apis/messaging/config" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + "knative.dev/pkg/apis" +) + +func (p *Parallel) SetDefaults(ctx context.Context) { + withNS := apis.WithinParent(ctx, p.ObjectMeta) + if p != nil && p.Spec.ChannelTemplate == nil { + cfg := config.FromContextOrDefaults(ctx) + c, err := cfg.ChannelDefaults.GetChannelConfig(apis.ParentMeta(ctx).Namespace) + + if err == nil { + p.Spec.ChannelTemplate = &messagingv1.ChannelTemplateSpec{ + TypeMeta: c.TypeMeta, + Spec: c.Spec, + } + } + } + p.Spec.SetDefaults(withNS) +} + +func (ps *ParallelSpec) SetDefaults(ctx context.Context) { + for _, branch := range ps.Branches { + if branch.Filter != nil { + branch.Filter.SetDefaults(ctx) + } + branch.Subscriber.SetDefaults(ctx) + if branch.Reply != nil { + branch.Reply.SetDefaults(ctx) + } + } + if ps.Reply != nil { + ps.Reply.SetDefaults(ctx) + } +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go new file mode 100644 index 0000000000..18857479ab --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go @@ -0,0 +1,205 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + duckv1 "knative.dev/eventing/pkg/apis/duck/v1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + "knative.dev/pkg/apis" + pkgduckv1 "knative.dev/pkg/apis/duck/v1" +) + +var pCondSet = apis.NewLivingConditionSet(ParallelConditionReady, ParallelConditionChannelsReady, ParallelConditionSubscriptionsReady, ParallelConditionAddressable) + +const ( + // ParallelConditionReady has status True when all subconditions below have been set to True. + ParallelConditionReady = apis.ConditionReady + + // ParallelConditionChannelsReady has status True when all the channels created as part of + // this parallel are ready. + ParallelConditionChannelsReady apis.ConditionType = "ChannelsReady" + + // ParallelConditionSubscriptionsReady has status True when all the subscriptions created as part of + // this parallel are ready. + ParallelConditionSubscriptionsReady apis.ConditionType = "SubscriptionsReady" + + // ParallelConditionAddressable has status true when this Parallel meets + // the Addressable contract and has a non-empty hostname. + ParallelConditionAddressable apis.ConditionType = "Addressable" +) + +// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. +func (*Parallel) GetConditionSet() apis.ConditionSet { + return pCondSet +} + +// GetGroupVersionKind returns GroupVersionKind for Parallel +func (*Parallel) GetGroupVersionKind() schema.GroupVersionKind { + return SchemeGroupVersion.WithKind("Parallel") +} + +// GetUntypedSpec returns the spec of the Parallel. +func (p *Parallel) GetUntypedSpec() interface{} { + return p.Spec +} + +// GetCondition returns the condition currently associated with the given type, or nil. +func (ps *ParallelStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return pCondSet.Manage(ps).GetCondition(t) +} + +// IsReady returns true if the resource is ready overall. +func (ps *ParallelStatus) IsReady() bool { + return pCondSet.Manage(ps).IsHappy() +} + +// InitializeConditions sets relevant unset conditions to Unknown state. +func (ps *ParallelStatus) InitializeConditions() { + pCondSet.Manage(ps).InitializeConditions() +} + +// PropagateSubscriptionStatuses sets the ParallelConditionSubscriptionsReady based on +// the status of the incoming subscriptions. +func (ps *ParallelStatus) PropagateSubscriptionStatuses(filterSubscriptions []*messagingv1.Subscription, subscriptions []*messagingv1.Subscription) { + if ps.BranchStatuses == nil { + ps.BranchStatuses = make([]ParallelBranchStatus, len(subscriptions)) + } + allReady := true + // If there are no subscriptions, treat that as a False branch. Could go either way, but this seems right. + if len(subscriptions) == 0 { + allReady = false + } + + for i, s := range subscriptions { + ps.BranchStatuses[i].SubscriptionStatus = ParallelSubscriptionStatus{ + Subscription: corev1.ObjectReference{ + APIVersion: s.APIVersion, + Kind: s.Kind, + Name: s.Name, + Namespace: s.Namespace, + }, + } + + readyCondition := s.Status.GetTopLevelCondition() + if readyCondition != nil { + ps.BranchStatuses[i].SubscriptionStatus.ReadyCondition = *readyCondition + if readyCondition.Status != corev1.ConditionTrue { + allReady = false + } + } else { + allReady = false + } + + fs := filterSubscriptions[i] + ps.BranchStatuses[i].FilterSubscriptionStatus = ParallelSubscriptionStatus{ + Subscription: corev1.ObjectReference{ + APIVersion: fs.APIVersion, + Kind: fs.Kind, + Name: fs.Name, + Namespace: fs.Namespace, + }, + } + readyCondition = fs.Status.GetCondition(messagingv1.SubscriptionConditionReady) + if readyCondition != nil { + ps.BranchStatuses[i].FilterSubscriptionStatus.ReadyCondition = *readyCondition + if readyCondition.Status != corev1.ConditionTrue { + allReady = false + } + } else { + allReady = false + } + + } + if allReady { + pCondSet.Manage(ps).MarkTrue(ParallelConditionSubscriptionsReady) + } else { + ps.MarkSubscriptionsNotReady("SubscriptionsNotReady", "Subscriptions are not ready yet, or there are none") + } +} + +// PropagateChannelStatuses sets the ChannelStatuses and ParallelConditionChannelsReady based on the +// status of the incoming channels. +func (ps *ParallelStatus) PropagateChannelStatuses(ingressChannel *duckv1.Channelable, channels []*duckv1.Channelable) { + if ps.BranchStatuses == nil { + ps.BranchStatuses = make([]ParallelBranchStatus, len(channels)) + } + allReady := true + + ps.IngressChannelStatus.Channel = corev1.ObjectReference{ + APIVersion: ingressChannel.APIVersion, + Kind: ingressChannel.Kind, + Name: ingressChannel.Name, + Namespace: ingressChannel.Namespace, + } + + address := ingressChannel.Status.AddressStatus.Address + if address != nil { + ps.IngressChannelStatus.ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionTrue} + } else { + ps.IngressChannelStatus.ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionFalse, Reason: "NotAddressable", Message: "Channel is not addressable"} + allReady = false + } + ps.setAddress(address) + + for i, c := range channels { + ps.BranchStatuses[i].FilterChannelStatus = ParallelChannelStatus{ + Channel: corev1.ObjectReference{ + APIVersion: c.APIVersion, + Kind: c.Kind, + Name: c.Name, + Namespace: c.Namespace, + }, + } + // TODO: Once the addressable has a real status to dig through, use that here instead of + // addressable, because it might be addressable but not ready. + address := c.Status.AddressStatus.Address + if address != nil { + ps.BranchStatuses[i].FilterChannelStatus.ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionTrue} + } else { + ps.BranchStatuses[i].FilterChannelStatus.ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionFalse, Reason: "NotAddressable", Message: "Channel is not addressable"} + allReady = false + } + } + if allReady { + pCondSet.Manage(ps).MarkTrue(ParallelConditionChannelsReady) + } else { + ps.MarkChannelsNotReady("ChannelsNotReady", "Channels are not ready yet, or there are none") + } +} + +func (ps *ParallelStatus) MarkChannelsNotReady(reason, messageFormat string, messageA ...interface{}) { + pCondSet.Manage(ps).MarkFalse(ParallelConditionChannelsReady, reason, messageFormat, messageA...) +} + +func (ps *ParallelStatus) MarkSubscriptionsNotReady(reason, messageFormat string, messageA ...interface{}) { + pCondSet.Manage(ps).MarkFalse(ParallelConditionSubscriptionsReady, reason, messageFormat, messageA...) +} + +func (ps *ParallelStatus) MarkAddressableNotReady(reason, messageFormat string, messageA ...interface{}) { + pCondSet.Manage(ps).MarkFalse(ParallelConditionAddressable, reason, messageFormat, messageA...) +} + +func (ps *ParallelStatus) setAddress(address *pkgduckv1.Addressable) { + ps.Address = address + if address == nil { + pCondSet.Manage(ps).MarkFalse(ParallelConditionAddressable, "emptyAddress", "addressable is nil") + } else { + pCondSet.Manage(ps).MarkTrue(ParallelConditionAddressable) + } +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_types.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_types.go new file mode 100644 index 0000000000..2dc3296361 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_types.go @@ -0,0 +1,164 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/kmeta" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// Parallel defines conditional branches that will be wired in +// series through Channels and Subscriptions. +type Parallel struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of the Parallel. + Spec ParallelSpec `json:"spec,omitempty"` + + // Status represents the current state of the Parallel. This data may be out of + // date. + // +optional + Status ParallelStatus `json:"status,omitempty"` +} + +var ( + // Check that Parallel can be validated and defaulted. + _ apis.Validatable = (*Parallel)(nil) + _ apis.Defaultable = (*Parallel)(nil) + + // Check that Parallel can return its spec untyped. + _ apis.HasSpec = (*Parallel)(nil) + + // TODO: make appropriate fields immutable. + //_ apis.Immutable = (*Parallel)(nil) + + _ runtime.Object = (*Parallel)(nil) + + // Check that we can create OwnerReferences to a Parallel. + _ kmeta.OwnerRefable = (*Parallel)(nil) + + // Check that the type conforms to the duck Knative Resource shape. + _ duckv1.KRShaped = (*Parallel)(nil) +) + +type ParallelSpec struct { + // Branches is the list of Filter/Subscribers pairs. + Branches []ParallelBranch `json:"branches"` + + // ChannelTemplate specifies which Channel CRD to use. If left unspecified, it is set to the default Channel CRD + // for the namespace (or cluster, in case there are no defaults for the namespace). + // +optional + ChannelTemplate *messagingv1.ChannelTemplateSpec `json:"channelTemplate"` + + // Reply is a Reference to where the result of a case Subscriber gets sent to + // when the case does not have a Reply + // +optional + Reply *duckv1.Destination `json:"reply,omitempty"` +} + +type ParallelBranch struct { + // Filter is the expression guarding the branch + // +optional + Filter *duckv1.Destination `json:"filter,omitempty"` + + // Subscriber receiving the event when the filter passes + Subscriber duckv1.Destination `json:"subscriber"` + + // Reply is a Reference to where the result of Subscriber of this case gets sent to. + // If not specified, sent the result to the Parallel Reply + // +optional + Reply *duckv1.Destination `json:"reply,omitempty"` + + // Delivery is the delivery specification for events to the subscriber + // This includes things like retries, DLQ, etc. + // +optional + Delivery *eventingduckv1.DeliverySpec `json:"delivery,omitempty"` +} + +// ParallelStatus represents the current state of a Parallel. +type ParallelStatus struct { + // inherits duck/v1 Status, which currently provides: + // * ObservedGeneration - the 'Generation' of the Service that was last processed by the controller. + // * Conditions - the latest available observations of a resource's current state. + duckv1.Status `json:",inline"` + + // IngressChannelStatus corresponds to the ingress channel status. + IngressChannelStatus ParallelChannelStatus `json:"ingressChannelStatus"` + + // BranchStatuses is an array of corresponding to branch statuses. + // Matches the Spec.Branches array in the order. + BranchStatuses []ParallelBranchStatus `json:"branchStatuses"` + + // AddressStatus is the starting point to this Parallel. Sending to this + // will target the first subscriber. + // It generally has the form {channel}.{namespace}.svc.{cluster domain name} + duckv1.AddressStatus `json:",inline"` +} + +// ParallelBranchStatus represents the current state of a Parallel branch +type ParallelBranchStatus struct { + // FilterSubscriptionStatus corresponds to the filter subscription status. + FilterSubscriptionStatus ParallelSubscriptionStatus `json:"filterSubscriptionStatus"` + + // FilterChannelStatus corresponds to the filter channel status. + FilterChannelStatus ParallelChannelStatus `json:"filterChannelStatus"` + + // SubscriptionStatus corresponds to the subscriber subscription status. + SubscriptionStatus ParallelSubscriptionStatus `json:"subscriberSubscriptionStatus"` +} + +type ParallelChannelStatus struct { + // Channel is the reference to the underlying channel. + Channel corev1.ObjectReference `json:"channel"` + + // ReadyCondition indicates whether the Channel is ready or not. + ReadyCondition apis.Condition `json:"ready"` +} + +type ParallelSubscriptionStatus struct { + // Subscription is the reference to the underlying Subscription. + Subscription corev1.ObjectReference `json:"subscription"` + + // ReadyCondition indicates whether the Subscription is ready or not. + ReadyCondition apis.Condition `json:"ready"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ParallelList is a collection of Parallels. +type ParallelList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []Parallel `json:"items"` +} + +// GetStatus retrieves the status of the Parallel. Implements the KRShaped interface. +func (p *Parallel) GetStatus() *duckv1.Status { + return &p.Status.Status +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_validation.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_validation.go new file mode 100644 index 0000000000..7aa30c0d3e --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_validation.go @@ -0,0 +1,68 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "context" + + "knative.dev/pkg/apis" +) + +func (p *Parallel) Validate(ctx context.Context) *apis.FieldError { + return p.Spec.Validate(ctx).ViaField("spec") +} + +func (ps *ParallelSpec) Validate(ctx context.Context) *apis.FieldError { + var errs *apis.FieldError + + if len(ps.Branches) == 0 { + errs = errs.Also(apis.ErrMissingField("branches")) + } + + for i, s := range ps.Branches { + if err := s.Filter.Validate(ctx); err != nil { + errs = errs.Also(apis.ErrInvalidArrayValue(s, "branches.filter", i)) + } + + if e := s.Subscriber.Validate(ctx); e != nil { + errs = errs.Also(apis.ErrInvalidArrayValue(s, "branches.subscriber", i)) + } + + if e := s.Reply.Validate(ctx); e != nil { + errs = errs.Also(apis.ErrInvalidArrayValue(s, "branches.reply", i)) + } + } + + if ps.ChannelTemplate == nil { + errs = errs.Also(apis.ErrMissingField("channelTemplate")) + return errs + } + + if len(ps.ChannelTemplate.APIVersion) == 0 { + errs = errs.Also(apis.ErrMissingField("channelTemplate.apiVersion")) + } + + if len(ps.ChannelTemplate.Kind) == 0 { + errs = errs.Also(apis.ErrMissingField("channelTemplate.kind")) + } + + if err := ps.Reply.Validate(ctx); err != nil { + errs = errs.Also(err.ViaField("reply")) + } + + return errs +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/register.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/register.go new file mode 100644 index 0000000000..821e7468a2 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "knative.dev/eventing/pkg/apis/flows" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: flows.GroupName, Version: "v1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Sequence{}, + &SequenceList{}, + &Parallel{}, + &ParallelList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_conversion.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_conversion.go new file mode 100644 index 0000000000..34e26a3abb --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_conversion.go @@ -0,0 +1,34 @@ +/* +Copyright 2020 The Knative Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + "fmt" + + "knative.dev/pkg/apis" +) + +// ConvertTo implements apis.Convertible +func (source *Sequence) ConvertTo(ctx context.Context, sink apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", sink) +} + +// ConvertFrom implements apis.Convertible +func (sink *Sequence) ConvertFrom(ctx context.Context, source apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", source) +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_defaults.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_defaults.go new file mode 100644 index 0000000000..64d681f607 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_defaults.go @@ -0,0 +1,58 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "context" + + "knative.dev/eventing/pkg/apis/messaging/config" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + "knative.dev/pkg/apis" +) + +func (s *Sequence) SetDefaults(ctx context.Context) { + withNS := apis.WithinParent(ctx, s.ObjectMeta) + if s != nil && s.Spec.ChannelTemplate == nil { + cfg := config.FromContextOrDefaults(ctx) + c, err := cfg.ChannelDefaults.GetChannelConfig(apis.ParentMeta(ctx).Namespace) + + if err == nil { + s.Spec.ChannelTemplate = &messagingv1.ChannelTemplateSpec{ + TypeMeta: c.TypeMeta, + Spec: c.Spec, + } + } + } + s.Spec.SetDefaults(withNS) +} + +func (ss *SequenceSpec) SetDefaults(ctx context.Context) { + // Default the namespace for all the steps. + for _, s := range ss.Steps { + s.SetDefaults(ctx) + } + // Default the reply + if ss.Reply != nil { + ss.Reply.SetDefaults(ctx) + } +} + +func (ss *SequenceStep) SetDefaults(ctx context.Context) { + ss.Destination.SetDefaults(ctx) + + // No delivery defaults. +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go new file mode 100644 index 0000000000..175b40d400 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go @@ -0,0 +1,174 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" +) + +var sCondSet = apis.NewLivingConditionSet(SequenceConditionReady, SequenceConditionChannelsReady, SequenceConditionSubscriptionsReady, SequenceConditionAddressable) + +const ( + // SequenceConditionReady has status True when all subconditions below have been set to True. + SequenceConditionReady = apis.ConditionReady + + // SequenceConditionChannelsReady has status True when all the channels created as part of + // this sequence are ready. + SequenceConditionChannelsReady apis.ConditionType = "ChannelsReady" + + // SequenceConditionSubscriptionsReady has status True when all the subscriptions created as part of + // this sequence are ready. + SequenceConditionSubscriptionsReady apis.ConditionType = "SubscriptionsReady" + + // SequenceConditionAddressable has status true when this Sequence meets + // the Addressable contract and has a non-empty hostname. + SequenceConditionAddressable apis.ConditionType = "Addressable" +) + +// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. +func (*Sequence) GetConditionSet() apis.ConditionSet { + return sCondSet +} + +// GetGroupVersionKind returns GroupVersionKind for InMemoryChannels +func (*Sequence) GetGroupVersionKind() schema.GroupVersionKind { + return SchemeGroupVersion.WithKind("Sequence") +} + +// GetUntypedSpec returns the spec of the Sequence. +func (s *Sequence) GetUntypedSpec() interface{} { + return s.Spec +} + +// GetCondition returns the condition currently associated with the given type, or nil. +func (ss *SequenceStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return sCondSet.Manage(ss).GetCondition(t) +} + +// IsReady returns true if the resource is ready overall. +func (ss *SequenceStatus) IsReady() bool { + return sCondSet.Manage(ss).IsHappy() +} + +// InitializeConditions sets relevant unset conditions to Unknown state. +func (ss *SequenceStatus) InitializeConditions() { + sCondSet.Manage(ss).InitializeConditions() +} + +// PropagateSubscriptionStatuses sets the SubscriptionStatuses and SequenceConditionSubscriptionsReady based on +// the status of the incoming subscriptions. +func (ss *SequenceStatus) PropagateSubscriptionStatuses(subscriptions []*messagingv1.Subscription) { + ss.SubscriptionStatuses = make([]SequenceSubscriptionStatus, len(subscriptions)) + allReady := true + // If there are no subscriptions, treat that as a False case. Could go either way, but this seems right. + if len(subscriptions) == 0 { + allReady = false + + } + for i, s := range subscriptions { + ss.SubscriptionStatuses[i] = SequenceSubscriptionStatus{ + Subscription: corev1.ObjectReference{ + APIVersion: s.APIVersion, + Kind: s.Kind, + Name: s.Name, + Namespace: s.Namespace, + }, + } + readyCondition := s.Status.GetCondition(messagingv1.SubscriptionConditionReady) + if readyCondition != nil { + ss.SubscriptionStatuses[i].ReadyCondition = *readyCondition + if readyCondition.Status != corev1.ConditionTrue { + allReady = false + } + } else { + allReady = false + } + + } + if allReady { + sCondSet.Manage(ss).MarkTrue(SequenceConditionSubscriptionsReady) + } else { + ss.MarkSubscriptionsNotReady("SubscriptionsNotReady", "Subscriptions are not ready yet, or there are none") + } +} + +// PropagateChannelStatuses sets the ChannelStatuses and SequenceConditionChannelsReady based on the +// status of the incoming channels. +func (ss *SequenceStatus) PropagateChannelStatuses(channels []*eventingduckv1.Channelable) { + ss.ChannelStatuses = make([]SequenceChannelStatus, len(channels)) + allReady := true + // If there are no channels, treat that as a False case. Could go either way, but this seems right. + if len(channels) == 0 { + allReady = false + + } + for i, c := range channels { + ss.ChannelStatuses[i] = SequenceChannelStatus{ + Channel: corev1.ObjectReference{ + APIVersion: c.APIVersion, + Kind: c.Kind, + Name: c.Name, + Namespace: c.Namespace, + }, + } + // TODO: Once the addressable has a real status to dig through, use that here instead of + // addressable, because it might be addressable but not ready. + address := c.Status.AddressStatus.Address + if address != nil { + ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionTrue} + } else { + ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionFalse, Reason: "NotAddressable", Message: "Channel is not addressable"} + allReady = false + } + + // Mark the Sequence address as the Address of the first channel. + if i == 0 { + ss.setAddress(address) + } + } + if allReady { + sCondSet.Manage(ss).MarkTrue(SequenceConditionChannelsReady) + } else { + ss.MarkChannelsNotReady("ChannelsNotReady", "Channels are not ready yet, or there are none") + } +} + +func (ss *SequenceStatus) MarkChannelsNotReady(reason, messageFormat string, messageA ...interface{}) { + sCondSet.Manage(ss).MarkFalse(SequenceConditionChannelsReady, reason, messageFormat, messageA...) +} + +func (ss *SequenceStatus) MarkSubscriptionsNotReady(reason, messageFormat string, messageA ...interface{}) { + sCondSet.Manage(ss).MarkFalse(SequenceConditionSubscriptionsReady, reason, messageFormat, messageA...) +} + +func (ss *SequenceStatus) MarkAddressableNotReady(reason, messageFormat string, messageA ...interface{}) { + sCondSet.Manage(ss).MarkFalse(SequenceConditionAddressable, reason, messageFormat, messageA...) +} + +func (ss *SequenceStatus) setAddress(address *duckv1.Addressable) { + if address == nil || address.URL == nil { + sCondSet.Manage(ss).MarkFalse(SequenceConditionAddressable, "emptyAddress", "addressable is nil") + } else { + ss.AddressStatus.Address = &duckv1.Addressable{URL: address.URL} + sCondSet.Manage(ss).MarkTrue(SequenceConditionAddressable) + } +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_types.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_types.go new file mode 100644 index 0000000000..df7b71c9e8 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_types.go @@ -0,0 +1,145 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/kmeta" + + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// Sequence defines a sequence of Subscribers that will be wired in +// series through Channels and Subscriptions. +type Sequence struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of the Sequence. + Spec SequenceSpec `json:"spec,omitempty"` + + // Status represents the current state of the Sequence. This data may be out of + // date. + // +optional + Status SequenceStatus `json:"status,omitempty"` +} + +var ( + // Check that Sequence can be validated and defaulted. + _ apis.Validatable = (*Sequence)(nil) + _ apis.Defaultable = (*Sequence)(nil) + + // Check that Sequence can return its spec untyped. + _ apis.HasSpec = (*Sequence)(nil) + + // TODO: make appropriate fields immutable. + //_ apis.Immutable = (*Sequence)(nil) + + _ runtime.Object = (*Sequence)(nil) + + // Check that we can create OwnerReferences to a Sequence. + _ kmeta.OwnerRefable = (*Sequence)(nil) + + // Check that the type conforms to the duck Knative Resource shape. + _ duckv1.KRShaped = (*Sequence)(nil) +) + +type SequenceSpec struct { + // Steps is the list of Destinations (processors / functions) that will be called in the order + // provided. Each step has its own delivery options + Steps []SequenceStep `json:"steps"` + + // ChannelTemplate specifies which Channel CRD to use. If left unspecified, it is set to the default Channel CRD + // for the namespace (or cluster, in case there are no defaults for the namespace). + // +optional + ChannelTemplate *messagingv1.ChannelTemplateSpec `json:"channelTemplate,omitempty"` + + // Reply is a Reference to where the result of the last Subscriber gets sent to. + // +optional + Reply *duckv1.Destination `json:"reply,omitempty"` +} + +type SequenceStep struct { + // Subscriber receiving the step event + duckv1.Destination `json:",inline"` + + // Delivery is the delivery specification for events to the subscriber + // This includes things like retries, DLQ, etc. + // +optional + Delivery *eventingduckv1.DeliverySpec `json:"delivery,omitempty"` +} + +type SequenceChannelStatus struct { + // Channel is the reference to the underlying channel. + Channel corev1.ObjectReference `json:"channel"` + + // ReadyCondition indicates whether the Channel is ready or not. + ReadyCondition apis.Condition `json:"ready"` +} + +type SequenceSubscriptionStatus struct { + // Subscription is the reference to the underlying Subscription. + Subscription corev1.ObjectReference `json:"subscription"` + + // ReadyCondition indicates whether the Subscription is ready or not. + ReadyCondition apis.Condition `json:"ready"` +} + +// SequenceStatus represents the current state of a Sequence. +type SequenceStatus struct { + // inherits duck/v1 Status, which currently provides: + // * ObservedGeneration - the 'Generation' of the Service that was last processed by the controller. + // * Conditions - the latest available observations of a resource's current state. + duckv1.Status `json:",inline"` + + // SubscriptionStatuses is an array of corresponding Subscription statuses. + // Matches the Spec.Steps array in the order. + SubscriptionStatuses []SequenceSubscriptionStatus `json:"subscriptionStatuses"` + + // ChannelStatuses is an array of corresponding Channel statuses. + // Matches the Spec.Steps array in the order. + ChannelStatuses []SequenceChannelStatus `json:"channelStatuses"` + + // AddressStatus is the starting point to this Sequence. Sending to this + // will target the first subscriber. + // It generally has the form {channel}.{namespace}.svc.{cluster domain name} + duckv1.AddressStatus `json:",inline"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SequenceList is a collection of Sequences. +type SequenceList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []Sequence `json:"items"` +} + +// GetStatus retrieves the status of the Sequence. Implements the KRShaped interface. +func (p *Sequence) GetStatus() *duckv1.Status { + return &p.Status.Status +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_validation.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_validation.go new file mode 100644 index 0000000000..a352bb18fa --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_validation.go @@ -0,0 +1,72 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "context" + + "knative.dev/pkg/apis" +) + +func (p *Sequence) Validate(ctx context.Context) *apis.FieldError { + return p.Spec.Validate(ctx).ViaField("spec") +} + +func (ps *SequenceSpec) Validate(ctx context.Context) *apis.FieldError { + var errs *apis.FieldError + + if len(ps.Steps) == 0 { + errs = errs.Also(apis.ErrMissingField("steps")) + } + + for i, s := range ps.Steps { + if e := s.Validate(ctx); e != nil { + errs = errs.Also(apis.ErrInvalidArrayValue(s, "steps", i)) + } + } + + if ps.ChannelTemplate == nil { + errs = errs.Also(apis.ErrMissingField("channelTemplate")) + return errs + } + + if len(ps.ChannelTemplate.APIVersion) == 0 { + errs = errs.Also(apis.ErrMissingField("channelTemplate.apiVersion")) + } + + if len(ps.ChannelTemplate.Kind) == 0 { + errs = errs.Also(apis.ErrMissingField("channelTemplate.kind")) + } + + if err := ps.Reply.Validate(ctx); err != nil { + errs = errs.Also(err.ViaField("reply")) + } + + return errs +} + +func (ss *SequenceStep) Validate(ctx context.Context) *apis.FieldError { + errs := ss.Destination.Validate(ctx) + + if ss.Delivery != nil { + if de := ss.Delivery.Validate(ctx); de != nil { + errs = errs.Also(de.ViaField("delivery")) + } + } + + return errs +} diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/test_helpers.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/test_helpers.go new file mode 100644 index 0000000000..308dcba877 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/test_helpers.go @@ -0,0 +1,37 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "github.com/google/go-cmp/cmp/cmpopts" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + "knative.dev/pkg/apis" +) + +var ( + defaultChannelTemplate = &messagingv1.ChannelTemplateSpec{ + TypeMeta: v1.TypeMeta{ + APIVersion: SchemeGroupVersion.String(), + Kind: "InMemoryChannel", + }, + } + ignoreAllButTypeAndStatus = cmpopts.IgnoreFields( + apis.Condition{}, + "LastTransitionTime", "Message", "Reason", "Severity") +) diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/zz_generated.deepcopy.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..e199236dc5 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/zz_generated.deepcopy.go @@ -0,0 +1,419 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + apisduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + duckv1 "knative.dev/pkg/apis/duck/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Parallel) DeepCopyInto(out *Parallel) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Parallel. +func (in *Parallel) DeepCopy() *Parallel { + if in == nil { + return nil + } + out := new(Parallel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Parallel) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParallelBranch) DeepCopyInto(out *ParallelBranch) { + *out = *in + if in.Filter != nil { + in, out := &in.Filter, &out.Filter + *out = new(duckv1.Destination) + (*in).DeepCopyInto(*out) + } + in.Subscriber.DeepCopyInto(&out.Subscriber) + if in.Reply != nil { + in, out := &in.Reply, &out.Reply + *out = new(duckv1.Destination) + (*in).DeepCopyInto(*out) + } + if in.Delivery != nil { + in, out := &in.Delivery, &out.Delivery + *out = new(apisduckv1.DeliverySpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParallelBranch. +func (in *ParallelBranch) DeepCopy() *ParallelBranch { + if in == nil { + return nil + } + out := new(ParallelBranch) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParallelBranchStatus) DeepCopyInto(out *ParallelBranchStatus) { + *out = *in + in.FilterSubscriptionStatus.DeepCopyInto(&out.FilterSubscriptionStatus) + in.FilterChannelStatus.DeepCopyInto(&out.FilterChannelStatus) + in.SubscriptionStatus.DeepCopyInto(&out.SubscriptionStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParallelBranchStatus. +func (in *ParallelBranchStatus) DeepCopy() *ParallelBranchStatus { + if in == nil { + return nil + } + out := new(ParallelBranchStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParallelChannelStatus) DeepCopyInto(out *ParallelChannelStatus) { + *out = *in + out.Channel = in.Channel + in.ReadyCondition.DeepCopyInto(&out.ReadyCondition) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParallelChannelStatus. +func (in *ParallelChannelStatus) DeepCopy() *ParallelChannelStatus { + if in == nil { + return nil + } + out := new(ParallelChannelStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParallelList) DeepCopyInto(out *ParallelList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Parallel, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParallelList. +func (in *ParallelList) DeepCopy() *ParallelList { + if in == nil { + return nil + } + out := new(ParallelList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ParallelList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParallelSpec) DeepCopyInto(out *ParallelSpec) { + *out = *in + if in.Branches != nil { + in, out := &in.Branches, &out.Branches + *out = make([]ParallelBranch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ChannelTemplate != nil { + in, out := &in.ChannelTemplate, &out.ChannelTemplate + *out = new(messagingv1.ChannelTemplateSpec) + (*in).DeepCopyInto(*out) + } + if in.Reply != nil { + in, out := &in.Reply, &out.Reply + *out = new(duckv1.Destination) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParallelSpec. +func (in *ParallelSpec) DeepCopy() *ParallelSpec { + if in == nil { + return nil + } + out := new(ParallelSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParallelStatus) DeepCopyInto(out *ParallelStatus) { + *out = *in + in.Status.DeepCopyInto(&out.Status) + in.IngressChannelStatus.DeepCopyInto(&out.IngressChannelStatus) + if in.BranchStatuses != nil { + in, out := &in.BranchStatuses, &out.BranchStatuses + *out = make([]ParallelBranchStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.AddressStatus.DeepCopyInto(&out.AddressStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParallelStatus. +func (in *ParallelStatus) DeepCopy() *ParallelStatus { + if in == nil { + return nil + } + out := new(ParallelStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParallelSubscriptionStatus) DeepCopyInto(out *ParallelSubscriptionStatus) { + *out = *in + out.Subscription = in.Subscription + in.ReadyCondition.DeepCopyInto(&out.ReadyCondition) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParallelSubscriptionStatus. +func (in *ParallelSubscriptionStatus) DeepCopy() *ParallelSubscriptionStatus { + if in == nil { + return nil + } + out := new(ParallelSubscriptionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Sequence) DeepCopyInto(out *Sequence) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sequence. +func (in *Sequence) DeepCopy() *Sequence { + if in == nil { + return nil + } + out := new(Sequence) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Sequence) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SequenceChannelStatus) DeepCopyInto(out *SequenceChannelStatus) { + *out = *in + out.Channel = in.Channel + in.ReadyCondition.DeepCopyInto(&out.ReadyCondition) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SequenceChannelStatus. +func (in *SequenceChannelStatus) DeepCopy() *SequenceChannelStatus { + if in == nil { + return nil + } + out := new(SequenceChannelStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SequenceList) DeepCopyInto(out *SequenceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Sequence, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SequenceList. +func (in *SequenceList) DeepCopy() *SequenceList { + if in == nil { + return nil + } + out := new(SequenceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SequenceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SequenceSpec) DeepCopyInto(out *SequenceSpec) { + *out = *in + if in.Steps != nil { + in, out := &in.Steps, &out.Steps + *out = make([]SequenceStep, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ChannelTemplate != nil { + in, out := &in.ChannelTemplate, &out.ChannelTemplate + *out = new(messagingv1.ChannelTemplateSpec) + (*in).DeepCopyInto(*out) + } + if in.Reply != nil { + in, out := &in.Reply, &out.Reply + *out = new(duckv1.Destination) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SequenceSpec. +func (in *SequenceSpec) DeepCopy() *SequenceSpec { + if in == nil { + return nil + } + out := new(SequenceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SequenceStatus) DeepCopyInto(out *SequenceStatus) { + *out = *in + in.Status.DeepCopyInto(&out.Status) + if in.SubscriptionStatuses != nil { + in, out := &in.SubscriptionStatuses, &out.SubscriptionStatuses + *out = make([]SequenceSubscriptionStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ChannelStatuses != nil { + in, out := &in.ChannelStatuses, &out.ChannelStatuses + *out = make([]SequenceChannelStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.AddressStatus.DeepCopyInto(&out.AddressStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SequenceStatus. +func (in *SequenceStatus) DeepCopy() *SequenceStatus { + if in == nil { + return nil + } + out := new(SequenceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SequenceStep) DeepCopyInto(out *SequenceStep) { + *out = *in + in.Destination.DeepCopyInto(&out.Destination) + if in.Delivery != nil { + in, out := &in.Delivery, &out.Delivery + *out = new(apisduckv1.DeliverySpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SequenceStep. +func (in *SequenceStep) DeepCopy() *SequenceStep { + if in == nil { + return nil + } + out := new(SequenceStep) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SequenceSubscriptionStatus) DeepCopyInto(out *SequenceSubscriptionStatus) { + *out = *in + out.Subscription = in.Subscription + in.ReadyCondition.DeepCopyInto(&out.ReadyCondition) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SequenceSubscriptionStatus. +func (in *SequenceSubscriptionStatus) DeepCopy() *SequenceSubscriptionStatus { + if in == nil { + return nil + } + out := new(SequenceSubscriptionStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_conversion.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_conversion.go new file mode 100644 index 0000000000..6b44fd5797 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_conversion.go @@ -0,0 +1,34 @@ +/* +Copyright 2020 The Knative Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + "fmt" + + "knative.dev/pkg/apis" +) + +// ConvertTo implements apis.Convertible +func (source *Channel) ConvertTo(ctx context.Context, sink apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", sink) +} + +// ConvertFrom implements apis.Convertible +func (sink *Channel) ConvertFrom(ctx context.Context, source apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", source) +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_defaults.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_defaults.go new file mode 100644 index 0000000000..82746cdd4f --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_defaults.go @@ -0,0 +1,58 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + + "knative.dev/eventing/pkg/apis/messaging" + "knative.dev/eventing/pkg/apis/messaging/config" + "knative.dev/pkg/apis" +) + +func (c *Channel) SetDefaults(ctx context.Context) { + if c.Annotations == nil { + c.Annotations = make(map[string]string) + } + if _, ok := c.Annotations[messaging.SubscribableDuckVersionAnnotation]; !ok { + c.Annotations[messaging.SubscribableDuckVersionAnnotation] = "v1" + } + + c.Spec.SetDefaults(apis.WithinParent(ctx, c.ObjectMeta)) +} + +func (cs *ChannelSpec) SetDefaults(ctx context.Context) { + if cs.ChannelTemplate != nil { + return + } + + cfg := config.FromContextOrDefaults(ctx) + c, err := cfg.ChannelDefaults.GetChannelConfig(apis.ParentMeta(ctx).Namespace) + if err == nil { + cs.ChannelTemplate = &ChannelTemplateSpec{ + c.TypeMeta, + c.Spec, + } + } +} + +// ChannelDefaulter sets the default Channel CRD and Arguments on Channels that do not +// specify any implementation. +type ChannelDefaulter interface { + // GetDefault determines the default Channel CRD for the given namespace. + GetDefault(namespace string) *ChannelTemplateSpec +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_lifecycle.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_lifecycle.go new file mode 100644 index 0000000000..8206a6a062 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_lifecycle.go @@ -0,0 +1,124 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + eventingduck "knative.dev/eventing/pkg/apis/duck/v1" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" +) + +var chCondSet = apis.NewLivingConditionSet(ChannelConditionBackingChannelReady, ChannelConditionAddressable) + +const ( + // ChannelConditionReady has status True when all subconditions below have been set to True. + ChannelConditionReady = apis.ConditionReady + + // ChannelConditionBackingChannelReady has status True when the backing Channel CRD is ready. + ChannelConditionBackingChannelReady apis.ConditionType = "BackingChannelReady" + + // ChannelConditionAddressable has status true when this Channel meets + // the Addressable contract and has a non-empty hostname. + ChannelConditionAddressable apis.ConditionType = "Addressable" +) + +// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. +func (*Channel) GetConditionSet() apis.ConditionSet { + return chCondSet +} + +// GetGroupVersionKind returns GroupVersionKind for Channels. +func (*Channel) GetGroupVersionKind() schema.GroupVersionKind { + return SchemeGroupVersion.WithKind("Channel") +} + +// GetUntypedSpec returns the spec of the Channel. +func (c *Channel) GetUntypedSpec() interface{} { + return c.Spec +} + +// GetCondition returns the condition currently associated with the given type, or nil. +func (cs *ChannelStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return chCondSet.Manage(cs).GetCondition(t) +} + +// GetTopLevelCondition returns the top level Condition. +func (cs *ChannelStatus) GetTopLevelCondition() *apis.Condition { + return chCondSet.Manage(cs).GetTopLevelCondition() +} + +// IsReady returns true if the resource is ready overall. +func (cs *ChannelStatus) IsReady() bool { + return chCondSet.Manage(cs).IsHappy() +} + +// InitializeConditions sets relevant unset conditions to Unknown state. +func (cs *ChannelStatus) InitializeConditions() { + chCondSet.Manage(cs).InitializeConditions() +} + +func (cs *ChannelStatus) SetAddress(address *duckv1.Addressable) { + cs.Address = address + if address == nil || address.URL.IsEmpty() { + chCondSet.Manage(cs).MarkFalse(ChannelConditionAddressable, "EmptyHostname", "hostname is the empty string") + } else { + chCondSet.Manage(cs).MarkTrue(ChannelConditionAddressable) + + } +} + +func (cs *ChannelStatus) MarkBackingChannelFailed(reason, messageFormat string, messageA ...interface{}) { + chCondSet.Manage(cs).MarkFalse(ChannelConditionBackingChannelReady, reason, messageFormat, messageA...) +} + +func (cs *ChannelStatus) MarkBackingChannelUnknown(reason, messageFormat string, messageA ...interface{}) { + chCondSet.Manage(cs).MarkUnknown(ChannelConditionBackingChannelReady, reason, messageFormat, messageA...) +} + +func (cs *ChannelStatus) MarkBackingChannelNotConfigured() { + chCondSet.Manage(cs).MarkUnknown(ChannelConditionBackingChannelReady, + "BackingChannelNotConfigured", "BackingChannel has not yet been reconciled.") +} + +func (cs *ChannelStatus) MarkBackingChannelReady() { + chCondSet.Manage(cs).MarkTrue(ChannelConditionBackingChannelReady) +} + +func (cs *ChannelStatus) PropagateStatuses(chs *eventingduck.ChannelableStatus) { + // TODO: Once you can get a Ready status from Channelable in a generic way, use it here. + readyCondition := chs.Status.GetCondition(apis.ConditionReady) + if readyCondition == nil { + cs.MarkBackingChannelNotConfigured() + } else { + switch { + case readyCondition.Status == corev1.ConditionUnknown: + cs.MarkBackingChannelUnknown(readyCondition.Reason, readyCondition.Message) + case readyCondition.Status == corev1.ConditionTrue: + cs.MarkBackingChannelReady() + case readyCondition.Status == corev1.ConditionFalse: + cs.MarkBackingChannelFailed(readyCondition.Reason, readyCondition.Message) + default: + cs.MarkBackingChannelUnknown("BackingChannelUnknown", "The status of BackingChannel is invalid: %v", readyCondition.Status) + } + } + // Set the address and update the Addressable conditions. + cs.SetAddress(chs.AddressStatus.Address) + // Set the subscribable status. + cs.SubscribableStatus = chs.SubscribableStatus +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_template_types.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_template_types.go new file mode 100644 index 0000000000..35f42de7f1 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_template_types.go @@ -0,0 +1,47 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ChannelTemplateSpec struct { + metav1.TypeMeta `json:",inline"` + + // Spec defines the Spec to use for each channel created. Passed + // in verbatim to the Channel CRD as Spec section. + // +optional + Spec *runtime.RawExtension `json:"spec,omitempty"` +} + +// ChannelTemplateSpecInternal is an internal only version that includes ObjectMeta so that +// we can easily create new Channels off of it. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ChannelTemplateSpecInternal struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the Spec to use for each channel created. Passed + // in verbatim to the Channel CRD as Spec section. + // +optional + Spec *runtime.RawExtension `json:"spec,omitempty"` +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_types.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_types.go new file mode 100644 index 0000000000..53e620a9a7 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_types.go @@ -0,0 +1,97 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/kmeta" +) + +// +genclient +// +genreconciler +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Channel represents a geneeric Channel. It is normally used when we want a Channel, but don't need a specific Channel implementation. +type Channel struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of the Channel. + Spec ChannelSpec `json:"spec,omitempty"` + + // Status represents the current state of the Channel. This data may be out of + // date. + // +optional + Status ChannelStatus `json:"status,omitempty"` +} + +var ( + // Check that Channel can be validated and defaulted. + _ apis.Validatable = (*Channel)(nil) + _ apis.Defaultable = (*Channel)(nil) + + // Check that Channel can return its spec untyped. + _ apis.HasSpec = (*Channel)(nil) + + _ runtime.Object = (*Channel)(nil) + + // Check that we can create OwnerReferences to a Channel. + _ kmeta.OwnerRefable = (*Channel)(nil) + + // Check that the type conforms to the duck Knative Resource shape. + _ duckv1.KRShaped = (*Channel)(nil) +) + +// ChannelSpec defines which subscribers have expressed interest in receiving events from this Channel. +// It also defines the ChannelTemplate to use in order to create the CRD Channel backing this Channel. +type ChannelSpec struct { + // ChannelTemplate specifies which Channel CRD to use to create the CRD Channel backing this Channel. + // This is immutable after creation. Normally this is set by the Channel defaulter, not directly by the user. + ChannelTemplate *ChannelTemplateSpec `json:"channelTemplate"` + + // Channel conforms to ChannelableSpec + eventingduckv1.ChannelableSpec `json:",inline"` +} + +// ChannelStatus represents the current state of a Channel. +type ChannelStatus struct { + // Channel conforms to ChannelableStatus + eventingduckv1.ChannelableStatus `json:",inline"` + + // Channel is an KReference to the Channel CRD backing this Channel. + Channel *duckv1.KReference `json:"channel,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ChannelList is a collection of Channels. +type ChannelList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []Channel `json:"items"` +} + +// GetStatus retrieves the status of the Channel. Implements the KRShaped interface. +func (t *Channel) GetStatus() *duckv1.Status { + return &t.Status.Status +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_validation.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_validation.go new file mode 100644 index 0000000000..f0654efeef --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_validation.go @@ -0,0 +1,81 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + + "github.com/google/go-cmp/cmp/cmpopts" + "knative.dev/pkg/apis" + "knative.dev/pkg/kmp" +) + +func (c *Channel) Validate(ctx context.Context) *apis.FieldError { + withNS := apis.WithinParent(ctx, c.ObjectMeta) + return c.Spec.Validate(withNS).ViaField("spec") +} + +func (cs *ChannelSpec) Validate(ctx context.Context) *apis.FieldError { + var errs *apis.FieldError + + if cs.ChannelTemplate == nil { + // The Channel defaulter is expected to set this, not the users. + errs = errs.Also(apis.ErrMissingField("channelTemplate")) + } else { + if cte := IsValidChannelTemplate(cs.ChannelTemplate); cte != nil { + errs = errs.Also(cte.ViaField("channelTemplate")) + } + } + + if len(cs.SubscribableSpec.Subscribers) > 0 { + errs = errs.Also(apis.ErrDisallowedFields("subscribers").ViaField("subscribable")) + } + return errs +} + +func IsValidChannelTemplate(ct *ChannelTemplateSpec) *apis.FieldError { + var errs *apis.FieldError + if ct.Kind == "" { + errs = errs.Also(apis.ErrMissingField("kind")) + } + if ct.APIVersion == "" { + errs = errs.Also(apis.ErrMissingField("apiVersion")) + } + return errs +} + +func (c *Channel) CheckImmutableFields(ctx context.Context, original *Channel) *apis.FieldError { + if original == nil { + return nil + } + + ignoreArguments := cmpopts.IgnoreFields(ChannelSpec{}, "SubscribableSpec") + if diff, err := kmp.ShortDiff(original.Spec, c.Spec, ignoreArguments); err != nil { + return &apis.FieldError{ + Message: "Failed to diff Channel", + Paths: []string{"spec"}, + Details: err.Error(), + } + } else if diff != "" { + return &apis.FieldError{ + Message: "Immutable fields changed (-old +new)", + Paths: []string{"spec"}, + Details: diff, + } + } + return nil +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/doc.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/doc.go new file mode 100644 index 0000000000..056ab44b74 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/doc.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Api versions allow the api contract for a resource to be changed while keeping +// backward compatibility by support multiple concurrent versions +// of the same resource + +// Package v1 is the v1 version of the API. +// +k8s:deepcopy-gen=package +// +groupName=messaging.knative.dev +package v1 diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_conversion.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_conversion.go new file mode 100644 index 0000000000..d0300da28a --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_conversion.go @@ -0,0 +1,34 @@ +/* +Copyright 2020 The Knative Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + "fmt" + + "knative.dev/pkg/apis" +) + +// ConvertTo implements apis.Convertible +func (source *InMemoryChannel) ConvertTo(ctx context.Context, sink apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", sink) +} + +// ConvertFrom implements apis.Convertible +func (sink *InMemoryChannel) ConvertFrom(ctx context.Context, source apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", source) +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_defaults.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_defaults.go new file mode 100644 index 0000000000..a081d6bb67 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_defaults.go @@ -0,0 +1,43 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + + "knative.dev/eventing/pkg/apis/messaging" +) + +func (imc *InMemoryChannel) SetDefaults(ctx context.Context) { + // Set the duck subscription to the stored version of the duck + // we support. Reason for this is that the stored version will + // not get a chance to get modified, but for newer versions + // conversion webhook will be able to take a crack at it and + // can modify it to match the duck shape. + if imc.Annotations == nil { + imc.Annotations = make(map[string]string) + } + if _, ok := imc.Annotations[messaging.SubscribableDuckVersionAnnotation]; !ok { + imc.Annotations[messaging.SubscribableDuckVersionAnnotation] = "v1" + } + + imc.Spec.SetDefaults(ctx) +} + +func (imcs *InMemoryChannelSpec) SetDefaults(ctx context.Context) { + // TODO: Nothing to default here... +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_lifecycle.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_lifecycle.go new file mode 100644 index 0000000000..ca3379469a --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_lifecycle.go @@ -0,0 +1,152 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/apis" + v1 "knative.dev/pkg/apis/duck/v1" +) + +var imcCondSet = apis.NewLivingConditionSet(InMemoryChannelConditionDispatcherReady, InMemoryChannelConditionServiceReady, InMemoryChannelConditionEndpointsReady, InMemoryChannelConditionAddressable, InMemoryChannelConditionChannelServiceReady) + +const ( + // InMemoryChannelConditionReady has status True when all subconditions below have been set to True. + InMemoryChannelConditionReady = apis.ConditionReady + + // InMemoryChannelConditionDispatcherReady has status True when a Dispatcher deployment is ready + // Keyed off appsv1.DeploymentAvaialble, which means minimum available replicas required are up + // and running for at least minReadySeconds. + InMemoryChannelConditionDispatcherReady apis.ConditionType = "DispatcherReady" + + // InMemoryChannelConditionServiceReady has status True when a k8s Service is ready. This + // basically just means it exists because there's no meaningful status in Service. See Endpoints + // below. + InMemoryChannelConditionServiceReady apis.ConditionType = "ServiceReady" + + // InMemoryChannelConditionEndpointsReady has status True when a k8s Service Endpoints are backed + // by at least one endpoint. + InMemoryChannelConditionEndpointsReady apis.ConditionType = "EndpointsReady" + + // InMemoryChannelConditionAddressable has status true when this InMemoryChannel meets + // the Addressable contract and has a non-empty hostname. + InMemoryChannelConditionAddressable apis.ConditionType = "Addressable" + + // InMemoryChannelConditionServiceReady has status True when a k8s Service representing the channel is ready. + // Because this uses ExternalName, there are no endpoints to check. + InMemoryChannelConditionChannelServiceReady apis.ConditionType = "ChannelServiceReady" +) + +// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. +func (*InMemoryChannel) GetConditionSet() apis.ConditionSet { + return imcCondSet +} + +// GetGroupVersionKind returns GroupVersionKind for InMemoryChannels +func (*InMemoryChannel) GetGroupVersionKind() schema.GroupVersionKind { + return SchemeGroupVersion.WithKind("InMemoryChannel") +} + +// GetUntypedSpec returns the spec of the InMemoryChannel. +func (i *InMemoryChannel) GetUntypedSpec() interface{} { + return i.Spec +} + +// GetCondition returns the condition currently associated with the given type, or nil. +func (imcs *InMemoryChannelStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return imcCondSet.Manage(imcs).GetCondition(t) +} + +// IsReady returns true if the resource is ready overall. +func (imcs *InMemoryChannelStatus) IsReady() bool { + return imcCondSet.Manage(imcs).IsHappy() +} + +// InitializeConditions sets relevant unset conditions to Unknown state. +func (imcs *InMemoryChannelStatus) InitializeConditions() { + imcCondSet.Manage(imcs).InitializeConditions() +} + +func (imcs *InMemoryChannelStatus) SetAddress(url *apis.URL) { + imcs.Address = &v1.Addressable{URL: url} + if url != nil { + imcCondSet.Manage(imcs).MarkTrue(InMemoryChannelConditionAddressable) + } else { + imcCondSet.Manage(imcs).MarkFalse(InMemoryChannelConditionAddressable, "emptyHostname", "hostname is the empty string") + } +} + +func (imcs *InMemoryChannelStatus) MarkDispatcherFailed(reason, messageFormat string, messageA ...interface{}) { + imcCondSet.Manage(imcs).MarkFalse(InMemoryChannelConditionDispatcherReady, reason, messageFormat, messageA...) +} + +func (imcs *InMemoryChannelStatus) MarkDispatcherUnknown(reason, messageFormat string, messageA ...interface{}) { + imcCondSet.Manage(imcs).MarkUnknown(InMemoryChannelConditionDispatcherReady, reason, messageFormat, messageA...) +} + +// TODO: Unify this with the ones from Eventing. Say: Broker, Trigger. +func (imcs *InMemoryChannelStatus) PropagateDispatcherStatus(ds *appsv1.DeploymentStatus) { + for _, cond := range ds.Conditions { + if cond.Type == appsv1.DeploymentAvailable { + if cond.Status == corev1.ConditionTrue { + imcCondSet.Manage(imcs).MarkTrue(InMemoryChannelConditionDispatcherReady) + } else if cond.Status == corev1.ConditionFalse { + imcs.MarkDispatcherFailed("DispatcherDeploymentFalse", "The status of Dispatcher Deployment is False: %s : %s", cond.Reason, cond.Message) + } else if cond.Status == corev1.ConditionUnknown { + imcs.MarkDispatcherUnknown("DispatcherDeploymentUnknown", "The status of Dispatcher Deployment is Unknown: %s : %s", cond.Reason, cond.Message) + } + } + } +} + +func (imcs *InMemoryChannelStatus) MarkServiceFailed(reason, messageFormat string, messageA ...interface{}) { + imcCondSet.Manage(imcs).MarkFalse(InMemoryChannelConditionServiceReady, reason, messageFormat, messageA...) +} + +func (imcs *InMemoryChannelStatus) MarkServiceUnknown(reason, messageFormat string, messageA ...interface{}) { + imcCondSet.Manage(imcs).MarkUnknown(InMemoryChannelConditionServiceReady, reason, messageFormat, messageA...) +} + +func (imcs *InMemoryChannelStatus) MarkServiceTrue() { + imcCondSet.Manage(imcs).MarkTrue(InMemoryChannelConditionServiceReady) +} + +func (imcs *InMemoryChannelStatus) MarkChannelServiceFailed(reason, messageFormat string, messageA ...interface{}) { + imcCondSet.Manage(imcs).MarkFalse(InMemoryChannelConditionChannelServiceReady, reason, messageFormat, messageA...) +} + +func (imcs *InMemoryChannelStatus) MarkChannelServiceUnknown(reason, messageFormat string, messageA ...interface{}) { + imcCondSet.Manage(imcs).MarkUnknown(InMemoryChannelConditionChannelServiceReady, reason, messageFormat, messageA...) +} + +func (imcs *InMemoryChannelStatus) MarkChannelServiceTrue() { + imcCondSet.Manage(imcs).MarkTrue(InMemoryChannelConditionChannelServiceReady) +} + +func (imcs *InMemoryChannelStatus) MarkEndpointsFailed(reason, messageFormat string, messageA ...interface{}) { + imcCondSet.Manage(imcs).MarkFalse(InMemoryChannelConditionEndpointsReady, reason, messageFormat, messageA...) +} + +func (imcs *InMemoryChannelStatus) MarkEndpointsUnknown(reason, messageFormat string, messageA ...interface{}) { + imcCondSet.Manage(imcs).MarkUnknown(InMemoryChannelConditionEndpointsReady, reason, messageFormat, messageA...) +} + +func (imcs *InMemoryChannelStatus) MarkEndpointsTrue() { + imcCondSet.Manage(imcs).MarkTrue(InMemoryChannelConditionEndpointsReady) +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_types.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_types.go new file mode 100644 index 0000000000..f3a72aca43 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_types.go @@ -0,0 +1,91 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/kmeta" +) + +// +genclient +// +genreconciler +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InMemoryChannel is a resource representing an in memory channel +type InMemoryChannel struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of the Channel. + Spec InMemoryChannelSpec `json:"spec,omitempty"` + + // Status represents the current state of the Channel. This data may be out of + // date. + // +optional + Status InMemoryChannelStatus `json:"status,omitempty"` +} + +var ( + // Check that InMemoryChannel can be validated and defaulted. + _ apis.Validatable = (*InMemoryChannel)(nil) + _ apis.Defaultable = (*InMemoryChannel)(nil) + + // Check that InMemoryChannel can return its spec untyped. + _ apis.HasSpec = (*InMemoryChannel)(nil) + + _ runtime.Object = (*InMemoryChannel)(nil) + + // Check that we can create OwnerReferences to an InMemoryChannel. + _ kmeta.OwnerRefable = (*InMemoryChannel)(nil) + + // Check that the type conforms to the duck Knative Resource shape. + _ duckv1.KRShaped = (*InMemoryChannel)(nil) +) + +// InMemoryChannelSpec defines which subscribers have expressed interest in +// receiving events from this InMemoryChannel. +// arguments for a Channel. +type InMemoryChannelSpec struct { + // Channel conforms to Duck type Channelable. + eventingduckv1.ChannelableSpec `json:",inline"` +} + +// ChannelStatus represents the current state of a Channel. +type InMemoryChannelStatus struct { + // Channel conforms to Duck type Channelable. + eventingduckv1.ChannelableStatus `json:",inline"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InMemoryChannelList is a collection of in-memory channels. +type InMemoryChannelList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []InMemoryChannel `json:"items"` +} + +// GetStatus retrieves the status of the InMemoryChannel. Implements the KRShaped interface. +func (t *InMemoryChannel) GetStatus() *duckv1.Status { + return &t.Status.Status +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_validation.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_validation.go new file mode 100644 index 0000000000..df35c54740 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_validation.go @@ -0,0 +1,56 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + "fmt" + + "knative.dev/pkg/apis" + + "knative.dev/eventing/pkg/apis/eventing" +) + +func (imc *InMemoryChannel) Validate(ctx context.Context) *apis.FieldError { + errs := imc.Spec.Validate(ctx).ViaField("spec") + + // Validate annotations + if imc.Annotations != nil { + if scope, ok := imc.Annotations[eventing.ScopeAnnotationKey]; ok { + if scope != eventing.ScopeNamespace && scope != eventing.ScopeCluster { + iv := apis.ErrInvalidValue(scope, "") + iv.Details = "expected either 'cluster' or 'namespace'" + errs = errs.Also(iv.ViaFieldKey("annotations", eventing.ScopeAnnotationKey).ViaField("metadata")) + } + } + } + + return errs +} + +func (imcs *InMemoryChannelSpec) Validate(ctx context.Context) *apis.FieldError { + var errs *apis.FieldError + for i, subscriber := range imcs.SubscribableSpec.Subscribers { + if subscriber.ReplyURI == nil && subscriber.SubscriberURI == nil { + fe := apis.ErrMissingField("replyURI", "subscriberURI") + fe.Details = "expected at least one of, got none" + errs = errs.Also(fe.ViaField(fmt.Sprintf("subscriber[%d]", i)).ViaField("subscribable")) + } + } + + return errs +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/register.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/register.go new file mode 100644 index 0000000000..27b38b997a --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/register.go @@ -0,0 +1,57 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "knative.dev/eventing/pkg/apis/messaging" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: messaging.GroupName, Version: "v1"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &InMemoryChannel{}, + &InMemoryChannelList{}, + &Subscription{}, + &SubscriptionList{}, + &Channel{}, + &ChannelList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscribable_channelable_validation.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscribable_channelable_validation.go new file mode 100644 index 0000000000..14d4d20b6e --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscribable_channelable_validation.go @@ -0,0 +1,85 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "reflect" + + "github.com/google/go-cmp/cmp" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" + "knative.dev/pkg/apis" +) + +func isChannelEmpty(f corev1.ObjectReference) bool { + return equality.Semantic.DeepEqual(f, corev1.ObjectReference{}) +} + +// Valid if it is a valid object reference. +func isValidChannel(f corev1.ObjectReference) *apis.FieldError { + return IsValidObjectReference(f) +} + +func IsValidObjectReference(f corev1.ObjectReference) *apis.FieldError { + return checkRequiredObjectReferenceFields(f). + Also(checkDisallowedObjectReferenceFields(f)) +} + +// Check the corev1.ObjectReference to make sure it has the required fields. They +// are not checked for anything more except that they are set. +func checkRequiredObjectReferenceFields(f corev1.ObjectReference) *apis.FieldError { + var errs *apis.FieldError + if f.Name == "" { + errs = errs.Also(apis.ErrMissingField("name")) + } + if f.APIVersion == "" { + errs = errs.Also(apis.ErrMissingField("apiVersion")) + } + if f.Kind == "" { + errs = errs.Also(apis.ErrMissingField("kind")) + } + return errs +} + +// Check the corev1.ObjectReference to make sure it only has the following fields set: +// Name, Kind, APIVersion +// If any other fields are set and is not the Zero value, returns an apis.FieldError +// with the fieldpaths for all those fields. +func checkDisallowedObjectReferenceFields(f corev1.ObjectReference) *apis.FieldError { + disallowedFields := []string{} + // See if there are any fields that have been set that should not be. + // TODO: Hoist this kind of stuff into pkg repository. + s := reflect.ValueOf(f) + typeOf := s.Type() + for i := 0; i < s.NumField(); i++ { + field := s.Field(i) + fieldName := typeOf.Field(i).Name + if fieldName == "Name" || fieldName == "Kind" || fieldName == "APIVersion" { + continue + } + if !cmp.Equal(field.Interface(), reflect.Zero(field.Type()).Interface()) { + disallowedFields = append(disallowedFields, fieldName) + } + } + if len(disallowedFields) > 0 { + fe := apis.ErrDisallowedFields(disallowedFields...) + fe.Details = "only name, apiVersion and kind are supported fields" + return fe + } + return nil + +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_conversion.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_conversion.go new file mode 100644 index 0000000000..9422c7a3c2 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_conversion.go @@ -0,0 +1,34 @@ +/* +Copyright 2020 The Knative Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + "fmt" + + "knative.dev/pkg/apis" +) + +// ConvertTo implements apis.Convertible +func (source *Subscription) ConvertTo(ctx context.Context, sink apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", sink) +} + +// ConvertFrom implements apis.Convertible +func (sink *Subscription) ConvertFrom(ctx context.Context, source apis.Convertible) error { + return fmt.Errorf("v1 is the highest known version, got: %T", source) +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_defaults.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_defaults.go new file mode 100644 index 0000000000..c2ddc46ac0 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_defaults.go @@ -0,0 +1,29 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" +) + +func (s *Subscription) SetDefaults(ctx context.Context) { + s.Spec.SetDefaults(ctx) +} + +func (ss *SubscriptionSpec) SetDefaults(ctx context.Context) { + // TODO anything? +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_lifecycle.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_lifecycle.go new file mode 100644 index 0000000000..e09e75116b --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_lifecycle.go @@ -0,0 +1,115 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "knative.dev/pkg/apis" +) + +// SubCondSet is a condition set with Ready as the happy condition and +// ReferencesResolved and ChannelReady as the dependent conditions. +var SubCondSet = apis.NewLivingConditionSet(SubscriptionConditionReferencesResolved, SubscriptionConditionAddedToChannel, SubscriptionConditionChannelReady) + +const ( + // SubscriptionConditionReady has status True when all subconditions below have been set to True. + SubscriptionConditionReady = apis.ConditionReady + // SubscriptionConditionReferencesResolved has status True when all the specified references have been successfully + // resolved. + SubscriptionConditionReferencesResolved apis.ConditionType = "ReferencesResolved" + + // SubscriptionConditionAddedToChannel has status True when controller has successfully added a + // subscription to the spec.channel resource. + SubscriptionConditionAddedToChannel apis.ConditionType = "AddedToChannel" + + // SubscriptionConditionChannelReady has status True when the channel has marked the subscriber as 'ready' + SubscriptionConditionChannelReady apis.ConditionType = "ChannelReady" +) + +// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. +func (*Subscription) GetConditionSet() apis.ConditionSet { + return SubCondSet +} + +// GetCondition returns the condition currently associated with the given type, or nil. +func (ss *SubscriptionStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return SubCondSet.Manage(ss).GetCondition(t) +} + +// GetTopLevelCondition returns the top level Condition. +func (ss *SubscriptionStatus) GetTopLevelCondition() *apis.Condition { + return SubCondSet.Manage(ss).GetTopLevelCondition() +} + +// IsReady returns true if the resource is ready overall. +func (ss *SubscriptionStatus) IsReady() bool { + return SubCondSet.Manage(ss).IsHappy() +} + +// IsAddedToChannel returns true if SubscriptionConditionAddedToChannel is true +func (ss *SubscriptionStatus) IsAddedToChannel() bool { + return ss.GetCondition(SubscriptionConditionAddedToChannel).IsTrue() +} + +// AreReferencesResolved returns true if SubscriptionConditionReferencesResolved is true +func (ss *SubscriptionStatus) AreReferencesResolved() bool { + return ss.GetCondition(SubscriptionConditionReferencesResolved).IsTrue() +} + +// InitializeConditions sets relevant unset conditions to Unknown state. +func (ss *SubscriptionStatus) InitializeConditions() { + SubCondSet.Manage(ss).InitializeConditions() +} + +// MarkReferencesResolved sets the ReferencesResolved condition to True state. +func (ss *SubscriptionStatus) MarkReferencesResolved() { + SubCondSet.Manage(ss).MarkTrue(SubscriptionConditionReferencesResolved) +} + +// MarkChannelReady sets the ChannelReady condition to True state. +func (ss *SubscriptionStatus) MarkChannelReady() { + SubCondSet.Manage(ss).MarkTrue(SubscriptionConditionChannelReady) +} + +// MarkAddedToChannel sets the AddedToChannel condition to True state. +func (ss *SubscriptionStatus) MarkAddedToChannel() { + SubCondSet.Manage(ss).MarkTrue(SubscriptionConditionAddedToChannel) +} + +// MarkReferencesNotResolved sets the ReferencesResolved condition to False state. +func (ss *SubscriptionStatus) MarkReferencesNotResolved(reason, messageFormat string, messageA ...interface{}) { + SubCondSet.Manage(ss).MarkFalse(SubscriptionConditionReferencesResolved, reason, messageFormat, messageA...) +} + +// MarkReferencesResolvedUnknown sets the ReferencesResolved condition to Unknown state. +func (ss *SubscriptionStatus) MarkReferencesResolvedUnknown(reason, messageFormat string, messageA ...interface{}) { + SubCondSet.Manage(ss).MarkUnknown(SubscriptionConditionReferencesResolved, reason, messageFormat, messageA...) +} + +// MarkChannelFailed sets the ChannelReady condition to False state. +func (ss *SubscriptionStatus) MarkChannelFailed(reason, messageFormat string, messageA ...interface{}) { + SubCondSet.Manage(ss).MarkFalse(SubscriptionConditionChannelReady, reason, messageFormat, messageA) +} + +// MarkChannelUnknown sets the ChannelReady condition to Unknown state. +func (ss *SubscriptionStatus) MarkChannelUnknown(reason, messageFormat string, messageA ...interface{}) { + SubCondSet.Manage(ss).MarkUnknown(SubscriptionConditionChannelReady, reason, messageFormat, messageA...) +} + +// MarkNotAddedToChannel sets the AddedToChannel condition to False state. +func (ss *SubscriptionStatus) MarkNotAddedToChannel(reason, messageFormat string, messageA ...interface{}) { + SubCondSet.Manage(ss).MarkFalse(SubscriptionConditionAddedToChannel, reason, messageFormat, messageA...) +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_types.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_types.go new file mode 100644 index 0000000000..a42f549eff --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_types.go @@ -0,0 +1,156 @@ +/* + * Copyright 2020 The Knative Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/kmeta" + + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" +) + +// +genclient +// +genreconciler +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:defaulter-gen=true + +// Subscription routes events received on a Channel to a DNS name and +// corresponds to the subscriptions.channels.knative.dev CRD. +type Subscription struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + Spec SubscriptionSpec `json:"spec"` + Status SubscriptionStatus `json:"status,omitempty"` +} + +var ( + // Check that Subscription can be validated, can be defaulted, and has immutable fields. + _ apis.Validatable = (*Subscription)(nil) + _ apis.Defaultable = (*Subscription)(nil) + + // Check that Subscription can return its spec untyped. + _ apis.HasSpec = (*Subscription)(nil) + + _ runtime.Object = (*Subscription)(nil) + + // Check that we can create OwnerReferences to a Subscription. + _ kmeta.OwnerRefable = (*Subscription)(nil) + + // Check that the type conforms to the duck Knative Resource shape. + _ duckv1.KRShaped = (*Subscription)(nil) +) + +// SubscriptionSpec specifies the Channel for incoming events, a Subscriber target +// for processing those events and where to put the result of the processing. Only +// From (where the events are coming from) is always required. You can optionally +// only Process the events (results in no output events) by leaving out the Result. +// You can also perform an identity transformation on the incoming events by leaving +// out the Subscriber and only specifying Result. +// +// The following are all valid specifications: +// channel --[subscriber]--> reply +// Sink, no outgoing events: +// channel -- subscriber +// no-op function (identity transformation): +// channel --> reply +type SubscriptionSpec struct { + // Reference to a channel that will be used to create the subscription + // You can specify only the following fields of the ObjectReference: + // - Kind + // - APIVersion + // - Name + // The resource pointed by this ObjectReference must meet the + // contract to the ChannelableSpec duck type. If the resource does not + // meet this contract it will be reflected in the Subscription's status. + // + // This field is immutable. We have no good answer on what happens to + // the events that are currently in the channel being consumed from + // and what the semantics there should be. For now, you can always + // delete the Subscription and recreate it to point to a different + // channel, giving the user more control over what semantics should + // be used (drain the channel first, possibly have events dropped, + // etc.) + Channel corev1.ObjectReference `json:"channel"` + + // Subscriber is reference to (optional) function for processing events. + // Events from the Channel will be delivered here and replies are + // sent to a Destination as specified by the Reply. + // +optional + Subscriber *duckv1.Destination `json:"subscriber,omitempty"` + + // Reply specifies (optionally) how to handle events returned from + // the Subscriber target. + // +optional + Reply *duckv1.Destination `json:"reply,omitempty"` + + // Delivery configuration + // +optional + Delivery *eventingduckv1.DeliverySpec `json:"delivery,omitempty"` +} + +// SubscriptionStatus (computed) for a subscription +type SubscriptionStatus struct { + // inherits duck/v1 Status, which currently provides: + // * ObservedGeneration - the 'Generation' of the Service that was last processed by the controller. + // * Conditions - the latest available observations of a resource's current state. + duckv1.Status `json:",inline"` + + // PhysicalSubscription is the fully resolved values that this Subscription represents. + PhysicalSubscription SubscriptionStatusPhysicalSubscription `json:"physicalSubscription,omitempty"` +} + +// SubscriptionStatusPhysicalSubscription represents the fully resolved values for this +// Subscription. +type SubscriptionStatusPhysicalSubscription struct { + // SubscriberURI is the fully resolved URI for spec.subscriber. + SubscriberURI *apis.URL `json:"subscriberUri,omitempty"` + + // ReplyURI is the fully resolved URI for the spec.reply. + ReplyURI *apis.URL `json:"replyUri,omitempty"` + + // ReplyURI is the fully resolved URI for the spec.delivery.deadLetterSink. + DeadLetterSinkURI *apis.URL `json:"deadLetterSinkUri,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SubscriptionList returned in list operations +type SubscriptionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []Subscription `json:"items"` +} + +// GetGroupVersionKind returns GroupVersionKind for Subscriptions +func (*Subscription) GetGroupVersionKind() schema.GroupVersionKind { + return SchemeGroupVersion.WithKind("Subscription") +} + +// GetUntypedSpec returns the spec of the Subscription. +func (s *Subscription) GetUntypedSpec() interface{} { + return s.Spec +} + +// GetStatus retrieves the status of the Subscription. Implements the KRShaped interface. +func (s *Subscription) GetStatus() *duckv1.Status { + return &s.Status.Status +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_validation.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_validation.go new file mode 100644 index 0000000000..2b96cb6cad --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/subscription_validation.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + + "github.com/google/go-cmp/cmp/cmpopts" + "k8s.io/apimachinery/pkg/api/equality" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/kmp" +) + +func (s *Subscription) Validate(ctx context.Context) *apis.FieldError { + return s.Spec.Validate(ctx).ViaField("spec") +} + +func (ss *SubscriptionSpec) Validate(ctx context.Context) *apis.FieldError { + // We require always Channel. + // Also at least one of 'subscriber' and 'reply' must be defined (non-nil and non-empty). + + var errs *apis.FieldError + if isChannelEmpty(ss.Channel) { + fe := apis.ErrMissingField("channel") + fe.Details = "the Subscription must reference a channel" + return fe + } else if fe := isValidChannel(ss.Channel); fe != nil { + errs = errs.Also(fe.ViaField("channel")) + } + + missingSubscriber := isDestinationNilOrEmpty(ss.Subscriber) + missingReply := isDestinationNilOrEmpty(ss.Reply) + if missingSubscriber && missingReply { + fe := apis.ErrMissingField("reply", "subscriber") + fe.Details = "the Subscription must reference at least one of (reply or a subscriber)" + errs = errs.Also(fe) + } + + if !missingSubscriber { + if fe := ss.Subscriber.Validate(ctx); fe != nil { + errs = errs.Also(fe.ViaField("subscriber")) + } + } + + if !missingReply { + if fe := ss.Reply.Validate(ctx); fe != nil { + errs = errs.Also(fe.ViaField("reply")) + } + } + + return errs +} + +func isDestinationNilOrEmpty(d *duckv1.Destination) bool { + return d == nil || equality.Semantic.DeepEqual(d, &duckv1.Destination{}) +} + +func (s *Subscription) CheckImmutableFields(ctx context.Context, original *Subscription) *apis.FieldError { + if original == nil { + return nil + } + + // Only Subscriber and Reply are mutable. + ignoreArguments := cmpopts.IgnoreFields(SubscriptionSpec{}, "Subscriber", "Reply") + if diff, err := kmp.ShortDiff(original.Spec, s.Spec, ignoreArguments); err != nil { + return &apis.FieldError{ + Message: "Failed to diff Subscription", + Paths: []string{"spec"}, + Details: err.Error(), + } + } else if diff != "" { + return &apis.FieldError{ + Message: "Immutable fields changed (-old +new)", + Paths: []string{"spec"}, + Details: diff, + } + } + return nil +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..f5158622a9 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go @@ -0,0 +1,431 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + apisduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + apis "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Channel) DeepCopyInto(out *Channel) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Channel. +func (in *Channel) DeepCopy() *Channel { + if in == nil { + return nil + } + out := new(Channel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Channel) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ChannelList) DeepCopyInto(out *ChannelList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Channel, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelList. +func (in *ChannelList) DeepCopy() *ChannelList { + if in == nil { + return nil + } + out := new(ChannelList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ChannelList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ChannelSpec) DeepCopyInto(out *ChannelSpec) { + *out = *in + if in.ChannelTemplate != nil { + in, out := &in.ChannelTemplate, &out.ChannelTemplate + *out = new(ChannelTemplateSpec) + (*in).DeepCopyInto(*out) + } + in.ChannelableSpec.DeepCopyInto(&out.ChannelableSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelSpec. +func (in *ChannelSpec) DeepCopy() *ChannelSpec { + if in == nil { + return nil + } + out := new(ChannelSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ChannelStatus) DeepCopyInto(out *ChannelStatus) { + *out = *in + in.ChannelableStatus.DeepCopyInto(&out.ChannelableStatus) + if in.Channel != nil { + in, out := &in.Channel, &out.Channel + *out = new(duckv1.KReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelStatus. +func (in *ChannelStatus) DeepCopy() *ChannelStatus { + if in == nil { + return nil + } + out := new(ChannelStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ChannelTemplateSpec) DeepCopyInto(out *ChannelTemplateSpec) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelTemplateSpec. +func (in *ChannelTemplateSpec) DeepCopy() *ChannelTemplateSpec { + if in == nil { + return nil + } + out := new(ChannelTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ChannelTemplateSpec) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ChannelTemplateSpecInternal) DeepCopyInto(out *ChannelTemplateSpecInternal) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelTemplateSpecInternal. +func (in *ChannelTemplateSpecInternal) DeepCopy() *ChannelTemplateSpecInternal { + if in == nil { + return nil + } + out := new(ChannelTemplateSpecInternal) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ChannelTemplateSpecInternal) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InMemoryChannel) DeepCopyInto(out *InMemoryChannel) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InMemoryChannel. +func (in *InMemoryChannel) DeepCopy() *InMemoryChannel { + if in == nil { + return nil + } + out := new(InMemoryChannel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InMemoryChannel) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InMemoryChannelList) DeepCopyInto(out *InMemoryChannelList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]InMemoryChannel, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InMemoryChannelList. +func (in *InMemoryChannelList) DeepCopy() *InMemoryChannelList { + if in == nil { + return nil + } + out := new(InMemoryChannelList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InMemoryChannelList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InMemoryChannelSpec) DeepCopyInto(out *InMemoryChannelSpec) { + *out = *in + in.ChannelableSpec.DeepCopyInto(&out.ChannelableSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InMemoryChannelSpec. +func (in *InMemoryChannelSpec) DeepCopy() *InMemoryChannelSpec { + if in == nil { + return nil + } + out := new(InMemoryChannelSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InMemoryChannelStatus) DeepCopyInto(out *InMemoryChannelStatus) { + *out = *in + in.ChannelableStatus.DeepCopyInto(&out.ChannelableStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InMemoryChannelStatus. +func (in *InMemoryChannelStatus) DeepCopy() *InMemoryChannelStatus { + if in == nil { + return nil + } + out := new(InMemoryChannelStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subscription) DeepCopyInto(out *Subscription) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription. +func (in *Subscription) DeepCopy() *Subscription { + if in == nil { + return nil + } + out := new(Subscription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Subscription) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Subscription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList. +func (in *SubscriptionList) DeepCopy() *SubscriptionList { + if in == nil { + return nil + } + out := new(SubscriptionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SubscriptionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionSpec) DeepCopyInto(out *SubscriptionSpec) { + *out = *in + out.Channel = in.Channel + if in.Subscriber != nil { + in, out := &in.Subscriber, &out.Subscriber + *out = new(duckv1.Destination) + (*in).DeepCopyInto(*out) + } + if in.Reply != nil { + in, out := &in.Reply, &out.Reply + *out = new(duckv1.Destination) + (*in).DeepCopyInto(*out) + } + if in.Delivery != nil { + in, out := &in.Delivery, &out.Delivery + *out = new(apisduckv1.DeliverySpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionSpec. +func (in *SubscriptionSpec) DeepCopy() *SubscriptionSpec { + if in == nil { + return nil + } + out := new(SubscriptionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus) { + *out = *in + in.Status.DeepCopyInto(&out.Status) + in.PhysicalSubscription.DeepCopyInto(&out.PhysicalSubscription) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionStatus. +func (in *SubscriptionStatus) DeepCopy() *SubscriptionStatus { + if in == nil { + return nil + } + out := new(SubscriptionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionStatusPhysicalSubscription) DeepCopyInto(out *SubscriptionStatusPhysicalSubscription) { + *out = *in + if in.SubscriberURI != nil { + in, out := &in.SubscriberURI, &out.SubscriberURI + *out = new(apis.URL) + (*in).DeepCopyInto(*out) + } + if in.ReplyURI != nil { + in, out := &in.ReplyURI, &out.ReplyURI + *out = new(apis.URL) + (*in).DeepCopyInto(*out) + } + if in.DeadLetterSinkURI != nil { + in, out := &in.DeadLetterSinkURI, &out.DeadLetterSinkURI + *out = new(apis.URL) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionStatusPhysicalSubscription. +func (in *SubscriptionStatusPhysicalSubscription) DeepCopy() *SubscriptionStatusPhysicalSubscription { + if in == nil { + return nil + } + out := new(SubscriptionStatusPhysicalSubscription) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1beta1/channel_conversion.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1beta1/channel_conversion.go index de642bd873..c2217ef2fa 100644 --- a/vendor/knative.dev/eventing/pkg/apis/messaging/v1beta1/channel_conversion.go +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1beta1/channel_conversion.go @@ -1,12 +1,9 @@ /* Copyright 2020 The Knative 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. @@ -20,15 +17,83 @@ import ( "context" "fmt" + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + "knative.dev/eventing/pkg/apis/duck/v1beta1" + v1 "knative.dev/eventing/pkg/apis/messaging/v1" "knative.dev/pkg/apis" ) // ConvertTo implements apis.Convertible -func (source *Channel) ConvertTo(ctx context.Context, sink apis.Convertible) error { - return fmt.Errorf("v1beta1 is the highest known version, got: %T", sink) +// Converts source (from v1beta1.Channel) into v1.Channel +func (source *Channel) ConvertTo(ctx context.Context, obj apis.Convertible) error { + switch sink := obj.(type) { + case *v1.Channel: + sink.ObjectMeta = source.ObjectMeta + source.Status.ConvertTo(ctx, &sink.Status) + source.Spec.ConvertTo(ctx, &sink.Spec) + return nil + default: + return fmt.Errorf("unknown version, got: %T", sink) + } +} + +// ConvertTo helps implement apis.Convertible +func (source *ChannelSpec) ConvertTo(ctx context.Context, sink *v1.ChannelSpec) { + if source.ChannelTemplate != nil { + sink.ChannelTemplate = &v1.ChannelTemplateSpec{ + TypeMeta: source.ChannelTemplate.TypeMeta, + Spec: source.ChannelTemplate.Spec, + } + } + sink.ChannelableSpec = eventingduckv1.ChannelableSpec{} + if source.Delivery != nil { + sink.Delivery = &eventingduckv1.DeliverySpec{} + source.Delivery.ConvertTo(ctx, sink.Delivery) + } + source.SubscribableSpec.ConvertTo(ctx, &sink.SubscribableSpec) +} + +// ConvertTo helps implement apis.Convertible +func (source *ChannelStatus) ConvertTo(ctx context.Context, sink *v1.ChannelStatus) { + source.Status.ConvertTo(ctx, &sink.Status) + sink.AddressStatus.Address = source.AddressStatus.Address + source.SubscribableStatus.ConvertTo(ctx, &sink.SubscribableStatus) + sink.Channel = source.Channel +} + +// ConvertFrom implements apis.Convertible. +// Converts obj v1.Channel into v1beta1.Channel +func (sink *Channel) ConvertFrom(ctx context.Context, obj apis.Convertible) error { + switch source := obj.(type) { + case *v1.Channel: + sink.ObjectMeta = source.ObjectMeta + sink.Status.ConvertFrom(ctx, source.Status) + sink.Spec.ConvertFrom(ctx, source.Spec) + return nil + default: + return fmt.Errorf("unknown version, got: %T", source) + } +} + +// ConvertFrom helps implement apis.Convertible +func (sink *ChannelSpec) ConvertFrom(ctx context.Context, source v1.ChannelSpec) { + if source.ChannelTemplate != nil { + sink.ChannelTemplate = &ChannelTemplateSpec{ + TypeMeta: source.ChannelTemplate.TypeMeta, + Spec: source.ChannelTemplate.Spec, + } + } + if source.Delivery != nil { + sink.Delivery = &v1beta1.DeliverySpec{} + sink.Delivery.ConvertFrom(ctx, source.Delivery) + } + sink.ChannelableSpec.SubscribableSpec.ConvertFrom(ctx, source.ChannelableSpec.SubscribableSpec) } -// ConvertFrom implements apis.Convertible -func (sink *Channel) ConvertFrom(ctx context.Context, source apis.Convertible) error { - return fmt.Errorf("v1beta1 is the highest known version, got: %T", source) +// ConvertFrom helps implement apis.Convertible +func (sink *ChannelStatus) ConvertFrom(ctx context.Context, source v1.ChannelStatus) { + source.Status.ConvertTo(ctx, &sink.Status) + sink.Channel = source.Channel + sink.SubscribableStatus.ConvertFrom(ctx, source.SubscribableStatus) + sink.AddressStatus.Address = source.AddressStatus.Address } diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/clientset.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/clientset.go index 21897073e1..b69841c4ab 100644 --- a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/clientset.go +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/clientset.go @@ -27,7 +27,9 @@ import ( configsv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/configs/v1alpha1" eventingv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1" eventingv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1beta1" + flowsv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1" flowsv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1beta1" + messagingv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1" messagingv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1beta1" sourcesv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" sourcesv1alpha2 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2" @@ -39,7 +41,9 @@ type Interface interface { EventingV1beta1() eventingv1beta1.EventingV1beta1Interface EventingV1() eventingv1.EventingV1Interface FlowsV1beta1() flowsv1beta1.FlowsV1beta1Interface + FlowsV1() flowsv1.FlowsV1Interface MessagingV1beta1() messagingv1beta1.MessagingV1beta1Interface + MessagingV1() messagingv1.MessagingV1Interface SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface SourcesV1alpha2() sourcesv1alpha2.SourcesV1alpha2Interface } @@ -52,7 +56,9 @@ type Clientset struct { eventingV1beta1 *eventingv1beta1.EventingV1beta1Client eventingV1 *eventingv1.EventingV1Client flowsV1beta1 *flowsv1beta1.FlowsV1beta1Client + flowsV1 *flowsv1.FlowsV1Client messagingV1beta1 *messagingv1beta1.MessagingV1beta1Client + messagingV1 *messagingv1.MessagingV1Client sourcesV1alpha1 *sourcesv1alpha1.SourcesV1alpha1Client sourcesV1alpha2 *sourcesv1alpha2.SourcesV1alpha2Client } @@ -77,11 +83,21 @@ func (c *Clientset) FlowsV1beta1() flowsv1beta1.FlowsV1beta1Interface { return c.flowsV1beta1 } +// FlowsV1 retrieves the FlowsV1Client +func (c *Clientset) FlowsV1() flowsv1.FlowsV1Interface { + return c.flowsV1 +} + // MessagingV1beta1 retrieves the MessagingV1beta1Client func (c *Clientset) MessagingV1beta1() messagingv1beta1.MessagingV1beta1Interface { return c.messagingV1beta1 } +// MessagingV1 retrieves the MessagingV1Client +func (c *Clientset) MessagingV1() messagingv1.MessagingV1Interface { + return c.messagingV1 +} + // SourcesV1alpha1 retrieves the SourcesV1alpha1Client func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface { return c.sourcesV1alpha1 @@ -129,10 +145,18 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.flowsV1, err = flowsv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.messagingV1beta1, err = messagingv1beta1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } + cs.messagingV1, err = messagingv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.sourcesV1alpha1, err = sourcesv1alpha1.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -157,7 +181,9 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.eventingV1beta1 = eventingv1beta1.NewForConfigOrDie(c) cs.eventingV1 = eventingv1.NewForConfigOrDie(c) cs.flowsV1beta1 = flowsv1beta1.NewForConfigOrDie(c) + cs.flowsV1 = flowsv1.NewForConfigOrDie(c) cs.messagingV1beta1 = messagingv1beta1.NewForConfigOrDie(c) + cs.messagingV1 = messagingv1.NewForConfigOrDie(c) cs.sourcesV1alpha1 = sourcesv1alpha1.NewForConfigOrDie(c) cs.sourcesV1alpha2 = sourcesv1alpha2.NewForConfigOrDie(c) @@ -172,7 +198,9 @@ func New(c rest.Interface) *Clientset { cs.eventingV1beta1 = eventingv1beta1.New(c) cs.eventingV1 = eventingv1.New(c) cs.flowsV1beta1 = flowsv1beta1.New(c) + cs.flowsV1 = flowsv1.New(c) cs.messagingV1beta1 = messagingv1beta1.New(c) + cs.messagingV1 = messagingv1.New(c) cs.sourcesV1alpha1 = sourcesv1alpha1.New(c) cs.sourcesV1alpha2 = sourcesv1alpha2.New(c) diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/fake/clientset_generated.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/fake/clientset_generated.go index a3c066cafe..dd0fed242f 100644 --- a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -31,8 +31,12 @@ import ( fakeeventingv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1/fake" eventingv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1beta1" fakeeventingv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1beta1/fake" + flowsv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1" + fakeflowsv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake" flowsv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1beta1" fakeflowsv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1beta1/fake" + messagingv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1" + fakemessagingv1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake" messagingv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1beta1" fakemessagingv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1beta1/fake" sourcesv1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" @@ -108,11 +112,21 @@ func (c *Clientset) FlowsV1beta1() flowsv1beta1.FlowsV1beta1Interface { return &fakeflowsv1beta1.FakeFlowsV1beta1{Fake: &c.Fake} } +// FlowsV1 retrieves the FlowsV1Client +func (c *Clientset) FlowsV1() flowsv1.FlowsV1Interface { + return &fakeflowsv1.FakeFlowsV1{Fake: &c.Fake} +} + // MessagingV1beta1 retrieves the MessagingV1beta1Client func (c *Clientset) MessagingV1beta1() messagingv1beta1.MessagingV1beta1Interface { return &fakemessagingv1beta1.FakeMessagingV1beta1{Fake: &c.Fake} } +// MessagingV1 retrieves the MessagingV1Client +func (c *Clientset) MessagingV1() messagingv1.MessagingV1Interface { + return &fakemessagingv1.FakeMessagingV1{Fake: &c.Fake} +} + // SourcesV1alpha1 retrieves the SourcesV1alpha1Client func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface { return &fakesourcesv1alpha1.FakeSourcesV1alpha1{Fake: &c.Fake} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/fake/register.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/fake/register.go index d767c43548..f2579b5b7e 100644 --- a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/fake/register.go +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/fake/register.go @@ -27,7 +27,9 @@ import ( configsv1alpha1 "knative.dev/eventing/pkg/apis/configs/v1alpha1" eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" eventingv1beta1 "knative.dev/eventing/pkg/apis/eventing/v1beta1" + flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" flowsv1beta1 "knative.dev/eventing/pkg/apis/flows/v1beta1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" messagingv1beta1 "knative.dev/eventing/pkg/apis/messaging/v1beta1" sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" sourcesv1alpha2 "knative.dev/eventing/pkg/apis/sources/v1alpha2" @@ -41,7 +43,9 @@ var localSchemeBuilder = runtime.SchemeBuilder{ eventingv1beta1.AddToScheme, eventingv1.AddToScheme, flowsv1beta1.AddToScheme, + flowsv1.AddToScheme, messagingv1beta1.AddToScheme, + messagingv1.AddToScheme, sourcesv1alpha1.AddToScheme, sourcesv1alpha2.AddToScheme, } diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/scheme/register.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/scheme/register.go index a6cb9e4ac2..e055463a7d 100644 --- a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/scheme/register.go +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/scheme/register.go @@ -27,7 +27,9 @@ import ( configsv1alpha1 "knative.dev/eventing/pkg/apis/configs/v1alpha1" eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" eventingv1beta1 "knative.dev/eventing/pkg/apis/eventing/v1beta1" + flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" flowsv1beta1 "knative.dev/eventing/pkg/apis/flows/v1beta1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" messagingv1beta1 "knative.dev/eventing/pkg/apis/messaging/v1beta1" sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" sourcesv1alpha2 "knative.dev/eventing/pkg/apis/sources/v1alpha2" @@ -41,7 +43,9 @@ var localSchemeBuilder = runtime.SchemeBuilder{ eventingv1beta1.AddToScheme, eventingv1.AddToScheme, flowsv1beta1.AddToScheme, + flowsv1.AddToScheme, messagingv1beta1.AddToScheme, + messagingv1.AddToScheme, sourcesv1alpha1.AddToScheme, sourcesv1alpha2.AddToScheme, } diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/doc.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/doc.go new file mode 100644 index 0000000000..5b83bd1f41 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/doc.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/doc.go new file mode 100644 index 0000000000..c7f6e65cab --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_flows_client.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_flows_client.go new file mode 100644 index 0000000000..35091f29ab --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_flows_client.go @@ -0,0 +1,44 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1" +) + +type FakeFlowsV1 struct { + *testing.Fake +} + +func (c *FakeFlowsV1) Parallels(namespace string) v1.ParallelInterface { + return &FakeParallels{c, namespace} +} + +func (c *FakeFlowsV1) Sequences(namespace string) v1.SequenceInterface { + return &FakeSequences{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeFlowsV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_parallel.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_parallel.go new file mode 100644 index 0000000000..3483ead0be --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_parallel.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" +) + +// FakeParallels implements ParallelInterface +type FakeParallels struct { + Fake *FakeFlowsV1 + ns string +} + +var parallelsResource = schema.GroupVersionResource{Group: "flows.knative.dev", Version: "v1", Resource: "parallels"} + +var parallelsKind = schema.GroupVersionKind{Group: "flows.knative.dev", Version: "v1", Kind: "Parallel"} + +// Get takes name of the parallel, and returns the corresponding parallel object, and an error if there is any. +func (c *FakeParallels) Get(name string, options v1.GetOptions) (result *flowsv1.Parallel, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(parallelsResource, c.ns, name), &flowsv1.Parallel{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Parallel), err +} + +// List takes label and field selectors, and returns the list of Parallels that match those selectors. +func (c *FakeParallels) List(opts v1.ListOptions) (result *flowsv1.ParallelList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(parallelsResource, parallelsKind, c.ns, opts), &flowsv1.ParallelList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &flowsv1.ParallelList{ListMeta: obj.(*flowsv1.ParallelList).ListMeta} + for _, item := range obj.(*flowsv1.ParallelList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested parallels. +func (c *FakeParallels) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(parallelsResource, c.ns, opts)) + +} + +// Create takes the representation of a parallel and creates it. Returns the server's representation of the parallel, and an error, if there is any. +func (c *FakeParallels) Create(parallel *flowsv1.Parallel) (result *flowsv1.Parallel, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(parallelsResource, c.ns, parallel), &flowsv1.Parallel{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Parallel), err +} + +// Update takes the representation of a parallel and updates it. Returns the server's representation of the parallel, and an error, if there is any. +func (c *FakeParallels) Update(parallel *flowsv1.Parallel) (result *flowsv1.Parallel, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(parallelsResource, c.ns, parallel), &flowsv1.Parallel{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Parallel), 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 *FakeParallels) UpdateStatus(parallel *flowsv1.Parallel) (*flowsv1.Parallel, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(parallelsResource, "status", c.ns, parallel), &flowsv1.Parallel{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Parallel), err +} + +// Delete takes name of the parallel and deletes it. Returns an error if one occurs. +func (c *FakeParallels) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(parallelsResource, c.ns, name), &flowsv1.Parallel{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeParallels) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(parallelsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &flowsv1.ParallelList{}) + return err +} + +// Patch applies the patch and returns the patched parallel. +func (c *FakeParallels) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *flowsv1.Parallel, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(parallelsResource, c.ns, name, pt, data, subresources...), &flowsv1.Parallel{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Parallel), err +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_sequence.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_sequence.go new file mode 100644 index 0000000000..bd35aa3917 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake/fake_sequence.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" +) + +// FakeSequences implements SequenceInterface +type FakeSequences struct { + Fake *FakeFlowsV1 + ns string +} + +var sequencesResource = schema.GroupVersionResource{Group: "flows.knative.dev", Version: "v1", Resource: "sequences"} + +var sequencesKind = schema.GroupVersionKind{Group: "flows.knative.dev", Version: "v1", Kind: "Sequence"} + +// Get takes name of the sequence, and returns the corresponding sequence object, and an error if there is any. +func (c *FakeSequences) Get(name string, options v1.GetOptions) (result *flowsv1.Sequence, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(sequencesResource, c.ns, name), &flowsv1.Sequence{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Sequence), err +} + +// List takes label and field selectors, and returns the list of Sequences that match those selectors. +func (c *FakeSequences) List(opts v1.ListOptions) (result *flowsv1.SequenceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(sequencesResource, sequencesKind, c.ns, opts), &flowsv1.SequenceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &flowsv1.SequenceList{ListMeta: obj.(*flowsv1.SequenceList).ListMeta} + for _, item := range obj.(*flowsv1.SequenceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested sequences. +func (c *FakeSequences) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(sequencesResource, c.ns, opts)) + +} + +// Create takes the representation of a sequence and creates it. Returns the server's representation of the sequence, and an error, if there is any. +func (c *FakeSequences) Create(sequence *flowsv1.Sequence) (result *flowsv1.Sequence, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(sequencesResource, c.ns, sequence), &flowsv1.Sequence{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Sequence), err +} + +// Update takes the representation of a sequence and updates it. Returns the server's representation of the sequence, and an error, if there is any. +func (c *FakeSequences) Update(sequence *flowsv1.Sequence) (result *flowsv1.Sequence, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(sequencesResource, c.ns, sequence), &flowsv1.Sequence{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Sequence), 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 *FakeSequences) UpdateStatus(sequence *flowsv1.Sequence) (*flowsv1.Sequence, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(sequencesResource, "status", c.ns, sequence), &flowsv1.Sequence{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Sequence), err +} + +// Delete takes name of the sequence and deletes it. Returns an error if one occurs. +func (c *FakeSequences) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(sequencesResource, c.ns, name), &flowsv1.Sequence{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSequences) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(sequencesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &flowsv1.SequenceList{}) + return err +} + +// Patch applies the patch and returns the patched sequence. +func (c *FakeSequences) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *flowsv1.Sequence, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(sequencesResource, c.ns, name, pt, data, subresources...), &flowsv1.Sequence{}) + + if obj == nil { + return nil, err + } + return obj.(*flowsv1.Sequence), err +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/flows_client.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/flows_client.go new file mode 100644 index 0000000000..cd2e6fb94e --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/flows_client.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + rest "k8s.io/client-go/rest" + v1 "knative.dev/eventing/pkg/apis/flows/v1" + "knative.dev/eventing/pkg/client/clientset/versioned/scheme" +) + +type FlowsV1Interface interface { + RESTClient() rest.Interface + ParallelsGetter + SequencesGetter +} + +// FlowsV1Client is used to interact with features provided by the flows.knative.dev group. +type FlowsV1Client struct { + restClient rest.Interface +} + +func (c *FlowsV1Client) Parallels(namespace string) ParallelInterface { + return newParallels(c, namespace) +} + +func (c *FlowsV1Client) Sequences(namespace string) SequenceInterface { + return newSequences(c, namespace) +} + +// NewForConfig creates a new FlowsV1Client for the given config. +func NewForConfig(c *rest.Config) (*FlowsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &FlowsV1Client{client}, nil +} + +// NewForConfigOrDie creates a new FlowsV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *FlowsV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new FlowsV1Client for the given RESTClient. +func New(c rest.Interface) *FlowsV1Client { + return &FlowsV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FlowsV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/generated_expansion.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/generated_expansion.go new file mode 100644 index 0000000000..9612fb9083 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/generated_expansion.go @@ -0,0 +1,23 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type ParallelExpansion interface{} + +type SequenceExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/parallel.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/parallel.go new file mode 100644 index 0000000000..32b162bbac --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/parallel.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "time" + + metav1 "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" + v1 "knative.dev/eventing/pkg/apis/flows/v1" + scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" +) + +// ParallelsGetter has a method to return a ParallelInterface. +// A group's client should implement this interface. +type ParallelsGetter interface { + Parallels(namespace string) ParallelInterface +} + +// ParallelInterface has methods to work with Parallel resources. +type ParallelInterface interface { + Create(*v1.Parallel) (*v1.Parallel, error) + Update(*v1.Parallel) (*v1.Parallel, error) + UpdateStatus(*v1.Parallel) (*v1.Parallel, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.Parallel, error) + List(opts metav1.ListOptions) (*v1.ParallelList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Parallel, err error) + ParallelExpansion +} + +// parallels implements ParallelInterface +type parallels struct { + client rest.Interface + ns string +} + +// newParallels returns a Parallels +func newParallels(c *FlowsV1Client, namespace string) *parallels { + return ¶llels{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the parallel, and returns the corresponding parallel object, and an error if there is any. +func (c *parallels) Get(name string, options metav1.GetOptions) (result *v1.Parallel, err error) { + result = &v1.Parallel{} + err = c.client.Get(). + Namespace(c.ns). + Resource("parallels"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Parallels that match those selectors. +func (c *parallels) List(opts metav1.ListOptions) (result *v1.ParallelList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ParallelList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("parallels"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested parallels. +func (c *parallels) Watch(opts metav1.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("parallels"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a parallel and creates it. Returns the server's representation of the parallel, and an error, if there is any. +func (c *parallels) Create(parallel *v1.Parallel) (result *v1.Parallel, err error) { + result = &v1.Parallel{} + err = c.client.Post(). + Namespace(c.ns). + Resource("parallels"). + Body(parallel). + Do(). + Into(result) + return +} + +// Update takes the representation of a parallel and updates it. Returns the server's representation of the parallel, and an error, if there is any. +func (c *parallels) Update(parallel *v1.Parallel) (result *v1.Parallel, err error) { + result = &v1.Parallel{} + err = c.client.Put(). + Namespace(c.ns). + Resource("parallels"). + Name(parallel.Name). + Body(parallel). + Do(). + 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 *parallels) UpdateStatus(parallel *v1.Parallel) (result *v1.Parallel, err error) { + result = &v1.Parallel{} + err = c.client.Put(). + Namespace(c.ns). + Resource("parallels"). + Name(parallel.Name). + SubResource("status"). + Body(parallel). + Do(). + Into(result) + return +} + +// Delete takes name of the parallel and deletes it. Returns an error if one occurs. +func (c *parallels) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("parallels"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *parallels) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("parallels"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched parallel. +func (c *parallels) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Parallel, err error) { + result = &v1.Parallel{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("parallels"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/sequence.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/sequence.go new file mode 100644 index 0000000000..414c70b41e --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/sequence.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "time" + + metav1 "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" + v1 "knative.dev/eventing/pkg/apis/flows/v1" + scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" +) + +// SequencesGetter has a method to return a SequenceInterface. +// A group's client should implement this interface. +type SequencesGetter interface { + Sequences(namespace string) SequenceInterface +} + +// SequenceInterface has methods to work with Sequence resources. +type SequenceInterface interface { + Create(*v1.Sequence) (*v1.Sequence, error) + Update(*v1.Sequence) (*v1.Sequence, error) + UpdateStatus(*v1.Sequence) (*v1.Sequence, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.Sequence, error) + List(opts metav1.ListOptions) (*v1.SequenceList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Sequence, err error) + SequenceExpansion +} + +// sequences implements SequenceInterface +type sequences struct { + client rest.Interface + ns string +} + +// newSequences returns a Sequences +func newSequences(c *FlowsV1Client, namespace string) *sequences { + return &sequences{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the sequence, and returns the corresponding sequence object, and an error if there is any. +func (c *sequences) Get(name string, options metav1.GetOptions) (result *v1.Sequence, err error) { + result = &v1.Sequence{} + err = c.client.Get(). + Namespace(c.ns). + Resource("sequences"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Sequences that match those selectors. +func (c *sequences) List(opts metav1.ListOptions) (result *v1.SequenceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.SequenceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("sequences"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested sequences. +func (c *sequences) Watch(opts metav1.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("sequences"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a sequence and creates it. Returns the server's representation of the sequence, and an error, if there is any. +func (c *sequences) Create(sequence *v1.Sequence) (result *v1.Sequence, err error) { + result = &v1.Sequence{} + err = c.client.Post(). + Namespace(c.ns). + Resource("sequences"). + Body(sequence). + Do(). + Into(result) + return +} + +// Update takes the representation of a sequence and updates it. Returns the server's representation of the sequence, and an error, if there is any. +func (c *sequences) Update(sequence *v1.Sequence) (result *v1.Sequence, err error) { + result = &v1.Sequence{} + err = c.client.Put(). + Namespace(c.ns). + Resource("sequences"). + Name(sequence.Name). + Body(sequence). + Do(). + 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 *sequences) UpdateStatus(sequence *v1.Sequence) (result *v1.Sequence, err error) { + result = &v1.Sequence{} + err = c.client.Put(). + Namespace(c.ns). + Resource("sequences"). + Name(sequence.Name). + SubResource("status"). + Body(sequence). + Do(). + Into(result) + return +} + +// Delete takes name of the sequence and deletes it. Returns an error if one occurs. +func (c *sequences) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("sequences"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *sequences) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("sequences"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched sequence. +func (c *sequences) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Sequence, err error) { + result = &v1.Sequence{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("sequences"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/channel.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/channel.go new file mode 100644 index 0000000000..012acc7c93 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/channel.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "time" + + metav1 "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" + v1 "knative.dev/eventing/pkg/apis/messaging/v1" + scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" +) + +// ChannelsGetter has a method to return a ChannelInterface. +// A group's client should implement this interface. +type ChannelsGetter interface { + Channels(namespace string) ChannelInterface +} + +// ChannelInterface has methods to work with Channel resources. +type ChannelInterface interface { + Create(*v1.Channel) (*v1.Channel, error) + Update(*v1.Channel) (*v1.Channel, error) + UpdateStatus(*v1.Channel) (*v1.Channel, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.Channel, error) + List(opts metav1.ListOptions) (*v1.ChannelList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Channel, err error) + ChannelExpansion +} + +// channels implements ChannelInterface +type channels struct { + client rest.Interface + ns string +} + +// newChannels returns a Channels +func newChannels(c *MessagingV1Client, namespace string) *channels { + return &channels{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the channel, and returns the corresponding channel object, and an error if there is any. +func (c *channels) Get(name string, options metav1.GetOptions) (result *v1.Channel, err error) { + result = &v1.Channel{} + err = c.client.Get(). + Namespace(c.ns). + Resource("channels"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Channels that match those selectors. +func (c *channels) List(opts metav1.ListOptions) (result *v1.ChannelList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ChannelList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("channels"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested channels. +func (c *channels) Watch(opts metav1.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("channels"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a channel and creates it. Returns the server's representation of the channel, and an error, if there is any. +func (c *channels) Create(channel *v1.Channel) (result *v1.Channel, err error) { + result = &v1.Channel{} + err = c.client.Post(). + Namespace(c.ns). + Resource("channels"). + Body(channel). + Do(). + Into(result) + return +} + +// Update takes the representation of a channel and updates it. Returns the server's representation of the channel, and an error, if there is any. +func (c *channels) Update(channel *v1.Channel) (result *v1.Channel, err error) { + result = &v1.Channel{} + err = c.client.Put(). + Namespace(c.ns). + Resource("channels"). + Name(channel.Name). + Body(channel). + Do(). + 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 *channels) UpdateStatus(channel *v1.Channel) (result *v1.Channel, err error) { + result = &v1.Channel{} + err = c.client.Put(). + Namespace(c.ns). + Resource("channels"). + Name(channel.Name). + SubResource("status"). + Body(channel). + Do(). + Into(result) + return +} + +// Delete takes name of the channel and deletes it. Returns an error if one occurs. +func (c *channels) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("channels"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *channels) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("channels"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched channel. +func (c *channels) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Channel, err error) { + result = &v1.Channel{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("channels"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/doc.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/doc.go new file mode 100644 index 0000000000..5b83bd1f41 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/doc.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/doc.go new file mode 100644 index 0000000000..c7f6e65cab --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_channel.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_channel.go new file mode 100644 index 0000000000..32b1547ce4 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_channel.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" +) + +// FakeChannels implements ChannelInterface +type FakeChannels struct { + Fake *FakeMessagingV1 + ns string +} + +var channelsResource = schema.GroupVersionResource{Group: "messaging.knative.dev", Version: "v1", Resource: "channels"} + +var channelsKind = schema.GroupVersionKind{Group: "messaging.knative.dev", Version: "v1", Kind: "Channel"} + +// Get takes name of the channel, and returns the corresponding channel object, and an error if there is any. +func (c *FakeChannels) Get(name string, options v1.GetOptions) (result *messagingv1.Channel, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(channelsResource, c.ns, name), &messagingv1.Channel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Channel), err +} + +// List takes label and field selectors, and returns the list of Channels that match those selectors. +func (c *FakeChannels) List(opts v1.ListOptions) (result *messagingv1.ChannelList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(channelsResource, channelsKind, c.ns, opts), &messagingv1.ChannelList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &messagingv1.ChannelList{ListMeta: obj.(*messagingv1.ChannelList).ListMeta} + for _, item := range obj.(*messagingv1.ChannelList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested channels. +func (c *FakeChannels) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(channelsResource, c.ns, opts)) + +} + +// Create takes the representation of a channel and creates it. Returns the server's representation of the channel, and an error, if there is any. +func (c *FakeChannels) Create(channel *messagingv1.Channel) (result *messagingv1.Channel, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(channelsResource, c.ns, channel), &messagingv1.Channel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Channel), err +} + +// Update takes the representation of a channel and updates it. Returns the server's representation of the channel, and an error, if there is any. +func (c *FakeChannels) Update(channel *messagingv1.Channel) (result *messagingv1.Channel, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(channelsResource, c.ns, channel), &messagingv1.Channel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Channel), 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 *FakeChannels) UpdateStatus(channel *messagingv1.Channel) (*messagingv1.Channel, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(channelsResource, "status", c.ns, channel), &messagingv1.Channel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Channel), err +} + +// Delete takes name of the channel and deletes it. Returns an error if one occurs. +func (c *FakeChannels) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(channelsResource, c.ns, name), &messagingv1.Channel{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeChannels) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(channelsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &messagingv1.ChannelList{}) + return err +} + +// Patch applies the patch and returns the patched channel. +func (c *FakeChannels) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *messagingv1.Channel, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(channelsResource, c.ns, name, pt, data, subresources...), &messagingv1.Channel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Channel), err +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_inmemorychannel.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_inmemorychannel.go new file mode 100644 index 0000000000..2d1a536cf5 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_inmemorychannel.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" +) + +// FakeInMemoryChannels implements InMemoryChannelInterface +type FakeInMemoryChannels struct { + Fake *FakeMessagingV1 + ns string +} + +var inmemorychannelsResource = schema.GroupVersionResource{Group: "messaging.knative.dev", Version: "v1", Resource: "inmemorychannels"} + +var inmemorychannelsKind = schema.GroupVersionKind{Group: "messaging.knative.dev", Version: "v1", Kind: "InMemoryChannel"} + +// Get takes name of the inMemoryChannel, and returns the corresponding inMemoryChannel object, and an error if there is any. +func (c *FakeInMemoryChannels) Get(name string, options v1.GetOptions) (result *messagingv1.InMemoryChannel, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(inmemorychannelsResource, c.ns, name), &messagingv1.InMemoryChannel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.InMemoryChannel), err +} + +// List takes label and field selectors, and returns the list of InMemoryChannels that match those selectors. +func (c *FakeInMemoryChannels) List(opts v1.ListOptions) (result *messagingv1.InMemoryChannelList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(inmemorychannelsResource, inmemorychannelsKind, c.ns, opts), &messagingv1.InMemoryChannelList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &messagingv1.InMemoryChannelList{ListMeta: obj.(*messagingv1.InMemoryChannelList).ListMeta} + for _, item := range obj.(*messagingv1.InMemoryChannelList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested inMemoryChannels. +func (c *FakeInMemoryChannels) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(inmemorychannelsResource, c.ns, opts)) + +} + +// Create takes the representation of a inMemoryChannel and creates it. Returns the server's representation of the inMemoryChannel, and an error, if there is any. +func (c *FakeInMemoryChannels) Create(inMemoryChannel *messagingv1.InMemoryChannel) (result *messagingv1.InMemoryChannel, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(inmemorychannelsResource, c.ns, inMemoryChannel), &messagingv1.InMemoryChannel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.InMemoryChannel), err +} + +// Update takes the representation of a inMemoryChannel and updates it. Returns the server's representation of the inMemoryChannel, and an error, if there is any. +func (c *FakeInMemoryChannels) Update(inMemoryChannel *messagingv1.InMemoryChannel) (result *messagingv1.InMemoryChannel, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(inmemorychannelsResource, c.ns, inMemoryChannel), &messagingv1.InMemoryChannel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.InMemoryChannel), 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 *FakeInMemoryChannels) UpdateStatus(inMemoryChannel *messagingv1.InMemoryChannel) (*messagingv1.InMemoryChannel, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(inmemorychannelsResource, "status", c.ns, inMemoryChannel), &messagingv1.InMemoryChannel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.InMemoryChannel), err +} + +// Delete takes name of the inMemoryChannel and deletes it. Returns an error if one occurs. +func (c *FakeInMemoryChannels) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(inmemorychannelsResource, c.ns, name), &messagingv1.InMemoryChannel{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeInMemoryChannels) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(inmemorychannelsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &messagingv1.InMemoryChannelList{}) + return err +} + +// Patch applies the patch and returns the patched inMemoryChannel. +func (c *FakeInMemoryChannels) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *messagingv1.InMemoryChannel, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(inmemorychannelsResource, c.ns, name, pt, data, subresources...), &messagingv1.InMemoryChannel{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.InMemoryChannel), err +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_messaging_client.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_messaging_client.go new file mode 100644 index 0000000000..117d377b11 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_messaging_client.go @@ -0,0 +1,48 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1" +) + +type FakeMessagingV1 struct { + *testing.Fake +} + +func (c *FakeMessagingV1) Channels(namespace string) v1.ChannelInterface { + return &FakeChannels{c, namespace} +} + +func (c *FakeMessagingV1) InMemoryChannels(namespace string) v1.InMemoryChannelInterface { + return &FakeInMemoryChannels{c, namespace} +} + +func (c *FakeMessagingV1) Subscriptions(namespace string) v1.SubscriptionInterface { + return &FakeSubscriptions{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMessagingV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_subscription.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_subscription.go new file mode 100644 index 0000000000..350d902643 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake/fake_subscription.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" +) + +// FakeSubscriptions implements SubscriptionInterface +type FakeSubscriptions struct { + Fake *FakeMessagingV1 + ns string +} + +var subscriptionsResource = schema.GroupVersionResource{Group: "messaging.knative.dev", Version: "v1", Resource: "subscriptions"} + +var subscriptionsKind = schema.GroupVersionKind{Group: "messaging.knative.dev", Version: "v1", Kind: "Subscription"} + +// Get takes name of the subscription, and returns the corresponding subscription object, and an error if there is any. +func (c *FakeSubscriptions) Get(name string, options v1.GetOptions) (result *messagingv1.Subscription, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(subscriptionsResource, c.ns, name), &messagingv1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Subscription), err +} + +// List takes label and field selectors, and returns the list of Subscriptions that match those selectors. +func (c *FakeSubscriptions) List(opts v1.ListOptions) (result *messagingv1.SubscriptionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(subscriptionsResource, subscriptionsKind, c.ns, opts), &messagingv1.SubscriptionList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &messagingv1.SubscriptionList{ListMeta: obj.(*messagingv1.SubscriptionList).ListMeta} + for _, item := range obj.(*messagingv1.SubscriptionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested subscriptions. +func (c *FakeSubscriptions) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(subscriptionsResource, c.ns, opts)) + +} + +// Create takes the representation of a subscription and creates it. Returns the server's representation of the subscription, and an error, if there is any. +func (c *FakeSubscriptions) Create(subscription *messagingv1.Subscription) (result *messagingv1.Subscription, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(subscriptionsResource, c.ns, subscription), &messagingv1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Subscription), err +} + +// Update takes the representation of a subscription and updates it. Returns the server's representation of the subscription, and an error, if there is any. +func (c *FakeSubscriptions) Update(subscription *messagingv1.Subscription) (result *messagingv1.Subscription, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(subscriptionsResource, c.ns, subscription), &messagingv1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Subscription), 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 *FakeSubscriptions) UpdateStatus(subscription *messagingv1.Subscription) (*messagingv1.Subscription, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(subscriptionsResource, "status", c.ns, subscription), &messagingv1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Subscription), err +} + +// Delete takes name of the subscription and deletes it. Returns an error if one occurs. +func (c *FakeSubscriptions) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(subscriptionsResource, c.ns, name), &messagingv1.Subscription{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSubscriptions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(subscriptionsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &messagingv1.SubscriptionList{}) + return err +} + +// Patch applies the patch and returns the patched subscription. +func (c *FakeSubscriptions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *messagingv1.Subscription, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(subscriptionsResource, c.ns, name, pt, data, subresources...), &messagingv1.Subscription{}) + + if obj == nil { + return nil, err + } + return obj.(*messagingv1.Subscription), err +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/generated_expansion.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/generated_expansion.go new file mode 100644 index 0000000000..5a35ebd8ae --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/generated_expansion.go @@ -0,0 +1,25 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type ChannelExpansion interface{} + +type InMemoryChannelExpansion interface{} + +type SubscriptionExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/inmemorychannel.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/inmemorychannel.go new file mode 100644 index 0000000000..d7496ac63e --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/inmemorychannel.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "time" + + metav1 "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" + v1 "knative.dev/eventing/pkg/apis/messaging/v1" + scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" +) + +// InMemoryChannelsGetter has a method to return a InMemoryChannelInterface. +// A group's client should implement this interface. +type InMemoryChannelsGetter interface { + InMemoryChannels(namespace string) InMemoryChannelInterface +} + +// InMemoryChannelInterface has methods to work with InMemoryChannel resources. +type InMemoryChannelInterface interface { + Create(*v1.InMemoryChannel) (*v1.InMemoryChannel, error) + Update(*v1.InMemoryChannel) (*v1.InMemoryChannel, error) + UpdateStatus(*v1.InMemoryChannel) (*v1.InMemoryChannel, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.InMemoryChannel, error) + List(opts metav1.ListOptions) (*v1.InMemoryChannelList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.InMemoryChannel, err error) + InMemoryChannelExpansion +} + +// inMemoryChannels implements InMemoryChannelInterface +type inMemoryChannels struct { + client rest.Interface + ns string +} + +// newInMemoryChannels returns a InMemoryChannels +func newInMemoryChannels(c *MessagingV1Client, namespace string) *inMemoryChannels { + return &inMemoryChannels{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the inMemoryChannel, and returns the corresponding inMemoryChannel object, and an error if there is any. +func (c *inMemoryChannels) Get(name string, options metav1.GetOptions) (result *v1.InMemoryChannel, err error) { + result = &v1.InMemoryChannel{} + err = c.client.Get(). + Namespace(c.ns). + Resource("inmemorychannels"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of InMemoryChannels that match those selectors. +func (c *inMemoryChannels) List(opts metav1.ListOptions) (result *v1.InMemoryChannelList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.InMemoryChannelList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("inmemorychannels"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested inMemoryChannels. +func (c *inMemoryChannels) Watch(opts metav1.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("inmemorychannels"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a inMemoryChannel and creates it. Returns the server's representation of the inMemoryChannel, and an error, if there is any. +func (c *inMemoryChannels) Create(inMemoryChannel *v1.InMemoryChannel) (result *v1.InMemoryChannel, err error) { + result = &v1.InMemoryChannel{} + err = c.client.Post(). + Namespace(c.ns). + Resource("inmemorychannels"). + Body(inMemoryChannel). + Do(). + Into(result) + return +} + +// Update takes the representation of a inMemoryChannel and updates it. Returns the server's representation of the inMemoryChannel, and an error, if there is any. +func (c *inMemoryChannels) Update(inMemoryChannel *v1.InMemoryChannel) (result *v1.InMemoryChannel, err error) { + result = &v1.InMemoryChannel{} + err = c.client.Put(). + Namespace(c.ns). + Resource("inmemorychannels"). + Name(inMemoryChannel.Name). + Body(inMemoryChannel). + Do(). + 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 *inMemoryChannels) UpdateStatus(inMemoryChannel *v1.InMemoryChannel) (result *v1.InMemoryChannel, err error) { + result = &v1.InMemoryChannel{} + err = c.client.Put(). + Namespace(c.ns). + Resource("inmemorychannels"). + Name(inMemoryChannel.Name). + SubResource("status"). + Body(inMemoryChannel). + Do(). + Into(result) + return +} + +// Delete takes name of the inMemoryChannel and deletes it. Returns an error if one occurs. +func (c *inMemoryChannels) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("inmemorychannels"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *inMemoryChannels) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("inmemorychannels"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched inMemoryChannel. +func (c *inMemoryChannels) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.InMemoryChannel, err error) { + result = &v1.InMemoryChannel{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("inmemorychannels"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/messaging_client.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/messaging_client.go new file mode 100644 index 0000000000..b025af8c76 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/messaging_client.go @@ -0,0 +1,99 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + rest "k8s.io/client-go/rest" + v1 "knative.dev/eventing/pkg/apis/messaging/v1" + "knative.dev/eventing/pkg/client/clientset/versioned/scheme" +) + +type MessagingV1Interface interface { + RESTClient() rest.Interface + ChannelsGetter + InMemoryChannelsGetter + SubscriptionsGetter +} + +// MessagingV1Client is used to interact with features provided by the messaging.knative.dev group. +type MessagingV1Client struct { + restClient rest.Interface +} + +func (c *MessagingV1Client) Channels(namespace string) ChannelInterface { + return newChannels(c, namespace) +} + +func (c *MessagingV1Client) InMemoryChannels(namespace string) InMemoryChannelInterface { + return newInMemoryChannels(c, namespace) +} + +func (c *MessagingV1Client) Subscriptions(namespace string) SubscriptionInterface { + return newSubscriptions(c, namespace) +} + +// NewForConfig creates a new MessagingV1Client for the given config. +func NewForConfig(c *rest.Config) (*MessagingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &MessagingV1Client{client}, nil +} + +// NewForConfigOrDie creates a new MessagingV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MessagingV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MessagingV1Client for the given RESTClient. +func New(c rest.Interface) *MessagingV1Client { + return &MessagingV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *MessagingV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/subscription.go b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/subscription.go new file mode 100644 index 0000000000..749a5ca04c --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/subscription.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "time" + + metav1 "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" + v1 "knative.dev/eventing/pkg/apis/messaging/v1" + scheme "knative.dev/eventing/pkg/client/clientset/versioned/scheme" +) + +// SubscriptionsGetter has a method to return a SubscriptionInterface. +// A group's client should implement this interface. +type SubscriptionsGetter interface { + Subscriptions(namespace string) SubscriptionInterface +} + +// SubscriptionInterface has methods to work with Subscription resources. +type SubscriptionInterface interface { + Create(*v1.Subscription) (*v1.Subscription, error) + Update(*v1.Subscription) (*v1.Subscription, error) + UpdateStatus(*v1.Subscription) (*v1.Subscription, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.Subscription, error) + List(opts metav1.ListOptions) (*v1.SubscriptionList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Subscription, err error) + SubscriptionExpansion +} + +// subscriptions implements SubscriptionInterface +type subscriptions struct { + client rest.Interface + ns string +} + +// newSubscriptions returns a Subscriptions +func newSubscriptions(c *MessagingV1Client, namespace string) *subscriptions { + return &subscriptions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the subscription, and returns the corresponding subscription object, and an error if there is any. +func (c *subscriptions) Get(name string, options metav1.GetOptions) (result *v1.Subscription, err error) { + result = &v1.Subscription{} + err = c.client.Get(). + Namespace(c.ns). + Resource("subscriptions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Subscriptions that match those selectors. +func (c *subscriptions) List(opts metav1.ListOptions) (result *v1.SubscriptionList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.SubscriptionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("subscriptions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested subscriptions. +func (c *subscriptions) Watch(opts metav1.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("subscriptions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a subscription and creates it. Returns the server's representation of the subscription, and an error, if there is any. +func (c *subscriptions) Create(subscription *v1.Subscription) (result *v1.Subscription, err error) { + result = &v1.Subscription{} + err = c.client.Post(). + Namespace(c.ns). + Resource("subscriptions"). + Body(subscription). + Do(). + Into(result) + return +} + +// Update takes the representation of a subscription and updates it. Returns the server's representation of the subscription, and an error, if there is any. +func (c *subscriptions) Update(subscription *v1.Subscription) (result *v1.Subscription, err error) { + result = &v1.Subscription{} + err = c.client.Put(). + Namespace(c.ns). + Resource("subscriptions"). + Name(subscription.Name). + Body(subscription). + Do(). + 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 *subscriptions) UpdateStatus(subscription *v1.Subscription) (result *v1.Subscription, err error) { + result = &v1.Subscription{} + err = c.client.Put(). + Namespace(c.ns). + Resource("subscriptions"). + Name(subscription.Name). + SubResource("status"). + Body(subscription). + Do(). + Into(result) + return +} + +// Delete takes name of the subscription and deletes it. Returns an error if one occurs. +func (c *subscriptions) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("subscriptions"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *subscriptions) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("subscriptions"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched subscription. +func (c *subscriptions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Subscription, err error) { + result = &v1.Subscription{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("subscriptions"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/interface.go index fb7f141771..96d048edd6 100644 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/interface.go +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/interface.go @@ -19,6 +19,7 @@ limitations under the License. package flows import ( + v1 "knative.dev/eventing/pkg/client/informers/externalversions/flows/v1" v1beta1 "knative.dev/eventing/pkg/client/informers/externalversions/flows/v1beta1" internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" ) @@ -27,6 +28,8 @@ import ( type Interface interface { // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/interface.go new file mode 100644 index 0000000000..96c6ac42e9 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Parallels returns a ParallelInformer. + Parallels() ParallelInformer + // Sequences returns a SequenceInformer. + Sequences() SequenceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Parallels returns a ParallelInformer. +func (v *version) Parallels() ParallelInformer { + return ¶llelInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Sequences returns a SequenceInformer. +func (v *version) Sequences() SequenceInformer { + return &sequenceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/parallel.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/parallel.go new file mode 100644 index 0000000000..d647ea206b --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/parallel.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" + versioned "knative.dev/eventing/pkg/client/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1 "knative.dev/eventing/pkg/client/listers/flows/v1" +) + +// ParallelInformer provides access to a shared informer and lister for +// Parallels. +type ParallelInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ParallelLister +} + +type parallelInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewParallelInformer constructs a new informer for Parallel type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewParallelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredParallelInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredParallelInformer constructs a new informer for Parallel type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredParallelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowsV1().Parallels(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowsV1().Parallels(namespace).Watch(options) + }, + }, + &flowsv1.Parallel{}, + resyncPeriod, + indexers, + ) +} + +func (f *parallelInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredParallelInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *parallelInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowsv1.Parallel{}, f.defaultInformer) +} + +func (f *parallelInformer) Lister() v1.ParallelLister { + return v1.NewParallelLister(f.Informer().GetIndexer()) +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/sequence.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/sequence.go new file mode 100644 index 0000000000..6a03d2a238 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/flows/v1/sequence.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" + versioned "knative.dev/eventing/pkg/client/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1 "knative.dev/eventing/pkg/client/listers/flows/v1" +) + +// SequenceInformer provides access to a shared informer and lister for +// Sequences. +type SequenceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.SequenceLister +} + +type sequenceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSequenceInformer constructs a new informer for Sequence type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSequenceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSequenceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSequenceInformer constructs a new informer for Sequence type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSequenceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowsV1().Sequences(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowsV1().Sequences(namespace).Watch(options) + }, + }, + &flowsv1.Sequence{}, + resyncPeriod, + indexers, + ) +} + +func (f *sequenceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSequenceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *sequenceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowsv1.Sequence{}, f.defaultInformer) +} + +func (f *sequenceInformer) Lister() v1.SequenceLister { + return v1.NewSequenceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/generic.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/generic.go index 83ba875db8..029ac619b4 100644 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/generic.go +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/generic.go @@ -26,7 +26,9 @@ import ( v1alpha1 "knative.dev/eventing/pkg/apis/configs/v1alpha1" v1 "knative.dev/eventing/pkg/apis/eventing/v1" v1beta1 "knative.dev/eventing/pkg/apis/eventing/v1beta1" + flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" flowsv1beta1 "knative.dev/eventing/pkg/apis/flows/v1beta1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" messagingv1beta1 "knative.dev/eventing/pkg/apis/messaging/v1beta1" sourcesv1alpha1 "knative.dev/eventing/pkg/apis/sources/v1alpha1" v1alpha2 "knative.dev/eventing/pkg/apis/sources/v1alpha2" @@ -76,12 +78,26 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1beta1.SchemeGroupVersion.WithResource("triggers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Eventing().V1beta1().Triggers().Informer()}, nil + // Group=flows.knative.dev, Version=v1 + case flowsv1.SchemeGroupVersion.WithResource("parallels"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flows().V1().Parallels().Informer()}, nil + case flowsv1.SchemeGroupVersion.WithResource("sequences"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flows().V1().Sequences().Informer()}, nil + // Group=flows.knative.dev, Version=v1beta1 case flowsv1beta1.SchemeGroupVersion.WithResource("parallels"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flows().V1beta1().Parallels().Informer()}, nil case flowsv1beta1.SchemeGroupVersion.WithResource("sequences"): return &genericInformer{resource: resource.GroupResource(), informer: f.Flows().V1beta1().Sequences().Informer()}, nil + // Group=messaging.knative.dev, Version=v1 + case messagingv1.SchemeGroupVersion.WithResource("channels"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1().Channels().Informer()}, nil + case messagingv1.SchemeGroupVersion.WithResource("inmemorychannels"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1().InMemoryChannels().Informer()}, nil + case messagingv1.SchemeGroupVersion.WithResource("subscriptions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1().Subscriptions().Informer()}, nil + // Group=messaging.knative.dev, Version=v1beta1 case messagingv1beta1.SchemeGroupVersion.WithResource("channels"): return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1beta1().Channels().Informer()}, nil diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/interface.go index f1fb58aee2..417b712cde 100644 --- a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/interface.go +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/interface.go @@ -20,6 +20,7 @@ package messaging import ( internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1 "knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1" v1beta1 "knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1beta1" ) @@ -27,6 +28,8 @@ import ( type Interface interface { // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/channel.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/channel.go new file mode 100644 index 0000000000..a283f6975e --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/channel.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + versioned "knative.dev/eventing/pkg/client/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1 "knative.dev/eventing/pkg/client/listers/messaging/v1" +) + +// ChannelInformer provides access to a shared informer and lister for +// Channels. +type ChannelInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ChannelLister +} + +type channelInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewChannelInformer constructs a new informer for Channel type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredChannelInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredChannelInformer constructs a new informer for Channel type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MessagingV1().Channels(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MessagingV1().Channels(namespace).Watch(options) + }, + }, + &messagingv1.Channel{}, + resyncPeriod, + indexers, + ) +} + +func (f *channelInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredChannelInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *channelInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&messagingv1.Channel{}, f.defaultInformer) +} + +func (f *channelInformer) Lister() v1.ChannelLister { + return v1.NewChannelLister(f.Informer().GetIndexer()) +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/inmemorychannel.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/inmemorychannel.go new file mode 100644 index 0000000000..6ad602dfbe --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/inmemorychannel.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + versioned "knative.dev/eventing/pkg/client/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1 "knative.dev/eventing/pkg/client/listers/messaging/v1" +) + +// InMemoryChannelInformer provides access to a shared informer and lister for +// InMemoryChannels. +type InMemoryChannelInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.InMemoryChannelLister +} + +type inMemoryChannelInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewInMemoryChannelInformer constructs a new informer for InMemoryChannel type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewInMemoryChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredInMemoryChannelInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredInMemoryChannelInformer constructs a new informer for InMemoryChannel type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredInMemoryChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MessagingV1().InMemoryChannels(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MessagingV1().InMemoryChannels(namespace).Watch(options) + }, + }, + &messagingv1.InMemoryChannel{}, + resyncPeriod, + indexers, + ) +} + +func (f *inMemoryChannelInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredInMemoryChannelInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *inMemoryChannelInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&messagingv1.InMemoryChannel{}, f.defaultInformer) +} + +func (f *inMemoryChannelInformer) Lister() v1.InMemoryChannelLister { + return v1.NewInMemoryChannelLister(f.Informer().GetIndexer()) +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/interface.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/interface.go new file mode 100644 index 0000000000..668ba3b7bf --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/interface.go @@ -0,0 +1,59 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Channels returns a ChannelInformer. + Channels() ChannelInformer + // InMemoryChannels returns a InMemoryChannelInformer. + InMemoryChannels() InMemoryChannelInformer + // Subscriptions returns a SubscriptionInformer. + Subscriptions() SubscriptionInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Channels returns a ChannelInformer. +func (v *version) Channels() ChannelInformer { + return &channelInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// InMemoryChannels returns a InMemoryChannelInformer. +func (v *version) InMemoryChannels() InMemoryChannelInformer { + return &inMemoryChannelInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Subscriptions returns a SubscriptionInformer. +func (v *version) Subscriptions() SubscriptionInformer { + return &subscriptionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/subscription.go b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/subscription.go new file mode 100644 index 0000000000..6634a5e030 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1/subscription.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + versioned "knative.dev/eventing/pkg/client/clientset/versioned" + internalinterfaces "knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces" + v1 "knative.dev/eventing/pkg/client/listers/messaging/v1" +) + +// SubscriptionInformer provides access to a shared informer and lister for +// Subscriptions. +type SubscriptionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.SubscriptionLister +} + +type subscriptionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSubscriptionInformer constructs a new informer for Subscription type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSubscriptionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSubscriptionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSubscriptionInformer constructs a new informer for Subscription type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSubscriptionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MessagingV1().Subscriptions(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MessagingV1().Subscriptions(namespace).Watch(options) + }, + }, + &messagingv1.Subscription{}, + resyncPeriod, + indexers, + ) +} + +func (f *subscriptionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSubscriptionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *subscriptionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&messagingv1.Subscription{}, f.defaultInformer) +} + +func (f *subscriptionInformer) Lister() v1.SubscriptionLister { + return v1.NewSubscriptionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/expansion_generated.go new file mode 100644 index 0000000000..791c076686 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// ParallelListerExpansion allows custom methods to be added to +// ParallelLister. +type ParallelListerExpansion interface{} + +// ParallelNamespaceListerExpansion allows custom methods to be added to +// ParallelNamespaceLister. +type ParallelNamespaceListerExpansion interface{} + +// SequenceListerExpansion allows custom methods to be added to +// SequenceLister. +type SequenceListerExpansion interface{} + +// SequenceNamespaceListerExpansion allows custom methods to be added to +// SequenceNamespaceLister. +type SequenceNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/parallel.go b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/parallel.go new file mode 100644 index 0000000000..bcf84cec7d --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/parallel.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "knative.dev/eventing/pkg/apis/flows/v1" +) + +// ParallelLister helps list Parallels. +type ParallelLister interface { + // List lists all Parallels in the indexer. + List(selector labels.Selector) (ret []*v1.Parallel, err error) + // Parallels returns an object that can list and get Parallels. + Parallels(namespace string) ParallelNamespaceLister + ParallelListerExpansion +} + +// parallelLister implements the ParallelLister interface. +type parallelLister struct { + indexer cache.Indexer +} + +// NewParallelLister returns a new ParallelLister. +func NewParallelLister(indexer cache.Indexer) ParallelLister { + return ¶llelLister{indexer: indexer} +} + +// List lists all Parallels in the indexer. +func (s *parallelLister) List(selector labels.Selector) (ret []*v1.Parallel, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Parallel)) + }) + return ret, err +} + +// Parallels returns an object that can list and get Parallels. +func (s *parallelLister) Parallels(namespace string) ParallelNamespaceLister { + return parallelNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ParallelNamespaceLister helps list and get Parallels. +type ParallelNamespaceLister interface { + // List lists all Parallels in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Parallel, err error) + // Get retrieves the Parallel from the indexer for a given namespace and name. + Get(name string) (*v1.Parallel, error) + ParallelNamespaceListerExpansion +} + +// parallelNamespaceLister implements the ParallelNamespaceLister +// interface. +type parallelNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Parallels in the indexer for a given namespace. +func (s parallelNamespaceLister) List(selector labels.Selector) (ret []*v1.Parallel, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Parallel)) + }) + return ret, err +} + +// Get retrieves the Parallel from the indexer for a given namespace and name. +func (s parallelNamespaceLister) Get(name string) (*v1.Parallel, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("parallel"), name) + } + return obj.(*v1.Parallel), nil +} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/sequence.go b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/sequence.go new file mode 100644 index 0000000000..e6f126333c --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/listers/flows/v1/sequence.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "knative.dev/eventing/pkg/apis/flows/v1" +) + +// SequenceLister helps list Sequences. +type SequenceLister interface { + // List lists all Sequences in the indexer. + List(selector labels.Selector) (ret []*v1.Sequence, err error) + // Sequences returns an object that can list and get Sequences. + Sequences(namespace string) SequenceNamespaceLister + SequenceListerExpansion +} + +// sequenceLister implements the SequenceLister interface. +type sequenceLister struct { + indexer cache.Indexer +} + +// NewSequenceLister returns a new SequenceLister. +func NewSequenceLister(indexer cache.Indexer) SequenceLister { + return &sequenceLister{indexer: indexer} +} + +// List lists all Sequences in the indexer. +func (s *sequenceLister) List(selector labels.Selector) (ret []*v1.Sequence, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Sequence)) + }) + return ret, err +} + +// Sequences returns an object that can list and get Sequences. +func (s *sequenceLister) Sequences(namespace string) SequenceNamespaceLister { + return sequenceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SequenceNamespaceLister helps list and get Sequences. +type SequenceNamespaceLister interface { + // List lists all Sequences in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Sequence, err error) + // Get retrieves the Sequence from the indexer for a given namespace and name. + Get(name string) (*v1.Sequence, error) + SequenceNamespaceListerExpansion +} + +// sequenceNamespaceLister implements the SequenceNamespaceLister +// interface. +type sequenceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Sequences in the indexer for a given namespace. +func (s sequenceNamespaceLister) List(selector labels.Selector) (ret []*v1.Sequence, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Sequence)) + }) + return ret, err +} + +// Get retrieves the Sequence from the indexer for a given namespace and name. +func (s sequenceNamespaceLister) Get(name string) (*v1.Sequence, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("sequence"), name) + } + return obj.(*v1.Sequence), nil +} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/channel.go b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/channel.go new file mode 100644 index 0000000000..28183c5b03 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/channel.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "knative.dev/eventing/pkg/apis/messaging/v1" +) + +// ChannelLister helps list Channels. +type ChannelLister interface { + // List lists all Channels in the indexer. + List(selector labels.Selector) (ret []*v1.Channel, err error) + // Channels returns an object that can list and get Channels. + Channels(namespace string) ChannelNamespaceLister + ChannelListerExpansion +} + +// channelLister implements the ChannelLister interface. +type channelLister struct { + indexer cache.Indexer +} + +// NewChannelLister returns a new ChannelLister. +func NewChannelLister(indexer cache.Indexer) ChannelLister { + return &channelLister{indexer: indexer} +} + +// List lists all Channels in the indexer. +func (s *channelLister) List(selector labels.Selector) (ret []*v1.Channel, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Channel)) + }) + return ret, err +} + +// Channels returns an object that can list and get Channels. +func (s *channelLister) Channels(namespace string) ChannelNamespaceLister { + return channelNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ChannelNamespaceLister helps list and get Channels. +type ChannelNamespaceLister interface { + // List lists all Channels in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Channel, err error) + // Get retrieves the Channel from the indexer for a given namespace and name. + Get(name string) (*v1.Channel, error) + ChannelNamespaceListerExpansion +} + +// channelNamespaceLister implements the ChannelNamespaceLister +// interface. +type channelNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Channels in the indexer for a given namespace. +func (s channelNamespaceLister) List(selector labels.Selector) (ret []*v1.Channel, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Channel)) + }) + return ret, err +} + +// Get retrieves the Channel from the indexer for a given namespace and name. +func (s channelNamespaceLister) Get(name string) (*v1.Channel, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("channel"), name) + } + return obj.(*v1.Channel), nil +} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/expansion_generated.go b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/expansion_generated.go new file mode 100644 index 0000000000..8b6e740ace --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// ChannelListerExpansion allows custom methods to be added to +// ChannelLister. +type ChannelListerExpansion interface{} + +// ChannelNamespaceListerExpansion allows custom methods to be added to +// ChannelNamespaceLister. +type ChannelNamespaceListerExpansion interface{} + +// InMemoryChannelListerExpansion allows custom methods to be added to +// InMemoryChannelLister. +type InMemoryChannelListerExpansion interface{} + +// InMemoryChannelNamespaceListerExpansion allows custom methods to be added to +// InMemoryChannelNamespaceLister. +type InMemoryChannelNamespaceListerExpansion interface{} + +// SubscriptionListerExpansion allows custom methods to be added to +// SubscriptionLister. +type SubscriptionListerExpansion interface{} + +// SubscriptionNamespaceListerExpansion allows custom methods to be added to +// SubscriptionNamespaceLister. +type SubscriptionNamespaceListerExpansion interface{} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/inmemorychannel.go b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/inmemorychannel.go new file mode 100644 index 0000000000..49b0688859 --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/inmemorychannel.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "knative.dev/eventing/pkg/apis/messaging/v1" +) + +// InMemoryChannelLister helps list InMemoryChannels. +type InMemoryChannelLister interface { + // List lists all InMemoryChannels in the indexer. + List(selector labels.Selector) (ret []*v1.InMemoryChannel, err error) + // InMemoryChannels returns an object that can list and get InMemoryChannels. + InMemoryChannels(namespace string) InMemoryChannelNamespaceLister + InMemoryChannelListerExpansion +} + +// inMemoryChannelLister implements the InMemoryChannelLister interface. +type inMemoryChannelLister struct { + indexer cache.Indexer +} + +// NewInMemoryChannelLister returns a new InMemoryChannelLister. +func NewInMemoryChannelLister(indexer cache.Indexer) InMemoryChannelLister { + return &inMemoryChannelLister{indexer: indexer} +} + +// List lists all InMemoryChannels in the indexer. +func (s *inMemoryChannelLister) List(selector labels.Selector) (ret []*v1.InMemoryChannel, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.InMemoryChannel)) + }) + return ret, err +} + +// InMemoryChannels returns an object that can list and get InMemoryChannels. +func (s *inMemoryChannelLister) InMemoryChannels(namespace string) InMemoryChannelNamespaceLister { + return inMemoryChannelNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// InMemoryChannelNamespaceLister helps list and get InMemoryChannels. +type InMemoryChannelNamespaceLister interface { + // List lists all InMemoryChannels in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.InMemoryChannel, err error) + // Get retrieves the InMemoryChannel from the indexer for a given namespace and name. + Get(name string) (*v1.InMemoryChannel, error) + InMemoryChannelNamespaceListerExpansion +} + +// inMemoryChannelNamespaceLister implements the InMemoryChannelNamespaceLister +// interface. +type inMemoryChannelNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all InMemoryChannels in the indexer for a given namespace. +func (s inMemoryChannelNamespaceLister) List(selector labels.Selector) (ret []*v1.InMemoryChannel, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.InMemoryChannel)) + }) + return ret, err +} + +// Get retrieves the InMemoryChannel from the indexer for a given namespace and name. +func (s inMemoryChannelNamespaceLister) Get(name string) (*v1.InMemoryChannel, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("inmemorychannel"), name) + } + return obj.(*v1.InMemoryChannel), nil +} diff --git a/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/subscription.go b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/subscription.go new file mode 100644 index 0000000000..ed40d6945b --- /dev/null +++ b/vendor/knative.dev/eventing/pkg/client/listers/messaging/v1/subscription.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Knative 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "knative.dev/eventing/pkg/apis/messaging/v1" +) + +// SubscriptionLister helps list Subscriptions. +type SubscriptionLister interface { + // List lists all Subscriptions in the indexer. + List(selector labels.Selector) (ret []*v1.Subscription, err error) + // Subscriptions returns an object that can list and get Subscriptions. + Subscriptions(namespace string) SubscriptionNamespaceLister + SubscriptionListerExpansion +} + +// subscriptionLister implements the SubscriptionLister interface. +type subscriptionLister struct { + indexer cache.Indexer +} + +// NewSubscriptionLister returns a new SubscriptionLister. +func NewSubscriptionLister(indexer cache.Indexer) SubscriptionLister { + return &subscriptionLister{indexer: indexer} +} + +// List lists all Subscriptions in the indexer. +func (s *subscriptionLister) List(selector labels.Selector) (ret []*v1.Subscription, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Subscription)) + }) + return ret, err +} + +// Subscriptions returns an object that can list and get Subscriptions. +func (s *subscriptionLister) Subscriptions(namespace string) SubscriptionNamespaceLister { + return subscriptionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SubscriptionNamespaceLister helps list and get Subscriptions. +type SubscriptionNamespaceLister interface { + // List lists all Subscriptions in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Subscription, err error) + // Get retrieves the Subscription from the indexer for a given namespace and name. + Get(name string) (*v1.Subscription, error) + SubscriptionNamespaceListerExpansion +} + +// subscriptionNamespaceLister implements the SubscriptionNamespaceLister +// interface. +type subscriptionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Subscriptions in the indexer for a given namespace. +func (s subscriptionNamespaceLister) List(selector labels.Selector) (ret []*v1.Subscription, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Subscription)) + }) + return ret, err +} + +// Get retrieves the Subscription from the indexer for a given namespace and name. +func (s subscriptionNamespaceLister) Get(name string) (*v1.Subscription, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("subscription"), name) + } + return obj.(*v1.Subscription), nil +} diff --git a/vendor/knative.dev/pkg/leaderelection/config.go b/vendor/knative.dev/pkg/leaderelection/config.go index 44378d30cc..8b7c020581 100644 --- a/vendor/knative.dev/pkg/leaderelection/config.go +++ b/vendor/knative.dev/pkg/leaderelection/config.go @@ -126,6 +126,14 @@ type ComponentConfig struct { RetryPeriod time.Duration } +// StatefulSetConfig represents the required information for a StatefulSet service. +type StatefulSetConfig struct { + StatefulSetName string + ServiceName string + Port string + Protocol string +} + func defaultComponentConfig(name string) ComponentConfig { return ComponentConfig{ Component: name, diff --git a/vendor/knative.dev/pkg/leaderelection/context.go b/vendor/knative.dev/pkg/leaderelection/context.go index a0d8555f97..d273a572e2 100644 --- a/vendor/knative.dev/pkg/leaderelection/context.go +++ b/vendor/knative.dev/pkg/leaderelection/context.go @@ -28,6 +28,7 @@ import ( "k8s.io/client-go/tools/leaderelection" "k8s.io/client-go/tools/leaderelection/resourcelock" "knative.dev/pkg/logging" + "knative.dev/pkg/network" "knative.dev/pkg/reconciler" "knative.dev/pkg/system" ) @@ -42,6 +43,16 @@ func WithStandardLeaderElectorBuilder(ctx context.Context, kc kubernetes.Interfa }) } +// WithStatefulSetLeaderElectorBuilder infuses a context with the ability to build +// Electors which are assigned leadership based on the StatefulSet ordinal from +// the provided component configuration. +func WithStatefulSetLeaderElectorBuilder(ctx context.Context, cc ComponentConfig, ssc StatefulSetConfig) context.Context { + return context.WithValue(ctx, builderKey{}, &statefulSetBuilder{ + lec: cc, + ssc: ssc, + }) +} + // HasLeaderElection returns whether there is leader election configuration // associated with the context func HasLeaderElection(ctx context.Context) bool { @@ -61,8 +72,9 @@ func BuildElector(ctx context.Context, la reconciler.LeaderAware, name string, e switch builder := val.(type) { case *standardBuilder: return builder.BuildElector(ctx, la, name, enq) + case *statefulSetBuilder: + return builder.BuildElector(ctx, la, enq) } - // TODO(mattmoor): Add a flavor of builder that relies on StatefulSet to partition the key space. } return &unopposedElector{ @@ -90,10 +102,11 @@ func (b *standardBuilder) BuildElector(ctx context.Context, la reconciler.Leader buckets := make([]Elector, 0, b.lec.Buckets) for i := uint32(0); i < b.lec.Buckets; i++ { bkt := &bucket{ - component: b.lec.Component, - name: name, - index: i, - total: b.lec.Buckets, + // The resource name is the lowercase: + // {component}.{workqueue}.{index}-of-{total} + name: strings.ToLower(fmt.Sprintf("%s.%s.%02d-of-%02d", b.lec.Component, name, i, b.lec.Buckets)), + index: i, + total: b.lec.Buckets, } rl, err := resourcelock.New(b.lec.ResourceLock, @@ -145,6 +158,35 @@ func (b *standardBuilder) BuildElector(ctx context.Context, la reconciler.Leader return &runAll{les: buckets}, nil } +type statefulSetBuilder struct { + lec ComponentConfig + ssc StatefulSetConfig +} + +func (b *statefulSetBuilder) BuildElector(ctx context.Context, la reconciler.LeaderAware, enq func(reconciler.Bucket, types.NamespacedName)) (Elector, error) { + logger := logging.FromContext(ctx) + + ordinal, err := ControllerOrdinal() + if err != nil { + return nil, err + } + + logger.Infof("%s will run in StatefulSet ordinal assignement mode with ordinal %d", b.lec.Component, ordinal) + + return &unopposedElector{ + bkt: &bucket{ + // The name is the full pod DNS of the owner pod of this bucket. + name: fmt.Sprintf("%s://%s-%d.%s.%s.svc.%s:%s", b.ssc.Protocol, + b.ssc.StatefulSetName, ordinal, b.ssc.ServiceName, + system.Namespace(), network.GetClusterDomainName(), b.ssc.Port), + index: uint32(ordinal), + total: b.lec.Buckets, + }, + la: la, + enq: enq, + }, nil +} + // unopposedElector promotes when run without needing to be elected. type unopposedElector struct { bkt reconciler.Bucket @@ -197,8 +239,7 @@ func (ruc *runUntilCancelled) Run(ctx context.Context) { } type bucket struct { - component string - name string + name string // We are bucket {index} of {total} index uint32 @@ -209,9 +250,7 @@ var _ reconciler.Bucket = (*bucket)(nil) // Name implements reconciler.Bucket func (b *bucket) Name() string { - // The resource name is the lowercase: - // {component}.{workqueue}.{index}-of-{total} - return strings.ToLower(fmt.Sprintf("%s.%s.%02d-of-%02d", b.component, b.name, b.index, b.total)) + return b.name } // Has implements reconciler.Bucket diff --git a/vendor/knative.dev/pkg/leaderelection/ordinal.go b/vendor/knative.dev/pkg/leaderelection/ordinal.go new file mode 100644 index 0000000000..94a3775a0d --- /dev/null +++ b/vendor/knative.dev/pkg/leaderelection/ordinal.go @@ -0,0 +1,39 @@ +/* +Copyright 2020 The Knative Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package leaderelection + +import ( + "fmt" + "os" + "strconv" + "strings" +) + +// If run a process on Kubernetes, the value of this environment variable +// should be set to the pod name via the downward API. +const controllerOrdinalEnv = "CONTROLLER_ORDINAL" + +// ControllerOrdinal tries to get ordinal from the pod name of a StatefulSet, +// which is provided from the environment variable CONTROLLER_ORDINAL. +func ControllerOrdinal() (uint64, error) { + v := os.Getenv(controllerOrdinalEnv) + if i := strings.LastIndex(v, "-"); i != -1 { + return strconv.ParseUint(v[i+1:], 10, 64) + } + + return 0, fmt.Errorf("ordinal not found in %s=%s", controllerOrdinalEnv, v) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 24df37fe3a..e460af4dcc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1023,7 +1023,7 @@ k8s.io/utils/buffer k8s.io/utils/integer k8s.io/utils/pointer k8s.io/utils/trace -# knative.dev/eventing v0.15.1-0.20200625112228-88aa030c747f +# knative.dev/eventing v0.15.1-0.20200625220028-1e3a03b620b6 ## explicit knative.dev/eventing/pkg/apis/config knative.dev/eventing/pkg/apis/configs @@ -1036,9 +1036,11 @@ knative.dev/eventing/pkg/apis/eventing knative.dev/eventing/pkg/apis/eventing/v1 knative.dev/eventing/pkg/apis/eventing/v1beta1 knative.dev/eventing/pkg/apis/flows +knative.dev/eventing/pkg/apis/flows/v1 knative.dev/eventing/pkg/apis/flows/v1beta1 knative.dev/eventing/pkg/apis/messaging knative.dev/eventing/pkg/apis/messaging/config +knative.dev/eventing/pkg/apis/messaging/v1 knative.dev/eventing/pkg/apis/messaging/v1beta1 knative.dev/eventing/pkg/apis/sources knative.dev/eventing/pkg/apis/sources/v1alpha1 @@ -1052,8 +1054,12 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1 knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1/fake knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1beta1 knative.dev/eventing/pkg/client/clientset/versioned/typed/eventing/v1beta1/fake +knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1 +knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1/fake knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1beta1 knative.dev/eventing/pkg/client/clientset/versioned/typed/flows/v1beta1/fake +knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1 +knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1/fake knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1beta1 knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1beta1/fake knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1 @@ -1067,9 +1073,11 @@ knative.dev/eventing/pkg/client/informers/externalversions/eventing knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1 knative.dev/eventing/pkg/client/informers/externalversions/eventing/v1beta1 knative.dev/eventing/pkg/client/informers/externalversions/flows +knative.dev/eventing/pkg/client/informers/externalversions/flows/v1 knative.dev/eventing/pkg/client/informers/externalversions/flows/v1beta1 knative.dev/eventing/pkg/client/informers/externalversions/internalinterfaces knative.dev/eventing/pkg/client/informers/externalversions/messaging +knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1 knative.dev/eventing/pkg/client/informers/externalversions/messaging/v1beta1 knative.dev/eventing/pkg/client/informers/externalversions/sources knative.dev/eventing/pkg/client/informers/externalversions/sources/v1alpha1 @@ -1082,7 +1090,9 @@ knative.dev/eventing/pkg/client/injection/reconciler/eventing/v1beta1/broker knative.dev/eventing/pkg/client/listers/configs/v1alpha1 knative.dev/eventing/pkg/client/listers/eventing/v1 knative.dev/eventing/pkg/client/listers/eventing/v1beta1 +knative.dev/eventing/pkg/client/listers/flows/v1 knative.dev/eventing/pkg/client/listers/flows/v1beta1 +knative.dev/eventing/pkg/client/listers/messaging/v1 knative.dev/eventing/pkg/client/listers/messaging/v1beta1 knative.dev/eventing/pkg/client/listers/sources/v1alpha1 knative.dev/eventing/pkg/client/listers/sources/v1alpha2 @@ -1115,11 +1125,11 @@ knative.dev/eventing/test/test_images/event-sender knative.dev/eventing/test/test_images/performance knative.dev/eventing/test/test_images/recordevents knative.dev/eventing/test/test_images/transformevents -# knative.dev/networking v0.0.0-20200623230227-53e376c3ec4c +# knative.dev/networking v0.0.0-20200624161427-341a83759c17 knative.dev/networking/pkg/apis/config knative.dev/networking/pkg/apis/networking knative.dev/networking/pkg/apis/networking/v1alpha1 -# knative.dev/pkg v0.0.0-20200624210428-eb05e8dd5b5b +# knative.dev/pkg v0.0.0-20200626022628-f1ee372577e1 ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -1226,7 +1236,7 @@ knative.dev/pkg/webhook/resourcesemantics knative.dev/pkg/webhook/resourcesemantics/conversion knative.dev/pkg/webhook/resourcesemantics/defaulting knative.dev/pkg/webhook/resourcesemantics/validation -# knative.dev/serving v0.15.1-0.20200625123828-2949259bd49e +# knative.dev/serving v0.15.1-0.20200626061427-ce9c1723e56a ## explicit knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1 @@ -1265,7 +1275,7 @@ knative.dev/serving/pkg/client/listers/autoscaling/v1alpha1 knative.dev/serving/pkg/client/listers/serving/v1 knative.dev/serving/pkg/client/listers/serving/v1alpha1 knative.dev/serving/pkg/client/listers/serving/v1beta1 -# knative.dev/test-infra v0.0.0-20200624184627-7eae2aae38e4 +# knative.dev/test-infra v0.0.0-20200625195728-62651036b559 ## explicit knative.dev/test-infra/scripts # sigs.k8s.io/yaml v1.2.0 => sigs.k8s.io/yaml v1.1.0