diff --git a/docs/cmd/kn.md b/docs/cmd/kn.md index 47ff5bd7d2..b52df1ab73 100644 --- a/docs/cmd/kn.md +++ b/docs/cmd/kn.md @@ -27,6 +27,6 @@ Manage your Knative building blocks: * [kn revision](kn_revision.md) - Revision command group * [kn route](kn_route.md) - Route command group * [kn service](kn_service.md) - Service command group -* [kn source](kn_source.md) - Event Source command group +* [kn source](kn_source.md) - Event source command group * [kn version](kn_version.md) - Prints the client version diff --git a/docs/cmd/kn_source.md b/docs/cmd/kn_source.md index 7386e2f8f4..a4e12e1a8a 100644 --- a/docs/cmd/kn_source.md +++ b/docs/cmd/kn_source.md @@ -1,10 +1,10 @@ ## kn source -Event Source command group +Event source command group ### Synopsis -Event Source command group +Event source command group ``` kn source [flags] @@ -28,5 +28,6 @@ kn source [flags] * [kn](kn.md) - Knative client * [kn source apiserver](kn_source_apiserver.md) - Kubernetes API Server Event Source command group +* [kn source cronjob](kn_source_cronjob.md) - Cronjob source command group * [kn source list-types](kn_source_list-types.md) - List available source types diff --git a/docs/cmd/kn_source_apiserver.md b/docs/cmd/kn_source_apiserver.md index 8755556b44..0b9de677c8 100644 --- a/docs/cmd/kn_source_apiserver.md +++ b/docs/cmd/kn_source_apiserver.md @@ -26,7 +26,7 @@ kn source apiserver [flags] ### SEE ALSO -* [kn source](kn_source.md) - Event Source command group +* [kn source](kn_source.md) - Event source command group * [kn source apiserver create](kn_source_apiserver_create.md) - Create an ApiServerSource, which watches for Kubernetes events and forwards them to a sink * [kn source apiserver delete](kn_source_apiserver_delete.md) - Delete an ApiServerSource. diff --git a/docs/cmd/kn_source_cronjob.md b/docs/cmd/kn_source_cronjob.md new file mode 100644 index 0000000000..6a5940b2f2 --- /dev/null +++ b/docs/cmd/kn_source_cronjob.md @@ -0,0 +1,34 @@ +## kn source cronjob + +Cronjob source command group + +### Synopsis + +Cronjob source command group + +``` +kn source cronjob [flags] +``` + +### Options + +``` + -h, --help help for cronjob +``` + +### Options inherited from parent commands + +``` + --config string kn config file (default is $HOME/.kn/config.yaml) + --kubeconfig string kubectl config file (default is $HOME/.kube/config) + --log-http log http traffic +``` + +### SEE ALSO + +* [kn source](kn_source.md) - Event source command group +* [kn source cronjob create](kn_source_cronjob_create.md) - Create a Cronjob source. +* [kn source cronjob delete](kn_source_cronjob_delete.md) - Delete a Cronjob source. +* [kn source cronjob describe](kn_source_cronjob_describe.md) - Describe a Cronjob source. +* [kn source cronjob update](kn_source_cronjob_update.md) - Update a Cronjob source. + diff --git a/docs/cmd/kn_source_cronjob_create.md b/docs/cmd/kn_source_cronjob_create.md new file mode 100644 index 0000000000..53fa3e7434 --- /dev/null +++ b/docs/cmd/kn_source_cronjob_create.md @@ -0,0 +1,42 @@ +## kn source cronjob create + +Create a Cronjob source. + +### Synopsis + +Create a Cronjob source. + +``` +kn source cronjob create NAME --schedule SCHEDULE --sink SINK --data DATA [flags] +``` + +### Examples + +``` + + # Create a crontab scheduler 'my-cron-trigger' which fires every minute and sends 'ping' to service 'mysvc' as a cloudevent + kn source cronjob create my-cron-trigger --schedule "* * * * */1" --data "ping" --sink svc:mysvc +``` + +### Options + +``` + -d, --data string String data to send + -h, --help help for create + -n, --namespace string Specify the namespace to operate in. + --schedule string Schedule specification in crontab format (e.g. '* * * * */2' for every two minutes + -s, --sink string Addressable sink for events +``` + +### Options inherited from parent commands + +``` + --config string kn config file (default is $HOME/.kn/config.yaml) + --kubeconfig string kubectl config file (default is $HOME/.kube/config) + --log-http log http traffic +``` + +### SEE ALSO + +* [kn source cronjob](kn_source_cronjob.md) - Cronjob source command group + diff --git a/docs/cmd/kn_source_cronjob_delete.md b/docs/cmd/kn_source_cronjob_delete.md new file mode 100644 index 0000000000..47f750a9f1 --- /dev/null +++ b/docs/cmd/kn_source_cronjob_delete.md @@ -0,0 +1,39 @@ +## kn source cronjob delete + +Delete a Cronjob source. + +### Synopsis + +Delete a Cronjob source. + +``` +kn source cronjob delete NAME [flags] +``` + +### Examples + +``` + + # Delete a CronJob source 'my-cron-trigger' + kn source cronjob delete my-cron-trigger +``` + +### Options + +``` + -h, --help help for delete + -n, --namespace string Specify the namespace to operate in. +``` + +### Options inherited from parent commands + +``` + --config string kn config file (default is $HOME/.kn/config.yaml) + --kubeconfig string kubectl config file (default is $HOME/.kube/config) + --log-http log http traffic +``` + +### SEE ALSO + +* [kn source cronjob](kn_source_cronjob.md) - Cronjob source command group + diff --git a/docs/cmd/kn_source_cronjob_describe.md b/docs/cmd/kn_source_cronjob_describe.md new file mode 100644 index 0000000000..d2e7b85881 --- /dev/null +++ b/docs/cmd/kn_source_cronjob_describe.md @@ -0,0 +1,40 @@ +## kn source cronjob describe + +Describe a Cronjob source. + +### Synopsis + +Describe a Cronjob source. + +``` +kn source cronjob describe NAME [flags] +``` + +### Examples + +``` + + # Describe a cronjob source with name 'my-cron-trigger' + kn source cronjob describe my-cron-trigger +``` + +### Options + +``` + -h, --help help for describe + -n, --namespace string Specify the namespace to operate in. + -v, --verbose More output. +``` + +### Options inherited from parent commands + +``` + --config string kn config file (default is $HOME/.kn/config.yaml) + --kubeconfig string kubectl config file (default is $HOME/.kube/config) + --log-http log http traffic +``` + +### SEE ALSO + +* [kn source cronjob](kn_source_cronjob.md) - Cronjob source command group + diff --git a/docs/cmd/kn_source_cronjob_update.md b/docs/cmd/kn_source_cronjob_update.md new file mode 100644 index 0000000000..c2d57f00a7 --- /dev/null +++ b/docs/cmd/kn_source_cronjob_update.md @@ -0,0 +1,42 @@ +## kn source cronjob update + +Update a Cronjob source. + +### Synopsis + +Update a Cronjob source. + +``` +kn source cronjob update NAME --schedule SCHEDULE --sink SERVICE --data DATA [flags] +``` + +### Examples + +``` + + # Update the schedule of a crontab source 'my-cron-trigger' to fire every minute + kn source cronjob update my-cron-trigger --schedule "* * * * */1" +``` + +### Options + +``` + -d, --data string String data to send + -h, --help help for update + -n, --namespace string Specify the namespace to operate in. + --schedule string Schedule specification in crontab format (e.g. '* * * * */2' for every two minutes + -s, --sink string Addressable sink for events +``` + +### Options inherited from parent commands + +``` + --config string kn config file (default is $HOME/.kn/config.yaml) + --kubeconfig string kubectl config file (default is $HOME/.kube/config) + --log-http log http traffic +``` + +### SEE ALSO + +* [kn source cronjob](kn_source_cronjob.md) - Cronjob source command group + diff --git a/docs/cmd/kn_source_list-types.md b/docs/cmd/kn_source_list-types.md index e45710c100..16136a019a 100644 --- a/docs/cmd/kn_source_list-types.md +++ b/docs/cmd/kn_source_list-types.md @@ -42,5 +42,5 @@ kn source list-types [flags] ### SEE ALSO -* [kn source](kn_source.md) - Event Source command group +* [kn source](kn_source.md) - Event source command group diff --git a/go.sum b/go.sum index afa83bd89c..b4504cf28c 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,4 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= @@ -23,7 +22,6 @@ github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jB github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -68,7 +66,6 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= @@ -86,38 +83,32 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.19.0 h1:FTUMcX77w5rQkClIzDtTxvn6Bsa894CcrzNj2MMfeg8= github.com/go-openapi/jsonpointer v0.19.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2 h1:A9+F4Dc/MCNB5jibxf6rRvOvR/iFgQdyNx9eIhnGqq0= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.19.0 h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk= github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= -github.com/go-openapi/spec v0.17.2 h1:eb2NbuCnoe8cWAxhtK6CfMWUYmiFEZJ9Hx3Z2WRwJ5M= github.com/go-openapi/spec v0.17.2/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.19.2 h1:SStNd1jRcYtfKCN7R0laGNs80WYYvn5CbBjM2sOmCrE= github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.17.2 h1:K/ycE/XTUDFltNHSO32cGRUhrVGJD64o8WgAIZNyc3k= github.com/go-openapi/swag v0.17.2/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2 h1:jvO6bCMBEilGwMfHhrd61zIID4oIFdwb76V17SM88dE= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -126,7 +117,6 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -136,14 +126,12 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-containerregistry v0.0.0-20191029173801-50b26ee28691 h1:9fkqC5Bq8l2FQgcW6FQbPDUeZvExyg7okl+s4Gg9Jrs= github.com/google/go-containerregistry v0.0.0-20191029173801-50b26ee28691/go.mod h1:2KrPZhPVc4ttLyBIro34Aw115FerjFuIQMT+u2tmzXo= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -156,21 +144,18 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.2.2 h1:DcFegQ7+ECdmkJMfVwWlC+89I4esJ7p8nkGt9ainGDk= github.com/googleapis/gnostic v0.2.2/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.0.0-20190126172459-c818fa66e4c8/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7 h1:6TSoaYExHper8PYsJu23GWVNOyYRCSnIFyxKgLSZ54w= github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -188,7 +173,6 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be h1:AHimNtVIpiBjPUhEF5KNCkrUyqTSA5zWUl8sQ2bfGBE= github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -209,7 +193,6 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63 h1:nTT4s92Dgz2HlrB2NaMgvlfqHH39OgMhA7z3PK7PGD4= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -234,16 +217,12 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c h1:Hww8mOyEKTeON4bZn7FrlLismspbPc1teNRUVH7wLQ8= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c h1:eSfnfIuwhxZyULg1NNuZycJcYkjYVGYe7FczwQReM6U= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3 h1:EooPXg51Tn+xmWPXJUGCnJhJSpeuMlBmfJVcqIRmmv8= github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= @@ -299,7 +278,6 @@ github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9 github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -309,9 +287,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -320,9 +296,7 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.1 h1:8dP3SGL7MPB94crU3bEPplMPe83FI4EouesJUeFHv50= go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= @@ -334,7 +308,6 @@ go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -372,24 +345,19 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc h1:gkKoSkUmnU6bpS/VhkuO27bzQeSA51uaEfbOW5dNb68= golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2 h1:4dVFTC832rPn4pomLSz1vA+are2+dU19w1H8OngV7nc= golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA= golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -399,9 +367,7 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313 h1:pczuHS43Cp2ktBEEmLwScxgjWsBSzdaQiKzUyf3DTTc= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -415,10 +381,8 @@ golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db h1:6/JqlYfC1CCaLnGceQTI+sDGhC9UBSPAsBqI0Gun6kU= golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -434,7 +398,6 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -446,14 +409,12 @@ golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= -golang.org/x/tools v0.0.0-20191017205301-920acffc3e65 h1:GwXwgmbrvlcHLDsENMqrQTTIC2C0kIPszsq929NruKI= golang.org/x/tools v0.0.0-20191017205301-920acffc3e65/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0 h1:9sdfJOzWlkqPltHAuzT2Cp+yrBeY1KRVYgms8soxMwM= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -461,11 +422,8 @@ google.golang.org/api v0.10.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhE google.golang.org/api v0.14.0 h1:uMf5uLi4eQMRrMKhCplNik4U4H8Z6C1br3zOtAa/aDE= google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.2 h1:j8RI1yW0SkI+paT6uGwMlrMI/6zwYA6/CFil8rxOzGI= google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= @@ -474,7 +432,6 @@ google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64 h1:iKtrH9Y8mcbADOP0YFaEMth7OfuHY9xHOwNj4znpM1A= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51 h1:Ex1mq5jaJof+kRnYi3SlYJ8KKa9Ao3NHyIT5XJ1gF6U= @@ -493,7 +450,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/inf.v0 v0.9.0 h1:3zYtXIO92bvsdS3ggAdA8Gb4Azj0YU+TVY1uGYNFA8o= gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= @@ -502,7 +458,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -528,11 +483,9 @@ k8s.io/code-generator v0.0.0-20191026065352-f361089c127c/go.mod h1:HtDEU3n5Xo1vb k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.3.1 h1:RVgyDHY/kFKtLqh67NvEWIgkMneNoIrdkN0CxDSQc68= k8s.io/klog v0.3.1/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 h1:TRb4wNWoBVrH9plmkp2q86FIDppkbrEXdXlxU3a3BMI= k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf h1:EYm5AW/UUDbnmnI+gK0TJDVK9qPLhM+sRHYanNKw0EQ= k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= diff --git a/pkg/eventing/sources/v1alpha1/apiserver_client.go b/pkg/eventing/sources/v1alpha1/apiserver_client.go new file mode 100644 index 0000000000..0a6b69d257 --- /dev/null +++ b/pkg/eventing/sources/v1alpha1/apiserver_client.go @@ -0,0 +1,72 @@ +// Copyright © 2019 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 v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/eventing/pkg/apis/sources/v1alpha1" + client_v1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" + + kn_errors "knative.dev/client/pkg/errors" +) + +// Interface for working with ApiServer sources +type KnApiServerSourcesClient interface { + + // Get an ApiServerSource by object + CreateApiServerSource(apisvrsrc *v1alpha1.ApiServerSource) (*v1alpha1.ApiServerSource, error) + + // Delete an ApiServerSource by name + DeleteApiServerSource(name string) error + + // Get namespace for this client + Namespace() string +} + +// knSourcesClient is a combination of Sources client interface and namespace +// Temporarily help to add sources dependencies +// May be changed when adding real sources features +type apiServerSourcesClient struct { + client client_v1alpha1.ApiServerSourceInterface + namespace string +} + +// NewKnSourcesClient is to invoke Eventing Sources Client API to create object +func newKnApiServerSourcesClient(client client_v1alpha1.ApiServerSourceInterface, namespace string) KnApiServerSourcesClient { + return &apiServerSourcesClient{ + client: client, + namespace: namespace, + } +} + +//CreateApiServerSource is used to create an instance of ApiServerSource +func (c *apiServerSourcesClient) CreateApiServerSource(apisvrsrc *v1alpha1.ApiServerSource) (*v1alpha1.ApiServerSource, error) { + ins, err := c.client.Create(apisvrsrc) + if err != nil { + return nil, kn_errors.GetError(err) + } + return ins, nil +} + +//DeleteApiServerSource is used to create an instance of ApiServerSource +func (c *apiServerSourcesClient) DeleteApiServerSource(name string) error { + err := c.client.Delete(name, &v1.DeleteOptions{}) + return err +} + +// Return the client's namespace +func (c *apiServerSourcesClient) Namespace() string { + return c.namespace +} diff --git a/pkg/eventing/sources/v1alpha1/client_test.go b/pkg/eventing/sources/v1alpha1/apiserver_client_test.go similarity index 95% rename from pkg/eventing/sources/v1alpha1/client_test.go rename to pkg/eventing/sources/v1alpha1/apiserver_client_test.go index 33c6d2c4f3..1c8470e79f 100644 --- a/pkg/eventing/sources/v1alpha1/client_test.go +++ b/pkg/eventing/sources/v1alpha1/apiserver_client_test.go @@ -29,9 +29,9 @@ import ( var testNamespace = "test-ns" -func setup() (sources fake.FakeSourcesV1alpha1, client KnSourcesClient) { +func setup() (sources fake.FakeSourcesV1alpha1, client KnApiServerSourcesClient) { sources = fake.FakeSourcesV1alpha1{Fake: &client_testing.Fake{}} - client = NewKnSourcesClient(&sources, testNamespace) + client = NewKnSourcesClient(&sources, testNamespace).ApiServerSourcesClient() return } diff --git a/pkg/eventing/sources/v1alpha1/client.go b/pkg/eventing/sources/v1alpha1/client.go index 14dacf2ca5..74049199fc 100644 --- a/pkg/eventing/sources/v1alpha1/client.go +++ b/pkg/eventing/sources/v1alpha1/client.go @@ -15,58 +15,41 @@ package v1alpha1 import ( - apis_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - kn_errors "knative.dev/client/pkg/errors" - "knative.dev/eventing/pkg/apis/sources/v1alpha1" client_v1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" ) // KnSourcesClient to Eventing Sources. All methods are relative to the // namespace specified during construction type KnSourcesClient interface { - // Namespace in which this client is operating for - Namespace() string - - // Get an ApiServerSource by object - CreateApiServerSource(apisvrsrc *v1alpha1.ApiServerSource) (*v1alpha1.ApiServerSource, error) + // Get client for ApiServer sources + ApiServerSourcesClient() KnApiServerSourcesClient - // Delete an ApiServerSource by name - DeleteApiServerSource(name string) error + // Get client for CronJob sources + CronJobSourcesClient() KnCronJobSourcesClient } -// knSourcesClient is a combination of Sources client interface and namespace +// sourcesClient is a combination of Sources client interface and namespace // Temporarily help to add sources dependencies // May be changed when adding real sources features -type knSourcesClient struct { +type sourcesClient struct { client client_v1alpha1.SourcesV1alpha1Interface namespace string } -// NewKnSourcesClient is to invoke Eventing Sources Client API to create object +// Create a new client for managing all eventing built-in sources func NewKnSourcesClient(client client_v1alpha1.SourcesV1alpha1Interface, namespace string) KnSourcesClient { - return &knSourcesClient{ + return &sourcesClient{ client: client, namespace: namespace, } } -//CreateApiServerSource is used to create an instance of ApiServerSource -func (c *knSourcesClient) CreateApiServerSource(apisvrsrc *v1alpha1.ApiServerSource) (*v1alpha1.ApiServerSource, error) { - ins, err := c.client.ApiServerSources(c.namespace).Create(apisvrsrc) - if err != nil { - return nil, kn_errors.GetError(err) - } - return ins, nil -} - -//DeleteApiServerSource is used to create an instance of ApiServerSource -func (c *knSourcesClient) DeleteApiServerSource(name string) error { - err := c.client.ApiServerSources(c.namespace).Delete(name, &apis_v1.DeleteOptions{}) - return err +// Get the client for dealing with apiserver sources +func (c *sourcesClient) ApiServerSourcesClient() KnApiServerSourcesClient { + return newKnApiServerSourcesClient(c.client.ApiServerSources(c.namespace), c.namespace) } -// Return the client's namespace -func (c *knSourcesClient) Namespace() string { - return c.namespace +// Get the client for dealing with cronjob sources +func (c *sourcesClient) CronJobSourcesClient() KnCronJobSourcesClient { + return newKnCronJobSourcesClient(c.client.CronJobSources(c.namespace), c.namespace) } diff --git a/pkg/eventing/sources/v1alpha1/cronjob_client.go b/pkg/eventing/sources/v1alpha1/cronjob_client.go new file mode 100644 index 0000000000..71e1497215 --- /dev/null +++ b/pkg/eventing/sources/v1alpha1/cronjob_client.go @@ -0,0 +1,110 @@ +// Copyright © 2019 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 v1alpha1 + +import ( + "fmt" + + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/eventing/pkg/apis/sources/v1alpha1" + client_v1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" + duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" +) + +// Interface for interacting with a cronjob source +type KnCronJobSourcesClient interface { + + // Get a single cronjob source by name + GetCronJobSource(name string) (*v1alpha1.CronJobSource, error) + + // Create a cronjob source by providing the schedule, data and sink + CreateCronJobSource(name, schedule, data string, sink *duckv1beta1.Destination) error + + // Update a cronjob source by providing the schedule, data and sink + UpdateCronJobSource(name, schedule, data string, sink *duckv1beta1.Destination) error + + // Delete a cronjob source by name + DeleteCronJobSource(name string) error + + // Get namespace for this source + Namespace() string +} + +// knSourcesClient is a combination of Sources client interface and namespace +// Temporarily help to add sources dependencies +// May be changed when adding real sources features +type cronJobSourcesClient struct { + client client_v1alpha1.CronJobSourceInterface + namespace string +} + +// NewKnSourcesClient is to invoke Eventing Sources Client API to create object +func newKnCronJobSourcesClient(client client_v1alpha1.CronJobSourceInterface, namespace string) KnCronJobSourcesClient { + return &cronJobSourcesClient{ + client: client, + namespace: namespace, + } +} + +// Get the namespace for which this client has been created +func (c *cronJobSourcesClient) Namespace() string { + return c.namespace +} + +func (c *cronJobSourcesClient) CreateCronJobSource(name, schedule, data string, sink *duckv1beta1.Destination) error { + if sink == nil { + return fmt.Errorf("a sink is required for creating a source") + } + source := v1alpha1.CronJobSource{ + ObjectMeta: meta_v1.ObjectMeta{ + Name: name, + }, + Spec: v1alpha1.CronJobSourceSpec{ + Schedule: schedule, + Data: data, + Sink: sink, + }, + } + + _, err := c.client.Create(&source) + return err +} + +func (c *cronJobSourcesClient) UpdateCronJobSource(name, schedule, data string, sink *duckv1beta1.Destination) error { + source, err := c.GetCronJobSource(name) + if err != nil { + return err + } + + if schedule != "" { + source.Spec.Schedule = schedule + } + if data != "" { + source.Spec.Data = data + } + if sink != nil { + source.Spec.Sink = sink + } + _, err = c.client.Update(source) + return err +} + +func (c *cronJobSourcesClient) DeleteCronJobSource(name string) error { + return c.client.Delete(name, &meta_v1.DeleteOptions{}) +} + +func (c *cronJobSourcesClient) GetCronJobSource(name string) (*v1alpha1.CronJobSource, error) { + return c.client.Get(name, meta_v1.GetOptions{}) +} diff --git a/pkg/kn/commands/source/apiserver/create.go b/pkg/kn/commands/source/apiserver/create.go index 65d400ea22..dc7be52cc9 100644 --- a/pkg/kn/commands/source/apiserver/create.go +++ b/pkg/kn/commands/source/apiserver/create.go @@ -73,7 +73,7 @@ func NewApiServerCreateCommand(p *commands.KnParams) *cobra.Command { apisrvsrc.Spec.Sink = objectRef // create - _, err = sourcesClient.CreateApiServerSource(apisrvsrc) + _, err = sourcesClient.ApiServerSourcesClient().CreateApiServerSource(apisrvsrc) if err != nil { return fmt.Errorf( "cannot create ApiServerSource '%s' in namespace '%s' "+ diff --git a/pkg/kn/commands/source/apiserver/delete.go b/pkg/kn/commands/source/apiserver/delete.go index a4d9ea5ef5..9a6b59d547 100644 --- a/pkg/kn/commands/source/apiserver/delete.go +++ b/pkg/kn/commands/source/apiserver/delete.go @@ -46,7 +46,7 @@ func NewApiServerDeleteCommand(p *commands.KnParams) *cobra.Command { return err } - err = sourcesClient.DeleteApiServerSource(name) + err = sourcesClient.ApiServerSourcesClient().DeleteApiServerSource(name) if err != nil { return err } diff --git a/pkg/kn/commands/source/cronjob/create.go b/pkg/kn/commands/source/cronjob/create.go new file mode 100644 index 0000000000..d7e6f241cb --- /dev/null +++ b/pkg/kn/commands/source/cronjob/create.go @@ -0,0 +1,74 @@ +// Copyright © 2019 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 cronjob + +import ( + "errors" + "fmt" + + "github.com/spf13/cobra" + + "knative.dev/client/pkg/kn/commands" + "knative.dev/client/pkg/kn/commands/flags" +) + +func NewCronJobCreateCommand(p *commands.KnParams) *cobra.Command { + var cronUpdateFlags cronJobUpdateFlags + var sinkFlags flags.SinkFlags + + cmd := &cobra.Command{ + Use: "create NAME --schedule SCHEDULE --sink SINK --data DATA", + Short: "Create a Cronjob source.", + Example: ` + # Create a crontab scheduler 'my-cron-trigger' which fires every minute and sends 'ping' to service 'mysvc' as a cloudevent + kn source cronjob create my-cron-trigger --schedule "* * * * */1" --data "ping" --sink svc:mysvc`, + + RunE: func(cmd *cobra.Command, args []string) (err error) { + if len(args) != 1 { + return errors.New("requires the name of the crobjob source to create as single argument") + + } + name := args[0] + + cronSourceClient, err := newCronJobSourceClient(p, cmd) + if err != nil { + return err + } + + servingClient, err := p.NewServingClient(cronSourceClient.Namespace()) + if err != nil { + return err + } + + destination, err := sinkFlags.ResolveSink(servingClient) + if err != nil { + return err + } + + err = cronSourceClient.CreateCronJobSource(name, cronUpdateFlags.schedule, cronUpdateFlags.data, destination) + if err == nil { + fmt.Fprintf(cmd.OutOrStdout(), "Cronjob source '%s' created in namespace '%s'.\n", args[0], cronSourceClient.Namespace()) + } + return err + }, + } + commands.AddNamespaceFlags(cmd.Flags(), false) + cronUpdateFlags.addCronJobFlags(cmd) + sinkFlags.Add(cmd) + cmd.MarkFlagRequired("schedule") + cmd.MarkFlagRequired("sink") + + return cmd +} diff --git a/pkg/kn/commands/source/cronjob/create_test.go b/pkg/kn/commands/source/cronjob/create_test.go new file mode 100644 index 0000000000..d60e873f0d --- /dev/null +++ b/pkg/kn/commands/source/cronjob/create_test.go @@ -0,0 +1,68 @@ +// Copyright © 2019 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 cronjob + +import ( + "errors" + "fmt" + "testing" + + "gotest.tools/assert" + "k8s.io/apimachinery/pkg/runtime" + client_testing "k8s.io/client-go/testing" + "k8s.io/client-go/tools/clientcmd" + "knative.dev/eventing/pkg/apis/sources/v1alpha1" + serving_v1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1" + + sources_fake "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake" + + v1alpha12 "knative.dev/client/pkg/eventing/sources/v1alpha1" + knservingclient "knative.dev/client/pkg/serving/v1alpha1" + "knative.dev/client/pkg/util" +) + +func TestCreateCronJobSource(t *testing.T) { + + servingClient := knservingclient.NewMockKnServiceClient(t) + + recorder := servingClient.Recorder() + recorder.GetService("mysvc", &serving_v1alpha1.Service{}, nil) + + sources := prepareFakeCronJobSourceClientFactory() + sources.AddReactor("create", "cronjobsources", + func(a client_testing.Action) (bool, runtime.Object, error) { + createAction, ok := a.(client_testing.CreateAction) + if !ok { + return true, nil, fmt.Errorf("wrong kind of action %v", a) + } + src, ok := createAction.GetObject().(*v1alpha1.CronJobSource) + if !ok { + return true, nil, errors.New("was passed the wrong object") + } + return true, src, nil + }) + + out, err := executeCronJobSourceCommand(servingClient, "create", "--sink", "svc:mysvc", "--schedule", "* * * * *", "testsource") + assert.NilError(t, err, "Source should have been created") + util.ContainsAll(out, "created", "default", "testsource") +} + +func prepareFakeCronJobSourceClientFactory() *sources_fake.FakeSourcesV1alpha1 { + sources := &sources_fake.FakeSourcesV1alpha1{&client_testing.Fake{}} + cronJobSourceClientFactory = func(config clientcmd.ClientConfig, namespace string) (client v1alpha12.KnCronJobSourcesClient, err error) { + return v1alpha12.NewKnSourcesClient(sources, namespace).CronJobSourcesClient(), nil + } + return sources +} diff --git a/pkg/kn/commands/source/cronjob/cronjob.go b/pkg/kn/commands/source/cronjob/cronjob.go new file mode 100644 index 0000000000..3ae2435db6 --- /dev/null +++ b/pkg/kn/commands/source/cronjob/cronjob.go @@ -0,0 +1,66 @@ +// Copyright © 2019 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 cronjob + +import ( + "github.com/spf13/cobra" + "k8s.io/client-go/tools/clientcmd" + sources_v1alpha1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha1" + + "knative.dev/client/pkg/eventing/sources/v1alpha1" + "knative.dev/client/pkg/kn/commands" +) + +func NewCronJobCommand(p *commands.KnParams) *cobra.Command { + cronImporterCmd := &cobra.Command{ + Use: "cronjob", + Short: "Cronjob source command group", + } + cronImporterCmd.AddCommand(NewCronJobCreateCommand(p)) + cronImporterCmd.AddCommand(NewCronJobDeleteCommand(p)) + cronImporterCmd.AddCommand(NewCronJobDescribeCommand(p)) + cronImporterCmd.AddCommand(NewCronJobUpdateCommand(p)) + return cronImporterCmd +} + +var cronJobSourceClientFactory func(config clientcmd.ClientConfig, namespace string) (v1alpha1.KnCronJobSourcesClient, error) + +func newCronJobSourceClient(p *commands.KnParams, cmd *cobra.Command) (v1alpha1.KnCronJobSourcesClient, error) { + namespace, err := p.GetNamespace(cmd) + if err != nil { + return nil, err + } + + config, err := p.GetClientConfig() + if err != nil { + return nil, err + } + + if cronJobSourceClientFactory != nil { + return cronJobSourceClientFactory(config, namespace) + } + + clientConfig, err := config.ClientConfig() + if err != nil { + return nil, err + } + + client, err := sources_v1alpha1.NewForConfig(clientConfig) + if err != nil { + return nil, err + } + + return v1alpha1.NewKnSourcesClient(client, namespace).CronJobSourcesClient(), nil +} diff --git a/pkg/kn/commands/source/cronjob/cronjob_test.go b/pkg/kn/commands/source/cronjob/cronjob_test.go new file mode 100644 index 0000000000..bdd94832f7 --- /dev/null +++ b/pkg/kn/commands/source/cronjob/cronjob_test.go @@ -0,0 +1,68 @@ +// Copyright © 2019 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 cronjob + +import ( + "bytes" + + "k8s.io/client-go/tools/clientcmd" + + "knative.dev/client/pkg/kn/commands" + knclient "knative.dev/client/pkg/serving/v1alpha1" +) + +// Helper methods +var blankConfig clientcmd.ClientConfig + +// TOOD: Remove that blankConfig hack for tests in favor of overwriting GetConfig() +// Remove also in service_test.go +func init() { + var err error + blankConfig, err = clientcmd.NewClientConfigFromBytes([]byte(`kind: Config +version: v1 +users: +- name: u +clusters: +- name: c + cluster: + server: example.com +contexts: +- name: x + context: + user: u + cluster: c +current-context: x +`)) + if err != nil { + panic(err) + } +} + +func executeCronJobSourceCommand(client knclient.KnServingClient, args ...string) (string, error) { + knParams := &commands.KnParams{} + knParams.ClientConfig = blankConfig + + output := new(bytes.Buffer) + knParams.Output = output + knParams.NewServingClient = func(namespace string) (knclient.KnServingClient, error) { + return client, nil + } + + cmd := NewCronJobCommand(knParams) + cmd.SetArgs(args) + cmd.SetOutput(output) + err := cmd.Execute() + return output.String(), err +} diff --git a/pkg/kn/commands/source/cronjob/delete.go b/pkg/kn/commands/source/cronjob/delete.go new file mode 100644 index 0000000000..2c6059d625 --- /dev/null +++ b/pkg/kn/commands/source/cronjob/delete.go @@ -0,0 +1,55 @@ +// Copyright © 2019 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 cronjob + +import ( + "errors" + "fmt" + + "github.com/spf13/cobra" + "knative.dev/client/pkg/kn/commands" +) + +// NewCronJobDelete command for deleting a cronjob source +func NewCronJobDeleteCommand(p *commands.KnParams) *cobra.Command { + ApiServerDeleteCommand := &cobra.Command{ + Use: "delete NAME", + Short: "Delete a Cronjob source.", + Example: ` + # Delete a CronJob source 'my-cron-trigger' + kn source cronjob delete my-cron-trigger`, + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) != 1 { + return errors.New("'requires the name of the crobjob source to delete as single argument") + } + name := args[0] + + cronSourceClient, err := newCronJobSourceClient(p, cmd) + if err != nil { + return err + } + + err = cronSourceClient.DeleteCronJobSource(name) + if err != nil { + return err + } + + fmt.Fprintf(cmd.OutOrStdout(), "Cronjob source '%s' deleted in namespace '%s'.\n", name, cronSourceClient.Namespace()) + return nil + }, + } + commands.AddNamespaceFlags(ApiServerDeleteCommand.Flags(), false) + return ApiServerDeleteCommand +} diff --git a/pkg/kn/commands/source/cronjob/describe.go b/pkg/kn/commands/source/cronjob/describe.go new file mode 100644 index 0000000000..27c24526b6 --- /dev/null +++ b/pkg/kn/commands/source/cronjob/describe.go @@ -0,0 +1,109 @@ +// Copyright © 2019 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 cronjob + +import ( + "errors" + "fmt" + + "github.com/spf13/cobra" + "knative.dev/eventing/pkg/apis/sources/v1alpha1" + duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" + + "knative.dev/client/pkg/kn/commands" + "knative.dev/client/pkg/printers" +) + +// Return a new command for describe a cron job source object +func NewCronJobDescribeCommand(p *commands.KnParams) *cobra.Command { + + cronJobDescribe := &cobra.Command{ + Use: "describe NAME", + Short: "Describe a Cronjob source.", + Example: ` + # Describe a cronjob source with name 'my-cron-trigger' + kn source cronjob describe my-cron-trigger`, + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) != 1 { + return errors.New("source name required as argument") + } + name := args[0] + + cronSourceClient, err := newCronJobSourceClient(p, cmd) + if err != nil { + return err + } + + cjSource, err := cronSourceClient.GetCronJobSource(name) + if err != nil { + return err + } + + out := cmd.OutOrStdout() + dw := printers.NewPrefixWriter(out) + + printDetails, err := cmd.Flags().GetBool("verbose") + if err != nil { + return err + } + + writeCronJobSource(dw, cjSource, printDetails) + dw.WriteLine() + if err := dw.Flush(); err != nil { + return err + } + + // Revisions summary info + writeSink(dw, cjSource.Spec.Sink) + dw.WriteLine() + if err := dw.Flush(); err != nil { + return err + } + + // Condition info + commands.WriteConditions(dw, cjSource.Status.Conditions, printDetails) + if err := dw.Flush(); err != nil { + return err + } + + return nil + }, + } + flags := cronJobDescribe.Flags() + commands.AddNamespaceFlags(flags, false) + flags.BoolP("verbose", "v", false, "More output.") + + return cronJobDescribe +} + +func writeSink(dw printers.PrefixWriter, sink *duckv1beta1.Destination) { + subWriter := dw.WriteAttribute("Sink", "") + subWriter.WriteAttribute("Name", sink.Ref.Name) + subWriter.WriteAttribute("Namespace", sink.Ref.Namespace) + ref := sink.Ref + if ref != nil { + subWriter.WriteAttribute("Resource", fmt.Sprintf("%s (%s)", sink.Ref.Kind, sink.Ref.APIVersion)) + } + uri := sink.URI + if uri != nil { + subWriter.WriteAttribute("URI", uri.String()) + } +} + +func writeCronJobSource(dw printers.PrefixWriter, source *v1alpha1.CronJobSource, printDetails bool) { + commands.WriteMetadata(dw, &source.ObjectMeta, printDetails) + dw.WriteAttribute("Schedule", source.Spec.Schedule) + dw.WriteAttribute("Data", source.Spec.Data) +} diff --git a/pkg/kn/commands/source/cronjob/flags.go b/pkg/kn/commands/source/cronjob/flags.go new file mode 100644 index 0000000000..5ea210a1cf --- /dev/null +++ b/pkg/kn/commands/source/cronjob/flags.go @@ -0,0 +1,27 @@ +// Copyright © 2019 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 cronjob + +import "github.com/spf13/cobra" + +type cronJobUpdateFlags struct { + schedule string + data string +} + +func (c *cronJobUpdateFlags) addCronJobFlags(cmd *cobra.Command) { + cmd.Flags().StringVar(&c.schedule, "schedule", "", "Schedule specification in crontab format (e.g. '* * * * */2' for every two minutes") + cmd.Flags().StringVarP(&c.data, "data", "d", "", "String data to send") +} diff --git a/pkg/kn/commands/source/cronjob/update.go b/pkg/kn/commands/source/cronjob/update.go new file mode 100644 index 0000000000..cd25f24945 --- /dev/null +++ b/pkg/kn/commands/source/cronjob/update.go @@ -0,0 +1,70 @@ +// Copyright © 2019 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 cronjob + +import ( + "errors" + "fmt" + + "github.com/spf13/cobra" + + "knative.dev/client/pkg/kn/commands" + "knative.dev/client/pkg/kn/commands/flags" +) + +func NewCronJobUpdateCommand(p *commands.KnParams) *cobra.Command { + var cronUpdateFlags cronJobUpdateFlags + var sinkFlags flags.SinkFlags + + cmd := &cobra.Command{ + Use: "update NAME --schedule SCHEDULE --sink SERVICE --data DATA", + Short: "Update a Cronjob source.", + Example: ` + # Update the schedule of a crontab source 'my-cron-trigger' to fire every minute + kn source cronjob update my-cron-trigger --schedule "* * * * */1"`, + + RunE: func(cmd *cobra.Command, args []string) (err error) { + if len(args) != 1 { + return errors.New("name of cronjob source required") + } + name := args[0] + + cronSourceClient, err := newCronJobSourceClient(p, cmd) + if err != nil { + return err + } + + servingClient, err := p.NewServingClient(cronSourceClient.Namespace()) + if err != nil { + return err + } + + destination, err := sinkFlags.ResolveSink(servingClient) + if err != nil { + return err + } + err = cronSourceClient.UpdateCronJobSource(name, cronUpdateFlags.schedule, cronUpdateFlags.data, destination) + if err == nil { + fmt.Fprintf(cmd.OutOrStdout(), "Cronjob source '%s' updated in namespace '%s'.\n", name, cronSourceClient.Namespace()) + } + return err + }, + } + commands.AddNamespaceFlags(cmd.Flags(), false) + cronUpdateFlags.addCronJobFlags(cmd) + sinkFlags.Add(cmd) + + return cmd +} diff --git a/pkg/kn/commands/source/source.go b/pkg/kn/commands/source/source.go index 6b9323a8b2..37c076291f 100644 --- a/pkg/kn/commands/source/source.go +++ b/pkg/kn/commands/source/source.go @@ -19,15 +19,16 @@ import ( "knative.dev/client/pkg/kn/commands" "knative.dev/client/pkg/kn/commands/source/apiserver" + "knative.dev/client/pkg/kn/commands/source/cronjob" ) -// NewSourceCommand defines and processes the `kn source` event source command group func NewSourceCommand(p *commands.KnParams) *cobra.Command { sourceCmd := &cobra.Command{ Use: "source", - Short: "Event Source command group", + Short: "Event source command group", } sourceCmd.AddCommand(apiserver.NewApiServerCommand(p)) sourceCmd.AddCommand(NewListTypesCommand(p)) + sourceCmd.AddCommand(cronjob.NewCronJobCommand(p)) return sourceCmd } diff --git a/pkg/kn/commands/types_test.go b/pkg/kn/commands/types_test.go index 559899a390..8f2590f1d7 100644 --- a/pkg/kn/commands/types_test.go +++ b/pkg/kn/commands/types_test.go @@ -187,7 +187,8 @@ func TestNewSourcesClient(t *testing.T) { } if sourcesClient != nil { - assert.Assert(t, sourcesClient.Namespace() == namespace) + assert.Assert(t, sourcesClient.ApiServerSourcesClient().Namespace() == namespace) + assert.Assert(t, sourcesClient.CronJobSourcesClient().Namespace() == namespace) } } }