diff --git a/Makefile b/Makefile index 39281a6..aff3b69 100644 --- a/Makefile +++ b/Makefile @@ -45,3 +45,20 @@ deb_%: clean docker_build_% itest_%: deb_% @echo "Built package for $*" + +gen-paasta-api: + rm -rf pkg/paastaapi + mkdir -p pkg/paastaapi + rm swagger.json + curl -o swagger.json https://raw.githubusercontent.com/Yelp/paasta/master/paasta_tools/api/api_docs/swagger.json + docker run \ + --rm -it \ + --user "$$(id -u):$$(id -g)" \ + -e GOPATH=$$HOME/go:/go \ + -v $$HOME:$$HOME \ + -w $$(pwd) quay.io/goswagger/swagger \ + generate client -f ./swagger.json -t pkg/paastaapi + @echo "Due to bug in goswagger you may need to add an import for paastaapi/client/operations" + @echo "in pkg/paastaapi/client/paasta_client.go, run 'go build ./...' to check." + @echo + @echo "Do not forget to 'git add' and 'git commit' updated swagger.json and paasta-api" diff --git a/go.mod b/go.mod index 323769e..ff4f1ab 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,11 @@ require ( github.com/dlespiau/kube-test-harness v0.0.0-20190930170435-ec3f93e1a754 github.com/fatih/structs v1.1.0 github.com/go-logr/zapr v0.1.1 // indirect + github.com/go-openapi/errors v0.19.4 + github.com/go-openapi/runtime v0.19.15 + github.com/go-openapi/strfmt v0.19.5 + github.com/go-openapi/swag v0.19.5 + github.com/go-openapi/validate v0.19.8 github.com/gogo/protobuf v1.2.1 // indirect github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7 // indirect github.com/hashicorp/golang-lru v0.5.3 // indirect @@ -22,7 +27,7 @@ require ( golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 // indirect golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 // indirect golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect - gopkg.in/yaml.v2 v2.2.2 + gopkg.in/yaml.v2 v2.2.4 k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible diff --git a/go.sum b/go.sum index f725407..079da1e 100644 --- a/go.sum +++ b/go.sum @@ -3,12 +3,22 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +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= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/appscode/jsonpatch v2.0.1+incompatible h1:Ksl+gGquV3TeYmiZPBsDNauiyloE7sg9OMUWKr5Ctmg= +github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -21,6 +31,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlespiau/kube-test-harness v0.0.0-20190930170435-ec3f93e1a754 h1:Qd6djMDE2KFeLwuKQ4B316XYt101DFoymbgoxFHeKCY= github.com/dlespiau/kube-test-harness v0.0.0-20190930170435-ec3f93e1a754/go.mod h1:rTr8X4qZPRmQKsyAjhECPi+zPnmlcmv5W9s1F11oBSo= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= @@ -29,6 +41,8 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -38,10 +52,68 @@ github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7 github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-logr/zapr v0.1.1 h1:qXBXPDdNncunGs7XeEpsJt8wCjYBygluzfdLO0G5baE= github.com/go-logr/zapr v0.1.1/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= +github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= +github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/analysis v0.19.5 h1:8b2ZgKfKIUTVQpTb77MoRDIMEIwvDVw40o3aOXdfYzI= +github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= +github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= +github.com/go-openapi/errors v0.19.4 h1:fSGwO1tSYHFu70NKaWJt5Qh0qoBRtCm/mXS1yhf+0W0= +github.com/go-openapi/errors v0.19.4/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= 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.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= +github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= +github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI= +github.com/go-openapi/loads v0.19.4 h1:5I4CCSqoWzT+82bBkNIvmLc0UOsoKKQ4Fz+3VxOB7SY= +github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= +github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= +github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= +github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= +github.com/go-openapi/runtime v0.19.15 h1:2GIefxs9Rx1vCDNghRtypRq+ig8KSLrjHbAYI/gCLCM= +github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= 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.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= +github.com/go-openapi/spec v0.19.3 h1:0XRyw8kguri6Yw4SxhsQA/atC88yqrk0+G4YhI2wabc= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= +github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= +github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= +github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= +github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= +github.com/go-openapi/strfmt v0.19.5 h1:0utjKrw+BAh8s57XE9Xz8DUBsVvPmRUB6styvl9wWIM= +github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= +github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87 h1:zP3nY8Tk2E6RTkqGYrarZXuzh+ffyLDljLxCy1iJw80= 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.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= +github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= +github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= +github.com/go-openapi/validate v0.19.8 h1:YFzsdWIDfVuLvIOF+ZmKjVg1MbPJ1QgY9PihMwei1ys= +github.com/go-openapi/validate v0.19.8/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= @@ -54,6 +126,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y 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= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= @@ -62,6 +135,7 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.1 h1:WeAefnSUHlBb0iJKwxFDZdbfGwkd7xRNuV+IpXMJhYk= github.com/googleapis/gnostic v0.3.1/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU= @@ -86,8 +160,16 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a h1:TpvdAwDAt1K4ANVOfcihouRdvP+MgAfDWwBuct4l6ZY= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0 h1:aizVhC/NAAcKWb+5QsU1iNOZb4Yws5UO2I+aIprQITM= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= @@ -138,6 +220,7 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -147,6 +230,7 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= @@ -155,6 +239,12 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= +go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.2 h1:jxcFYjlkl8xaERsgLo+RNquI0epW6zuy/ZRQs6jnrFA= +go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -168,7 +258,10 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/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-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -176,16 +269,20 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 h1:ulvT7fqt0yHWzpJwI57MezWnYDVpCAYBVuYst/L+fAY= golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 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 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/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-20191202225959-858c2ad4c8b6 h1:pE8b58s1HRDMi8RDc79m0HISf9D4TzseP40cEA6IGfs= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -200,20 +297,28 @@ 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-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f h1:68K/z8GLUxV76xGSqwTWw2gyk/jwn79LUL43rES2g8o= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/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.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -235,6 +340,8 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD 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= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= k8s.io/api v0.0.0-20190202010724-74b699b93c15 h1:AoUGjnJ3PJMFz+Rkp4lx3X+6mPUnY1MESJhbUSGX+pc= k8s.io/api v0.0.0-20190202010724-74b699b93c15/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= diff --git a/pkg/paastaapi/client/autoscaler/autoscaler_client.go b/pkg/paastaapi/client/autoscaler/autoscaler_client.go new file mode 100644 index 0000000..723b895 --- /dev/null +++ b/pkg/paastaapi/client/autoscaler/autoscaler_client.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package autoscaler + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new autoscaler API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for autoscaler API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientService is the interface for Client methods +type ClientService interface { + GetAutoscalerCount(params *GetAutoscalerCountParams) (*GetAutoscalerCountOK, error) + + UpdateAutoscalerCount(params *UpdateAutoscalerCountParams) (*UpdateAutoscalerCountAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + GetAutoscalerCount gets status of service name instance name +*/ +func (a *Client) GetAutoscalerCount(params *GetAutoscalerCountParams) (*GetAutoscalerCountOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAutoscalerCountParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "get_autoscaler_count", + Method: "GET", + PathPattern: "/services/{service}/{instance}/autoscaler", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAutoscalerCountReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*GetAutoscalerCountOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for get_autoscaler_count: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + UpdateAutoscalerCount gets status of service name instance name +*/ +func (a *Client) UpdateAutoscalerCount(params *UpdateAutoscalerCountParams) (*UpdateAutoscalerCountAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateAutoscalerCountParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "update_autoscaler_count", + Method: "POST", + PathPattern: "/services/{service}/{instance}/autoscaler", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateAutoscalerCountReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*UpdateAutoscalerCountAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for update_autoscaler_count: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/pkg/paastaapi/client/autoscaler/get_autoscaler_count_parameters.go b/pkg/paastaapi/client/autoscaler/get_autoscaler_count_parameters.go new file mode 100644 index 0000000..df8c045 --- /dev/null +++ b/pkg/paastaapi/client/autoscaler/get_autoscaler_count_parameters.go @@ -0,0 +1,156 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package autoscaler + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetAutoscalerCountParams creates a new GetAutoscalerCountParams object +// with the default values initialized. +func NewGetAutoscalerCountParams() *GetAutoscalerCountParams { + var () + return &GetAutoscalerCountParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAutoscalerCountParamsWithTimeout creates a new GetAutoscalerCountParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAutoscalerCountParamsWithTimeout(timeout time.Duration) *GetAutoscalerCountParams { + var () + return &GetAutoscalerCountParams{ + + timeout: timeout, + } +} + +// NewGetAutoscalerCountParamsWithContext creates a new GetAutoscalerCountParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAutoscalerCountParamsWithContext(ctx context.Context) *GetAutoscalerCountParams { + var () + return &GetAutoscalerCountParams{ + + Context: ctx, + } +} + +// NewGetAutoscalerCountParamsWithHTTPClient creates a new GetAutoscalerCountParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAutoscalerCountParamsWithHTTPClient(client *http.Client) *GetAutoscalerCountParams { + var () + return &GetAutoscalerCountParams{ + HTTPClient: client, + } +} + +/*GetAutoscalerCountParams contains all the parameters to send to the API endpoint +for the get autoscaler count operation typically these are written to a http.Request +*/ +type GetAutoscalerCountParams struct { + + /*Instance + Instance name + + */ + Instance string + /*Service + Service name + + */ + Service string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get autoscaler count params +func (o *GetAutoscalerCountParams) WithTimeout(timeout time.Duration) *GetAutoscalerCountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get autoscaler count params +func (o *GetAutoscalerCountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get autoscaler count params +func (o *GetAutoscalerCountParams) WithContext(ctx context.Context) *GetAutoscalerCountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get autoscaler count params +func (o *GetAutoscalerCountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get autoscaler count params +func (o *GetAutoscalerCountParams) WithHTTPClient(client *http.Client) *GetAutoscalerCountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get autoscaler count params +func (o *GetAutoscalerCountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInstance adds the instance to the get autoscaler count params +func (o *GetAutoscalerCountParams) WithInstance(instance string) *GetAutoscalerCountParams { + o.SetInstance(instance) + return o +} + +// SetInstance adds the instance to the get autoscaler count params +func (o *GetAutoscalerCountParams) SetInstance(instance string) { + o.Instance = instance +} + +// WithService adds the service to the get autoscaler count params +func (o *GetAutoscalerCountParams) WithService(service string) *GetAutoscalerCountParams { + o.SetService(service) + return o +} + +// SetService adds the service to the get autoscaler count params +func (o *GetAutoscalerCountParams) SetService(service string) { + o.Service = service +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAutoscalerCountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param instance + if err := r.SetPathParam("instance", o.Instance); err != nil { + return err + } + + // path param service + if err := r.SetPathParam("service", o.Service); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/autoscaler/get_autoscaler_count_responses.go b/pkg/paastaapi/client/autoscaler/get_autoscaler_count_responses.go new file mode 100644 index 0000000..3530321 --- /dev/null +++ b/pkg/paastaapi/client/autoscaler/get_autoscaler_count_responses.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package autoscaler + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// GetAutoscalerCountReader is a Reader for the GetAutoscalerCount structure. +type GetAutoscalerCountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAutoscalerCountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAutoscalerCountOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewGetAutoscalerCountNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewGetAutoscalerCountInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAutoscalerCountOK creates a GetAutoscalerCountOK with default headers values +func NewGetAutoscalerCountOK() *GetAutoscalerCountOK { + return &GetAutoscalerCountOK{} +} + +/*GetAutoscalerCountOK handles this case with default header values. + +Get desired instance count for a service instance +*/ +type GetAutoscalerCountOK struct { + Payload *GetAutoscalerCountOKBody +} + +func (o *GetAutoscalerCountOK) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/autoscaler][%d] getAutoscalerCountOK %+v", 200, o.Payload) +} + +func (o *GetAutoscalerCountOK) GetPayload() *GetAutoscalerCountOKBody { + return o.Payload +} + +func (o *GetAutoscalerCountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(GetAutoscalerCountOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAutoscalerCountNotFound creates a GetAutoscalerCountNotFound with default headers values +func NewGetAutoscalerCountNotFound() *GetAutoscalerCountNotFound { + return &GetAutoscalerCountNotFound{} +} + +/*GetAutoscalerCountNotFound handles this case with default header values. + +Deployment key not found +*/ +type GetAutoscalerCountNotFound struct { +} + +func (o *GetAutoscalerCountNotFound) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/autoscaler][%d] getAutoscalerCountNotFound ", 404) +} + +func (o *GetAutoscalerCountNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetAutoscalerCountInternalServerError creates a GetAutoscalerCountInternalServerError with default headers values +func NewGetAutoscalerCountInternalServerError() *GetAutoscalerCountInternalServerError { + return &GetAutoscalerCountInternalServerError{} +} + +/*GetAutoscalerCountInternalServerError handles this case with default header values. + +Instance failure +*/ +type GetAutoscalerCountInternalServerError struct { +} + +func (o *GetAutoscalerCountInternalServerError) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/autoscaler][%d] getAutoscalerCountInternalServerError ", 500) +} + +func (o *GetAutoscalerCountInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +/*GetAutoscalerCountOKBody get autoscaler count o k body +swagger:model GetAutoscalerCountOKBody +*/ +type GetAutoscalerCountOKBody struct { + + // desired instances + DesiredInstances int64 `json:"desired_instances,omitempty"` +} + +// Validate validates this get autoscaler count o k body +func (o *GetAutoscalerCountOKBody) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *GetAutoscalerCountOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GetAutoscalerCountOKBody) UnmarshalBinary(b []byte) error { + var res GetAutoscalerCountOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/pkg/paastaapi/client/autoscaler/update_autoscaler_count_parameters.go b/pkg/paastaapi/client/autoscaler/update_autoscaler_count_parameters.go new file mode 100644 index 0000000..4e4e1dc --- /dev/null +++ b/pkg/paastaapi/client/autoscaler/update_autoscaler_count_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package autoscaler + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewUpdateAutoscalerCountParams creates a new UpdateAutoscalerCountParams object +// with the default values initialized. +func NewUpdateAutoscalerCountParams() *UpdateAutoscalerCountParams { + var () + return &UpdateAutoscalerCountParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateAutoscalerCountParamsWithTimeout creates a new UpdateAutoscalerCountParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateAutoscalerCountParamsWithTimeout(timeout time.Duration) *UpdateAutoscalerCountParams { + var () + return &UpdateAutoscalerCountParams{ + + timeout: timeout, + } +} + +// NewUpdateAutoscalerCountParamsWithContext creates a new UpdateAutoscalerCountParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateAutoscalerCountParamsWithContext(ctx context.Context) *UpdateAutoscalerCountParams { + var () + return &UpdateAutoscalerCountParams{ + + Context: ctx, + } +} + +// NewUpdateAutoscalerCountParamsWithHTTPClient creates a new UpdateAutoscalerCountParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateAutoscalerCountParamsWithHTTPClient(client *http.Client) *UpdateAutoscalerCountParams { + var () + return &UpdateAutoscalerCountParams{ + HTTPClient: client, + } +} + +/*UpdateAutoscalerCountParams contains all the parameters to send to the API endpoint +for the update autoscaler count operation typically these are written to a http.Request +*/ +type UpdateAutoscalerCountParams struct { + + /*Instance + Instance name + + */ + Instance string + /*JSONBody*/ + JSONBody UpdateAutoscalerCountBody + /*Service + Service name + + */ + Service string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) WithTimeout(timeout time.Duration) *UpdateAutoscalerCountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) WithContext(ctx context.Context) *UpdateAutoscalerCountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) WithHTTPClient(client *http.Client) *UpdateAutoscalerCountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInstance adds the instance to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) WithInstance(instance string) *UpdateAutoscalerCountParams { + o.SetInstance(instance) + return o +} + +// SetInstance adds the instance to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) SetInstance(instance string) { + o.Instance = instance +} + +// WithJSONBody adds the jSONBody to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) WithJSONBody(jSONBody UpdateAutoscalerCountBody) *UpdateAutoscalerCountParams { + o.SetJSONBody(jSONBody) + return o +} + +// SetJSONBody adds the jsonBody to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) SetJSONBody(jSONBody UpdateAutoscalerCountBody) { + o.JSONBody = jSONBody +} + +// WithService adds the service to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) WithService(service string) *UpdateAutoscalerCountParams { + o.SetService(service) + return o +} + +// SetService adds the service to the update autoscaler count params +func (o *UpdateAutoscalerCountParams) SetService(service string) { + o.Service = service +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateAutoscalerCountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param instance + if err := r.SetPathParam("instance", o.Instance); err != nil { + return err + } + + if err := r.SetBodyParam(o.JSONBody); err != nil { + return err + } + + // path param service + if err := r.SetPathParam("service", o.Service); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/autoscaler/update_autoscaler_count_responses.go b/pkg/paastaapi/client/autoscaler/update_autoscaler_count_responses.go new file mode 100644 index 0000000..fc7be49 --- /dev/null +++ b/pkg/paastaapi/client/autoscaler/update_autoscaler_count_responses.go @@ -0,0 +1,192 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package autoscaler + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UpdateAutoscalerCountReader is a Reader for the UpdateAutoscalerCount structure. +type UpdateAutoscalerCountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateAutoscalerCountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewUpdateAutoscalerCountAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewUpdateAutoscalerCountNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewUpdateAutoscalerCountInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewUpdateAutoscalerCountAccepted creates a UpdateAutoscalerCountAccepted with default headers values +func NewUpdateAutoscalerCountAccepted() *UpdateAutoscalerCountAccepted { + return &UpdateAutoscalerCountAccepted{} +} + +/*UpdateAutoscalerCountAccepted handles this case with default header values. + +Set desired instance count for a service instance +*/ +type UpdateAutoscalerCountAccepted struct { + Payload *UpdateAutoscalerCountAcceptedBody +} + +func (o *UpdateAutoscalerCountAccepted) Error() string { + return fmt.Sprintf("[POST /services/{service}/{instance}/autoscaler][%d] updateAutoscalerCountAccepted %+v", 202, o.Payload) +} + +func (o *UpdateAutoscalerCountAccepted) GetPayload() *UpdateAutoscalerCountAcceptedBody { + return o.Payload +} + +func (o *UpdateAutoscalerCountAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(UpdateAutoscalerCountAcceptedBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateAutoscalerCountNotFound creates a UpdateAutoscalerCountNotFound with default headers values +func NewUpdateAutoscalerCountNotFound() *UpdateAutoscalerCountNotFound { + return &UpdateAutoscalerCountNotFound{} +} + +/*UpdateAutoscalerCountNotFound handles this case with default header values. + +Deployment key not found +*/ +type UpdateAutoscalerCountNotFound struct { +} + +func (o *UpdateAutoscalerCountNotFound) Error() string { + return fmt.Sprintf("[POST /services/{service}/{instance}/autoscaler][%d] updateAutoscalerCountNotFound ", 404) +} + +func (o *UpdateAutoscalerCountNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateAutoscalerCountInternalServerError creates a UpdateAutoscalerCountInternalServerError with default headers values +func NewUpdateAutoscalerCountInternalServerError() *UpdateAutoscalerCountInternalServerError { + return &UpdateAutoscalerCountInternalServerError{} +} + +/*UpdateAutoscalerCountInternalServerError handles this case with default header values. + +Instance failure +*/ +type UpdateAutoscalerCountInternalServerError struct { +} + +func (o *UpdateAutoscalerCountInternalServerError) Error() string { + return fmt.Sprintf("[POST /services/{service}/{instance}/autoscaler][%d] updateAutoscalerCountInternalServerError ", 500) +} + +func (o *UpdateAutoscalerCountInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +/*UpdateAutoscalerCountAcceptedBody update autoscaler count accepted body +swagger:model UpdateAutoscalerCountAcceptedBody +*/ +type UpdateAutoscalerCountAcceptedBody struct { + + // desired instances + DesiredInstances int64 `json:"desired_instances,omitempty"` + + // status + Status string `json:"status,omitempty"` +} + +// Validate validates this update autoscaler count accepted body +func (o *UpdateAutoscalerCountAcceptedBody) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *UpdateAutoscalerCountAcceptedBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UpdateAutoscalerCountAcceptedBody) UnmarshalBinary(b []byte) error { + var res UpdateAutoscalerCountAcceptedBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/*UpdateAutoscalerCountBody update autoscaler count body +swagger:model UpdateAutoscalerCountBody +*/ +type UpdateAutoscalerCountBody struct { + + // calculated instances + CalculatedInstances int64 `json:"calculated_instances,omitempty"` + + // desired instances + DesiredInstances int64 `json:"desired_instances,omitempty"` +} + +// Validate validates this update autoscaler count body +func (o *UpdateAutoscalerCountBody) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *UpdateAutoscalerCountBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UpdateAutoscalerCountBody) UnmarshalBinary(b []byte) error { + var res UpdateAutoscalerCountBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_client.go b/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_client.go new file mode 100644 index 0000000..986e590 --- /dev/null +++ b/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_client.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package marathon_dashboard + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new marathon dashboard API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for marathon dashboard API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientService is the interface for Client methods +type ClientService interface { + MarathonDashboard(params *MarathonDashboardParams) (*MarathonDashboardOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + MarathonDashboard gets marathon service instances and their shards +*/ +func (a *Client) MarathonDashboard(params *MarathonDashboardParams) (*MarathonDashboardOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMarathonDashboardParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "marathon_dashboard", + Method: "GET", + PathPattern: "/marathon_dashboard", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &MarathonDashboardReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*MarathonDashboardOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for marathon_dashboard: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_parameters.go b/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_parameters.go new file mode 100644 index 0000000..67d5f61 --- /dev/null +++ b/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_parameters.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package marathon_dashboard + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMarathonDashboardParams creates a new MarathonDashboardParams object +// with the default values initialized. +func NewMarathonDashboardParams() *MarathonDashboardParams { + + return &MarathonDashboardParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewMarathonDashboardParamsWithTimeout creates a new MarathonDashboardParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewMarathonDashboardParamsWithTimeout(timeout time.Duration) *MarathonDashboardParams { + + return &MarathonDashboardParams{ + + timeout: timeout, + } +} + +// NewMarathonDashboardParamsWithContext creates a new MarathonDashboardParams object +// with the default values initialized, and the ability to set a context for a request +func NewMarathonDashboardParamsWithContext(ctx context.Context) *MarathonDashboardParams { + + return &MarathonDashboardParams{ + + Context: ctx, + } +} + +// NewMarathonDashboardParamsWithHTTPClient creates a new MarathonDashboardParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewMarathonDashboardParamsWithHTTPClient(client *http.Client) *MarathonDashboardParams { + + return &MarathonDashboardParams{ + HTTPClient: client, + } +} + +/*MarathonDashboardParams contains all the parameters to send to the API endpoint +for the marathon dashboard operation typically these are written to a http.Request +*/ +type MarathonDashboardParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the marathon dashboard params +func (o *MarathonDashboardParams) WithTimeout(timeout time.Duration) *MarathonDashboardParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the marathon dashboard params +func (o *MarathonDashboardParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the marathon dashboard params +func (o *MarathonDashboardParams) WithContext(ctx context.Context) *MarathonDashboardParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the marathon dashboard params +func (o *MarathonDashboardParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the marathon dashboard params +func (o *MarathonDashboardParams) WithHTTPClient(client *http.Client) *MarathonDashboardParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the marathon dashboard params +func (o *MarathonDashboardParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *MarathonDashboardParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_responses.go b/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_responses.go new file mode 100644 index 0000000..c57e6cb --- /dev/null +++ b/pkg/paastaapi/client/marathon_dashboard/marathon_dashboard_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package marathon_dashboard + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/models" +) + +// MarathonDashboardReader is a Reader for the MarathonDashboard structure. +type MarathonDashboardReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MarathonDashboardReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMarathonDashboardOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewMarathonDashboardOK creates a MarathonDashboardOK with default headers values +func NewMarathonDashboardOK() *MarathonDashboardOK { + return &MarathonDashboardOK{} +} + +/*MarathonDashboardOK handles this case with default header values. + +List of service instances and information on their Marathon shard +*/ +type MarathonDashboardOK struct { + Payload models.MarathonDashboard +} + +func (o *MarathonDashboardOK) Error() string { + return fmt.Sprintf("[GET /marathon_dashboard][%d] marathonDashboardOK %+v", 200, o.Payload) +} + +func (o *MarathonDashboardOK) GetPayload() models.MarathonDashboard { + return o.Payload +} + +func (o *MarathonDashboardOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/paastaapi/client/operations/delete_service_autoscaler_pause_parameters.go b/pkg/paastaapi/client/operations/delete_service_autoscaler_pause_parameters.go new file mode 100644 index 0000000..999782b --- /dev/null +++ b/pkg/paastaapi/client/operations/delete_service_autoscaler_pause_parameters.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeleteServiceAutoscalerPauseParams creates a new DeleteServiceAutoscalerPauseParams object +// with the default values initialized. +func NewDeleteServiceAutoscalerPauseParams() *DeleteServiceAutoscalerPauseParams { + + return &DeleteServiceAutoscalerPauseParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteServiceAutoscalerPauseParamsWithTimeout creates a new DeleteServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteServiceAutoscalerPauseParamsWithTimeout(timeout time.Duration) *DeleteServiceAutoscalerPauseParams { + + return &DeleteServiceAutoscalerPauseParams{ + + timeout: timeout, + } +} + +// NewDeleteServiceAutoscalerPauseParamsWithContext creates a new DeleteServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteServiceAutoscalerPauseParamsWithContext(ctx context.Context) *DeleteServiceAutoscalerPauseParams { + + return &DeleteServiceAutoscalerPauseParams{ + + Context: ctx, + } +} + +// NewDeleteServiceAutoscalerPauseParamsWithHTTPClient creates a new DeleteServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteServiceAutoscalerPauseParamsWithHTTPClient(client *http.Client) *DeleteServiceAutoscalerPauseParams { + + return &DeleteServiceAutoscalerPauseParams{ + HTTPClient: client, + } +} + +/*DeleteServiceAutoscalerPauseParams contains all the parameters to send to the API endpoint +for the delete service autoscaler pause operation typically these are written to a http.Request +*/ +type DeleteServiceAutoscalerPauseParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete service autoscaler pause params +func (o *DeleteServiceAutoscalerPauseParams) WithTimeout(timeout time.Duration) *DeleteServiceAutoscalerPauseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete service autoscaler pause params +func (o *DeleteServiceAutoscalerPauseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete service autoscaler pause params +func (o *DeleteServiceAutoscalerPauseParams) WithContext(ctx context.Context) *DeleteServiceAutoscalerPauseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete service autoscaler pause params +func (o *DeleteServiceAutoscalerPauseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete service autoscaler pause params +func (o *DeleteServiceAutoscalerPauseParams) WithHTTPClient(client *http.Client) *DeleteServiceAutoscalerPauseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete service autoscaler pause params +func (o *DeleteServiceAutoscalerPauseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteServiceAutoscalerPauseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/operations/delete_service_autoscaler_pause_responses.go b/pkg/paastaapi/client/operations/delete_service_autoscaler_pause_responses.go new file mode 100644 index 0000000..d41f68f --- /dev/null +++ b/pkg/paastaapi/client/operations/delete_service_autoscaler_pause_responses.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteServiceAutoscalerPauseReader is a Reader for the DeleteServiceAutoscalerPause structure. +type DeleteServiceAutoscalerPauseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteServiceAutoscalerPauseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteServiceAutoscalerPauseOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewDeleteServiceAutoscalerPauseInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteServiceAutoscalerPauseOK creates a DeleteServiceAutoscalerPauseOK with default headers values +func NewDeleteServiceAutoscalerPauseOK() *DeleteServiceAutoscalerPauseOK { + return &DeleteServiceAutoscalerPauseOK{} +} + +/*DeleteServiceAutoscalerPauseOK handles this case with default header values. + +Service autoscaler successfully unpaused +*/ +type DeleteServiceAutoscalerPauseOK struct { +} + +func (o *DeleteServiceAutoscalerPauseOK) Error() string { + return fmt.Sprintf("[DELETE /service_autoscaler/pause][%d] deleteServiceAutoscalerPauseOK ", 200) +} + +func (o *DeleteServiceAutoscalerPauseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteServiceAutoscalerPauseInternalServerError creates a DeleteServiceAutoscalerPauseInternalServerError with default headers values +func NewDeleteServiceAutoscalerPauseInternalServerError() *DeleteServiceAutoscalerPauseInternalServerError { + return &DeleteServiceAutoscalerPauseInternalServerError{} +} + +/*DeleteServiceAutoscalerPauseInternalServerError handles this case with default header values. + +Unable to talk to zookeeper +*/ +type DeleteServiceAutoscalerPauseInternalServerError struct { +} + +func (o *DeleteServiceAutoscalerPauseInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /service_autoscaler/pause][%d] deleteServiceAutoscalerPauseInternalServerError ", 500) +} + +func (o *DeleteServiceAutoscalerPauseInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/client/operations/deploy_queue_parameters.go b/pkg/paastaapi/client/operations/deploy_queue_parameters.go new file mode 100644 index 0000000..a7e02a0 --- /dev/null +++ b/pkg/paastaapi/client/operations/deploy_queue_parameters.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeployQueueParams creates a new DeployQueueParams object +// with the default values initialized. +func NewDeployQueueParams() *DeployQueueParams { + + return &DeployQueueParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeployQueueParamsWithTimeout creates a new DeployQueueParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeployQueueParamsWithTimeout(timeout time.Duration) *DeployQueueParams { + + return &DeployQueueParams{ + + timeout: timeout, + } +} + +// NewDeployQueueParamsWithContext creates a new DeployQueueParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeployQueueParamsWithContext(ctx context.Context) *DeployQueueParams { + + return &DeployQueueParams{ + + Context: ctx, + } +} + +// NewDeployQueueParamsWithHTTPClient creates a new DeployQueueParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeployQueueParamsWithHTTPClient(client *http.Client) *DeployQueueParams { + + return &DeployQueueParams{ + HTTPClient: client, + } +} + +/*DeployQueueParams contains all the parameters to send to the API endpoint +for the deploy queue operation typically these are written to a http.Request +*/ +type DeployQueueParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the deploy queue params +func (o *DeployQueueParams) WithTimeout(timeout time.Duration) *DeployQueueParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the deploy queue params +func (o *DeployQueueParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the deploy queue params +func (o *DeployQueueParams) WithContext(ctx context.Context) *DeployQueueParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the deploy queue params +func (o *DeployQueueParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the deploy queue params +func (o *DeployQueueParams) WithHTTPClient(client *http.Client) *DeployQueueParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the deploy queue params +func (o *DeployQueueParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DeployQueueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/operations/deploy_queue_responses.go b/pkg/paastaapi/client/operations/deploy_queue_responses.go new file mode 100644 index 0000000..ec56eac --- /dev/null +++ b/pkg/paastaapi/client/operations/deploy_queue_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/models" +) + +// DeployQueueReader is a Reader for the DeployQueue structure. +type DeployQueueReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeployQueueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeployQueueOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeployQueueOK creates a DeployQueueOK with default headers values +func NewDeployQueueOK() *DeployQueueOK { + return &DeployQueueOK{} +} + +/*DeployQueueOK handles this case with default header values. + +Contents of deploy queue +*/ +type DeployQueueOK struct { + Payload *models.DeployQueue +} + +func (o *DeployQueueOK) Error() string { + return fmt.Sprintf("[GET /deploy_queue][%d] deployQueueOK %+v", 200, o.Payload) +} + +func (o *DeployQueueOK) GetPayload() *models.DeployQueue { + return o.Payload +} + +func (o *DeployQueueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DeployQueue) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/paastaapi/client/operations/get_service_autoscaler_pause_parameters.go b/pkg/paastaapi/client/operations/get_service_autoscaler_pause_parameters.go new file mode 100644 index 0000000..e00dd1b --- /dev/null +++ b/pkg/paastaapi/client/operations/get_service_autoscaler_pause_parameters.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetServiceAutoscalerPauseParams creates a new GetServiceAutoscalerPauseParams object +// with the default values initialized. +func NewGetServiceAutoscalerPauseParams() *GetServiceAutoscalerPauseParams { + + return &GetServiceAutoscalerPauseParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetServiceAutoscalerPauseParamsWithTimeout creates a new GetServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetServiceAutoscalerPauseParamsWithTimeout(timeout time.Duration) *GetServiceAutoscalerPauseParams { + + return &GetServiceAutoscalerPauseParams{ + + timeout: timeout, + } +} + +// NewGetServiceAutoscalerPauseParamsWithContext creates a new GetServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetServiceAutoscalerPauseParamsWithContext(ctx context.Context) *GetServiceAutoscalerPauseParams { + + return &GetServiceAutoscalerPauseParams{ + + Context: ctx, + } +} + +// NewGetServiceAutoscalerPauseParamsWithHTTPClient creates a new GetServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetServiceAutoscalerPauseParamsWithHTTPClient(client *http.Client) *GetServiceAutoscalerPauseParams { + + return &GetServiceAutoscalerPauseParams{ + HTTPClient: client, + } +} + +/*GetServiceAutoscalerPauseParams contains all the parameters to send to the API endpoint +for the get service autoscaler pause operation typically these are written to a http.Request +*/ +type GetServiceAutoscalerPauseParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get service autoscaler pause params +func (o *GetServiceAutoscalerPauseParams) WithTimeout(timeout time.Duration) *GetServiceAutoscalerPauseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get service autoscaler pause params +func (o *GetServiceAutoscalerPauseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get service autoscaler pause params +func (o *GetServiceAutoscalerPauseParams) WithContext(ctx context.Context) *GetServiceAutoscalerPauseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get service autoscaler pause params +func (o *GetServiceAutoscalerPauseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get service autoscaler pause params +func (o *GetServiceAutoscalerPauseParams) WithHTTPClient(client *http.Client) *GetServiceAutoscalerPauseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get service autoscaler pause params +func (o *GetServiceAutoscalerPauseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetServiceAutoscalerPauseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/operations/get_service_autoscaler_pause_responses.go b/pkg/paastaapi/client/operations/get_service_autoscaler_pause_responses.go new file mode 100644 index 0000000..5e0eda9 --- /dev/null +++ b/pkg/paastaapi/client/operations/get_service_autoscaler_pause_responses.go @@ -0,0 +1,92 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// GetServiceAutoscalerPauseReader is a Reader for the GetServiceAutoscalerPause structure. +type GetServiceAutoscalerPauseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetServiceAutoscalerPauseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetServiceAutoscalerPauseOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewGetServiceAutoscalerPauseInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetServiceAutoscalerPauseOK creates a GetServiceAutoscalerPauseOK with default headers values +func NewGetServiceAutoscalerPauseOK() *GetServiceAutoscalerPauseOK { + return &GetServiceAutoscalerPauseOK{} +} + +/*GetServiceAutoscalerPauseOK handles this case with default header values. + +The time until which the servcie autoscaler is paused for +*/ +type GetServiceAutoscalerPauseOK struct { + Payload string +} + +func (o *GetServiceAutoscalerPauseOK) Error() string { + return fmt.Sprintf("[GET /service_autoscaler/pause][%d] getServiceAutoscalerPauseOK %+v", 200, o.Payload) +} + +func (o *GetServiceAutoscalerPauseOK) GetPayload() string { + return o.Payload +} + +func (o *GetServiceAutoscalerPauseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetServiceAutoscalerPauseInternalServerError creates a GetServiceAutoscalerPauseInternalServerError with default headers values +func NewGetServiceAutoscalerPauseInternalServerError() *GetServiceAutoscalerPauseInternalServerError { + return &GetServiceAutoscalerPauseInternalServerError{} +} + +/*GetServiceAutoscalerPauseInternalServerError handles this case with default header values. + +Unable to talk to zookeeper +*/ +type GetServiceAutoscalerPauseInternalServerError struct { +} + +func (o *GetServiceAutoscalerPauseInternalServerError) Error() string { + return fmt.Sprintf("[GET /service_autoscaler/pause][%d] getServiceAutoscalerPauseInternalServerError ", 500) +} + +func (o *GetServiceAutoscalerPauseInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/client/operations/metastatus_parameters.go b/pkg/paastaapi/client/operations/metastatus_parameters.go new file mode 100644 index 0000000..3448fcd --- /dev/null +++ b/pkg/paastaapi/client/operations/metastatus_parameters.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewMetastatusParams creates a new MetastatusParams object +// with the default values initialized. +func NewMetastatusParams() *MetastatusParams { + var () + return &MetastatusParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewMetastatusParamsWithTimeout creates a new MetastatusParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewMetastatusParamsWithTimeout(timeout time.Duration) *MetastatusParams { + var () + return &MetastatusParams{ + + timeout: timeout, + } +} + +// NewMetastatusParamsWithContext creates a new MetastatusParams object +// with the default values initialized, and the ability to set a context for a request +func NewMetastatusParamsWithContext(ctx context.Context) *MetastatusParams { + var () + return &MetastatusParams{ + + Context: ctx, + } +} + +// NewMetastatusParamsWithHTTPClient creates a new MetastatusParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewMetastatusParamsWithHTTPClient(client *http.Client) *MetastatusParams { + var () + return &MetastatusParams{ + HTTPClient: client, + } +} + +/*MetastatusParams contains all the parameters to send to the API endpoint +for the metastatus operation typically these are written to a http.Request +*/ +type MetastatusParams struct { + + /*CmdArgs + comma separated list of command arguments + + */ + CmdArgs []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the metastatus params +func (o *MetastatusParams) WithTimeout(timeout time.Duration) *MetastatusParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the metastatus params +func (o *MetastatusParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the metastatus params +func (o *MetastatusParams) WithContext(ctx context.Context) *MetastatusParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the metastatus params +func (o *MetastatusParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the metastatus params +func (o *MetastatusParams) WithHTTPClient(client *http.Client) *MetastatusParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the metastatus params +func (o *MetastatusParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCmdArgs adds the cmdArgs to the metastatus params +func (o *MetastatusParams) WithCmdArgs(cmdArgs []string) *MetastatusParams { + o.SetCmdArgs(cmdArgs) + return o +} + +// SetCmdArgs adds the cmdArgs to the metastatus params +func (o *MetastatusParams) SetCmdArgs(cmdArgs []string) { + o.CmdArgs = cmdArgs +} + +// WriteToRequest writes these params to a swagger request +func (o *MetastatusParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + valuesCmdArgs := o.CmdArgs + + joinedCmdArgs := swag.JoinByFormat(valuesCmdArgs, "csv") + // query array param cmd_args + if err := r.SetQueryParam("cmd_args", joinedCmdArgs...); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/operations/metastatus_responses.go b/pkg/paastaapi/client/operations/metastatus_responses.go new file mode 100644 index 0000000..dea90ba --- /dev/null +++ b/pkg/paastaapi/client/operations/metastatus_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/models" +) + +// MetastatusReader is a Reader for the Metastatus structure. +type MetastatusReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MetastatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMetastatusOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewMetastatusInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewMetastatusOK creates a MetastatusOK with default headers values +func NewMetastatusOK() *MetastatusOK { + return &MetastatusOK{} +} + +/*MetastatusOK handles this case with default header values. + +Detailed metastatus +*/ +type MetastatusOK struct { + Payload *models.MetaStatus +} + +func (o *MetastatusOK) Error() string { + return fmt.Sprintf("[GET /metastatus][%d] metastatusOK %+v", 200, o.Payload) +} + +func (o *MetastatusOK) GetPayload() *models.MetaStatus { + return o.Payload +} + +func (o *MetastatusOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.MetaStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMetastatusInternalServerError creates a MetastatusInternalServerError with default headers values +func NewMetastatusInternalServerError() *MetastatusInternalServerError { + return &MetastatusInternalServerError{} +} + +/*MetastatusInternalServerError handles this case with default header values. + +Metastatus failure +*/ +type MetastatusInternalServerError struct { +} + +func (o *MetastatusInternalServerError) Error() string { + return fmt.Sprintf("[GET /metastatus][%d] metastatusInternalServerError ", 500) +} + +func (o *MetastatusInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/client/operations/operations_client.go b/pkg/paastaapi/client/operations/operations_client.go new file mode 100644 index 0000000..825d239 --- /dev/null +++ b/pkg/paastaapi/client/operations/operations_client.go @@ -0,0 +1,252 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new operations API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for operations API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteServiceAutoscalerPause(params *DeleteServiceAutoscalerPauseParams) (*DeleteServiceAutoscalerPauseOK, error) + + DeployQueue(params *DeployQueueParams) (*DeployQueueOK, error) + + GetServiceAutoscalerPause(params *GetServiceAutoscalerPauseParams) (*GetServiceAutoscalerPauseOK, error) + + Metastatus(params *MetastatusParams) (*MetastatusOK, error) + + ShowVersion(params *ShowVersionParams) (*ShowVersionOK, error) + + UpdateServiceAutoscalerPause(params *UpdateServiceAutoscalerPauseParams) (*UpdateServiceAutoscalerPauseOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + DeleteServiceAutoscalerPause unpauses the autoscaler +*/ +func (a *Client) DeleteServiceAutoscalerPause(params *DeleteServiceAutoscalerPauseParams) (*DeleteServiceAutoscalerPauseOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteServiceAutoscalerPauseParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "delete_service_autoscaler_pause", + Method: "DELETE", + PathPattern: "/service_autoscaler/pause", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteServiceAutoscalerPauseReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteServiceAutoscalerPauseOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for delete_service_autoscaler_pause: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + DeployQueue gets deploy queue contents +*/ +func (a *Client) DeployQueue(params *DeployQueueParams) (*DeployQueueOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeployQueueParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "deploy_queue", + Method: "GET", + PathPattern: "/deploy_queue", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeployQueueReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*DeployQueueOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for deploy_queue: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + GetServiceAutoscalerPause gets autoscaling pause time +*/ +func (a *Client) GetServiceAutoscalerPause(params *GetServiceAutoscalerPauseParams) (*GetServiceAutoscalerPauseOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetServiceAutoscalerPauseParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "get_service_autoscaler_pause", + Method: "GET", + PathPattern: "/service_autoscaler/pause", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetServiceAutoscalerPauseReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*GetServiceAutoscalerPauseOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for get_service_autoscaler_pause: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + Metastatus gets metastatus +*/ +func (a *Client) Metastatus(params *MetastatusParams) (*MetastatusOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMetastatusParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "metastatus", + Method: "GET", + PathPattern: "/metastatus", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &MetastatusReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*MetastatusOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for metastatus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ShowVersion versions of paasta tools package +*/ +func (a *Client) ShowVersion(params *ShowVersionParams) (*ShowVersionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewShowVersionParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "showVersion", + Method: "GET", + PathPattern: "/version", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ShowVersionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ShowVersionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for showVersion: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + UpdateServiceAutoscalerPause update service autoscaler pause API +*/ +func (a *Client) UpdateServiceAutoscalerPause(params *UpdateServiceAutoscalerPauseParams) (*UpdateServiceAutoscalerPauseOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateServiceAutoscalerPauseParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "update_service_autoscaler_pause", + Method: "POST", + PathPattern: "/service_autoscaler/pause", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateServiceAutoscalerPauseReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*UpdateServiceAutoscalerPauseOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for update_service_autoscaler_pause: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/pkg/paastaapi/client/operations/show_version_parameters.go b/pkg/paastaapi/client/operations/show_version_parameters.go new file mode 100644 index 0000000..a8b181a --- /dev/null +++ b/pkg/paastaapi/client/operations/show_version_parameters.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewShowVersionParams creates a new ShowVersionParams object +// with the default values initialized. +func NewShowVersionParams() *ShowVersionParams { + + return &ShowVersionParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewShowVersionParamsWithTimeout creates a new ShowVersionParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewShowVersionParamsWithTimeout(timeout time.Duration) *ShowVersionParams { + + return &ShowVersionParams{ + + timeout: timeout, + } +} + +// NewShowVersionParamsWithContext creates a new ShowVersionParams object +// with the default values initialized, and the ability to set a context for a request +func NewShowVersionParamsWithContext(ctx context.Context) *ShowVersionParams { + + return &ShowVersionParams{ + + Context: ctx, + } +} + +// NewShowVersionParamsWithHTTPClient creates a new ShowVersionParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewShowVersionParamsWithHTTPClient(client *http.Client) *ShowVersionParams { + + return &ShowVersionParams{ + HTTPClient: client, + } +} + +/*ShowVersionParams contains all the parameters to send to the API endpoint +for the show version operation typically these are written to a http.Request +*/ +type ShowVersionParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the show version params +func (o *ShowVersionParams) WithTimeout(timeout time.Duration) *ShowVersionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the show version params +func (o *ShowVersionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the show version params +func (o *ShowVersionParams) WithContext(ctx context.Context) *ShowVersionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the show version params +func (o *ShowVersionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the show version params +func (o *ShowVersionParams) WithHTTPClient(client *http.Client) *ShowVersionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the show version params +func (o *ShowVersionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ShowVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/operations/show_version_responses.go b/pkg/paastaapi/client/operations/show_version_responses.go new file mode 100644 index 0000000..bd7c8f7 --- /dev/null +++ b/pkg/paastaapi/client/operations/show_version_responses.go @@ -0,0 +1,65 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// ShowVersionReader is a Reader for the ShowVersion structure. +type ShowVersionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ShowVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewShowVersionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewShowVersionOK creates a ShowVersionOK with default headers values +func NewShowVersionOK() *ShowVersionOK { + return &ShowVersionOK{} +} + +/*ShowVersionOK handles this case with default header values. + +Version of paasta_tools package +*/ +type ShowVersionOK struct { + Payload string +} + +func (o *ShowVersionOK) Error() string { + return fmt.Sprintf("[GET /version][%d] showVersionOK %+v", 200, o.Payload) +} + +func (o *ShowVersionOK) GetPayload() string { + return o.Payload +} + +func (o *ShowVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/paastaapi/client/operations/update_service_autoscaler_pause_parameters.go b/pkg/paastaapi/client/operations/update_service_autoscaler_pause_parameters.go new file mode 100644 index 0000000..5fb998d --- /dev/null +++ b/pkg/paastaapi/client/operations/update_service_autoscaler_pause_parameters.go @@ -0,0 +1,131 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewUpdateServiceAutoscalerPauseParams creates a new UpdateServiceAutoscalerPauseParams object +// with the default values initialized. +func NewUpdateServiceAutoscalerPauseParams() *UpdateServiceAutoscalerPauseParams { + var () + return &UpdateServiceAutoscalerPauseParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateServiceAutoscalerPauseParamsWithTimeout creates a new UpdateServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateServiceAutoscalerPauseParamsWithTimeout(timeout time.Duration) *UpdateServiceAutoscalerPauseParams { + var () + return &UpdateServiceAutoscalerPauseParams{ + + timeout: timeout, + } +} + +// NewUpdateServiceAutoscalerPauseParamsWithContext creates a new UpdateServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateServiceAutoscalerPauseParamsWithContext(ctx context.Context) *UpdateServiceAutoscalerPauseParams { + var () + return &UpdateServiceAutoscalerPauseParams{ + + Context: ctx, + } +} + +// NewUpdateServiceAutoscalerPauseParamsWithHTTPClient creates a new UpdateServiceAutoscalerPauseParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateServiceAutoscalerPauseParamsWithHTTPClient(client *http.Client) *UpdateServiceAutoscalerPauseParams { + var () + return &UpdateServiceAutoscalerPauseParams{ + HTTPClient: client, + } +} + +/*UpdateServiceAutoscalerPauseParams contains all the parameters to send to the API endpoint +for the update service autoscaler pause operation typically these are written to a http.Request +*/ +type UpdateServiceAutoscalerPauseParams struct { + + /*JSONBody*/ + JSONBody UpdateServiceAutoscalerPauseBody + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update service autoscaler pause params +func (o *UpdateServiceAutoscalerPauseParams) WithTimeout(timeout time.Duration) *UpdateServiceAutoscalerPauseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update service autoscaler pause params +func (o *UpdateServiceAutoscalerPauseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update service autoscaler pause params +func (o *UpdateServiceAutoscalerPauseParams) WithContext(ctx context.Context) *UpdateServiceAutoscalerPauseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update service autoscaler pause params +func (o *UpdateServiceAutoscalerPauseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update service autoscaler pause params +func (o *UpdateServiceAutoscalerPauseParams) WithHTTPClient(client *http.Client) *UpdateServiceAutoscalerPauseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update service autoscaler pause params +func (o *UpdateServiceAutoscalerPauseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithJSONBody adds the jSONBody to the update service autoscaler pause params +func (o *UpdateServiceAutoscalerPauseParams) WithJSONBody(jSONBody UpdateServiceAutoscalerPauseBody) *UpdateServiceAutoscalerPauseParams { + o.SetJSONBody(jSONBody) + return o +} + +// SetJSONBody adds the jsonBody to the update service autoscaler pause params +func (o *UpdateServiceAutoscalerPauseParams) SetJSONBody(jSONBody UpdateServiceAutoscalerPauseBody) { + o.JSONBody = jSONBody +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateServiceAutoscalerPauseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if err := r.SetBodyParam(o.JSONBody); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/operations/update_service_autoscaler_pause_responses.go b/pkg/paastaapi/client/operations/update_service_autoscaler_pause_responses.go new file mode 100644 index 0000000..4496259 --- /dev/null +++ b/pkg/paastaapi/client/operations/update_service_autoscaler_pause_responses.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UpdateServiceAutoscalerPauseReader is a Reader for the UpdateServiceAutoscalerPause structure. +type UpdateServiceAutoscalerPauseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateServiceAutoscalerPauseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateServiceAutoscalerPauseOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewUpdateServiceAutoscalerPauseInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewUpdateServiceAutoscalerPauseOK creates a UpdateServiceAutoscalerPauseOK with default headers values +func NewUpdateServiceAutoscalerPauseOK() *UpdateServiceAutoscalerPauseOK { + return &UpdateServiceAutoscalerPauseOK{} +} + +/*UpdateServiceAutoscalerPauseOK handles this case with default header values. + +Service autoscaler successfully paused +*/ +type UpdateServiceAutoscalerPauseOK struct { +} + +func (o *UpdateServiceAutoscalerPauseOK) Error() string { + return fmt.Sprintf("[POST /service_autoscaler/pause][%d] updateServiceAutoscalerPauseOK ", 200) +} + +func (o *UpdateServiceAutoscalerPauseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateServiceAutoscalerPauseInternalServerError creates a UpdateServiceAutoscalerPauseInternalServerError with default headers values +func NewUpdateServiceAutoscalerPauseInternalServerError() *UpdateServiceAutoscalerPauseInternalServerError { + return &UpdateServiceAutoscalerPauseInternalServerError{} +} + +/*UpdateServiceAutoscalerPauseInternalServerError handles this case with default header values. + +Unable to talk to zookeeper +*/ +type UpdateServiceAutoscalerPauseInternalServerError struct { +} + +func (o *UpdateServiceAutoscalerPauseInternalServerError) Error() string { + return fmt.Sprintf("[POST /service_autoscaler/pause][%d] updateServiceAutoscalerPauseInternalServerError ", 500) +} + +func (o *UpdateServiceAutoscalerPauseInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +/*UpdateServiceAutoscalerPauseBody update service autoscaler pause body +swagger:model UpdateServiceAutoscalerPauseBody +*/ +type UpdateServiceAutoscalerPauseBody struct { + + // minutes + Minutes int64 `json:"minutes,omitempty"` +} + +// Validate validates this update service autoscaler pause body +func (o *UpdateServiceAutoscalerPauseBody) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *UpdateServiceAutoscalerPauseBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UpdateServiceAutoscalerPauseBody) UnmarshalBinary(b []byte) error { + var res UpdateServiceAutoscalerPauseBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/pkg/paastaapi/client/paasta_client.go b/pkg/paastaapi/client/paasta_client.go new file mode 100644 index 0000000..6ab044e --- /dev/null +++ b/pkg/paastaapi/client/paasta_client.go @@ -0,0 +1,132 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/client/autoscaler" + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/client/marathon_dashboard" + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/client/operations" + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/client/resources" + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/client/service" +) + +// Default paasta HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "localhost" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/v1" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http"} + +// NewHTTPClient creates a new paasta HTTP client. +func NewHTTPClient(formats strfmt.Registry) *Paasta { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new paasta HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Paasta { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new paasta client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Paasta { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(Paasta) + cli.Transport = transport + cli.Autoscaler = autoscaler.New(transport, formats) + cli.MarathonDashboard = marathon_dashboard.New(transport, formats) + cli.Operations = operations.New(transport, formats) + cli.Resources = resources.New(transport, formats) + cli.Service = service.New(transport, formats) + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// Paasta is a client for paasta +type Paasta struct { + Autoscaler autoscaler.ClientService + + MarathonDashboard marathon_dashboard.ClientService + + Operations operations.ClientService + + Resources resources.ClientService + + Service service.ClientService + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *Paasta) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + c.Autoscaler.SetTransport(transport) + c.MarathonDashboard.SetTransport(transport) + c.Operations.SetTransport(transport) + c.Resources.SetTransport(transport) + c.Service.SetTransport(transport) +} diff --git a/pkg/paastaapi/client/resources/resources_client.go b/pkg/paastaapi/client/resources/resources_client.go new file mode 100644 index 0000000..94639f3 --- /dev/null +++ b/pkg/paastaapi/client/resources/resources_client.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package resources + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new resources API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for resources API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientService is the interface for Client methods +type ClientService interface { + Resources(params *ResourcesParams) (*ResourcesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + Resources gets resources in the cluster +*/ +func (a *Client) Resources(params *ResourcesParams) (*ResourcesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewResourcesParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "resources", + Method: "GET", + PathPattern: "/resources/utilization", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ResourcesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ResourcesOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for resources: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/pkg/paastaapi/client/resources/resources_parameters.go b/pkg/paastaapi/client/resources/resources_parameters.go new file mode 100644 index 0000000..48a697f --- /dev/null +++ b/pkg/paastaapi/client/resources/resources_parameters.go @@ -0,0 +1,163 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package resources + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewResourcesParams creates a new ResourcesParams object +// with the default values initialized. +func NewResourcesParams() *ResourcesParams { + var () + return &ResourcesParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewResourcesParamsWithTimeout creates a new ResourcesParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewResourcesParamsWithTimeout(timeout time.Duration) *ResourcesParams { + var () + return &ResourcesParams{ + + timeout: timeout, + } +} + +// NewResourcesParamsWithContext creates a new ResourcesParams object +// with the default values initialized, and the ability to set a context for a request +func NewResourcesParamsWithContext(ctx context.Context) *ResourcesParams { + var () + return &ResourcesParams{ + + Context: ctx, + } +} + +// NewResourcesParamsWithHTTPClient creates a new ResourcesParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewResourcesParamsWithHTTPClient(client *http.Client) *ResourcesParams { + var () + return &ResourcesParams{ + HTTPClient: client, + } +} + +/*ResourcesParams contains all the parameters to send to the API endpoint +for the resources operation typically these are written to a http.Request +*/ +type ResourcesParams struct { + + /*Filter + List of slave filters in format 'filter=attr_name:value1,value2&filter=attr2:value3,value4'. Matches attr_name=(value1 OR value2) AND attr2=(value3 OR value4) + + */ + Filter []string + /*Groupings + comma separated list of keys to group by + + */ + Groupings []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the resources params +func (o *ResourcesParams) WithTimeout(timeout time.Duration) *ResourcesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the resources params +func (o *ResourcesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the resources params +func (o *ResourcesParams) WithContext(ctx context.Context) *ResourcesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the resources params +func (o *ResourcesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the resources params +func (o *ResourcesParams) WithHTTPClient(client *http.Client) *ResourcesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the resources params +func (o *ResourcesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilter adds the filter to the resources params +func (o *ResourcesParams) WithFilter(filter []string) *ResourcesParams { + o.SetFilter(filter) + return o +} + +// SetFilter adds the filter to the resources params +func (o *ResourcesParams) SetFilter(filter []string) { + o.Filter = filter +} + +// WithGroupings adds the groupings to the resources params +func (o *ResourcesParams) WithGroupings(groupings []string) *ResourcesParams { + o.SetGroupings(groupings) + return o +} + +// SetGroupings adds the groupings to the resources params +func (o *ResourcesParams) SetGroupings(groupings []string) { + o.Groupings = groupings +} + +// WriteToRequest writes these params to a swagger request +func (o *ResourcesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + valuesFilter := o.Filter + + joinedFilter := swag.JoinByFormat(valuesFilter, "multi") + // query array param filter + if err := r.SetQueryParam("filter", joinedFilter...); err != nil { + return err + } + + valuesGroupings := o.Groupings + + joinedGroupings := swag.JoinByFormat(valuesGroupings, "csv") + // query array param groupings + if err := r.SetQueryParam("groupings", joinedGroupings...); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/resources/resources_responses.go b/pkg/paastaapi/client/resources/resources_responses.go new file mode 100644 index 0000000..0d143be --- /dev/null +++ b/pkg/paastaapi/client/resources/resources_responses.go @@ -0,0 +1,94 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package resources + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/models" +) + +// ResourcesReader is a Reader for the Resources structure. +type ResourcesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ResourcesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewResourcesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewResourcesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewResourcesOK creates a ResourcesOK with default headers values +func NewResourcesOK() *ResourcesOK { + return &ResourcesOK{} +} + +/*ResourcesOK handles this case with default header values. + +Resources in the cluster, filtered and grouped by parameters +*/ +type ResourcesOK struct { + Payload models.Resource +} + +func (o *ResourcesOK) Error() string { + return fmt.Sprintf("[GET /resources/utilization][%d] resourcesOK %+v", 200, o.Payload) +} + +func (o *ResourcesOK) GetPayload() models.Resource { + return o.Payload +} + +func (o *ResourcesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewResourcesBadRequest creates a ResourcesBadRequest with default headers values +func NewResourcesBadRequest() *ResourcesBadRequest { + return &ResourcesBadRequest{} +} + +/*ResourcesBadRequest handles this case with default header values. + +Poorly formated query parameters +*/ +type ResourcesBadRequest struct { +} + +func (o *ResourcesBadRequest) Error() string { + return fmt.Sprintf("[GET /resources/utilization][%d] resourcesBadRequest ", 400) +} + +func (o *ResourcesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/client/service/delay_instance_parameters.go b/pkg/paastaapi/client/service/delay_instance_parameters.go new file mode 100644 index 0000000..3b90c31 --- /dev/null +++ b/pkg/paastaapi/client/service/delay_instance_parameters.go @@ -0,0 +1,156 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDelayInstanceParams creates a new DelayInstanceParams object +// with the default values initialized. +func NewDelayInstanceParams() *DelayInstanceParams { + var () + return &DelayInstanceParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDelayInstanceParamsWithTimeout creates a new DelayInstanceParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDelayInstanceParamsWithTimeout(timeout time.Duration) *DelayInstanceParams { + var () + return &DelayInstanceParams{ + + timeout: timeout, + } +} + +// NewDelayInstanceParamsWithContext creates a new DelayInstanceParams object +// with the default values initialized, and the ability to set a context for a request +func NewDelayInstanceParamsWithContext(ctx context.Context) *DelayInstanceParams { + var () + return &DelayInstanceParams{ + + Context: ctx, + } +} + +// NewDelayInstanceParamsWithHTTPClient creates a new DelayInstanceParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDelayInstanceParamsWithHTTPClient(client *http.Client) *DelayInstanceParams { + var () + return &DelayInstanceParams{ + HTTPClient: client, + } +} + +/*DelayInstanceParams contains all the parameters to send to the API endpoint +for the delay instance operation typically these are written to a http.Request +*/ +type DelayInstanceParams struct { + + /*Instance + Instance name + + */ + Instance string + /*Service + Service name + + */ + Service string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delay instance params +func (o *DelayInstanceParams) WithTimeout(timeout time.Duration) *DelayInstanceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delay instance params +func (o *DelayInstanceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delay instance params +func (o *DelayInstanceParams) WithContext(ctx context.Context) *DelayInstanceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delay instance params +func (o *DelayInstanceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delay instance params +func (o *DelayInstanceParams) WithHTTPClient(client *http.Client) *DelayInstanceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delay instance params +func (o *DelayInstanceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInstance adds the instance to the delay instance params +func (o *DelayInstanceParams) WithInstance(instance string) *DelayInstanceParams { + o.SetInstance(instance) + return o +} + +// SetInstance adds the instance to the delay instance params +func (o *DelayInstanceParams) SetInstance(instance string) { + o.Instance = instance +} + +// WithService adds the service to the delay instance params +func (o *DelayInstanceParams) WithService(service string) *DelayInstanceParams { + o.SetService(service) + return o +} + +// SetService adds the service to the delay instance params +func (o *DelayInstanceParams) SetService(service string) { + o.Service = service +} + +// WriteToRequest writes these params to a swagger request +func (o *DelayInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param instance + if err := r.SetPathParam("instance", o.Instance); err != nil { + return err + } + + // path param service + if err := r.SetPathParam("service", o.Service); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/service/delay_instance_responses.go b/pkg/paastaapi/client/service/delay_instance_responses.go new file mode 100644 index 0000000..188a8f4 --- /dev/null +++ b/pkg/paastaapi/client/service/delay_instance_responses.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/models" +) + +// DelayInstanceReader is a Reader for the DelayInstance structure. +type DelayInstanceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DelayInstanceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDelayInstanceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 204: + result := NewDelayInstanceNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewDelayInstanceNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDelayInstanceInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDelayInstanceOK creates a DelayInstanceOK with default headers values +func NewDelayInstanceOK() *DelayInstanceOK { + return &DelayInstanceOK{} +} + +/*DelayInstanceOK handles this case with default header values. + +The service is delayed for these possible reasons +*/ +type DelayInstanceOK struct { + Payload models.InstanceDelay +} + +func (o *DelayInstanceOK) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/delay][%d] delayInstanceOK %+v", 200, o.Payload) +} + +func (o *DelayInstanceOK) GetPayload() models.InstanceDelay { + return o.Payload +} + +func (o *DelayInstanceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDelayInstanceNoContent creates a DelayInstanceNoContent with default headers values +func NewDelayInstanceNoContent() *DelayInstanceNoContent { + return &DelayInstanceNoContent{} +} + +/*DelayInstanceNoContent handles this case with default header values. + +Could not find any reasons for a delay +*/ +type DelayInstanceNoContent struct { +} + +func (o *DelayInstanceNoContent) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/delay][%d] delayInstanceNoContent ", 204) +} + +func (o *DelayInstanceNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDelayInstanceNotFound creates a DelayInstanceNotFound with default headers values +func NewDelayInstanceNotFound() *DelayInstanceNotFound { + return &DelayInstanceNotFound{} +} + +/*DelayInstanceNotFound handles this case with default header values. + +Deployment key not found +*/ +type DelayInstanceNotFound struct { +} + +func (o *DelayInstanceNotFound) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/delay][%d] delayInstanceNotFound ", 404) +} + +func (o *DelayInstanceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDelayInstanceInternalServerError creates a DelayInstanceInternalServerError with default headers values +func NewDelayInstanceInternalServerError() *DelayInstanceInternalServerError { + return &DelayInstanceInternalServerError{} +} + +/*DelayInstanceInternalServerError handles this case with default header values. + +Instance failure +*/ +type DelayInstanceInternalServerError struct { +} + +func (o *DelayInstanceInternalServerError) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/delay][%d] delayInstanceInternalServerError ", 500) +} + +func (o *DelayInstanceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/client/service/instance_set_state_parameters.go b/pkg/paastaapi/client/service/instance_set_state_parameters.go new file mode 100644 index 0000000..3359d4e --- /dev/null +++ b/pkg/paastaapi/client/service/instance_set_state_parameters.go @@ -0,0 +1,177 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewInstanceSetStateParams creates a new InstanceSetStateParams object +// with the default values initialized. +func NewInstanceSetStateParams() *InstanceSetStateParams { + var () + return &InstanceSetStateParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewInstanceSetStateParamsWithTimeout creates a new InstanceSetStateParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewInstanceSetStateParamsWithTimeout(timeout time.Duration) *InstanceSetStateParams { + var () + return &InstanceSetStateParams{ + + timeout: timeout, + } +} + +// NewInstanceSetStateParamsWithContext creates a new InstanceSetStateParams object +// with the default values initialized, and the ability to set a context for a request +func NewInstanceSetStateParamsWithContext(ctx context.Context) *InstanceSetStateParams { + var () + return &InstanceSetStateParams{ + + Context: ctx, + } +} + +// NewInstanceSetStateParamsWithHTTPClient creates a new InstanceSetStateParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewInstanceSetStateParamsWithHTTPClient(client *http.Client) *InstanceSetStateParams { + var () + return &InstanceSetStateParams{ + HTTPClient: client, + } +} + +/*InstanceSetStateParams contains all the parameters to send to the API endpoint +for the instance set state operation typically these are written to a http.Request +*/ +type InstanceSetStateParams struct { + + /*DesiredState + Desired state + + */ + DesiredState string + /*Instance + Instance name + + */ + Instance string + /*Service + Service name + + */ + Service string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the instance set state params +func (o *InstanceSetStateParams) WithTimeout(timeout time.Duration) *InstanceSetStateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance set state params +func (o *InstanceSetStateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance set state params +func (o *InstanceSetStateParams) WithContext(ctx context.Context) *InstanceSetStateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance set state params +func (o *InstanceSetStateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance set state params +func (o *InstanceSetStateParams) WithHTTPClient(client *http.Client) *InstanceSetStateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance set state params +func (o *InstanceSetStateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDesiredState adds the desiredState to the instance set state params +func (o *InstanceSetStateParams) WithDesiredState(desiredState string) *InstanceSetStateParams { + o.SetDesiredState(desiredState) + return o +} + +// SetDesiredState adds the desiredState to the instance set state params +func (o *InstanceSetStateParams) SetDesiredState(desiredState string) { + o.DesiredState = desiredState +} + +// WithInstance adds the instance to the instance set state params +func (o *InstanceSetStateParams) WithInstance(instance string) *InstanceSetStateParams { + o.SetInstance(instance) + return o +} + +// SetInstance adds the instance to the instance set state params +func (o *InstanceSetStateParams) SetInstance(instance string) { + o.Instance = instance +} + +// WithService adds the service to the instance set state params +func (o *InstanceSetStateParams) WithService(service string) *InstanceSetStateParams { + o.SetService(service) + return o +} + +// SetService adds the service to the instance set state params +func (o *InstanceSetStateParams) SetService(service string) { + o.Service = service +} + +// WriteToRequest writes these params to a swagger request +func (o *InstanceSetStateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param desired_state + if err := r.SetPathParam("desired_state", o.DesiredState); err != nil { + return err + } + + // path param instance + if err := r.SetPathParam("instance", o.Instance); err != nil { + return err + } + + // path param service + if err := r.SetPathParam("service", o.Service); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/service/instance_set_state_responses.go b/pkg/paastaapi/client/service/instance_set_state_responses.go new file mode 100644 index 0000000..d5a8496 --- /dev/null +++ b/pkg/paastaapi/client/service/instance_set_state_responses.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// InstanceSetStateReader is a Reader for the InstanceSetState structure. +type InstanceSetStateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstanceSetStateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstanceSetStateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewInstanceSetStateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstanceSetStateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInstanceSetStateOK creates a InstanceSetStateOK with default headers values +func NewInstanceSetStateOK() *InstanceSetStateOK { + return &InstanceSetStateOK{} +} + +/*InstanceSetStateOK handles this case with default header values. + +Result of instance state change +*/ +type InstanceSetStateOK struct { +} + +func (o *InstanceSetStateOK) Error() string { + return fmt.Sprintf("[POST /services/{service}/{instance}/state/{desired_state}][%d] instanceSetStateOK ", 200) +} + +func (o *InstanceSetStateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceSetStateNotFound creates a InstanceSetStateNotFound with default headers values +func NewInstanceSetStateNotFound() *InstanceSetStateNotFound { + return &InstanceSetStateNotFound{} +} + +/*InstanceSetStateNotFound handles this case with default header values. + +Deployment key not found +*/ +type InstanceSetStateNotFound struct { +} + +func (o *InstanceSetStateNotFound) Error() string { + return fmt.Sprintf("[POST /services/{service}/{instance}/state/{desired_state}][%d] instanceSetStateNotFound ", 404) +} + +func (o *InstanceSetStateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceSetStateInternalServerError creates a InstanceSetStateInternalServerError with default headers values +func NewInstanceSetStateInternalServerError() *InstanceSetStateInternalServerError { + return &InstanceSetStateInternalServerError{} +} + +/*InstanceSetStateInternalServerError handles this case with default header values. + +Instance failure +*/ +type InstanceSetStateInternalServerError struct { +} + +func (o *InstanceSetStateInternalServerError) Error() string { + return fmt.Sprintf("[POST /services/{service}/{instance}/state/{desired_state}][%d] instanceSetStateInternalServerError ", 500) +} + +func (o *InstanceSetStateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/client/service/list_instances_parameters.go b/pkg/paastaapi/client/service/list_instances_parameters.go new file mode 100644 index 0000000..e36e755 --- /dev/null +++ b/pkg/paastaapi/client/service/list_instances_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListInstancesParams creates a new ListInstancesParams object +// with the default values initialized. +func NewListInstancesParams() *ListInstancesParams { + var () + return &ListInstancesParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewListInstancesParamsWithTimeout creates a new ListInstancesParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewListInstancesParamsWithTimeout(timeout time.Duration) *ListInstancesParams { + var () + return &ListInstancesParams{ + + timeout: timeout, + } +} + +// NewListInstancesParamsWithContext creates a new ListInstancesParams object +// with the default values initialized, and the ability to set a context for a request +func NewListInstancesParamsWithContext(ctx context.Context) *ListInstancesParams { + var () + return &ListInstancesParams{ + + Context: ctx, + } +} + +// NewListInstancesParamsWithHTTPClient creates a new ListInstancesParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewListInstancesParamsWithHTTPClient(client *http.Client) *ListInstancesParams { + var () + return &ListInstancesParams{ + HTTPClient: client, + } +} + +/*ListInstancesParams contains all the parameters to send to the API endpoint +for the list instances operation typically these are written to a http.Request +*/ +type ListInstancesParams struct { + + /*Service + Service name + + */ + Service string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the list instances params +func (o *ListInstancesParams) WithTimeout(timeout time.Duration) *ListInstancesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list instances params +func (o *ListInstancesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list instances params +func (o *ListInstancesParams) WithContext(ctx context.Context) *ListInstancesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list instances params +func (o *ListInstancesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list instances params +func (o *ListInstancesParams) WithHTTPClient(client *http.Client) *ListInstancesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list instances params +func (o *ListInstancesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithService adds the service to the list instances params +func (o *ListInstancesParams) WithService(service string) *ListInstancesParams { + o.SetService(service) + return o +} + +// SetService adds the service to the list instances params +func (o *ListInstancesParams) SetService(service string) { + o.Service = service +} + +// WriteToRequest writes these params to a swagger request +func (o *ListInstancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param service + if err := r.SetPathParam("service", o.Service); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/service/list_instances_responses.go b/pkg/paastaapi/client/service/list_instances_responses.go new file mode 100644 index 0000000..0ca8f18 --- /dev/null +++ b/pkg/paastaapi/client/service/list_instances_responses.go @@ -0,0 +1,100 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ListInstancesReader is a Reader for the ListInstances structure. +type ListInstancesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListInstancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListInstancesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewListInstancesOK creates a ListInstancesOK with default headers values +func NewListInstancesOK() *ListInstancesOK { + return &ListInstancesOK{} +} + +/*ListInstancesOK handles this case with default header values. + +Instances of a service +*/ +type ListInstancesOK struct { + Payload *ListInstancesOKBody +} + +func (o *ListInstancesOK) Error() string { + return fmt.Sprintf("[GET /services/{service}][%d] listInstancesOK %+v", 200, o.Payload) +} + +func (o *ListInstancesOK) GetPayload() *ListInstancesOKBody { + return o.Payload +} + +func (o *ListInstancesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(ListInstancesOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/*ListInstancesOKBody list instances o k body +swagger:model ListInstancesOKBody +*/ +type ListInstancesOKBody struct { + + // instances + Instances []string `json:"instances"` +} + +// Validate validates this list instances o k body +func (o *ListInstancesOKBody) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ListInstancesOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ListInstancesOKBody) UnmarshalBinary(b []byte) error { + var res ListInstancesOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/pkg/paastaapi/client/service/list_services_for_cluster_parameters.go b/pkg/paastaapi/client/service/list_services_for_cluster_parameters.go new file mode 100644 index 0000000..d2c6416 --- /dev/null +++ b/pkg/paastaapi/client/service/list_services_for_cluster_parameters.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListServicesForClusterParams creates a new ListServicesForClusterParams object +// with the default values initialized. +func NewListServicesForClusterParams() *ListServicesForClusterParams { + + return &ListServicesForClusterParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewListServicesForClusterParamsWithTimeout creates a new ListServicesForClusterParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewListServicesForClusterParamsWithTimeout(timeout time.Duration) *ListServicesForClusterParams { + + return &ListServicesForClusterParams{ + + timeout: timeout, + } +} + +// NewListServicesForClusterParamsWithContext creates a new ListServicesForClusterParams object +// with the default values initialized, and the ability to set a context for a request +func NewListServicesForClusterParamsWithContext(ctx context.Context) *ListServicesForClusterParams { + + return &ListServicesForClusterParams{ + + Context: ctx, + } +} + +// NewListServicesForClusterParamsWithHTTPClient creates a new ListServicesForClusterParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewListServicesForClusterParamsWithHTTPClient(client *http.Client) *ListServicesForClusterParams { + + return &ListServicesForClusterParams{ + HTTPClient: client, + } +} + +/*ListServicesForClusterParams contains all the parameters to send to the API endpoint +for the list services for cluster operation typically these are written to a http.Request +*/ +type ListServicesForClusterParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the list services for cluster params +func (o *ListServicesForClusterParams) WithTimeout(timeout time.Duration) *ListServicesForClusterParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list services for cluster params +func (o *ListServicesForClusterParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list services for cluster params +func (o *ListServicesForClusterParams) WithContext(ctx context.Context) *ListServicesForClusterParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list services for cluster params +func (o *ListServicesForClusterParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list services for cluster params +func (o *ListServicesForClusterParams) WithHTTPClient(client *http.Client) *ListServicesForClusterParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list services for cluster params +func (o *ListServicesForClusterParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListServicesForClusterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/service/list_services_for_cluster_responses.go b/pkg/paastaapi/client/service/list_services_for_cluster_responses.go new file mode 100644 index 0000000..d17c09b --- /dev/null +++ b/pkg/paastaapi/client/service/list_services_for_cluster_responses.go @@ -0,0 +1,100 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ListServicesForClusterReader is a Reader for the ListServicesForCluster structure. +type ListServicesForClusterReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListServicesForClusterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListServicesForClusterOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewListServicesForClusterOK creates a ListServicesForClusterOK with default headers values +func NewListServicesForClusterOK() *ListServicesForClusterOK { + return &ListServicesForClusterOK{} +} + +/*ListServicesForClusterOK handles this case with default header values. + +Services and their instances on the current cluster +*/ +type ListServicesForClusterOK struct { + Payload *ListServicesForClusterOKBody +} + +func (o *ListServicesForClusterOK) Error() string { + return fmt.Sprintf("[GET /services][%d] listServicesForClusterOK %+v", 200, o.Payload) +} + +func (o *ListServicesForClusterOK) GetPayload() *ListServicesForClusterOKBody { + return o.Payload +} + +func (o *ListServicesForClusterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(ListServicesForClusterOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/*ListServicesForClusterOKBody list services for cluster o k body +swagger:model ListServicesForClusterOKBody +*/ +type ListServicesForClusterOKBody struct { + + // services + Services [][]interface{} `json:"services"` +} + +// Validate validates this list services for cluster o k body +func (o *ListServicesForClusterOKBody) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ListServicesForClusterOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ListServicesForClusterOKBody) UnmarshalBinary(b []byte) error { + var res ListServicesForClusterOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/pkg/paastaapi/client/service/service_client.go b/pkg/paastaapi/client/service/service_client.go new file mode 100644 index 0000000..0edf5a3 --- /dev/null +++ b/pkg/paastaapi/client/service/service_client.go @@ -0,0 +1,289 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientService is the interface for Client methods +type ClientService interface { + DelayInstance(params *DelayInstanceParams) (*DelayInstanceOK, *DelayInstanceNoContent, error) + + InstanceSetState(params *InstanceSetStateParams) (*InstanceSetStateOK, error) + + ListInstances(params *ListInstancesParams) (*ListInstancesOK, error) + + ListServicesForCluster(params *ListServicesForClusterParams) (*ListServicesForClusterOK, error) + + StatusInstance(params *StatusInstanceParams) (*StatusInstanceOK, error) + + TaskInstance(params *TaskInstanceParams) (*TaskInstanceOK, error) + + TasksInstance(params *TasksInstanceParams) (*TasksInstanceOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + DelayInstance gets the possible reasons for a deployment delay for a marathon service instance +*/ +func (a *Client) DelayInstance(params *DelayInstanceParams) (*DelayInstanceOK, *DelayInstanceNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDelayInstanceParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "delay_instance", + Method: "GET", + PathPattern: "/services/{service}/{instance}/delay", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DelayInstanceReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *DelayInstanceOK: + return value, nil, nil + case *DelayInstanceNoContent: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for service: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + InstanceSetState changes state of service name instance name +*/ +func (a *Client) InstanceSetState(params *InstanceSetStateParams) (*InstanceSetStateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstanceSetStateParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "instance_set_state", + Method: "POST", + PathPattern: "/services/{service}/{instance}/state/{desired_state}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &InstanceSetStateReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*InstanceSetStateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for instance_set_state: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ListInstances lists instances of service name +*/ +func (a *Client) ListInstances(params *ListInstancesParams) (*ListInstancesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListInstancesParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "list_instances", + Method: "GET", + PathPattern: "/services/{service}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListInstancesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ListInstancesOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for list_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ListServicesForCluster lists service names and service instance names on the current cluster +*/ +func (a *Client) ListServicesForCluster(params *ListServicesForClusterParams) (*ListServicesForClusterOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListServicesForClusterParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "list_services_for_cluster", + Method: "GET", + PathPattern: "/services", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListServicesForClusterReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ListServicesForClusterOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for list_services_for_cluster: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusInstance gets status of service name instance name +*/ +func (a *Client) StatusInstance(params *StatusInstanceParams) (*StatusInstanceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusInstanceParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "status_instance", + Method: "GET", + PathPattern: "/services/{service}/{instance}/status", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &StatusInstanceReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*StatusInstanceOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for status_instance: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + TaskInstance gets mesos task of service name instance name by task id +*/ +func (a *Client) TaskInstance(params *TaskInstanceParams) (*TaskInstanceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTaskInstanceParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "task_instance", + Method: "GET", + PathPattern: "/services/{service}/{instance}/tasks/{task_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &TaskInstanceReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*TaskInstanceOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for task_instance: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + TasksInstance gets mesos tasks of service name instance name +*/ +func (a *Client) TasksInstance(params *TasksInstanceParams) (*TasksInstanceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTasksInstanceParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "tasks_instance", + Method: "GET", + PathPattern: "/services/{service}/{instance}/tasks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"}, + Schemes: []string{"http"}, + Params: params, + Reader: &TasksInstanceReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*TasksInstanceOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for tasks_instance: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/pkg/paastaapi/client/service/status_instance_parameters.go b/pkg/paastaapi/client/service/status_instance_parameters.go new file mode 100644 index 0000000..c20547d --- /dev/null +++ b/pkg/paastaapi/client/service/status_instance_parameters.go @@ -0,0 +1,285 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewStatusInstanceParams creates a new StatusInstanceParams object +// with the default values initialized. +func NewStatusInstanceParams() *StatusInstanceParams { + var () + return &StatusInstanceParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewStatusInstanceParamsWithTimeout creates a new StatusInstanceParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewStatusInstanceParamsWithTimeout(timeout time.Duration) *StatusInstanceParams { + var () + return &StatusInstanceParams{ + + timeout: timeout, + } +} + +// NewStatusInstanceParamsWithContext creates a new StatusInstanceParams object +// with the default values initialized, and the ability to set a context for a request +func NewStatusInstanceParamsWithContext(ctx context.Context) *StatusInstanceParams { + var () + return &StatusInstanceParams{ + + Context: ctx, + } +} + +// NewStatusInstanceParamsWithHTTPClient creates a new StatusInstanceParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewStatusInstanceParamsWithHTTPClient(client *http.Client) *StatusInstanceParams { + var () + return &StatusInstanceParams{ + HTTPClient: client, + } +} + +/*StatusInstanceParams contains all the parameters to send to the API endpoint +for the status instance operation typically these are written to a http.Request +*/ +type StatusInstanceParams struct { + + /*IncludeEnvoy + Include Envoy information + + */ + IncludeEnvoy *bool + /*IncludeMesos + Include Mesos information + + */ + IncludeMesos *bool + /*IncludeSmartstack + Include Smartstack information + + */ + IncludeSmartstack *bool + /*Instance + Instance name + + */ + Instance string + /*Service + Service name + + */ + Service string + /*Verbose + Include verbose status information + + */ + Verbose *int32 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the status instance params +func (o *StatusInstanceParams) WithTimeout(timeout time.Duration) *StatusInstanceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status instance params +func (o *StatusInstanceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status instance params +func (o *StatusInstanceParams) WithContext(ctx context.Context) *StatusInstanceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status instance params +func (o *StatusInstanceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status instance params +func (o *StatusInstanceParams) WithHTTPClient(client *http.Client) *StatusInstanceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status instance params +func (o *StatusInstanceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithIncludeEnvoy adds the includeEnvoy to the status instance params +func (o *StatusInstanceParams) WithIncludeEnvoy(includeEnvoy *bool) *StatusInstanceParams { + o.SetIncludeEnvoy(includeEnvoy) + return o +} + +// SetIncludeEnvoy adds the includeEnvoy to the status instance params +func (o *StatusInstanceParams) SetIncludeEnvoy(includeEnvoy *bool) { + o.IncludeEnvoy = includeEnvoy +} + +// WithIncludeMesos adds the includeMesos to the status instance params +func (o *StatusInstanceParams) WithIncludeMesos(includeMesos *bool) *StatusInstanceParams { + o.SetIncludeMesos(includeMesos) + return o +} + +// SetIncludeMesos adds the includeMesos to the status instance params +func (o *StatusInstanceParams) SetIncludeMesos(includeMesos *bool) { + o.IncludeMesos = includeMesos +} + +// WithIncludeSmartstack adds the includeSmartstack to the status instance params +func (o *StatusInstanceParams) WithIncludeSmartstack(includeSmartstack *bool) *StatusInstanceParams { + o.SetIncludeSmartstack(includeSmartstack) + return o +} + +// SetIncludeSmartstack adds the includeSmartstack to the status instance params +func (o *StatusInstanceParams) SetIncludeSmartstack(includeSmartstack *bool) { + o.IncludeSmartstack = includeSmartstack +} + +// WithInstance adds the instance to the status instance params +func (o *StatusInstanceParams) WithInstance(instance string) *StatusInstanceParams { + o.SetInstance(instance) + return o +} + +// SetInstance adds the instance to the status instance params +func (o *StatusInstanceParams) SetInstance(instance string) { + o.Instance = instance +} + +// WithService adds the service to the status instance params +func (o *StatusInstanceParams) WithService(service string) *StatusInstanceParams { + o.SetService(service) + return o +} + +// SetService adds the service to the status instance params +func (o *StatusInstanceParams) SetService(service string) { + o.Service = service +} + +// WithVerbose adds the verbose to the status instance params +func (o *StatusInstanceParams) WithVerbose(verbose *int32) *StatusInstanceParams { + o.SetVerbose(verbose) + return o +} + +// SetVerbose adds the verbose to the status instance params +func (o *StatusInstanceParams) SetVerbose(verbose *int32) { + o.Verbose = verbose +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.IncludeEnvoy != nil { + + // query param include_envoy + var qrIncludeEnvoy bool + if o.IncludeEnvoy != nil { + qrIncludeEnvoy = *o.IncludeEnvoy + } + qIncludeEnvoy := swag.FormatBool(qrIncludeEnvoy) + if qIncludeEnvoy != "" { + if err := r.SetQueryParam("include_envoy", qIncludeEnvoy); err != nil { + return err + } + } + + } + + if o.IncludeMesos != nil { + + // query param include_mesos + var qrIncludeMesos bool + if o.IncludeMesos != nil { + qrIncludeMesos = *o.IncludeMesos + } + qIncludeMesos := swag.FormatBool(qrIncludeMesos) + if qIncludeMesos != "" { + if err := r.SetQueryParam("include_mesos", qIncludeMesos); err != nil { + return err + } + } + + } + + if o.IncludeSmartstack != nil { + + // query param include_smartstack + var qrIncludeSmartstack bool + if o.IncludeSmartstack != nil { + qrIncludeSmartstack = *o.IncludeSmartstack + } + qIncludeSmartstack := swag.FormatBool(qrIncludeSmartstack) + if qIncludeSmartstack != "" { + if err := r.SetQueryParam("include_smartstack", qIncludeSmartstack); err != nil { + return err + } + } + + } + + // path param instance + if err := r.SetPathParam("instance", o.Instance); err != nil { + return err + } + + // path param service + if err := r.SetPathParam("service", o.Service); err != nil { + return err + } + + if o.Verbose != nil { + + // query param verbose + var qrVerbose int32 + if o.Verbose != nil { + qrVerbose = *o.Verbose + } + qVerbose := swag.FormatInt32(qrVerbose) + if qVerbose != "" { + if err := r.SetQueryParam("verbose", qVerbose); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/service/status_instance_responses.go b/pkg/paastaapi/client/service/status_instance_responses.go new file mode 100644 index 0000000..22d8f6c --- /dev/null +++ b/pkg/paastaapi/client/service/status_instance_responses.go @@ -0,0 +1,123 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/models" +) + +// StatusInstanceReader is a Reader for the StatusInstance structure. +type StatusInstanceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusInstanceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusInstanceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewStatusInstanceNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusInstanceInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewStatusInstanceOK creates a StatusInstanceOK with default headers values +func NewStatusInstanceOK() *StatusInstanceOK { + return &StatusInstanceOK{} +} + +/*StatusInstanceOK handles this case with default header values. + +Detailed status of an instance +*/ +type StatusInstanceOK struct { + Payload *models.InstanceStatus +} + +func (o *StatusInstanceOK) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/status][%d] statusInstanceOK %+v", 200, o.Payload) +} + +func (o *StatusInstanceOK) GetPayload() *models.InstanceStatus { + return o.Payload +} + +func (o *StatusInstanceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusInstanceNotFound creates a StatusInstanceNotFound with default headers values +func NewStatusInstanceNotFound() *StatusInstanceNotFound { + return &StatusInstanceNotFound{} +} + +/*StatusInstanceNotFound handles this case with default header values. + +Deployment key not found +*/ +type StatusInstanceNotFound struct { +} + +func (o *StatusInstanceNotFound) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/status][%d] statusInstanceNotFound ", 404) +} + +func (o *StatusInstanceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusInstanceInternalServerError creates a StatusInstanceInternalServerError with default headers values +func NewStatusInstanceInternalServerError() *StatusInstanceInternalServerError { + return &StatusInstanceInternalServerError{} +} + +/*StatusInstanceInternalServerError handles this case with default header values. + +Instance failure +*/ +type StatusInstanceInternalServerError struct { +} + +func (o *StatusInstanceInternalServerError) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/status][%d] statusInstanceInternalServerError ", 500) +} + +func (o *StatusInstanceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/client/service/task_instance_parameters.go b/pkg/paastaapi/client/service/task_instance_parameters.go new file mode 100644 index 0000000..9cada39 --- /dev/null +++ b/pkg/paastaapi/client/service/task_instance_parameters.go @@ -0,0 +1,210 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewTaskInstanceParams creates a new TaskInstanceParams object +// with the default values initialized. +func NewTaskInstanceParams() *TaskInstanceParams { + var () + return &TaskInstanceParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewTaskInstanceParamsWithTimeout creates a new TaskInstanceParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewTaskInstanceParamsWithTimeout(timeout time.Duration) *TaskInstanceParams { + var () + return &TaskInstanceParams{ + + timeout: timeout, + } +} + +// NewTaskInstanceParamsWithContext creates a new TaskInstanceParams object +// with the default values initialized, and the ability to set a context for a request +func NewTaskInstanceParamsWithContext(ctx context.Context) *TaskInstanceParams { + var () + return &TaskInstanceParams{ + + Context: ctx, + } +} + +// NewTaskInstanceParamsWithHTTPClient creates a new TaskInstanceParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewTaskInstanceParamsWithHTTPClient(client *http.Client) *TaskInstanceParams { + var () + return &TaskInstanceParams{ + HTTPClient: client, + } +} + +/*TaskInstanceParams contains all the parameters to send to the API endpoint +for the task instance operation typically these are written to a http.Request +*/ +type TaskInstanceParams struct { + + /*Instance + Instance name + + */ + Instance string + /*Service + Service name + + */ + Service string + /*TaskID + mesos task id + + */ + TaskID string + /*Verbose + Return slave and executor for task + + */ + Verbose *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the task instance params +func (o *TaskInstanceParams) WithTimeout(timeout time.Duration) *TaskInstanceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the task instance params +func (o *TaskInstanceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the task instance params +func (o *TaskInstanceParams) WithContext(ctx context.Context) *TaskInstanceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the task instance params +func (o *TaskInstanceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the task instance params +func (o *TaskInstanceParams) WithHTTPClient(client *http.Client) *TaskInstanceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the task instance params +func (o *TaskInstanceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInstance adds the instance to the task instance params +func (o *TaskInstanceParams) WithInstance(instance string) *TaskInstanceParams { + o.SetInstance(instance) + return o +} + +// SetInstance adds the instance to the task instance params +func (o *TaskInstanceParams) SetInstance(instance string) { + o.Instance = instance +} + +// WithService adds the service to the task instance params +func (o *TaskInstanceParams) WithService(service string) *TaskInstanceParams { + o.SetService(service) + return o +} + +// SetService adds the service to the task instance params +func (o *TaskInstanceParams) SetService(service string) { + o.Service = service +} + +// WithTaskID adds the taskID to the task instance params +func (o *TaskInstanceParams) WithTaskID(taskID string) *TaskInstanceParams { + o.SetTaskID(taskID) + return o +} + +// SetTaskID adds the taskId to the task instance params +func (o *TaskInstanceParams) SetTaskID(taskID string) { + o.TaskID = taskID +} + +// WithVerbose adds the verbose to the task instance params +func (o *TaskInstanceParams) WithVerbose(verbose *bool) *TaskInstanceParams { + o.SetVerbose(verbose) + return o +} + +// SetVerbose adds the verbose to the task instance params +func (o *TaskInstanceParams) SetVerbose(verbose *bool) { + o.Verbose = verbose +} + +// WriteToRequest writes these params to a swagger request +func (o *TaskInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param instance + if err := r.SetPathParam("instance", o.Instance); err != nil { + return err + } + + // path param service + if err := r.SetPathParam("service", o.Service); err != nil { + return err + } + + // path param task_id + if err := r.SetPathParam("task_id", o.TaskID); err != nil { + return err + } + + if o.Verbose != nil { + + // query param verbose + var qrVerbose bool + if o.Verbose != nil { + qrVerbose = *o.Verbose + } + qVerbose := swag.FormatBool(qrVerbose) + if qVerbose != "" { + if err := r.SetQueryParam("verbose", qVerbose); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/service/task_instance_responses.go b/pkg/paastaapi/client/service/task_instance_responses.go new file mode 100644 index 0000000..b8cc88a --- /dev/null +++ b/pkg/paastaapi/client/service/task_instance_responses.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/models" +) + +// TaskInstanceReader is a Reader for the TaskInstance structure. +type TaskInstanceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TaskInstanceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTaskInstanceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewTaskInstanceBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewTaskInstanceNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewTaskInstanceInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewTaskInstanceOK creates a TaskInstanceOK with default headers values +func NewTaskInstanceOK() *TaskInstanceOK { + return &TaskInstanceOK{} +} + +/*TaskInstanceOK handles this case with default header values. + +Task associated with an instance with specified ID +*/ +type TaskInstanceOK struct { + Payload models.InstanceTask +} + +func (o *TaskInstanceOK) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/tasks/{task_id}][%d] taskInstanceOK %+v", 200, o.Payload) +} + +func (o *TaskInstanceOK) GetPayload() models.InstanceTask { + return o.Payload +} + +func (o *TaskInstanceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTaskInstanceBadRequest creates a TaskInstanceBadRequest with default headers values +func NewTaskInstanceBadRequest() *TaskInstanceBadRequest { + return &TaskInstanceBadRequest{} +} + +/*TaskInstanceBadRequest handles this case with default header values. + +Bad request +*/ +type TaskInstanceBadRequest struct { +} + +func (o *TaskInstanceBadRequest) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/tasks/{task_id}][%d] taskInstanceBadRequest ", 400) +} + +func (o *TaskInstanceBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTaskInstanceNotFound creates a TaskInstanceNotFound with default headers values +func NewTaskInstanceNotFound() *TaskInstanceNotFound { + return &TaskInstanceNotFound{} +} + +/*TaskInstanceNotFound handles this case with default header values. + +Task with ID not found +*/ +type TaskInstanceNotFound struct { +} + +func (o *TaskInstanceNotFound) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/tasks/{task_id}][%d] taskInstanceNotFound ", 404) +} + +func (o *TaskInstanceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTaskInstanceInternalServerError creates a TaskInstanceInternalServerError with default headers values +func NewTaskInstanceInternalServerError() *TaskInstanceInternalServerError { + return &TaskInstanceInternalServerError{} +} + +/*TaskInstanceInternalServerError handles this case with default header values. + +Instance failure +*/ +type TaskInstanceInternalServerError struct { +} + +func (o *TaskInstanceInternalServerError) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/tasks/{task_id}][%d] taskInstanceInternalServerError ", 500) +} + +func (o *TaskInstanceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/client/service/tasks_instance_parameters.go b/pkg/paastaapi/client/service/tasks_instance_parameters.go new file mode 100644 index 0000000..fbb920f --- /dev/null +++ b/pkg/paastaapi/client/service/tasks_instance_parameters.go @@ -0,0 +1,221 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewTasksInstanceParams creates a new TasksInstanceParams object +// with the default values initialized. +func NewTasksInstanceParams() *TasksInstanceParams { + var () + return &TasksInstanceParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewTasksInstanceParamsWithTimeout creates a new TasksInstanceParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewTasksInstanceParamsWithTimeout(timeout time.Duration) *TasksInstanceParams { + var () + return &TasksInstanceParams{ + + timeout: timeout, + } +} + +// NewTasksInstanceParamsWithContext creates a new TasksInstanceParams object +// with the default values initialized, and the ability to set a context for a request +func NewTasksInstanceParamsWithContext(ctx context.Context) *TasksInstanceParams { + var () + return &TasksInstanceParams{ + + Context: ctx, + } +} + +// NewTasksInstanceParamsWithHTTPClient creates a new TasksInstanceParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewTasksInstanceParamsWithHTTPClient(client *http.Client) *TasksInstanceParams { + var () + return &TasksInstanceParams{ + HTTPClient: client, + } +} + +/*TasksInstanceParams contains all the parameters to send to the API endpoint +for the tasks instance operation typically these are written to a http.Request +*/ +type TasksInstanceParams struct { + + /*Instance + Instance name + + */ + Instance string + /*Service + Service name + + */ + Service string + /*SlaveHostname + slave hostname to filter tasks by + + */ + SlaveHostname *string + /*Verbose + Return slave and executor for task + + */ + Verbose *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the tasks instance params +func (o *TasksInstanceParams) WithTimeout(timeout time.Duration) *TasksInstanceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tasks instance params +func (o *TasksInstanceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tasks instance params +func (o *TasksInstanceParams) WithContext(ctx context.Context) *TasksInstanceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tasks instance params +func (o *TasksInstanceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tasks instance params +func (o *TasksInstanceParams) WithHTTPClient(client *http.Client) *TasksInstanceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tasks instance params +func (o *TasksInstanceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInstance adds the instance to the tasks instance params +func (o *TasksInstanceParams) WithInstance(instance string) *TasksInstanceParams { + o.SetInstance(instance) + return o +} + +// SetInstance adds the instance to the tasks instance params +func (o *TasksInstanceParams) SetInstance(instance string) { + o.Instance = instance +} + +// WithService adds the service to the tasks instance params +func (o *TasksInstanceParams) WithService(service string) *TasksInstanceParams { + o.SetService(service) + return o +} + +// SetService adds the service to the tasks instance params +func (o *TasksInstanceParams) SetService(service string) { + o.Service = service +} + +// WithSlaveHostname adds the slaveHostname to the tasks instance params +func (o *TasksInstanceParams) WithSlaveHostname(slaveHostname *string) *TasksInstanceParams { + o.SetSlaveHostname(slaveHostname) + return o +} + +// SetSlaveHostname adds the slaveHostname to the tasks instance params +func (o *TasksInstanceParams) SetSlaveHostname(slaveHostname *string) { + o.SlaveHostname = slaveHostname +} + +// WithVerbose adds the verbose to the tasks instance params +func (o *TasksInstanceParams) WithVerbose(verbose *bool) *TasksInstanceParams { + o.SetVerbose(verbose) + return o +} + +// SetVerbose adds the verbose to the tasks instance params +func (o *TasksInstanceParams) SetVerbose(verbose *bool) { + o.Verbose = verbose +} + +// WriteToRequest writes these params to a swagger request +func (o *TasksInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param instance + if err := r.SetPathParam("instance", o.Instance); err != nil { + return err + } + + // path param service + if err := r.SetPathParam("service", o.Service); err != nil { + return err + } + + if o.SlaveHostname != nil { + + // query param slave_hostname + var qrSlaveHostname string + if o.SlaveHostname != nil { + qrSlaveHostname = *o.SlaveHostname + } + qSlaveHostname := qrSlaveHostname + if qSlaveHostname != "" { + if err := r.SetQueryParam("slave_hostname", qSlaveHostname); err != nil { + return err + } + } + + } + + if o.Verbose != nil { + + // query param verbose + var qrVerbose bool + if o.Verbose != nil { + qrVerbose = *o.Verbose + } + qVerbose := swag.FormatBool(qrVerbose) + if qVerbose != "" { + if err := r.SetQueryParam("verbose", qVerbose); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/client/service/tasks_instance_responses.go b/pkg/paastaapi/client/service/tasks_instance_responses.go new file mode 100644 index 0000000..5b9bd95 --- /dev/null +++ b/pkg/paastaapi/client/service/tasks_instance_responses.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/Yelp/paasta-tools-go/pkg/paastaapi/models" +) + +// TasksInstanceReader is a Reader for the TasksInstance structure. +type TasksInstanceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TasksInstanceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTasksInstanceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewTasksInstanceBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewTasksInstanceNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewTasksInstanceInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewTasksInstanceOK creates a TasksInstanceOK with default headers values +func NewTasksInstanceOK() *TasksInstanceOK { + return &TasksInstanceOK{} +} + +/*TasksInstanceOK handles this case with default header values. + +List of tasks associated with an instance +*/ +type TasksInstanceOK struct { + Payload models.InstanceTasks +} + +func (o *TasksInstanceOK) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/tasks][%d] tasksInstanceOK %+v", 200, o.Payload) +} + +func (o *TasksInstanceOK) GetPayload() models.InstanceTasks { + return o.Payload +} + +func (o *TasksInstanceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTasksInstanceBadRequest creates a TasksInstanceBadRequest with default headers values +func NewTasksInstanceBadRequest() *TasksInstanceBadRequest { + return &TasksInstanceBadRequest{} +} + +/*TasksInstanceBadRequest handles this case with default header values. + +Bad request +*/ +type TasksInstanceBadRequest struct { +} + +func (o *TasksInstanceBadRequest) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/tasks][%d] tasksInstanceBadRequest ", 400) +} + +func (o *TasksInstanceBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTasksInstanceNotFound creates a TasksInstanceNotFound with default headers values +func NewTasksInstanceNotFound() *TasksInstanceNotFound { + return &TasksInstanceNotFound{} +} + +/*TasksInstanceNotFound handles this case with default header values. + +Deployment key not found +*/ +type TasksInstanceNotFound struct { +} + +func (o *TasksInstanceNotFound) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/tasks][%d] tasksInstanceNotFound ", 404) +} + +func (o *TasksInstanceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTasksInstanceInternalServerError creates a TasksInstanceInternalServerError with default headers values +func NewTasksInstanceInternalServerError() *TasksInstanceInternalServerError { + return &TasksInstanceInternalServerError{} +} + +/*TasksInstanceInternalServerError handles this case with default header values. + +Instance failure +*/ +type TasksInstanceInternalServerError struct { +} + +func (o *TasksInstanceInternalServerError) Error() string { + return fmt.Sprintf("[GET /services/{service}/{instance}/tasks][%d] tasksInstanceInternalServerError ", 500) +} + +func (o *TasksInstanceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/paastaapi/models/adhoc_launch_history.go b/pkg/paastaapi/models/adhoc_launch_history.go new file mode 100644 index 0000000..eb964a3 --- /dev/null +++ b/pkg/paastaapi/models/adhoc_launch_history.go @@ -0,0 +1,49 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdhocLaunchHistory A single run +// +// swagger:model AdhocLaunchHistory +type AdhocLaunchHistory struct { + + // framework id + FrameworkID string `json:"framework_id,omitempty"` + + // when the job was launched + LaunchTime string `json:"launch_time,omitempty"` + + // id of the single run + RunID string `json:"run_id,omitempty"` +} + +// Validate validates this adhoc launch history +func (m *AdhocLaunchHistory) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AdhocLaunchHistory) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdhocLaunchHistory) UnmarshalBinary(b []byte) error { + var res AdhocLaunchHistory + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/deploy_queue.go b/pkg/paastaapi/models/deploy_queue.go new file mode 100644 index 0000000..bb48b42 --- /dev/null +++ b/pkg/paastaapi/models/deploy_queue.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DeployQueue Current state of the deployd queue +// +// swagger:model DeployQueue +type DeployQueue struct { + + // Service instances that are ready to be acted on by deployd + AvailableServiceInstances []*DeployQueueServiceInstance `json:"available_service_instances"` + + // Service instances that deployd is waiting to act on + UnavailableServiceInstances []*DeployQueueServiceInstance `json:"unavailable_service_instances"` +} + +// Validate validates this deploy queue +func (m *DeployQueue) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAvailableServiceInstances(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUnavailableServiceInstances(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DeployQueue) validateAvailableServiceInstances(formats strfmt.Registry) error { + + if swag.IsZero(m.AvailableServiceInstances) { // not required + return nil + } + + for i := 0; i < len(m.AvailableServiceInstances); i++ { + if swag.IsZero(m.AvailableServiceInstances[i]) { // not required + continue + } + + if m.AvailableServiceInstances[i] != nil { + if err := m.AvailableServiceInstances[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("available_service_instances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DeployQueue) validateUnavailableServiceInstances(formats strfmt.Registry) error { + + if swag.IsZero(m.UnavailableServiceInstances) { // not required + return nil + } + + for i := 0; i < len(m.UnavailableServiceInstances); i++ { + if swag.IsZero(m.UnavailableServiceInstances[i]) { // not required + continue + } + + if m.UnavailableServiceInstances[i] != nil { + if err := m.UnavailableServiceInstances[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unavailable_service_instances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DeployQueue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DeployQueue) UnmarshalBinary(b []byte) error { + var res DeployQueue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/deploy_queue_service_instance.go b/pkg/paastaapi/models/deploy_queue_service_instance.go new file mode 100644 index 0000000..993a8c5 --- /dev/null +++ b/pkg/paastaapi/models/deploy_queue_service_instance.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DeployQueueServiceInstance An instance of a service in the deploy queue +// +// swagger:model DeployQueueServiceInstance +type DeployQueueServiceInstance struct { + + // Desired timestamp by which the service instance should be bounced + BounceBy float32 `json:"bounce_by,omitempty"` + + // Timestamp at which service instance was first added to the queue + BounceStartTime float32 `json:"bounce_start_time,omitempty"` + + // Timestamp at which the service instance was last added to the queue + EnqueueTime float32 `json:"enqueue_time,omitempty"` + + // Number of times deployment actions have failed on this service instance + Failures int32 `json:"failures,omitempty"` + + // Name of the instance of the service + Instance string `json:"instance,omitempty"` + + // Number of times any deployment action has been taken on this service instance + ProcessedCount int32 `json:"processed_count,omitempty"` + + // Name of the service + Service string `json:"service,omitempty"` + + // Timestamp before which no action should be taken on this service instance + WaitUntil float32 `json:"wait_until,omitempty"` + + // The process that enqueued the task + Watcher string `json:"watcher,omitempty"` +} + +// Validate validates this deploy queue service instance +func (m *DeployQueueServiceInstance) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DeployQueueServiceInstance) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DeployQueueServiceInstance) UnmarshalBinary(b []byte) error { + var res DeployQueueServiceInstance + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/envoy_backend.go b/pkg/paastaapi/models/envoy_backend.go new file mode 100644 index 0000000..b22c1bf --- /dev/null +++ b/pkg/paastaapi/models/envoy_backend.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// EnvoyBackend envoy backend +// +// swagger:model EnvoyBackend +type EnvoyBackend struct { + + // Address of the host on which the backend is running + Address string `json:"address,omitempty"` + + // Status of the backend in Envoy as reported by the EDS + EdsHealthStatus string `json:"eds_health_status,omitempty"` + + // Whether this backend has an associated task running + HasAssociatedTask bool `json:"has_associated_task,omitempty"` + + // Name of the host on which the backend is running + Hostname string `json:"hostname,omitempty"` + + // Port number on which the backend responds + PortValue int32 `json:"port_value,omitempty"` + + // The weight of this backend in the cluster + Weight int32 `json:"weight,omitempty"` +} + +// Validate validates this envoy backend +func (m *EnvoyBackend) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *EnvoyBackend) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *EnvoyBackend) UnmarshalBinary(b []byte) error { + var res EnvoyBackend + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/envoy_location.go b/pkg/paastaapi/models/envoy_location.go new file mode 100644 index 0000000..ff76861 --- /dev/null +++ b/pkg/paastaapi/models/envoy_location.go @@ -0,0 +1,89 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// EnvoyLocation envoy location +// +// swagger:model EnvoyLocation +type EnvoyLocation struct { + + // Envoy backends running in this location + Backends []*EnvoyBackend `json:"backends"` + + // Whether this backend is proxied through Casper + IsProxiedThroughCasper bool `json:"is_proxied_through_casper,omitempty"` + + // Name of the location + Name string `json:"name,omitempty"` + + // Number of running backends for the service in this location + RunningBackendsCount int32 `json:"running_backends_count,omitempty"` +} + +// Validate validates this envoy location +func (m *EnvoyLocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBackends(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *EnvoyLocation) validateBackends(formats strfmt.Registry) error { + + if swag.IsZero(m.Backends) { // not required + return nil + } + + for i := 0; i < len(m.Backends); i++ { + if swag.IsZero(m.Backends[i]) { // not required + continue + } + + if m.Backends[i] != nil { + if err := m.Backends[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("backends" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *EnvoyLocation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *EnvoyLocation) UnmarshalBinary(b []byte) error { + var res EnvoyLocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/envoy_status.go b/pkg/paastaapi/models/envoy_status.go new file mode 100644 index 0000000..b58fae1 --- /dev/null +++ b/pkg/paastaapi/models/envoy_status.go @@ -0,0 +1,86 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// EnvoyStatus envoy status +// +// swagger:model EnvoyStatus +type EnvoyStatus struct { + + // Number of backends expected to be present in each location + ExpectedBackendsPerLocation int32 `json:"expected_backends_per_location,omitempty"` + + // Locations the service is deployed + Locations []*EnvoyLocation `json:"locations"` + + // Registration name of the service in Smartstack + Registration string `json:"registration,omitempty"` +} + +// Validate validates this envoy status +func (m *EnvoyStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocations(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *EnvoyStatus) validateLocations(formats strfmt.Registry) error { + + if swag.IsZero(m.Locations) { // not required + return nil + } + + for i := 0; i < len(m.Locations); i++ { + if swag.IsZero(m.Locations[i]) { // not required + continue + } + + if m.Locations[i] != nil { + if err := m.Locations[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("locations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *EnvoyStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *EnvoyStatus) UnmarshalBinary(b []byte) error { + var res EnvoyStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/float_and_error.go b/pkg/paastaapi/models/float_and_error.go new file mode 100644 index 0000000..659a1d6 --- /dev/null +++ b/pkg/paastaapi/models/float_and_error.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// FloatAndError float and error +// +// swagger:model FloatAndError +type FloatAndError struct { + + // error message + ErrorMessage string `json:"error_message,omitempty"` + + // value + Value float32 `json:"value,omitempty"` +} + +// Validate validates this float and error +func (m *FloatAndError) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *FloatAndError) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FloatAndError) UnmarshalBinary(b []byte) error { + var res FloatAndError + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/h_p_a_metric.go b/pkg/paastaapi/models/h_p_a_metric.go new file mode 100644 index 0000000..ba03710 --- /dev/null +++ b/pkg/paastaapi/models/h_p_a_metric.go @@ -0,0 +1,49 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HPAMetric h p a metric +// +// swagger:model HPAMetric +type HPAMetric struct { + + // setpoint/target_value as specified in yelpsoa_configs + CurrentValue string `json:"current_value,omitempty"` + + // name of the metric + Name string `json:"name,omitempty"` + + // setpoint/target_value as specified in yelpsoa_configs + TargetValue string `json:"target_value,omitempty"` +} + +// Validate validates this h p a metric +func (m *HPAMetric) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HPAMetric) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HPAMetric) UnmarshalBinary(b []byte) error { + var res HPAMetric + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/instance_delay.go b/pkg/paastaapi/models/instance_delay.go new file mode 100644 index 0000000..d30b602 --- /dev/null +++ b/pkg/paastaapi/models/instance_delay.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// InstanceDelay instance delay +// +// swagger:model InstanceDelay +type InstanceDelay interface{} diff --git a/pkg/paastaapi/models/instance_metadata_kafka_cluster.go b/pkg/paastaapi/models/instance_metadata_kafka_cluster.go new file mode 100644 index 0000000..7c2359d --- /dev/null +++ b/pkg/paastaapi/models/instance_metadata_kafka_cluster.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// InstanceMetadataKafkaCluster Kafka instance metadata +// +// swagger:model InstanceMetadataKafkaCluster +type InstanceMetadataKafkaCluster interface{} diff --git a/pkg/paastaapi/models/instance_spec_kafka_cluster.go b/pkg/paastaapi/models/instance_spec_kafka_cluster.go new file mode 100644 index 0000000..826905b --- /dev/null +++ b/pkg/paastaapi/models/instance_spec_kafka_cluster.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// InstanceSpecKafkaCluster Kafka instance spec +// +// swagger:model InstanceSpecKafkaCluster +type InstanceSpecKafkaCluster interface{} diff --git a/pkg/paastaapi/models/instance_status.go b/pkg/paastaapi/models/instance_status.go new file mode 100644 index 0000000..fc74692 --- /dev/null +++ b/pkg/paastaapi/models/instance_status.go @@ -0,0 +1,273 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceStatus instance status +// +// swagger:model InstanceStatus +type InstanceStatus struct { + + // Adhoc instance status + Adhoc InstanceStatusAdhoc `json:"adhoc,omitempty"` + + // flink + Flink *InstanceStatusFlink `json:"flink,omitempty"` + + // Git sha of a service + GitSha string `json:"git_sha,omitempty"` + + // Instance name + Instance string `json:"instance,omitempty"` + + // kafkacluster + Kafkacluster *InstanceStatusKafkacluster `json:"kafkacluster,omitempty"` + + // Kubernetes instance status + Kubernetes *InstanceStatusKubernetes `json:"kubernetes,omitempty"` + + // Marathon instance status + Marathon *InstanceStatusMarathon `json:"marathon,omitempty"` + + // Service name + Service string `json:"service,omitempty"` + + // Tron instance status + Tron *InstanceStatusTron `json:"tron,omitempty"` +} + +// Validate validates this instance status +func (m *InstanceStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAdhoc(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFlink(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKafkacluster(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKubernetes(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMarathon(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTron(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceStatus) validateAdhoc(formats strfmt.Registry) error { + + if swag.IsZero(m.Adhoc) { // not required + return nil + } + + if err := m.Adhoc.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adhoc") + } + return err + } + + return nil +} + +func (m *InstanceStatus) validateFlink(formats strfmt.Registry) error { + + if swag.IsZero(m.Flink) { // not required + return nil + } + + if m.Flink != nil { + if err := m.Flink.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("flink") + } + return err + } + } + + return nil +} + +func (m *InstanceStatus) validateKafkacluster(formats strfmt.Registry) error { + + if swag.IsZero(m.Kafkacluster) { // not required + return nil + } + + if m.Kafkacluster != nil { + if err := m.Kafkacluster.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("kafkacluster") + } + return err + } + } + + return nil +} + +func (m *InstanceStatus) validateKubernetes(formats strfmt.Registry) error { + + if swag.IsZero(m.Kubernetes) { // not required + return nil + } + + if m.Kubernetes != nil { + if err := m.Kubernetes.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("kubernetes") + } + return err + } + } + + return nil +} + +func (m *InstanceStatus) validateMarathon(formats strfmt.Registry) error { + + if swag.IsZero(m.Marathon) { // not required + return nil + } + + if m.Marathon != nil { + if err := m.Marathon.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("marathon") + } + return err + } + } + + return nil +} + +func (m *InstanceStatus) validateTron(formats strfmt.Registry) error { + + if swag.IsZero(m.Tron) { // not required + return nil + } + + if m.Tron != nil { + if err := m.Tron.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tron") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceStatus) UnmarshalBinary(b []byte) error { + var res InstanceStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// InstanceStatusFlink Nullable Flink instance status and metadata +// +// swagger:model InstanceStatusFlink +type InstanceStatusFlink struct { + + // metadata + Metadata InstanceStatusFlinkMetadata `json:"metadata,omitempty"` + + // status + Status InstanceStatusFlinkStatus `json:"status,omitempty"` +} + +// Validate validates this instance status flink +func (m *InstanceStatusFlink) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceStatusFlink) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceStatusFlink) UnmarshalBinary(b []byte) error { + var res InstanceStatusFlink + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// InstanceStatusKafkacluster Nullable KafkaCluster instance status and metadata +// +// swagger:model InstanceStatusKafkacluster +type InstanceStatusKafkacluster struct { + + // metadata + Metadata InstanceMetadataKafkaCluster `json:"metadata,omitempty"` + + // status + Status InstanceStatusKafkaCluster `json:"status,omitempty"` +} + +// Validate validates this instance status kafkacluster +func (m *InstanceStatusKafkacluster) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceStatusKafkacluster) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceStatusKafkacluster) UnmarshalBinary(b []byte) error { + var res InstanceStatusKafkacluster + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/instance_status_adhoc.go b/pkg/paastaapi/models/instance_status_adhoc.go new file mode 100644 index 0000000..4dd30a9 --- /dev/null +++ b/pkg/paastaapi/models/instance_status_adhoc.go @@ -0,0 +1,45 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceStatusAdhoc List of runs associated with job +// +// swagger:model InstanceStatusAdhoc +type InstanceStatusAdhoc []*AdhocLaunchHistory + +// Validate validates this instance status adhoc +func (m InstanceStatusAdhoc) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/models/instance_status_flink_metadata.go b/pkg/paastaapi/models/instance_status_flink_metadata.go new file mode 100644 index 0000000..056359b --- /dev/null +++ b/pkg/paastaapi/models/instance_status_flink_metadata.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// InstanceStatusFlinkMetadata Flink instance metadata +// +// swagger:model InstanceStatusFlinkMetadata +type InstanceStatusFlinkMetadata interface{} diff --git a/pkg/paastaapi/models/instance_status_flink_status.go b/pkg/paastaapi/models/instance_status_flink_status.go new file mode 100644 index 0000000..a6a0617 --- /dev/null +++ b/pkg/paastaapi/models/instance_status_flink_status.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// InstanceStatusFlinkStatus Flink instance status +// +// swagger:model InstanceStatusFlinkStatus +type InstanceStatusFlinkStatus interface{} diff --git a/pkg/paastaapi/models/instance_status_kafka_cluster.go b/pkg/paastaapi/models/instance_status_kafka_cluster.go new file mode 100644 index 0000000..1ce0abc --- /dev/null +++ b/pkg/paastaapi/models/instance_status_kafka_cluster.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// InstanceStatusKafkaCluster Kafka instance status +// +// swagger:model InstanceStatusKafkaCluster +type InstanceStatusKafkaCluster interface{} diff --git a/pkg/paastaapi/models/instance_status_kubernetes.go b/pkg/paastaapi/models/instance_status_kubernetes.go new file mode 100644 index 0000000..8984d28 --- /dev/null +++ b/pkg/paastaapi/models/instance_status_kubernetes.go @@ -0,0 +1,456 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// InstanceStatusKubernetes instance status kubernetes +// +// swagger:model InstanceStatusKubernetes +type InstanceStatusKubernetes struct { + + // The number of different running versions of the same service (0 for stopped, 1 for running and 1+ for bouncing) + // Required: true + AppCount *int32 `json:"app_count"` + + // ID of the desired version of a service instance + AppID string `json:"app_id,omitempty"` + + // autoscaling status + AutoscalingStatus *InstanceStatusKubernetesAutoscalingStatus `json:"autoscaling_status,omitempty"` + + // backoff in seconds before launching the next task + BackoffSeconds int32 `json:"backoff_seconds,omitempty"` + + // Method to transit between new and old versions of a service + // Required: true + // Enum: [brutal upthendown downthenup crossover] + BounceMethod *string `json:"bounce_method"` + + // Unix timestamp when this app was created + CreateTimestamp float32 `json:"create_timestamp,omitempty"` + + // Deploy status of a Kubernetes service + // Enum: [Running Deploying Stopped Delayed Waiting NotRunning] + DeployStatus string `json:"deploy_status,omitempty"` + + // Reason for the deploy status + DeployStatusMessage string `json:"deploy_status_message,omitempty"` + + // Desired state of a service, for Kubernetes + // Required: true + // Enum: [start stop] + DesiredState *string `json:"desired_state"` + + // Error message when a kubernetes object (Deployment/Statefulset) cannot be found + ErrorMessage string `json:"error_message,omitempty"` + + // The number of desired instances of the service + ExpectedInstanceCount int32 `json:"expected_instance_count,omitempty"` + + // The namespace this app is running + Namespace string `json:"namespace,omitempty"` + + // Pods associated to this app + Pods []*KubernetesPod `json:"pods"` + + // ReplicaSets associated to this app + Replicasets []*KubernetesReplicaSet `json:"replicasets"` + + // The number of actual running instances of the service + RunningInstanceCount int32 `json:"running_instance_count,omitempty"` + + // Status of the service in smartstack + Smartstack *SmartstackStatus `json:"smartstack,omitempty"` +} + +// Validate validates this instance status kubernetes +func (m *InstanceStatusKubernetes) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAppCount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAutoscalingStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBounceMethod(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeployStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDesiredState(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePods(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReplicasets(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSmartstack(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceStatusKubernetes) validateAppCount(formats strfmt.Registry) error { + + if err := validate.Required("app_count", "body", m.AppCount); err != nil { + return err + } + + return nil +} + +func (m *InstanceStatusKubernetes) validateAutoscalingStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.AutoscalingStatus) { // not required + return nil + } + + if m.AutoscalingStatus != nil { + if err := m.AutoscalingStatus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("autoscaling_status") + } + return err + } + } + + return nil +} + +var instanceStatusKubernetesTypeBounceMethodPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["brutal","upthendown","downthenup","crossover"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + instanceStatusKubernetesTypeBounceMethodPropEnum = append(instanceStatusKubernetesTypeBounceMethodPropEnum, v) + } +} + +const ( + + // InstanceStatusKubernetesBounceMethodBrutal captures enum value "brutal" + InstanceStatusKubernetesBounceMethodBrutal string = "brutal" + + // InstanceStatusKubernetesBounceMethodUpthendown captures enum value "upthendown" + InstanceStatusKubernetesBounceMethodUpthendown string = "upthendown" + + // InstanceStatusKubernetesBounceMethodDownthenup captures enum value "downthenup" + InstanceStatusKubernetesBounceMethodDownthenup string = "downthenup" + + // InstanceStatusKubernetesBounceMethodCrossover captures enum value "crossover" + InstanceStatusKubernetesBounceMethodCrossover string = "crossover" +) + +// prop value enum +func (m *InstanceStatusKubernetes) validateBounceMethodEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, instanceStatusKubernetesTypeBounceMethodPropEnum); err != nil { + return err + } + return nil +} + +func (m *InstanceStatusKubernetes) validateBounceMethod(formats strfmt.Registry) error { + + if err := validate.Required("bounce_method", "body", m.BounceMethod); err != nil { + return err + } + + // value enum + if err := m.validateBounceMethodEnum("bounce_method", "body", *m.BounceMethod); err != nil { + return err + } + + return nil +} + +var instanceStatusKubernetesTypeDeployStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Running","Deploying","Stopped","Delayed","Waiting","NotRunning"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + instanceStatusKubernetesTypeDeployStatusPropEnum = append(instanceStatusKubernetesTypeDeployStatusPropEnum, v) + } +} + +const ( + + // InstanceStatusKubernetesDeployStatusRunning captures enum value "Running" + InstanceStatusKubernetesDeployStatusRunning string = "Running" + + // InstanceStatusKubernetesDeployStatusDeploying captures enum value "Deploying" + InstanceStatusKubernetesDeployStatusDeploying string = "Deploying" + + // InstanceStatusKubernetesDeployStatusStopped captures enum value "Stopped" + InstanceStatusKubernetesDeployStatusStopped string = "Stopped" + + // InstanceStatusKubernetesDeployStatusDelayed captures enum value "Delayed" + InstanceStatusKubernetesDeployStatusDelayed string = "Delayed" + + // InstanceStatusKubernetesDeployStatusWaiting captures enum value "Waiting" + InstanceStatusKubernetesDeployStatusWaiting string = "Waiting" + + // InstanceStatusKubernetesDeployStatusNotRunning captures enum value "NotRunning" + InstanceStatusKubernetesDeployStatusNotRunning string = "NotRunning" +) + +// prop value enum +func (m *InstanceStatusKubernetes) validateDeployStatusEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, instanceStatusKubernetesTypeDeployStatusPropEnum); err != nil { + return err + } + return nil +} + +func (m *InstanceStatusKubernetes) validateDeployStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.DeployStatus) { // not required + return nil + } + + // value enum + if err := m.validateDeployStatusEnum("deploy_status", "body", m.DeployStatus); err != nil { + return err + } + + return nil +} + +var instanceStatusKubernetesTypeDesiredStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["start","stop"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + instanceStatusKubernetesTypeDesiredStatePropEnum = append(instanceStatusKubernetesTypeDesiredStatePropEnum, v) + } +} + +const ( + + // InstanceStatusKubernetesDesiredStateStart captures enum value "start" + InstanceStatusKubernetesDesiredStateStart string = "start" + + // InstanceStatusKubernetesDesiredStateStop captures enum value "stop" + InstanceStatusKubernetesDesiredStateStop string = "stop" +) + +// prop value enum +func (m *InstanceStatusKubernetes) validateDesiredStateEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, instanceStatusKubernetesTypeDesiredStatePropEnum); err != nil { + return err + } + return nil +} + +func (m *InstanceStatusKubernetes) validateDesiredState(formats strfmt.Registry) error { + + if err := validate.Required("desired_state", "body", m.DesiredState); err != nil { + return err + } + + // value enum + if err := m.validateDesiredStateEnum("desired_state", "body", *m.DesiredState); err != nil { + return err + } + + return nil +} + +func (m *InstanceStatusKubernetes) validatePods(formats strfmt.Registry) error { + + if swag.IsZero(m.Pods) { // not required + return nil + } + + for i := 0; i < len(m.Pods); i++ { + if swag.IsZero(m.Pods[i]) { // not required + continue + } + + if m.Pods[i] != nil { + if err := m.Pods[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pods" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceStatusKubernetes) validateReplicasets(formats strfmt.Registry) error { + + if swag.IsZero(m.Replicasets) { // not required + return nil + } + + for i := 0; i < len(m.Replicasets); i++ { + if swag.IsZero(m.Replicasets[i]) { // not required + continue + } + + if m.Replicasets[i] != nil { + if err := m.Replicasets[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("replicasets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceStatusKubernetes) validateSmartstack(formats strfmt.Registry) error { + + if swag.IsZero(m.Smartstack) { // not required + return nil + } + + if m.Smartstack != nil { + if err := m.Smartstack.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("smartstack") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceStatusKubernetes) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceStatusKubernetes) UnmarshalBinary(b []byte) error { + var res InstanceStatusKubernetes + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// InstanceStatusKubernetesAutoscalingStatus HPA associated to this app +// +// swagger:model InstanceStatusKubernetesAutoscalingStatus +type InstanceStatusKubernetesAutoscalingStatus struct { + + // desired number of _instances as calculated by HPA + DesiredReplicas int64 `json:"desired_replicas,omitempty"` + + // timestamp of last autoscale + LastScaleTime string `json:"last_scale_time,omitempty"` + + // min_instances as specified in yelpsoa_configs + MaxInstances int64 `json:"max_instances,omitempty"` + + // Current metrics + Metrics []*HPAMetric `json:"metrics"` + + // min_instances as specified in yelpsoa_configs + MinInstances int64 `json:"min_instances,omitempty"` +} + +// Validate validates this instance status kubernetes autoscaling status +func (m *InstanceStatusKubernetesAutoscalingStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMetrics(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceStatusKubernetesAutoscalingStatus) validateMetrics(formats strfmt.Registry) error { + + if swag.IsZero(m.Metrics) { // not required + return nil + } + + for i := 0; i < len(m.Metrics); i++ { + if swag.IsZero(m.Metrics[i]) { // not required + continue + } + + if m.Metrics[i] != nil { + if err := m.Metrics[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("autoscaling_status" + "." + "metrics" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceStatusKubernetesAutoscalingStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceStatusKubernetesAutoscalingStatus) UnmarshalBinary(b []byte) error { + var res InstanceStatusKubernetesAutoscalingStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/instance_status_marathon.go b/pkg/paastaapi/models/instance_status_marathon.go new file mode 100644 index 0000000..6ce4f42 --- /dev/null +++ b/pkg/paastaapi/models/instance_status_marathon.go @@ -0,0 +1,390 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// InstanceStatusMarathon instance status marathon +// +// swagger:model InstanceStatusMarathon +type InstanceStatusMarathon struct { + + // The number of different running versions of the same service (0 for stopped, 1 for running and 1+ for bouncing) + // Required: true + AppCount *int32 `json:"app_count"` + + // Statuses of each app of the service + AppStatuses []*MarathonAppStatus `json:"app_statuses"` + + // Autoscaling information for the service + AutoscalingInfo *MarathonAutoscalingInfo `json:"autoscaling_info,omitempty"` + + // backoff in seconds before launching the next task + BackoffSeconds int32 `json:"backoff_seconds,omitempty"` + + // Method to transit between new and old versions of a service + // Required: true + // Enum: [brutal upthendown downthenup crossover] + BounceMethod *string `json:"bounce_method"` + + // Deploy status of a marathon service + // Enum: [Running Deploying Stopped Delayed Waiting Waiting for bounce NotRunning] + DeployStatus string `json:"deploy_status,omitempty"` + + // ID of the desired version of a service instance + DesiredAppID string `json:"desired_app_id,omitempty"` + + // Desired state of a service, for Marathon + // Required: true + // Enum: [start stop] + DesiredState *string `json:"desired_state"` + + // Status of the service in Envoy + Envoy *EnvoyStatus `json:"envoy,omitempty"` + + // Error message when a marathon job ID cannot be found + ErrorMessage string `json:"error_message,omitempty"` + + // The number of desired instances of the service + ExpectedInstanceCount int32 `json:"expected_instance_count,omitempty"` + + // Status of the service in Mesos + Mesos *MarathonMesosStatus `json:"mesos,omitempty"` + + // The number of actual running instances of the service + RunningInstanceCount int32 `json:"running_instance_count,omitempty"` + + // Status of the service in smartstack + Smartstack *SmartstackStatus `json:"smartstack,omitempty"` +} + +// Validate validates this instance status marathon +func (m *InstanceStatusMarathon) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAppCount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAppStatuses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAutoscalingInfo(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBounceMethod(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeployStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDesiredState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnvoy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMesos(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSmartstack(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceStatusMarathon) validateAppCount(formats strfmt.Registry) error { + + if err := validate.Required("app_count", "body", m.AppCount); err != nil { + return err + } + + return nil +} + +func (m *InstanceStatusMarathon) validateAppStatuses(formats strfmt.Registry) error { + + if swag.IsZero(m.AppStatuses) { // not required + return nil + } + + for i := 0; i < len(m.AppStatuses); i++ { + if swag.IsZero(m.AppStatuses[i]) { // not required + continue + } + + if m.AppStatuses[i] != nil { + if err := m.AppStatuses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("app_statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceStatusMarathon) validateAutoscalingInfo(formats strfmt.Registry) error { + + if swag.IsZero(m.AutoscalingInfo) { // not required + return nil + } + + if m.AutoscalingInfo != nil { + if err := m.AutoscalingInfo.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("autoscaling_info") + } + return err + } + } + + return nil +} + +var instanceStatusMarathonTypeBounceMethodPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["brutal","upthendown","downthenup","crossover"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + instanceStatusMarathonTypeBounceMethodPropEnum = append(instanceStatusMarathonTypeBounceMethodPropEnum, v) + } +} + +const ( + + // InstanceStatusMarathonBounceMethodBrutal captures enum value "brutal" + InstanceStatusMarathonBounceMethodBrutal string = "brutal" + + // InstanceStatusMarathonBounceMethodUpthendown captures enum value "upthendown" + InstanceStatusMarathonBounceMethodUpthendown string = "upthendown" + + // InstanceStatusMarathonBounceMethodDownthenup captures enum value "downthenup" + InstanceStatusMarathonBounceMethodDownthenup string = "downthenup" + + // InstanceStatusMarathonBounceMethodCrossover captures enum value "crossover" + InstanceStatusMarathonBounceMethodCrossover string = "crossover" +) + +// prop value enum +func (m *InstanceStatusMarathon) validateBounceMethodEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, instanceStatusMarathonTypeBounceMethodPropEnum); err != nil { + return err + } + return nil +} + +func (m *InstanceStatusMarathon) validateBounceMethod(formats strfmt.Registry) error { + + if err := validate.Required("bounce_method", "body", m.BounceMethod); err != nil { + return err + } + + // value enum + if err := m.validateBounceMethodEnum("bounce_method", "body", *m.BounceMethod); err != nil { + return err + } + + return nil +} + +var instanceStatusMarathonTypeDeployStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Running","Deploying","Stopped","Delayed","Waiting","Waiting for bounce","NotRunning"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + instanceStatusMarathonTypeDeployStatusPropEnum = append(instanceStatusMarathonTypeDeployStatusPropEnum, v) + } +} + +const ( + + // InstanceStatusMarathonDeployStatusRunning captures enum value "Running" + InstanceStatusMarathonDeployStatusRunning string = "Running" + + // InstanceStatusMarathonDeployStatusDeploying captures enum value "Deploying" + InstanceStatusMarathonDeployStatusDeploying string = "Deploying" + + // InstanceStatusMarathonDeployStatusStopped captures enum value "Stopped" + InstanceStatusMarathonDeployStatusStopped string = "Stopped" + + // InstanceStatusMarathonDeployStatusDelayed captures enum value "Delayed" + InstanceStatusMarathonDeployStatusDelayed string = "Delayed" + + // InstanceStatusMarathonDeployStatusWaiting captures enum value "Waiting" + InstanceStatusMarathonDeployStatusWaiting string = "Waiting" + + // InstanceStatusMarathonDeployStatusWaitingForBounce captures enum value "Waiting for bounce" + InstanceStatusMarathonDeployStatusWaitingForBounce string = "Waiting for bounce" + + // InstanceStatusMarathonDeployStatusNotRunning captures enum value "NotRunning" + InstanceStatusMarathonDeployStatusNotRunning string = "NotRunning" +) + +// prop value enum +func (m *InstanceStatusMarathon) validateDeployStatusEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, instanceStatusMarathonTypeDeployStatusPropEnum); err != nil { + return err + } + return nil +} + +func (m *InstanceStatusMarathon) validateDeployStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.DeployStatus) { // not required + return nil + } + + // value enum + if err := m.validateDeployStatusEnum("deploy_status", "body", m.DeployStatus); err != nil { + return err + } + + return nil +} + +var instanceStatusMarathonTypeDesiredStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["start","stop"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + instanceStatusMarathonTypeDesiredStatePropEnum = append(instanceStatusMarathonTypeDesiredStatePropEnum, v) + } +} + +const ( + + // InstanceStatusMarathonDesiredStateStart captures enum value "start" + InstanceStatusMarathonDesiredStateStart string = "start" + + // InstanceStatusMarathonDesiredStateStop captures enum value "stop" + InstanceStatusMarathonDesiredStateStop string = "stop" +) + +// prop value enum +func (m *InstanceStatusMarathon) validateDesiredStateEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, instanceStatusMarathonTypeDesiredStatePropEnum); err != nil { + return err + } + return nil +} + +func (m *InstanceStatusMarathon) validateDesiredState(formats strfmt.Registry) error { + + if err := validate.Required("desired_state", "body", m.DesiredState); err != nil { + return err + } + + // value enum + if err := m.validateDesiredStateEnum("desired_state", "body", *m.DesiredState); err != nil { + return err + } + + return nil +} + +func (m *InstanceStatusMarathon) validateEnvoy(formats strfmt.Registry) error { + + if swag.IsZero(m.Envoy) { // not required + return nil + } + + if m.Envoy != nil { + if err := m.Envoy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("envoy") + } + return err + } + } + + return nil +} + +func (m *InstanceStatusMarathon) validateMesos(formats strfmt.Registry) error { + + if swag.IsZero(m.Mesos) { // not required + return nil + } + + if m.Mesos != nil { + if err := m.Mesos.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mesos") + } + return err + } + } + + return nil +} + +func (m *InstanceStatusMarathon) validateSmartstack(formats strfmt.Registry) error { + + if swag.IsZero(m.Smartstack) { // not required + return nil + } + + if m.Smartstack != nil { + if err := m.Smartstack.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("smartstack") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceStatusMarathon) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceStatusMarathon) UnmarshalBinary(b []byte) error { + var res InstanceStatusMarathon + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/instance_status_tron.go b/pkg/paastaapi/models/instance_status_tron.go new file mode 100644 index 0000000..dda087b --- /dev/null +++ b/pkg/paastaapi/models/instance_status_tron.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// InstanceStatusTron instance status tron +// +// swagger:model InstanceStatusTron +type InstanceStatusTron struct { + + // The command of the action + ActionCommand string `json:"action_command,omitempty"` + + // The name of the action + ActionName string `json:"action_name,omitempty"` + + // The raw command of the action + ActionRawCommand string `json:"action_raw_command,omitempty"` + + // The start time of the action + ActionStartTime string `json:"action_start_time,omitempty"` + + // The state of the action + ActionState string `json:"action_state,omitempty"` + + // The stderr command of the action + ActionStderr string `json:"action_stderr,omitempty"` + + // The stdout command of the action + ActionStdout string `json:"action_stdout,omitempty"` + + // The name of this job + // Required: true + JobName *string `json:"job_name"` + + // The job schedule of the job + JobSchedule string `json:"job_schedule,omitempty"` + + // The status of the job + JobStatus string `json:"job_status,omitempty"` + + // The dashboard url of the job + // Required: true + JobURL *string `json:"job_url"` +} + +// Validate validates this instance status tron +func (m *InstanceStatusTron) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateJobName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateJobURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceStatusTron) validateJobName(formats strfmt.Registry) error { + + if err := validate.Required("job_name", "body", m.JobName); err != nil { + return err + } + + return nil +} + +func (m *InstanceStatusTron) validateJobURL(formats strfmt.Registry) error { + + if err := validate.Required("job_url", "body", m.JobURL); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceStatusTron) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceStatusTron) UnmarshalBinary(b []byte) error { + var res InstanceStatusTron + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/instance_task.go b/pkg/paastaapi/models/instance_task.go new file mode 100644 index 0000000..b7cfd25 --- /dev/null +++ b/pkg/paastaapi/models/instance_task.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// InstanceTask instance task +// +// swagger:model InstanceTask +type InstanceTask interface{} diff --git a/pkg/paastaapi/models/instance_tasks.go b/pkg/paastaapi/models/instance_tasks.go new file mode 100644 index 0000000..3f29281 --- /dev/null +++ b/pkg/paastaapi/models/instance_tasks.go @@ -0,0 +1,20 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" +) + +// InstanceTasks List of tasks associated with instance +// +// swagger:model InstanceTasks +type InstanceTasks []InstanceTask + +// Validate validates this instance tasks +func (m InstanceTasks) Validate(formats strfmt.Registry) error { + return nil +} diff --git a/pkg/paastaapi/models/integer_and_error.go b/pkg/paastaapi/models/integer_and_error.go new file mode 100644 index 0000000..61636f3 --- /dev/null +++ b/pkg/paastaapi/models/integer_and_error.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// IntegerAndError integer and error +// +// swagger:model IntegerAndError +type IntegerAndError struct { + + // error message + ErrorMessage string `json:"error_message,omitempty"` + + // value + Value int32 `json:"value,omitempty"` +} + +// Validate validates this integer and error +func (m *IntegerAndError) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *IntegerAndError) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IntegerAndError) UnmarshalBinary(b []byte) error { + var res IntegerAndError + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/kubernetes_container.go b/pkg/paastaapi/models/kubernetes_container.go new file mode 100644 index 0000000..5b3a66b --- /dev/null +++ b/pkg/paastaapi/models/kubernetes_container.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// KubernetesContainer kubernetes container +// +// swagger:model KubernetesContainer +type KubernetesContainer struct { + + // Name of the container + Name string `json:"name,omitempty"` + + // Stdout and stderr tail of the container + TailLines *TaskTailLines `json:"tail_lines,omitempty"` +} + +// Validate validates this kubernetes container +func (m *KubernetesContainer) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTailLines(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *KubernetesContainer) validateTailLines(formats strfmt.Registry) error { + + if swag.IsZero(m.TailLines) { // not required + return nil + } + + if m.TailLines != nil { + if err := m.TailLines.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tail_lines") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *KubernetesContainer) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *KubernetesContainer) UnmarshalBinary(b []byte) error { + var res KubernetesContainer + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/kubernetes_pod.go b/pkg/paastaapi/models/kubernetes_pod.go new file mode 100644 index 0000000..648f35d --- /dev/null +++ b/pkg/paastaapi/models/kubernetes_pod.go @@ -0,0 +1,101 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// KubernetesPod kubernetes pod +// +// swagger:model KubernetesPod +type KubernetesPod struct { + + // containers + Containers []*KubernetesContainer `json:"containers"` + + // Time at which the pod was deployed + DeployedTimestamp float32 `json:"deployed_timestamp,omitempty"` + + // name of the pod's host + Host string `json:"host,omitempty"` + + // long message explaining the pod's state + Message *string `json:"message,omitempty"` + + // name of the pod in Kubernetes + Name string `json:"name,omitempty"` + + // The status of the pod + Phase string `json:"phase,omitempty"` + + // Whether or not the pod is ready (i.e. all containers up) + Ready bool `json:"ready,omitempty"` + + // short message explaining the pod's state + Reason *string `json:"reason,omitempty"` +} + +// Validate validates this kubernetes pod +func (m *KubernetesPod) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContainers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *KubernetesPod) validateContainers(formats strfmt.Registry) error { + + if swag.IsZero(m.Containers) { // not required + return nil + } + + for i := 0; i < len(m.Containers); i++ { + if swag.IsZero(m.Containers[i]) { // not required + continue + } + + if m.Containers[i] != nil { + if err := m.Containers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("containers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *KubernetesPod) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *KubernetesPod) UnmarshalBinary(b []byte) error { + var res KubernetesPod + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/kubernetes_replica_set.go b/pkg/paastaapi/models/kubernetes_replica_set.go new file mode 100644 index 0000000..015b9e4 --- /dev/null +++ b/pkg/paastaapi/models/kubernetes_replica_set.go @@ -0,0 +1,52 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// KubernetesReplicaSet kubernetes replica set +// +// swagger:model KubernetesReplicaSet +type KubernetesReplicaSet struct { + + // Time at which the replicaset was created + CreateTimestamp float32 `json:"create_timestamp,omitempty"` + + // name of the replicaset in Kubernetes + Name string `json:"name,omitempty"` + + // number of ready replicas for the replicaset + ReadyReplicas int32 `json:"ready_replicas,omitempty"` + + // number of desired replicas for the replicaset + Replicas int32 `json:"replicas,omitempty"` +} + +// Validate validates this kubernetes replica set +func (m *KubernetesReplicaSet) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *KubernetesReplicaSet) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *KubernetesReplicaSet) UnmarshalBinary(b []byte) error { + var res KubernetesReplicaSet + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/marathon_app_status.go b/pkg/paastaapi/models/marathon_app_status.go new file mode 100644 index 0000000..e04b0bc --- /dev/null +++ b/pkg/paastaapi/models/marathon_app_status.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MarathonAppStatus marathon app status +// +// swagger:model MarathonAppStatus +type MarathonAppStatus struct { + + // Backoff in seconds before launching next task + BackoffSeconds int32 `json:"backoff_seconds,omitempty"` + + // Unix timestamp when this app was created + CreateTimestamp float32 `json:"create_timestamp,omitempty"` + + // Marathon dashboard URL for this app + DashboardURL string `json:"dashboard_url,omitempty"` + + // Deploy status of this app + DeployStatus string `json:"deploy_status,omitempty"` + + // Tasks associated to this app + Tasks []*MarathonTask `json:"tasks"` + + // Number of healthy tasks for this app + TasksHealthy int32 `json:"tasks_healthy,omitempty"` + + // Number running tasks for this app + TasksRunning int32 `json:"tasks_running,omitempty"` + + // Number of staged tasks for this app + TasksStaged int32 `json:"tasks_staged,omitempty"` + + // Total number of tasks for this app + TasksTotal int32 `json:"tasks_total,omitempty"` + + // Mapping of reason offer was refused to the number of times that type of refusal was seen + UnusedOfferReasonCounts interface{} `json:"unused_offer_reason_counts,omitempty"` +} + +// Validate validates this marathon app status +func (m *MarathonAppStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTasks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MarathonAppStatus) validateTasks(formats strfmt.Registry) error { + + if swag.IsZero(m.Tasks) { // not required + return nil + } + + for i := 0; i < len(m.Tasks); i++ { + if swag.IsZero(m.Tasks[i]) { // not required + continue + } + + if m.Tasks[i] != nil { + if err := m.Tasks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tasks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MarathonAppStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MarathonAppStatus) UnmarshalBinary(b []byte) error { + var res MarathonAppStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/marathon_autoscaling_info.go b/pkg/paastaapi/models/marathon_autoscaling_info.go new file mode 100644 index 0000000..cfe69c0 --- /dev/null +++ b/pkg/paastaapi/models/marathon_autoscaling_info.go @@ -0,0 +1,55 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MarathonAutoscalingInfo marathon autoscaling info +// +// swagger:model MarathonAutoscalingInfo +type MarathonAutoscalingInfo struct { + + // The number of instances of the service currently running + CurrentInstances int32 `json:"current_instances,omitempty"` + + // The current utilization of the instances' allocated resources + CurrentUtilization float32 `json:"current_utilization,omitempty"` + + // The maximum number of instances that the autoscaler will scale to + MaxInstances int32 `json:"max_instances,omitempty"` + + // The minimum number of instances that the autoscaler will scale to + MinInstances int32 `json:"min_instances,omitempty"` + + // The autoscaler's current target number of instances of this service to run + TargetInstances int32 `json:"target_instances,omitempty"` +} + +// Validate validates this marathon autoscaling info +func (m *MarathonAutoscalingInfo) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MarathonAutoscalingInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MarathonAutoscalingInfo) UnmarshalBinary(b []byte) error { + var res MarathonAutoscalingInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/marathon_dashboard.go b/pkg/paastaapi/models/marathon_dashboard.go new file mode 100644 index 0000000..090d427 --- /dev/null +++ b/pkg/paastaapi/models/marathon_dashboard.go @@ -0,0 +1,42 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// MarathonDashboard A list of Marathon service, instance, and shard url for one or more clusters +// +// swagger:model MarathonDashboard +type MarathonDashboard map[string]MarathonDashboardCluster + +// Validate validates this marathon dashboard +func (m MarathonDashboard) Validate(formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := validate.Required(k, "body", m[k]); err != nil { + return err + } + + if err := m[k].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } + return err + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/models/marathon_dashboard_cluster.go b/pkg/paastaapi/models/marathon_dashboard_cluster.go new file mode 100644 index 0000000..c72ca00 --- /dev/null +++ b/pkg/paastaapi/models/marathon_dashboard_cluster.go @@ -0,0 +1,45 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MarathonDashboardCluster List of all the MarathonDashboardItems for a cluster +// +// swagger:model MarathonDashboardCluster +type MarathonDashboardCluster []*MarathonDashboardItem + +// Validate validates this marathon dashboard cluster +func (m MarathonDashboardCluster) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/models/marathon_dashboard_item.go b/pkg/paastaapi/models/marathon_dashboard_item.go new file mode 100644 index 0000000..7a3d453 --- /dev/null +++ b/pkg/paastaapi/models/marathon_dashboard_item.go @@ -0,0 +1,49 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MarathonDashboardItem Marathon service, instance, and shard url +// +// swagger:model MarathonDashboardItem +type MarathonDashboardItem struct { + + // Instance name + Instance string `json:"instance,omitempty"` + + // Service name + Service string `json:"service,omitempty"` + + // Marathon Shard URL + ShardURL string `json:"shard_url,omitempty"` +} + +// Validate validates this marathon dashboard item +func (m *MarathonDashboardItem) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MarathonDashboardItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MarathonDashboardItem) UnmarshalBinary(b []byte) error { + var res MarathonDashboardItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/marathon_mesos_nonrunning_task.go b/pkg/paastaapi/models/marathon_mesos_nonrunning_task.go new file mode 100644 index 0000000..79f6711 --- /dev/null +++ b/pkg/paastaapi/models/marathon_mesos_nonrunning_task.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MarathonMesosNonrunningTask marathon mesos nonrunning task +// +// swagger:model MarathonMesosNonrunningTask +type MarathonMesosNonrunningTask struct { + + // The unix timestamp at which the task was deployed + DeployedTimestamp float32 `json:"deployed_timestamp,omitempty"` + + // Name of the Mesos agent on which this task is running + Hostname string `json:"hostname,omitempty"` + + // The ID of the task in Mesos + ID string `json:"id,omitempty"` + + // The current state of the task + State string `json:"state,omitempty"` + + // Stdout and stderr tail of the task + TailLines *TaskTailLines `json:"tail_lines,omitempty"` +} + +// Validate validates this marathon mesos nonrunning task +func (m *MarathonMesosNonrunningTask) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTailLines(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MarathonMesosNonrunningTask) validateTailLines(formats strfmt.Registry) error { + + if swag.IsZero(m.TailLines) { // not required + return nil + } + + if m.TailLines != nil { + if err := m.TailLines.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tail_lines") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MarathonMesosNonrunningTask) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MarathonMesosNonrunningTask) UnmarshalBinary(b []byte) error { + var res MarathonMesosNonrunningTask + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/marathon_mesos_running_task.go b/pkg/paastaapi/models/marathon_mesos_running_task.go new file mode 100644 index 0000000..0f0f2b1 --- /dev/null +++ b/pkg/paastaapi/models/marathon_mesos_running_task.go @@ -0,0 +1,183 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MarathonMesosRunningTask marathon mesos running task +// +// swagger:model MarathonMesosRunningTask +type MarathonMesosRunningTask struct { + + // The portion of a CPU that the task can use + CPUShares *FloatAndError `json:"cpu_shares,omitempty"` + + // The number of seconds of CPU time the task has used + CPUUsedSeconds *FloatAndError `json:"cpu_used_seconds,omitempty"` + + // The unix timestamp at which the task was deployed + DeployedTimestamp float32 `json:"deployed_timestamp,omitempty"` + + // The duration over which the task has been running in seconds + DurationSeconds int32 `json:"duration_seconds,omitempty"` + + // Name of the Mesos agent on which this task is running + Hostname string `json:"hostname,omitempty"` + + // The ID of the task in Mesos + ID string `json:"id,omitempty"` + + // The maximum amount of memory the task is allowed to use + MemLimit *IntegerAndError `json:"mem_limit,omitempty"` + + // The tasks's resident set size + Rss *IntegerAndError `json:"rss,omitempty"` + + // Stdout and stderr tail of the task + TailLines *TaskTailLines `json:"tail_lines,omitempty"` +} + +// Validate validates this marathon mesos running task +func (m *MarathonMesosRunningTask) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCPUShares(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCPUUsedSeconds(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemLimit(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRss(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTailLines(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MarathonMesosRunningTask) validateCPUShares(formats strfmt.Registry) error { + + if swag.IsZero(m.CPUShares) { // not required + return nil + } + + if m.CPUShares != nil { + if err := m.CPUShares.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cpu_shares") + } + return err + } + } + + return nil +} + +func (m *MarathonMesosRunningTask) validateCPUUsedSeconds(formats strfmt.Registry) error { + + if swag.IsZero(m.CPUUsedSeconds) { // not required + return nil + } + + if m.CPUUsedSeconds != nil { + if err := m.CPUUsedSeconds.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cpu_used_seconds") + } + return err + } + } + + return nil +} + +func (m *MarathonMesosRunningTask) validateMemLimit(formats strfmt.Registry) error { + + if swag.IsZero(m.MemLimit) { // not required + return nil + } + + if m.MemLimit != nil { + if err := m.MemLimit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mem_limit") + } + return err + } + } + + return nil +} + +func (m *MarathonMesosRunningTask) validateRss(formats strfmt.Registry) error { + + if swag.IsZero(m.Rss) { // not required + return nil + } + + if m.Rss != nil { + if err := m.Rss.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rss") + } + return err + } + } + + return nil +} + +func (m *MarathonMesosRunningTask) validateTailLines(formats strfmt.Registry) error { + + if swag.IsZero(m.TailLines) { // not required + return nil + } + + if m.TailLines != nil { + if err := m.TailLines.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tail_lines") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MarathonMesosRunningTask) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MarathonMesosRunningTask) UnmarshalBinary(b []byte) error { + var res MarathonMesosRunningTask + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/marathon_mesos_status.go b/pkg/paastaapi/models/marathon_mesos_status.go new file mode 100644 index 0000000..2fcffac --- /dev/null +++ b/pkg/paastaapi/models/marathon_mesos_status.go @@ -0,0 +1,118 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MarathonMesosStatus marathon mesos status +// +// swagger:model MarathonMesosStatus +type MarathonMesosStatus struct { + + // Error message when Mesos tasks cannot be queried + ErrorMessage string `json:"error_message,omitempty"` + + // Non-running tasks associated to this service + NonRunningTasks []*MarathonMesosNonrunningTask `json:"non_running_tasks"` + + // The number of running Mesos tasks associated to this service + RunningTaskCount int32 `json:"running_task_count,omitempty"` + + // Currently running tasks associated to this service + RunningTasks []*MarathonMesosRunningTask `json:"running_tasks"` +} + +// Validate validates this marathon mesos status +func (m *MarathonMesosStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNonRunningTasks(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRunningTasks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MarathonMesosStatus) validateNonRunningTasks(formats strfmt.Registry) error { + + if swag.IsZero(m.NonRunningTasks) { // not required + return nil + } + + for i := 0; i < len(m.NonRunningTasks); i++ { + if swag.IsZero(m.NonRunningTasks[i]) { // not required + continue + } + + if m.NonRunningTasks[i] != nil { + if err := m.NonRunningTasks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("non_running_tasks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MarathonMesosStatus) validateRunningTasks(formats strfmt.Registry) error { + + if swag.IsZero(m.RunningTasks) { // not required + return nil + } + + for i := 0; i < len(m.RunningTasks); i++ { + if swag.IsZero(m.RunningTasks[i]) { // not required + continue + } + + if m.RunningTasks[i] != nil { + if err := m.RunningTasks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("running_tasks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MarathonMesosStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MarathonMesosStatus) UnmarshalBinary(b []byte) error { + var res MarathonMesosStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/marathon_task.go b/pkg/paastaapi/models/marathon_task.go new file mode 100644 index 0000000..903c1f0 --- /dev/null +++ b/pkg/paastaapi/models/marathon_task.go @@ -0,0 +1,55 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MarathonTask marathon task +// +// swagger:model MarathonTask +type MarathonTask struct { + + // Time at which the task was deployed + DeployedTimestamp float32 `json:"deployed_timestamp,omitempty"` + + // Name of the host on which the task is running + Host string `json:"host,omitempty"` + + // ID of the task in Mesos + ID string `json:"id,omitempty"` + + // Whether Marathon thinks the task is healthy + IsHealthy bool `json:"is_healthy,omitempty"` + + // Port on which the task is listening + Port int32 `json:"port,omitempty"` +} + +// Validate validates this marathon task +func (m *MarathonTask) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MarathonTask) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MarathonTask) UnmarshalBinary(b []byte) error { + var res MarathonTask + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/meta_status.go b/pkg/paastaapi/models/meta_status.go new file mode 100644 index 0000000..3257987 --- /dev/null +++ b/pkg/paastaapi/models/meta_status.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MetaStatus Result of `paasta metastatus` command +// +// swagger:model MetaStatus +type MetaStatus struct { + + // Exit code from `paasta metastatus` command + ExitCode int64 `json:"exit_code,omitempty"` + + // Output from `paasta metastatus` command + Output string `json:"output,omitempty"` +} + +// Validate validates this meta status +func (m *MetaStatus) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MetaStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MetaStatus) UnmarshalBinary(b []byte) error { + var res MetaStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/resource.go b/pkg/paastaapi/models/resource.go new file mode 100644 index 0000000..aa529c6 --- /dev/null +++ b/pkg/paastaapi/models/resource.go @@ -0,0 +1,45 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Resource resource +// +// swagger:model Resource +type Resource []*ResourceItem + +// Validate validates this resource +func (m Resource) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/paastaapi/models/resource_item.go b/pkg/paastaapi/models/resource_item.go new file mode 100644 index 0000000..b63b20b --- /dev/null +++ b/pkg/paastaapi/models/resource_item.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ResourceItem resource item +// +// swagger:model ResourceItem +type ResourceItem struct { + + // cpus + Cpus *ResourceValue `json:"cpus,omitempty"` + + // disk + Disk *ResourceValue `json:"disk,omitempty"` + + // groupings + Groupings interface{} `json:"groupings,omitempty"` + + // mem + Mem *ResourceValue `json:"mem,omitempty"` +} + +// Validate validates this resource item +func (m *ResourceItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCpus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDisk(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMem(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResourceItem) validateCpus(formats strfmt.Registry) error { + + if swag.IsZero(m.Cpus) { // not required + return nil + } + + if m.Cpus != nil { + if err := m.Cpus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cpus") + } + return err + } + } + + return nil +} + +func (m *ResourceItem) validateDisk(formats strfmt.Registry) error { + + if swag.IsZero(m.Disk) { // not required + return nil + } + + if m.Disk != nil { + if err := m.Disk.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disk") + } + return err + } + } + + return nil +} + +func (m *ResourceItem) validateMem(formats strfmt.Registry) error { + + if swag.IsZero(m.Mem) { // not required + return nil + } + + if m.Mem != nil { + if err := m.Mem.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mem") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ResourceItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ResourceItem) UnmarshalBinary(b []byte) error { + var res ResourceItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/resource_value.go b/pkg/paastaapi/models/resource_value.go new file mode 100644 index 0000000..4569060 --- /dev/null +++ b/pkg/paastaapi/models/resource_value.go @@ -0,0 +1,49 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ResourceValue resource value +// +// swagger:model ResourceValue +type ResourceValue struct { + + // free + Free float64 `json:"free,omitempty"` + + // total + Total float64 `json:"total,omitempty"` + + // used + Used float64 `json:"used,omitempty"` +} + +// Validate validates this resource value +func (m *ResourceValue) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ResourceValue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ResourceValue) UnmarshalBinary(b []byte) error { + var res ResourceValue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/smartstack_backend.go b/pkg/paastaapi/models/smartstack_backend.go new file mode 100644 index 0000000..74301d4 --- /dev/null +++ b/pkg/paastaapi/models/smartstack_backend.go @@ -0,0 +1,64 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SmartstackBackend smartstack backend +// +// swagger:model SmartstackBackend +type SmartstackBackend struct { + + // Check code reported by HAProxy + CheckCode string `json:"check_code,omitempty"` + + // Duration in ms of the last health check performed by HAProxy + CheckDuration int32 `json:"check_duration,omitempty"` + + // Status of last health check of the backend + CheckStatus string `json:"check_status,omitempty"` + + // Whether this backend has an associated task running + HasAssociatedTask bool `json:"has_associated_task,omitempty"` + + // Name of the host on which the backend is running + Hostname string `json:"hostname,omitempty"` + + // Seconds since last change in backend status + LastChange int32 `json:"last_change,omitempty"` + + // Port number on which the backend responds + Port int32 `json:"port,omitempty"` + + // Status of the backend in HAProxy + Status string `json:"status,omitempty"` +} + +// Validate validates this smartstack backend +func (m *SmartstackBackend) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SmartstackBackend) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SmartstackBackend) UnmarshalBinary(b []byte) error { + var res SmartstackBackend + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/smartstack_location.go b/pkg/paastaapi/models/smartstack_location.go new file mode 100644 index 0000000..fdc8b13 --- /dev/null +++ b/pkg/paastaapi/models/smartstack_location.go @@ -0,0 +1,86 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SmartstackLocation smartstack location +// +// swagger:model SmartstackLocation +type SmartstackLocation struct { + + // Smartstack backends running in this location + Backends []*SmartstackBackend `json:"backends"` + + // Name of the location + Name string `json:"name,omitempty"` + + // Number of running backends for the service in this location + RunningBackendsCount int32 `json:"running_backends_count,omitempty"` +} + +// Validate validates this smartstack location +func (m *SmartstackLocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBackends(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SmartstackLocation) validateBackends(formats strfmt.Registry) error { + + if swag.IsZero(m.Backends) { // not required + return nil + } + + for i := 0; i < len(m.Backends); i++ { + if swag.IsZero(m.Backends[i]) { // not required + continue + } + + if m.Backends[i] != nil { + if err := m.Backends[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("backends" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SmartstackLocation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SmartstackLocation) UnmarshalBinary(b []byte) error { + var res SmartstackLocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/smartstack_status.go b/pkg/paastaapi/models/smartstack_status.go new file mode 100644 index 0000000..15f963e --- /dev/null +++ b/pkg/paastaapi/models/smartstack_status.go @@ -0,0 +1,86 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SmartstackStatus smartstack status +// +// swagger:model SmartstackStatus +type SmartstackStatus struct { + + // Number of backends expected to be present in each location + ExpectedBackendsPerLocation int32 `json:"expected_backends_per_location,omitempty"` + + // Locations the service is deployed + Locations []*SmartstackLocation `json:"locations"` + + // Registration name of the service in Smartstack + Registration string `json:"registration,omitempty"` +} + +// Validate validates this smartstack status +func (m *SmartstackStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocations(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SmartstackStatus) validateLocations(formats strfmt.Registry) error { + + if swag.IsZero(m.Locations) { // not required + return nil + } + + for i := 0; i < len(m.Locations); i++ { + if swag.IsZero(m.Locations[i]) { // not required + continue + } + + if m.Locations[i] != nil { + if err := m.Locations[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("locations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SmartstackStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SmartstackStatus) UnmarshalBinary(b []byte) error { + var res SmartstackStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/paastaapi/models/task_tail_lines.go b/pkg/paastaapi/models/task_tail_lines.go new file mode 100644 index 0000000..1166d9d --- /dev/null +++ b/pkg/paastaapi/models/task_tail_lines.go @@ -0,0 +1,49 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TaskTailLines task tail lines +// +// swagger:model TaskTailLines +type TaskTailLines struct { + + // Error message when fetching tail lines fails + ErrorMessage string `json:"error_message,omitempty"` + + // The requested number of lines from the task's stderr + Stderr []string `json:"stderr"` + + // The requested number of lines from the task's stdout + Stdout []string `json:"stdout"` +} + +// Validate validates this task tail lines +func (m *TaskTailLines) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TaskTailLines) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TaskTailLines) UnmarshalBinary(b []byte) error { + var res TaskTailLines + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagger.json b/swagger.json new file mode 100644 index 0000000..ced2b17 --- /dev/null +++ b/swagger.json @@ -0,0 +1,1682 @@ +{ + "swagger": "2.0", + "info": { + "title": "Paasta API", + "version": "1.0.0" + }, + "basePath": "/v1", + "schemes": [ + "http" + ], + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json" + ], + "tags": [ + { + "name": "service", + "description": "information about a paasta service" + } + ], + "paths": { + "/version": { + "get": { + "responses": { + "200": { + "description": "Version of paasta_tools package", + "schema": { + "type": "string" + } + } + }, + "summary": "Version of paasta_tools package", + "operationId": "showVersion" + } + }, + "/metastatus": { + "get": { + "parameters": [ + { + "in": "query", + "description": "comma separated list of command arguments", + "name": "cmd_args", + "required": true, + "type": "array", + "collectionFormat": "csv", + "items": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Detailed metastatus", + "schema": { + "$ref": "#/definitions/MetaStatus" + } + }, + "500": { + "description": "Metastatus failure" + } + }, + "summary": "Get metastatus", + "operationId": "metastatus" + } + }, + "/deploy_queue": { + "get": { + "responses": { + "200": { + "description": "Contents of deploy queue", + "schema": { + "$ref": "#/definitions/DeployQueue" + } + } + }, + "summary": "Get deploy queue contents", + "operationId": "deploy_queue" + } + }, + "/service_autoscaler/pause": { + "get": { + "responses": { + "200": { + "description": "The time until which the servcie autoscaler is paused for", + "schema": { + "type": "string" + } + }, + "500": { + "description": "Unable to talk to zookeeper" + } + }, + "summary": "Get autoscaling pause time", + "operationId": "get_service_autoscaler_pause" + }, + "post": { + "responses": { + "200": { + "description": "Service autoscaler successfully paused" + }, + "500": { + "description": "Unable to talk to zookeeper" + } + }, + "operationId": "update_service_autoscaler_pause", + "parameters": [ + { + "in": "body", + "name": "json_body", + "required": true, + "schema": { + "type": "object", + "properties": { + "minutes": { + "type": "integer" + } + } + } + } + ] + }, + "delete": { + "responses": { + "200": { + "description": "Service autoscaler successfully unpaused" + }, + "500": { + "description": "Unable to talk to zookeeper" + } + }, + "summary": "Unpause the autoscaler", + "operationId": "delete_service_autoscaler_pause" + } + }, + "/marathon_dashboard": { + "get": { + "responses": { + "200": { + "description": "List of service instances and information on their Marathon shard", + "schema": { + "$ref": "#/definitions/MarathonDashboard" + } + } + }, + "summary": "Get marathon service instances and their shards", + "operationId": "marathon_dashboard", + "tags": [ + "marathon_dashboard" + ] + } + }, + "/resources/utilization": { + "get": { + "responses": { + "200": { + "description": "Resources in the cluster, filtered and grouped by parameters", + "schema": { + "$ref": "#/definitions/Resource" + } + }, + "400": { + "description": "Poorly formated query parameters" + } + }, + "summary": "Get resources in the cluster", + "operationId": "resources", + "tags": [ + "resources" + ], + "parameters": [ + { + "in": "query", + "description": "comma separated list of keys to group by", + "name": "groupings", + "required": false, + "type": "array", + "collectionFormat": "csv", + "items": { + "type": "string" + } + }, + { + "in": "query", + "description": "List of slave filters in format 'filter=attr_name:value1,value2&filter=attr2:value3,value4'. Matches attr_name=(value1 OR value2) AND attr2=(value3 OR value4)", + "name": "filter", + "required": false, + "type": "array", + "collectionFormat": "multi", + "items": { + "type": "string", + "pattern": "(.*):(.*,)*(.*)" + } + } + ] + } + }, + "/services": { + "get": { + "responses": { + "200": { + "description": "Services and their instances on the current cluster", + "schema": { + "type": "object", + "properties": { + "services": { + "type": "array", + "items": { + "type": "array", + "items": {} + } + } + } + } + } + }, + "summary": "List service names and service instance names on the current cluster", + "operationId": "list_services_for_cluster", + "tags": [ + "service" + ] + } + }, + "/services/{service}": { + "get": { + "responses": { + "200": { + "description": "Instances of a service", + "schema": { + "type": "object", + "properties": { + "instances": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + }, + "summary": "List instances of service_name", + "operationId": "list_instances", + "tags": [ + "service" + ], + "parameters": [ + { + "in": "path", + "description": "Service name", + "name": "service", + "required": true, + "type": "string" + } + ] + } + }, + "/services/{service}/{instance}/state/{desired_state}": { + "post": { + "responses": { + "200": { + "description": "Result of instance state change" + }, + "404": { + "description": "Deployment key not found" + }, + "500": { + "description": "Instance failure" + } + }, + "summary": "Change state of service_name.instance_name", + "operationId": "instance_set_state", + "tags": [ + "service" + ], + "parameters": [ + { + "in": "path", + "description": "Service name", + "name": "service", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "Instance name", + "name": "instance", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "Desired state", + "name": "desired_state", + "required": true, + "type": "string" + } + ] + } + }, + "/services/{service}/{instance}/status": { + "get": { + "responses": { + "200": { + "description": "Detailed status of an instance", + "schema": { + "$ref": "#/definitions/InstanceStatus" + } + }, + "404": { + "description": "Deployment key not found" + }, + "500": { + "description": "Instance failure" + } + }, + "summary": "Get status of service_name.instance_name", + "operationId": "status_instance", + "tags": [ + "service" + ], + "parameters": [ + { + "in": "path", + "description": "Service name", + "name": "service", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "Instance name", + "name": "instance", + "required": true, + "type": "string" + }, + { + "in": "query", + "description": "Include verbose status information", + "name": "verbose", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "in": "query", + "description": "Include Smartstack information", + "name": "include_smartstack", + "required": false, + "type": "boolean" + }, + { + "in": "query", + "description": "Include Envoy information", + "name": "include_envoy", + "required": false, + "type": "boolean" + }, + { + "in": "query", + "description": "Include Mesos information", + "name": "include_mesos", + "required": false, + "type": "boolean" + } + ] + } + }, + "/services/{service}/{instance}/delay": { + "get": { + "responses": { + "200": { + "description": "The service is delayed for these possible reasons", + "schema": { + "$ref": "#/definitions/InstanceDelay" + } + }, + "204": { + "description": "Could not find any reasons for a delay" + }, + "404": { + "description": "Deployment key not found" + }, + "500": { + "description": "Instance failure" + } + }, + "summary": "Get the possible reasons for a deployment delay for a marathon service.instance", + "operationId": "delay_instance", + "tags": [ + "service" + ], + "parameters": [ + { + "in": "path", + "description": "Service name", + "name": "service", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "Instance name", + "name": "instance", + "required": true, + "type": "string" + } + ] + } + }, + "/services/{service}/{instance}/tasks": { + "get": { + "responses": { + "200": { + "description": "List of tasks associated with an instance", + "schema": { + "$ref": "#/definitions/InstanceTasks" + } + }, + "400": { + "description": "Bad request" + }, + "404": { + "description": "Deployment key not found" + }, + "500": { + "description": "Instance failure" + } + }, + "summary": "Get mesos tasks of service_name.instance_name", + "operationId": "tasks_instance", + "tags": [ + "service" + ], + "parameters": [ + { + "in": "path", + "description": "Service name", + "name": "service", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "Instance name", + "name": "instance", + "required": true, + "type": "string" + }, + { + "in": "query", + "description": "slave hostname to filter tasks by", + "name": "slave_hostname", + "required": false, + "type": "string" + }, + { + "in": "query", + "description": "Return slave and executor for task", + "name": "verbose", + "required": false, + "type": "boolean" + } + ] + } + }, + "/services/{service}/{instance}/tasks/{task_id}": { + "get": { + "responses": { + "200": { + "description": "Task associated with an instance with specified ID", + "schema": { + "$ref": "#/definitions/InstanceTask" + } + }, + "400": { + "description": "Bad request" + }, + "404": { + "description": "Task with ID not found" + }, + "500": { + "description": "Instance failure" + } + }, + "summary": "Get mesos task of service_name.instance_name by task_id", + "operationId": "task_instance", + "tags": [ + "service" + ], + "parameters": [ + { + "in": "path", + "description": "Service name", + "name": "service", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "Instance name", + "name": "instance", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "mesos task id", + "name": "task_id", + "required": true, + "type": "string" + }, + { + "in": "query", + "description": "Return slave and executor for task", + "name": "verbose", + "required": false, + "type": "boolean" + } + ] + } + }, + "/services/{service}/{instance}/autoscaler": { + "get": { + "responses": { + "200": { + "description": "Get desired instance count for a service instance", + "schema": { + "type": "object", + "properties": { + "desired_instances": { + "type": "integer" + } + } + } + }, + "404": { + "description": "Deployment key not found" + }, + "500": { + "description": "Instance failure" + } + }, + "summary": "Get status of service_name.instance_name", + "operationId": "get_autoscaler_count", + "tags": [ + "autoscaler" + ], + "parameters": [ + { + "in": "path", + "description": "Service name", + "name": "service", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "Instance name", + "name": "instance", + "required": true, + "type": "string" + } + ] + }, + "post": { + "responses": { + "202": { + "description": "Set desired instance count for a service instance", + "schema": { + "type": "object", + "properties": { + "desired_instances": { + "type": "integer" + }, + "status": { + "type": "string" + } + } + } + }, + "404": { + "description": "Deployment key not found" + }, + "500": { + "description": "Instance failure" + } + }, + "summary": "Get status of service_name.instance_name", + "operationId": "update_autoscaler_count", + "tags": [ + "autoscaler" + ], + "parameters": [ + { + "in": "path", + "description": "Service name", + "name": "service", + "required": true, + "type": "string" + }, + { + "in": "path", + "description": "Instance name", + "name": "instance", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "json_body", + "required": true, + "schema": { + "type": "object", + "properties": { + "desired_instances": { + "type": "integer" + }, + "calculated_instances": { + "type": "integer" + } + } + } + } + ] + } + } + }, + "definitions": { + "InstanceStatus": { + "type": "object", + "properties": { + "service": { + "type": "string", + "description": "Service name" + }, + "instance": { + "type": "string", + "description": "Instance name" + }, + "git_sha": { + "type": "string", + "description": "Git sha of a service" + }, + "marathon": { + "$ref": "#/definitions/InstanceStatusMarathon", + "description": "Marathon instance status" + }, + "kubernetes": { + "$ref": "#/definitions/InstanceStatusKubernetes", + "description": "Kubernetes instance status" + }, + "tron": { + "$ref": "#/definitions/InstanceStatusTron", + "description": "Tron instance status" + }, + "adhoc": { + "$ref": "#/definitions/InstanceStatusAdhoc", + "description": "Adhoc instance status" + }, + "flink": { + "type": "object", + "properties": { + "status": { + "$ref": "#/definitions/InstanceStatusFlinkStatus" + }, + "metadata": { + "$ref": "#/definitions/InstanceStatusFlinkMetadata" + } + }, + "description": "Nullable Flink instance status and metadata" + }, + "kafkacluster": { + "type": "object", + "properties": { + "status": { + "$ref": "#/definitions/InstanceStatusKafkaCluster" + }, + "metadata": { + "$ref": "#/definitions/InstanceMetadataKafkaCluster" + } + }, + "description": "Nullable KafkaCluster instance status and metadata" + } + } + }, + "InstanceDelay": { + "type": "object" + }, + "InstanceStatusMarathon": { + "type": "object", + "properties": { + "desired_state": { + "type": "string", + "description": "Desired state of a service, for Marathon", + "enum": [ + "start", + "stop" + ] + }, + "app_count": { + "type": "integer", + "format": "int32", + "description": "The number of different running versions of the same service (0 for stopped, 1 for running and 1+ for bouncing)" + }, + "desired_app_id": { + "type": "string", + "description": "ID of the desired version of a service instance" + }, + "bounce_method": { + "type": "string", + "description": "Method to transit between new and old versions of a service", + "enum": [ + "brutal", + "upthendown", + "downthenup", + "crossover" + ] + }, + "deploy_status": { + "type": "string", + "description": "Deploy status of a marathon service", + "enum": [ + "Running", + "Deploying", + "Stopped", + "Delayed", + "Waiting", + "Waiting for bounce", + "NotRunning" + ] + }, + "backoff_seconds": { + "type": "integer", + "format": "int32", + "description": "backoff in seconds before launching the next task" + }, + "running_instance_count": { + "type": "integer", + "format": "int32", + "description": "The number of actual running instances of the service" + }, + "expected_instance_count": { + "type": "integer", + "format": "int32", + "description": "The number of desired instances of the service" + }, + "autoscaling_info": { + "$ref": "#/definitions/MarathonAutoscalingInfo", + "description": "Autoscaling information for the service" + }, + "app_statuses": { + "type": "array", + "description": "Statuses of each app of the service", + "items": { + "$ref": "#/definitions/MarathonAppStatus" + } + }, + "mesos": { + "$ref": "#/definitions/MarathonMesosStatus", + "description": "Status of the service in Mesos" + }, + "smartstack": { + "$ref": "#/definitions/SmartstackStatus", + "description": "Status of the service in smartstack" + }, + "envoy": { + "$ref": "#/definitions/EnvoyStatus", + "description": "Status of the service in Envoy" + }, + "error_message": { + "type": "string", + "description": "Error message when a marathon job ID cannot be found" + } + }, + "required": [ + "desired_state", + "app_count", + "bounce_method" + ] + }, + "MarathonMesosStatus": { + "type": "object", + "properties": { + "running_task_count": { + "type": "integer", + "format": "int32", + "description": "The number of running Mesos tasks associated to this service" + }, + "running_tasks": { + "type": "array", + "description": "Currently running tasks associated to this service", + "items": { + "$ref": "#/definitions/MarathonMesosRunningTask" + } + }, + "non_running_tasks": { + "type": "array", + "description": "Non-running tasks associated to this service", + "items": { + "$ref": "#/definitions/MarathonMesosNonrunningTask" + } + }, + "error_message": { + "type": "string", + "description": "Error message when Mesos tasks cannot be queried" + } + } + }, + "MarathonMesosRunningTask": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the task in Mesos" + }, + "hostname": { + "type": "string", + "description": "Name of the Mesos agent on which this task is running" + }, + "mem_limit": { + "$ref": "#/definitions/IntegerAndError", + "description": "The maximum amount of memory the task is allowed to use" + }, + "rss": { + "$ref": "#/definitions/IntegerAndError", + "description": "The tasks's resident set size" + }, + "cpu_shares": { + "$ref": "#/definitions/FloatAndError", + "description": "The portion of a CPU that the task can use" + }, + "cpu_used_seconds": { + "$ref": "#/definitions/FloatAndError", + "description": "The number of seconds of CPU time the task has used" + }, + "duration_seconds": { + "type": "integer", + "format": "int32", + "description": "The duration over which the task has been running in seconds" + }, + "deployed_timestamp": { + "type": "number", + "format": "float", + "description": "The unix timestamp at which the task was deployed" + }, + "tail_lines": { + "$ref": "#/definitions/TaskTailLines", + "description": "Stdout and stderr tail of the task" + } + } + }, + "MarathonMesosNonrunningTask": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the task in Mesos" + }, + "hostname": { + "type": "string", + "description": "Name of the Mesos agent on which this task is running" + }, + "deployed_timestamp": { + "type": "number", + "format": "float", + "description": "The unix timestamp at which the task was deployed" + }, + "state": { + "type": "string", + "description": "The current state of the task" + }, + "tail_lines": { + "$ref": "#/definitions/TaskTailLines", + "description": "Stdout and stderr tail of the task" + } + } + }, + "TaskTailLines": { + "type": "object", + "properties": { + "stdout": { + "type": "array", + "description": "The requested number of lines from the task's stdout", + "items": { + "type": "string" + } + }, + "stderr": { + "type": "array", + "description": "The requested number of lines from the task's stderr", + "items": { + "type": "string" + } + }, + "error_message": { + "type": "string", + "description": "Error message when fetching tail lines fails" + } + } + }, + "MarathonAutoscalingInfo": { + "type": "object", + "properties": { + "current_instances": { + "type": "integer", + "format": "int32", + "description": "The number of instances of the service currently running" + }, + "max_instances": { + "type": "integer", + "format": "int32", + "description": "The maximum number of instances that the autoscaler will scale to" + }, + "min_instances": { + "type": "integer", + "format": "int32", + "description": "The minimum number of instances that the autoscaler will scale to" + }, + "current_utilization": { + "type": "number", + "format": "float", + "description": "The current utilization of the instances' allocated resources" + }, + "target_instances": { + "type": "integer", + "format": "int32", + "description": "The autoscaler's current target number of instances of this service to run" + } + } + }, + "MarathonAppStatus": { + "type": "object", + "properties": { + "tasks_running": { + "type": "integer", + "format": "int32", + "description": "Number running tasks for this app" + }, + "tasks_healthy": { + "type": "integer", + "format": "int32", + "description": "Number of healthy tasks for this app" + }, + "tasks_staged": { + "type": "integer", + "format": "int32", + "description": "Number of staged tasks for this app" + }, + "tasks_total": { + "type": "integer", + "format": "int32", + "description": "Total number of tasks for this app" + }, + "create_timestamp": { + "type": "number", + "format": "float", + "description": "Unix timestamp when this app was created" + }, + "deploy_status": { + "type": "string", + "description": "Deploy status of this app" + }, + "dashboard_url": { + "type": "string", + "description": "Marathon dashboard URL for this app" + }, + "backoff_seconds": { + "type": "integer", + "format": "int32", + "description": "Backoff in seconds before launching next task" + }, + "unused_offer_reason_counts": { + "type": "object", + "description": "Mapping of reason offer was refused to the number of times that type of refusal was seen" + }, + "tasks": { + "type": "array", + "description": "Tasks associated to this app", + "items": { + "$ref": "#/definitions/MarathonTask" + } + } + } + }, + "MarathonTask": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "ID of the task in Mesos" + }, + "host": { + "type": "string", + "description": "Name of the host on which the task is running" + }, + "port": { + "type": "integer", + "format": "int32", + "description": "Port on which the task is listening" + }, + "deployed_timestamp": { + "type": "number", + "format": "float", + "description": "Time at which the task was deployed" + }, + "is_healthy": { + "type": "boolean", + "description": "Whether Marathon thinks the task is healthy" + } + } + }, + "SmartstackStatus": { + "type": "object", + "properties": { + "registration": { + "type": "string", + "description": "Registration name of the service in Smartstack" + }, + "expected_backends_per_location": { + "type": "integer", + "format": "int32", + "description": "Number of backends expected to be present in each location" + }, + "locations": { + "type": "array", + "description": "Locations the service is deployed", + "items": { + "$ref": "#/definitions/SmartstackLocation" + } + } + } + }, + "SmartstackLocation": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the location" + }, + "running_backends_count": { + "type": "integer", + "format": "int32", + "description": "Number of running backends for the service in this location" + }, + "backends": { + "type": "array", + "description": "Smartstack backends running in this location", + "items": { + "$ref": "#/definitions/SmartstackBackend" + } + } + } + }, + "SmartstackBackend": { + "type": "object", + "properties": { + "hostname": { + "type": "string", + "description": "Name of the host on which the backend is running" + }, + "port": { + "type": "integer", + "format": "int32", + "description": "Port number on which the backend responds" + }, + "status": { + "type": "string", + "description": "Status of the backend in HAProxy" + }, + "check_status": { + "type": "string", + "description": "Status of last health check of the backend" + }, + "check_code": { + "type": "string", + "description": "Check code reported by HAProxy" + }, + "check_duration": { + "type": "integer", + "format": "int32", + "description": "Duration in ms of the last health check performed by HAProxy" + }, + "last_change": { + "type": "integer", + "format": "int32", + "description": "Seconds since last change in backend status" + }, + "has_associated_task": { + "type": "boolean", + "description": "Whether this backend has an associated task running" + } + } + }, + "EnvoyStatus": { + "type": "object", + "properties": { + "registration": { + "type": "string", + "description": "Registration name of the service in Smartstack" + }, + "expected_backends_per_location": { + "type": "integer", + "format": "int32", + "description": "Number of backends expected to be present in each location" + }, + "locations": { + "type": "array", + "description": "Locations the service is deployed", + "items": { + "$ref": "#/definitions/EnvoyLocation" + } + } + } + }, + "EnvoyLocation": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the location" + }, + "running_backends_count": { + "type": "integer", + "format": "int32", + "description": "Number of running backends for the service in this location" + }, + "backends": { + "type": "array", + "description": "Envoy backends running in this location", + "items": { + "$ref": "#/definitions/EnvoyBackend" + } + }, + "is_proxied_through_casper": { + "type": "boolean", + "description": "Whether this backend is proxied through Casper" + } + } + }, + "EnvoyBackend": { + "type": "object", + "properties": { + "address": { + "type": "string", + "description": "Address of the host on which the backend is running" + }, + "port_value": { + "type": "integer", + "format": "int32", + "description": "Port number on which the backend responds" + }, + "hostname": { + "type": "string", + "description": "Name of the host on which the backend is running" + }, + "eds_health_status": { + "type": "string", + "description": "Status of the backend in Envoy as reported by the EDS" + }, + "weight": { + "type": "integer", + "format": "int32", + "description": "The weight of this backend in the cluster" + }, + "has_associated_task": { + "type": "boolean", + "description": "Whether this backend has an associated task running" + } + } + }, + "InstanceStatusKubernetes": { + "type": "object", + "properties": { + "desired_state": { + "type": "string", + "description": "Desired state of a service, for Kubernetes", + "enum": [ + "start", + "stop" + ] + }, + "app_count": { + "type": "integer", + "format": "int32", + "description": "The number of different running versions of the same service (0 for stopped, 1 for running and 1+ for bouncing)" + }, + "app_id": { + "type": "string", + "description": "ID of the desired version of a service instance" + }, + "bounce_method": { + "type": "string", + "description": "Method to transit between new and old versions of a service", + "enum": [ + "brutal", + "upthendown", + "downthenup", + "crossover" + ] + }, + "deploy_status": { + "type": "string", + "description": "Deploy status of a Kubernetes service", + "enum": [ + "Running", + "Deploying", + "Stopped", + "Delayed", + "Waiting", + "NotRunning" + ] + }, + "deploy_status_message": { + "type": "string", + "description": "Reason for the deploy status" + }, + "backoff_seconds": { + "type": "integer", + "format": "int32", + "description": "backoff in seconds before launching the next task" + }, + "running_instance_count": { + "type": "integer", + "format": "int32", + "description": "The number of actual running instances of the service" + }, + "expected_instance_count": { + "type": "integer", + "format": "int32", + "description": "The number of desired instances of the service" + }, + "create_timestamp": { + "type": "number", + "format": "float", + "description": "Unix timestamp when this app was created" + }, + "smartstack": { + "$ref": "#/definitions/SmartstackStatus", + "description": "Status of the service in smartstack" + }, + "namespace": { + "type": "string", + "description": "The namespace this app is running" + }, + "replicasets": { + "type": "array", + "description": "ReplicaSets associated to this app", + "items": { + "$ref": "#/definitions/KubernetesReplicaSet" + } + }, + "pods": { + "type": "array", + "description": "Pods associated to this app", + "items": { + "$ref": "#/definitions/KubernetesPod" + } + }, + "autoscaling_status": { + "type": "object", + "description": "HPA associated to this app", + "properties": { + "min_instances": { + "type": "integer", + "description": "min_instances as specified in yelpsoa_configs" + }, + "max_instances": { + "type": "integer", + "description": "min_instances as specified in yelpsoa_configs" + }, + "desired_replicas": { + "type": "integer", + "description": "desired number of _instances as calculated by HPA" + }, + "last_scale_time": { + "type": "string", + "description": "timestamp of last autoscale" + }, + "metrics": { + "type": "array", + "description": "Current metrics", + "items": { + "$ref": "#/definitions/HPAMetric" + } + } + } + }, + "error_message": { + "type": "string", + "description": "Error message when a kubernetes object (Deployment/Statefulset) cannot be found" + } + }, + "required": [ + "desired_state", + "app_count", + "bounce_method" + ] + }, + "HPAMetric": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "name of the metric" + }, + "target_value": { + "type": "string", + "description": "setpoint/target_value as specified in yelpsoa_configs" + }, + "current_value": { + "type": "string", + "description": "setpoint/target_value as specified in yelpsoa_configs" + } + } + }, + "KubernetesReplicaSet": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "name of the replicaset in Kubernetes" + }, + "ready_replicas": { + "type": "integer", + "format": "int32", + "description": "number of ready replicas for the replicaset" + }, + "replicas": { + "type": "integer", + "format": "int32", + "description": "number of desired replicas for the replicaset" + }, + "create_timestamp": { + "type": "number", + "format": "float", + "description": "Time at which the replicaset was created" + } + } + }, + "KubernetesPod": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "name of the pod in Kubernetes" + }, + "host": { + "type": "string", + "description": "name of the pod's host" + }, + "deployed_timestamp": { + "type": "number", + "format": "float", + "description": "Time at which the pod was deployed" + }, + "phase": { + "type": "string", + "description": "The status of the pod" + }, + "ready": { + "type": "boolean", + "description": "Whether or not the pod is ready (i.e. all containers up)" + }, + "containers": { + "type": "array", + "items": { + "$ref": "#/definitions/KubernetesContainer", + "description": "List of containers in the pod" + } + }, + "reason": { + "type": "string", + "x-nullable": true, + "description": "short message explaining the pod's state" + }, + "message": { + "type": "string", + "x-nullable": true, + "description": "long message explaining the pod's state" + } + } + }, + "KubernetesContainer": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the container" + }, + "tail_lines": { + "$ref": "#/definitions/TaskTailLines", + "description": "Stdout and stderr tail of the container" + } + } + }, + "InstanceStatusTron": { + "type": "object", + "required": [ + "job_name", + "job_url" + ], + "properties": { + "job_name": { + "type": "string", + "description": "The name of this job" + }, + "job_status": { + "type": "string", + "description": "The status of the job" + }, + "job_schedule": { + "type": "string", + "description": "The job schedule of the job" + }, + "job_url": { + "type": "string", + "description": "The dashboard url of the job" + }, + "action_name": { + "type": "string", + "description": "The name of the action" + }, + "action_state": { + "type": "string", + "description": "The state of the action" + }, + "action_raw_command": { + "type": "string", + "description": "The raw command of the action" + }, + "action_command": { + "type": "string", + "description": "The command of the action" + }, + "action_start_time": { + "type": "string", + "description": "The start time of the action" + }, + "action_stderr": { + "type": "string", + "description": "The stderr command of the action" + }, + "action_stdout": { + "type": "string", + "description": "The stdout command of the action" + } + } + }, + "InstanceStatusFlinkStatus": { + "type": "object", + "description": "Flink instance status" + }, + "InstanceStatusFlinkMetadata": { + "type": "object", + "description": "Flink instance metadata" + }, + "InstanceStatusKafkaCluster": { + "type": "object", + "description": "Kafka instance status" + }, + "InstanceMetadataKafkaCluster": { + "type": "object", + "description": "Kafka instance metadata" + }, + "InstanceSpecKafkaCluster": { + "type": "object", + "description": "Kafka instance spec" + }, + "InstanceTasks": { + "type": "array", + "description": "List of tasks associated with instance", + "items": { + "$ref": "#/definitions/InstanceTask" + } + }, + "InstanceTask": { + "type": "object" + }, + "InstanceStatusAdhoc": { + "type": "array", + "description": "List of runs associated with job", + "items": { + "$ref": "#/definitions/AdhocLaunchHistory" + } + }, + "AdhocLaunchHistory": { + "type": "object", + "description": "A single run", + "properties": { + "launch_time": { + "type": "string", + "description": "when the job was launched" + }, + "run_id": { + "type": "string", + "description": "id of the single run" + }, + "framework_id": { + "type": "string", + "description": "framework id" + } + } + }, + "MarathonDashboard": { + "type": "object", + "description": "A list of Marathon service, instance, and shard url for one or more clusters", + "additionalProperties": { + "$ref": "#/definitions/MarathonDashboardCluster" + } + }, + "MarathonDashboardCluster": { + "type": "array", + "description": "List of all the MarathonDashboardItems for a cluster", + "items": { + "$ref": "#/definitions/MarathonDashboardItem" + } + }, + "MarathonDashboardItem": { + "type": "object", + "description": "Marathon service, instance, and shard url", + "properties": { + "service": { + "type": "string", + "description": "Service name" + }, + "instance": { + "type": "string", + "description": "Instance name" + }, + "shard_url": { + "type": "string", + "description": "Marathon Shard URL" + } + } + }, + "MetaStatus": { + "type": "object", + "description": "Result of `paasta metastatus` command", + "properties": { + "output": { + "type": "string", + "description": "Output from `paasta metastatus` command" + }, + "exit_code": { + "type": "integer", + "description": "Exit code from `paasta metastatus` command" + } + } + }, + "DeployQueue": { + "type": "object", + "description": "Current state of the deployd queue", + "properties": { + "available_service_instances": { + "type": "array", + "description": "Service instances that are ready to be acted on by deployd", + "items": { + "$ref": "#/definitions/DeployQueueServiceInstance" + } + }, + "unavailable_service_instances": { + "type": "array", + "description": "Service instances that deployd is waiting to act on", + "items": { + "$ref": "#/definitions/DeployQueueServiceInstance" + } + } + } + }, + "DeployQueueServiceInstance": { + "type": "object", + "description": "An instance of a service in the deploy queue", + "properties": { + "service": { + "type": "string", + "description": "Name of the service" + }, + "instance": { + "type": "string", + "description": "Name of the instance of the service" + }, + "bounce_by": { + "type": "number", + "format": "float", + "description": "Desired timestamp by which the service instance should be bounced" + }, + "wait_until": { + "type": "number", + "format": "float", + "description": "Timestamp before which no action should be taken on this service instance" + }, + "enqueue_time": { + "type": "number", + "format": "float", + "description": "Timestamp at which the service instance was last added to the queue" + }, + "bounce_start_time": { + "type": "number", + "format": "float", + "description": "Timestamp at which service instance was first added to the queue" + }, + "watcher": { + "type": "string", + "description": "The process that enqueued the task" + }, + "failures": { + "type": "integer", + "format": "int32", + "description": "Number of times deployment actions have failed on this service instance" + }, + "processed_count": { + "type": "integer", + "format": "int32", + "description": "Number of times any deployment action has been taken on this service instance" + } + } + }, + "Resource": { + "type": "array", + "items": { + "$ref": "#/definitions/ResourceItem" + } + }, + "ResourceItem": { + "type": "object", + "properties": { + "groupings": { + "type": "object" + }, + "cpus": { + "$ref": "#/definitions/ResourceValue" + }, + "mem": { + "$ref": "#/definitions/ResourceValue" + }, + "disk": { + "$ref": "#/definitions/ResourceValue" + } + } + }, + "ResourceValue": { + "type": "object", + "properties": { + "free": { + "type": "number" + }, + "used": { + "type": "number" + }, + "total": { + "type": "number" + } + } + }, + "FloatAndError": { + "type": "object", + "properties": { + "value": { + "type": "number", + "format": "float" + }, + "error_message": { + "type": "string" + } + } + }, + "IntegerAndError": { + "type": "object", + "properties": { + "value": { + "type": "integer", + "format": "int32" + }, + "error_message": { + "type": "string" + } + } + } + } +}