diff --git a/go.mod b/go.mod index 97d75520..f3362cfa 100644 --- a/go.mod +++ b/go.mod @@ -6,12 +6,17 @@ toolchain go1.23.2 require ( github.com/COSSAS/gauth v1.0.0 - github.com/eclipse/paho.mqtt.golang v1.4.3 - github.com/gin-contrib/cors v1.7.1 + github.com/eclipse/paho.mqtt.golang v1.5.0 + github.com/gin-contrib/cors v1.7.2 github.com/gin-gonic/gin v1.10.0 + github.com/go-openapi/errors v0.22.0 + github.com/go-openapi/runtime v0.28.0 + github.com/go-openapi/strfmt v0.23.0 + github.com/go-openapi/swag v0.23.0 + github.com/go-openapi/validate v0.24.0 github.com/go-playground/assert/v2 v2.2.0 - github.com/go-playground/validator/v10 v10.20.0 - github.com/google/uuid v1.3.1 + github.com/go-playground/validator/v10 v10.23.0 + github.com/google/uuid v1.6.0 github.com/joho/godotenv v1.5.1 github.com/masterzen/winrm v0.0.0-20240702205601-3fad6e106085 github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 @@ -20,17 +25,16 @@ require ( github.com/stretchr/testify v1.9.0 github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 - github.com/swaggo/swag v1.16.1 - go.mongodb.org/mongo-driver v1.12.1 - golang.org/x/crypto v0.31.0 + github.com/swaggo/swag v1.16.4 + go.mongodb.org/mongo-driver v1.17.1 + golang.org/x/crypto v0.29.0 ) require ( github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 // indirect github.com/KyleBanks/depth v1.2.1 // indirect - github.com/PuerkitoBio/purell v1.1.1 // indirect - github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/bodgit/ntlmssp v0.0.0-20240506230425-31973bb52d9b // indirect github.com/bodgit/windows v1.0.1 // indirect github.com/bytedance/sonic v1.11.6 // indirect @@ -43,18 +47,20 @@ require ( github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-jose/go-jose/v4 v4.0.2 // indirect github.com/go-logr/logr v1.4.1 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.19.6 // indirect - github.com/go-openapi/spec v0.20.4 // indirect - github.com/go-openapi/swag v0.19.15 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/analysis v0.23.0 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/loads v0.22.0 // indirect + github.com/go-openapi/spec v0.21.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/gofrs/uuid v4.4.0+incompatible // indirect - github.com/golang/snappy v0.0.1 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/gorilla/securecookie v1.1.2 // indirect github.com/gorilla/sessions v1.4.0 // indirect - github.com/gorilla/websocket v1.5.0 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect @@ -68,12 +74,15 @@ require ( github.com/klauspost/compress v1.13.6 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/mailru/easyjson v0.7.6 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect + github.com/montanaflynn/stats v0.7.1 // indirect + github.com/oklog/ulid v1.3.1 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.2 // indirect @@ -83,15 +92,17 @@ require ( github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect - github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect + github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/arch v0.8.0 // indirect golang.org/x/net v0.27.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/sync v0.9.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.20.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/protobuf v1.34.1 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index d9ee5118..937386b2 100644 --- a/go.sum +++ b/go.sum @@ -6,10 +6,8 @@ github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 h1:w0E0fgc1Y github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= -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-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/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/bodgit/ntlmssp v0.0.0-20240506230425-31973bb52d9b h1:baFN6AnR0SeC194X2D292IUZcHDs4JjStpqtE70fjXE= github.com/bodgit/ntlmssp v0.0.0-20240506230425-31973bb52d9b/go.mod h1:Ram6ngyPDmP+0t6+4T2rymv0w0BS9N8Ch5vvUJccw5o= github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4= @@ -24,18 +22,17 @@ github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI= github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/eclipse/paho.mqtt.golang v1.4.3 h1:2kwcUGn8seMUfWndX0hGbvH8r7crgcJguQNCyp70xik= -github.com/eclipse/paho.mqtt.golang v1.4.3/go.mod h1:CSYvoAlsMkhYOXh/oKyxa8EcBci6dVkLCbo5tTC1RIE= +github.com/eclipse/paho.mqtt.golang v1.5.0 h1:EH+bUVJNgttidWFkLLVKaQPGmkTUfQQqjOsyvMGvD6o= +github.com/eclipse/paho.mqtt.golang v1.5.0/go.mod h1:du/2qNQVqJf/Sqs4MEL77kR8QTqANF7XU7Fk0aOTAgk= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= -github.com/gin-contrib/cors v1.7.1 h1:s9SIppU/rk8enVvkzwiC2VK3UZ/0NNGsWfUKvV55rqs= -github.com/gin-contrib/cors v1.7.1/go.mod h1:n/Zj7B4xyrgk/cX1WCX2dkzFfaNm/xJb6oIUk7WTtps= +github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw= +github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E= github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -44,48 +41,60 @@ github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/go-jose/go-jose/v4 v4.0.2 h1:R3l3kkBds16bO7ZFAEEcofK0MkrAJt3jlJznWZG0nvk= github.com/go-jose/go-jose/v4 v4.0.2/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= -github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= -github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= -github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= -github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU= +github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco= +github.com/go-openapi/loads v0.22.0/go.mod h1:yLsaTCS92mnSAZX5WWoxszLj0u+Ojl+Zs5Stn1oF+rs= +github.com/go-openapi/runtime v0.28.0 h1:gpPPmWSNGo214l6n8hzdXYhPuJcGtziTOgUpvsFWGIQ= +github.com/go-openapi/runtime v0.28.0/go.mod h1:QN7OzcS+XuYmkQLw05akXk0jRH/eZ3kb18+1KwW9gyc= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= +github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58= +github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= -github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o= +github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ= github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -115,39 +124,39 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02 github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -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.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 h1:2ZKn+w/BJeL43sCxI2jhPLRv73oVVOjEKZjKkflyqxg= github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= github.com/masterzen/winrm v0.0.0-20240702205601-3fad6e106085 h1:PiQLLKX4vMYlJImDzJYtQScF2BbQ0GAjPIHCDqzHHHs= github.com/masterzen/winrm v0.0.0-20240702205601-3fad6e106085/go.mod h1:JajVhkiG2bYSNYYPYuWG7WZHr42CTjMTcCjfInRNCqc= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= +github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 h1:PKK9DyHxif4LZo+uQSgXNqs0jj5+xZwwfKHgph2lxBw= @@ -161,7 +170,6 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -173,8 +181,8 @@ github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M= github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo= -github.com/swaggo/swag v1.16.1 h1:fTNRhKstPKxcnoKsytm4sahr8FaYzUcT7i1/3nd/fBg= -github.com/swaggo/swag v1.16.1/go.mod h1:9/LMvHycG3NFHfR6LwvikHv5iFvmPADQ359cKikGxto= +github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A= +github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg= github.com/tidwall/transform v0.0.0-20201103190739-32f242e2dbde h1:AMNpJRc7P+GTwVbl8DkK2I9I8BBUzNiHuH/tlxrpan0= github.com/tidwall/transform v0.0.0-20201103190739-32f242e2dbde/go.mod h1:MvrEmduDUz4ST5pGZ7CABCnOU5f3ZiOAZzT6b1A6nX8= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= @@ -187,28 +195,33 @@ github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM= +github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= -go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= +go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM= +go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= @@ -218,52 +231,43 @@ golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= diff --git a/pkg/core/capability/caldera/api/client/abilities/abilities_client.go b/pkg/core/capability/caldera/api/client/abilities/abilities_client.go new file mode 100644 index 00000000..2557fc51 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/abilities_client.go @@ -0,0 +1,401 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new abilities API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new abilities API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new abilities API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for abilities API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2AbilitiesAbilityID(params *DeleteAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*DeleteAPIV2AbilitiesAbilityIDNoContent, error) + + GetAPIV2Abilities(params *GetAPIV2AbilitiesParams, opts ...ClientOption) (*GetAPIV2AbilitiesOK, error) + + GetAPIV2AbilitiesAbilityID(params *GetAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*GetAPIV2AbilitiesAbilityIDOK, error) + + HeadAPIV2Abilities(params *HeadAPIV2AbilitiesParams, opts ...ClientOption) (*HeadAPIV2AbilitiesOK, error) + + HeadAPIV2AbilitiesAbilityID(params *HeadAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*HeadAPIV2AbilitiesAbilityIDOK, error) + + PatchAPIV2AbilitiesAbilityID(params *PatchAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*PatchAPIV2AbilitiesAbilityIDOK, error) + + PostAPIV2Abilities(params *PostAPIV2AbilitiesParams, opts ...ClientOption) (*PostAPIV2AbilitiesOK, error) + + PutAPIV2AbilitiesAbilityID(params *PutAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*PutAPIV2AbilitiesAbilityIDOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2AbilitiesAbilityID deletes an ability + +Deletes an existing ability. +*/ +func (a *Client) DeleteAPIV2AbilitiesAbilityID(params *DeleteAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*DeleteAPIV2AbilitiesAbilityIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2AbilitiesAbilityIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2AbilitiesAbilityID", + Method: "DELETE", + PathPattern: "/api/v2/abilities/{ability_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2AbilitiesAbilityIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2AbilitiesAbilityIDNoContent) + 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 DeleteAPIV2AbilitiesAbilityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Abilities gets all abilities + +Provides a list of all available abilities. +*/ +func (a *Client) GetAPIV2Abilities(params *GetAPIV2AbilitiesParams, opts ...ClientOption) (*GetAPIV2AbilitiesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2AbilitiesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Abilities", + Method: "GET", + PathPattern: "/api/v2/abilities", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2AbilitiesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2AbilitiesOK) + 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 GetAPIV2Abilities: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2AbilitiesAbilityID gets an ability + +Provides one ability based on its ability id. +*/ +func (a *Client) GetAPIV2AbilitiesAbilityID(params *GetAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*GetAPIV2AbilitiesAbilityIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2AbilitiesAbilityIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2AbilitiesAbilityID", + Method: "GET", + PathPattern: "/api/v2/abilities/{ability_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2AbilitiesAbilityIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2AbilitiesAbilityIDOK) + 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 GetAPIV2AbilitiesAbilityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Abilities gets all abilities + +Provides a list of all available abilities. +*/ +func (a *Client) HeadAPIV2Abilities(params *HeadAPIV2AbilitiesParams, opts ...ClientOption) (*HeadAPIV2AbilitiesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2AbilitiesParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Abilities", + Method: "HEAD", + PathPattern: "/api/v2/abilities", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2AbilitiesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2AbilitiesOK) + 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 HeadAPIV2Abilities: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2AbilitiesAbilityID gets an ability + +Provides one ability based on its ability id. +*/ +func (a *Client) HeadAPIV2AbilitiesAbilityID(params *HeadAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*HeadAPIV2AbilitiesAbilityIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2AbilitiesAbilityIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2AbilitiesAbilityID", + Method: "HEAD", + PathPattern: "/api/v2/abilities/{ability_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2AbilitiesAbilityIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2AbilitiesAbilityIDOK) + 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 HeadAPIV2AbilitiesAbilityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2AbilitiesAbilityID updates an existing ability + +Updates an ability based on the `AbilitySchema` values provided in the message body. +*/ +func (a *Client) PatchAPIV2AbilitiesAbilityID(params *PatchAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*PatchAPIV2AbilitiesAbilityIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2AbilitiesAbilityIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2AbilitiesAbilityID", + Method: "PATCH", + PathPattern: "/api/v2/abilities/{ability_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2AbilitiesAbilityIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2AbilitiesAbilityIDOK) + 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 PatchAPIV2AbilitiesAbilityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Abilities creates a new ability + +Creates a new ability based on the `AbilitySchema`. "name", "tactic", "technique_name", "technique_id" and "executors" are all required fields. +*/ +func (a *Client) PostAPIV2Abilities(params *PostAPIV2AbilitiesParams, opts ...ClientOption) (*PostAPIV2AbilitiesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2AbilitiesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Abilities", + Method: "POST", + PathPattern: "/api/v2/abilities", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2AbilitiesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2AbilitiesOK) + 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 PostAPIV2Abilities: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PutAPIV2AbilitiesAbilityID replaces an existing ability + +Replaces an ability based on the `AbilitySchema` values provided in the message body. "name", "tactic", and "executors" are all required fields. +*/ +func (a *Client) PutAPIV2AbilitiesAbilityID(params *PutAPIV2AbilitiesAbilityIDParams, opts ...ClientOption) (*PutAPIV2AbilitiesAbilityIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAPIV2AbilitiesAbilityIDParams() + } + op := &runtime.ClientOperation{ + ID: "PutAPIV2AbilitiesAbilityID", + Method: "PUT", + PathPattern: "/api/v2/abilities/{ability_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutAPIV2AbilitiesAbilityIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PutAPIV2AbilitiesAbilityIDOK) + 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 PutAPIV2AbilitiesAbilityID: 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/core/capability/caldera/api/client/abilities/delete_api_v2_abilities_ability_id_parameters.go b/pkg/core/capability/caldera/api/client/abilities/delete_api_v2_abilities_ability_id_parameters.go new file mode 100644 index 00000000..897a1d2d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/delete_api_v2_abilities_ability_id_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" +) + +// NewDeleteAPIV2AbilitiesAbilityIDParams creates a new DeleteAPIV2AbilitiesAbilityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2AbilitiesAbilityIDParams() *DeleteAPIV2AbilitiesAbilityIDParams { + return &DeleteAPIV2AbilitiesAbilityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2AbilitiesAbilityIDParamsWithTimeout creates a new DeleteAPIV2AbilitiesAbilityIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2AbilitiesAbilityIDParamsWithTimeout(timeout time.Duration) *DeleteAPIV2AbilitiesAbilityIDParams { + return &DeleteAPIV2AbilitiesAbilityIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2AbilitiesAbilityIDParamsWithContext creates a new DeleteAPIV2AbilitiesAbilityIDParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2AbilitiesAbilityIDParamsWithContext(ctx context.Context) *DeleteAPIV2AbilitiesAbilityIDParams { + return &DeleteAPIV2AbilitiesAbilityIDParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2AbilitiesAbilityIDParamsWithHTTPClient creates a new DeleteAPIV2AbilitiesAbilityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2AbilitiesAbilityIDParamsWithHTTPClient(client *http.Client) *DeleteAPIV2AbilitiesAbilityIDParams { + return &DeleteAPIV2AbilitiesAbilityIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2AbilitiesAbilityIDParams contains all the parameters to send to the API endpoint + + for the delete API v2 abilities ability ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2AbilitiesAbilityIDParams struct { + + /* AbilityID. + + UUID of the Ability to be retrieved + */ + AbilityID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2AbilitiesAbilityIDParams) WithDefaults() *DeleteAPIV2AbilitiesAbilityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2AbilitiesAbilityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 abilities ability ID params +func (o *DeleteAPIV2AbilitiesAbilityIDParams) WithTimeout(timeout time.Duration) *DeleteAPIV2AbilitiesAbilityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 abilities ability ID params +func (o *DeleteAPIV2AbilitiesAbilityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 abilities ability ID params +func (o *DeleteAPIV2AbilitiesAbilityIDParams) WithContext(ctx context.Context) *DeleteAPIV2AbilitiesAbilityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 abilities ability ID params +func (o *DeleteAPIV2AbilitiesAbilityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 abilities ability ID params +func (o *DeleteAPIV2AbilitiesAbilityIDParams) WithHTTPClient(client *http.Client) *DeleteAPIV2AbilitiesAbilityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 abilities ability ID params +func (o *DeleteAPIV2AbilitiesAbilityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAbilityID adds the abilityID to the delete API v2 abilities ability ID params +func (o *DeleteAPIV2AbilitiesAbilityIDParams) WithAbilityID(abilityID string) *DeleteAPIV2AbilitiesAbilityIDParams { + o.SetAbilityID(abilityID) + return o +} + +// SetAbilityID adds the abilityId to the delete API v2 abilities ability ID params +func (o *DeleteAPIV2AbilitiesAbilityIDParams) SetAbilityID(abilityID string) { + o.AbilityID = abilityID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2AbilitiesAbilityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param ability_id + if err := r.SetPathParam("ability_id", o.AbilityID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/delete_api_v2_abilities_ability_id_responses.go b/pkg/core/capability/caldera/api/client/abilities/delete_api_v2_abilities_ability_id_responses.go new file mode 100644 index 00000000..b0e73e79 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/delete_api_v2_abilities_ability_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// DeleteAPIV2AbilitiesAbilityIDReader is a Reader for the DeleteAPIV2AbilitiesAbilityID structure. +type DeleteAPIV2AbilitiesAbilityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2AbilitiesAbilityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPIV2AbilitiesAbilityIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/abilities/{ability_id}] DeleteAPIV2AbilitiesAbilityID", response, response.Code()) + } +} + +// NewDeleteAPIV2AbilitiesAbilityIDNoContent creates a DeleteAPIV2AbilitiesAbilityIDNoContent with default headers values +func NewDeleteAPIV2AbilitiesAbilityIDNoContent() *DeleteAPIV2AbilitiesAbilityIDNoContent { + return &DeleteAPIV2AbilitiesAbilityIDNoContent{} +} + +/* +DeleteAPIV2AbilitiesAbilityIDNoContent describes a response with status code 204, with default header values. + +HTTP 204 Status Code (No Content) +*/ +type DeleteAPIV2AbilitiesAbilityIDNoContent struct { + Payload *models.Ability +} + +// IsSuccess returns true when this delete Api v2 abilities ability Id no content response has a 2xx status code +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 abilities ability Id no content response has a 3xx status code +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 abilities ability Id no content response has a 4xx status code +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 abilities ability Id no content response has a 5xx status code +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 abilities ability Id no content response a status code equal to that given +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) IsCode(code int) bool { + return code == 204 +} + +// Code gets the status code for the delete Api v2 abilities ability Id no content response +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) Code() int { + return 204 +} + +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/abilities/{ability_id}][%d] deleteApiV2AbilitiesAbilityIdNoContent %s", 204, payload) +} + +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/abilities/{ability_id}][%d] deleteApiV2AbilitiesAbilityIdNoContent %s", 204, payload) +} + +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) GetPayload() *models.Ability { + return o.Payload +} + +func (o *DeleteAPIV2AbilitiesAbilityIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Ability) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_ability_id_parameters.go b/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_ability_id_parameters.go new file mode 100644 index 00000000..1e91bb70 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_ability_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" +) + +// NewGetAPIV2AbilitiesAbilityIDParams creates a new GetAPIV2AbilitiesAbilityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2AbilitiesAbilityIDParams() *GetAPIV2AbilitiesAbilityIDParams { + return &GetAPIV2AbilitiesAbilityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2AbilitiesAbilityIDParamsWithTimeout creates a new GetAPIV2AbilitiesAbilityIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2AbilitiesAbilityIDParamsWithTimeout(timeout time.Duration) *GetAPIV2AbilitiesAbilityIDParams { + return &GetAPIV2AbilitiesAbilityIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2AbilitiesAbilityIDParamsWithContext creates a new GetAPIV2AbilitiesAbilityIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2AbilitiesAbilityIDParamsWithContext(ctx context.Context) *GetAPIV2AbilitiesAbilityIDParams { + return &GetAPIV2AbilitiesAbilityIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2AbilitiesAbilityIDParamsWithHTTPClient creates a new GetAPIV2AbilitiesAbilityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2AbilitiesAbilityIDParamsWithHTTPClient(client *http.Client) *GetAPIV2AbilitiesAbilityIDParams { + return &GetAPIV2AbilitiesAbilityIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2AbilitiesAbilityIDParams contains all the parameters to send to the API endpoint + + for the get API v2 abilities ability ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2AbilitiesAbilityIDParams struct { + + /* AbilityID. + + UUID of the Ability to be retrieved + */ + AbilityID string + + // Exclude. + Exclude []string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AbilitiesAbilityIDParams) WithDefaults() *GetAPIV2AbilitiesAbilityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AbilitiesAbilityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) WithTimeout(timeout time.Duration) *GetAPIV2AbilitiesAbilityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) WithContext(ctx context.Context) *GetAPIV2AbilitiesAbilityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) WithHTTPClient(client *http.Client) *GetAPIV2AbilitiesAbilityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAbilityID adds the abilityID to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) WithAbilityID(abilityID string) *GetAPIV2AbilitiesAbilityIDParams { + o.SetAbilityID(abilityID) + return o +} + +// SetAbilityID adds the abilityId to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) SetAbilityID(abilityID string) { + o.AbilityID = abilityID +} + +// WithExclude adds the exclude to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) WithExclude(exclude []string) *GetAPIV2AbilitiesAbilityIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) WithInclude(include []string) *GetAPIV2AbilitiesAbilityIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 abilities ability ID params +func (o *GetAPIV2AbilitiesAbilityIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2AbilitiesAbilityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param ability_id + if err := r.SetPathParam("ability_id", o.AbilityID); err != nil { + return err + } + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2AbilitiesAbilityID binds the parameter exclude +func (o *GetAPIV2AbilitiesAbilityIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2AbilitiesAbilityID binds the parameter include +func (o *GetAPIV2AbilitiesAbilityIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_ability_id_responses.go b/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_ability_id_responses.go new file mode 100644 index 00000000..e73b7002 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_ability_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2AbilitiesAbilityIDReader is a Reader for the GetAPIV2AbilitiesAbilityID structure. +type GetAPIV2AbilitiesAbilityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2AbilitiesAbilityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2AbilitiesAbilityIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/abilities/{ability_id}] GetAPIV2AbilitiesAbilityID", response, response.Code()) + } +} + +// NewGetAPIV2AbilitiesAbilityIDOK creates a GetAPIV2AbilitiesAbilityIDOK with default headers values +func NewGetAPIV2AbilitiesAbilityIDOK() *GetAPIV2AbilitiesAbilityIDOK { + return &GetAPIV2AbilitiesAbilityIDOK{} +} + +/* +GetAPIV2AbilitiesAbilityIDOK describes a response with status code 200, with default header values. + +JSON dictionary representation of the existing Ability. +*/ +type GetAPIV2AbilitiesAbilityIDOK struct { + Payload *models.PartialAbility +} + +// IsSuccess returns true when this get Api v2 abilities ability Id o k response has a 2xx status code +func (o *GetAPIV2AbilitiesAbilityIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 abilities ability Id o k response has a 3xx status code +func (o *GetAPIV2AbilitiesAbilityIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 abilities ability Id o k response has a 4xx status code +func (o *GetAPIV2AbilitiesAbilityIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 abilities ability Id o k response has a 5xx status code +func (o *GetAPIV2AbilitiesAbilityIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 abilities ability Id o k response a status code equal to that given +func (o *GetAPIV2AbilitiesAbilityIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 abilities ability Id o k response +func (o *GetAPIV2AbilitiesAbilityIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2AbilitiesAbilityIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/abilities/{ability_id}][%d] getApiV2AbilitiesAbilityIdOK %s", 200, payload) +} + +func (o *GetAPIV2AbilitiesAbilityIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/abilities/{ability_id}][%d] getApiV2AbilitiesAbilityIdOK %s", 200, payload) +} + +func (o *GetAPIV2AbilitiesAbilityIDOK) GetPayload() *models.PartialAbility { + return o.Payload +} + +func (o *GetAPIV2AbilitiesAbilityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialAbility) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_parameters.go b/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_parameters.go new file mode 100644 index 00000000..e799e7d2 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" +) + +// NewGetAPIV2AbilitiesParams creates a new GetAPIV2AbilitiesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2AbilitiesParams() *GetAPIV2AbilitiesParams { + return &GetAPIV2AbilitiesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2AbilitiesParamsWithTimeout creates a new GetAPIV2AbilitiesParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2AbilitiesParamsWithTimeout(timeout time.Duration) *GetAPIV2AbilitiesParams { + return &GetAPIV2AbilitiesParams{ + timeout: timeout, + } +} + +// NewGetAPIV2AbilitiesParamsWithContext creates a new GetAPIV2AbilitiesParams object +// with the ability to set a context for a request. +func NewGetAPIV2AbilitiesParamsWithContext(ctx context.Context) *GetAPIV2AbilitiesParams { + return &GetAPIV2AbilitiesParams{ + Context: ctx, + } +} + +// NewGetAPIV2AbilitiesParamsWithHTTPClient creates a new GetAPIV2AbilitiesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2AbilitiesParamsWithHTTPClient(client *http.Client) *GetAPIV2AbilitiesParams { + return &GetAPIV2AbilitiesParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2AbilitiesParams contains all the parameters to send to the API endpoint + + for the get API v2 abilities operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2AbilitiesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 abilities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AbilitiesParams) WithDefaults() *GetAPIV2AbilitiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 abilities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AbilitiesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) WithTimeout(timeout time.Duration) *GetAPIV2AbilitiesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) WithContext(ctx context.Context) *GetAPIV2AbilitiesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) WithHTTPClient(client *http.Client) *GetAPIV2AbilitiesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) WithExclude(exclude []string) *GetAPIV2AbilitiesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) WithInclude(include []string) *GetAPIV2AbilitiesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) WithSort(sort *string) *GetAPIV2AbilitiesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 abilities params +func (o *GetAPIV2AbilitiesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2AbilitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Abilities binds the parameter exclude +func (o *GetAPIV2AbilitiesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Abilities binds the parameter include +func (o *GetAPIV2AbilitiesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_responses.go b/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_responses.go new file mode 100644 index 00000000..9f480b47 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/get_api_v2_abilities_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2AbilitiesReader is a Reader for the GetAPIV2Abilities structure. +type GetAPIV2AbilitiesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2AbilitiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2AbilitiesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/abilities] GetAPIV2Abilities", response, response.Code()) + } +} + +// NewGetAPIV2AbilitiesOK creates a GetAPIV2AbilitiesOK with default headers values +func NewGetAPIV2AbilitiesOK() *GetAPIV2AbilitiesOK { + return &GetAPIV2AbilitiesOK{} +} + +/* +GetAPIV2AbilitiesOK describes a response with status code 200, with default header values. + +Returns a list of all abilities. +*/ +type GetAPIV2AbilitiesOK struct { + Payload []*models.PartialAbility +} + +// IsSuccess returns true when this get Api v2 abilities o k response has a 2xx status code +func (o *GetAPIV2AbilitiesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 abilities o k response has a 3xx status code +func (o *GetAPIV2AbilitiesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 abilities o k response has a 4xx status code +func (o *GetAPIV2AbilitiesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 abilities o k response has a 5xx status code +func (o *GetAPIV2AbilitiesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 abilities o k response a status code equal to that given +func (o *GetAPIV2AbilitiesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 abilities o k response +func (o *GetAPIV2AbilitiesOK) Code() int { + return 200 +} + +func (o *GetAPIV2AbilitiesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/abilities][%d] getApiV2AbilitiesOK %s", 200, payload) +} + +func (o *GetAPIV2AbilitiesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/abilities][%d] getApiV2AbilitiesOK %s", 200, payload) +} + +func (o *GetAPIV2AbilitiesOK) GetPayload() []*models.PartialAbility { + return o.Payload +} + +func (o *GetAPIV2AbilitiesOK) 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/core/capability/caldera/api/client/abilities/head_api_v2_abilities_ability_id_parameters.go b/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_ability_id_parameters.go new file mode 100644 index 00000000..55d3ecc3 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_ability_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" +) + +// NewHeadAPIV2AbilitiesAbilityIDParams creates a new HeadAPIV2AbilitiesAbilityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2AbilitiesAbilityIDParams() *HeadAPIV2AbilitiesAbilityIDParams { + return &HeadAPIV2AbilitiesAbilityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2AbilitiesAbilityIDParamsWithTimeout creates a new HeadAPIV2AbilitiesAbilityIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2AbilitiesAbilityIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2AbilitiesAbilityIDParams { + return &HeadAPIV2AbilitiesAbilityIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2AbilitiesAbilityIDParamsWithContext creates a new HeadAPIV2AbilitiesAbilityIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2AbilitiesAbilityIDParamsWithContext(ctx context.Context) *HeadAPIV2AbilitiesAbilityIDParams { + return &HeadAPIV2AbilitiesAbilityIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2AbilitiesAbilityIDParamsWithHTTPClient creates a new HeadAPIV2AbilitiesAbilityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2AbilitiesAbilityIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2AbilitiesAbilityIDParams { + return &HeadAPIV2AbilitiesAbilityIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2AbilitiesAbilityIDParams contains all the parameters to send to the API endpoint + + for the head API v2 abilities ability ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2AbilitiesAbilityIDParams struct { + + /* AbilityID. + + UUID of the Ability to be retrieved + */ + AbilityID string + + // Exclude. + Exclude []string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AbilitiesAbilityIDParams) WithDefaults() *HeadAPIV2AbilitiesAbilityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AbilitiesAbilityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2AbilitiesAbilityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) WithContext(ctx context.Context) *HeadAPIV2AbilitiesAbilityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2AbilitiesAbilityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAbilityID adds the abilityID to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) WithAbilityID(abilityID string) *HeadAPIV2AbilitiesAbilityIDParams { + o.SetAbilityID(abilityID) + return o +} + +// SetAbilityID adds the abilityId to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) SetAbilityID(abilityID string) { + o.AbilityID = abilityID +} + +// WithExclude adds the exclude to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) WithExclude(exclude []string) *HeadAPIV2AbilitiesAbilityIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) WithInclude(include []string) *HeadAPIV2AbilitiesAbilityIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 abilities ability ID params +func (o *HeadAPIV2AbilitiesAbilityIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2AbilitiesAbilityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param ability_id + if err := r.SetPathParam("ability_id", o.AbilityID); err != nil { + return err + } + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2AbilitiesAbilityID binds the parameter exclude +func (o *HeadAPIV2AbilitiesAbilityIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2AbilitiesAbilityID binds the parameter include +func (o *HeadAPIV2AbilitiesAbilityIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_ability_id_responses.go b/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_ability_id_responses.go new file mode 100644 index 00000000..4f9009c9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_ability_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2AbilitiesAbilityIDReader is a Reader for the HeadAPIV2AbilitiesAbilityID structure. +type HeadAPIV2AbilitiesAbilityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2AbilitiesAbilityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2AbilitiesAbilityIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/abilities/{ability_id}] HeadAPIV2AbilitiesAbilityID", response, response.Code()) + } +} + +// NewHeadAPIV2AbilitiesAbilityIDOK creates a HeadAPIV2AbilitiesAbilityIDOK with default headers values +func NewHeadAPIV2AbilitiesAbilityIDOK() *HeadAPIV2AbilitiesAbilityIDOK { + return &HeadAPIV2AbilitiesAbilityIDOK{} +} + +/* +HeadAPIV2AbilitiesAbilityIDOK describes a response with status code 200, with default header values. + +JSON dictionary representation of the existing Ability. +*/ +type HeadAPIV2AbilitiesAbilityIDOK struct { + Payload *models.PartialAbility +} + +// IsSuccess returns true when this head Api v2 abilities ability Id o k response has a 2xx status code +func (o *HeadAPIV2AbilitiesAbilityIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 abilities ability Id o k response has a 3xx status code +func (o *HeadAPIV2AbilitiesAbilityIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 abilities ability Id o k response has a 4xx status code +func (o *HeadAPIV2AbilitiesAbilityIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 abilities ability Id o k response has a 5xx status code +func (o *HeadAPIV2AbilitiesAbilityIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 abilities ability Id o k response a status code equal to that given +func (o *HeadAPIV2AbilitiesAbilityIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 abilities ability Id o k response +func (o *HeadAPIV2AbilitiesAbilityIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2AbilitiesAbilityIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/abilities/{ability_id}][%d] headApiV2AbilitiesAbilityIdOK %s", 200, payload) +} + +func (o *HeadAPIV2AbilitiesAbilityIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/abilities/{ability_id}][%d] headApiV2AbilitiesAbilityIdOK %s", 200, payload) +} + +func (o *HeadAPIV2AbilitiesAbilityIDOK) GetPayload() *models.PartialAbility { + return o.Payload +} + +func (o *HeadAPIV2AbilitiesAbilityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialAbility) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_parameters.go b/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_parameters.go new file mode 100644 index 00000000..f37c80d3 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" +) + +// NewHeadAPIV2AbilitiesParams creates a new HeadAPIV2AbilitiesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2AbilitiesParams() *HeadAPIV2AbilitiesParams { + return &HeadAPIV2AbilitiesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2AbilitiesParamsWithTimeout creates a new HeadAPIV2AbilitiesParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2AbilitiesParamsWithTimeout(timeout time.Duration) *HeadAPIV2AbilitiesParams { + return &HeadAPIV2AbilitiesParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2AbilitiesParamsWithContext creates a new HeadAPIV2AbilitiesParams object +// with the ability to set a context for a request. +func NewHeadAPIV2AbilitiesParamsWithContext(ctx context.Context) *HeadAPIV2AbilitiesParams { + return &HeadAPIV2AbilitiesParams{ + Context: ctx, + } +} + +// NewHeadAPIV2AbilitiesParamsWithHTTPClient creates a new HeadAPIV2AbilitiesParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2AbilitiesParamsWithHTTPClient(client *http.Client) *HeadAPIV2AbilitiesParams { + return &HeadAPIV2AbilitiesParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2AbilitiesParams contains all the parameters to send to the API endpoint + + for the head API v2 abilities operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2AbilitiesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 abilities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AbilitiesParams) WithDefaults() *HeadAPIV2AbilitiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 abilities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AbilitiesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) WithTimeout(timeout time.Duration) *HeadAPIV2AbilitiesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) WithContext(ctx context.Context) *HeadAPIV2AbilitiesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) WithHTTPClient(client *http.Client) *HeadAPIV2AbilitiesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) WithExclude(exclude []string) *HeadAPIV2AbilitiesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) WithInclude(include []string) *HeadAPIV2AbilitiesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) WithSort(sort *string) *HeadAPIV2AbilitiesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 abilities params +func (o *HeadAPIV2AbilitiesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2AbilitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Abilities binds the parameter exclude +func (o *HeadAPIV2AbilitiesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Abilities binds the parameter include +func (o *HeadAPIV2AbilitiesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_responses.go b/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_responses.go new file mode 100644 index 00000000..d0c992d1 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/head_api_v2_abilities_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2AbilitiesReader is a Reader for the HeadAPIV2Abilities structure. +type HeadAPIV2AbilitiesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2AbilitiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2AbilitiesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/abilities] HeadAPIV2Abilities", response, response.Code()) + } +} + +// NewHeadAPIV2AbilitiesOK creates a HeadAPIV2AbilitiesOK with default headers values +func NewHeadAPIV2AbilitiesOK() *HeadAPIV2AbilitiesOK { + return &HeadAPIV2AbilitiesOK{} +} + +/* +HeadAPIV2AbilitiesOK describes a response with status code 200, with default header values. + +Returns a list of all abilities. +*/ +type HeadAPIV2AbilitiesOK struct { + Payload []*models.PartialAbility +} + +// IsSuccess returns true when this head Api v2 abilities o k response has a 2xx status code +func (o *HeadAPIV2AbilitiesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 abilities o k response has a 3xx status code +func (o *HeadAPIV2AbilitiesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 abilities o k response has a 4xx status code +func (o *HeadAPIV2AbilitiesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 abilities o k response has a 5xx status code +func (o *HeadAPIV2AbilitiesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 abilities o k response a status code equal to that given +func (o *HeadAPIV2AbilitiesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 abilities o k response +func (o *HeadAPIV2AbilitiesOK) Code() int { + return 200 +} + +func (o *HeadAPIV2AbilitiesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/abilities][%d] headApiV2AbilitiesOK %s", 200, payload) +} + +func (o *HeadAPIV2AbilitiesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/abilities][%d] headApiV2AbilitiesOK %s", 200, payload) +} + +func (o *HeadAPIV2AbilitiesOK) GetPayload() []*models.PartialAbility { + return o.Payload +} + +func (o *HeadAPIV2AbilitiesOK) 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/core/capability/caldera/api/client/abilities/patch_api_v2_abilities_ability_id_parameters.go b/pkg/core/capability/caldera/api/client/abilities/patch_api_v2_abilities_ability_id_parameters.go new file mode 100644 index 00000000..4c2679b6 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/patch_api_v2_abilities_ability_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2AbilitiesAbilityIDParams creates a new PatchAPIV2AbilitiesAbilityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2AbilitiesAbilityIDParams() *PatchAPIV2AbilitiesAbilityIDParams { + return &PatchAPIV2AbilitiesAbilityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2AbilitiesAbilityIDParamsWithTimeout creates a new PatchAPIV2AbilitiesAbilityIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2AbilitiesAbilityIDParamsWithTimeout(timeout time.Duration) *PatchAPIV2AbilitiesAbilityIDParams { + return &PatchAPIV2AbilitiesAbilityIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2AbilitiesAbilityIDParamsWithContext creates a new PatchAPIV2AbilitiesAbilityIDParams object +// with the ability to set a context for a request. +func NewPatchAPIV2AbilitiesAbilityIDParamsWithContext(ctx context.Context) *PatchAPIV2AbilitiesAbilityIDParams { + return &PatchAPIV2AbilitiesAbilityIDParams{ + Context: ctx, + } +} + +// NewPatchAPIV2AbilitiesAbilityIDParamsWithHTTPClient creates a new PatchAPIV2AbilitiesAbilityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2AbilitiesAbilityIDParamsWithHTTPClient(client *http.Client) *PatchAPIV2AbilitiesAbilityIDParams { + return &PatchAPIV2AbilitiesAbilityIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2AbilitiesAbilityIDParams contains all the parameters to send to the API endpoint + + for the patch API v2 abilities ability ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2AbilitiesAbilityIDParams struct { + + /* AbilityID. + + UUID of the Ability to be retrieved + */ + AbilityID string + + // Body. + Body *models.PartialAbility1 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2AbilitiesAbilityIDParams) WithDefaults() *PatchAPIV2AbilitiesAbilityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2AbilitiesAbilityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) WithTimeout(timeout time.Duration) *PatchAPIV2AbilitiesAbilityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) WithContext(ctx context.Context) *PatchAPIV2AbilitiesAbilityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) WithHTTPClient(client *http.Client) *PatchAPIV2AbilitiesAbilityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAbilityID adds the abilityID to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) WithAbilityID(abilityID string) *PatchAPIV2AbilitiesAbilityIDParams { + o.SetAbilityID(abilityID) + return o +} + +// SetAbilityID adds the abilityId to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) SetAbilityID(abilityID string) { + o.AbilityID = abilityID +} + +// WithBody adds the body to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) WithBody(body *models.PartialAbility1) *PatchAPIV2AbilitiesAbilityIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 abilities ability ID params +func (o *PatchAPIV2AbilitiesAbilityIDParams) SetBody(body *models.PartialAbility1) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2AbilitiesAbilityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param ability_id + if err := r.SetPathParam("ability_id", o.AbilityID); err != nil { + return err + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/patch_api_v2_abilities_ability_id_responses.go b/pkg/core/capability/caldera/api/client/abilities/patch_api_v2_abilities_ability_id_responses.go new file mode 100644 index 00000000..44236214 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/patch_api_v2_abilities_ability_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2AbilitiesAbilityIDReader is a Reader for the PatchAPIV2AbilitiesAbilityID structure. +type PatchAPIV2AbilitiesAbilityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2AbilitiesAbilityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2AbilitiesAbilityIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/abilities/{ability_id}] PatchAPIV2AbilitiesAbilityID", response, response.Code()) + } +} + +// NewPatchAPIV2AbilitiesAbilityIDOK creates a PatchAPIV2AbilitiesAbilityIDOK with default headers values +func NewPatchAPIV2AbilitiesAbilityIDOK() *PatchAPIV2AbilitiesAbilityIDOK { + return &PatchAPIV2AbilitiesAbilityIDOK{} +} + +/* +PatchAPIV2AbilitiesAbilityIDOK describes a response with status code 200, with default header values. + +JSON dictionary representation of the replaced Ability. +*/ +type PatchAPIV2AbilitiesAbilityIDOK struct { + Payload *models.Ability +} + +// IsSuccess returns true when this patch Api v2 abilities ability Id o k response has a 2xx status code +func (o *PatchAPIV2AbilitiesAbilityIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 abilities ability Id o k response has a 3xx status code +func (o *PatchAPIV2AbilitiesAbilityIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 abilities ability Id o k response has a 4xx status code +func (o *PatchAPIV2AbilitiesAbilityIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 abilities ability Id o k response has a 5xx status code +func (o *PatchAPIV2AbilitiesAbilityIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 abilities ability Id o k response a status code equal to that given +func (o *PatchAPIV2AbilitiesAbilityIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 abilities ability Id o k response +func (o *PatchAPIV2AbilitiesAbilityIDOK) Code() int { + return 200 +} + +func (o *PatchAPIV2AbilitiesAbilityIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/abilities/{ability_id}][%d] patchApiV2AbilitiesAbilityIdOK %s", 200, payload) +} + +func (o *PatchAPIV2AbilitiesAbilityIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/abilities/{ability_id}][%d] patchApiV2AbilitiesAbilityIdOK %s", 200, payload) +} + +func (o *PatchAPIV2AbilitiesAbilityIDOK) GetPayload() *models.Ability { + return o.Payload +} + +func (o *PatchAPIV2AbilitiesAbilityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Ability) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/post_api_v2_abilities_parameters.go b/pkg/core/capability/caldera/api/client/abilities/post_api_v2_abilities_parameters.go new file mode 100644 index 00000000..9878b150 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/post_api_v2_abilities_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2AbilitiesParams creates a new PostAPIV2AbilitiesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2AbilitiesParams() *PostAPIV2AbilitiesParams { + return &PostAPIV2AbilitiesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2AbilitiesParamsWithTimeout creates a new PostAPIV2AbilitiesParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2AbilitiesParamsWithTimeout(timeout time.Duration) *PostAPIV2AbilitiesParams { + return &PostAPIV2AbilitiesParams{ + timeout: timeout, + } +} + +// NewPostAPIV2AbilitiesParamsWithContext creates a new PostAPIV2AbilitiesParams object +// with the ability to set a context for a request. +func NewPostAPIV2AbilitiesParamsWithContext(ctx context.Context) *PostAPIV2AbilitiesParams { + return &PostAPIV2AbilitiesParams{ + Context: ctx, + } +} + +// NewPostAPIV2AbilitiesParamsWithHTTPClient creates a new PostAPIV2AbilitiesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2AbilitiesParamsWithHTTPClient(client *http.Client) *PostAPIV2AbilitiesParams { + return &PostAPIV2AbilitiesParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2AbilitiesParams contains all the parameters to send to the API endpoint + + for the post API v2 abilities operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2AbilitiesParams struct { + + // Body. + Body *models.Ability + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 abilities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2AbilitiesParams) WithDefaults() *PostAPIV2AbilitiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 abilities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2AbilitiesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 abilities params +func (o *PostAPIV2AbilitiesParams) WithTimeout(timeout time.Duration) *PostAPIV2AbilitiesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 abilities params +func (o *PostAPIV2AbilitiesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 abilities params +func (o *PostAPIV2AbilitiesParams) WithContext(ctx context.Context) *PostAPIV2AbilitiesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 abilities params +func (o *PostAPIV2AbilitiesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 abilities params +func (o *PostAPIV2AbilitiesParams) WithHTTPClient(client *http.Client) *PostAPIV2AbilitiesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 abilities params +func (o *PostAPIV2AbilitiesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 abilities params +func (o *PostAPIV2AbilitiesParams) WithBody(body *models.Ability) *PostAPIV2AbilitiesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 abilities params +func (o *PostAPIV2AbilitiesParams) SetBody(body *models.Ability) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2AbilitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/post_api_v2_abilities_responses.go b/pkg/core/capability/caldera/api/client/abilities/post_api_v2_abilities_responses.go new file mode 100644 index 00000000..7ef1b0e9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/post_api_v2_abilities_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2AbilitiesReader is a Reader for the PostAPIV2Abilities structure. +type PostAPIV2AbilitiesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2AbilitiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2AbilitiesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/abilities] PostAPIV2Abilities", response, response.Code()) + } +} + +// NewPostAPIV2AbilitiesOK creates a PostAPIV2AbilitiesOK with default headers values +func NewPostAPIV2AbilitiesOK() *PostAPIV2AbilitiesOK { + return &PostAPIV2AbilitiesOK{} +} + +/* +PostAPIV2AbilitiesOK describes a response with status code 200, with default header values. + +JSON dictionary representation of the created Ability. +*/ +type PostAPIV2AbilitiesOK struct { + Payload *models.Ability +} + +// IsSuccess returns true when this post Api v2 abilities o k response has a 2xx status code +func (o *PostAPIV2AbilitiesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 abilities o k response has a 3xx status code +func (o *PostAPIV2AbilitiesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 abilities o k response has a 4xx status code +func (o *PostAPIV2AbilitiesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 abilities o k response has a 5xx status code +func (o *PostAPIV2AbilitiesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 abilities o k response a status code equal to that given +func (o *PostAPIV2AbilitiesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 abilities o k response +func (o *PostAPIV2AbilitiesOK) Code() int { + return 200 +} + +func (o *PostAPIV2AbilitiesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/abilities][%d] postApiV2AbilitiesOK %s", 200, payload) +} + +func (o *PostAPIV2AbilitiesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/abilities][%d] postApiV2AbilitiesOK %s", 200, payload) +} + +func (o *PostAPIV2AbilitiesOK) GetPayload() *models.Ability { + return o.Payload +} + +func (o *PostAPIV2AbilitiesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Ability) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/put_api_v2_abilities_ability_id_parameters.go b/pkg/core/capability/caldera/api/client/abilities/put_api_v2_abilities_ability_id_parameters.go new file mode 100644 index 00000000..dbc6eafa --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/put_api_v2_abilities_ability_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPutAPIV2AbilitiesAbilityIDParams creates a new PutAPIV2AbilitiesAbilityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPutAPIV2AbilitiesAbilityIDParams() *PutAPIV2AbilitiesAbilityIDParams { + return &PutAPIV2AbilitiesAbilityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPutAPIV2AbilitiesAbilityIDParamsWithTimeout creates a new PutAPIV2AbilitiesAbilityIDParams object +// with the ability to set a timeout on a request. +func NewPutAPIV2AbilitiesAbilityIDParamsWithTimeout(timeout time.Duration) *PutAPIV2AbilitiesAbilityIDParams { + return &PutAPIV2AbilitiesAbilityIDParams{ + timeout: timeout, + } +} + +// NewPutAPIV2AbilitiesAbilityIDParamsWithContext creates a new PutAPIV2AbilitiesAbilityIDParams object +// with the ability to set a context for a request. +func NewPutAPIV2AbilitiesAbilityIDParamsWithContext(ctx context.Context) *PutAPIV2AbilitiesAbilityIDParams { + return &PutAPIV2AbilitiesAbilityIDParams{ + Context: ctx, + } +} + +// NewPutAPIV2AbilitiesAbilityIDParamsWithHTTPClient creates a new PutAPIV2AbilitiesAbilityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPutAPIV2AbilitiesAbilityIDParamsWithHTTPClient(client *http.Client) *PutAPIV2AbilitiesAbilityIDParams { + return &PutAPIV2AbilitiesAbilityIDParams{ + HTTPClient: client, + } +} + +/* +PutAPIV2AbilitiesAbilityIDParams contains all the parameters to send to the API endpoint + + for the put API v2 abilities ability ID operation. + + Typically these are written to a http.Request. +*/ +type PutAPIV2AbilitiesAbilityIDParams struct { + + /* AbilityID. + + UUID of the Ability to be retrieved + */ + AbilityID string + + // Body. + Body *models.PartialAbility + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the put API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2AbilitiesAbilityIDParams) WithDefaults() *PutAPIV2AbilitiesAbilityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put API v2 abilities ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2AbilitiesAbilityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) WithTimeout(timeout time.Duration) *PutAPIV2AbilitiesAbilityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) WithContext(ctx context.Context) *PutAPIV2AbilitiesAbilityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) WithHTTPClient(client *http.Client) *PutAPIV2AbilitiesAbilityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAbilityID adds the abilityID to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) WithAbilityID(abilityID string) *PutAPIV2AbilitiesAbilityIDParams { + o.SetAbilityID(abilityID) + return o +} + +// SetAbilityID adds the abilityId to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) SetAbilityID(abilityID string) { + o.AbilityID = abilityID +} + +// WithBody adds the body to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) WithBody(body *models.PartialAbility) *PutAPIV2AbilitiesAbilityIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put API v2 abilities ability ID params +func (o *PutAPIV2AbilitiesAbilityIDParams) SetBody(body *models.PartialAbility) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAPIV2AbilitiesAbilityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param ability_id + if err := r.SetPathParam("ability_id", o.AbilityID); err != nil { + return err + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/abilities/put_api_v2_abilities_ability_id_responses.go b/pkg/core/capability/caldera/api/client/abilities/put_api_v2_abilities_ability_id_responses.go new file mode 100644 index 00000000..bddc6d61 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/abilities/put_api_v2_abilities_ability_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package abilities + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PutAPIV2AbilitiesAbilityIDReader is a Reader for the PutAPIV2AbilitiesAbilityID structure. +type PutAPIV2AbilitiesAbilityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAPIV2AbilitiesAbilityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPutAPIV2AbilitiesAbilityIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PUT /api/v2/abilities/{ability_id}] PutAPIV2AbilitiesAbilityID", response, response.Code()) + } +} + +// NewPutAPIV2AbilitiesAbilityIDOK creates a PutAPIV2AbilitiesAbilityIDOK with default headers values +func NewPutAPIV2AbilitiesAbilityIDOK() *PutAPIV2AbilitiesAbilityIDOK { + return &PutAPIV2AbilitiesAbilityIDOK{} +} + +/* +PutAPIV2AbilitiesAbilityIDOK describes a response with status code 200, with default header values. + +JSON dictionary representation of the replaced Ability. +*/ +type PutAPIV2AbilitiesAbilityIDOK struct { + Payload *models.Ability +} + +// IsSuccess returns true when this put Api v2 abilities ability Id o k response has a 2xx status code +func (o *PutAPIV2AbilitiesAbilityIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put Api v2 abilities ability Id o k response has a 3xx status code +func (o *PutAPIV2AbilitiesAbilityIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put Api v2 abilities ability Id o k response has a 4xx status code +func (o *PutAPIV2AbilitiesAbilityIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this put Api v2 abilities ability Id o k response has a 5xx status code +func (o *PutAPIV2AbilitiesAbilityIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put Api v2 abilities ability Id o k response a status code equal to that given +func (o *PutAPIV2AbilitiesAbilityIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the put Api v2 abilities ability Id o k response +func (o *PutAPIV2AbilitiesAbilityIDOK) Code() int { + return 200 +} + +func (o *PutAPIV2AbilitiesAbilityIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/abilities/{ability_id}][%d] putApiV2AbilitiesAbilityIdOK %s", 200, payload) +} + +func (o *PutAPIV2AbilitiesAbilityIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/abilities/{ability_id}][%d] putApiV2AbilitiesAbilityIdOK %s", 200, payload) +} + +func (o *PutAPIV2AbilitiesAbilityIDOK) GetPayload() *models.Ability { + return o.Payload +} + +func (o *PutAPIV2AbilitiesAbilityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Ability) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/adversaries_client.go b/pkg/core/capability/caldera/api/client/adversaries/adversaries_client.go new file mode 100644 index 00000000..fee95d58 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/adversaries_client.go @@ -0,0 +1,401 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new adversaries API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new adversaries API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new adversaries API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for adversaries API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2AdversariesAdversaryID(params *DeleteAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*DeleteAPIV2AdversariesAdversaryIDNoContent, error) + + GetAPIV2Adversaries(params *GetAPIV2AdversariesParams, opts ...ClientOption) (*GetAPIV2AdversariesOK, error) + + GetAPIV2AdversariesAdversaryID(params *GetAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*GetAPIV2AdversariesAdversaryIDOK, error) + + HeadAPIV2Adversaries(params *HeadAPIV2AdversariesParams, opts ...ClientOption) (*HeadAPIV2AdversariesOK, error) + + HeadAPIV2AdversariesAdversaryID(params *HeadAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*HeadAPIV2AdversariesAdversaryIDOK, error) + + PatchAPIV2AdversariesAdversaryID(params *PatchAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*PatchAPIV2AdversariesAdversaryIDOK, error) + + PostAPIV2Adversaries(params *PostAPIV2AdversariesParams, opts ...ClientOption) (*PostAPIV2AdversariesOK, error) + + PutAPIV2AdversariesAdversaryID(params *PutAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*PutAPIV2AdversariesAdversaryIDOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2AdversariesAdversaryID deletes an adversary + +Deletes an existing adversary. +*/ +func (a *Client) DeleteAPIV2AdversariesAdversaryID(params *DeleteAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*DeleteAPIV2AdversariesAdversaryIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2AdversariesAdversaryIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2AdversariesAdversaryID", + Method: "DELETE", + PathPattern: "/api/v2/adversaries/{adversary_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2AdversariesAdversaryIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2AdversariesAdversaryIDNoContent) + 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 DeleteAPIV2AdversariesAdversaryID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Adversaries retrieves all adversaries + +Returns a list of all available adversaries in the system, including plugin, name, description, and atomic ordering. Supply fields from the `AdversarySchema` to the include and exclude fields of the `BaseGetAllQuerySchema` in the request body to filter retrieved adversaries. +*/ +func (a *Client) GetAPIV2Adversaries(params *GetAPIV2AdversariesParams, opts ...ClientOption) (*GetAPIV2AdversariesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2AdversariesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Adversaries", + Method: "GET", + PathPattern: "/api/v2/adversaries", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2AdversariesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2AdversariesOK) + 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 GetAPIV2Adversaries: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2AdversariesAdversaryID retrieves adversary by ID + +Retrieve one adversary by ID. Use fields from the `AdversarySchema` in the request body to filter retrieved adversary. +*/ +func (a *Client) GetAPIV2AdversariesAdversaryID(params *GetAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*GetAPIV2AdversariesAdversaryIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2AdversariesAdversaryIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2AdversariesAdversaryID", + Method: "GET", + PathPattern: "/api/v2/adversaries/{adversary_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2AdversariesAdversaryIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2AdversariesAdversaryIDOK) + 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 GetAPIV2AdversariesAdversaryID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Adversaries retrieves all adversaries + +Returns a list of all available adversaries in the system, including plugin, name, description, and atomic ordering. Supply fields from the `AdversarySchema` to the include and exclude fields of the `BaseGetAllQuerySchema` in the request body to filter retrieved adversaries. +*/ +func (a *Client) HeadAPIV2Adversaries(params *HeadAPIV2AdversariesParams, opts ...ClientOption) (*HeadAPIV2AdversariesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2AdversariesParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Adversaries", + Method: "HEAD", + PathPattern: "/api/v2/adversaries", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2AdversariesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2AdversariesOK) + 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 HeadAPIV2Adversaries: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2AdversariesAdversaryID retrieves adversary by ID + +Retrieve one adversary by ID. Use fields from the `AdversarySchema` in the request body to filter retrieved adversary. +*/ +func (a *Client) HeadAPIV2AdversariesAdversaryID(params *HeadAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*HeadAPIV2AdversariesAdversaryIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2AdversariesAdversaryIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2AdversariesAdversaryID", + Method: "HEAD", + PathPattern: "/api/v2/adversaries/{adversary_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2AdversariesAdversaryIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2AdversariesAdversaryIDOK) + 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 HeadAPIV2AdversariesAdversaryID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2AdversariesAdversaryID updates an adversary + +Update an adversary using fields from the `AdversarySchema` in the request body. +*/ +func (a *Client) PatchAPIV2AdversariesAdversaryID(params *PatchAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*PatchAPIV2AdversariesAdversaryIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2AdversariesAdversaryIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2AdversariesAdversaryID", + Method: "PATCH", + PathPattern: "/api/v2/adversaries/{adversary_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2AdversariesAdversaryIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2AdversariesAdversaryIDOK) + 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 PatchAPIV2AdversariesAdversaryID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Adversaries creates a new adversary + +Create a new adversary using the format provided in the `AdversarySchema`. +*/ +func (a *Client) PostAPIV2Adversaries(params *PostAPIV2AdversariesParams, opts ...ClientOption) (*PostAPIV2AdversariesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2AdversariesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Adversaries", + Method: "POST", + PathPattern: "/api/v2/adversaries", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2AdversariesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2AdversariesOK) + 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 PostAPIV2Adversaries: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PutAPIV2AdversariesAdversaryID creates or update an adversary + +Attempt to update an adversaries using fields from the `AdversarySchema` in the request body. If the adversary does not already exist, then create a new one using the `AdversarySchema` format. +*/ +func (a *Client) PutAPIV2AdversariesAdversaryID(params *PutAPIV2AdversariesAdversaryIDParams, opts ...ClientOption) (*PutAPIV2AdversariesAdversaryIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAPIV2AdversariesAdversaryIDParams() + } + op := &runtime.ClientOperation{ + ID: "PutAPIV2AdversariesAdversaryID", + Method: "PUT", + PathPattern: "/api/v2/adversaries/{adversary_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutAPIV2AdversariesAdversaryIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PutAPIV2AdversariesAdversaryIDOK) + 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 PutAPIV2AdversariesAdversaryID: 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/core/capability/caldera/api/client/adversaries/delete_api_v2_adversaries_adversary_id_parameters.go b/pkg/core/capability/caldera/api/client/adversaries/delete_api_v2_adversaries_adversary_id_parameters.go new file mode 100644 index 00000000..66550947 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/delete_api_v2_adversaries_adversary_id_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" +) + +// NewDeleteAPIV2AdversariesAdversaryIDParams creates a new DeleteAPIV2AdversariesAdversaryIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2AdversariesAdversaryIDParams() *DeleteAPIV2AdversariesAdversaryIDParams { + return &DeleteAPIV2AdversariesAdversaryIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2AdversariesAdversaryIDParamsWithTimeout creates a new DeleteAPIV2AdversariesAdversaryIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2AdversariesAdversaryIDParamsWithTimeout(timeout time.Duration) *DeleteAPIV2AdversariesAdversaryIDParams { + return &DeleteAPIV2AdversariesAdversaryIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2AdversariesAdversaryIDParamsWithContext creates a new DeleteAPIV2AdversariesAdversaryIDParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2AdversariesAdversaryIDParamsWithContext(ctx context.Context) *DeleteAPIV2AdversariesAdversaryIDParams { + return &DeleteAPIV2AdversariesAdversaryIDParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2AdversariesAdversaryIDParamsWithHTTPClient creates a new DeleteAPIV2AdversariesAdversaryIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2AdversariesAdversaryIDParamsWithHTTPClient(client *http.Client) *DeleteAPIV2AdversariesAdversaryIDParams { + return &DeleteAPIV2AdversariesAdversaryIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2AdversariesAdversaryIDParams contains all the parameters to send to the API endpoint + + for the delete API v2 adversaries adversary ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2AdversariesAdversaryIDParams struct { + + /* AdversaryID. + + UUID of the adversary to be retrieved + */ + AdversaryID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2AdversariesAdversaryIDParams) WithDefaults() *DeleteAPIV2AdversariesAdversaryIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2AdversariesAdversaryIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 adversaries adversary ID params +func (o *DeleteAPIV2AdversariesAdversaryIDParams) WithTimeout(timeout time.Duration) *DeleteAPIV2AdversariesAdversaryIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 adversaries adversary ID params +func (o *DeleteAPIV2AdversariesAdversaryIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 adversaries adversary ID params +func (o *DeleteAPIV2AdversariesAdversaryIDParams) WithContext(ctx context.Context) *DeleteAPIV2AdversariesAdversaryIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 adversaries adversary ID params +func (o *DeleteAPIV2AdversariesAdversaryIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 adversaries adversary ID params +func (o *DeleteAPIV2AdversariesAdversaryIDParams) WithHTTPClient(client *http.Client) *DeleteAPIV2AdversariesAdversaryIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 adversaries adversary ID params +func (o *DeleteAPIV2AdversariesAdversaryIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAdversaryID adds the adversaryID to the delete API v2 adversaries adversary ID params +func (o *DeleteAPIV2AdversariesAdversaryIDParams) WithAdversaryID(adversaryID string) *DeleteAPIV2AdversariesAdversaryIDParams { + o.SetAdversaryID(adversaryID) + return o +} + +// SetAdversaryID adds the adversaryId to the delete API v2 adversaries adversary ID params +func (o *DeleteAPIV2AdversariesAdversaryIDParams) SetAdversaryID(adversaryID string) { + o.AdversaryID = adversaryID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2AdversariesAdversaryIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param adversary_id + if err := r.SetPathParam("adversary_id", o.AdversaryID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/delete_api_v2_adversaries_adversary_id_responses.go b/pkg/core/capability/caldera/api/client/adversaries/delete_api_v2_adversaries_adversary_id_responses.go new file mode 100644 index 00000000..28d7dcfe --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/delete_api_v2_adversaries_adversary_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// DeleteAPIV2AdversariesAdversaryIDReader is a Reader for the DeleteAPIV2AdversariesAdversaryID structure. +type DeleteAPIV2AdversariesAdversaryIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2AdversariesAdversaryIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPIV2AdversariesAdversaryIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/adversaries/{adversary_id}] DeleteAPIV2AdversariesAdversaryID", response, response.Code()) + } +} + +// NewDeleteAPIV2AdversariesAdversaryIDNoContent creates a DeleteAPIV2AdversariesAdversaryIDNoContent with default headers values +func NewDeleteAPIV2AdversariesAdversaryIDNoContent() *DeleteAPIV2AdversariesAdversaryIDNoContent { + return &DeleteAPIV2AdversariesAdversaryIDNoContent{} +} + +/* +DeleteAPIV2AdversariesAdversaryIDNoContent describes a response with status code 204, with default header values. + +HTTP 204 Status Code (No Content) +*/ +type DeleteAPIV2AdversariesAdversaryIDNoContent struct { + Payload *models.PartialAdversary +} + +// IsSuccess returns true when this delete Api v2 adversaries adversary Id no content response has a 2xx status code +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 adversaries adversary Id no content response has a 3xx status code +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 adversaries adversary Id no content response has a 4xx status code +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 adversaries adversary Id no content response has a 5xx status code +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 adversaries adversary Id no content response a status code equal to that given +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) IsCode(code int) bool { + return code == 204 +} + +// Code gets the status code for the delete Api v2 adversaries adversary Id no content response +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) Code() int { + return 204 +} + +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/adversaries/{adversary_id}][%d] deleteApiV2AdversariesAdversaryIdNoContent %s", 204, payload) +} + +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/adversaries/{adversary_id}][%d] deleteApiV2AdversariesAdversaryIdNoContent %s", 204, payload) +} + +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) GetPayload() *models.PartialAdversary { + return o.Payload +} + +func (o *DeleteAPIV2AdversariesAdversaryIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialAdversary) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_adversary_id_parameters.go b/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_adversary_id_parameters.go new file mode 100644 index 00000000..805eaf4f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_adversary_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" +) + +// NewGetAPIV2AdversariesAdversaryIDParams creates a new GetAPIV2AdversariesAdversaryIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2AdversariesAdversaryIDParams() *GetAPIV2AdversariesAdversaryIDParams { + return &GetAPIV2AdversariesAdversaryIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2AdversariesAdversaryIDParamsWithTimeout creates a new GetAPIV2AdversariesAdversaryIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2AdversariesAdversaryIDParamsWithTimeout(timeout time.Duration) *GetAPIV2AdversariesAdversaryIDParams { + return &GetAPIV2AdversariesAdversaryIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2AdversariesAdversaryIDParamsWithContext creates a new GetAPIV2AdversariesAdversaryIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2AdversariesAdversaryIDParamsWithContext(ctx context.Context) *GetAPIV2AdversariesAdversaryIDParams { + return &GetAPIV2AdversariesAdversaryIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2AdversariesAdversaryIDParamsWithHTTPClient creates a new GetAPIV2AdversariesAdversaryIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2AdversariesAdversaryIDParamsWithHTTPClient(client *http.Client) *GetAPIV2AdversariesAdversaryIDParams { + return &GetAPIV2AdversariesAdversaryIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2AdversariesAdversaryIDParams contains all the parameters to send to the API endpoint + + for the get API v2 adversaries adversary ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2AdversariesAdversaryIDParams struct { + + /* AdversaryID. + + UUID of the adversary to be retrieved + */ + AdversaryID string + + // Exclude. + Exclude []string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AdversariesAdversaryIDParams) WithDefaults() *GetAPIV2AdversariesAdversaryIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AdversariesAdversaryIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) WithTimeout(timeout time.Duration) *GetAPIV2AdversariesAdversaryIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) WithContext(ctx context.Context) *GetAPIV2AdversariesAdversaryIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) WithHTTPClient(client *http.Client) *GetAPIV2AdversariesAdversaryIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAdversaryID adds the adversaryID to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) WithAdversaryID(adversaryID string) *GetAPIV2AdversariesAdversaryIDParams { + o.SetAdversaryID(adversaryID) + return o +} + +// SetAdversaryID adds the adversaryId to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) SetAdversaryID(adversaryID string) { + o.AdversaryID = adversaryID +} + +// WithExclude adds the exclude to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) WithExclude(exclude []string) *GetAPIV2AdversariesAdversaryIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) WithInclude(include []string) *GetAPIV2AdversariesAdversaryIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 adversaries adversary ID params +func (o *GetAPIV2AdversariesAdversaryIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2AdversariesAdversaryIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param adversary_id + if err := r.SetPathParam("adversary_id", o.AdversaryID); err != nil { + return err + } + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2AdversariesAdversaryID binds the parameter exclude +func (o *GetAPIV2AdversariesAdversaryIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2AdversariesAdversaryID binds the parameter include +func (o *GetAPIV2AdversariesAdversaryIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_adversary_id_responses.go b/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_adversary_id_responses.go new file mode 100644 index 00000000..e096437d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_adversary_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2AdversariesAdversaryIDReader is a Reader for the GetAPIV2AdversariesAdversaryID structure. +type GetAPIV2AdversariesAdversaryIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2AdversariesAdversaryIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2AdversariesAdversaryIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/adversaries/{adversary_id}] GetAPIV2AdversariesAdversaryID", response, response.Code()) + } +} + +// NewGetAPIV2AdversariesAdversaryIDOK creates a GetAPIV2AdversariesAdversaryIDOK with default headers values +func NewGetAPIV2AdversariesAdversaryIDOK() *GetAPIV2AdversariesAdversaryIDOK { + return &GetAPIV2AdversariesAdversaryIDOK{} +} + +/* +GetAPIV2AdversariesAdversaryIDOK describes a response with status code 200, with default header values. + +Returns single adversary in AdversarySchema format. +*/ +type GetAPIV2AdversariesAdversaryIDOK struct { + Payload *models.PartialAdversary +} + +// IsSuccess returns true when this get Api v2 adversaries adversary Id o k response has a 2xx status code +func (o *GetAPIV2AdversariesAdversaryIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 adversaries adversary Id o k response has a 3xx status code +func (o *GetAPIV2AdversariesAdversaryIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 adversaries adversary Id o k response has a 4xx status code +func (o *GetAPIV2AdversariesAdversaryIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 adversaries adversary Id o k response has a 5xx status code +func (o *GetAPIV2AdversariesAdversaryIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 adversaries adversary Id o k response a status code equal to that given +func (o *GetAPIV2AdversariesAdversaryIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 adversaries adversary Id o k response +func (o *GetAPIV2AdversariesAdversaryIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2AdversariesAdversaryIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/adversaries/{adversary_id}][%d] getApiV2AdversariesAdversaryIdOK %s", 200, payload) +} + +func (o *GetAPIV2AdversariesAdversaryIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/adversaries/{adversary_id}][%d] getApiV2AdversariesAdversaryIdOK %s", 200, payload) +} + +func (o *GetAPIV2AdversariesAdversaryIDOK) GetPayload() *models.PartialAdversary { + return o.Payload +} + +func (o *GetAPIV2AdversariesAdversaryIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialAdversary) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_parameters.go b/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_parameters.go new file mode 100644 index 00000000..4a6aa1c5 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" +) + +// NewGetAPIV2AdversariesParams creates a new GetAPIV2AdversariesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2AdversariesParams() *GetAPIV2AdversariesParams { + return &GetAPIV2AdversariesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2AdversariesParamsWithTimeout creates a new GetAPIV2AdversariesParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2AdversariesParamsWithTimeout(timeout time.Duration) *GetAPIV2AdversariesParams { + return &GetAPIV2AdversariesParams{ + timeout: timeout, + } +} + +// NewGetAPIV2AdversariesParamsWithContext creates a new GetAPIV2AdversariesParams object +// with the ability to set a context for a request. +func NewGetAPIV2AdversariesParamsWithContext(ctx context.Context) *GetAPIV2AdversariesParams { + return &GetAPIV2AdversariesParams{ + Context: ctx, + } +} + +// NewGetAPIV2AdversariesParamsWithHTTPClient creates a new GetAPIV2AdversariesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2AdversariesParamsWithHTTPClient(client *http.Client) *GetAPIV2AdversariesParams { + return &GetAPIV2AdversariesParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2AdversariesParams contains all the parameters to send to the API endpoint + + for the get API v2 adversaries operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2AdversariesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 adversaries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AdversariesParams) WithDefaults() *GetAPIV2AdversariesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 adversaries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AdversariesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) WithTimeout(timeout time.Duration) *GetAPIV2AdversariesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) WithContext(ctx context.Context) *GetAPIV2AdversariesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) WithHTTPClient(client *http.Client) *GetAPIV2AdversariesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) WithExclude(exclude []string) *GetAPIV2AdversariesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) WithInclude(include []string) *GetAPIV2AdversariesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) WithSort(sort *string) *GetAPIV2AdversariesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 adversaries params +func (o *GetAPIV2AdversariesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2AdversariesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Adversaries binds the parameter exclude +func (o *GetAPIV2AdversariesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Adversaries binds the parameter include +func (o *GetAPIV2AdversariesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_responses.go b/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_responses.go new file mode 100644 index 00000000..b490ed42 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/get_api_v2_adversaries_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2AdversariesReader is a Reader for the GetAPIV2Adversaries structure. +type GetAPIV2AdversariesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2AdversariesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2AdversariesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/adversaries] GetAPIV2Adversaries", response, response.Code()) + } +} + +// NewGetAPIV2AdversariesOK creates a GetAPIV2AdversariesOK with default headers values +func NewGetAPIV2AdversariesOK() *GetAPIV2AdversariesOK { + return &GetAPIV2AdversariesOK{} +} + +/* +GetAPIV2AdversariesOK describes a response with status code 200, with default header values. + +Returns a list in `AdversarySchema` format of all available adversaries in the system. +*/ +type GetAPIV2AdversariesOK struct { + Payload []*models.PartialAdversary +} + +// IsSuccess returns true when this get Api v2 adversaries o k response has a 2xx status code +func (o *GetAPIV2AdversariesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 adversaries o k response has a 3xx status code +func (o *GetAPIV2AdversariesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 adversaries o k response has a 4xx status code +func (o *GetAPIV2AdversariesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 adversaries o k response has a 5xx status code +func (o *GetAPIV2AdversariesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 adversaries o k response a status code equal to that given +func (o *GetAPIV2AdversariesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 adversaries o k response +func (o *GetAPIV2AdversariesOK) Code() int { + return 200 +} + +func (o *GetAPIV2AdversariesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/adversaries][%d] getApiV2AdversariesOK %s", 200, payload) +} + +func (o *GetAPIV2AdversariesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/adversaries][%d] getApiV2AdversariesOK %s", 200, payload) +} + +func (o *GetAPIV2AdversariesOK) GetPayload() []*models.PartialAdversary { + return o.Payload +} + +func (o *GetAPIV2AdversariesOK) 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/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_adversary_id_parameters.go b/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_adversary_id_parameters.go new file mode 100644 index 00000000..7d60afcc --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_adversary_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" +) + +// NewHeadAPIV2AdversariesAdversaryIDParams creates a new HeadAPIV2AdversariesAdversaryIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2AdversariesAdversaryIDParams() *HeadAPIV2AdversariesAdversaryIDParams { + return &HeadAPIV2AdversariesAdversaryIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2AdversariesAdversaryIDParamsWithTimeout creates a new HeadAPIV2AdversariesAdversaryIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2AdversariesAdversaryIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2AdversariesAdversaryIDParams { + return &HeadAPIV2AdversariesAdversaryIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2AdversariesAdversaryIDParamsWithContext creates a new HeadAPIV2AdversariesAdversaryIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2AdversariesAdversaryIDParamsWithContext(ctx context.Context) *HeadAPIV2AdversariesAdversaryIDParams { + return &HeadAPIV2AdversariesAdversaryIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2AdversariesAdversaryIDParamsWithHTTPClient creates a new HeadAPIV2AdversariesAdversaryIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2AdversariesAdversaryIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2AdversariesAdversaryIDParams { + return &HeadAPIV2AdversariesAdversaryIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2AdversariesAdversaryIDParams contains all the parameters to send to the API endpoint + + for the head API v2 adversaries adversary ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2AdversariesAdversaryIDParams struct { + + /* AdversaryID. + + UUID of the adversary to be retrieved + */ + AdversaryID string + + // Exclude. + Exclude []string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AdversariesAdversaryIDParams) WithDefaults() *HeadAPIV2AdversariesAdversaryIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AdversariesAdversaryIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2AdversariesAdversaryIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) WithContext(ctx context.Context) *HeadAPIV2AdversariesAdversaryIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2AdversariesAdversaryIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAdversaryID adds the adversaryID to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) WithAdversaryID(adversaryID string) *HeadAPIV2AdversariesAdversaryIDParams { + o.SetAdversaryID(adversaryID) + return o +} + +// SetAdversaryID adds the adversaryId to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) SetAdversaryID(adversaryID string) { + o.AdversaryID = adversaryID +} + +// WithExclude adds the exclude to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) WithExclude(exclude []string) *HeadAPIV2AdversariesAdversaryIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) WithInclude(include []string) *HeadAPIV2AdversariesAdversaryIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 adversaries adversary ID params +func (o *HeadAPIV2AdversariesAdversaryIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2AdversariesAdversaryIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param adversary_id + if err := r.SetPathParam("adversary_id", o.AdversaryID); err != nil { + return err + } + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2AdversariesAdversaryID binds the parameter exclude +func (o *HeadAPIV2AdversariesAdversaryIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2AdversariesAdversaryID binds the parameter include +func (o *HeadAPIV2AdversariesAdversaryIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_adversary_id_responses.go b/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_adversary_id_responses.go new file mode 100644 index 00000000..6c4e9327 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_adversary_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2AdversariesAdversaryIDReader is a Reader for the HeadAPIV2AdversariesAdversaryID structure. +type HeadAPIV2AdversariesAdversaryIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2AdversariesAdversaryIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2AdversariesAdversaryIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/adversaries/{adversary_id}] HeadAPIV2AdversariesAdversaryID", response, response.Code()) + } +} + +// NewHeadAPIV2AdversariesAdversaryIDOK creates a HeadAPIV2AdversariesAdversaryIDOK with default headers values +func NewHeadAPIV2AdversariesAdversaryIDOK() *HeadAPIV2AdversariesAdversaryIDOK { + return &HeadAPIV2AdversariesAdversaryIDOK{} +} + +/* +HeadAPIV2AdversariesAdversaryIDOK describes a response with status code 200, with default header values. + +Returns single adversary in AdversarySchema format. +*/ +type HeadAPIV2AdversariesAdversaryIDOK struct { + Payload *models.PartialAdversary +} + +// IsSuccess returns true when this head Api v2 adversaries adversary Id o k response has a 2xx status code +func (o *HeadAPIV2AdversariesAdversaryIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 adversaries adversary Id o k response has a 3xx status code +func (o *HeadAPIV2AdversariesAdversaryIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 adversaries adversary Id o k response has a 4xx status code +func (o *HeadAPIV2AdversariesAdversaryIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 adversaries adversary Id o k response has a 5xx status code +func (o *HeadAPIV2AdversariesAdversaryIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 adversaries adversary Id o k response a status code equal to that given +func (o *HeadAPIV2AdversariesAdversaryIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 adversaries adversary Id o k response +func (o *HeadAPIV2AdversariesAdversaryIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2AdversariesAdversaryIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/adversaries/{adversary_id}][%d] headApiV2AdversariesAdversaryIdOK %s", 200, payload) +} + +func (o *HeadAPIV2AdversariesAdversaryIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/adversaries/{adversary_id}][%d] headApiV2AdversariesAdversaryIdOK %s", 200, payload) +} + +func (o *HeadAPIV2AdversariesAdversaryIDOK) GetPayload() *models.PartialAdversary { + return o.Payload +} + +func (o *HeadAPIV2AdversariesAdversaryIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialAdversary) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_parameters.go b/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_parameters.go new file mode 100644 index 00000000..195d8c5b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" +) + +// NewHeadAPIV2AdversariesParams creates a new HeadAPIV2AdversariesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2AdversariesParams() *HeadAPIV2AdversariesParams { + return &HeadAPIV2AdversariesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2AdversariesParamsWithTimeout creates a new HeadAPIV2AdversariesParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2AdversariesParamsWithTimeout(timeout time.Duration) *HeadAPIV2AdversariesParams { + return &HeadAPIV2AdversariesParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2AdversariesParamsWithContext creates a new HeadAPIV2AdversariesParams object +// with the ability to set a context for a request. +func NewHeadAPIV2AdversariesParamsWithContext(ctx context.Context) *HeadAPIV2AdversariesParams { + return &HeadAPIV2AdversariesParams{ + Context: ctx, + } +} + +// NewHeadAPIV2AdversariesParamsWithHTTPClient creates a new HeadAPIV2AdversariesParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2AdversariesParamsWithHTTPClient(client *http.Client) *HeadAPIV2AdversariesParams { + return &HeadAPIV2AdversariesParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2AdversariesParams contains all the parameters to send to the API endpoint + + for the head API v2 adversaries operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2AdversariesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 adversaries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AdversariesParams) WithDefaults() *HeadAPIV2AdversariesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 adversaries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AdversariesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) WithTimeout(timeout time.Duration) *HeadAPIV2AdversariesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) WithContext(ctx context.Context) *HeadAPIV2AdversariesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) WithHTTPClient(client *http.Client) *HeadAPIV2AdversariesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) WithExclude(exclude []string) *HeadAPIV2AdversariesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) WithInclude(include []string) *HeadAPIV2AdversariesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) WithSort(sort *string) *HeadAPIV2AdversariesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 adversaries params +func (o *HeadAPIV2AdversariesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2AdversariesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Adversaries binds the parameter exclude +func (o *HeadAPIV2AdversariesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Adversaries binds the parameter include +func (o *HeadAPIV2AdversariesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_responses.go b/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_responses.go new file mode 100644 index 00000000..a3f5e59d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/head_api_v2_adversaries_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2AdversariesReader is a Reader for the HeadAPIV2Adversaries structure. +type HeadAPIV2AdversariesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2AdversariesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2AdversariesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/adversaries] HeadAPIV2Adversaries", response, response.Code()) + } +} + +// NewHeadAPIV2AdversariesOK creates a HeadAPIV2AdversariesOK with default headers values +func NewHeadAPIV2AdversariesOK() *HeadAPIV2AdversariesOK { + return &HeadAPIV2AdversariesOK{} +} + +/* +HeadAPIV2AdversariesOK describes a response with status code 200, with default header values. + +Returns a list in `AdversarySchema` format of all available adversaries in the system. +*/ +type HeadAPIV2AdversariesOK struct { + Payload []*models.PartialAdversary +} + +// IsSuccess returns true when this head Api v2 adversaries o k response has a 2xx status code +func (o *HeadAPIV2AdversariesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 adversaries o k response has a 3xx status code +func (o *HeadAPIV2AdversariesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 adversaries o k response has a 4xx status code +func (o *HeadAPIV2AdversariesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 adversaries o k response has a 5xx status code +func (o *HeadAPIV2AdversariesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 adversaries o k response a status code equal to that given +func (o *HeadAPIV2AdversariesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 adversaries o k response +func (o *HeadAPIV2AdversariesOK) Code() int { + return 200 +} + +func (o *HeadAPIV2AdversariesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/adversaries][%d] headApiV2AdversariesOK %s", 200, payload) +} + +func (o *HeadAPIV2AdversariesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/adversaries][%d] headApiV2AdversariesOK %s", 200, payload) +} + +func (o *HeadAPIV2AdversariesOK) GetPayload() []*models.PartialAdversary { + return o.Payload +} + +func (o *HeadAPIV2AdversariesOK) 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/core/capability/caldera/api/client/adversaries/patch_api_v2_adversaries_adversary_id_parameters.go b/pkg/core/capability/caldera/api/client/adversaries/patch_api_v2_adversaries_adversary_id_parameters.go new file mode 100644 index 00000000..75862c02 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/patch_api_v2_adversaries_adversary_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2AdversariesAdversaryIDParams creates a new PatchAPIV2AdversariesAdversaryIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2AdversariesAdversaryIDParams() *PatchAPIV2AdversariesAdversaryIDParams { + return &PatchAPIV2AdversariesAdversaryIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2AdversariesAdversaryIDParamsWithTimeout creates a new PatchAPIV2AdversariesAdversaryIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2AdversariesAdversaryIDParamsWithTimeout(timeout time.Duration) *PatchAPIV2AdversariesAdversaryIDParams { + return &PatchAPIV2AdversariesAdversaryIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2AdversariesAdversaryIDParamsWithContext creates a new PatchAPIV2AdversariesAdversaryIDParams object +// with the ability to set a context for a request. +func NewPatchAPIV2AdversariesAdversaryIDParamsWithContext(ctx context.Context) *PatchAPIV2AdversariesAdversaryIDParams { + return &PatchAPIV2AdversariesAdversaryIDParams{ + Context: ctx, + } +} + +// NewPatchAPIV2AdversariesAdversaryIDParamsWithHTTPClient creates a new PatchAPIV2AdversariesAdversaryIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2AdversariesAdversaryIDParamsWithHTTPClient(client *http.Client) *PatchAPIV2AdversariesAdversaryIDParams { + return &PatchAPIV2AdversariesAdversaryIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2AdversariesAdversaryIDParams contains all the parameters to send to the API endpoint + + for the patch API v2 adversaries adversary ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2AdversariesAdversaryIDParams struct { + + /* AdversaryID. + + UUID of the adversary to be updated + */ + AdversaryID string + + // Body. + Body *models.PartialAdversary1 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2AdversariesAdversaryIDParams) WithDefaults() *PatchAPIV2AdversariesAdversaryIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2AdversariesAdversaryIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) WithTimeout(timeout time.Duration) *PatchAPIV2AdversariesAdversaryIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) WithContext(ctx context.Context) *PatchAPIV2AdversariesAdversaryIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) WithHTTPClient(client *http.Client) *PatchAPIV2AdversariesAdversaryIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAdversaryID adds the adversaryID to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) WithAdversaryID(adversaryID string) *PatchAPIV2AdversariesAdversaryIDParams { + o.SetAdversaryID(adversaryID) + return o +} + +// SetAdversaryID adds the adversaryId to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) SetAdversaryID(adversaryID string) { + o.AdversaryID = adversaryID +} + +// WithBody adds the body to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) WithBody(body *models.PartialAdversary1) *PatchAPIV2AdversariesAdversaryIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 adversaries adversary ID params +func (o *PatchAPIV2AdversariesAdversaryIDParams) SetBody(body *models.PartialAdversary1) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2AdversariesAdversaryIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param adversary_id + if err := r.SetPathParam("adversary_id", o.AdversaryID); err != nil { + return err + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/patch_api_v2_adversaries_adversary_id_responses.go b/pkg/core/capability/caldera/api/client/adversaries/patch_api_v2_adversaries_adversary_id_responses.go new file mode 100644 index 00000000..4f55982e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/patch_api_v2_adversaries_adversary_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2AdversariesAdversaryIDReader is a Reader for the PatchAPIV2AdversariesAdversaryID structure. +type PatchAPIV2AdversariesAdversaryIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2AdversariesAdversaryIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2AdversariesAdversaryIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/adversaries/{adversary_id}] PatchAPIV2AdversariesAdversaryID", response, response.Code()) + } +} + +// NewPatchAPIV2AdversariesAdversaryIDOK creates a PatchAPIV2AdversariesAdversaryIDOK with default headers values +func NewPatchAPIV2AdversariesAdversaryIDOK() *PatchAPIV2AdversariesAdversaryIDOK { + return &PatchAPIV2AdversariesAdversaryIDOK{} +} + +/* +PatchAPIV2AdversariesAdversaryIDOK describes a response with status code 200, with default header values. + +The updated adversary in AdversarySchema format. +*/ +type PatchAPIV2AdversariesAdversaryIDOK struct { + Payload *models.Adversary +} + +// IsSuccess returns true when this patch Api v2 adversaries adversary Id o k response has a 2xx status code +func (o *PatchAPIV2AdversariesAdversaryIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 adversaries adversary Id o k response has a 3xx status code +func (o *PatchAPIV2AdversariesAdversaryIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 adversaries adversary Id o k response has a 4xx status code +func (o *PatchAPIV2AdversariesAdversaryIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 adversaries adversary Id o k response has a 5xx status code +func (o *PatchAPIV2AdversariesAdversaryIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 adversaries adversary Id o k response a status code equal to that given +func (o *PatchAPIV2AdversariesAdversaryIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 adversaries adversary Id o k response +func (o *PatchAPIV2AdversariesAdversaryIDOK) Code() int { + return 200 +} + +func (o *PatchAPIV2AdversariesAdversaryIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/adversaries/{adversary_id}][%d] patchApiV2AdversariesAdversaryIdOK %s", 200, payload) +} + +func (o *PatchAPIV2AdversariesAdversaryIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/adversaries/{adversary_id}][%d] patchApiV2AdversariesAdversaryIdOK %s", 200, payload) +} + +func (o *PatchAPIV2AdversariesAdversaryIDOK) GetPayload() *models.Adversary { + return o.Payload +} + +func (o *PatchAPIV2AdversariesAdversaryIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Adversary) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/post_api_v2_adversaries_parameters.go b/pkg/core/capability/caldera/api/client/adversaries/post_api_v2_adversaries_parameters.go new file mode 100644 index 00000000..355e479e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/post_api_v2_adversaries_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2AdversariesParams creates a new PostAPIV2AdversariesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2AdversariesParams() *PostAPIV2AdversariesParams { + return &PostAPIV2AdversariesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2AdversariesParamsWithTimeout creates a new PostAPIV2AdversariesParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2AdversariesParamsWithTimeout(timeout time.Duration) *PostAPIV2AdversariesParams { + return &PostAPIV2AdversariesParams{ + timeout: timeout, + } +} + +// NewPostAPIV2AdversariesParamsWithContext creates a new PostAPIV2AdversariesParams object +// with the ability to set a context for a request. +func NewPostAPIV2AdversariesParamsWithContext(ctx context.Context) *PostAPIV2AdversariesParams { + return &PostAPIV2AdversariesParams{ + Context: ctx, + } +} + +// NewPostAPIV2AdversariesParamsWithHTTPClient creates a new PostAPIV2AdversariesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2AdversariesParamsWithHTTPClient(client *http.Client) *PostAPIV2AdversariesParams { + return &PostAPIV2AdversariesParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2AdversariesParams contains all the parameters to send to the API endpoint + + for the post API v2 adversaries operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2AdversariesParams struct { + + // Body. + Body *models.Adversary + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 adversaries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2AdversariesParams) WithDefaults() *PostAPIV2AdversariesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 adversaries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2AdversariesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 adversaries params +func (o *PostAPIV2AdversariesParams) WithTimeout(timeout time.Duration) *PostAPIV2AdversariesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 adversaries params +func (o *PostAPIV2AdversariesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 adversaries params +func (o *PostAPIV2AdversariesParams) WithContext(ctx context.Context) *PostAPIV2AdversariesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 adversaries params +func (o *PostAPIV2AdversariesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 adversaries params +func (o *PostAPIV2AdversariesParams) WithHTTPClient(client *http.Client) *PostAPIV2AdversariesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 adversaries params +func (o *PostAPIV2AdversariesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 adversaries params +func (o *PostAPIV2AdversariesParams) WithBody(body *models.Adversary) *PostAPIV2AdversariesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 adversaries params +func (o *PostAPIV2AdversariesParams) SetBody(body *models.Adversary) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2AdversariesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/post_api_v2_adversaries_responses.go b/pkg/core/capability/caldera/api/client/adversaries/post_api_v2_adversaries_responses.go new file mode 100644 index 00000000..acbc6044 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/post_api_v2_adversaries_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2AdversariesReader is a Reader for the PostAPIV2Adversaries structure. +type PostAPIV2AdversariesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2AdversariesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2AdversariesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/adversaries] PostAPIV2Adversaries", response, response.Code()) + } +} + +// NewPostAPIV2AdversariesOK creates a PostAPIV2AdversariesOK with default headers values +func NewPostAPIV2AdversariesOK() *PostAPIV2AdversariesOK { + return &PostAPIV2AdversariesOK{} +} + +/* +PostAPIV2AdversariesOK describes a response with status code 200, with default header values. + +A single adversary in AdversarySchema format. +*/ +type PostAPIV2AdversariesOK struct { + Payload *models.Adversary +} + +// IsSuccess returns true when this post Api v2 adversaries o k response has a 2xx status code +func (o *PostAPIV2AdversariesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 adversaries o k response has a 3xx status code +func (o *PostAPIV2AdversariesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 adversaries o k response has a 4xx status code +func (o *PostAPIV2AdversariesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 adversaries o k response has a 5xx status code +func (o *PostAPIV2AdversariesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 adversaries o k response a status code equal to that given +func (o *PostAPIV2AdversariesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 adversaries o k response +func (o *PostAPIV2AdversariesOK) Code() int { + return 200 +} + +func (o *PostAPIV2AdversariesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/adversaries][%d] postApiV2AdversariesOK %s", 200, payload) +} + +func (o *PostAPIV2AdversariesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/adversaries][%d] postApiV2AdversariesOK %s", 200, payload) +} + +func (o *PostAPIV2AdversariesOK) GetPayload() *models.Adversary { + return o.Payload +} + +func (o *PostAPIV2AdversariesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Adversary) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/put_api_v2_adversaries_adversary_id_parameters.go b/pkg/core/capability/caldera/api/client/adversaries/put_api_v2_adversaries_adversary_id_parameters.go new file mode 100644 index 00000000..9cd820c0 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/put_api_v2_adversaries_adversary_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPutAPIV2AdversariesAdversaryIDParams creates a new PutAPIV2AdversariesAdversaryIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPutAPIV2AdversariesAdversaryIDParams() *PutAPIV2AdversariesAdversaryIDParams { + return &PutAPIV2AdversariesAdversaryIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPutAPIV2AdversariesAdversaryIDParamsWithTimeout creates a new PutAPIV2AdversariesAdversaryIDParams object +// with the ability to set a timeout on a request. +func NewPutAPIV2AdversariesAdversaryIDParamsWithTimeout(timeout time.Duration) *PutAPIV2AdversariesAdversaryIDParams { + return &PutAPIV2AdversariesAdversaryIDParams{ + timeout: timeout, + } +} + +// NewPutAPIV2AdversariesAdversaryIDParamsWithContext creates a new PutAPIV2AdversariesAdversaryIDParams object +// with the ability to set a context for a request. +func NewPutAPIV2AdversariesAdversaryIDParamsWithContext(ctx context.Context) *PutAPIV2AdversariesAdversaryIDParams { + return &PutAPIV2AdversariesAdversaryIDParams{ + Context: ctx, + } +} + +// NewPutAPIV2AdversariesAdversaryIDParamsWithHTTPClient creates a new PutAPIV2AdversariesAdversaryIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPutAPIV2AdversariesAdversaryIDParamsWithHTTPClient(client *http.Client) *PutAPIV2AdversariesAdversaryIDParams { + return &PutAPIV2AdversariesAdversaryIDParams{ + HTTPClient: client, + } +} + +/* +PutAPIV2AdversariesAdversaryIDParams contains all the parameters to send to the API endpoint + + for the put API v2 adversaries adversary ID operation. + + Typically these are written to a http.Request. +*/ +type PutAPIV2AdversariesAdversaryIDParams struct { + + /* AdversaryID. + + UUID of the adversary to be created or updated + */ + AdversaryID string + + // Body. + Body *models.PartialAdversary + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the put API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2AdversariesAdversaryIDParams) WithDefaults() *PutAPIV2AdversariesAdversaryIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put API v2 adversaries adversary ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2AdversariesAdversaryIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) WithTimeout(timeout time.Duration) *PutAPIV2AdversariesAdversaryIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) WithContext(ctx context.Context) *PutAPIV2AdversariesAdversaryIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) WithHTTPClient(client *http.Client) *PutAPIV2AdversariesAdversaryIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAdversaryID adds the adversaryID to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) WithAdversaryID(adversaryID string) *PutAPIV2AdversariesAdversaryIDParams { + o.SetAdversaryID(adversaryID) + return o +} + +// SetAdversaryID adds the adversaryId to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) SetAdversaryID(adversaryID string) { + o.AdversaryID = adversaryID +} + +// WithBody adds the body to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) WithBody(body *models.PartialAdversary) *PutAPIV2AdversariesAdversaryIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put API v2 adversaries adversary ID params +func (o *PutAPIV2AdversariesAdversaryIDParams) SetBody(body *models.PartialAdversary) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAPIV2AdversariesAdversaryIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param adversary_id + if err := r.SetPathParam("adversary_id", o.AdversaryID); err != nil { + return err + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/adversaries/put_api_v2_adversaries_adversary_id_responses.go b/pkg/core/capability/caldera/api/client/adversaries/put_api_v2_adversaries_adversary_id_responses.go new file mode 100644 index 00000000..20e4a267 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/adversaries/put_api_v2_adversaries_adversary_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adversaries + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PutAPIV2AdversariesAdversaryIDReader is a Reader for the PutAPIV2AdversariesAdversaryID structure. +type PutAPIV2AdversariesAdversaryIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAPIV2AdversariesAdversaryIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPutAPIV2AdversariesAdversaryIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PUT /api/v2/adversaries/{adversary_id}] PutAPIV2AdversariesAdversaryID", response, response.Code()) + } +} + +// NewPutAPIV2AdversariesAdversaryIDOK creates a PutAPIV2AdversariesAdversaryIDOK with default headers values +func NewPutAPIV2AdversariesAdversaryIDOK() *PutAPIV2AdversariesAdversaryIDOK { + return &PutAPIV2AdversariesAdversaryIDOK{} +} + +/* +PutAPIV2AdversariesAdversaryIDOK describes a response with status code 200, with default header values. + +A single adversary, either newly created or updated, in AdversarySchema format. +*/ +type PutAPIV2AdversariesAdversaryIDOK struct { + Payload *models.Adversary +} + +// IsSuccess returns true when this put Api v2 adversaries adversary Id o k response has a 2xx status code +func (o *PutAPIV2AdversariesAdversaryIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put Api v2 adversaries adversary Id o k response has a 3xx status code +func (o *PutAPIV2AdversariesAdversaryIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put Api v2 adversaries adversary Id o k response has a 4xx status code +func (o *PutAPIV2AdversariesAdversaryIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this put Api v2 adversaries adversary Id o k response has a 5xx status code +func (o *PutAPIV2AdversariesAdversaryIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put Api v2 adversaries adversary Id o k response a status code equal to that given +func (o *PutAPIV2AdversariesAdversaryIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the put Api v2 adversaries adversary Id o k response +func (o *PutAPIV2AdversariesAdversaryIDOK) Code() int { + return 200 +} + +func (o *PutAPIV2AdversariesAdversaryIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/adversaries/{adversary_id}][%d] putApiV2AdversariesAdversaryIdOK %s", 200, payload) +} + +func (o *PutAPIV2AdversariesAdversaryIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/adversaries/{adversary_id}][%d] putApiV2AdversariesAdversaryIdOK %s", 200, payload) +} + +func (o *PutAPIV2AdversariesAdversaryIDOK) GetPayload() *models.Adversary { + return o.Payload +} + +func (o *PutAPIV2AdversariesAdversaryIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Adversary) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/agents_client.go b/pkg/core/capability/caldera/api/client/agents/agents_client.go new file mode 100644 index 00000000..11dd002d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/agents_client.go @@ -0,0 +1,569 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new agents API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new agents API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new agents API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for agents API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2AgentsPaw(params *DeleteAPIV2AgentsPawParams, opts ...ClientOption) (*DeleteAPIV2AgentsPawOK, error) + + GetAPIV2Agents(params *GetAPIV2AgentsParams, opts ...ClientOption) (*GetAPIV2AgentsOK, error) + + GetAPIV2AgentsPaw(params *GetAPIV2AgentsPawParams, opts ...ClientOption) (*GetAPIV2AgentsPawOK, error) + + GetAPIV2DeployCommands(params *GetAPIV2DeployCommandsParams, opts ...ClientOption) (*GetAPIV2DeployCommandsOK, error) + + GetAPIV2DeployCommandsAbilityID(params *GetAPIV2DeployCommandsAbilityIDParams, opts ...ClientOption) (*GetAPIV2DeployCommandsAbilityIDOK, error) + + HeadAPIV2Agents(params *HeadAPIV2AgentsParams, opts ...ClientOption) (*HeadAPIV2AgentsOK, error) + + HeadAPIV2AgentsPaw(params *HeadAPIV2AgentsPawParams, opts ...ClientOption) (*HeadAPIV2AgentsPawOK, error) + + HeadAPIV2DeployCommands(params *HeadAPIV2DeployCommandsParams, opts ...ClientOption) (*HeadAPIV2DeployCommandsOK, error) + + HeadAPIV2DeployCommandsAbilityID(params *HeadAPIV2DeployCommandsAbilityIDParams, opts ...ClientOption) (*HeadAPIV2DeployCommandsAbilityIDOK, error) + + PatchAPIV2AgentsPaw(params *PatchAPIV2AgentsPawParams, opts ...ClientOption) (*PatchAPIV2AgentsPawOK, error) + + PostAPIV2Agents(params *PostAPIV2AgentsParams, opts ...ClientOption) (*PostAPIV2AgentsOK, error) + + PutAPIV2AgentsPaw(params *PutAPIV2AgentsPawParams, opts ...ClientOption) (*PutAPIV2AgentsPawOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2AgentsPaw deletes an agent + +Delete an agent. Use the paw field in the URL to specify matching criteria for the agent(s) to delete. +*/ +func (a *Client) DeleteAPIV2AgentsPaw(params *DeleteAPIV2AgentsPawParams, opts ...ClientOption) (*DeleteAPIV2AgentsPawOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2AgentsPawParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2AgentsPaw", + Method: "DELETE", + PathPattern: "/api/v2/agents/{paw}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2AgentsPawReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2AgentsPawOK) + 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 DeleteAPIV2AgentsPaw: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Agents retrieves all agents + +Retrieves all stored agents. +*/ +func (a *Client) GetAPIV2Agents(params *GetAPIV2AgentsParams, opts ...ClientOption) (*GetAPIV2AgentsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2AgentsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Agents", + Method: "GET", + PathPattern: "/api/v2/agents", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2AgentsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2AgentsOK) + 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 GetAPIV2Agents: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2AgentsPaw retrieves agent by paw + +Retrieve information about a specific agent using its ID (paw). Use the paw field in the URL to specify matching criteria for the agent to obtain information about. +*/ +func (a *Client) GetAPIV2AgentsPaw(params *GetAPIV2AgentsPawParams, opts ...ClientOption) (*GetAPIV2AgentsPawOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2AgentsPawParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2AgentsPaw", + Method: "GET", + PathPattern: "/api/v2/agents/{paw}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2AgentsPawReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2AgentsPawOK) + 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 GetAPIV2AgentsPaw: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2DeployCommands retrieves deploy commands + +Retrieve the deploy commands currently configured within Caldera. +*/ +func (a *Client) GetAPIV2DeployCommands(params *GetAPIV2DeployCommandsParams, opts ...ClientOption) (*GetAPIV2DeployCommandsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2DeployCommandsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2DeployCommands", + Method: "GET", + PathPattern: "/api/v2/deploy_commands", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2DeployCommandsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2DeployCommandsOK) + 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 GetAPIV2DeployCommands: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2DeployCommandsAbilityID retrieves deploy commands for an ability + +Retrieve the deploy commands associated with a given ability ID. Use the 'ability_id' field in the URL specify which ability to retrieve deploy commands for. +*/ +func (a *Client) GetAPIV2DeployCommandsAbilityID(params *GetAPIV2DeployCommandsAbilityIDParams, opts ...ClientOption) (*GetAPIV2DeployCommandsAbilityIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2DeployCommandsAbilityIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2DeployCommandsAbilityID", + Method: "GET", + PathPattern: "/api/v2/deploy_commands/{ability_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2DeployCommandsAbilityIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2DeployCommandsAbilityIDOK) + 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 GetAPIV2DeployCommandsAbilityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Agents retrieves all agents + +Retrieves all stored agents. +*/ +func (a *Client) HeadAPIV2Agents(params *HeadAPIV2AgentsParams, opts ...ClientOption) (*HeadAPIV2AgentsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2AgentsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Agents", + Method: "HEAD", + PathPattern: "/api/v2/agents", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2AgentsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2AgentsOK) + 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 HeadAPIV2Agents: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2AgentsPaw retrieves agent by paw + +Retrieve information about a specific agent using its ID (paw). Use the paw field in the URL to specify matching criteria for the agent to obtain information about. +*/ +func (a *Client) HeadAPIV2AgentsPaw(params *HeadAPIV2AgentsPawParams, opts ...ClientOption) (*HeadAPIV2AgentsPawOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2AgentsPawParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2AgentsPaw", + Method: "HEAD", + PathPattern: "/api/v2/agents/{paw}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2AgentsPawReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2AgentsPawOK) + 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 HeadAPIV2AgentsPaw: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2DeployCommands retrieves deploy commands + +Retrieve the deploy commands currently configured within Caldera. +*/ +func (a *Client) HeadAPIV2DeployCommands(params *HeadAPIV2DeployCommandsParams, opts ...ClientOption) (*HeadAPIV2DeployCommandsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2DeployCommandsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2DeployCommands", + Method: "HEAD", + PathPattern: "/api/v2/deploy_commands", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2DeployCommandsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2DeployCommandsOK) + 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 HeadAPIV2DeployCommands: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2DeployCommandsAbilityID retrieves deploy commands for an ability + +Retrieve the deploy commands associated with a given ability ID. Use the 'ability_id' field in the URL specify which ability to retrieve deploy commands for. +*/ +func (a *Client) HeadAPIV2DeployCommandsAbilityID(params *HeadAPIV2DeployCommandsAbilityIDParams, opts ...ClientOption) (*HeadAPIV2DeployCommandsAbilityIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2DeployCommandsAbilityIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2DeployCommandsAbilityID", + Method: "HEAD", + PathPattern: "/api/v2/deploy_commands/{ability_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2DeployCommandsAbilityIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2DeployCommandsAbilityIDOK) + 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 HeadAPIV2DeployCommandsAbilityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2AgentsPaw updates an agent + +Update the attributes of a specific Agent using its ID (paw). Use the paw field in the URL to specify matching criteria and the fields from the AgentSchema in the request body to specify updated field values. +*/ +func (a *Client) PatchAPIV2AgentsPaw(params *PatchAPIV2AgentsPawParams, opts ...ClientOption) (*PatchAPIV2AgentsPawOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2AgentsPawParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2AgentsPaw", + Method: "PATCH", + PathPattern: "/api/v2/agents/{paw}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2AgentsPawReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2AgentsPawOK) + 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 PatchAPIV2AgentsPaw: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Agents creates a new agent + +Creates a new agent using the format from 'AgentSchema'. +*/ +func (a *Client) PostAPIV2Agents(params *PostAPIV2AgentsParams, opts ...ClientOption) (*PostAPIV2AgentsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2AgentsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Agents", + Method: "POST", + PathPattern: "/api/v2/agents", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2AgentsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2AgentsOK) + 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 PostAPIV2Agents: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PutAPIV2AgentsPaw creates or update an agent + +Update an agent, or if a existing agent match cannot be found, create one. Use the paw field in the URL to specify matching criteria and the fields from the AgentSchema in the request body to specify new field values. +*/ +func (a *Client) PutAPIV2AgentsPaw(params *PutAPIV2AgentsPawParams, opts ...ClientOption) (*PutAPIV2AgentsPawOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAPIV2AgentsPawParams() + } + op := &runtime.ClientOperation{ + ID: "PutAPIV2AgentsPaw", + Method: "PUT", + PathPattern: "/api/v2/agents/{paw}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutAPIV2AgentsPawReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PutAPIV2AgentsPawOK) + 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 PutAPIV2AgentsPaw: 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/core/capability/caldera/api/client/agents/delete_api_v2_agents_paw_parameters.go b/pkg/core/capability/caldera/api/client/agents/delete_api_v2_agents_paw_parameters.go new file mode 100644 index 00000000..65d4221d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/delete_api_v2_agents_paw_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewDeleteAPIV2AgentsPawParams creates a new DeleteAPIV2AgentsPawParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2AgentsPawParams() *DeleteAPIV2AgentsPawParams { + return &DeleteAPIV2AgentsPawParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2AgentsPawParamsWithTimeout creates a new DeleteAPIV2AgentsPawParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2AgentsPawParamsWithTimeout(timeout time.Duration) *DeleteAPIV2AgentsPawParams { + return &DeleteAPIV2AgentsPawParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2AgentsPawParamsWithContext creates a new DeleteAPIV2AgentsPawParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2AgentsPawParamsWithContext(ctx context.Context) *DeleteAPIV2AgentsPawParams { + return &DeleteAPIV2AgentsPawParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2AgentsPawParamsWithHTTPClient creates a new DeleteAPIV2AgentsPawParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2AgentsPawParamsWithHTTPClient(client *http.Client) *DeleteAPIV2AgentsPawParams { + return &DeleteAPIV2AgentsPawParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2AgentsPawParams contains all the parameters to send to the API endpoint + + for the delete API v2 agents paw operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2AgentsPawParams struct { + + /* Paw. + + paw of the Agent to be deleted + */ + Paw string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2AgentsPawParams) WithDefaults() *DeleteAPIV2AgentsPawParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2AgentsPawParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 agents paw params +func (o *DeleteAPIV2AgentsPawParams) WithTimeout(timeout time.Duration) *DeleteAPIV2AgentsPawParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 agents paw params +func (o *DeleteAPIV2AgentsPawParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 agents paw params +func (o *DeleteAPIV2AgentsPawParams) WithContext(ctx context.Context) *DeleteAPIV2AgentsPawParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 agents paw params +func (o *DeleteAPIV2AgentsPawParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 agents paw params +func (o *DeleteAPIV2AgentsPawParams) WithHTTPClient(client *http.Client) *DeleteAPIV2AgentsPawParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 agents paw params +func (o *DeleteAPIV2AgentsPawParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPaw adds the paw to the delete API v2 agents paw params +func (o *DeleteAPIV2AgentsPawParams) WithPaw(paw string) *DeleteAPIV2AgentsPawParams { + o.SetPaw(paw) + return o +} + +// SetPaw adds the paw to the delete API v2 agents paw params +func (o *DeleteAPIV2AgentsPawParams) SetPaw(paw string) { + o.Paw = paw +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2AgentsPawParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param paw + if err := r.SetPathParam("paw", o.Paw); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/delete_api_v2_agents_paw_responses.go b/pkg/core/capability/caldera/api/client/agents/delete_api_v2_agents_paw_responses.go new file mode 100644 index 00000000..0c62d987 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/delete_api_v2_agents_paw_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// DeleteAPIV2AgentsPawReader is a Reader for the DeleteAPIV2AgentsPaw structure. +type DeleteAPIV2AgentsPawReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2AgentsPawReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPIV2AgentsPawOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/agents/{paw}] DeleteAPIV2AgentsPaw", response, response.Code()) + } +} + +// NewDeleteAPIV2AgentsPawOK creates a DeleteAPIV2AgentsPawOK with default headers values +func NewDeleteAPIV2AgentsPawOK() *DeleteAPIV2AgentsPawOK { + return &DeleteAPIV2AgentsPawOK{} +} + +/* +DeleteAPIV2AgentsPawOK describes a response with status code 200, with default header values. + +Returns HTTP 200 +*/ +type DeleteAPIV2AgentsPawOK struct { + Payload models.Agent1 +} + +// IsSuccess returns true when this delete Api v2 agents paw o k response has a 2xx status code +func (o *DeleteAPIV2AgentsPawOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 agents paw o k response has a 3xx status code +func (o *DeleteAPIV2AgentsPawOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 agents paw o k response has a 4xx status code +func (o *DeleteAPIV2AgentsPawOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 agents paw o k response has a 5xx status code +func (o *DeleteAPIV2AgentsPawOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 agents paw o k response a status code equal to that given +func (o *DeleteAPIV2AgentsPawOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete Api v2 agents paw o k response +func (o *DeleteAPIV2AgentsPawOK) Code() int { + return 200 +} + +func (o *DeleteAPIV2AgentsPawOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/agents/{paw}][%d] deleteApiV2AgentsPawOK %s", 200, payload) +} + +func (o *DeleteAPIV2AgentsPawOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/agents/{paw}][%d] deleteApiV2AgentsPawOK %s", 200, payload) +} + +func (o *DeleteAPIV2AgentsPawOK) GetPayload() models.Agent1 { + return o.Payload +} + +func (o *DeleteAPIV2AgentsPawOK) 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/core/capability/caldera/api/client/agents/get_api_v2_agents_parameters.go b/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_parameters.go new file mode 100644 index 00000000..49bdb0b6 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewGetAPIV2AgentsParams creates a new GetAPIV2AgentsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2AgentsParams() *GetAPIV2AgentsParams { + return &GetAPIV2AgentsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2AgentsParamsWithTimeout creates a new GetAPIV2AgentsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2AgentsParamsWithTimeout(timeout time.Duration) *GetAPIV2AgentsParams { + return &GetAPIV2AgentsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2AgentsParamsWithContext creates a new GetAPIV2AgentsParams object +// with the ability to set a context for a request. +func NewGetAPIV2AgentsParamsWithContext(ctx context.Context) *GetAPIV2AgentsParams { + return &GetAPIV2AgentsParams{ + Context: ctx, + } +} + +// NewGetAPIV2AgentsParamsWithHTTPClient creates a new GetAPIV2AgentsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2AgentsParamsWithHTTPClient(client *http.Client) *GetAPIV2AgentsParams { + return &GetAPIV2AgentsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2AgentsParams contains all the parameters to send to the API endpoint + + for the get API v2 agents operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2AgentsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 agents params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AgentsParams) WithDefaults() *GetAPIV2AgentsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 agents params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AgentsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 agents params +func (o *GetAPIV2AgentsParams) WithTimeout(timeout time.Duration) *GetAPIV2AgentsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 agents params +func (o *GetAPIV2AgentsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 agents params +func (o *GetAPIV2AgentsParams) WithContext(ctx context.Context) *GetAPIV2AgentsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 agents params +func (o *GetAPIV2AgentsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 agents params +func (o *GetAPIV2AgentsParams) WithHTTPClient(client *http.Client) *GetAPIV2AgentsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 agents params +func (o *GetAPIV2AgentsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 agents params +func (o *GetAPIV2AgentsParams) WithExclude(exclude []string) *GetAPIV2AgentsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 agents params +func (o *GetAPIV2AgentsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 agents params +func (o *GetAPIV2AgentsParams) WithInclude(include []string) *GetAPIV2AgentsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 agents params +func (o *GetAPIV2AgentsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 agents params +func (o *GetAPIV2AgentsParams) WithSort(sort *string) *GetAPIV2AgentsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 agents params +func (o *GetAPIV2AgentsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2AgentsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Agents binds the parameter exclude +func (o *GetAPIV2AgentsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Agents binds the parameter include +func (o *GetAPIV2AgentsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_paw_parameters.go b/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_paw_parameters.go new file mode 100644 index 00000000..b378450c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_paw_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewGetAPIV2AgentsPawParams creates a new GetAPIV2AgentsPawParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2AgentsPawParams() *GetAPIV2AgentsPawParams { + return &GetAPIV2AgentsPawParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2AgentsPawParamsWithTimeout creates a new GetAPIV2AgentsPawParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2AgentsPawParamsWithTimeout(timeout time.Duration) *GetAPIV2AgentsPawParams { + return &GetAPIV2AgentsPawParams{ + timeout: timeout, + } +} + +// NewGetAPIV2AgentsPawParamsWithContext creates a new GetAPIV2AgentsPawParams object +// with the ability to set a context for a request. +func NewGetAPIV2AgentsPawParamsWithContext(ctx context.Context) *GetAPIV2AgentsPawParams { + return &GetAPIV2AgentsPawParams{ + Context: ctx, + } +} + +// NewGetAPIV2AgentsPawParamsWithHTTPClient creates a new GetAPIV2AgentsPawParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2AgentsPawParamsWithHTTPClient(client *http.Client) *GetAPIV2AgentsPawParams { + return &GetAPIV2AgentsPawParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2AgentsPawParams contains all the parameters to send to the API endpoint + + for the get API v2 agents paw operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2AgentsPawParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + /* Paw. + + ID of the Agent to retrieve information about + */ + Paw string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AgentsPawParams) WithDefaults() *GetAPIV2AgentsPawParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2AgentsPawParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) WithTimeout(timeout time.Duration) *GetAPIV2AgentsPawParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) WithContext(ctx context.Context) *GetAPIV2AgentsPawParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) WithHTTPClient(client *http.Client) *GetAPIV2AgentsPawParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) WithExclude(exclude []string) *GetAPIV2AgentsPawParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) WithInclude(include []string) *GetAPIV2AgentsPawParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) SetInclude(include []string) { + o.Include = include +} + +// WithPaw adds the paw to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) WithPaw(paw string) *GetAPIV2AgentsPawParams { + o.SetPaw(paw) + return o +} + +// SetPaw adds the paw to the get API v2 agents paw params +func (o *GetAPIV2AgentsPawParams) SetPaw(paw string) { + o.Paw = paw +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2AgentsPawParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param paw + if err := r.SetPathParam("paw", o.Paw); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2AgentsPaw binds the parameter exclude +func (o *GetAPIV2AgentsPawParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2AgentsPaw binds the parameter include +func (o *GetAPIV2AgentsPawParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_paw_responses.go b/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_paw_responses.go new file mode 100644 index 00000000..25b158f0 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_paw_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2AgentsPawReader is a Reader for the GetAPIV2AgentsPaw structure. +type GetAPIV2AgentsPawReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2AgentsPawReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2AgentsPawOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/agents/{paw}] GetAPIV2AgentsPaw", response, response.Code()) + } +} + +// NewGetAPIV2AgentsPawOK creates a GetAPIV2AgentsPawOK with default headers values +func NewGetAPIV2AgentsPawOK() *GetAPIV2AgentsPawOK { + return &GetAPIV2AgentsPawOK{} +} + +/* +GetAPIV2AgentsPawOK describes a response with status code 200, with default header values. + +Returns JSON response with specified Agent +*/ +type GetAPIV2AgentsPawOK struct { + Payload *models.PartialAgent +} + +// IsSuccess returns true when this get Api v2 agents paw o k response has a 2xx status code +func (o *GetAPIV2AgentsPawOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 agents paw o k response has a 3xx status code +func (o *GetAPIV2AgentsPawOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 agents paw o k response has a 4xx status code +func (o *GetAPIV2AgentsPawOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 agents paw o k response has a 5xx status code +func (o *GetAPIV2AgentsPawOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 agents paw o k response a status code equal to that given +func (o *GetAPIV2AgentsPawOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 agents paw o k response +func (o *GetAPIV2AgentsPawOK) Code() int { + return 200 +} + +func (o *GetAPIV2AgentsPawOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/agents/{paw}][%d] getApiV2AgentsPawOK %s", 200, payload) +} + +func (o *GetAPIV2AgentsPawOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/agents/{paw}][%d] getApiV2AgentsPawOK %s", 200, payload) +} + +func (o *GetAPIV2AgentsPawOK) GetPayload() *models.PartialAgent { + return o.Payload +} + +func (o *GetAPIV2AgentsPawOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialAgent) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_responses.go b/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_responses.go new file mode 100644 index 00000000..7986f504 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/get_api_v2_agents_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2AgentsReader is a Reader for the GetAPIV2Agents structure. +type GetAPIV2AgentsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2AgentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2AgentsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/agents] GetAPIV2Agents", response, response.Code()) + } +} + +// NewGetAPIV2AgentsOK creates a GetAPIV2AgentsOK with default headers values +func NewGetAPIV2AgentsOK() *GetAPIV2AgentsOK { + return &GetAPIV2AgentsOK{} +} + +/* +GetAPIV2AgentsOK describes a response with status code 200, with default header values. + +Returns a list of all agents. +*/ +type GetAPIV2AgentsOK struct { + Payload []*models.PartialAgent +} + +// IsSuccess returns true when this get Api v2 agents o k response has a 2xx status code +func (o *GetAPIV2AgentsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 agents o k response has a 3xx status code +func (o *GetAPIV2AgentsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 agents o k response has a 4xx status code +func (o *GetAPIV2AgentsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 agents o k response has a 5xx status code +func (o *GetAPIV2AgentsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 agents o k response a status code equal to that given +func (o *GetAPIV2AgentsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 agents o k response +func (o *GetAPIV2AgentsOK) Code() int { + return 200 +} + +func (o *GetAPIV2AgentsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/agents][%d] getApiV2AgentsOK %s", 200, payload) +} + +func (o *GetAPIV2AgentsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/agents][%d] getApiV2AgentsOK %s", 200, payload) +} + +func (o *GetAPIV2AgentsOK) GetPayload() []*models.PartialAgent { + return o.Payload +} + +func (o *GetAPIV2AgentsOK) 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/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_ability_id_parameters.go b/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_ability_id_parameters.go new file mode 100644 index 00000000..fe4919d9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_ability_id_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewGetAPIV2DeployCommandsAbilityIDParams creates a new GetAPIV2DeployCommandsAbilityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2DeployCommandsAbilityIDParams() *GetAPIV2DeployCommandsAbilityIDParams { + return &GetAPIV2DeployCommandsAbilityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2DeployCommandsAbilityIDParamsWithTimeout creates a new GetAPIV2DeployCommandsAbilityIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2DeployCommandsAbilityIDParamsWithTimeout(timeout time.Duration) *GetAPIV2DeployCommandsAbilityIDParams { + return &GetAPIV2DeployCommandsAbilityIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2DeployCommandsAbilityIDParamsWithContext creates a new GetAPIV2DeployCommandsAbilityIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2DeployCommandsAbilityIDParamsWithContext(ctx context.Context) *GetAPIV2DeployCommandsAbilityIDParams { + return &GetAPIV2DeployCommandsAbilityIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2DeployCommandsAbilityIDParamsWithHTTPClient creates a new GetAPIV2DeployCommandsAbilityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2DeployCommandsAbilityIDParamsWithHTTPClient(client *http.Client) *GetAPIV2DeployCommandsAbilityIDParams { + return &GetAPIV2DeployCommandsAbilityIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2DeployCommandsAbilityIDParams contains all the parameters to send to the API endpoint + + for the get API v2 deploy commands ability ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2DeployCommandsAbilityIDParams struct { + + /* AbilityID. + + ID of the ability to retrieve deploy commands for + */ + AbilityID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 deploy commands ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2DeployCommandsAbilityIDParams) WithDefaults() *GetAPIV2DeployCommandsAbilityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 deploy commands ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2DeployCommandsAbilityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 deploy commands ability ID params +func (o *GetAPIV2DeployCommandsAbilityIDParams) WithTimeout(timeout time.Duration) *GetAPIV2DeployCommandsAbilityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 deploy commands ability ID params +func (o *GetAPIV2DeployCommandsAbilityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 deploy commands ability ID params +func (o *GetAPIV2DeployCommandsAbilityIDParams) WithContext(ctx context.Context) *GetAPIV2DeployCommandsAbilityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 deploy commands ability ID params +func (o *GetAPIV2DeployCommandsAbilityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 deploy commands ability ID params +func (o *GetAPIV2DeployCommandsAbilityIDParams) WithHTTPClient(client *http.Client) *GetAPIV2DeployCommandsAbilityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 deploy commands ability ID params +func (o *GetAPIV2DeployCommandsAbilityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAbilityID adds the abilityID to the get API v2 deploy commands ability ID params +func (o *GetAPIV2DeployCommandsAbilityIDParams) WithAbilityID(abilityID string) *GetAPIV2DeployCommandsAbilityIDParams { + o.SetAbilityID(abilityID) + return o +} + +// SetAbilityID adds the abilityId to the get API v2 deploy commands ability ID params +func (o *GetAPIV2DeployCommandsAbilityIDParams) SetAbilityID(abilityID string) { + o.AbilityID = abilityID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2DeployCommandsAbilityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param ability_id + if err := r.SetPathParam("ability_id", o.AbilityID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_ability_id_responses.go b/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_ability_id_responses.go new file mode 100644 index 00000000..fa08fd63 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_ability_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2DeployCommandsAbilityIDReader is a Reader for the GetAPIV2DeployCommandsAbilityID structure. +type GetAPIV2DeployCommandsAbilityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2DeployCommandsAbilityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2DeployCommandsAbilityIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/deploy_commands/{ability_id}] GetAPIV2DeployCommandsAbilityID", response, response.Code()) + } +} + +// NewGetAPIV2DeployCommandsAbilityIDOK creates a GetAPIV2DeployCommandsAbilityIDOK with default headers values +func NewGetAPIV2DeployCommandsAbilityIDOK() *GetAPIV2DeployCommandsAbilityIDOK { + return &GetAPIV2DeployCommandsAbilityIDOK{} +} + +/* +GetAPIV2DeployCommandsAbilityIDOK describes a response with status code 200, with default header values. + +Json dictionary representation of deploy commands for the specified Ability ID +*/ +type GetAPIV2DeployCommandsAbilityIDOK struct { + Payload *models.DeployCommands +} + +// IsSuccess returns true when this get Api v2 deploy commands ability Id o k response has a 2xx status code +func (o *GetAPIV2DeployCommandsAbilityIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 deploy commands ability Id o k response has a 3xx status code +func (o *GetAPIV2DeployCommandsAbilityIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 deploy commands ability Id o k response has a 4xx status code +func (o *GetAPIV2DeployCommandsAbilityIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 deploy commands ability Id o k response has a 5xx status code +func (o *GetAPIV2DeployCommandsAbilityIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 deploy commands ability Id o k response a status code equal to that given +func (o *GetAPIV2DeployCommandsAbilityIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 deploy commands ability Id o k response +func (o *GetAPIV2DeployCommandsAbilityIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2DeployCommandsAbilityIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/deploy_commands/{ability_id}][%d] getApiV2DeployCommandsAbilityIdOK %s", 200, payload) +} + +func (o *GetAPIV2DeployCommandsAbilityIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/deploy_commands/{ability_id}][%d] getApiV2DeployCommandsAbilityIdOK %s", 200, payload) +} + +func (o *GetAPIV2DeployCommandsAbilityIDOK) GetPayload() *models.DeployCommands { + return o.Payload +} + +func (o *GetAPIV2DeployCommandsAbilityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DeployCommands) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_parameters.go b/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_parameters.go new file mode 100644 index 00000000..b4eb1df3 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewGetAPIV2DeployCommandsParams creates a new GetAPIV2DeployCommandsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2DeployCommandsParams() *GetAPIV2DeployCommandsParams { + return &GetAPIV2DeployCommandsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2DeployCommandsParamsWithTimeout creates a new GetAPIV2DeployCommandsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2DeployCommandsParamsWithTimeout(timeout time.Duration) *GetAPIV2DeployCommandsParams { + return &GetAPIV2DeployCommandsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2DeployCommandsParamsWithContext creates a new GetAPIV2DeployCommandsParams object +// with the ability to set a context for a request. +func NewGetAPIV2DeployCommandsParamsWithContext(ctx context.Context) *GetAPIV2DeployCommandsParams { + return &GetAPIV2DeployCommandsParams{ + Context: ctx, + } +} + +// NewGetAPIV2DeployCommandsParamsWithHTTPClient creates a new GetAPIV2DeployCommandsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2DeployCommandsParamsWithHTTPClient(client *http.Client) *GetAPIV2DeployCommandsParams { + return &GetAPIV2DeployCommandsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2DeployCommandsParams contains all the parameters to send to the API endpoint + + for the get API v2 deploy commands operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2DeployCommandsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 deploy commands params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2DeployCommandsParams) WithDefaults() *GetAPIV2DeployCommandsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 deploy commands params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2DeployCommandsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 deploy commands params +func (o *GetAPIV2DeployCommandsParams) WithTimeout(timeout time.Duration) *GetAPIV2DeployCommandsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 deploy commands params +func (o *GetAPIV2DeployCommandsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 deploy commands params +func (o *GetAPIV2DeployCommandsParams) WithContext(ctx context.Context) *GetAPIV2DeployCommandsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 deploy commands params +func (o *GetAPIV2DeployCommandsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 deploy commands params +func (o *GetAPIV2DeployCommandsParams) WithHTTPClient(client *http.Client) *GetAPIV2DeployCommandsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 deploy commands params +func (o *GetAPIV2DeployCommandsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2DeployCommandsParams) 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/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_responses.go b/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_responses.go new file mode 100644 index 00000000..9042978c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/get_api_v2_deploy_commands_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2DeployCommandsReader is a Reader for the GetAPIV2DeployCommands structure. +type GetAPIV2DeployCommandsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2DeployCommandsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2DeployCommandsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/deploy_commands] GetAPIV2DeployCommands", response, response.Code()) + } +} + +// NewGetAPIV2DeployCommandsOK creates a GetAPIV2DeployCommandsOK with default headers values +func NewGetAPIV2DeployCommandsOK() *GetAPIV2DeployCommandsOK { + return &GetAPIV2DeployCommandsOK{} +} + +/* +GetAPIV2DeployCommandsOK describes a response with status code 200, with default header values. + +Json dictionary representation of deploy commands, sorted by Ability ID +*/ +type GetAPIV2DeployCommandsOK struct { + Payload *models.DeployCommands +} + +// IsSuccess returns true when this get Api v2 deploy commands o k response has a 2xx status code +func (o *GetAPIV2DeployCommandsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 deploy commands o k response has a 3xx status code +func (o *GetAPIV2DeployCommandsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 deploy commands o k response has a 4xx status code +func (o *GetAPIV2DeployCommandsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 deploy commands o k response has a 5xx status code +func (o *GetAPIV2DeployCommandsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 deploy commands o k response a status code equal to that given +func (o *GetAPIV2DeployCommandsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 deploy commands o k response +func (o *GetAPIV2DeployCommandsOK) Code() int { + return 200 +} + +func (o *GetAPIV2DeployCommandsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/deploy_commands][%d] getApiV2DeployCommandsOK %s", 200, payload) +} + +func (o *GetAPIV2DeployCommandsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/deploy_commands][%d] getApiV2DeployCommandsOK %s", 200, payload) +} + +func (o *GetAPIV2DeployCommandsOK) GetPayload() *models.DeployCommands { + return o.Payload +} + +func (o *GetAPIV2DeployCommandsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DeployCommands) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_parameters.go b/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_parameters.go new file mode 100644 index 00000000..f687fab6 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewHeadAPIV2AgentsParams creates a new HeadAPIV2AgentsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2AgentsParams() *HeadAPIV2AgentsParams { + return &HeadAPIV2AgentsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2AgentsParamsWithTimeout creates a new HeadAPIV2AgentsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2AgentsParamsWithTimeout(timeout time.Duration) *HeadAPIV2AgentsParams { + return &HeadAPIV2AgentsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2AgentsParamsWithContext creates a new HeadAPIV2AgentsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2AgentsParamsWithContext(ctx context.Context) *HeadAPIV2AgentsParams { + return &HeadAPIV2AgentsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2AgentsParamsWithHTTPClient creates a new HeadAPIV2AgentsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2AgentsParamsWithHTTPClient(client *http.Client) *HeadAPIV2AgentsParams { + return &HeadAPIV2AgentsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2AgentsParams contains all the parameters to send to the API endpoint + + for the head API v2 agents operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2AgentsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 agents params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AgentsParams) WithDefaults() *HeadAPIV2AgentsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 agents params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AgentsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) WithTimeout(timeout time.Duration) *HeadAPIV2AgentsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) WithContext(ctx context.Context) *HeadAPIV2AgentsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) WithHTTPClient(client *http.Client) *HeadAPIV2AgentsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) WithExclude(exclude []string) *HeadAPIV2AgentsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) WithInclude(include []string) *HeadAPIV2AgentsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) WithSort(sort *string) *HeadAPIV2AgentsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 agents params +func (o *HeadAPIV2AgentsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2AgentsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Agents binds the parameter exclude +func (o *HeadAPIV2AgentsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Agents binds the parameter include +func (o *HeadAPIV2AgentsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_paw_parameters.go b/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_paw_parameters.go new file mode 100644 index 00000000..4ffd559e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_paw_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewHeadAPIV2AgentsPawParams creates a new HeadAPIV2AgentsPawParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2AgentsPawParams() *HeadAPIV2AgentsPawParams { + return &HeadAPIV2AgentsPawParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2AgentsPawParamsWithTimeout creates a new HeadAPIV2AgentsPawParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2AgentsPawParamsWithTimeout(timeout time.Duration) *HeadAPIV2AgentsPawParams { + return &HeadAPIV2AgentsPawParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2AgentsPawParamsWithContext creates a new HeadAPIV2AgentsPawParams object +// with the ability to set a context for a request. +func NewHeadAPIV2AgentsPawParamsWithContext(ctx context.Context) *HeadAPIV2AgentsPawParams { + return &HeadAPIV2AgentsPawParams{ + Context: ctx, + } +} + +// NewHeadAPIV2AgentsPawParamsWithHTTPClient creates a new HeadAPIV2AgentsPawParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2AgentsPawParamsWithHTTPClient(client *http.Client) *HeadAPIV2AgentsPawParams { + return &HeadAPIV2AgentsPawParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2AgentsPawParams contains all the parameters to send to the API endpoint + + for the head API v2 agents paw operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2AgentsPawParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + /* Paw. + + ID of the Agent to retrieve information about + */ + Paw string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AgentsPawParams) WithDefaults() *HeadAPIV2AgentsPawParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2AgentsPawParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) WithTimeout(timeout time.Duration) *HeadAPIV2AgentsPawParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) WithContext(ctx context.Context) *HeadAPIV2AgentsPawParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) WithHTTPClient(client *http.Client) *HeadAPIV2AgentsPawParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) WithExclude(exclude []string) *HeadAPIV2AgentsPawParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) WithInclude(include []string) *HeadAPIV2AgentsPawParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) SetInclude(include []string) { + o.Include = include +} + +// WithPaw adds the paw to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) WithPaw(paw string) *HeadAPIV2AgentsPawParams { + o.SetPaw(paw) + return o +} + +// SetPaw adds the paw to the head API v2 agents paw params +func (o *HeadAPIV2AgentsPawParams) SetPaw(paw string) { + o.Paw = paw +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2AgentsPawParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param paw + if err := r.SetPathParam("paw", o.Paw); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2AgentsPaw binds the parameter exclude +func (o *HeadAPIV2AgentsPawParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2AgentsPaw binds the parameter include +func (o *HeadAPIV2AgentsPawParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_paw_responses.go b/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_paw_responses.go new file mode 100644 index 00000000..a1da693b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_paw_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2AgentsPawReader is a Reader for the HeadAPIV2AgentsPaw structure. +type HeadAPIV2AgentsPawReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2AgentsPawReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2AgentsPawOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/agents/{paw}] HeadAPIV2AgentsPaw", response, response.Code()) + } +} + +// NewHeadAPIV2AgentsPawOK creates a HeadAPIV2AgentsPawOK with default headers values +func NewHeadAPIV2AgentsPawOK() *HeadAPIV2AgentsPawOK { + return &HeadAPIV2AgentsPawOK{} +} + +/* +HeadAPIV2AgentsPawOK describes a response with status code 200, with default header values. + +Returns JSON response with specified Agent +*/ +type HeadAPIV2AgentsPawOK struct { + Payload *models.PartialAgent +} + +// IsSuccess returns true when this head Api v2 agents paw o k response has a 2xx status code +func (o *HeadAPIV2AgentsPawOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 agents paw o k response has a 3xx status code +func (o *HeadAPIV2AgentsPawOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 agents paw o k response has a 4xx status code +func (o *HeadAPIV2AgentsPawOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 agents paw o k response has a 5xx status code +func (o *HeadAPIV2AgentsPawOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 agents paw o k response a status code equal to that given +func (o *HeadAPIV2AgentsPawOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 agents paw o k response +func (o *HeadAPIV2AgentsPawOK) Code() int { + return 200 +} + +func (o *HeadAPIV2AgentsPawOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/agents/{paw}][%d] headApiV2AgentsPawOK %s", 200, payload) +} + +func (o *HeadAPIV2AgentsPawOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/agents/{paw}][%d] headApiV2AgentsPawOK %s", 200, payload) +} + +func (o *HeadAPIV2AgentsPawOK) GetPayload() *models.PartialAgent { + return o.Payload +} + +func (o *HeadAPIV2AgentsPawOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialAgent) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_responses.go b/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_responses.go new file mode 100644 index 00000000..30b4b92b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/head_api_v2_agents_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2AgentsReader is a Reader for the HeadAPIV2Agents structure. +type HeadAPIV2AgentsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2AgentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2AgentsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/agents] HeadAPIV2Agents", response, response.Code()) + } +} + +// NewHeadAPIV2AgentsOK creates a HeadAPIV2AgentsOK with default headers values +func NewHeadAPIV2AgentsOK() *HeadAPIV2AgentsOK { + return &HeadAPIV2AgentsOK{} +} + +/* +HeadAPIV2AgentsOK describes a response with status code 200, with default header values. + +Returns a list of all agents. +*/ +type HeadAPIV2AgentsOK struct { + Payload []*models.PartialAgent +} + +// IsSuccess returns true when this head Api v2 agents o k response has a 2xx status code +func (o *HeadAPIV2AgentsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 agents o k response has a 3xx status code +func (o *HeadAPIV2AgentsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 agents o k response has a 4xx status code +func (o *HeadAPIV2AgentsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 agents o k response has a 5xx status code +func (o *HeadAPIV2AgentsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 agents o k response a status code equal to that given +func (o *HeadAPIV2AgentsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 agents o k response +func (o *HeadAPIV2AgentsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2AgentsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/agents][%d] headApiV2AgentsOK %s", 200, payload) +} + +func (o *HeadAPIV2AgentsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/agents][%d] headApiV2AgentsOK %s", 200, payload) +} + +func (o *HeadAPIV2AgentsOK) GetPayload() []*models.PartialAgent { + return o.Payload +} + +func (o *HeadAPIV2AgentsOK) 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/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_ability_id_parameters.go b/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_ability_id_parameters.go new file mode 100644 index 00000000..21724c74 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_ability_id_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewHeadAPIV2DeployCommandsAbilityIDParams creates a new HeadAPIV2DeployCommandsAbilityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2DeployCommandsAbilityIDParams() *HeadAPIV2DeployCommandsAbilityIDParams { + return &HeadAPIV2DeployCommandsAbilityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2DeployCommandsAbilityIDParamsWithTimeout creates a new HeadAPIV2DeployCommandsAbilityIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2DeployCommandsAbilityIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2DeployCommandsAbilityIDParams { + return &HeadAPIV2DeployCommandsAbilityIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2DeployCommandsAbilityIDParamsWithContext creates a new HeadAPIV2DeployCommandsAbilityIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2DeployCommandsAbilityIDParamsWithContext(ctx context.Context) *HeadAPIV2DeployCommandsAbilityIDParams { + return &HeadAPIV2DeployCommandsAbilityIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2DeployCommandsAbilityIDParamsWithHTTPClient creates a new HeadAPIV2DeployCommandsAbilityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2DeployCommandsAbilityIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2DeployCommandsAbilityIDParams { + return &HeadAPIV2DeployCommandsAbilityIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2DeployCommandsAbilityIDParams contains all the parameters to send to the API endpoint + + for the head API v2 deploy commands ability ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2DeployCommandsAbilityIDParams struct { + + /* AbilityID. + + ID of the ability to retrieve deploy commands for + */ + AbilityID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 deploy commands ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2DeployCommandsAbilityIDParams) WithDefaults() *HeadAPIV2DeployCommandsAbilityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 deploy commands ability ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2DeployCommandsAbilityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 deploy commands ability ID params +func (o *HeadAPIV2DeployCommandsAbilityIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2DeployCommandsAbilityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 deploy commands ability ID params +func (o *HeadAPIV2DeployCommandsAbilityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 deploy commands ability ID params +func (o *HeadAPIV2DeployCommandsAbilityIDParams) WithContext(ctx context.Context) *HeadAPIV2DeployCommandsAbilityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 deploy commands ability ID params +func (o *HeadAPIV2DeployCommandsAbilityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 deploy commands ability ID params +func (o *HeadAPIV2DeployCommandsAbilityIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2DeployCommandsAbilityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 deploy commands ability ID params +func (o *HeadAPIV2DeployCommandsAbilityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAbilityID adds the abilityID to the head API v2 deploy commands ability ID params +func (o *HeadAPIV2DeployCommandsAbilityIDParams) WithAbilityID(abilityID string) *HeadAPIV2DeployCommandsAbilityIDParams { + o.SetAbilityID(abilityID) + return o +} + +// SetAbilityID adds the abilityId to the head API v2 deploy commands ability ID params +func (o *HeadAPIV2DeployCommandsAbilityIDParams) SetAbilityID(abilityID string) { + o.AbilityID = abilityID +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2DeployCommandsAbilityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param ability_id + if err := r.SetPathParam("ability_id", o.AbilityID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_ability_id_responses.go b/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_ability_id_responses.go new file mode 100644 index 00000000..3535b573 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_ability_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2DeployCommandsAbilityIDReader is a Reader for the HeadAPIV2DeployCommandsAbilityID structure. +type HeadAPIV2DeployCommandsAbilityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2DeployCommandsAbilityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2DeployCommandsAbilityIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/deploy_commands/{ability_id}] HeadAPIV2DeployCommandsAbilityID", response, response.Code()) + } +} + +// NewHeadAPIV2DeployCommandsAbilityIDOK creates a HeadAPIV2DeployCommandsAbilityIDOK with default headers values +func NewHeadAPIV2DeployCommandsAbilityIDOK() *HeadAPIV2DeployCommandsAbilityIDOK { + return &HeadAPIV2DeployCommandsAbilityIDOK{} +} + +/* +HeadAPIV2DeployCommandsAbilityIDOK describes a response with status code 200, with default header values. + +Json dictionary representation of deploy commands for the specified Ability ID +*/ +type HeadAPIV2DeployCommandsAbilityIDOK struct { + Payload *models.DeployCommands +} + +// IsSuccess returns true when this head Api v2 deploy commands ability Id o k response has a 2xx status code +func (o *HeadAPIV2DeployCommandsAbilityIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 deploy commands ability Id o k response has a 3xx status code +func (o *HeadAPIV2DeployCommandsAbilityIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 deploy commands ability Id o k response has a 4xx status code +func (o *HeadAPIV2DeployCommandsAbilityIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 deploy commands ability Id o k response has a 5xx status code +func (o *HeadAPIV2DeployCommandsAbilityIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 deploy commands ability Id o k response a status code equal to that given +func (o *HeadAPIV2DeployCommandsAbilityIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 deploy commands ability Id o k response +func (o *HeadAPIV2DeployCommandsAbilityIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2DeployCommandsAbilityIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/deploy_commands/{ability_id}][%d] headApiV2DeployCommandsAbilityIdOK %s", 200, payload) +} + +func (o *HeadAPIV2DeployCommandsAbilityIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/deploy_commands/{ability_id}][%d] headApiV2DeployCommandsAbilityIdOK %s", 200, payload) +} + +func (o *HeadAPIV2DeployCommandsAbilityIDOK) GetPayload() *models.DeployCommands { + return o.Payload +} + +func (o *HeadAPIV2DeployCommandsAbilityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DeployCommands) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_parameters.go b/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_parameters.go new file mode 100644 index 00000000..14ac3115 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" +) + +// NewHeadAPIV2DeployCommandsParams creates a new HeadAPIV2DeployCommandsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2DeployCommandsParams() *HeadAPIV2DeployCommandsParams { + return &HeadAPIV2DeployCommandsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2DeployCommandsParamsWithTimeout creates a new HeadAPIV2DeployCommandsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2DeployCommandsParamsWithTimeout(timeout time.Duration) *HeadAPIV2DeployCommandsParams { + return &HeadAPIV2DeployCommandsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2DeployCommandsParamsWithContext creates a new HeadAPIV2DeployCommandsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2DeployCommandsParamsWithContext(ctx context.Context) *HeadAPIV2DeployCommandsParams { + return &HeadAPIV2DeployCommandsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2DeployCommandsParamsWithHTTPClient creates a new HeadAPIV2DeployCommandsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2DeployCommandsParamsWithHTTPClient(client *http.Client) *HeadAPIV2DeployCommandsParams { + return &HeadAPIV2DeployCommandsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2DeployCommandsParams contains all the parameters to send to the API endpoint + + for the head API v2 deploy commands operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2DeployCommandsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 deploy commands params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2DeployCommandsParams) WithDefaults() *HeadAPIV2DeployCommandsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 deploy commands params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2DeployCommandsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 deploy commands params +func (o *HeadAPIV2DeployCommandsParams) WithTimeout(timeout time.Duration) *HeadAPIV2DeployCommandsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 deploy commands params +func (o *HeadAPIV2DeployCommandsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 deploy commands params +func (o *HeadAPIV2DeployCommandsParams) WithContext(ctx context.Context) *HeadAPIV2DeployCommandsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 deploy commands params +func (o *HeadAPIV2DeployCommandsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 deploy commands params +func (o *HeadAPIV2DeployCommandsParams) WithHTTPClient(client *http.Client) *HeadAPIV2DeployCommandsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 deploy commands params +func (o *HeadAPIV2DeployCommandsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2DeployCommandsParams) 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/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_responses.go b/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_responses.go new file mode 100644 index 00000000..506fd459 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/head_api_v2_deploy_commands_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2DeployCommandsReader is a Reader for the HeadAPIV2DeployCommands structure. +type HeadAPIV2DeployCommandsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2DeployCommandsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2DeployCommandsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/deploy_commands] HeadAPIV2DeployCommands", response, response.Code()) + } +} + +// NewHeadAPIV2DeployCommandsOK creates a HeadAPIV2DeployCommandsOK with default headers values +func NewHeadAPIV2DeployCommandsOK() *HeadAPIV2DeployCommandsOK { + return &HeadAPIV2DeployCommandsOK{} +} + +/* +HeadAPIV2DeployCommandsOK describes a response with status code 200, with default header values. + +Json dictionary representation of deploy commands, sorted by Ability ID +*/ +type HeadAPIV2DeployCommandsOK struct { + Payload *models.DeployCommands +} + +// IsSuccess returns true when this head Api v2 deploy commands o k response has a 2xx status code +func (o *HeadAPIV2DeployCommandsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 deploy commands o k response has a 3xx status code +func (o *HeadAPIV2DeployCommandsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 deploy commands o k response has a 4xx status code +func (o *HeadAPIV2DeployCommandsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 deploy commands o k response has a 5xx status code +func (o *HeadAPIV2DeployCommandsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 deploy commands o k response a status code equal to that given +func (o *HeadAPIV2DeployCommandsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 deploy commands o k response +func (o *HeadAPIV2DeployCommandsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2DeployCommandsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/deploy_commands][%d] headApiV2DeployCommandsOK %s", 200, payload) +} + +func (o *HeadAPIV2DeployCommandsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/deploy_commands][%d] headApiV2DeployCommandsOK %s", 200, payload) +} + +func (o *HeadAPIV2DeployCommandsOK) GetPayload() *models.DeployCommands { + return o.Payload +} + +func (o *HeadAPIV2DeployCommandsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DeployCommands) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/patch_api_v2_agents_paw_parameters.go b/pkg/core/capability/caldera/api/client/agents/patch_api_v2_agents_paw_parameters.go new file mode 100644 index 00000000..48fcb1c0 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/patch_api_v2_agents_paw_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2AgentsPawParams creates a new PatchAPIV2AgentsPawParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2AgentsPawParams() *PatchAPIV2AgentsPawParams { + return &PatchAPIV2AgentsPawParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2AgentsPawParamsWithTimeout creates a new PatchAPIV2AgentsPawParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2AgentsPawParamsWithTimeout(timeout time.Duration) *PatchAPIV2AgentsPawParams { + return &PatchAPIV2AgentsPawParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2AgentsPawParamsWithContext creates a new PatchAPIV2AgentsPawParams object +// with the ability to set a context for a request. +func NewPatchAPIV2AgentsPawParamsWithContext(ctx context.Context) *PatchAPIV2AgentsPawParams { + return &PatchAPIV2AgentsPawParams{ + Context: ctx, + } +} + +// NewPatchAPIV2AgentsPawParamsWithHTTPClient creates a new PatchAPIV2AgentsPawParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2AgentsPawParamsWithHTTPClient(client *http.Client) *PatchAPIV2AgentsPawParams { + return &PatchAPIV2AgentsPawParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2AgentsPawParams contains all the parameters to send to the API endpoint + + for the patch API v2 agents paw operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2AgentsPawParams struct { + + // Body. + Body *models.PartialAgent1 + + /* Paw. + + ID of the Agent to update + */ + Paw string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2AgentsPawParams) WithDefaults() *PatchAPIV2AgentsPawParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2AgentsPawParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) WithTimeout(timeout time.Duration) *PatchAPIV2AgentsPawParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) WithContext(ctx context.Context) *PatchAPIV2AgentsPawParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) WithHTTPClient(client *http.Client) *PatchAPIV2AgentsPawParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) WithBody(body *models.PartialAgent1) *PatchAPIV2AgentsPawParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) SetBody(body *models.PartialAgent1) { + o.Body = body +} + +// WithPaw adds the paw to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) WithPaw(paw string) *PatchAPIV2AgentsPawParams { + o.SetPaw(paw) + return o +} + +// SetPaw adds the paw to the patch API v2 agents paw params +func (o *PatchAPIV2AgentsPawParams) SetPaw(paw string) { + o.Paw = paw +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2AgentsPawParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param paw + if err := r.SetPathParam("paw", o.Paw); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/patch_api_v2_agents_paw_responses.go b/pkg/core/capability/caldera/api/client/agents/patch_api_v2_agents_paw_responses.go new file mode 100644 index 00000000..29dcecf7 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/patch_api_v2_agents_paw_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2AgentsPawReader is a Reader for the PatchAPIV2AgentsPaw structure. +type PatchAPIV2AgentsPawReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2AgentsPawReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2AgentsPawOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/agents/{paw}] PatchAPIV2AgentsPaw", response, response.Code()) + } +} + +// NewPatchAPIV2AgentsPawOK creates a PatchAPIV2AgentsPawOK with default headers values +func NewPatchAPIV2AgentsPawOK() *PatchAPIV2AgentsPawOK { + return &PatchAPIV2AgentsPawOK{} +} + +/* +PatchAPIV2AgentsPawOK describes a response with status code 200, with default header values. + +Returns JSON response with updated Agent fields +*/ +type PatchAPIV2AgentsPawOK struct { + Payload *models.Agent +} + +// IsSuccess returns true when this patch Api v2 agents paw o k response has a 2xx status code +func (o *PatchAPIV2AgentsPawOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 agents paw o k response has a 3xx status code +func (o *PatchAPIV2AgentsPawOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 agents paw o k response has a 4xx status code +func (o *PatchAPIV2AgentsPawOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 agents paw o k response has a 5xx status code +func (o *PatchAPIV2AgentsPawOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 agents paw o k response a status code equal to that given +func (o *PatchAPIV2AgentsPawOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 agents paw o k response +func (o *PatchAPIV2AgentsPawOK) Code() int { + return 200 +} + +func (o *PatchAPIV2AgentsPawOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/agents/{paw}][%d] patchApiV2AgentsPawOK %s", 200, payload) +} + +func (o *PatchAPIV2AgentsPawOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/agents/{paw}][%d] patchApiV2AgentsPawOK %s", 200, payload) +} + +func (o *PatchAPIV2AgentsPawOK) GetPayload() *models.Agent { + return o.Payload +} + +func (o *PatchAPIV2AgentsPawOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Agent) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/post_api_v2_agents_parameters.go b/pkg/core/capability/caldera/api/client/agents/post_api_v2_agents_parameters.go new file mode 100644 index 00000000..72050c91 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/post_api_v2_agents_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2AgentsParams creates a new PostAPIV2AgentsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2AgentsParams() *PostAPIV2AgentsParams { + return &PostAPIV2AgentsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2AgentsParamsWithTimeout creates a new PostAPIV2AgentsParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2AgentsParamsWithTimeout(timeout time.Duration) *PostAPIV2AgentsParams { + return &PostAPIV2AgentsParams{ + timeout: timeout, + } +} + +// NewPostAPIV2AgentsParamsWithContext creates a new PostAPIV2AgentsParams object +// with the ability to set a context for a request. +func NewPostAPIV2AgentsParamsWithContext(ctx context.Context) *PostAPIV2AgentsParams { + return &PostAPIV2AgentsParams{ + Context: ctx, + } +} + +// NewPostAPIV2AgentsParamsWithHTTPClient creates a new PostAPIV2AgentsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2AgentsParamsWithHTTPClient(client *http.Client) *PostAPIV2AgentsParams { + return &PostAPIV2AgentsParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2AgentsParams contains all the parameters to send to the API endpoint + + for the post API v2 agents operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2AgentsParams struct { + + // Body. + Body *models.Agent + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 agents params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2AgentsParams) WithDefaults() *PostAPIV2AgentsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 agents params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2AgentsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 agents params +func (o *PostAPIV2AgentsParams) WithTimeout(timeout time.Duration) *PostAPIV2AgentsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 agents params +func (o *PostAPIV2AgentsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 agents params +func (o *PostAPIV2AgentsParams) WithContext(ctx context.Context) *PostAPIV2AgentsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 agents params +func (o *PostAPIV2AgentsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 agents params +func (o *PostAPIV2AgentsParams) WithHTTPClient(client *http.Client) *PostAPIV2AgentsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 agents params +func (o *PostAPIV2AgentsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 agents params +func (o *PostAPIV2AgentsParams) WithBody(body *models.Agent) *PostAPIV2AgentsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 agents params +func (o *PostAPIV2AgentsParams) SetBody(body *models.Agent) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2AgentsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/post_api_v2_agents_responses.go b/pkg/core/capability/caldera/api/client/agents/post_api_v2_agents_responses.go new file mode 100644 index 00000000..eff239b2 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/post_api_v2_agents_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2AgentsReader is a Reader for the PostAPIV2Agents structure. +type PostAPIV2AgentsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2AgentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2AgentsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/agents] PostAPIV2Agents", response, response.Code()) + } +} + +// NewPostAPIV2AgentsOK creates a PostAPIV2AgentsOK with default headers values +func NewPostAPIV2AgentsOK() *PostAPIV2AgentsOK { + return &PostAPIV2AgentsOK{} +} + +/* +PostAPIV2AgentsOK describes a response with status code 200, with default header values. + +Returns a single agent in 'AgentSchema' format +*/ +type PostAPIV2AgentsOK struct { + Payload *models.Agent +} + +// IsSuccess returns true when this post Api v2 agents o k response has a 2xx status code +func (o *PostAPIV2AgentsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 agents o k response has a 3xx status code +func (o *PostAPIV2AgentsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 agents o k response has a 4xx status code +func (o *PostAPIV2AgentsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 agents o k response has a 5xx status code +func (o *PostAPIV2AgentsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 agents o k response a status code equal to that given +func (o *PostAPIV2AgentsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 agents o k response +func (o *PostAPIV2AgentsOK) Code() int { + return 200 +} + +func (o *PostAPIV2AgentsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/agents][%d] postApiV2AgentsOK %s", 200, payload) +} + +func (o *PostAPIV2AgentsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/agents][%d] postApiV2AgentsOK %s", 200, payload) +} + +func (o *PostAPIV2AgentsOK) GetPayload() *models.Agent { + return o.Payload +} + +func (o *PostAPIV2AgentsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Agent) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/put_api_v2_agents_paw_parameters.go b/pkg/core/capability/caldera/api/client/agents/put_api_v2_agents_paw_parameters.go new file mode 100644 index 00000000..1ba70b33 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/put_api_v2_agents_paw_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPutAPIV2AgentsPawParams creates a new PutAPIV2AgentsPawParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPutAPIV2AgentsPawParams() *PutAPIV2AgentsPawParams { + return &PutAPIV2AgentsPawParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPutAPIV2AgentsPawParamsWithTimeout creates a new PutAPIV2AgentsPawParams object +// with the ability to set a timeout on a request. +func NewPutAPIV2AgentsPawParamsWithTimeout(timeout time.Duration) *PutAPIV2AgentsPawParams { + return &PutAPIV2AgentsPawParams{ + timeout: timeout, + } +} + +// NewPutAPIV2AgentsPawParamsWithContext creates a new PutAPIV2AgentsPawParams object +// with the ability to set a context for a request. +func NewPutAPIV2AgentsPawParamsWithContext(ctx context.Context) *PutAPIV2AgentsPawParams { + return &PutAPIV2AgentsPawParams{ + Context: ctx, + } +} + +// NewPutAPIV2AgentsPawParamsWithHTTPClient creates a new PutAPIV2AgentsPawParams object +// with the ability to set a custom HTTPClient for a request. +func NewPutAPIV2AgentsPawParamsWithHTTPClient(client *http.Client) *PutAPIV2AgentsPawParams { + return &PutAPIV2AgentsPawParams{ + HTTPClient: client, + } +} + +/* +PutAPIV2AgentsPawParams contains all the parameters to send to the API endpoint + + for the put API v2 agents paw operation. + + Typically these are written to a http.Request. +*/ +type PutAPIV2AgentsPawParams struct { + + // Body. + Body *models.PartialAgent + + /* Paw. + + paw of the Agent to be retrieved + */ + Paw string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the put API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2AgentsPawParams) WithDefaults() *PutAPIV2AgentsPawParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put API v2 agents paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2AgentsPawParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) WithTimeout(timeout time.Duration) *PutAPIV2AgentsPawParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) WithContext(ctx context.Context) *PutAPIV2AgentsPawParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) WithHTTPClient(client *http.Client) *PutAPIV2AgentsPawParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) WithBody(body *models.PartialAgent) *PutAPIV2AgentsPawParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) SetBody(body *models.PartialAgent) { + o.Body = body +} + +// WithPaw adds the paw to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) WithPaw(paw string) *PutAPIV2AgentsPawParams { + o.SetPaw(paw) + return o +} + +// SetPaw adds the paw to the put API v2 agents paw params +func (o *PutAPIV2AgentsPawParams) SetPaw(paw string) { + o.Paw = paw +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAPIV2AgentsPawParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param paw + if err := r.SetPathParam("paw", o.Paw); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/agents/put_api_v2_agents_paw_responses.go b/pkg/core/capability/caldera/api/client/agents/put_api_v2_agents_paw_responses.go new file mode 100644 index 00000000..3d2142c8 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/agents/put_api_v2_agents_paw_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package agents + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PutAPIV2AgentsPawReader is a Reader for the PutAPIV2AgentsPaw structure. +type PutAPIV2AgentsPawReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAPIV2AgentsPawReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPutAPIV2AgentsPawOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PUT /api/v2/agents/{paw}] PutAPIV2AgentsPaw", response, response.Code()) + } +} + +// NewPutAPIV2AgentsPawOK creates a PutAPIV2AgentsPawOK with default headers values +func NewPutAPIV2AgentsPawOK() *PutAPIV2AgentsPawOK { + return &PutAPIV2AgentsPawOK{} +} + +/* +PutAPIV2AgentsPawOK describes a response with status code 200, with default header values. + +Json dictionary representation of the created or updated Agent +*/ +type PutAPIV2AgentsPawOK struct { + Payload *models.Agent +} + +// IsSuccess returns true when this put Api v2 agents paw o k response has a 2xx status code +func (o *PutAPIV2AgentsPawOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put Api v2 agents paw o k response has a 3xx status code +func (o *PutAPIV2AgentsPawOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put Api v2 agents paw o k response has a 4xx status code +func (o *PutAPIV2AgentsPawOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this put Api v2 agents paw o k response has a 5xx status code +func (o *PutAPIV2AgentsPawOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put Api v2 agents paw o k response a status code equal to that given +func (o *PutAPIV2AgentsPawOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the put Api v2 agents paw o k response +func (o *PutAPIV2AgentsPawOK) Code() int { + return 200 +} + +func (o *PutAPIV2AgentsPawOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/agents/{paw}][%d] putApiV2AgentsPawOK %s", 200, payload) +} + +func (o *PutAPIV2AgentsPawOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/agents/{paw}][%d] putApiV2AgentsPawOK %s", 200, payload) +} + +func (o *PutAPIV2AgentsPawOK) GetPayload() *models.Agent { + return o.Payload +} + +func (o *PutAPIV2AgentsPawOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Agent) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/caldera_client.go b/pkg/core/capability/caldera/api/client/caldera_client.go new file mode 100644 index 00000000..d980098d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/caldera_client.go @@ -0,0 +1,187 @@ +// 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" + + "soarca/pkg/core/capability/caldera/api/client/abilities" + "soarca/pkg/core/capability/caldera/api/client/adversaries" + "soarca/pkg/core/capability/caldera/api/client/agents" + "soarca/pkg/core/capability/caldera/api/client/config" + "soarca/pkg/core/capability/caldera/api/client/contacts" + "soarca/pkg/core/capability/caldera/api/client/facts" + "soarca/pkg/core/capability/caldera/api/client/health" + "soarca/pkg/core/capability/caldera/api/client/obfuscators" + "soarca/pkg/core/capability/caldera/api/client/objectives" + "soarca/pkg/core/capability/caldera/api/client/operationsops" + "soarca/pkg/core/capability/caldera/api/client/payloads" + "soarca/pkg/core/capability/caldera/api/client/planners" + "soarca/pkg/core/capability/caldera/api/client/plugins" + "soarca/pkg/core/capability/caldera/api/client/relationships" + "soarca/pkg/core/capability/caldera/api/client/schedules" + "soarca/pkg/core/capability/caldera/api/client/sources" +) + +// Default caldera 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 = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http"} + +// NewHTTPClient creates a new caldera HTTP client. +func NewHTTPClient(formats strfmt.Registry) *Caldera { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new caldera HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Caldera { + // 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 caldera client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Caldera { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(Caldera) + cli.Transport = transport + cli.Abilities = abilities.New(transport, formats) + cli.Adversaries = adversaries.New(transport, formats) + cli.Agents = agents.New(transport, formats) + cli.Config = config.New(transport, formats) + cli.Contacts = contacts.New(transport, formats) + cli.Facts = facts.New(transport, formats) + cli.Health = health.New(transport, formats) + cli.Obfuscators = obfuscators.New(transport, formats) + cli.Objectives = objectives.New(transport, formats) + cli.Operationsops = operationsops.New(transport, formats) + cli.Payloads = payloads.New(transport, formats) + cli.Planners = planners.New(transport, formats) + cli.Plugins = plugins.New(transport, formats) + cli.Relationships = relationships.New(transport, formats) + cli.Schedules = schedules.New(transport, formats) + cli.Sources = sources.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 +} + +// Caldera is a client for caldera +type Caldera struct { + Abilities abilities.ClientService + + Adversaries adversaries.ClientService + + Agents agents.ClientService + + Config config.ClientService + + Contacts contacts.ClientService + + Facts facts.ClientService + + Health health.ClientService + + Obfuscators obfuscators.ClientService + + Objectives objectives.ClientService + + Operationsops operationsops.ClientService + + Payloads payloads.ClientService + + Planners planners.ClientService + + Plugins plugins.ClientService + + Relationships relationships.ClientService + + Schedules schedules.ClientService + + Sources sources.ClientService + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *Caldera) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + c.Abilities.SetTransport(transport) + c.Adversaries.SetTransport(transport) + c.Agents.SetTransport(transport) + c.Config.SetTransport(transport) + c.Contacts.SetTransport(transport) + c.Facts.SetTransport(transport) + c.Health.SetTransport(transport) + c.Obfuscators.SetTransport(transport) + c.Objectives.SetTransport(transport) + c.Operationsops.SetTransport(transport) + c.Payloads.SetTransport(transport) + c.Planners.SetTransport(transport) + c.Plugins.SetTransport(transport) + c.Relationships.SetTransport(transport) + c.Schedules.SetTransport(transport) + c.Sources.SetTransport(transport) +} diff --git a/pkg/core/capability/caldera/api/client/config/config_client.go b/pkg/core/capability/caldera/api/client/config/config_client.go new file mode 100644 index 00000000..3cbd6029 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/config_client.go @@ -0,0 +1,233 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new config API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new config API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new config API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for config API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIV2ConfigName(params *GetAPIV2ConfigNameParams, opts ...ClientOption) (*GetAPIV2ConfigNameOK, error) + + HeadAPIV2ConfigName(params *HeadAPIV2ConfigNameParams, opts ...ClientOption) (*HeadAPIV2ConfigNameOK, error) + + PatchAPIV2ConfigAgents(params *PatchAPIV2ConfigAgentsParams, opts ...ClientOption) (*PatchAPIV2ConfigAgentsOK, error) + + PatchAPIV2ConfigMain(params *PatchAPIV2ConfigMainParams, opts ...ClientOption) (*PatchAPIV2ConfigMainOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIV2ConfigName retrieves config + +Retrieves configuration by name, as specified by {name} in the request url. +*/ +func (a *Client) GetAPIV2ConfigName(params *GetAPIV2ConfigNameParams, opts ...ClientOption) (*GetAPIV2ConfigNameOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2ConfigNameParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2ConfigName", + Method: "GET", + PathPattern: "/api/v2/config/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2ConfigNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2ConfigNameOK) + 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 GetAPIV2ConfigName: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2ConfigName retrieves config + +Retrieves configuration by name, as specified by {name} in the request url. +*/ +func (a *Client) HeadAPIV2ConfigName(params *HeadAPIV2ConfigNameParams, opts ...ClientOption) (*HeadAPIV2ConfigNameOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2ConfigNameParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2ConfigName", + Method: "HEAD", + PathPattern: "/api/v2/config/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2ConfigNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2ConfigNameOK) + 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 HeadAPIV2ConfigName: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2ConfigAgents updates agent config + +Use fields from the AgentConfigUpdateSchema in the request body to update the Agent Configuration file. +*/ +func (a *Client) PatchAPIV2ConfigAgents(params *PatchAPIV2ConfigAgentsParams, opts ...ClientOption) (*PatchAPIV2ConfigAgentsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2ConfigAgentsParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2ConfigAgents", + Method: "PATCH", + PathPattern: "/api/v2/config/agents", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2ConfigAgentsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2ConfigAgentsOK) + 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 PatchAPIV2ConfigAgents: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2ConfigMain updates main config + +Use fields from the ConfigUpdateSchema in the request body to update the main configuration file. +*/ +func (a *Client) PatchAPIV2ConfigMain(params *PatchAPIV2ConfigMainParams, opts ...ClientOption) (*PatchAPIV2ConfigMainOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2ConfigMainParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2ConfigMain", + Method: "PATCH", + PathPattern: "/api/v2/config/main", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2ConfigMainReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2ConfigMainOK) + 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 PatchAPIV2ConfigMain: 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/core/capability/caldera/api/client/config/get_api_v2_config_name_parameters.go b/pkg/core/capability/caldera/api/client/config/get_api_v2_config_name_parameters.go new file mode 100644 index 00000000..39a40893 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/get_api_v2_config_name_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" +) + +// NewGetAPIV2ConfigNameParams creates a new GetAPIV2ConfigNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2ConfigNameParams() *GetAPIV2ConfigNameParams { + return &GetAPIV2ConfigNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2ConfigNameParamsWithTimeout creates a new GetAPIV2ConfigNameParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2ConfigNameParamsWithTimeout(timeout time.Duration) *GetAPIV2ConfigNameParams { + return &GetAPIV2ConfigNameParams{ + timeout: timeout, + } +} + +// NewGetAPIV2ConfigNameParamsWithContext creates a new GetAPIV2ConfigNameParams object +// with the ability to set a context for a request. +func NewGetAPIV2ConfigNameParamsWithContext(ctx context.Context) *GetAPIV2ConfigNameParams { + return &GetAPIV2ConfigNameParams{ + Context: ctx, + } +} + +// NewGetAPIV2ConfigNameParamsWithHTTPClient creates a new GetAPIV2ConfigNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2ConfigNameParamsWithHTTPClient(client *http.Client) *GetAPIV2ConfigNameParams { + return &GetAPIV2ConfigNameParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2ConfigNameParams contains all the parameters to send to the API endpoint + + for the get API v2 config name operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2ConfigNameParams struct { + + /* Name. + + Name of the configuration file to be retrieved. + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 config name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ConfigNameParams) WithDefaults() *GetAPIV2ConfigNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 config name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ConfigNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 config name params +func (o *GetAPIV2ConfigNameParams) WithTimeout(timeout time.Duration) *GetAPIV2ConfigNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 config name params +func (o *GetAPIV2ConfigNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 config name params +func (o *GetAPIV2ConfigNameParams) WithContext(ctx context.Context) *GetAPIV2ConfigNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 config name params +func (o *GetAPIV2ConfigNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 config name params +func (o *GetAPIV2ConfigNameParams) WithHTTPClient(client *http.Client) *GetAPIV2ConfigNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 config name params +func (o *GetAPIV2ConfigNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithName adds the name to the get API v2 config name params +func (o *GetAPIV2ConfigNameParams) WithName(name string) *GetAPIV2ConfigNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the get API v2 config name params +func (o *GetAPIV2ConfigNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2ConfigNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/config/get_api_v2_config_name_responses.go b/pkg/core/capability/caldera/api/client/config/get_api_v2_config_name_responses.go new file mode 100644 index 00000000..735153ec --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/get_api_v2_config_name_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" +) + +// GetAPIV2ConfigNameReader is a Reader for the GetAPIV2ConfigName structure. +type GetAPIV2ConfigNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2ConfigNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2ConfigNameOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/config/{name}] GetAPIV2ConfigName", response, response.Code()) + } +} + +// NewGetAPIV2ConfigNameOK creates a GetAPIV2ConfigNameOK with default headers values +func NewGetAPIV2ConfigNameOK() *GetAPIV2ConfigNameOK { + return &GetAPIV2ConfigNameOK{} +} + +/* +GetAPIV2ConfigNameOK describes a response with status code 200, with default header values. + +OK +*/ +type GetAPIV2ConfigNameOK struct { +} + +// IsSuccess returns true when this get Api v2 config name o k response has a 2xx status code +func (o *GetAPIV2ConfigNameOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 config name o k response has a 3xx status code +func (o *GetAPIV2ConfigNameOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 config name o k response has a 4xx status code +func (o *GetAPIV2ConfigNameOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 config name o k response has a 5xx status code +func (o *GetAPIV2ConfigNameOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 config name o k response a status code equal to that given +func (o *GetAPIV2ConfigNameOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 config name o k response +func (o *GetAPIV2ConfigNameOK) Code() int { + return 200 +} + +func (o *GetAPIV2ConfigNameOK) Error() string { + return fmt.Sprintf("[GET /api/v2/config/{name}][%d] getApiV2ConfigNameOK", 200) +} + +func (o *GetAPIV2ConfigNameOK) String() string { + return fmt.Sprintf("[GET /api/v2/config/{name}][%d] getApiV2ConfigNameOK", 200) +} + +func (o *GetAPIV2ConfigNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/config/head_api_v2_config_name_parameters.go b/pkg/core/capability/caldera/api/client/config/head_api_v2_config_name_parameters.go new file mode 100644 index 00000000..a0518e51 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/head_api_v2_config_name_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" +) + +// NewHeadAPIV2ConfigNameParams creates a new HeadAPIV2ConfigNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2ConfigNameParams() *HeadAPIV2ConfigNameParams { + return &HeadAPIV2ConfigNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2ConfigNameParamsWithTimeout creates a new HeadAPIV2ConfigNameParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2ConfigNameParamsWithTimeout(timeout time.Duration) *HeadAPIV2ConfigNameParams { + return &HeadAPIV2ConfigNameParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2ConfigNameParamsWithContext creates a new HeadAPIV2ConfigNameParams object +// with the ability to set a context for a request. +func NewHeadAPIV2ConfigNameParamsWithContext(ctx context.Context) *HeadAPIV2ConfigNameParams { + return &HeadAPIV2ConfigNameParams{ + Context: ctx, + } +} + +// NewHeadAPIV2ConfigNameParamsWithHTTPClient creates a new HeadAPIV2ConfigNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2ConfigNameParamsWithHTTPClient(client *http.Client) *HeadAPIV2ConfigNameParams { + return &HeadAPIV2ConfigNameParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2ConfigNameParams contains all the parameters to send to the API endpoint + + for the head API v2 config name operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2ConfigNameParams struct { + + /* Name. + + Name of the configuration file to be retrieved. + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 config name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ConfigNameParams) WithDefaults() *HeadAPIV2ConfigNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 config name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ConfigNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 config name params +func (o *HeadAPIV2ConfigNameParams) WithTimeout(timeout time.Duration) *HeadAPIV2ConfigNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 config name params +func (o *HeadAPIV2ConfigNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 config name params +func (o *HeadAPIV2ConfigNameParams) WithContext(ctx context.Context) *HeadAPIV2ConfigNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 config name params +func (o *HeadAPIV2ConfigNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 config name params +func (o *HeadAPIV2ConfigNameParams) WithHTTPClient(client *http.Client) *HeadAPIV2ConfigNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 config name params +func (o *HeadAPIV2ConfigNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithName adds the name to the head API v2 config name params +func (o *HeadAPIV2ConfigNameParams) WithName(name string) *HeadAPIV2ConfigNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the head API v2 config name params +func (o *HeadAPIV2ConfigNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2ConfigNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/config/head_api_v2_config_name_responses.go b/pkg/core/capability/caldera/api/client/config/head_api_v2_config_name_responses.go new file mode 100644 index 00000000..8f0cf751 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/head_api_v2_config_name_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" +) + +// HeadAPIV2ConfigNameReader is a Reader for the HeadAPIV2ConfigName structure. +type HeadAPIV2ConfigNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2ConfigNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2ConfigNameOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/config/{name}] HeadAPIV2ConfigName", response, response.Code()) + } +} + +// NewHeadAPIV2ConfigNameOK creates a HeadAPIV2ConfigNameOK with default headers values +func NewHeadAPIV2ConfigNameOK() *HeadAPIV2ConfigNameOK { + return &HeadAPIV2ConfigNameOK{} +} + +/* +HeadAPIV2ConfigNameOK describes a response with status code 200, with default header values. + +OK +*/ +type HeadAPIV2ConfigNameOK struct { +} + +// IsSuccess returns true when this head Api v2 config name o k response has a 2xx status code +func (o *HeadAPIV2ConfigNameOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 config name o k response has a 3xx status code +func (o *HeadAPIV2ConfigNameOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 config name o k response has a 4xx status code +func (o *HeadAPIV2ConfigNameOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 config name o k response has a 5xx status code +func (o *HeadAPIV2ConfigNameOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 config name o k response a status code equal to that given +func (o *HeadAPIV2ConfigNameOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 config name o k response +func (o *HeadAPIV2ConfigNameOK) Code() int { + return 200 +} + +func (o *HeadAPIV2ConfigNameOK) Error() string { + return fmt.Sprintf("[HEAD /api/v2/config/{name}][%d] headApiV2ConfigNameOK", 200) +} + +func (o *HeadAPIV2ConfigNameOK) String() string { + return fmt.Sprintf("[HEAD /api/v2/config/{name}][%d] headApiV2ConfigNameOK", 200) +} + +func (o *HeadAPIV2ConfigNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_agents_parameters.go b/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_agents_parameters.go new file mode 100644 index 00000000..0ae94a92 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_agents_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2ConfigAgentsParams creates a new PatchAPIV2ConfigAgentsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2ConfigAgentsParams() *PatchAPIV2ConfigAgentsParams { + return &PatchAPIV2ConfigAgentsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2ConfigAgentsParamsWithTimeout creates a new PatchAPIV2ConfigAgentsParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2ConfigAgentsParamsWithTimeout(timeout time.Duration) *PatchAPIV2ConfigAgentsParams { + return &PatchAPIV2ConfigAgentsParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2ConfigAgentsParamsWithContext creates a new PatchAPIV2ConfigAgentsParams object +// with the ability to set a context for a request. +func NewPatchAPIV2ConfigAgentsParamsWithContext(ctx context.Context) *PatchAPIV2ConfigAgentsParams { + return &PatchAPIV2ConfigAgentsParams{ + Context: ctx, + } +} + +// NewPatchAPIV2ConfigAgentsParamsWithHTTPClient creates a new PatchAPIV2ConfigAgentsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2ConfigAgentsParamsWithHTTPClient(client *http.Client) *PatchAPIV2ConfigAgentsParams { + return &PatchAPIV2ConfigAgentsParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2ConfigAgentsParams contains all the parameters to send to the API endpoint + + for the patch API v2 config agents operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2ConfigAgentsParams struct { + + // Body. + Body *models.AgentConfigUpdate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 config agents params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2ConfigAgentsParams) WithDefaults() *PatchAPIV2ConfigAgentsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 config agents params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2ConfigAgentsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 config agents params +func (o *PatchAPIV2ConfigAgentsParams) WithTimeout(timeout time.Duration) *PatchAPIV2ConfigAgentsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 config agents params +func (o *PatchAPIV2ConfigAgentsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 config agents params +func (o *PatchAPIV2ConfigAgentsParams) WithContext(ctx context.Context) *PatchAPIV2ConfigAgentsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 config agents params +func (o *PatchAPIV2ConfigAgentsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 config agents params +func (o *PatchAPIV2ConfigAgentsParams) WithHTTPClient(client *http.Client) *PatchAPIV2ConfigAgentsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 config agents params +func (o *PatchAPIV2ConfigAgentsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 config agents params +func (o *PatchAPIV2ConfigAgentsParams) WithBody(body *models.AgentConfigUpdate) *PatchAPIV2ConfigAgentsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 config agents params +func (o *PatchAPIV2ConfigAgentsParams) SetBody(body *models.AgentConfigUpdate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2ConfigAgentsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_agents_responses.go b/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_agents_responses.go new file mode 100644 index 00000000..17fef8f3 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_agents_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2ConfigAgentsReader is a Reader for the PatchAPIV2ConfigAgents structure. +type PatchAPIV2ConfigAgentsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2ConfigAgentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2ConfigAgentsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/config/agents] PatchAPIV2ConfigAgents", response, response.Code()) + } +} + +// NewPatchAPIV2ConfigAgentsOK creates a PatchAPIV2ConfigAgentsOK with default headers values +func NewPatchAPIV2ConfigAgentsOK() *PatchAPIV2ConfigAgentsOK { + return &PatchAPIV2ConfigAgentsOK{} +} + +/* +PatchAPIV2ConfigAgentsOK describes a response with status code 200, with default header values. + +The response consists of data from the Agent configuration file dumped in the AgentConfigUpdateSchema format. +*/ +type PatchAPIV2ConfigAgentsOK struct { + Payload *models.AgentConfigUpdate +} + +// IsSuccess returns true when this patch Api v2 config agents o k response has a 2xx status code +func (o *PatchAPIV2ConfigAgentsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 config agents o k response has a 3xx status code +func (o *PatchAPIV2ConfigAgentsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 config agents o k response has a 4xx status code +func (o *PatchAPIV2ConfigAgentsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 config agents o k response has a 5xx status code +func (o *PatchAPIV2ConfigAgentsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 config agents o k response a status code equal to that given +func (o *PatchAPIV2ConfigAgentsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 config agents o k response +func (o *PatchAPIV2ConfigAgentsOK) Code() int { + return 200 +} + +func (o *PatchAPIV2ConfigAgentsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/config/agents][%d] patchApiV2ConfigAgentsOK %s", 200, payload) +} + +func (o *PatchAPIV2ConfigAgentsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/config/agents][%d] patchApiV2ConfigAgentsOK %s", 200, payload) +} + +func (o *PatchAPIV2ConfigAgentsOK) GetPayload() *models.AgentConfigUpdate { + return o.Payload +} + +func (o *PatchAPIV2ConfigAgentsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AgentConfigUpdate) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_main_parameters.go b/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_main_parameters.go new file mode 100644 index 00000000..2ae5e6b9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_main_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2ConfigMainParams creates a new PatchAPIV2ConfigMainParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2ConfigMainParams() *PatchAPIV2ConfigMainParams { + return &PatchAPIV2ConfigMainParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2ConfigMainParamsWithTimeout creates a new PatchAPIV2ConfigMainParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2ConfigMainParamsWithTimeout(timeout time.Duration) *PatchAPIV2ConfigMainParams { + return &PatchAPIV2ConfigMainParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2ConfigMainParamsWithContext creates a new PatchAPIV2ConfigMainParams object +// with the ability to set a context for a request. +func NewPatchAPIV2ConfigMainParamsWithContext(ctx context.Context) *PatchAPIV2ConfigMainParams { + return &PatchAPIV2ConfigMainParams{ + Context: ctx, + } +} + +// NewPatchAPIV2ConfigMainParamsWithHTTPClient creates a new PatchAPIV2ConfigMainParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2ConfigMainParamsWithHTTPClient(client *http.Client) *PatchAPIV2ConfigMainParams { + return &PatchAPIV2ConfigMainParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2ConfigMainParams contains all the parameters to send to the API endpoint + + for the patch API v2 config main operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2ConfigMainParams struct { + + // Body. + Body *models.ConfigUpdate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 config main params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2ConfigMainParams) WithDefaults() *PatchAPIV2ConfigMainParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 config main params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2ConfigMainParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 config main params +func (o *PatchAPIV2ConfigMainParams) WithTimeout(timeout time.Duration) *PatchAPIV2ConfigMainParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 config main params +func (o *PatchAPIV2ConfigMainParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 config main params +func (o *PatchAPIV2ConfigMainParams) WithContext(ctx context.Context) *PatchAPIV2ConfigMainParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 config main params +func (o *PatchAPIV2ConfigMainParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 config main params +func (o *PatchAPIV2ConfigMainParams) WithHTTPClient(client *http.Client) *PatchAPIV2ConfigMainParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 config main params +func (o *PatchAPIV2ConfigMainParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 config main params +func (o *PatchAPIV2ConfigMainParams) WithBody(body *models.ConfigUpdate) *PatchAPIV2ConfigMainParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 config main params +func (o *PatchAPIV2ConfigMainParams) SetBody(body *models.ConfigUpdate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2ConfigMainParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_main_responses.go b/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_main_responses.go new file mode 100644 index 00000000..5bc410ab --- /dev/null +++ b/pkg/core/capability/caldera/api/client/config/patch_api_v2_config_main_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package config + +// 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" +) + +// PatchAPIV2ConfigMainReader is a Reader for the PatchAPIV2ConfigMain structure. +type PatchAPIV2ConfigMainReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2ConfigMainReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2ConfigMainOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/config/main] PatchAPIV2ConfigMain", response, response.Code()) + } +} + +// NewPatchAPIV2ConfigMainOK creates a PatchAPIV2ConfigMainOK with default headers values +func NewPatchAPIV2ConfigMainOK() *PatchAPIV2ConfigMainOK { + return &PatchAPIV2ConfigMainOK{} +} + +/* +PatchAPIV2ConfigMainOK describes a response with status code 200, with default header values. + +OK +*/ +type PatchAPIV2ConfigMainOK struct { +} + +// IsSuccess returns true when this patch Api v2 config main o k response has a 2xx status code +func (o *PatchAPIV2ConfigMainOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 config main o k response has a 3xx status code +func (o *PatchAPIV2ConfigMainOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 config main o k response has a 4xx status code +func (o *PatchAPIV2ConfigMainOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 config main o k response has a 5xx status code +func (o *PatchAPIV2ConfigMainOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 config main o k response a status code equal to that given +func (o *PatchAPIV2ConfigMainOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 config main o k response +func (o *PatchAPIV2ConfigMainOK) Code() int { + return 200 +} + +func (o *PatchAPIV2ConfigMainOK) Error() string { + return fmt.Sprintf("[PATCH /api/v2/config/main][%d] patchApiV2ConfigMainOK", 200) +} + +func (o *PatchAPIV2ConfigMainOK) String() string { + return fmt.Sprintf("[PATCH /api/v2/config/main][%d] patchApiV2ConfigMainOK", 200) +} + +func (o *PatchAPIV2ConfigMainOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/contacts/contacts_client.go b/pkg/core/capability/caldera/api/client/contacts/contacts_client.go new file mode 100644 index 00000000..3ae2306c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/contacts_client.go @@ -0,0 +1,233 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new contacts API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new contacts API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new contacts API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for contacts API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIV2Contacts(params *GetAPIV2ContactsParams, opts ...ClientOption) (*GetAPIV2ContactsOK, error) + + GetAPIV2ContactsName(params *GetAPIV2ContactsNameParams, opts ...ClientOption) (*GetAPIV2ContactsNameOK, error) + + HeadAPIV2Contacts(params *HeadAPIV2ContactsParams, opts ...ClientOption) (*HeadAPIV2ContactsOK, error) + + HeadAPIV2ContactsName(params *HeadAPIV2ContactsNameParams, opts ...ClientOption) (*HeadAPIV2ContactsNameOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIV2Contacts retrieves a list of all available contact reports + +Returns a list of contacts that at least one agent has beaconed to. As soon as any agent beacons over a given contact, the contact will be returned here. +*/ +func (a *Client) GetAPIV2Contacts(params *GetAPIV2ContactsParams, opts ...ClientOption) (*GetAPIV2ContactsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2ContactsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Contacts", + Method: "GET", + PathPattern: "/api/v2/contacts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2ContactsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2ContactsOK) + 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 GetAPIV2Contacts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2ContactsName retrieves a list of beacons made by agents to the specified contact + +Returns a list of beacons made by agents to the specified contact. The response is formatted as a list of dictionaries. The dictionaries have the keys `paw`, `instructions`, and `date`. `paw` being the paw of the agent that made the beacon. `instructions` being a list of strings (commands) executed by the agent since its last beacon. `date` being a UTC date/time string. +*/ +func (a *Client) GetAPIV2ContactsName(params *GetAPIV2ContactsNameParams, opts ...ClientOption) (*GetAPIV2ContactsNameOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2ContactsNameParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2ContactsName", + Method: "GET", + PathPattern: "/api/v2/contacts/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2ContactsNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2ContactsNameOK) + 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 GetAPIV2ContactsName: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Contacts retrieves a list of all available contact reports + +Returns a list of contacts that at least one agent has beaconed to. As soon as any agent beacons over a given contact, the contact will be returned here. +*/ +func (a *Client) HeadAPIV2Contacts(params *HeadAPIV2ContactsParams, opts ...ClientOption) (*HeadAPIV2ContactsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2ContactsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Contacts", + Method: "HEAD", + PathPattern: "/api/v2/contacts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2ContactsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2ContactsOK) + 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 HeadAPIV2Contacts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2ContactsName retrieves a list of beacons made by agents to the specified contact + +Returns a list of beacons made by agents to the specified contact. The response is formatted as a list of dictionaries. The dictionaries have the keys `paw`, `instructions`, and `date`. `paw` being the paw of the agent that made the beacon. `instructions` being a list of strings (commands) executed by the agent since its last beacon. `date` being a UTC date/time string. +*/ +func (a *Client) HeadAPIV2ContactsName(params *HeadAPIV2ContactsNameParams, opts ...ClientOption) (*HeadAPIV2ContactsNameOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2ContactsNameParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2ContactsName", + Method: "HEAD", + PathPattern: "/api/v2/contacts/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2ContactsNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2ContactsNameOK) + 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 HeadAPIV2ContactsName: 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/core/capability/caldera/api/client/contacts/get_api_v2_contacts_name_parameters.go b/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_name_parameters.go new file mode 100644 index 00000000..0daaf6ab --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_name_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" +) + +// NewGetAPIV2ContactsNameParams creates a new GetAPIV2ContactsNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2ContactsNameParams() *GetAPIV2ContactsNameParams { + return &GetAPIV2ContactsNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2ContactsNameParamsWithTimeout creates a new GetAPIV2ContactsNameParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2ContactsNameParamsWithTimeout(timeout time.Duration) *GetAPIV2ContactsNameParams { + return &GetAPIV2ContactsNameParams{ + timeout: timeout, + } +} + +// NewGetAPIV2ContactsNameParamsWithContext creates a new GetAPIV2ContactsNameParams object +// with the ability to set a context for a request. +func NewGetAPIV2ContactsNameParamsWithContext(ctx context.Context) *GetAPIV2ContactsNameParams { + return &GetAPIV2ContactsNameParams{ + Context: ctx, + } +} + +// NewGetAPIV2ContactsNameParamsWithHTTPClient creates a new GetAPIV2ContactsNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2ContactsNameParamsWithHTTPClient(client *http.Client) *GetAPIV2ContactsNameParams { + return &GetAPIV2ContactsNameParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2ContactsNameParams contains all the parameters to send to the API endpoint + + for the get API v2 contacts name operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2ContactsNameParams struct { + + /* Name. + + Name of the contact to get beacons for, e.g. HTTP, TCP, et cetera. + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 contacts name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ContactsNameParams) WithDefaults() *GetAPIV2ContactsNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 contacts name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ContactsNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 contacts name params +func (o *GetAPIV2ContactsNameParams) WithTimeout(timeout time.Duration) *GetAPIV2ContactsNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 contacts name params +func (o *GetAPIV2ContactsNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 contacts name params +func (o *GetAPIV2ContactsNameParams) WithContext(ctx context.Context) *GetAPIV2ContactsNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 contacts name params +func (o *GetAPIV2ContactsNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 contacts name params +func (o *GetAPIV2ContactsNameParams) WithHTTPClient(client *http.Client) *GetAPIV2ContactsNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 contacts name params +func (o *GetAPIV2ContactsNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithName adds the name to the get API v2 contacts name params +func (o *GetAPIV2ContactsNameParams) WithName(name string) *GetAPIV2ContactsNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the get API v2 contacts name params +func (o *GetAPIV2ContactsNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2ContactsNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_name_responses.go b/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_name_responses.go new file mode 100644 index 00000000..52427d77 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_name_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" +) + +// GetAPIV2ContactsNameReader is a Reader for the GetAPIV2ContactsName structure. +type GetAPIV2ContactsNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2ContactsNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2ContactsNameOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/contacts/{name}] GetAPIV2ContactsName", response, response.Code()) + } +} + +// NewGetAPIV2ContactsNameOK creates a GetAPIV2ContactsNameOK with default headers values +func NewGetAPIV2ContactsNameOK() *GetAPIV2ContactsNameOK { + return &GetAPIV2ContactsNameOK{} +} + +/* +GetAPIV2ContactsNameOK describes a response with status code 200, with default header values. + +OK +*/ +type GetAPIV2ContactsNameOK struct { +} + +// IsSuccess returns true when this get Api v2 contacts name o k response has a 2xx status code +func (o *GetAPIV2ContactsNameOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 contacts name o k response has a 3xx status code +func (o *GetAPIV2ContactsNameOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 contacts name o k response has a 4xx status code +func (o *GetAPIV2ContactsNameOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 contacts name o k response has a 5xx status code +func (o *GetAPIV2ContactsNameOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 contacts name o k response a status code equal to that given +func (o *GetAPIV2ContactsNameOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 contacts name o k response +func (o *GetAPIV2ContactsNameOK) Code() int { + return 200 +} + +func (o *GetAPIV2ContactsNameOK) Error() string { + return fmt.Sprintf("[GET /api/v2/contacts/{name}][%d] getApiV2ContactsNameOK", 200) +} + +func (o *GetAPIV2ContactsNameOK) String() string { + return fmt.Sprintf("[GET /api/v2/contacts/{name}][%d] getApiV2ContactsNameOK", 200) +} + +func (o *GetAPIV2ContactsNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_parameters.go b/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_parameters.go new file mode 100644 index 00000000..9ed55651 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" +) + +// NewGetAPIV2ContactsParams creates a new GetAPIV2ContactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2ContactsParams() *GetAPIV2ContactsParams { + return &GetAPIV2ContactsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2ContactsParamsWithTimeout creates a new GetAPIV2ContactsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2ContactsParamsWithTimeout(timeout time.Duration) *GetAPIV2ContactsParams { + return &GetAPIV2ContactsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2ContactsParamsWithContext creates a new GetAPIV2ContactsParams object +// with the ability to set a context for a request. +func NewGetAPIV2ContactsParamsWithContext(ctx context.Context) *GetAPIV2ContactsParams { + return &GetAPIV2ContactsParams{ + Context: ctx, + } +} + +// NewGetAPIV2ContactsParamsWithHTTPClient creates a new GetAPIV2ContactsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2ContactsParamsWithHTTPClient(client *http.Client) *GetAPIV2ContactsParams { + return &GetAPIV2ContactsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2ContactsParams contains all the parameters to send to the API endpoint + + for the get API v2 contacts operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2ContactsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ContactsParams) WithDefaults() *GetAPIV2ContactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ContactsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 contacts params +func (o *GetAPIV2ContactsParams) WithTimeout(timeout time.Duration) *GetAPIV2ContactsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 contacts params +func (o *GetAPIV2ContactsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 contacts params +func (o *GetAPIV2ContactsParams) WithContext(ctx context.Context) *GetAPIV2ContactsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 contacts params +func (o *GetAPIV2ContactsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 contacts params +func (o *GetAPIV2ContactsParams) WithHTTPClient(client *http.Client) *GetAPIV2ContactsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 contacts params +func (o *GetAPIV2ContactsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2ContactsParams) 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/core/capability/caldera/api/client/contacts/get_api_v2_contacts_responses.go b/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_responses.go new file mode 100644 index 00000000..d7e77dbd --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/get_api_v2_contacts_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" +) + +// GetAPIV2ContactsReader is a Reader for the GetAPIV2Contacts structure. +type GetAPIV2ContactsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2ContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2ContactsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/contacts] GetAPIV2Contacts", response, response.Code()) + } +} + +// NewGetAPIV2ContactsOK creates a GetAPIV2ContactsOK with default headers values +func NewGetAPIV2ContactsOK() *GetAPIV2ContactsOK { + return &GetAPIV2ContactsOK{} +} + +/* +GetAPIV2ContactsOK describes a response with status code 200, with default header values. + +OK +*/ +type GetAPIV2ContactsOK struct { +} + +// IsSuccess returns true when this get Api v2 contacts o k response has a 2xx status code +func (o *GetAPIV2ContactsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 contacts o k response has a 3xx status code +func (o *GetAPIV2ContactsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 contacts o k response has a 4xx status code +func (o *GetAPIV2ContactsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 contacts o k response has a 5xx status code +func (o *GetAPIV2ContactsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 contacts o k response a status code equal to that given +func (o *GetAPIV2ContactsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 contacts o k response +func (o *GetAPIV2ContactsOK) Code() int { + return 200 +} + +func (o *GetAPIV2ContactsOK) Error() string { + return fmt.Sprintf("[GET /api/v2/contacts][%d] getApiV2ContactsOK", 200) +} + +func (o *GetAPIV2ContactsOK) String() string { + return fmt.Sprintf("[GET /api/v2/contacts][%d] getApiV2ContactsOK", 200) +} + +func (o *GetAPIV2ContactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_name_parameters.go b/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_name_parameters.go new file mode 100644 index 00000000..e3137880 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_name_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" +) + +// NewHeadAPIV2ContactsNameParams creates a new HeadAPIV2ContactsNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2ContactsNameParams() *HeadAPIV2ContactsNameParams { + return &HeadAPIV2ContactsNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2ContactsNameParamsWithTimeout creates a new HeadAPIV2ContactsNameParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2ContactsNameParamsWithTimeout(timeout time.Duration) *HeadAPIV2ContactsNameParams { + return &HeadAPIV2ContactsNameParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2ContactsNameParamsWithContext creates a new HeadAPIV2ContactsNameParams object +// with the ability to set a context for a request. +func NewHeadAPIV2ContactsNameParamsWithContext(ctx context.Context) *HeadAPIV2ContactsNameParams { + return &HeadAPIV2ContactsNameParams{ + Context: ctx, + } +} + +// NewHeadAPIV2ContactsNameParamsWithHTTPClient creates a new HeadAPIV2ContactsNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2ContactsNameParamsWithHTTPClient(client *http.Client) *HeadAPIV2ContactsNameParams { + return &HeadAPIV2ContactsNameParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2ContactsNameParams contains all the parameters to send to the API endpoint + + for the head API v2 contacts name operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2ContactsNameParams struct { + + /* Name. + + Name of the contact to get beacons for, e.g. HTTP, TCP, et cetera. + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 contacts name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ContactsNameParams) WithDefaults() *HeadAPIV2ContactsNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 contacts name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ContactsNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 contacts name params +func (o *HeadAPIV2ContactsNameParams) WithTimeout(timeout time.Duration) *HeadAPIV2ContactsNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 contacts name params +func (o *HeadAPIV2ContactsNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 contacts name params +func (o *HeadAPIV2ContactsNameParams) WithContext(ctx context.Context) *HeadAPIV2ContactsNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 contacts name params +func (o *HeadAPIV2ContactsNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 contacts name params +func (o *HeadAPIV2ContactsNameParams) WithHTTPClient(client *http.Client) *HeadAPIV2ContactsNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 contacts name params +func (o *HeadAPIV2ContactsNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithName adds the name to the head API v2 contacts name params +func (o *HeadAPIV2ContactsNameParams) WithName(name string) *HeadAPIV2ContactsNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the head API v2 contacts name params +func (o *HeadAPIV2ContactsNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2ContactsNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_name_responses.go b/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_name_responses.go new file mode 100644 index 00000000..ff62d62b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_name_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" +) + +// HeadAPIV2ContactsNameReader is a Reader for the HeadAPIV2ContactsName structure. +type HeadAPIV2ContactsNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2ContactsNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2ContactsNameOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/contacts/{name}] HeadAPIV2ContactsName", response, response.Code()) + } +} + +// NewHeadAPIV2ContactsNameOK creates a HeadAPIV2ContactsNameOK with default headers values +func NewHeadAPIV2ContactsNameOK() *HeadAPIV2ContactsNameOK { + return &HeadAPIV2ContactsNameOK{} +} + +/* +HeadAPIV2ContactsNameOK describes a response with status code 200, with default header values. + +OK +*/ +type HeadAPIV2ContactsNameOK struct { +} + +// IsSuccess returns true when this head Api v2 contacts name o k response has a 2xx status code +func (o *HeadAPIV2ContactsNameOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 contacts name o k response has a 3xx status code +func (o *HeadAPIV2ContactsNameOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 contacts name o k response has a 4xx status code +func (o *HeadAPIV2ContactsNameOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 contacts name o k response has a 5xx status code +func (o *HeadAPIV2ContactsNameOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 contacts name o k response a status code equal to that given +func (o *HeadAPIV2ContactsNameOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 contacts name o k response +func (o *HeadAPIV2ContactsNameOK) Code() int { + return 200 +} + +func (o *HeadAPIV2ContactsNameOK) Error() string { + return fmt.Sprintf("[HEAD /api/v2/contacts/{name}][%d] headApiV2ContactsNameOK", 200) +} + +func (o *HeadAPIV2ContactsNameOK) String() string { + return fmt.Sprintf("[HEAD /api/v2/contacts/{name}][%d] headApiV2ContactsNameOK", 200) +} + +func (o *HeadAPIV2ContactsNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_parameters.go b/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_parameters.go new file mode 100644 index 00000000..cf545e20 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" +) + +// NewHeadAPIV2ContactsParams creates a new HeadAPIV2ContactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2ContactsParams() *HeadAPIV2ContactsParams { + return &HeadAPIV2ContactsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2ContactsParamsWithTimeout creates a new HeadAPIV2ContactsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2ContactsParamsWithTimeout(timeout time.Duration) *HeadAPIV2ContactsParams { + return &HeadAPIV2ContactsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2ContactsParamsWithContext creates a new HeadAPIV2ContactsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2ContactsParamsWithContext(ctx context.Context) *HeadAPIV2ContactsParams { + return &HeadAPIV2ContactsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2ContactsParamsWithHTTPClient creates a new HeadAPIV2ContactsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2ContactsParamsWithHTTPClient(client *http.Client) *HeadAPIV2ContactsParams { + return &HeadAPIV2ContactsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2ContactsParams contains all the parameters to send to the API endpoint + + for the head API v2 contacts operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2ContactsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ContactsParams) WithDefaults() *HeadAPIV2ContactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ContactsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 contacts params +func (o *HeadAPIV2ContactsParams) WithTimeout(timeout time.Duration) *HeadAPIV2ContactsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 contacts params +func (o *HeadAPIV2ContactsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 contacts params +func (o *HeadAPIV2ContactsParams) WithContext(ctx context.Context) *HeadAPIV2ContactsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 contacts params +func (o *HeadAPIV2ContactsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 contacts params +func (o *HeadAPIV2ContactsParams) WithHTTPClient(client *http.Client) *HeadAPIV2ContactsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 contacts params +func (o *HeadAPIV2ContactsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2ContactsParams) 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/core/capability/caldera/api/client/contacts/head_api_v2_contacts_responses.go b/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_responses.go new file mode 100644 index 00000000..0288b75f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/contacts/head_api_v2_contacts_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package contacts + +// 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" +) + +// HeadAPIV2ContactsReader is a Reader for the HeadAPIV2Contacts structure. +type HeadAPIV2ContactsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2ContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2ContactsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/contacts] HeadAPIV2Contacts", response, response.Code()) + } +} + +// NewHeadAPIV2ContactsOK creates a HeadAPIV2ContactsOK with default headers values +func NewHeadAPIV2ContactsOK() *HeadAPIV2ContactsOK { + return &HeadAPIV2ContactsOK{} +} + +/* +HeadAPIV2ContactsOK describes a response with status code 200, with default header values. + +OK +*/ +type HeadAPIV2ContactsOK struct { +} + +// IsSuccess returns true when this head Api v2 contacts o k response has a 2xx status code +func (o *HeadAPIV2ContactsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 contacts o k response has a 3xx status code +func (o *HeadAPIV2ContactsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 contacts o k response has a 4xx status code +func (o *HeadAPIV2ContactsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 contacts o k response has a 5xx status code +func (o *HeadAPIV2ContactsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 contacts o k response a status code equal to that given +func (o *HeadAPIV2ContactsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 contacts o k response +func (o *HeadAPIV2ContactsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2ContactsOK) Error() string { + return fmt.Sprintf("[HEAD /api/v2/contacts][%d] headApiV2ContactsOK", 200) +} + +func (o *HeadAPIV2ContactsOK) String() string { + return fmt.Sprintf("[HEAD /api/v2/contacts][%d] headApiV2ContactsOK", 200) +} + +func (o *HeadAPIV2ContactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/facts/delete_api_v2_facts_parameters.go b/pkg/core/capability/caldera/api/client/facts/delete_api_v2_facts_parameters.go new file mode 100644 index 00000000..ce5b2a15 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/delete_api_v2_facts_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewDeleteAPIV2FactsParams creates a new DeleteAPIV2FactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2FactsParams() *DeleteAPIV2FactsParams { + return &DeleteAPIV2FactsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2FactsParamsWithTimeout creates a new DeleteAPIV2FactsParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2FactsParamsWithTimeout(timeout time.Duration) *DeleteAPIV2FactsParams { + return &DeleteAPIV2FactsParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2FactsParamsWithContext creates a new DeleteAPIV2FactsParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2FactsParamsWithContext(ctx context.Context) *DeleteAPIV2FactsParams { + return &DeleteAPIV2FactsParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2FactsParamsWithHTTPClient creates a new DeleteAPIV2FactsParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2FactsParamsWithHTTPClient(client *http.Client) *DeleteAPIV2FactsParams { + return &DeleteAPIV2FactsParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2FactsParams contains all the parameters to send to the API endpoint + + for the delete API v2 facts operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2FactsParams struct { + + // Body. + Body *models.PartialFact + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2FactsParams) WithDefaults() *DeleteAPIV2FactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2FactsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 facts params +func (o *DeleteAPIV2FactsParams) WithTimeout(timeout time.Duration) *DeleteAPIV2FactsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 facts params +func (o *DeleteAPIV2FactsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 facts params +func (o *DeleteAPIV2FactsParams) WithContext(ctx context.Context) *DeleteAPIV2FactsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 facts params +func (o *DeleteAPIV2FactsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 facts params +func (o *DeleteAPIV2FactsParams) WithHTTPClient(client *http.Client) *DeleteAPIV2FactsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 facts params +func (o *DeleteAPIV2FactsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the delete API v2 facts params +func (o *DeleteAPIV2FactsParams) WithBody(body *models.PartialFact) *DeleteAPIV2FactsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the delete API v2 facts params +func (o *DeleteAPIV2FactsParams) SetBody(body *models.PartialFact) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2FactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/facts/delete_api_v2_facts_responses.go b/pkg/core/capability/caldera/api/client/facts/delete_api_v2_facts_responses.go new file mode 100644 index 00000000..915f8201 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/delete_api_v2_facts_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// DeleteAPIV2FactsReader is a Reader for the DeleteAPIV2Facts structure. +type DeleteAPIV2FactsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2FactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPIV2FactsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/facts] DeleteAPIV2Facts", response, response.Code()) + } +} + +// NewDeleteAPIV2FactsOK creates a DeleteAPIV2FactsOK with default headers values +func NewDeleteAPIV2FactsOK() *DeleteAPIV2FactsOK { + return &DeleteAPIV2FactsOK{} +} + +/* +DeleteAPIV2FactsOK describes a response with status code 200, with default header values. + +Returns the deleted fact(s), dumped in `FactSchema` format. +*/ +type DeleteAPIV2FactsOK struct { + Payload *models.Fact +} + +// IsSuccess returns true when this delete Api v2 facts o k response has a 2xx status code +func (o *DeleteAPIV2FactsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 facts o k response has a 3xx status code +func (o *DeleteAPIV2FactsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 facts o k response has a 4xx status code +func (o *DeleteAPIV2FactsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 facts o k response has a 5xx status code +func (o *DeleteAPIV2FactsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 facts o k response a status code equal to that given +func (o *DeleteAPIV2FactsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete Api v2 facts o k response +func (o *DeleteAPIV2FactsOK) Code() int { + return 200 +} + +func (o *DeleteAPIV2FactsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/facts][%d] deleteApiV2FactsOK %s", 200, payload) +} + +func (o *DeleteAPIV2FactsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/facts][%d] deleteApiV2FactsOK %s", 200, payload) +} + +func (o *DeleteAPIV2FactsOK) GetPayload() *models.Fact { + return o.Payload +} + +func (o *DeleteAPIV2FactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Fact) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/facts/facts_client.go b/pkg/core/capability/caldera/api/client/facts/facts_client.go new file mode 100644 index 00000000..e9aedb9b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/facts_client.go @@ -0,0 +1,359 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new facts API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new facts API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new facts API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for facts API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2Facts(params *DeleteAPIV2FactsParams, opts ...ClientOption) (*DeleteAPIV2FactsOK, error) + + GetAPIV2Facts(params *GetAPIV2FactsParams, opts ...ClientOption) (*GetAPIV2FactsOK, error) + + GetAPIV2FactsOperationID(params *GetAPIV2FactsOperationIDParams, opts ...ClientOption) (*GetAPIV2FactsOperationIDOK, error) + + HeadAPIV2Facts(params *HeadAPIV2FactsParams, opts ...ClientOption) (*HeadAPIV2FactsOK, error) + + HeadAPIV2FactsOperationID(params *HeadAPIV2FactsOperationIDParams, opts ...ClientOption) (*HeadAPIV2FactsOperationIDOK, error) + + PatchAPIV2Facts(params *PatchAPIV2FactsParams, opts ...ClientOption) (*PatchAPIV2FactsOK, error) + + PostAPIV2Facts(params *PostAPIV2FactsParams, opts ...ClientOption) (*PostAPIV2FactsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2Facts deletes one or more facts + +Delete facts using the format provided in the `FactSchema`. This will delete all facts that match the criteria specified in the payload. +*/ +func (a *Client) DeleteAPIV2Facts(params *DeleteAPIV2FactsParams, opts ...ClientOption) (*DeleteAPIV2FactsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2FactsParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2Facts", + Method: "DELETE", + PathPattern: "/api/v2/facts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2FactsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2FactsOK) + 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 DeleteAPIV2Facts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Facts retrieves facts + +Retrieve facts by criteria. Use fields from the `FactSchema` in the request body to filter retrieved facts. +*/ +func (a *Client) GetAPIV2Facts(params *GetAPIV2FactsParams, opts ...ClientOption) (*GetAPIV2FactsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2FactsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Facts", + Method: "GET", + PathPattern: "/api/v2/facts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2FactsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2FactsOK) + 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 GetAPIV2Facts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2FactsOperationID retrieves facts by operation id + +Retrieves facts associated with an operation. Returned facts will either be user-generated facts or learned facts. +*/ +func (a *Client) GetAPIV2FactsOperationID(params *GetAPIV2FactsOperationIDParams, opts ...ClientOption) (*GetAPIV2FactsOperationIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2FactsOperationIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2FactsOperationID", + Method: "GET", + PathPattern: "/api/v2/facts/{operation_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2FactsOperationIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2FactsOperationIDOK) + 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 GetAPIV2FactsOperationID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Facts retrieves facts + +Retrieve facts by criteria. Use fields from the `FactSchema` in the request body to filter retrieved facts. +*/ +func (a *Client) HeadAPIV2Facts(params *HeadAPIV2FactsParams, opts ...ClientOption) (*HeadAPIV2FactsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2FactsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Facts", + Method: "HEAD", + PathPattern: "/api/v2/facts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2FactsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2FactsOK) + 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 HeadAPIV2Facts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2FactsOperationID retrieves facts by operation id + +Retrieves facts associated with an operation. Returned facts will either be user-generated facts or learned facts. +*/ +func (a *Client) HeadAPIV2FactsOperationID(params *HeadAPIV2FactsOperationIDParams, opts ...ClientOption) (*HeadAPIV2FactsOperationIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2FactsOperationIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2FactsOperationID", + Method: "HEAD", + PathPattern: "/api/v2/facts/{operation_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2FactsOperationIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2FactsOperationIDOK) + 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 HeadAPIV2FactsOperationID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2Facts updates one or more facts + +Update existing facts using the format provided in the `FactSchema`. This will update all facts that match the criteria specified in the payload. +*/ +func (a *Client) PatchAPIV2Facts(params *PatchAPIV2FactsParams, opts ...ClientOption) (*PatchAPIV2FactsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2FactsParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2Facts", + Method: "PATCH", + PathPattern: "/api/v2/facts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2FactsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2FactsOK) + 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 PatchAPIV2Facts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Facts creates a fact + +Create a new fact using the format provided in the `FactSchema`. +*/ +func (a *Client) PostAPIV2Facts(params *PostAPIV2FactsParams, opts ...ClientOption) (*PostAPIV2FactsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2FactsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Facts", + Method: "POST", + PathPattern: "/api/v2/facts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2FactsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2FactsOK) + 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 PostAPIV2Facts: 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/core/capability/caldera/api/client/facts/get_api_v2_facts_operation_id_parameters.go b/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_operation_id_parameters.go new file mode 100644 index 00000000..e0512039 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_operation_id_parameters.go @@ -0,0 +1,264 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" +) + +// NewGetAPIV2FactsOperationIDParams creates a new GetAPIV2FactsOperationIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2FactsOperationIDParams() *GetAPIV2FactsOperationIDParams { + return &GetAPIV2FactsOperationIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2FactsOperationIDParamsWithTimeout creates a new GetAPIV2FactsOperationIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2FactsOperationIDParamsWithTimeout(timeout time.Duration) *GetAPIV2FactsOperationIDParams { + return &GetAPIV2FactsOperationIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2FactsOperationIDParamsWithContext creates a new GetAPIV2FactsOperationIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2FactsOperationIDParamsWithContext(ctx context.Context) *GetAPIV2FactsOperationIDParams { + return &GetAPIV2FactsOperationIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2FactsOperationIDParamsWithHTTPClient creates a new GetAPIV2FactsOperationIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2FactsOperationIDParamsWithHTTPClient(client *http.Client) *GetAPIV2FactsOperationIDParams { + return &GetAPIV2FactsOperationIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2FactsOperationIDParams contains all the parameters to send to the API endpoint + + for the get API v2 facts operation ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2FactsOperationIDParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // OperationID. + OperationID string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 facts operation ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2FactsOperationIDParams) WithDefaults() *GetAPIV2FactsOperationIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 facts operation ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2FactsOperationIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) WithTimeout(timeout time.Duration) *GetAPIV2FactsOperationIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) WithContext(ctx context.Context) *GetAPIV2FactsOperationIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) WithHTTPClient(client *http.Client) *GetAPIV2FactsOperationIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) WithExclude(exclude []string) *GetAPIV2FactsOperationIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) WithInclude(include []string) *GetAPIV2FactsOperationIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) SetInclude(include []string) { + o.Include = include +} + +// WithOperationID adds the operationID to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) WithOperationID(operationID string) *GetAPIV2FactsOperationIDParams { + o.SetOperationID(operationID) + return o +} + +// SetOperationID adds the operationId to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) SetOperationID(operationID string) { + o.OperationID = operationID +} + +// WithSort adds the sort to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) WithSort(sort *string) *GetAPIV2FactsOperationIDParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 facts operation ID params +func (o *GetAPIV2FactsOperationIDParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2FactsOperationIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param operation_id + if err := r.SetPathParam("operation_id", o.OperationID); err != nil { + return err + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2FactsOperationID binds the parameter exclude +func (o *GetAPIV2FactsOperationIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2FactsOperationID binds the parameter include +func (o *GetAPIV2FactsOperationIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_operation_id_responses.go b/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_operation_id_responses.go new file mode 100644 index 00000000..0cafcd7f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_operation_id_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2FactsOperationIDReader is a Reader for the GetAPIV2FactsOperationID structure. +type GetAPIV2FactsOperationIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2FactsOperationIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2FactsOperationIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/facts/{operation_id}] GetAPIV2FactsOperationID", response, response.Code()) + } +} + +// NewGetAPIV2FactsOperationIDOK creates a GetAPIV2FactsOperationIDOK with default headers values +func NewGetAPIV2FactsOperationIDOK() *GetAPIV2FactsOperationIDOK { + return &GetAPIV2FactsOperationIDOK{} +} + +/* +GetAPIV2FactsOperationIDOK describes a response with status code 200, with default header values. + +Returns a list of facts associated with operation_id, dumped in `FactSchema` format. +*/ +type GetAPIV2FactsOperationIDOK struct { + Payload []*models.PartialFact +} + +// IsSuccess returns true when this get Api v2 facts operation Id o k response has a 2xx status code +func (o *GetAPIV2FactsOperationIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 facts operation Id o k response has a 3xx status code +func (o *GetAPIV2FactsOperationIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 facts operation Id o k response has a 4xx status code +func (o *GetAPIV2FactsOperationIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 facts operation Id o k response has a 5xx status code +func (o *GetAPIV2FactsOperationIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 facts operation Id o k response a status code equal to that given +func (o *GetAPIV2FactsOperationIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 facts operation Id o k response +func (o *GetAPIV2FactsOperationIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2FactsOperationIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/facts/{operation_id}][%d] getApiV2FactsOperationIdOK %s", 200, payload) +} + +func (o *GetAPIV2FactsOperationIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/facts/{operation_id}][%d] getApiV2FactsOperationIdOK %s", 200, payload) +} + +func (o *GetAPIV2FactsOperationIDOK) GetPayload() []*models.PartialFact { + return o.Payload +} + +func (o *GetAPIV2FactsOperationIDOK) 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/core/capability/caldera/api/client/facts/get_api_v2_facts_parameters.go b/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_parameters.go new file mode 100644 index 00000000..2142ef05 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" +) + +// NewGetAPIV2FactsParams creates a new GetAPIV2FactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2FactsParams() *GetAPIV2FactsParams { + return &GetAPIV2FactsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2FactsParamsWithTimeout creates a new GetAPIV2FactsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2FactsParamsWithTimeout(timeout time.Duration) *GetAPIV2FactsParams { + return &GetAPIV2FactsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2FactsParamsWithContext creates a new GetAPIV2FactsParams object +// with the ability to set a context for a request. +func NewGetAPIV2FactsParamsWithContext(ctx context.Context) *GetAPIV2FactsParams { + return &GetAPIV2FactsParams{ + Context: ctx, + } +} + +// NewGetAPIV2FactsParamsWithHTTPClient creates a new GetAPIV2FactsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2FactsParamsWithHTTPClient(client *http.Client) *GetAPIV2FactsParams { + return &GetAPIV2FactsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2FactsParams contains all the parameters to send to the API endpoint + + for the get API v2 facts operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2FactsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2FactsParams) WithDefaults() *GetAPIV2FactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2FactsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 facts params +func (o *GetAPIV2FactsParams) WithTimeout(timeout time.Duration) *GetAPIV2FactsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 facts params +func (o *GetAPIV2FactsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 facts params +func (o *GetAPIV2FactsParams) WithContext(ctx context.Context) *GetAPIV2FactsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 facts params +func (o *GetAPIV2FactsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 facts params +func (o *GetAPIV2FactsParams) WithHTTPClient(client *http.Client) *GetAPIV2FactsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 facts params +func (o *GetAPIV2FactsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 facts params +func (o *GetAPIV2FactsParams) WithExclude(exclude []string) *GetAPIV2FactsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 facts params +func (o *GetAPIV2FactsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 facts params +func (o *GetAPIV2FactsParams) WithInclude(include []string) *GetAPIV2FactsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 facts params +func (o *GetAPIV2FactsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 facts params +func (o *GetAPIV2FactsParams) WithSort(sort *string) *GetAPIV2FactsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 facts params +func (o *GetAPIV2FactsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2FactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Facts binds the parameter exclude +func (o *GetAPIV2FactsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Facts binds the parameter include +func (o *GetAPIV2FactsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_responses.go b/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_responses.go new file mode 100644 index 00000000..9a1269a8 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/get_api_v2_facts_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2FactsReader is a Reader for the GetAPIV2Facts structure. +type GetAPIV2FactsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2FactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2FactsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/facts] GetAPIV2Facts", response, response.Code()) + } +} + +// NewGetAPIV2FactsOK creates a GetAPIV2FactsOK with default headers values +func NewGetAPIV2FactsOK() *GetAPIV2FactsOK { + return &GetAPIV2FactsOK{} +} + +/* +GetAPIV2FactsOK describes a response with status code 200, with default header values. + +Returns a list of matching facts, dumped in `FactSchema` format. +*/ +type GetAPIV2FactsOK struct { + Payload []*models.PartialFact +} + +// IsSuccess returns true when this get Api v2 facts o k response has a 2xx status code +func (o *GetAPIV2FactsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 facts o k response has a 3xx status code +func (o *GetAPIV2FactsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 facts o k response has a 4xx status code +func (o *GetAPIV2FactsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 facts o k response has a 5xx status code +func (o *GetAPIV2FactsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 facts o k response a status code equal to that given +func (o *GetAPIV2FactsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 facts o k response +func (o *GetAPIV2FactsOK) Code() int { + return 200 +} + +func (o *GetAPIV2FactsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/facts][%d] getApiV2FactsOK %s", 200, payload) +} + +func (o *GetAPIV2FactsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/facts][%d] getApiV2FactsOK %s", 200, payload) +} + +func (o *GetAPIV2FactsOK) GetPayload() []*models.PartialFact { + return o.Payload +} + +func (o *GetAPIV2FactsOK) 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/core/capability/caldera/api/client/facts/head_api_v2_facts_operation_id_parameters.go b/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_operation_id_parameters.go new file mode 100644 index 00000000..af9ff8ef --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_operation_id_parameters.go @@ -0,0 +1,264 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" +) + +// NewHeadAPIV2FactsOperationIDParams creates a new HeadAPIV2FactsOperationIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2FactsOperationIDParams() *HeadAPIV2FactsOperationIDParams { + return &HeadAPIV2FactsOperationIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2FactsOperationIDParamsWithTimeout creates a new HeadAPIV2FactsOperationIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2FactsOperationIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2FactsOperationIDParams { + return &HeadAPIV2FactsOperationIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2FactsOperationIDParamsWithContext creates a new HeadAPIV2FactsOperationIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2FactsOperationIDParamsWithContext(ctx context.Context) *HeadAPIV2FactsOperationIDParams { + return &HeadAPIV2FactsOperationIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2FactsOperationIDParamsWithHTTPClient creates a new HeadAPIV2FactsOperationIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2FactsOperationIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2FactsOperationIDParams { + return &HeadAPIV2FactsOperationIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2FactsOperationIDParams contains all the parameters to send to the API endpoint + + for the head API v2 facts operation ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2FactsOperationIDParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // OperationID. + OperationID string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 facts operation ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2FactsOperationIDParams) WithDefaults() *HeadAPIV2FactsOperationIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 facts operation ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2FactsOperationIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2FactsOperationIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) WithContext(ctx context.Context) *HeadAPIV2FactsOperationIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2FactsOperationIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) WithExclude(exclude []string) *HeadAPIV2FactsOperationIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) WithInclude(include []string) *HeadAPIV2FactsOperationIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) SetInclude(include []string) { + o.Include = include +} + +// WithOperationID adds the operationID to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) WithOperationID(operationID string) *HeadAPIV2FactsOperationIDParams { + o.SetOperationID(operationID) + return o +} + +// SetOperationID adds the operationId to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) SetOperationID(operationID string) { + o.OperationID = operationID +} + +// WithSort adds the sort to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) WithSort(sort *string) *HeadAPIV2FactsOperationIDParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 facts operation ID params +func (o *HeadAPIV2FactsOperationIDParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2FactsOperationIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param operation_id + if err := r.SetPathParam("operation_id", o.OperationID); err != nil { + return err + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2FactsOperationID binds the parameter exclude +func (o *HeadAPIV2FactsOperationIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2FactsOperationID binds the parameter include +func (o *HeadAPIV2FactsOperationIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_operation_id_responses.go b/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_operation_id_responses.go new file mode 100644 index 00000000..27159447 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_operation_id_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2FactsOperationIDReader is a Reader for the HeadAPIV2FactsOperationID structure. +type HeadAPIV2FactsOperationIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2FactsOperationIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2FactsOperationIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/facts/{operation_id}] HeadAPIV2FactsOperationID", response, response.Code()) + } +} + +// NewHeadAPIV2FactsOperationIDOK creates a HeadAPIV2FactsOperationIDOK with default headers values +func NewHeadAPIV2FactsOperationIDOK() *HeadAPIV2FactsOperationIDOK { + return &HeadAPIV2FactsOperationIDOK{} +} + +/* +HeadAPIV2FactsOperationIDOK describes a response with status code 200, with default header values. + +Returns a list of facts associated with operation_id, dumped in `FactSchema` format. +*/ +type HeadAPIV2FactsOperationIDOK struct { + Payload []*models.PartialFact +} + +// IsSuccess returns true when this head Api v2 facts operation Id o k response has a 2xx status code +func (o *HeadAPIV2FactsOperationIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 facts operation Id o k response has a 3xx status code +func (o *HeadAPIV2FactsOperationIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 facts operation Id o k response has a 4xx status code +func (o *HeadAPIV2FactsOperationIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 facts operation Id o k response has a 5xx status code +func (o *HeadAPIV2FactsOperationIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 facts operation Id o k response a status code equal to that given +func (o *HeadAPIV2FactsOperationIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 facts operation Id o k response +func (o *HeadAPIV2FactsOperationIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2FactsOperationIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/facts/{operation_id}][%d] headApiV2FactsOperationIdOK %s", 200, payload) +} + +func (o *HeadAPIV2FactsOperationIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/facts/{operation_id}][%d] headApiV2FactsOperationIdOK %s", 200, payload) +} + +func (o *HeadAPIV2FactsOperationIDOK) GetPayload() []*models.PartialFact { + return o.Payload +} + +func (o *HeadAPIV2FactsOperationIDOK) 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/core/capability/caldera/api/client/facts/head_api_v2_facts_parameters.go b/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_parameters.go new file mode 100644 index 00000000..ec0af0a4 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" +) + +// NewHeadAPIV2FactsParams creates a new HeadAPIV2FactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2FactsParams() *HeadAPIV2FactsParams { + return &HeadAPIV2FactsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2FactsParamsWithTimeout creates a new HeadAPIV2FactsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2FactsParamsWithTimeout(timeout time.Duration) *HeadAPIV2FactsParams { + return &HeadAPIV2FactsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2FactsParamsWithContext creates a new HeadAPIV2FactsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2FactsParamsWithContext(ctx context.Context) *HeadAPIV2FactsParams { + return &HeadAPIV2FactsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2FactsParamsWithHTTPClient creates a new HeadAPIV2FactsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2FactsParamsWithHTTPClient(client *http.Client) *HeadAPIV2FactsParams { + return &HeadAPIV2FactsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2FactsParams contains all the parameters to send to the API endpoint + + for the head API v2 facts operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2FactsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2FactsParams) WithDefaults() *HeadAPIV2FactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2FactsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 facts params +func (o *HeadAPIV2FactsParams) WithTimeout(timeout time.Duration) *HeadAPIV2FactsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 facts params +func (o *HeadAPIV2FactsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 facts params +func (o *HeadAPIV2FactsParams) WithContext(ctx context.Context) *HeadAPIV2FactsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 facts params +func (o *HeadAPIV2FactsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 facts params +func (o *HeadAPIV2FactsParams) WithHTTPClient(client *http.Client) *HeadAPIV2FactsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 facts params +func (o *HeadAPIV2FactsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 facts params +func (o *HeadAPIV2FactsParams) WithExclude(exclude []string) *HeadAPIV2FactsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 facts params +func (o *HeadAPIV2FactsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 facts params +func (o *HeadAPIV2FactsParams) WithInclude(include []string) *HeadAPIV2FactsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 facts params +func (o *HeadAPIV2FactsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 facts params +func (o *HeadAPIV2FactsParams) WithSort(sort *string) *HeadAPIV2FactsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 facts params +func (o *HeadAPIV2FactsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2FactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Facts binds the parameter exclude +func (o *HeadAPIV2FactsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Facts binds the parameter include +func (o *HeadAPIV2FactsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_responses.go b/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_responses.go new file mode 100644 index 00000000..3620d6d4 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/head_api_v2_facts_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2FactsReader is a Reader for the HeadAPIV2Facts structure. +type HeadAPIV2FactsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2FactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2FactsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/facts] HeadAPIV2Facts", response, response.Code()) + } +} + +// NewHeadAPIV2FactsOK creates a HeadAPIV2FactsOK with default headers values +func NewHeadAPIV2FactsOK() *HeadAPIV2FactsOK { + return &HeadAPIV2FactsOK{} +} + +/* +HeadAPIV2FactsOK describes a response with status code 200, with default header values. + +Returns a list of matching facts, dumped in `FactSchema` format. +*/ +type HeadAPIV2FactsOK struct { + Payload []*models.PartialFact +} + +// IsSuccess returns true when this head Api v2 facts o k response has a 2xx status code +func (o *HeadAPIV2FactsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 facts o k response has a 3xx status code +func (o *HeadAPIV2FactsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 facts o k response has a 4xx status code +func (o *HeadAPIV2FactsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 facts o k response has a 5xx status code +func (o *HeadAPIV2FactsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 facts o k response a status code equal to that given +func (o *HeadAPIV2FactsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 facts o k response +func (o *HeadAPIV2FactsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2FactsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/facts][%d] headApiV2FactsOK %s", 200, payload) +} + +func (o *HeadAPIV2FactsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/facts][%d] headApiV2FactsOK %s", 200, payload) +} + +func (o *HeadAPIV2FactsOK) GetPayload() []*models.PartialFact { + return o.Payload +} + +func (o *HeadAPIV2FactsOK) 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/core/capability/caldera/api/client/facts/patch_api_v2_facts_parameters.go b/pkg/core/capability/caldera/api/client/facts/patch_api_v2_facts_parameters.go new file mode 100644 index 00000000..8a736f63 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/patch_api_v2_facts_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2FactsParams creates a new PatchAPIV2FactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2FactsParams() *PatchAPIV2FactsParams { + return &PatchAPIV2FactsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2FactsParamsWithTimeout creates a new PatchAPIV2FactsParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2FactsParamsWithTimeout(timeout time.Duration) *PatchAPIV2FactsParams { + return &PatchAPIV2FactsParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2FactsParamsWithContext creates a new PatchAPIV2FactsParams object +// with the ability to set a context for a request. +func NewPatchAPIV2FactsParamsWithContext(ctx context.Context) *PatchAPIV2FactsParams { + return &PatchAPIV2FactsParams{ + Context: ctx, + } +} + +// NewPatchAPIV2FactsParamsWithHTTPClient creates a new PatchAPIV2FactsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2FactsParamsWithHTTPClient(client *http.Client) *PatchAPIV2FactsParams { + return &PatchAPIV2FactsParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2FactsParams contains all the parameters to send to the API endpoint + + for the patch API v2 facts operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2FactsParams struct { + + // Body. + Body *models.PartialFactUpdateRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2FactsParams) WithDefaults() *PatchAPIV2FactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2FactsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 facts params +func (o *PatchAPIV2FactsParams) WithTimeout(timeout time.Duration) *PatchAPIV2FactsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 facts params +func (o *PatchAPIV2FactsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 facts params +func (o *PatchAPIV2FactsParams) WithContext(ctx context.Context) *PatchAPIV2FactsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 facts params +func (o *PatchAPIV2FactsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 facts params +func (o *PatchAPIV2FactsParams) WithHTTPClient(client *http.Client) *PatchAPIV2FactsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 facts params +func (o *PatchAPIV2FactsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 facts params +func (o *PatchAPIV2FactsParams) WithBody(body *models.PartialFactUpdateRequest) *PatchAPIV2FactsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 facts params +func (o *PatchAPIV2FactsParams) SetBody(body *models.PartialFactUpdateRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2FactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/facts/patch_api_v2_facts_responses.go b/pkg/core/capability/caldera/api/client/facts/patch_api_v2_facts_responses.go new file mode 100644 index 00000000..e094cc6e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/patch_api_v2_facts_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2FactsReader is a Reader for the PatchAPIV2Facts structure. +type PatchAPIV2FactsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2FactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2FactsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/facts] PatchAPIV2Facts", response, response.Code()) + } +} + +// NewPatchAPIV2FactsOK creates a PatchAPIV2FactsOK with default headers values +func NewPatchAPIV2FactsOK() *PatchAPIV2FactsOK { + return &PatchAPIV2FactsOK{} +} + +/* +PatchAPIV2FactsOK describes a response with status code 200, with default header values. + +Returns the updated fact(s), dumped in `FactSchema` format. +*/ +type PatchAPIV2FactsOK struct { + Payload *models.Fact +} + +// IsSuccess returns true when this patch Api v2 facts o k response has a 2xx status code +func (o *PatchAPIV2FactsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 facts o k response has a 3xx status code +func (o *PatchAPIV2FactsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 facts o k response has a 4xx status code +func (o *PatchAPIV2FactsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 facts o k response has a 5xx status code +func (o *PatchAPIV2FactsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 facts o k response a status code equal to that given +func (o *PatchAPIV2FactsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 facts o k response +func (o *PatchAPIV2FactsOK) Code() int { + return 200 +} + +func (o *PatchAPIV2FactsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/facts][%d] patchApiV2FactsOK %s", 200, payload) +} + +func (o *PatchAPIV2FactsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/facts][%d] patchApiV2FactsOK %s", 200, payload) +} + +func (o *PatchAPIV2FactsOK) GetPayload() *models.Fact { + return o.Payload +} + +func (o *PatchAPIV2FactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Fact) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/facts/post_api_v2_facts_parameters.go b/pkg/core/capability/caldera/api/client/facts/post_api_v2_facts_parameters.go new file mode 100644 index 00000000..5ec59e5b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/post_api_v2_facts_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2FactsParams creates a new PostAPIV2FactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2FactsParams() *PostAPIV2FactsParams { + return &PostAPIV2FactsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2FactsParamsWithTimeout creates a new PostAPIV2FactsParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2FactsParamsWithTimeout(timeout time.Duration) *PostAPIV2FactsParams { + return &PostAPIV2FactsParams{ + timeout: timeout, + } +} + +// NewPostAPIV2FactsParamsWithContext creates a new PostAPIV2FactsParams object +// with the ability to set a context for a request. +func NewPostAPIV2FactsParamsWithContext(ctx context.Context) *PostAPIV2FactsParams { + return &PostAPIV2FactsParams{ + Context: ctx, + } +} + +// NewPostAPIV2FactsParamsWithHTTPClient creates a new PostAPIV2FactsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2FactsParamsWithHTTPClient(client *http.Client) *PostAPIV2FactsParams { + return &PostAPIV2FactsParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2FactsParams contains all the parameters to send to the API endpoint + + for the post API v2 facts operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2FactsParams struct { + + // Body. + Body *models.Fact + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2FactsParams) WithDefaults() *PostAPIV2FactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 facts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2FactsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 facts params +func (o *PostAPIV2FactsParams) WithTimeout(timeout time.Duration) *PostAPIV2FactsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 facts params +func (o *PostAPIV2FactsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 facts params +func (o *PostAPIV2FactsParams) WithContext(ctx context.Context) *PostAPIV2FactsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 facts params +func (o *PostAPIV2FactsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 facts params +func (o *PostAPIV2FactsParams) WithHTTPClient(client *http.Client) *PostAPIV2FactsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 facts params +func (o *PostAPIV2FactsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 facts params +func (o *PostAPIV2FactsParams) WithBody(body *models.Fact) *PostAPIV2FactsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 facts params +func (o *PostAPIV2FactsParams) SetBody(body *models.Fact) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2FactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/facts/post_api_v2_facts_responses.go b/pkg/core/capability/caldera/api/client/facts/post_api_v2_facts_responses.go new file mode 100644 index 00000000..27cf3fdf --- /dev/null +++ b/pkg/core/capability/caldera/api/client/facts/post_api_v2_facts_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package facts + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2FactsReader is a Reader for the PostAPIV2Facts structure. +type PostAPIV2FactsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2FactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2FactsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/facts] PostAPIV2Facts", response, response.Code()) + } +} + +// NewPostAPIV2FactsOK creates a PostAPIV2FactsOK with default headers values +func NewPostAPIV2FactsOK() *PostAPIV2FactsOK { + return &PostAPIV2FactsOK{} +} + +/* +PostAPIV2FactsOK describes a response with status code 200, with default header values. + +Returns the created fact, dumped in `FactSchema` format. +*/ +type PostAPIV2FactsOK struct { + Payload *models.Fact +} + +// IsSuccess returns true when this post Api v2 facts o k response has a 2xx status code +func (o *PostAPIV2FactsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 facts o k response has a 3xx status code +func (o *PostAPIV2FactsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 facts o k response has a 4xx status code +func (o *PostAPIV2FactsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 facts o k response has a 5xx status code +func (o *PostAPIV2FactsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 facts o k response a status code equal to that given +func (o *PostAPIV2FactsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 facts o k response +func (o *PostAPIV2FactsOK) Code() int { + return 200 +} + +func (o *PostAPIV2FactsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/facts][%d] postApiV2FactsOK %s", 200, payload) +} + +func (o *PostAPIV2FactsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/facts][%d] postApiV2FactsOK %s", 200, payload) +} + +func (o *PostAPIV2FactsOK) GetPayload() *models.Fact { + return o.Payload +} + +func (o *PostAPIV2FactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Fact) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/health/get_api_v2_health_parameters.go b/pkg/core/capability/caldera/api/client/health/get_api_v2_health_parameters.go new file mode 100644 index 00000000..10d0c666 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/health/get_api_v2_health_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewGetAPIV2HealthParams creates a new GetAPIV2HealthParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2HealthParams() *GetAPIV2HealthParams { + return &GetAPIV2HealthParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2HealthParamsWithTimeout creates a new GetAPIV2HealthParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2HealthParamsWithTimeout(timeout time.Duration) *GetAPIV2HealthParams { + return &GetAPIV2HealthParams{ + timeout: timeout, + } +} + +// NewGetAPIV2HealthParamsWithContext creates a new GetAPIV2HealthParams object +// with the ability to set a context for a request. +func NewGetAPIV2HealthParamsWithContext(ctx context.Context) *GetAPIV2HealthParams { + return &GetAPIV2HealthParams{ + Context: ctx, + } +} + +// NewGetAPIV2HealthParamsWithHTTPClient creates a new GetAPIV2HealthParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2HealthParamsWithHTTPClient(client *http.Client) *GetAPIV2HealthParams { + return &GetAPIV2HealthParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2HealthParams contains all the parameters to send to the API endpoint + + for the get API v2 health operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2HealthParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 health params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2HealthParams) WithDefaults() *GetAPIV2HealthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 health params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2HealthParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 health params +func (o *GetAPIV2HealthParams) WithTimeout(timeout time.Duration) *GetAPIV2HealthParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 health params +func (o *GetAPIV2HealthParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 health params +func (o *GetAPIV2HealthParams) WithContext(ctx context.Context) *GetAPIV2HealthParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 health params +func (o *GetAPIV2HealthParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 health params +func (o *GetAPIV2HealthParams) WithHTTPClient(client *http.Client) *GetAPIV2HealthParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 health params +func (o *GetAPIV2HealthParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2HealthParams) 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/core/capability/caldera/api/client/health/get_api_v2_health_responses.go b/pkg/core/capability/caldera/api/client/health/get_api_v2_health_responses.go new file mode 100644 index 00000000..248c5355 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/health/get_api_v2_health_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2HealthReader is a Reader for the GetAPIV2Health structure. +type GetAPIV2HealthReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2HealthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2HealthOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/health] GetAPIV2Health", response, response.Code()) + } +} + +// NewGetAPIV2HealthOK creates a GetAPIV2HealthOK with default headers values +func NewGetAPIV2HealthOK() *GetAPIV2HealthOK { + return &GetAPIV2HealthOK{} +} + +/* +GetAPIV2HealthOK describes a response with status code 200, with default header values. + +Includes all loaded plugins and system components. +*/ +type GetAPIV2HealthOK struct { + Payload *models.CalderaInfo +} + +// IsSuccess returns true when this get Api v2 health o k response has a 2xx status code +func (o *GetAPIV2HealthOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 health o k response has a 3xx status code +func (o *GetAPIV2HealthOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 health o k response has a 4xx status code +func (o *GetAPIV2HealthOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 health o k response has a 5xx status code +func (o *GetAPIV2HealthOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 health o k response a status code equal to that given +func (o *GetAPIV2HealthOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 health o k response +func (o *GetAPIV2HealthOK) Code() int { + return 200 +} + +func (o *GetAPIV2HealthOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/health][%d] getApiV2HealthOK %s", 200, payload) +} + +func (o *GetAPIV2HealthOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/health][%d] getApiV2HealthOK %s", 200, payload) +} + +func (o *GetAPIV2HealthOK) GetPayload() *models.CalderaInfo { + return o.Payload +} + +func (o *GetAPIV2HealthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CalderaInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/health/head_api_v2_health_parameters.go b/pkg/core/capability/caldera/api/client/health/head_api_v2_health_parameters.go new file mode 100644 index 00000000..a33cd48d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/health/head_api_v2_health_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewHeadAPIV2HealthParams creates a new HeadAPIV2HealthParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2HealthParams() *HeadAPIV2HealthParams { + return &HeadAPIV2HealthParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2HealthParamsWithTimeout creates a new HeadAPIV2HealthParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2HealthParamsWithTimeout(timeout time.Duration) *HeadAPIV2HealthParams { + return &HeadAPIV2HealthParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2HealthParamsWithContext creates a new HeadAPIV2HealthParams object +// with the ability to set a context for a request. +func NewHeadAPIV2HealthParamsWithContext(ctx context.Context) *HeadAPIV2HealthParams { + return &HeadAPIV2HealthParams{ + Context: ctx, + } +} + +// NewHeadAPIV2HealthParamsWithHTTPClient creates a new HeadAPIV2HealthParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2HealthParamsWithHTTPClient(client *http.Client) *HeadAPIV2HealthParams { + return &HeadAPIV2HealthParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2HealthParams contains all the parameters to send to the API endpoint + + for the head API v2 health operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2HealthParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 health params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2HealthParams) WithDefaults() *HeadAPIV2HealthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 health params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2HealthParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 health params +func (o *HeadAPIV2HealthParams) WithTimeout(timeout time.Duration) *HeadAPIV2HealthParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 health params +func (o *HeadAPIV2HealthParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 health params +func (o *HeadAPIV2HealthParams) WithContext(ctx context.Context) *HeadAPIV2HealthParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 health params +func (o *HeadAPIV2HealthParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 health params +func (o *HeadAPIV2HealthParams) WithHTTPClient(client *http.Client) *HeadAPIV2HealthParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 health params +func (o *HeadAPIV2HealthParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2HealthParams) 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/core/capability/caldera/api/client/health/head_api_v2_health_responses.go b/pkg/core/capability/caldera/api/client/health/head_api_v2_health_responses.go new file mode 100644 index 00000000..ed286caf --- /dev/null +++ b/pkg/core/capability/caldera/api/client/health/head_api_v2_health_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2HealthReader is a Reader for the HeadAPIV2Health structure. +type HeadAPIV2HealthReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2HealthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2HealthOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/health] HeadAPIV2Health", response, response.Code()) + } +} + +// NewHeadAPIV2HealthOK creates a HeadAPIV2HealthOK with default headers values +func NewHeadAPIV2HealthOK() *HeadAPIV2HealthOK { + return &HeadAPIV2HealthOK{} +} + +/* +HeadAPIV2HealthOK describes a response with status code 200, with default header values. + +Includes all loaded plugins and system components. +*/ +type HeadAPIV2HealthOK struct { + Payload *models.CalderaInfo +} + +// IsSuccess returns true when this head Api v2 health o k response has a 2xx status code +func (o *HeadAPIV2HealthOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 health o k response has a 3xx status code +func (o *HeadAPIV2HealthOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 health o k response has a 4xx status code +func (o *HeadAPIV2HealthOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 health o k response has a 5xx status code +func (o *HeadAPIV2HealthOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 health o k response a status code equal to that given +func (o *HeadAPIV2HealthOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 health o k response +func (o *HeadAPIV2HealthOK) Code() int { + return 200 +} + +func (o *HeadAPIV2HealthOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/health][%d] headApiV2HealthOK %s", 200, payload) +} + +func (o *HeadAPIV2HealthOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/health][%d] headApiV2HealthOK %s", 200, payload) +} + +func (o *HeadAPIV2HealthOK) GetPayload() *models.CalderaInfo { + return o.Payload +} + +func (o *HeadAPIV2HealthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CalderaInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/health/health_client.go b/pkg/core/capability/caldera/api/client/health/health_client.go new file mode 100644 index 00000000..eb2fa34a --- /dev/null +++ b/pkg/core/capability/caldera/api/client/health/health_client.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new health API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new health API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new health API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for health API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIV2Health(params *GetAPIV2HealthParams, opts ...ClientOption) (*GetAPIV2HealthOK, error) + + HeadAPIV2Health(params *HeadAPIV2HealthParams, opts ...ClientOption) (*HeadAPIV2HealthOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIV2Health healths endpoints returns the status of caldera + +Returns the status of Caldera and additional details including versions of system components +*/ +func (a *Client) GetAPIV2Health(params *GetAPIV2HealthParams, opts ...ClientOption) (*GetAPIV2HealthOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2HealthParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Health", + Method: "GET", + PathPattern: "/api/v2/health", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2HealthReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2HealthOK) + 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 GetAPIV2Health: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Health healths endpoints returns the status of caldera + +Returns the status of Caldera and additional details including versions of system components +*/ +func (a *Client) HeadAPIV2Health(params *HeadAPIV2HealthParams, opts ...ClientOption) (*HeadAPIV2HealthOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2HealthParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Health", + Method: "HEAD", + PathPattern: "/api/v2/health", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2HealthReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2HealthOK) + 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 HeadAPIV2Health: 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/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_name_parameters.go b/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_name_parameters.go new file mode 100644 index 00000000..308de5c5 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_name_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" +) + +// NewGetAPIV2ObfuscatorsNameParams creates a new GetAPIV2ObfuscatorsNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2ObfuscatorsNameParams() *GetAPIV2ObfuscatorsNameParams { + return &GetAPIV2ObfuscatorsNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2ObfuscatorsNameParamsWithTimeout creates a new GetAPIV2ObfuscatorsNameParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2ObfuscatorsNameParamsWithTimeout(timeout time.Duration) *GetAPIV2ObfuscatorsNameParams { + return &GetAPIV2ObfuscatorsNameParams{ + timeout: timeout, + } +} + +// NewGetAPIV2ObfuscatorsNameParamsWithContext creates a new GetAPIV2ObfuscatorsNameParams object +// with the ability to set a context for a request. +func NewGetAPIV2ObfuscatorsNameParamsWithContext(ctx context.Context) *GetAPIV2ObfuscatorsNameParams { + return &GetAPIV2ObfuscatorsNameParams{ + Context: ctx, + } +} + +// NewGetAPIV2ObfuscatorsNameParamsWithHTTPClient creates a new GetAPIV2ObfuscatorsNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2ObfuscatorsNameParamsWithHTTPClient(client *http.Client) *GetAPIV2ObfuscatorsNameParams { + return &GetAPIV2ObfuscatorsNameParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2ObfuscatorsNameParams contains all the parameters to send to the API endpoint + + for the get API v2 obfuscators name operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2ObfuscatorsNameParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + /* Name. + + Name of the Obfuscator + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 obfuscators name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ObfuscatorsNameParams) WithDefaults() *GetAPIV2ObfuscatorsNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 obfuscators name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ObfuscatorsNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) WithTimeout(timeout time.Duration) *GetAPIV2ObfuscatorsNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) WithContext(ctx context.Context) *GetAPIV2ObfuscatorsNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) WithHTTPClient(client *http.Client) *GetAPIV2ObfuscatorsNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) WithExclude(exclude []string) *GetAPIV2ObfuscatorsNameParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) WithInclude(include []string) *GetAPIV2ObfuscatorsNameParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) SetInclude(include []string) { + o.Include = include +} + +// WithName adds the name to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) WithName(name string) *GetAPIV2ObfuscatorsNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the get API v2 obfuscators name params +func (o *GetAPIV2ObfuscatorsNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2ObfuscatorsNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2ObfuscatorsName binds the parameter exclude +func (o *GetAPIV2ObfuscatorsNameParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2ObfuscatorsName binds the parameter include +func (o *GetAPIV2ObfuscatorsNameParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_name_responses.go b/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_name_responses.go new file mode 100644 index 00000000..c40a1a7b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_name_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2ObfuscatorsNameReader is a Reader for the GetAPIV2ObfuscatorsName structure. +type GetAPIV2ObfuscatorsNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2ObfuscatorsNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2ObfuscatorsNameOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/obfuscators/{name}] GetAPIV2ObfuscatorsName", response, response.Code()) + } +} + +// NewGetAPIV2ObfuscatorsNameOK creates a GetAPIV2ObfuscatorsNameOK with default headers values +func NewGetAPIV2ObfuscatorsNameOK() *GetAPIV2ObfuscatorsNameOK { + return &GetAPIV2ObfuscatorsNameOK{} +} + +/* +GetAPIV2ObfuscatorsNameOK describes a response with status code 200, with default header values. + +Returns the specified obfuscator in ObfuscatorSchema format. +*/ +type GetAPIV2ObfuscatorsNameOK struct { + Payload *models.PartialObfuscator +} + +// IsSuccess returns true when this get Api v2 obfuscators name o k response has a 2xx status code +func (o *GetAPIV2ObfuscatorsNameOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 obfuscators name o k response has a 3xx status code +func (o *GetAPIV2ObfuscatorsNameOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 obfuscators name o k response has a 4xx status code +func (o *GetAPIV2ObfuscatorsNameOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 obfuscators name o k response has a 5xx status code +func (o *GetAPIV2ObfuscatorsNameOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 obfuscators name o k response a status code equal to that given +func (o *GetAPIV2ObfuscatorsNameOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 obfuscators name o k response +func (o *GetAPIV2ObfuscatorsNameOK) Code() int { + return 200 +} + +func (o *GetAPIV2ObfuscatorsNameOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/obfuscators/{name}][%d] getApiV2ObfuscatorsNameOK %s", 200, payload) +} + +func (o *GetAPIV2ObfuscatorsNameOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/obfuscators/{name}][%d] getApiV2ObfuscatorsNameOK %s", 200, payload) +} + +func (o *GetAPIV2ObfuscatorsNameOK) GetPayload() *models.PartialObfuscator { + return o.Payload +} + +func (o *GetAPIV2ObfuscatorsNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialObfuscator) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_parameters.go b/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_parameters.go new file mode 100644 index 00000000..d4406162 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" +) + +// NewGetAPIV2ObfuscatorsParams creates a new GetAPIV2ObfuscatorsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2ObfuscatorsParams() *GetAPIV2ObfuscatorsParams { + return &GetAPIV2ObfuscatorsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2ObfuscatorsParamsWithTimeout creates a new GetAPIV2ObfuscatorsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2ObfuscatorsParamsWithTimeout(timeout time.Duration) *GetAPIV2ObfuscatorsParams { + return &GetAPIV2ObfuscatorsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2ObfuscatorsParamsWithContext creates a new GetAPIV2ObfuscatorsParams object +// with the ability to set a context for a request. +func NewGetAPIV2ObfuscatorsParamsWithContext(ctx context.Context) *GetAPIV2ObfuscatorsParams { + return &GetAPIV2ObfuscatorsParams{ + Context: ctx, + } +} + +// NewGetAPIV2ObfuscatorsParamsWithHTTPClient creates a new GetAPIV2ObfuscatorsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2ObfuscatorsParamsWithHTTPClient(client *http.Client) *GetAPIV2ObfuscatorsParams { + return &GetAPIV2ObfuscatorsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2ObfuscatorsParams contains all the parameters to send to the API endpoint + + for the get API v2 obfuscators operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2ObfuscatorsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 obfuscators params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ObfuscatorsParams) WithDefaults() *GetAPIV2ObfuscatorsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 obfuscators params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ObfuscatorsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) WithTimeout(timeout time.Duration) *GetAPIV2ObfuscatorsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) WithContext(ctx context.Context) *GetAPIV2ObfuscatorsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) WithHTTPClient(client *http.Client) *GetAPIV2ObfuscatorsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) WithExclude(exclude []string) *GetAPIV2ObfuscatorsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) WithInclude(include []string) *GetAPIV2ObfuscatorsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) WithSort(sort *string) *GetAPIV2ObfuscatorsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 obfuscators params +func (o *GetAPIV2ObfuscatorsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2ObfuscatorsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Obfuscators binds the parameter exclude +func (o *GetAPIV2ObfuscatorsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Obfuscators binds the parameter include +func (o *GetAPIV2ObfuscatorsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_responses.go b/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_responses.go new file mode 100644 index 00000000..23bc03c9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/get_api_v2_obfuscators_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2ObfuscatorsReader is a Reader for the GetAPIV2Obfuscators structure. +type GetAPIV2ObfuscatorsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2ObfuscatorsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2ObfuscatorsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/obfuscators] GetAPIV2Obfuscators", response, response.Code()) + } +} + +// NewGetAPIV2ObfuscatorsOK creates a GetAPIV2ObfuscatorsOK with default headers values +func NewGetAPIV2ObfuscatorsOK() *GetAPIV2ObfuscatorsOK { + return &GetAPIV2ObfuscatorsOK{} +} + +/* +GetAPIV2ObfuscatorsOK describes a response with status code 200, with default header values. + +Returns a list of all obfuscators in ObfuscatorSchema format. +*/ +type GetAPIV2ObfuscatorsOK struct { + Payload []*models.PartialObfuscator +} + +// IsSuccess returns true when this get Api v2 obfuscators o k response has a 2xx status code +func (o *GetAPIV2ObfuscatorsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 obfuscators o k response has a 3xx status code +func (o *GetAPIV2ObfuscatorsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 obfuscators o k response has a 4xx status code +func (o *GetAPIV2ObfuscatorsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 obfuscators o k response has a 5xx status code +func (o *GetAPIV2ObfuscatorsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 obfuscators o k response a status code equal to that given +func (o *GetAPIV2ObfuscatorsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 obfuscators o k response +func (o *GetAPIV2ObfuscatorsOK) Code() int { + return 200 +} + +func (o *GetAPIV2ObfuscatorsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/obfuscators][%d] getApiV2ObfuscatorsOK %s", 200, payload) +} + +func (o *GetAPIV2ObfuscatorsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/obfuscators][%d] getApiV2ObfuscatorsOK %s", 200, payload) +} + +func (o *GetAPIV2ObfuscatorsOK) GetPayload() []*models.PartialObfuscator { + return o.Payload +} + +func (o *GetAPIV2ObfuscatorsOK) 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/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_name_parameters.go b/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_name_parameters.go new file mode 100644 index 00000000..ff36d5b1 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_name_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" +) + +// NewHeadAPIV2ObfuscatorsNameParams creates a new HeadAPIV2ObfuscatorsNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2ObfuscatorsNameParams() *HeadAPIV2ObfuscatorsNameParams { + return &HeadAPIV2ObfuscatorsNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2ObfuscatorsNameParamsWithTimeout creates a new HeadAPIV2ObfuscatorsNameParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2ObfuscatorsNameParamsWithTimeout(timeout time.Duration) *HeadAPIV2ObfuscatorsNameParams { + return &HeadAPIV2ObfuscatorsNameParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2ObfuscatorsNameParamsWithContext creates a new HeadAPIV2ObfuscatorsNameParams object +// with the ability to set a context for a request. +func NewHeadAPIV2ObfuscatorsNameParamsWithContext(ctx context.Context) *HeadAPIV2ObfuscatorsNameParams { + return &HeadAPIV2ObfuscatorsNameParams{ + Context: ctx, + } +} + +// NewHeadAPIV2ObfuscatorsNameParamsWithHTTPClient creates a new HeadAPIV2ObfuscatorsNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2ObfuscatorsNameParamsWithHTTPClient(client *http.Client) *HeadAPIV2ObfuscatorsNameParams { + return &HeadAPIV2ObfuscatorsNameParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2ObfuscatorsNameParams contains all the parameters to send to the API endpoint + + for the head API v2 obfuscators name operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2ObfuscatorsNameParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + /* Name. + + Name of the Obfuscator + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 obfuscators name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ObfuscatorsNameParams) WithDefaults() *HeadAPIV2ObfuscatorsNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 obfuscators name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ObfuscatorsNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) WithTimeout(timeout time.Duration) *HeadAPIV2ObfuscatorsNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) WithContext(ctx context.Context) *HeadAPIV2ObfuscatorsNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) WithHTTPClient(client *http.Client) *HeadAPIV2ObfuscatorsNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) WithExclude(exclude []string) *HeadAPIV2ObfuscatorsNameParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) WithInclude(include []string) *HeadAPIV2ObfuscatorsNameParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) SetInclude(include []string) { + o.Include = include +} + +// WithName adds the name to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) WithName(name string) *HeadAPIV2ObfuscatorsNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the head API v2 obfuscators name params +func (o *HeadAPIV2ObfuscatorsNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2ObfuscatorsNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2ObfuscatorsName binds the parameter exclude +func (o *HeadAPIV2ObfuscatorsNameParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2ObfuscatorsName binds the parameter include +func (o *HeadAPIV2ObfuscatorsNameParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_name_responses.go b/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_name_responses.go new file mode 100644 index 00000000..0886aa58 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_name_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2ObfuscatorsNameReader is a Reader for the HeadAPIV2ObfuscatorsName structure. +type HeadAPIV2ObfuscatorsNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2ObfuscatorsNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2ObfuscatorsNameOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/obfuscators/{name}] HeadAPIV2ObfuscatorsName", response, response.Code()) + } +} + +// NewHeadAPIV2ObfuscatorsNameOK creates a HeadAPIV2ObfuscatorsNameOK with default headers values +func NewHeadAPIV2ObfuscatorsNameOK() *HeadAPIV2ObfuscatorsNameOK { + return &HeadAPIV2ObfuscatorsNameOK{} +} + +/* +HeadAPIV2ObfuscatorsNameOK describes a response with status code 200, with default header values. + +Returns the specified obfuscator in ObfuscatorSchema format. +*/ +type HeadAPIV2ObfuscatorsNameOK struct { + Payload *models.PartialObfuscator +} + +// IsSuccess returns true when this head Api v2 obfuscators name o k response has a 2xx status code +func (o *HeadAPIV2ObfuscatorsNameOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 obfuscators name o k response has a 3xx status code +func (o *HeadAPIV2ObfuscatorsNameOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 obfuscators name o k response has a 4xx status code +func (o *HeadAPIV2ObfuscatorsNameOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 obfuscators name o k response has a 5xx status code +func (o *HeadAPIV2ObfuscatorsNameOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 obfuscators name o k response a status code equal to that given +func (o *HeadAPIV2ObfuscatorsNameOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 obfuscators name o k response +func (o *HeadAPIV2ObfuscatorsNameOK) Code() int { + return 200 +} + +func (o *HeadAPIV2ObfuscatorsNameOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/obfuscators/{name}][%d] headApiV2ObfuscatorsNameOK %s", 200, payload) +} + +func (o *HeadAPIV2ObfuscatorsNameOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/obfuscators/{name}][%d] headApiV2ObfuscatorsNameOK %s", 200, payload) +} + +func (o *HeadAPIV2ObfuscatorsNameOK) GetPayload() *models.PartialObfuscator { + return o.Payload +} + +func (o *HeadAPIV2ObfuscatorsNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialObfuscator) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_parameters.go b/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_parameters.go new file mode 100644 index 00000000..a5b4a290 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" +) + +// NewHeadAPIV2ObfuscatorsParams creates a new HeadAPIV2ObfuscatorsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2ObfuscatorsParams() *HeadAPIV2ObfuscatorsParams { + return &HeadAPIV2ObfuscatorsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2ObfuscatorsParamsWithTimeout creates a new HeadAPIV2ObfuscatorsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2ObfuscatorsParamsWithTimeout(timeout time.Duration) *HeadAPIV2ObfuscatorsParams { + return &HeadAPIV2ObfuscatorsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2ObfuscatorsParamsWithContext creates a new HeadAPIV2ObfuscatorsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2ObfuscatorsParamsWithContext(ctx context.Context) *HeadAPIV2ObfuscatorsParams { + return &HeadAPIV2ObfuscatorsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2ObfuscatorsParamsWithHTTPClient creates a new HeadAPIV2ObfuscatorsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2ObfuscatorsParamsWithHTTPClient(client *http.Client) *HeadAPIV2ObfuscatorsParams { + return &HeadAPIV2ObfuscatorsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2ObfuscatorsParams contains all the parameters to send to the API endpoint + + for the head API v2 obfuscators operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2ObfuscatorsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 obfuscators params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ObfuscatorsParams) WithDefaults() *HeadAPIV2ObfuscatorsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 obfuscators params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ObfuscatorsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) WithTimeout(timeout time.Duration) *HeadAPIV2ObfuscatorsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) WithContext(ctx context.Context) *HeadAPIV2ObfuscatorsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) WithHTTPClient(client *http.Client) *HeadAPIV2ObfuscatorsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) WithExclude(exclude []string) *HeadAPIV2ObfuscatorsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) WithInclude(include []string) *HeadAPIV2ObfuscatorsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) WithSort(sort *string) *HeadAPIV2ObfuscatorsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 obfuscators params +func (o *HeadAPIV2ObfuscatorsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2ObfuscatorsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Obfuscators binds the parameter exclude +func (o *HeadAPIV2ObfuscatorsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Obfuscators binds the parameter include +func (o *HeadAPIV2ObfuscatorsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_responses.go b/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_responses.go new file mode 100644 index 00000000..c99942a0 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/head_api_v2_obfuscators_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2ObfuscatorsReader is a Reader for the HeadAPIV2Obfuscators structure. +type HeadAPIV2ObfuscatorsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2ObfuscatorsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2ObfuscatorsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/obfuscators] HeadAPIV2Obfuscators", response, response.Code()) + } +} + +// NewHeadAPIV2ObfuscatorsOK creates a HeadAPIV2ObfuscatorsOK with default headers values +func NewHeadAPIV2ObfuscatorsOK() *HeadAPIV2ObfuscatorsOK { + return &HeadAPIV2ObfuscatorsOK{} +} + +/* +HeadAPIV2ObfuscatorsOK describes a response with status code 200, with default header values. + +Returns a list of all obfuscators in ObfuscatorSchema format. +*/ +type HeadAPIV2ObfuscatorsOK struct { + Payload []*models.PartialObfuscator +} + +// IsSuccess returns true when this head Api v2 obfuscators o k response has a 2xx status code +func (o *HeadAPIV2ObfuscatorsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 obfuscators o k response has a 3xx status code +func (o *HeadAPIV2ObfuscatorsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 obfuscators o k response has a 4xx status code +func (o *HeadAPIV2ObfuscatorsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 obfuscators o k response has a 5xx status code +func (o *HeadAPIV2ObfuscatorsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 obfuscators o k response a status code equal to that given +func (o *HeadAPIV2ObfuscatorsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 obfuscators o k response +func (o *HeadAPIV2ObfuscatorsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2ObfuscatorsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/obfuscators][%d] headApiV2ObfuscatorsOK %s", 200, payload) +} + +func (o *HeadAPIV2ObfuscatorsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/obfuscators][%d] headApiV2ObfuscatorsOK %s", 200, payload) +} + +func (o *HeadAPIV2ObfuscatorsOK) GetPayload() []*models.PartialObfuscator { + return o.Payload +} + +func (o *HeadAPIV2ObfuscatorsOK) 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/core/capability/caldera/api/client/obfuscators/obfuscators_client.go b/pkg/core/capability/caldera/api/client/obfuscators/obfuscators_client.go new file mode 100644 index 00000000..4e52926b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/obfuscators/obfuscators_client.go @@ -0,0 +1,233 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package obfuscators + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new obfuscators API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new obfuscators API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new obfuscators API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for obfuscators API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIV2Obfuscators(params *GetAPIV2ObfuscatorsParams, opts ...ClientOption) (*GetAPIV2ObfuscatorsOK, error) + + GetAPIV2ObfuscatorsName(params *GetAPIV2ObfuscatorsNameParams, opts ...ClientOption) (*GetAPIV2ObfuscatorsNameOK, error) + + HeadAPIV2Obfuscators(params *HeadAPIV2ObfuscatorsParams, opts ...ClientOption) (*HeadAPIV2ObfuscatorsOK, error) + + HeadAPIV2ObfuscatorsName(params *HeadAPIV2ObfuscatorsNameParams, opts ...ClientOption) (*HeadAPIV2ObfuscatorsNameOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIV2Obfuscators retrieves obfuscators + +Retrieves all stored obfuscators. +*/ +func (a *Client) GetAPIV2Obfuscators(params *GetAPIV2ObfuscatorsParams, opts ...ClientOption) (*GetAPIV2ObfuscatorsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2ObfuscatorsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Obfuscators", + Method: "GET", + PathPattern: "/api/v2/obfuscators", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2ObfuscatorsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2ObfuscatorsOK) + 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 GetAPIV2Obfuscators: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2ObfuscatorsName retrieves an obfuscator by name + +Retrieve an obfuscator by name, as specified by {name} in the request url. +*/ +func (a *Client) GetAPIV2ObfuscatorsName(params *GetAPIV2ObfuscatorsNameParams, opts ...ClientOption) (*GetAPIV2ObfuscatorsNameOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2ObfuscatorsNameParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2ObfuscatorsName", + Method: "GET", + PathPattern: "/api/v2/obfuscators/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2ObfuscatorsNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2ObfuscatorsNameOK) + 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 GetAPIV2ObfuscatorsName: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Obfuscators retrieves obfuscators + +Retrieves all stored obfuscators. +*/ +func (a *Client) HeadAPIV2Obfuscators(params *HeadAPIV2ObfuscatorsParams, opts ...ClientOption) (*HeadAPIV2ObfuscatorsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2ObfuscatorsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Obfuscators", + Method: "HEAD", + PathPattern: "/api/v2/obfuscators", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2ObfuscatorsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2ObfuscatorsOK) + 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 HeadAPIV2Obfuscators: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2ObfuscatorsName retrieves an obfuscator by name + +Retrieve an obfuscator by name, as specified by {name} in the request url. +*/ +func (a *Client) HeadAPIV2ObfuscatorsName(params *HeadAPIV2ObfuscatorsNameParams, opts ...ClientOption) (*HeadAPIV2ObfuscatorsNameOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2ObfuscatorsNameParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2ObfuscatorsName", + Method: "HEAD", + PathPattern: "/api/v2/obfuscators/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2ObfuscatorsNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2ObfuscatorsNameOK) + 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 HeadAPIV2ObfuscatorsName: 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/core/capability/caldera/api/client/objectives/get_api_v2_objectives_id_parameters.go b/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_id_parameters.go new file mode 100644 index 00000000..ef99601d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" +) + +// NewGetAPIV2ObjectivesIDParams creates a new GetAPIV2ObjectivesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2ObjectivesIDParams() *GetAPIV2ObjectivesIDParams { + return &GetAPIV2ObjectivesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2ObjectivesIDParamsWithTimeout creates a new GetAPIV2ObjectivesIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2ObjectivesIDParamsWithTimeout(timeout time.Duration) *GetAPIV2ObjectivesIDParams { + return &GetAPIV2ObjectivesIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2ObjectivesIDParamsWithContext creates a new GetAPIV2ObjectivesIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2ObjectivesIDParamsWithContext(ctx context.Context) *GetAPIV2ObjectivesIDParams { + return &GetAPIV2ObjectivesIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2ObjectivesIDParamsWithHTTPClient creates a new GetAPIV2ObjectivesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2ObjectivesIDParamsWithHTTPClient(client *http.Client) *GetAPIV2ObjectivesIDParams { + return &GetAPIV2ObjectivesIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2ObjectivesIDParams contains all the parameters to send to the API endpoint + + for the get API v2 objectives ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2ObjectivesIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the objective to be retrieved + */ + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 objectives ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ObjectivesIDParams) WithDefaults() *GetAPIV2ObjectivesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 objectives ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ObjectivesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) WithTimeout(timeout time.Duration) *GetAPIV2ObjectivesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) WithContext(ctx context.Context) *GetAPIV2ObjectivesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) WithHTTPClient(client *http.Client) *GetAPIV2ObjectivesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) WithExclude(exclude []string) *GetAPIV2ObjectivesIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) WithID(id string) *GetAPIV2ObjectivesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) WithInclude(include []string) *GetAPIV2ObjectivesIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 objectives ID params +func (o *GetAPIV2ObjectivesIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2ObjectivesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2ObjectivesID binds the parameter exclude +func (o *GetAPIV2ObjectivesIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2ObjectivesID binds the parameter include +func (o *GetAPIV2ObjectivesIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_id_responses.go b/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_id_responses.go new file mode 100644 index 00000000..ecaf8fa2 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2ObjectivesIDReader is a Reader for the GetAPIV2ObjectivesID structure. +type GetAPIV2ObjectivesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2ObjectivesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2ObjectivesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/objectives/{id}] GetAPIV2ObjectivesID", response, response.Code()) + } +} + +// NewGetAPIV2ObjectivesIDOK creates a GetAPIV2ObjectivesIDOK with default headers values +func NewGetAPIV2ObjectivesIDOK() *GetAPIV2ObjectivesIDOK { + return &GetAPIV2ObjectivesIDOK{} +} + +/* +GetAPIV2ObjectivesIDOK describes a response with status code 200, with default header values. + +Returns single objective in ObjectiveSchema format. +*/ +type GetAPIV2ObjectivesIDOK struct { + Payload *models.PartialObjective +} + +// IsSuccess returns true when this get Api v2 objectives Id o k response has a 2xx status code +func (o *GetAPIV2ObjectivesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 objectives Id o k response has a 3xx status code +func (o *GetAPIV2ObjectivesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 objectives Id o k response has a 4xx status code +func (o *GetAPIV2ObjectivesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 objectives Id o k response has a 5xx status code +func (o *GetAPIV2ObjectivesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 objectives Id o k response a status code equal to that given +func (o *GetAPIV2ObjectivesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 objectives Id o k response +func (o *GetAPIV2ObjectivesIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2ObjectivesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/objectives/{id}][%d] getApiV2ObjectivesIdOK %s", 200, payload) +} + +func (o *GetAPIV2ObjectivesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/objectives/{id}][%d] getApiV2ObjectivesIdOK %s", 200, payload) +} + +func (o *GetAPIV2ObjectivesIDOK) GetPayload() *models.PartialObjective { + return o.Payload +} + +func (o *GetAPIV2ObjectivesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialObjective) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_parameters.go b/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_parameters.go new file mode 100644 index 00000000..4791a1f7 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" +) + +// NewGetAPIV2ObjectivesParams creates a new GetAPIV2ObjectivesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2ObjectivesParams() *GetAPIV2ObjectivesParams { + return &GetAPIV2ObjectivesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2ObjectivesParamsWithTimeout creates a new GetAPIV2ObjectivesParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2ObjectivesParamsWithTimeout(timeout time.Duration) *GetAPIV2ObjectivesParams { + return &GetAPIV2ObjectivesParams{ + timeout: timeout, + } +} + +// NewGetAPIV2ObjectivesParamsWithContext creates a new GetAPIV2ObjectivesParams object +// with the ability to set a context for a request. +func NewGetAPIV2ObjectivesParamsWithContext(ctx context.Context) *GetAPIV2ObjectivesParams { + return &GetAPIV2ObjectivesParams{ + Context: ctx, + } +} + +// NewGetAPIV2ObjectivesParamsWithHTTPClient creates a new GetAPIV2ObjectivesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2ObjectivesParamsWithHTTPClient(client *http.Client) *GetAPIV2ObjectivesParams { + return &GetAPIV2ObjectivesParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2ObjectivesParams contains all the parameters to send to the API endpoint + + for the get API v2 objectives operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2ObjectivesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 objectives params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ObjectivesParams) WithDefaults() *GetAPIV2ObjectivesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 objectives params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2ObjectivesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) WithTimeout(timeout time.Duration) *GetAPIV2ObjectivesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) WithContext(ctx context.Context) *GetAPIV2ObjectivesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) WithHTTPClient(client *http.Client) *GetAPIV2ObjectivesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) WithExclude(exclude []string) *GetAPIV2ObjectivesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) WithInclude(include []string) *GetAPIV2ObjectivesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) WithSort(sort *string) *GetAPIV2ObjectivesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 objectives params +func (o *GetAPIV2ObjectivesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2ObjectivesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Objectives binds the parameter exclude +func (o *GetAPIV2ObjectivesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Objectives binds the parameter include +func (o *GetAPIV2ObjectivesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_responses.go b/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_responses.go new file mode 100644 index 00000000..a1d2bb88 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/get_api_v2_objectives_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2ObjectivesReader is a Reader for the GetAPIV2Objectives structure. +type GetAPIV2ObjectivesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2ObjectivesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2ObjectivesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/objectives] GetAPIV2Objectives", response, response.Code()) + } +} + +// NewGetAPIV2ObjectivesOK creates a GetAPIV2ObjectivesOK with default headers values +func NewGetAPIV2ObjectivesOK() *GetAPIV2ObjectivesOK { + return &GetAPIV2ObjectivesOK{} +} + +/* +GetAPIV2ObjectivesOK describes a response with status code 200, with default header values. + +A list of all objectives dumped in ObjectiveSchema format. +*/ +type GetAPIV2ObjectivesOK struct { + Payload []*models.PartialObjective +} + +// IsSuccess returns true when this get Api v2 objectives o k response has a 2xx status code +func (o *GetAPIV2ObjectivesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 objectives o k response has a 3xx status code +func (o *GetAPIV2ObjectivesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 objectives o k response has a 4xx status code +func (o *GetAPIV2ObjectivesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 objectives o k response has a 5xx status code +func (o *GetAPIV2ObjectivesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 objectives o k response a status code equal to that given +func (o *GetAPIV2ObjectivesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 objectives o k response +func (o *GetAPIV2ObjectivesOK) Code() int { + return 200 +} + +func (o *GetAPIV2ObjectivesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/objectives][%d] getApiV2ObjectivesOK %s", 200, payload) +} + +func (o *GetAPIV2ObjectivesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/objectives][%d] getApiV2ObjectivesOK %s", 200, payload) +} + +func (o *GetAPIV2ObjectivesOK) GetPayload() []*models.PartialObjective { + return o.Payload +} + +func (o *GetAPIV2ObjectivesOK) 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/core/capability/caldera/api/client/objectives/head_api_v2_objectives_id_parameters.go b/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_id_parameters.go new file mode 100644 index 00000000..ebee01fd --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" +) + +// NewHeadAPIV2ObjectivesIDParams creates a new HeadAPIV2ObjectivesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2ObjectivesIDParams() *HeadAPIV2ObjectivesIDParams { + return &HeadAPIV2ObjectivesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2ObjectivesIDParamsWithTimeout creates a new HeadAPIV2ObjectivesIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2ObjectivesIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2ObjectivesIDParams { + return &HeadAPIV2ObjectivesIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2ObjectivesIDParamsWithContext creates a new HeadAPIV2ObjectivesIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2ObjectivesIDParamsWithContext(ctx context.Context) *HeadAPIV2ObjectivesIDParams { + return &HeadAPIV2ObjectivesIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2ObjectivesIDParamsWithHTTPClient creates a new HeadAPIV2ObjectivesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2ObjectivesIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2ObjectivesIDParams { + return &HeadAPIV2ObjectivesIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2ObjectivesIDParams contains all the parameters to send to the API endpoint + + for the head API v2 objectives ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2ObjectivesIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the objective to be retrieved + */ + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 objectives ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ObjectivesIDParams) WithDefaults() *HeadAPIV2ObjectivesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 objectives ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ObjectivesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2ObjectivesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) WithContext(ctx context.Context) *HeadAPIV2ObjectivesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2ObjectivesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) WithExclude(exclude []string) *HeadAPIV2ObjectivesIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) WithID(id string) *HeadAPIV2ObjectivesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) WithInclude(include []string) *HeadAPIV2ObjectivesIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 objectives ID params +func (o *HeadAPIV2ObjectivesIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2ObjectivesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2ObjectivesID binds the parameter exclude +func (o *HeadAPIV2ObjectivesIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2ObjectivesID binds the parameter include +func (o *HeadAPIV2ObjectivesIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_id_responses.go b/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_id_responses.go new file mode 100644 index 00000000..1ef02ac5 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2ObjectivesIDReader is a Reader for the HeadAPIV2ObjectivesID structure. +type HeadAPIV2ObjectivesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2ObjectivesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2ObjectivesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/objectives/{id}] HeadAPIV2ObjectivesID", response, response.Code()) + } +} + +// NewHeadAPIV2ObjectivesIDOK creates a HeadAPIV2ObjectivesIDOK with default headers values +func NewHeadAPIV2ObjectivesIDOK() *HeadAPIV2ObjectivesIDOK { + return &HeadAPIV2ObjectivesIDOK{} +} + +/* +HeadAPIV2ObjectivesIDOK describes a response with status code 200, with default header values. + +Returns single objective in ObjectiveSchema format. +*/ +type HeadAPIV2ObjectivesIDOK struct { + Payload *models.PartialObjective +} + +// IsSuccess returns true when this head Api v2 objectives Id o k response has a 2xx status code +func (o *HeadAPIV2ObjectivesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 objectives Id o k response has a 3xx status code +func (o *HeadAPIV2ObjectivesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 objectives Id o k response has a 4xx status code +func (o *HeadAPIV2ObjectivesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 objectives Id o k response has a 5xx status code +func (o *HeadAPIV2ObjectivesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 objectives Id o k response a status code equal to that given +func (o *HeadAPIV2ObjectivesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 objectives Id o k response +func (o *HeadAPIV2ObjectivesIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2ObjectivesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/objectives/{id}][%d] headApiV2ObjectivesIdOK %s", 200, payload) +} + +func (o *HeadAPIV2ObjectivesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/objectives/{id}][%d] headApiV2ObjectivesIdOK %s", 200, payload) +} + +func (o *HeadAPIV2ObjectivesIDOK) GetPayload() *models.PartialObjective { + return o.Payload +} + +func (o *HeadAPIV2ObjectivesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialObjective) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_parameters.go b/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_parameters.go new file mode 100644 index 00000000..5ce577a4 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" +) + +// NewHeadAPIV2ObjectivesParams creates a new HeadAPIV2ObjectivesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2ObjectivesParams() *HeadAPIV2ObjectivesParams { + return &HeadAPIV2ObjectivesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2ObjectivesParamsWithTimeout creates a new HeadAPIV2ObjectivesParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2ObjectivesParamsWithTimeout(timeout time.Duration) *HeadAPIV2ObjectivesParams { + return &HeadAPIV2ObjectivesParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2ObjectivesParamsWithContext creates a new HeadAPIV2ObjectivesParams object +// with the ability to set a context for a request. +func NewHeadAPIV2ObjectivesParamsWithContext(ctx context.Context) *HeadAPIV2ObjectivesParams { + return &HeadAPIV2ObjectivesParams{ + Context: ctx, + } +} + +// NewHeadAPIV2ObjectivesParamsWithHTTPClient creates a new HeadAPIV2ObjectivesParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2ObjectivesParamsWithHTTPClient(client *http.Client) *HeadAPIV2ObjectivesParams { + return &HeadAPIV2ObjectivesParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2ObjectivesParams contains all the parameters to send to the API endpoint + + for the head API v2 objectives operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2ObjectivesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 objectives params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ObjectivesParams) WithDefaults() *HeadAPIV2ObjectivesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 objectives params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2ObjectivesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) WithTimeout(timeout time.Duration) *HeadAPIV2ObjectivesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) WithContext(ctx context.Context) *HeadAPIV2ObjectivesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) WithHTTPClient(client *http.Client) *HeadAPIV2ObjectivesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) WithExclude(exclude []string) *HeadAPIV2ObjectivesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) WithInclude(include []string) *HeadAPIV2ObjectivesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) WithSort(sort *string) *HeadAPIV2ObjectivesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 objectives params +func (o *HeadAPIV2ObjectivesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2ObjectivesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Objectives binds the parameter exclude +func (o *HeadAPIV2ObjectivesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Objectives binds the parameter include +func (o *HeadAPIV2ObjectivesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_responses.go b/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_responses.go new file mode 100644 index 00000000..41b8ea3c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/head_api_v2_objectives_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2ObjectivesReader is a Reader for the HeadAPIV2Objectives structure. +type HeadAPIV2ObjectivesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2ObjectivesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2ObjectivesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/objectives] HeadAPIV2Objectives", response, response.Code()) + } +} + +// NewHeadAPIV2ObjectivesOK creates a HeadAPIV2ObjectivesOK with default headers values +func NewHeadAPIV2ObjectivesOK() *HeadAPIV2ObjectivesOK { + return &HeadAPIV2ObjectivesOK{} +} + +/* +HeadAPIV2ObjectivesOK describes a response with status code 200, with default header values. + +A list of all objectives dumped in ObjectiveSchema format. +*/ +type HeadAPIV2ObjectivesOK struct { + Payload []*models.PartialObjective +} + +// IsSuccess returns true when this head Api v2 objectives o k response has a 2xx status code +func (o *HeadAPIV2ObjectivesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 objectives o k response has a 3xx status code +func (o *HeadAPIV2ObjectivesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 objectives o k response has a 4xx status code +func (o *HeadAPIV2ObjectivesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 objectives o k response has a 5xx status code +func (o *HeadAPIV2ObjectivesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 objectives o k response a status code equal to that given +func (o *HeadAPIV2ObjectivesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 objectives o k response +func (o *HeadAPIV2ObjectivesOK) Code() int { + return 200 +} + +func (o *HeadAPIV2ObjectivesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/objectives][%d] headApiV2ObjectivesOK %s", 200, payload) +} + +func (o *HeadAPIV2ObjectivesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/objectives][%d] headApiV2ObjectivesOK %s", 200, payload) +} + +func (o *HeadAPIV2ObjectivesOK) GetPayload() []*models.PartialObjective { + return o.Payload +} + +func (o *HeadAPIV2ObjectivesOK) 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/core/capability/caldera/api/client/objectives/objectives_client.go b/pkg/core/capability/caldera/api/client/objectives/objectives_client.go new file mode 100644 index 00000000..c5e6430e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/objectives_client.go @@ -0,0 +1,359 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new objectives API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new objectives API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new objectives API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for objectives API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIV2Objectives(params *GetAPIV2ObjectivesParams, opts ...ClientOption) (*GetAPIV2ObjectivesOK, error) + + GetAPIV2ObjectivesID(params *GetAPIV2ObjectivesIDParams, opts ...ClientOption) (*GetAPIV2ObjectivesIDOK, error) + + HeadAPIV2Objectives(params *HeadAPIV2ObjectivesParams, opts ...ClientOption) (*HeadAPIV2ObjectivesOK, error) + + HeadAPIV2ObjectivesID(params *HeadAPIV2ObjectivesIDParams, opts ...ClientOption) (*HeadAPIV2ObjectivesIDOK, error) + + PatchAPIV2ObjectivesID(params *PatchAPIV2ObjectivesIDParams, opts ...ClientOption) (*PatchAPIV2ObjectivesIDOK, error) + + PostAPIV2Objectives(params *PostAPIV2ObjectivesParams, opts ...ClientOption) (*PostAPIV2ObjectivesOK, error) + + PutAPIV2ObjectivesID(params *PutAPIV2ObjectivesIDParams, opts ...ClientOption) (*PutAPIV2ObjectivesIDOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIV2Objectives retrieves objectives + +Retrieve all objectives by criteria. Use fields from the `ObjectiveSchema` in the request body to filter retrieved objectives. +*/ +func (a *Client) GetAPIV2Objectives(params *GetAPIV2ObjectivesParams, opts ...ClientOption) (*GetAPIV2ObjectivesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2ObjectivesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Objectives", + Method: "GET", + PathPattern: "/api/v2/objectives", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2ObjectivesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2ObjectivesOK) + 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 GetAPIV2Objectives: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2ObjectivesID retrieves objective by ID + +Retrieve one objective by ID. Use fields from the `ObjectiveSchema` in the request body to filter retrieved objective. +*/ +func (a *Client) GetAPIV2ObjectivesID(params *GetAPIV2ObjectivesIDParams, opts ...ClientOption) (*GetAPIV2ObjectivesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2ObjectivesIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2ObjectivesID", + Method: "GET", + PathPattern: "/api/v2/objectives/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2ObjectivesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2ObjectivesIDOK) + 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 GetAPIV2ObjectivesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Objectives retrieves objectives + +Retrieve all objectives by criteria. Use fields from the `ObjectiveSchema` in the request body to filter retrieved objectives. +*/ +func (a *Client) HeadAPIV2Objectives(params *HeadAPIV2ObjectivesParams, opts ...ClientOption) (*HeadAPIV2ObjectivesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2ObjectivesParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Objectives", + Method: "HEAD", + PathPattern: "/api/v2/objectives", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2ObjectivesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2ObjectivesOK) + 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 HeadAPIV2Objectives: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2ObjectivesID retrieves objective by ID + +Retrieve one objective by ID. Use fields from the `ObjectiveSchema` in the request body to filter retrieved objective. +*/ +func (a *Client) HeadAPIV2ObjectivesID(params *HeadAPIV2ObjectivesIDParams, opts ...ClientOption) (*HeadAPIV2ObjectivesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2ObjectivesIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2ObjectivesID", + Method: "HEAD", + PathPattern: "/api/v2/objectives/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2ObjectivesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2ObjectivesIDOK) + 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 HeadAPIV2ObjectivesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2ObjectivesID updates an objective + +Update an objective using fields from the `ObjectiveSchema` in the request body. +*/ +func (a *Client) PatchAPIV2ObjectivesID(params *PatchAPIV2ObjectivesIDParams, opts ...ClientOption) (*PatchAPIV2ObjectivesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2ObjectivesIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2ObjectivesID", + Method: "PATCH", + PathPattern: "/api/v2/objectives/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2ObjectivesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2ObjectivesIDOK) + 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 PatchAPIV2ObjectivesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Objectives creates a new objective + +Create a new objective using the format provided in the `ObjectiveSchema`. +*/ +func (a *Client) PostAPIV2Objectives(params *PostAPIV2ObjectivesParams, opts ...ClientOption) (*PostAPIV2ObjectivesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2ObjectivesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Objectives", + Method: "POST", + PathPattern: "/api/v2/objectives", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2ObjectivesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2ObjectivesOK) + 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 PostAPIV2Objectives: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PutAPIV2ObjectivesID creates or update an objective + +Attempt to update an objective using fields from the `ObjectiveSchema` in the request body. If the objective does not already exist, then create a new one using the `ObjectiveSchema` format. +*/ +func (a *Client) PutAPIV2ObjectivesID(params *PutAPIV2ObjectivesIDParams, opts ...ClientOption) (*PutAPIV2ObjectivesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAPIV2ObjectivesIDParams() + } + op := &runtime.ClientOperation{ + ID: "PutAPIV2ObjectivesID", + Method: "PUT", + PathPattern: "/api/v2/objectives/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutAPIV2ObjectivesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PutAPIV2ObjectivesIDOK) + 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 PutAPIV2ObjectivesID: 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/core/capability/caldera/api/client/objectives/patch_api_v2_objectives_id_parameters.go b/pkg/core/capability/caldera/api/client/objectives/patch_api_v2_objectives_id_parameters.go new file mode 100644 index 00000000..e7b7614d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/patch_api_v2_objectives_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2ObjectivesIDParams creates a new PatchAPIV2ObjectivesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2ObjectivesIDParams() *PatchAPIV2ObjectivesIDParams { + return &PatchAPIV2ObjectivesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2ObjectivesIDParamsWithTimeout creates a new PatchAPIV2ObjectivesIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2ObjectivesIDParamsWithTimeout(timeout time.Duration) *PatchAPIV2ObjectivesIDParams { + return &PatchAPIV2ObjectivesIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2ObjectivesIDParamsWithContext creates a new PatchAPIV2ObjectivesIDParams object +// with the ability to set a context for a request. +func NewPatchAPIV2ObjectivesIDParamsWithContext(ctx context.Context) *PatchAPIV2ObjectivesIDParams { + return &PatchAPIV2ObjectivesIDParams{ + Context: ctx, + } +} + +// NewPatchAPIV2ObjectivesIDParamsWithHTTPClient creates a new PatchAPIV2ObjectivesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2ObjectivesIDParamsWithHTTPClient(client *http.Client) *PatchAPIV2ObjectivesIDParams { + return &PatchAPIV2ObjectivesIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2ObjectivesIDParams contains all the parameters to send to the API endpoint + + for the patch API v2 objectives ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2ObjectivesIDParams struct { + + // Body. + Body *models.PartialObjective1 + + /* ID. + + UUID of the Objective to be updated + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 objectives ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2ObjectivesIDParams) WithDefaults() *PatchAPIV2ObjectivesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 objectives ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2ObjectivesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) WithTimeout(timeout time.Duration) *PatchAPIV2ObjectivesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) WithContext(ctx context.Context) *PatchAPIV2ObjectivesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) WithHTTPClient(client *http.Client) *PatchAPIV2ObjectivesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) WithBody(body *models.PartialObjective1) *PatchAPIV2ObjectivesIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) SetBody(body *models.PartialObjective1) { + o.Body = body +} + +// WithID adds the id to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) WithID(id string) *PatchAPIV2ObjectivesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API v2 objectives ID params +func (o *PatchAPIV2ObjectivesIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2ObjectivesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/objectives/patch_api_v2_objectives_id_responses.go b/pkg/core/capability/caldera/api/client/objectives/patch_api_v2_objectives_id_responses.go new file mode 100644 index 00000000..3628fa7d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/patch_api_v2_objectives_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2ObjectivesIDReader is a Reader for the PatchAPIV2ObjectivesID structure. +type PatchAPIV2ObjectivesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2ObjectivesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2ObjectivesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/objectives/{id}] PatchAPIV2ObjectivesID", response, response.Code()) + } +} + +// NewPatchAPIV2ObjectivesIDOK creates a PatchAPIV2ObjectivesIDOK with default headers values +func NewPatchAPIV2ObjectivesIDOK() *PatchAPIV2ObjectivesIDOK { + return &PatchAPIV2ObjectivesIDOK{} +} + +/* +PatchAPIV2ObjectivesIDOK describes a response with status code 200, with default header values. + +The updated Objective in ObjectiveSchema format. +*/ +type PatchAPIV2ObjectivesIDOK struct { + Payload *models.Objective +} + +// IsSuccess returns true when this patch Api v2 objectives Id o k response has a 2xx status code +func (o *PatchAPIV2ObjectivesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 objectives Id o k response has a 3xx status code +func (o *PatchAPIV2ObjectivesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 objectives Id o k response has a 4xx status code +func (o *PatchAPIV2ObjectivesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 objectives Id o k response has a 5xx status code +func (o *PatchAPIV2ObjectivesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 objectives Id o k response a status code equal to that given +func (o *PatchAPIV2ObjectivesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 objectives Id o k response +func (o *PatchAPIV2ObjectivesIDOK) Code() int { + return 200 +} + +func (o *PatchAPIV2ObjectivesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/objectives/{id}][%d] patchApiV2ObjectivesIdOK %s", 200, payload) +} + +func (o *PatchAPIV2ObjectivesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/objectives/{id}][%d] patchApiV2ObjectivesIdOK %s", 200, payload) +} + +func (o *PatchAPIV2ObjectivesIDOK) GetPayload() *models.Objective { + return o.Payload +} + +func (o *PatchAPIV2ObjectivesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Objective) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/objectives/post_api_v2_objectives_parameters.go b/pkg/core/capability/caldera/api/client/objectives/post_api_v2_objectives_parameters.go new file mode 100644 index 00000000..426ee536 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/post_api_v2_objectives_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2ObjectivesParams creates a new PostAPIV2ObjectivesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2ObjectivesParams() *PostAPIV2ObjectivesParams { + return &PostAPIV2ObjectivesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2ObjectivesParamsWithTimeout creates a new PostAPIV2ObjectivesParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2ObjectivesParamsWithTimeout(timeout time.Duration) *PostAPIV2ObjectivesParams { + return &PostAPIV2ObjectivesParams{ + timeout: timeout, + } +} + +// NewPostAPIV2ObjectivesParamsWithContext creates a new PostAPIV2ObjectivesParams object +// with the ability to set a context for a request. +func NewPostAPIV2ObjectivesParamsWithContext(ctx context.Context) *PostAPIV2ObjectivesParams { + return &PostAPIV2ObjectivesParams{ + Context: ctx, + } +} + +// NewPostAPIV2ObjectivesParamsWithHTTPClient creates a new PostAPIV2ObjectivesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2ObjectivesParamsWithHTTPClient(client *http.Client) *PostAPIV2ObjectivesParams { + return &PostAPIV2ObjectivesParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2ObjectivesParams contains all the parameters to send to the API endpoint + + for the post API v2 objectives operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2ObjectivesParams struct { + + // Body. + Body *models.Objective + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 objectives params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2ObjectivesParams) WithDefaults() *PostAPIV2ObjectivesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 objectives params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2ObjectivesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 objectives params +func (o *PostAPIV2ObjectivesParams) WithTimeout(timeout time.Duration) *PostAPIV2ObjectivesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 objectives params +func (o *PostAPIV2ObjectivesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 objectives params +func (o *PostAPIV2ObjectivesParams) WithContext(ctx context.Context) *PostAPIV2ObjectivesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 objectives params +func (o *PostAPIV2ObjectivesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 objectives params +func (o *PostAPIV2ObjectivesParams) WithHTTPClient(client *http.Client) *PostAPIV2ObjectivesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 objectives params +func (o *PostAPIV2ObjectivesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 objectives params +func (o *PostAPIV2ObjectivesParams) WithBody(body *models.Objective) *PostAPIV2ObjectivesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 objectives params +func (o *PostAPIV2ObjectivesParams) SetBody(body *models.Objective) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2ObjectivesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/objectives/post_api_v2_objectives_responses.go b/pkg/core/capability/caldera/api/client/objectives/post_api_v2_objectives_responses.go new file mode 100644 index 00000000..8fc58e01 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/post_api_v2_objectives_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2ObjectivesReader is a Reader for the PostAPIV2Objectives structure. +type PostAPIV2ObjectivesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2ObjectivesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2ObjectivesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/objectives] PostAPIV2Objectives", response, response.Code()) + } +} + +// NewPostAPIV2ObjectivesOK creates a PostAPIV2ObjectivesOK with default headers values +func NewPostAPIV2ObjectivesOK() *PostAPIV2ObjectivesOK { + return &PostAPIV2ObjectivesOK{} +} + +/* +PostAPIV2ObjectivesOK describes a response with status code 200, with default header values. + +A single objective in ObjectiveSchema format. +*/ +type PostAPIV2ObjectivesOK struct { + Payload *models.Objective +} + +// IsSuccess returns true when this post Api v2 objectives o k response has a 2xx status code +func (o *PostAPIV2ObjectivesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 objectives o k response has a 3xx status code +func (o *PostAPIV2ObjectivesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 objectives o k response has a 4xx status code +func (o *PostAPIV2ObjectivesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 objectives o k response has a 5xx status code +func (o *PostAPIV2ObjectivesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 objectives o k response a status code equal to that given +func (o *PostAPIV2ObjectivesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 objectives o k response +func (o *PostAPIV2ObjectivesOK) Code() int { + return 200 +} + +func (o *PostAPIV2ObjectivesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/objectives][%d] postApiV2ObjectivesOK %s", 200, payload) +} + +func (o *PostAPIV2ObjectivesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/objectives][%d] postApiV2ObjectivesOK %s", 200, payload) +} + +func (o *PostAPIV2ObjectivesOK) GetPayload() *models.Objective { + return o.Payload +} + +func (o *PostAPIV2ObjectivesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Objective) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/objectives/put_api_v2_objectives_id_parameters.go b/pkg/core/capability/caldera/api/client/objectives/put_api_v2_objectives_id_parameters.go new file mode 100644 index 00000000..b23a080f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/put_api_v2_objectives_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPutAPIV2ObjectivesIDParams creates a new PutAPIV2ObjectivesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPutAPIV2ObjectivesIDParams() *PutAPIV2ObjectivesIDParams { + return &PutAPIV2ObjectivesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPutAPIV2ObjectivesIDParamsWithTimeout creates a new PutAPIV2ObjectivesIDParams object +// with the ability to set a timeout on a request. +func NewPutAPIV2ObjectivesIDParamsWithTimeout(timeout time.Duration) *PutAPIV2ObjectivesIDParams { + return &PutAPIV2ObjectivesIDParams{ + timeout: timeout, + } +} + +// NewPutAPIV2ObjectivesIDParamsWithContext creates a new PutAPIV2ObjectivesIDParams object +// with the ability to set a context for a request. +func NewPutAPIV2ObjectivesIDParamsWithContext(ctx context.Context) *PutAPIV2ObjectivesIDParams { + return &PutAPIV2ObjectivesIDParams{ + Context: ctx, + } +} + +// NewPutAPIV2ObjectivesIDParamsWithHTTPClient creates a new PutAPIV2ObjectivesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPutAPIV2ObjectivesIDParamsWithHTTPClient(client *http.Client) *PutAPIV2ObjectivesIDParams { + return &PutAPIV2ObjectivesIDParams{ + HTTPClient: client, + } +} + +/* +PutAPIV2ObjectivesIDParams contains all the parameters to send to the API endpoint + + for the put API v2 objectives ID operation. + + Typically these are written to a http.Request. +*/ +type PutAPIV2ObjectivesIDParams struct { + + // Body. + Body *models.PartialObjective + + /* ID. + + UUID of the Objective to be created or updated + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the put API v2 objectives ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2ObjectivesIDParams) WithDefaults() *PutAPIV2ObjectivesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put API v2 objectives ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2ObjectivesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) WithTimeout(timeout time.Duration) *PutAPIV2ObjectivesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) WithContext(ctx context.Context) *PutAPIV2ObjectivesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) WithHTTPClient(client *http.Client) *PutAPIV2ObjectivesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) WithBody(body *models.PartialObjective) *PutAPIV2ObjectivesIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) SetBody(body *models.PartialObjective) { + o.Body = body +} + +// WithID adds the id to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) WithID(id string) *PutAPIV2ObjectivesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the put API v2 objectives ID params +func (o *PutAPIV2ObjectivesIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAPIV2ObjectivesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/objectives/put_api_v2_objectives_id_responses.go b/pkg/core/capability/caldera/api/client/objectives/put_api_v2_objectives_id_responses.go new file mode 100644 index 00000000..e0530f3f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/objectives/put_api_v2_objectives_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package objectives + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PutAPIV2ObjectivesIDReader is a Reader for the PutAPIV2ObjectivesID structure. +type PutAPIV2ObjectivesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAPIV2ObjectivesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPutAPIV2ObjectivesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PUT /api/v2/objectives/{id}] PutAPIV2ObjectivesID", response, response.Code()) + } +} + +// NewPutAPIV2ObjectivesIDOK creates a PutAPIV2ObjectivesIDOK with default headers values +func NewPutAPIV2ObjectivesIDOK() *PutAPIV2ObjectivesIDOK { + return &PutAPIV2ObjectivesIDOK{} +} + +/* +PutAPIV2ObjectivesIDOK describes a response with status code 200, with default header values. + +A single Objective, either newly created or updated, in ObjectiveSchema format. +*/ +type PutAPIV2ObjectivesIDOK struct { + Payload *models.Objective +} + +// IsSuccess returns true when this put Api v2 objectives Id o k response has a 2xx status code +func (o *PutAPIV2ObjectivesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put Api v2 objectives Id o k response has a 3xx status code +func (o *PutAPIV2ObjectivesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put Api v2 objectives Id o k response has a 4xx status code +func (o *PutAPIV2ObjectivesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this put Api v2 objectives Id o k response has a 5xx status code +func (o *PutAPIV2ObjectivesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put Api v2 objectives Id o k response a status code equal to that given +func (o *PutAPIV2ObjectivesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the put Api v2 objectives Id o k response +func (o *PutAPIV2ObjectivesIDOK) Code() int { + return 200 +} + +func (o *PutAPIV2ObjectivesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/objectives/{id}][%d] putApiV2ObjectivesIdOK %s", 200, payload) +} + +func (o *PutAPIV2ObjectivesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/objectives/{id}][%d] putApiV2ObjectivesIdOK %s", 200, payload) +} + +func (o *PutAPIV2ObjectivesIDOK) GetPayload() *models.Objective { + return o.Payload +} + +func (o *PutAPIV2ObjectivesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Objective) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/delete_api_v2_operations_id_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/delete_api_v2_operations_id_parameters.go new file mode 100644 index 00000000..49deb0b4 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/delete_api_v2_operations_id_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewDeleteAPIV2OperationsIDParams creates a new DeleteAPIV2OperationsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2OperationsIDParams() *DeleteAPIV2OperationsIDParams { + return &DeleteAPIV2OperationsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2OperationsIDParamsWithTimeout creates a new DeleteAPIV2OperationsIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2OperationsIDParamsWithTimeout(timeout time.Duration) *DeleteAPIV2OperationsIDParams { + return &DeleteAPIV2OperationsIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2OperationsIDParamsWithContext creates a new DeleteAPIV2OperationsIDParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2OperationsIDParamsWithContext(ctx context.Context) *DeleteAPIV2OperationsIDParams { + return &DeleteAPIV2OperationsIDParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2OperationsIDParamsWithHTTPClient creates a new DeleteAPIV2OperationsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2OperationsIDParamsWithHTTPClient(client *http.Client) *DeleteAPIV2OperationsIDParams { + return &DeleteAPIV2OperationsIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2OperationsIDParams contains all the parameters to send to the API endpoint + + for the delete API v2 operations ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2OperationsIDParams struct { + + /* ID. + + UUID of the Operation object to be retrieved. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 operations ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2OperationsIDParams) WithDefaults() *DeleteAPIV2OperationsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 operations ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2OperationsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 operations ID params +func (o *DeleteAPIV2OperationsIDParams) WithTimeout(timeout time.Duration) *DeleteAPIV2OperationsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 operations ID params +func (o *DeleteAPIV2OperationsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 operations ID params +func (o *DeleteAPIV2OperationsIDParams) WithContext(ctx context.Context) *DeleteAPIV2OperationsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 operations ID params +func (o *DeleteAPIV2OperationsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 operations ID params +func (o *DeleteAPIV2OperationsIDParams) WithHTTPClient(client *http.Client) *DeleteAPIV2OperationsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 operations ID params +func (o *DeleteAPIV2OperationsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API v2 operations ID params +func (o *DeleteAPIV2OperationsIDParams) WithID(id string) *DeleteAPIV2OperationsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API v2 operations ID params +func (o *DeleteAPIV2OperationsIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2OperationsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/delete_api_v2_operations_id_responses.go b/pkg/core/capability/caldera/api/client/operationsops/delete_api_v2_operations_id_responses.go new file mode 100644 index 00000000..1c014862 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/delete_api_v2_operations_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// DeleteAPIV2OperationsIDReader is a Reader for the DeleteAPIV2OperationsID structure. +type DeleteAPIV2OperationsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2OperationsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPIV2OperationsIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/operations/{id}] DeleteAPIV2OperationsID", response, response.Code()) + } +} + +// NewDeleteAPIV2OperationsIDOK creates a DeleteAPIV2OperationsIDOK with default headers values +func NewDeleteAPIV2OperationsIDOK() *DeleteAPIV2OperationsIDOK { + return &DeleteAPIV2OperationsIDOK{} +} + +/* +DeleteAPIV2OperationsIDOK describes a response with status code 200, with default header values. + +There is an empty response from a successful delete request. +*/ +type DeleteAPIV2OperationsIDOK struct { + Payload *models.Operation +} + +// IsSuccess returns true when this delete Api v2 operations Id o k response has a 2xx status code +func (o *DeleteAPIV2OperationsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 operations Id o k response has a 3xx status code +func (o *DeleteAPIV2OperationsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 operations Id o k response has a 4xx status code +func (o *DeleteAPIV2OperationsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 operations Id o k response has a 5xx status code +func (o *DeleteAPIV2OperationsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 operations Id o k response a status code equal to that given +func (o *DeleteAPIV2OperationsIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete Api v2 operations Id o k response +func (o *DeleteAPIV2OperationsIDOK) Code() int { + return 200 +} + +func (o *DeleteAPIV2OperationsIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/operations/{id}][%d] deleteApiV2OperationsIdOK %s", 200, payload) +} + +func (o *DeleteAPIV2OperationsIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/operations/{id}][%d] deleteApiV2OperationsIdOK %s", 200, payload) +} + +func (o *DeleteAPIV2OperationsIDOK) GetPayload() *models.Operation { + return o.Payload +} + +func (o *DeleteAPIV2OperationsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Operation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_parameters.go new file mode 100644 index 00000000..2e47763e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_parameters.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewGetAPIV2OperationsIDLinksLinkIDParams creates a new GetAPIV2OperationsIDLinksLinkIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2OperationsIDLinksLinkIDParams() *GetAPIV2OperationsIDLinksLinkIDParams { + return &GetAPIV2OperationsIDLinksLinkIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2OperationsIDLinksLinkIDParamsWithTimeout creates a new GetAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2OperationsIDLinksLinkIDParamsWithTimeout(timeout time.Duration) *GetAPIV2OperationsIDLinksLinkIDParams { + return &GetAPIV2OperationsIDLinksLinkIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2OperationsIDLinksLinkIDParamsWithContext creates a new GetAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2OperationsIDLinksLinkIDParamsWithContext(ctx context.Context) *GetAPIV2OperationsIDLinksLinkIDParams { + return &GetAPIV2OperationsIDLinksLinkIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2OperationsIDLinksLinkIDParamsWithHTTPClient creates a new GetAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2OperationsIDLinksLinkIDParamsWithHTTPClient(client *http.Client) *GetAPIV2OperationsIDLinksLinkIDParams { + return &GetAPIV2OperationsIDLinksLinkIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2OperationsIDLinksLinkIDParams contains all the parameters to send to the API endpoint + + for the get API v2 operations ID links link ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2OperationsIDLinksLinkIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + String UUID of the Operation containing desired link. + */ + ID string + + // Include. + Include []string + + /* LinkID. + + String UUID of the Link with the above operation. + */ + LinkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 operations ID links link ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WithDefaults() *GetAPIV2OperationsIDLinksLinkIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 operations ID links link ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDLinksLinkIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WithTimeout(timeout time.Duration) *GetAPIV2OperationsIDLinksLinkIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WithContext(ctx context.Context) *GetAPIV2OperationsIDLinksLinkIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WithHTTPClient(client *http.Client) *GetAPIV2OperationsIDLinksLinkIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WithExclude(exclude []string) *GetAPIV2OperationsIDLinksLinkIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WithID(id string) *GetAPIV2OperationsIDLinksLinkIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WithInclude(include []string) *GetAPIV2OperationsIDLinksLinkIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) SetInclude(include []string) { + o.Include = include +} + +// WithLinkID adds the linkID to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WithLinkID(linkID string) *GetAPIV2OperationsIDLinksLinkIDParams { + o.SetLinkID(linkID) + return o +} + +// SetLinkID adds the linkId to the get API v2 operations ID links link ID params +func (o *GetAPIV2OperationsIDLinksLinkIDParams) SetLinkID(linkID string) { + o.LinkID = linkID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2OperationsIDLinksLinkIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param link_id + if err := r.SetPathParam("link_id", o.LinkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2OperationsIDLinksLinkID binds the parameter exclude +func (o *GetAPIV2OperationsIDLinksLinkIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2OperationsIDLinksLinkID binds the parameter include +func (o *GetAPIV2OperationsIDLinksLinkIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_responses.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_responses.go new file mode 100644 index 00000000..686c7f44 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2OperationsIDLinksLinkIDReader is a Reader for the GetAPIV2OperationsIDLinksLinkID structure. +type GetAPIV2OperationsIDLinksLinkIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2OperationsIDLinksLinkIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2OperationsIDLinksLinkIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/operations/{id}/links/{link_id}] GetAPIV2OperationsIDLinksLinkID", response, response.Code()) + } +} + +// NewGetAPIV2OperationsIDLinksLinkIDOK creates a GetAPIV2OperationsIDLinksLinkIDOK with default headers values +func NewGetAPIV2OperationsIDLinksLinkIDOK() *GetAPIV2OperationsIDLinksLinkIDOK { + return &GetAPIV2OperationsIDLinksLinkIDOK{} +} + +/* +GetAPIV2OperationsIDLinksLinkIDOK describes a response with status code 200, with default header values. + +The link matching the provided `link_id` within the operation matching `id`. Use fields from the `BaseGetOneQuerySchema` in the request body to add `include` and `exclude` filters. +*/ +type GetAPIV2OperationsIDLinksLinkIDOK struct { + Payload *models.PartialLink +} + +// IsSuccess returns true when this get Api v2 operations Id links link Id o k response has a 2xx status code +func (o *GetAPIV2OperationsIDLinksLinkIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 operations Id links link Id o k response has a 3xx status code +func (o *GetAPIV2OperationsIDLinksLinkIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 operations Id links link Id o k response has a 4xx status code +func (o *GetAPIV2OperationsIDLinksLinkIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 operations Id links link Id o k response has a 5xx status code +func (o *GetAPIV2OperationsIDLinksLinkIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 operations Id links link Id o k response a status code equal to that given +func (o *GetAPIV2OperationsIDLinksLinkIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 operations Id links link Id o k response +func (o *GetAPIV2OperationsIDLinksLinkIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2OperationsIDLinksLinkIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/links/{link_id}][%d] getApiV2OperationsIdLinksLinkIdOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDLinksLinkIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/links/{link_id}][%d] getApiV2OperationsIdLinksLinkIdOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDLinksLinkIDOK) GetPayload() *models.PartialLink { + return o.Payload +} + +func (o *GetAPIV2OperationsIDLinksLinkIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialLink) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_result_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_result_parameters.go new file mode 100644 index 00000000..18764ecc --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_result_parameters.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewGetAPIV2OperationsIDLinksLinkIDResultParams creates a new GetAPIV2OperationsIDLinksLinkIDResultParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2OperationsIDLinksLinkIDResultParams() *GetAPIV2OperationsIDLinksLinkIDResultParams { + return &GetAPIV2OperationsIDLinksLinkIDResultParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2OperationsIDLinksLinkIDResultParamsWithTimeout creates a new GetAPIV2OperationsIDLinksLinkIDResultParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2OperationsIDLinksLinkIDResultParamsWithTimeout(timeout time.Duration) *GetAPIV2OperationsIDLinksLinkIDResultParams { + return &GetAPIV2OperationsIDLinksLinkIDResultParams{ + timeout: timeout, + } +} + +// NewGetAPIV2OperationsIDLinksLinkIDResultParamsWithContext creates a new GetAPIV2OperationsIDLinksLinkIDResultParams object +// with the ability to set a context for a request. +func NewGetAPIV2OperationsIDLinksLinkIDResultParamsWithContext(ctx context.Context) *GetAPIV2OperationsIDLinksLinkIDResultParams { + return &GetAPIV2OperationsIDLinksLinkIDResultParams{ + Context: ctx, + } +} + +// NewGetAPIV2OperationsIDLinksLinkIDResultParamsWithHTTPClient creates a new GetAPIV2OperationsIDLinksLinkIDResultParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2OperationsIDLinksLinkIDResultParamsWithHTTPClient(client *http.Client) *GetAPIV2OperationsIDLinksLinkIDResultParams { + return &GetAPIV2OperationsIDLinksLinkIDResultParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2OperationsIDLinksLinkIDResultParams contains all the parameters to send to the API endpoint + + for the get API v2 operations ID links link ID result operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2OperationsIDLinksLinkIDResultParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the operation object to be retrieved. + */ + ID string + + // Include. + Include []string + + /* LinkID. + + UUID of the link object to retrieve results of. + */ + LinkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 operations ID links link ID result params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WithDefaults() *GetAPIV2OperationsIDLinksLinkIDResultParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 operations ID links link ID result params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WithTimeout(timeout time.Duration) *GetAPIV2OperationsIDLinksLinkIDResultParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WithContext(ctx context.Context) *GetAPIV2OperationsIDLinksLinkIDResultParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WithHTTPClient(client *http.Client) *GetAPIV2OperationsIDLinksLinkIDResultParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WithExclude(exclude []string) *GetAPIV2OperationsIDLinksLinkIDResultParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WithID(id string) *GetAPIV2OperationsIDLinksLinkIDResultParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WithInclude(include []string) *GetAPIV2OperationsIDLinksLinkIDResultParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) SetInclude(include []string) { + o.Include = include +} + +// WithLinkID adds the linkID to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WithLinkID(linkID string) *GetAPIV2OperationsIDLinksLinkIDResultParams { + o.SetLinkID(linkID) + return o +} + +// SetLinkID adds the linkId to the get API v2 operations ID links link ID result params +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) SetLinkID(linkID string) { + o.LinkID = linkID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param link_id + if err := r.SetPathParam("link_id", o.LinkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2OperationsIDLinksLinkIDResult binds the parameter exclude +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2OperationsIDLinksLinkIDResult binds the parameter include +func (o *GetAPIV2OperationsIDLinksLinkIDResultParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_result_responses.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_result_responses.go new file mode 100644 index 00000000..023f75ca --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_link_id_result_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2OperationsIDLinksLinkIDResultReader is a Reader for the GetAPIV2OperationsIDLinksLinkIDResult structure. +type GetAPIV2OperationsIDLinksLinkIDResultReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2OperationsIDLinksLinkIDResultReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2OperationsIDLinksLinkIDResultOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/operations/{id}/links/{link_id}/result] GetAPIV2OperationsIDLinksLinkIDResult", response, response.Code()) + } +} + +// NewGetAPIV2OperationsIDLinksLinkIDResultOK creates a GetAPIV2OperationsIDLinksLinkIDResultOK with default headers values +func NewGetAPIV2OperationsIDLinksLinkIDResultOK() *GetAPIV2OperationsIDLinksLinkIDResultOK { + return &GetAPIV2OperationsIDLinksLinkIDResultOK{} +} + +/* +GetAPIV2OperationsIDLinksLinkIDResultOK describes a response with status code 200, with default header values. + +Contains a dictionary with the requested link and its results dictionary. +*/ +type GetAPIV2OperationsIDLinksLinkIDResultOK struct { + Payload *models.LinkResult +} + +// IsSuccess returns true when this get Api v2 operations Id links link Id result o k response has a 2xx status code +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 operations Id links link Id result o k response has a 3xx status code +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 operations Id links link Id result o k response has a 4xx status code +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 operations Id links link Id result o k response has a 5xx status code +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 operations Id links link Id result o k response a status code equal to that given +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 operations Id links link Id result o k response +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) Code() int { + return 200 +} + +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/links/{link_id}/result][%d] getApiV2OperationsIdLinksLinkIdResultOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/links/{link_id}/result][%d] getApiV2OperationsIdLinksLinkIdResultOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) GetPayload() *models.LinkResult { + return o.Payload +} + +func (o *GetAPIV2OperationsIDLinksLinkIDResultOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.LinkResult) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_parameters.go new file mode 100644 index 00000000..b71bb548 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_parameters.go @@ -0,0 +1,264 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewGetAPIV2OperationsIDLinksParams creates a new GetAPIV2OperationsIDLinksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2OperationsIDLinksParams() *GetAPIV2OperationsIDLinksParams { + return &GetAPIV2OperationsIDLinksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2OperationsIDLinksParamsWithTimeout creates a new GetAPIV2OperationsIDLinksParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2OperationsIDLinksParamsWithTimeout(timeout time.Duration) *GetAPIV2OperationsIDLinksParams { + return &GetAPIV2OperationsIDLinksParams{ + timeout: timeout, + } +} + +// NewGetAPIV2OperationsIDLinksParamsWithContext creates a new GetAPIV2OperationsIDLinksParams object +// with the ability to set a context for a request. +func NewGetAPIV2OperationsIDLinksParamsWithContext(ctx context.Context) *GetAPIV2OperationsIDLinksParams { + return &GetAPIV2OperationsIDLinksParams{ + Context: ctx, + } +} + +// NewGetAPIV2OperationsIDLinksParamsWithHTTPClient creates a new GetAPIV2OperationsIDLinksParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2OperationsIDLinksParamsWithHTTPClient(client *http.Client) *GetAPIV2OperationsIDLinksParams { + return &GetAPIV2OperationsIDLinksParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2OperationsIDLinksParams contains all the parameters to send to the API endpoint + + for the get API v2 operations ID links operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2OperationsIDLinksParams struct { + + // Exclude. + Exclude []string + + // ID. + ID string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 operations ID links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDLinksParams) WithDefaults() *GetAPIV2OperationsIDLinksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 operations ID links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDLinksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) WithTimeout(timeout time.Duration) *GetAPIV2OperationsIDLinksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) WithContext(ctx context.Context) *GetAPIV2OperationsIDLinksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) WithHTTPClient(client *http.Client) *GetAPIV2OperationsIDLinksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) WithExclude(exclude []string) *GetAPIV2OperationsIDLinksParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) WithID(id string) *GetAPIV2OperationsIDLinksParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) WithInclude(include []string) *GetAPIV2OperationsIDLinksParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) WithSort(sort *string) *GetAPIV2OperationsIDLinksParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 operations ID links params +func (o *GetAPIV2OperationsIDLinksParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2OperationsIDLinksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2OperationsIDLinks binds the parameter exclude +func (o *GetAPIV2OperationsIDLinksParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2OperationsIDLinks binds the parameter include +func (o *GetAPIV2OperationsIDLinksParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_responses.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_responses.go new file mode 100644 index 00000000..e69812f0 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_links_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2OperationsIDLinksReader is a Reader for the GetAPIV2OperationsIDLinks structure. +type GetAPIV2OperationsIDLinksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2OperationsIDLinksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2OperationsIDLinksOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/operations/{id}/links] GetAPIV2OperationsIDLinks", response, response.Code()) + } +} + +// NewGetAPIV2OperationsIDLinksOK creates a GetAPIV2OperationsIDLinksOK with default headers values +func NewGetAPIV2OperationsIDLinksOK() *GetAPIV2OperationsIDLinksOK { + return &GetAPIV2OperationsIDLinksOK{} +} + +/* +GetAPIV2OperationsIDLinksOK describes a response with status code 200, with default header values. + +All links contained in operation with the given `id` (String UUID). +*/ +type GetAPIV2OperationsIDLinksOK struct { + Payload []*models.PartialLink +} + +// IsSuccess returns true when this get Api v2 operations Id links o k response has a 2xx status code +func (o *GetAPIV2OperationsIDLinksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 operations Id links o k response has a 3xx status code +func (o *GetAPIV2OperationsIDLinksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 operations Id links o k response has a 4xx status code +func (o *GetAPIV2OperationsIDLinksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 operations Id links o k response has a 5xx status code +func (o *GetAPIV2OperationsIDLinksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 operations Id links o k response a status code equal to that given +func (o *GetAPIV2OperationsIDLinksOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 operations Id links o k response +func (o *GetAPIV2OperationsIDLinksOK) Code() int { + return 200 +} + +func (o *GetAPIV2OperationsIDLinksOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/links][%d] getApiV2OperationsIdLinksOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDLinksOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/links][%d] getApiV2OperationsIdLinksOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDLinksOK) GetPayload() []*models.PartialLink { + return o.Payload +} + +func (o *GetAPIV2OperationsIDLinksOK) 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/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_parameters.go new file mode 100644 index 00000000..48bfc9ea --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewGetAPIV2OperationsIDParams creates a new GetAPIV2OperationsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2OperationsIDParams() *GetAPIV2OperationsIDParams { + return &GetAPIV2OperationsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2OperationsIDParamsWithTimeout creates a new GetAPIV2OperationsIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2OperationsIDParamsWithTimeout(timeout time.Duration) *GetAPIV2OperationsIDParams { + return &GetAPIV2OperationsIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2OperationsIDParamsWithContext creates a new GetAPIV2OperationsIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2OperationsIDParamsWithContext(ctx context.Context) *GetAPIV2OperationsIDParams { + return &GetAPIV2OperationsIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2OperationsIDParamsWithHTTPClient creates a new GetAPIV2OperationsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2OperationsIDParamsWithHTTPClient(client *http.Client) *GetAPIV2OperationsIDParams { + return &GetAPIV2OperationsIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2OperationsIDParams contains all the parameters to send to the API endpoint + + for the get API v2 operations ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2OperationsIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the Operation object to be retrieved. + */ + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 operations ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDParams) WithDefaults() *GetAPIV2OperationsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 operations ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) WithTimeout(timeout time.Duration) *GetAPIV2OperationsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) WithContext(ctx context.Context) *GetAPIV2OperationsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) WithHTTPClient(client *http.Client) *GetAPIV2OperationsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) WithExclude(exclude []string) *GetAPIV2OperationsIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) WithID(id string) *GetAPIV2OperationsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) WithInclude(include []string) *GetAPIV2OperationsIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 operations ID params +func (o *GetAPIV2OperationsIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2OperationsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2OperationsID binds the parameter exclude +func (o *GetAPIV2OperationsIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2OperationsID binds the parameter include +func (o *GetAPIV2OperationsIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_parameters.go new file mode 100644 index 00000000..fead318e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_parameters.go @@ -0,0 +1,267 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewGetAPIV2OperationsIDPotentialLinksParams creates a new GetAPIV2OperationsIDPotentialLinksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2OperationsIDPotentialLinksParams() *GetAPIV2OperationsIDPotentialLinksParams { + return &GetAPIV2OperationsIDPotentialLinksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2OperationsIDPotentialLinksParamsWithTimeout creates a new GetAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2OperationsIDPotentialLinksParamsWithTimeout(timeout time.Duration) *GetAPIV2OperationsIDPotentialLinksParams { + return &GetAPIV2OperationsIDPotentialLinksParams{ + timeout: timeout, + } +} + +// NewGetAPIV2OperationsIDPotentialLinksParamsWithContext creates a new GetAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a context for a request. +func NewGetAPIV2OperationsIDPotentialLinksParamsWithContext(ctx context.Context) *GetAPIV2OperationsIDPotentialLinksParams { + return &GetAPIV2OperationsIDPotentialLinksParams{ + Context: ctx, + } +} + +// NewGetAPIV2OperationsIDPotentialLinksParamsWithHTTPClient creates a new GetAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2OperationsIDPotentialLinksParamsWithHTTPClient(client *http.Client) *GetAPIV2OperationsIDPotentialLinksParams { + return &GetAPIV2OperationsIDPotentialLinksParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2OperationsIDPotentialLinksParams contains all the parameters to send to the API endpoint + + for the get API v2 operations ID potential links operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2OperationsIDPotentialLinksParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the operation object to retrieve links for. + */ + ID string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 operations ID potential links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDPotentialLinksParams) WithDefaults() *GetAPIV2OperationsIDPotentialLinksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 operations ID potential links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDPotentialLinksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) WithTimeout(timeout time.Duration) *GetAPIV2OperationsIDPotentialLinksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) WithContext(ctx context.Context) *GetAPIV2OperationsIDPotentialLinksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) WithHTTPClient(client *http.Client) *GetAPIV2OperationsIDPotentialLinksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) WithExclude(exclude []string) *GetAPIV2OperationsIDPotentialLinksParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) WithID(id string) *GetAPIV2OperationsIDPotentialLinksParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) WithInclude(include []string) *GetAPIV2OperationsIDPotentialLinksParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) WithSort(sort *string) *GetAPIV2OperationsIDPotentialLinksParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 operations ID potential links params +func (o *GetAPIV2OperationsIDPotentialLinksParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2OperationsIDPotentialLinksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2OperationsIDPotentialLinks binds the parameter exclude +func (o *GetAPIV2OperationsIDPotentialLinksParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2OperationsIDPotentialLinks binds the parameter include +func (o *GetAPIV2OperationsIDPotentialLinksParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_paw_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_paw_parameters.go new file mode 100644 index 00000000..ca46ccb0 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_paw_parameters.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewGetAPIV2OperationsIDPotentialLinksPawParams creates a new GetAPIV2OperationsIDPotentialLinksPawParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2OperationsIDPotentialLinksPawParams() *GetAPIV2OperationsIDPotentialLinksPawParams { + return &GetAPIV2OperationsIDPotentialLinksPawParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2OperationsIDPotentialLinksPawParamsWithTimeout creates a new GetAPIV2OperationsIDPotentialLinksPawParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2OperationsIDPotentialLinksPawParamsWithTimeout(timeout time.Duration) *GetAPIV2OperationsIDPotentialLinksPawParams { + return &GetAPIV2OperationsIDPotentialLinksPawParams{ + timeout: timeout, + } +} + +// NewGetAPIV2OperationsIDPotentialLinksPawParamsWithContext creates a new GetAPIV2OperationsIDPotentialLinksPawParams object +// with the ability to set a context for a request. +func NewGetAPIV2OperationsIDPotentialLinksPawParamsWithContext(ctx context.Context) *GetAPIV2OperationsIDPotentialLinksPawParams { + return &GetAPIV2OperationsIDPotentialLinksPawParams{ + Context: ctx, + } +} + +// NewGetAPIV2OperationsIDPotentialLinksPawParamsWithHTTPClient creates a new GetAPIV2OperationsIDPotentialLinksPawParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2OperationsIDPotentialLinksPawParamsWithHTTPClient(client *http.Client) *GetAPIV2OperationsIDPotentialLinksPawParams { + return &GetAPIV2OperationsIDPotentialLinksPawParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2OperationsIDPotentialLinksPawParams contains all the parameters to send to the API endpoint + + for the get API v2 operations ID potential links paw operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2OperationsIDPotentialLinksPawParams struct { + + // Exclude. + Exclude []string + + /* ID. + + String UUID of the Operation containing desired links. + */ + ID string + + // Include. + Include []string + + /* Paw. + + Agent paw for the specified operation. + */ + Paw string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 operations ID potential links paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WithDefaults() *GetAPIV2OperationsIDPotentialLinksPawParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 operations ID potential links paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WithTimeout(timeout time.Duration) *GetAPIV2OperationsIDPotentialLinksPawParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WithContext(ctx context.Context) *GetAPIV2OperationsIDPotentialLinksPawParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WithHTTPClient(client *http.Client) *GetAPIV2OperationsIDPotentialLinksPawParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WithExclude(exclude []string) *GetAPIV2OperationsIDPotentialLinksPawParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WithID(id string) *GetAPIV2OperationsIDPotentialLinksPawParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WithInclude(include []string) *GetAPIV2OperationsIDPotentialLinksPawParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) SetInclude(include []string) { + o.Include = include +} + +// WithPaw adds the paw to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WithPaw(paw string) *GetAPIV2OperationsIDPotentialLinksPawParams { + o.SetPaw(paw) + return o +} + +// SetPaw adds the paw to the get API v2 operations ID potential links paw params +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) SetPaw(paw string) { + o.Paw = paw +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param paw + if err := r.SetPathParam("paw", o.Paw); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2OperationsIDPotentialLinksPaw binds the parameter exclude +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2OperationsIDPotentialLinksPaw binds the parameter include +func (o *GetAPIV2OperationsIDPotentialLinksPawParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_paw_responses.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_paw_responses.go new file mode 100644 index 00000000..cbf95ff1 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_paw_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2OperationsIDPotentialLinksPawReader is a Reader for the GetAPIV2OperationsIDPotentialLinksPaw structure. +type GetAPIV2OperationsIDPotentialLinksPawReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2OperationsIDPotentialLinksPawReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2OperationsIDPotentialLinksPawOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/operations/{id}/potential-links/{paw}] GetAPIV2OperationsIDPotentialLinksPaw", response, response.Code()) + } +} + +// NewGetAPIV2OperationsIDPotentialLinksPawOK creates a GetAPIV2OperationsIDPotentialLinksPawOK with default headers values +func NewGetAPIV2OperationsIDPotentialLinksPawOK() *GetAPIV2OperationsIDPotentialLinksPawOK { + return &GetAPIV2OperationsIDPotentialLinksPawOK{} +} + +/* +GetAPIV2OperationsIDPotentialLinksPawOK describes a response with status code 200, with default header values. + +All potential links for operation and the specified agent paw. +*/ +type GetAPIV2OperationsIDPotentialLinksPawOK struct { + Payload *models.PartialLink +} + +// IsSuccess returns true when this get Api v2 operations Id potential links paw o k response has a 2xx status code +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 operations Id potential links paw o k response has a 3xx status code +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 operations Id potential links paw o k response has a 4xx status code +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 operations Id potential links paw o k response has a 5xx status code +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 operations Id potential links paw o k response a status code equal to that given +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 operations Id potential links paw o k response +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) Code() int { + return 200 +} + +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/potential-links/{paw}][%d] getApiV2OperationsIdPotentialLinksPawOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/potential-links/{paw}][%d] getApiV2OperationsIdPotentialLinksPawOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) GetPayload() *models.PartialLink { + return o.Payload +} + +func (o *GetAPIV2OperationsIDPotentialLinksPawOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialLink) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_responses.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_responses.go new file mode 100644 index 00000000..cd03443d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_potential_links_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2OperationsIDPotentialLinksReader is a Reader for the GetAPIV2OperationsIDPotentialLinks structure. +type GetAPIV2OperationsIDPotentialLinksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2OperationsIDPotentialLinksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2OperationsIDPotentialLinksOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/operations/{id}/potential-links] GetAPIV2OperationsIDPotentialLinks", response, response.Code()) + } +} + +// NewGetAPIV2OperationsIDPotentialLinksOK creates a GetAPIV2OperationsIDPotentialLinksOK with default headers values +func NewGetAPIV2OperationsIDPotentialLinksOK() *GetAPIV2OperationsIDPotentialLinksOK { + return &GetAPIV2OperationsIDPotentialLinksOK{} +} + +/* +GetAPIV2OperationsIDPotentialLinksOK describes a response with status code 200, with default header values. + +Response contains a list of link objects for the requested id. +*/ +type GetAPIV2OperationsIDPotentialLinksOK struct { + Payload []*models.PartialLink +} + +// IsSuccess returns true when this get Api v2 operations Id potential links o k response has a 2xx status code +func (o *GetAPIV2OperationsIDPotentialLinksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 operations Id potential links o k response has a 3xx status code +func (o *GetAPIV2OperationsIDPotentialLinksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 operations Id potential links o k response has a 4xx status code +func (o *GetAPIV2OperationsIDPotentialLinksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 operations Id potential links o k response has a 5xx status code +func (o *GetAPIV2OperationsIDPotentialLinksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 operations Id potential links o k response a status code equal to that given +func (o *GetAPIV2OperationsIDPotentialLinksOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 operations Id potential links o k response +func (o *GetAPIV2OperationsIDPotentialLinksOK) Code() int { + return 200 +} + +func (o *GetAPIV2OperationsIDPotentialLinksOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/potential-links][%d] getApiV2OperationsIdPotentialLinksOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDPotentialLinksOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}/potential-links][%d] getApiV2OperationsIdPotentialLinksOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDPotentialLinksOK) GetPayload() []*models.PartialLink { + return o.Payload +} + +func (o *GetAPIV2OperationsIDPotentialLinksOK) 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/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_responses.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_responses.go new file mode 100644 index 00000000..da25a073 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2OperationsIDReader is a Reader for the GetAPIV2OperationsID structure. +type GetAPIV2OperationsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2OperationsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2OperationsIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/operations/{id}] GetAPIV2OperationsID", response, response.Code()) + } +} + +// NewGetAPIV2OperationsIDOK creates a GetAPIV2OperationsIDOK with default headers values +func NewGetAPIV2OperationsIDOK() *GetAPIV2OperationsIDOK { + return &GetAPIV2OperationsIDOK{} +} + +/* +GetAPIV2OperationsIDOK describes a response with status code 200, with default header values. + +The response is the operation with the specified id, if any. +*/ +type GetAPIV2OperationsIDOK struct { + Payload *models.PartialOperation +} + +// IsSuccess returns true when this get Api v2 operations Id o k response has a 2xx status code +func (o *GetAPIV2OperationsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 operations Id o k response has a 3xx status code +func (o *GetAPIV2OperationsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 operations Id o k response has a 4xx status code +func (o *GetAPIV2OperationsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 operations Id o k response has a 5xx status code +func (o *GetAPIV2OperationsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 operations Id o k response a status code equal to that given +func (o *GetAPIV2OperationsIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 operations Id o k response +func (o *GetAPIV2OperationsIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2OperationsIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}][%d] getApiV2OperationsIdOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/{id}][%d] getApiV2OperationsIdOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsIDOK) GetPayload() *models.PartialOperation { + return o.Payload +} + +func (o *GetAPIV2OperationsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialOperation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_parameters.go new file mode 100644 index 00000000..f1c7970e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewGetAPIV2OperationsParams creates a new GetAPIV2OperationsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2OperationsParams() *GetAPIV2OperationsParams { + return &GetAPIV2OperationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2OperationsParamsWithTimeout creates a new GetAPIV2OperationsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2OperationsParamsWithTimeout(timeout time.Duration) *GetAPIV2OperationsParams { + return &GetAPIV2OperationsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2OperationsParamsWithContext creates a new GetAPIV2OperationsParams object +// with the ability to set a context for a request. +func NewGetAPIV2OperationsParamsWithContext(ctx context.Context) *GetAPIV2OperationsParams { + return &GetAPIV2OperationsParams{ + Context: ctx, + } +} + +// NewGetAPIV2OperationsParamsWithHTTPClient creates a new GetAPIV2OperationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2OperationsParamsWithHTTPClient(client *http.Client) *GetAPIV2OperationsParams { + return &GetAPIV2OperationsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2OperationsParams contains all the parameters to send to the API endpoint + + for the get API v2 operations operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2OperationsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 operations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsParams) WithDefaults() *GetAPIV2OperationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 operations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 operations params +func (o *GetAPIV2OperationsParams) WithTimeout(timeout time.Duration) *GetAPIV2OperationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 operations params +func (o *GetAPIV2OperationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 operations params +func (o *GetAPIV2OperationsParams) WithContext(ctx context.Context) *GetAPIV2OperationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 operations params +func (o *GetAPIV2OperationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 operations params +func (o *GetAPIV2OperationsParams) WithHTTPClient(client *http.Client) *GetAPIV2OperationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 operations params +func (o *GetAPIV2OperationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 operations params +func (o *GetAPIV2OperationsParams) WithExclude(exclude []string) *GetAPIV2OperationsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 operations params +func (o *GetAPIV2OperationsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 operations params +func (o *GetAPIV2OperationsParams) WithInclude(include []string) *GetAPIV2OperationsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 operations params +func (o *GetAPIV2OperationsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 operations params +func (o *GetAPIV2OperationsParams) WithSort(sort *string) *GetAPIV2OperationsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 operations params +func (o *GetAPIV2OperationsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2OperationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Operations binds the parameter exclude +func (o *GetAPIV2OperationsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Operations binds the parameter include +func (o *GetAPIV2OperationsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_responses.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_responses.go new file mode 100644 index 00000000..eed2d5ea --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2OperationsReader is a Reader for the GetAPIV2Operations structure. +type GetAPIV2OperationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2OperationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2OperationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/operations] GetAPIV2Operations", response, response.Code()) + } +} + +// NewGetAPIV2OperationsOK creates a GetAPIV2OperationsOK with default headers values +func NewGetAPIV2OperationsOK() *GetAPIV2OperationsOK { + return &GetAPIV2OperationsOK{} +} + +/* +GetAPIV2OperationsOK describes a response with status code 200, with default header values. + +The response is a list of all operations. +*/ +type GetAPIV2OperationsOK struct { + Payload []*models.PartialOperation +} + +// IsSuccess returns true when this get Api v2 operations o k response has a 2xx status code +func (o *GetAPIV2OperationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 operations o k response has a 3xx status code +func (o *GetAPIV2OperationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 operations o k response has a 4xx status code +func (o *GetAPIV2OperationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 operations o k response has a 5xx status code +func (o *GetAPIV2OperationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 operations o k response a status code equal to that given +func (o *GetAPIV2OperationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 operations o k response +func (o *GetAPIV2OperationsOK) Code() int { + return 200 +} + +func (o *GetAPIV2OperationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations][%d] getApiV2OperationsOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations][%d] getApiV2OperationsOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsOK) GetPayload() []*models.PartialOperation { + return o.Payload +} + +func (o *GetAPIV2OperationsOK) 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/core/capability/caldera/api/client/operationsops/get_api_v2_operations_summary_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_summary_parameters.go new file mode 100644 index 00000000..d76c6a98 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_summary_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewGetAPIV2OperationsSummaryParams creates a new GetAPIV2OperationsSummaryParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2OperationsSummaryParams() *GetAPIV2OperationsSummaryParams { + return &GetAPIV2OperationsSummaryParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2OperationsSummaryParamsWithTimeout creates a new GetAPIV2OperationsSummaryParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2OperationsSummaryParamsWithTimeout(timeout time.Duration) *GetAPIV2OperationsSummaryParams { + return &GetAPIV2OperationsSummaryParams{ + timeout: timeout, + } +} + +// NewGetAPIV2OperationsSummaryParamsWithContext creates a new GetAPIV2OperationsSummaryParams object +// with the ability to set a context for a request. +func NewGetAPIV2OperationsSummaryParamsWithContext(ctx context.Context) *GetAPIV2OperationsSummaryParams { + return &GetAPIV2OperationsSummaryParams{ + Context: ctx, + } +} + +// NewGetAPIV2OperationsSummaryParamsWithHTTPClient creates a new GetAPIV2OperationsSummaryParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2OperationsSummaryParamsWithHTTPClient(client *http.Client) *GetAPIV2OperationsSummaryParams { + return &GetAPIV2OperationsSummaryParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2OperationsSummaryParams contains all the parameters to send to the API endpoint + + for the get API v2 operations summary operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2OperationsSummaryParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 operations summary params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsSummaryParams) WithDefaults() *GetAPIV2OperationsSummaryParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 operations summary params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2OperationsSummaryParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) WithTimeout(timeout time.Duration) *GetAPIV2OperationsSummaryParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) WithContext(ctx context.Context) *GetAPIV2OperationsSummaryParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) WithHTTPClient(client *http.Client) *GetAPIV2OperationsSummaryParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) WithExclude(exclude []string) *GetAPIV2OperationsSummaryParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) WithInclude(include []string) *GetAPIV2OperationsSummaryParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) WithSort(sort *string) *GetAPIV2OperationsSummaryParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 operations summary params +func (o *GetAPIV2OperationsSummaryParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2OperationsSummaryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2OperationsSummary binds the parameter exclude +func (o *GetAPIV2OperationsSummaryParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2OperationsSummary binds the parameter include +func (o *GetAPIV2OperationsSummaryParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_summary_responses.go b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_summary_responses.go new file mode 100644 index 00000000..7f68323f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/get_api_v2_operations_summary_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2OperationsSummaryReader is a Reader for the GetAPIV2OperationsSummary structure. +type GetAPIV2OperationsSummaryReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2OperationsSummaryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2OperationsSummaryOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/operations/summary] GetAPIV2OperationsSummary", response, response.Code()) + } +} + +// NewGetAPIV2OperationsSummaryOK creates a GetAPIV2OperationsSummaryOK with default headers values +func NewGetAPIV2OperationsSummaryOK() *GetAPIV2OperationsSummaryOK { + return &GetAPIV2OperationsSummaryOK{} +} + +/* +GetAPIV2OperationsSummaryOK describes a response with status code 200, with default header values. + +The response is a list of all operations. +*/ +type GetAPIV2OperationsSummaryOK struct { + Payload []*models.PartialOperationSchemaAlt +} + +// IsSuccess returns true when this get Api v2 operations summary o k response has a 2xx status code +func (o *GetAPIV2OperationsSummaryOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 operations summary o k response has a 3xx status code +func (o *GetAPIV2OperationsSummaryOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 operations summary o k response has a 4xx status code +func (o *GetAPIV2OperationsSummaryOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 operations summary o k response has a 5xx status code +func (o *GetAPIV2OperationsSummaryOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 operations summary o k response a status code equal to that given +func (o *GetAPIV2OperationsSummaryOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 operations summary o k response +func (o *GetAPIV2OperationsSummaryOK) Code() int { + return 200 +} + +func (o *GetAPIV2OperationsSummaryOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/summary][%d] getApiV2OperationsSummaryOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsSummaryOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/operations/summary][%d] getApiV2OperationsSummaryOK %s", 200, payload) +} + +func (o *GetAPIV2OperationsSummaryOK) GetPayload() []*models.PartialOperationSchemaAlt { + return o.Payload +} + +func (o *GetAPIV2OperationsSummaryOK) 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/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_parameters.go new file mode 100644 index 00000000..86a4fb9c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_parameters.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewHeadAPIV2OperationsIDLinksLinkIDParams creates a new HeadAPIV2OperationsIDLinksLinkIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2OperationsIDLinksLinkIDParams() *HeadAPIV2OperationsIDLinksLinkIDParams { + return &HeadAPIV2OperationsIDLinksLinkIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2OperationsIDLinksLinkIDParamsWithTimeout creates a new HeadAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2OperationsIDLinksLinkIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDLinksLinkIDParams { + return &HeadAPIV2OperationsIDLinksLinkIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2OperationsIDLinksLinkIDParamsWithContext creates a new HeadAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2OperationsIDLinksLinkIDParamsWithContext(ctx context.Context) *HeadAPIV2OperationsIDLinksLinkIDParams { + return &HeadAPIV2OperationsIDLinksLinkIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2OperationsIDLinksLinkIDParamsWithHTTPClient creates a new HeadAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2OperationsIDLinksLinkIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDLinksLinkIDParams { + return &HeadAPIV2OperationsIDLinksLinkIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2OperationsIDLinksLinkIDParams contains all the parameters to send to the API endpoint + + for the head API v2 operations ID links link ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2OperationsIDLinksLinkIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + String UUID of the Operation containing desired link. + */ + ID string + + // Include. + Include []string + + /* LinkID. + + String UUID of the Link with the above operation. + */ + LinkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 operations ID links link ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WithDefaults() *HeadAPIV2OperationsIDLinksLinkIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 operations ID links link ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDLinksLinkIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WithContext(ctx context.Context) *HeadAPIV2OperationsIDLinksLinkIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDLinksLinkIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WithExclude(exclude []string) *HeadAPIV2OperationsIDLinksLinkIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WithID(id string) *HeadAPIV2OperationsIDLinksLinkIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WithInclude(include []string) *HeadAPIV2OperationsIDLinksLinkIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) SetInclude(include []string) { + o.Include = include +} + +// WithLinkID adds the linkID to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WithLinkID(linkID string) *HeadAPIV2OperationsIDLinksLinkIDParams { + o.SetLinkID(linkID) + return o +} + +// SetLinkID adds the linkId to the head API v2 operations ID links link ID params +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) SetLinkID(linkID string) { + o.LinkID = linkID +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param link_id + if err := r.SetPathParam("link_id", o.LinkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2OperationsIDLinksLinkID binds the parameter exclude +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2OperationsIDLinksLinkID binds the parameter include +func (o *HeadAPIV2OperationsIDLinksLinkIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_responses.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_responses.go new file mode 100644 index 00000000..038004cc --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2OperationsIDLinksLinkIDReader is a Reader for the HeadAPIV2OperationsIDLinksLinkID structure. +type HeadAPIV2OperationsIDLinksLinkIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2OperationsIDLinksLinkIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2OperationsIDLinksLinkIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/operations/{id}/links/{link_id}] HeadAPIV2OperationsIDLinksLinkID", response, response.Code()) + } +} + +// NewHeadAPIV2OperationsIDLinksLinkIDOK creates a HeadAPIV2OperationsIDLinksLinkIDOK with default headers values +func NewHeadAPIV2OperationsIDLinksLinkIDOK() *HeadAPIV2OperationsIDLinksLinkIDOK { + return &HeadAPIV2OperationsIDLinksLinkIDOK{} +} + +/* +HeadAPIV2OperationsIDLinksLinkIDOK describes a response with status code 200, with default header values. + +The link matching the provided `link_id` within the operation matching `id`. Use fields from the `BaseGetOneQuerySchema` in the request body to add `include` and `exclude` filters. +*/ +type HeadAPIV2OperationsIDLinksLinkIDOK struct { + Payload *models.PartialLink +} + +// IsSuccess returns true when this head Api v2 operations Id links link Id o k response has a 2xx status code +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 operations Id links link Id o k response has a 3xx status code +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 operations Id links link Id o k response has a 4xx status code +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 operations Id links link Id o k response has a 5xx status code +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 operations Id links link Id o k response a status code equal to that given +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 operations Id links link Id o k response +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/links/{link_id}][%d] headApiV2OperationsIdLinksLinkIdOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/links/{link_id}][%d] headApiV2OperationsIdLinksLinkIdOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) GetPayload() *models.PartialLink { + return o.Payload +} + +func (o *HeadAPIV2OperationsIDLinksLinkIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialLink) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_result_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_result_parameters.go new file mode 100644 index 00000000..c0cb93e4 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_result_parameters.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewHeadAPIV2OperationsIDLinksLinkIDResultParams creates a new HeadAPIV2OperationsIDLinksLinkIDResultParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2OperationsIDLinksLinkIDResultParams() *HeadAPIV2OperationsIDLinksLinkIDResultParams { + return &HeadAPIV2OperationsIDLinksLinkIDResultParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2OperationsIDLinksLinkIDResultParamsWithTimeout creates a new HeadAPIV2OperationsIDLinksLinkIDResultParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2OperationsIDLinksLinkIDResultParamsWithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + return &HeadAPIV2OperationsIDLinksLinkIDResultParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2OperationsIDLinksLinkIDResultParamsWithContext creates a new HeadAPIV2OperationsIDLinksLinkIDResultParams object +// with the ability to set a context for a request. +func NewHeadAPIV2OperationsIDLinksLinkIDResultParamsWithContext(ctx context.Context) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + return &HeadAPIV2OperationsIDLinksLinkIDResultParams{ + Context: ctx, + } +} + +// NewHeadAPIV2OperationsIDLinksLinkIDResultParamsWithHTTPClient creates a new HeadAPIV2OperationsIDLinksLinkIDResultParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2OperationsIDLinksLinkIDResultParamsWithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + return &HeadAPIV2OperationsIDLinksLinkIDResultParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2OperationsIDLinksLinkIDResultParams contains all the parameters to send to the API endpoint + + for the head API v2 operations ID links link ID result operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2OperationsIDLinksLinkIDResultParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the operation object to be retrieved. + */ + ID string + + // Include. + Include []string + + /* LinkID. + + UUID of the link object to retrieve results of. + */ + LinkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 operations ID links link ID result params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WithDefaults() *HeadAPIV2OperationsIDLinksLinkIDResultParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 operations ID links link ID result params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WithContext(ctx context.Context) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WithExclude(exclude []string) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WithID(id string) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WithInclude(include []string) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) SetInclude(include []string) { + o.Include = include +} + +// WithLinkID adds the linkID to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WithLinkID(linkID string) *HeadAPIV2OperationsIDLinksLinkIDResultParams { + o.SetLinkID(linkID) + return o +} + +// SetLinkID adds the linkId to the head API v2 operations ID links link ID result params +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) SetLinkID(linkID string) { + o.LinkID = linkID +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param link_id + if err := r.SetPathParam("link_id", o.LinkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2OperationsIDLinksLinkIDResult binds the parameter exclude +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2OperationsIDLinksLinkIDResult binds the parameter include +func (o *HeadAPIV2OperationsIDLinksLinkIDResultParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_result_responses.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_result_responses.go new file mode 100644 index 00000000..220b0d7b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_link_id_result_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2OperationsIDLinksLinkIDResultReader is a Reader for the HeadAPIV2OperationsIDLinksLinkIDResult structure. +type HeadAPIV2OperationsIDLinksLinkIDResultReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2OperationsIDLinksLinkIDResultReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2OperationsIDLinksLinkIDResultOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/operations/{id}/links/{link_id}/result] HeadAPIV2OperationsIDLinksLinkIDResult", response, response.Code()) + } +} + +// NewHeadAPIV2OperationsIDLinksLinkIDResultOK creates a HeadAPIV2OperationsIDLinksLinkIDResultOK with default headers values +func NewHeadAPIV2OperationsIDLinksLinkIDResultOK() *HeadAPIV2OperationsIDLinksLinkIDResultOK { + return &HeadAPIV2OperationsIDLinksLinkIDResultOK{} +} + +/* +HeadAPIV2OperationsIDLinksLinkIDResultOK describes a response with status code 200, with default header values. + +Contains a dictionary with the requested link and its results dictionary. +*/ +type HeadAPIV2OperationsIDLinksLinkIDResultOK struct { + Payload *models.LinkResult +} + +// IsSuccess returns true when this head Api v2 operations Id links link Id result o k response has a 2xx status code +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 operations Id links link Id result o k response has a 3xx status code +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 operations Id links link Id result o k response has a 4xx status code +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 operations Id links link Id result o k response has a 5xx status code +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 operations Id links link Id result o k response a status code equal to that given +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 operations Id links link Id result o k response +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) Code() int { + return 200 +} + +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/links/{link_id}/result][%d] headApiV2OperationsIdLinksLinkIdResultOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/links/{link_id}/result][%d] headApiV2OperationsIdLinksLinkIdResultOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) GetPayload() *models.LinkResult { + return o.Payload +} + +func (o *HeadAPIV2OperationsIDLinksLinkIDResultOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.LinkResult) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_parameters.go new file mode 100644 index 00000000..c36b8503 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_parameters.go @@ -0,0 +1,264 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewHeadAPIV2OperationsIDLinksParams creates a new HeadAPIV2OperationsIDLinksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2OperationsIDLinksParams() *HeadAPIV2OperationsIDLinksParams { + return &HeadAPIV2OperationsIDLinksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2OperationsIDLinksParamsWithTimeout creates a new HeadAPIV2OperationsIDLinksParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2OperationsIDLinksParamsWithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDLinksParams { + return &HeadAPIV2OperationsIDLinksParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2OperationsIDLinksParamsWithContext creates a new HeadAPIV2OperationsIDLinksParams object +// with the ability to set a context for a request. +func NewHeadAPIV2OperationsIDLinksParamsWithContext(ctx context.Context) *HeadAPIV2OperationsIDLinksParams { + return &HeadAPIV2OperationsIDLinksParams{ + Context: ctx, + } +} + +// NewHeadAPIV2OperationsIDLinksParamsWithHTTPClient creates a new HeadAPIV2OperationsIDLinksParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2OperationsIDLinksParamsWithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDLinksParams { + return &HeadAPIV2OperationsIDLinksParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2OperationsIDLinksParams contains all the parameters to send to the API endpoint + + for the head API v2 operations ID links operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2OperationsIDLinksParams struct { + + // Exclude. + Exclude []string + + // ID. + ID string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 operations ID links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDLinksParams) WithDefaults() *HeadAPIV2OperationsIDLinksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 operations ID links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDLinksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) WithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDLinksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) WithContext(ctx context.Context) *HeadAPIV2OperationsIDLinksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) WithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDLinksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) WithExclude(exclude []string) *HeadAPIV2OperationsIDLinksParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) WithID(id string) *HeadAPIV2OperationsIDLinksParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) WithInclude(include []string) *HeadAPIV2OperationsIDLinksParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) WithSort(sort *string) *HeadAPIV2OperationsIDLinksParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 operations ID links params +func (o *HeadAPIV2OperationsIDLinksParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2OperationsIDLinksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2OperationsIDLinks binds the parameter exclude +func (o *HeadAPIV2OperationsIDLinksParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2OperationsIDLinks binds the parameter include +func (o *HeadAPIV2OperationsIDLinksParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_responses.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_responses.go new file mode 100644 index 00000000..72d776bc --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_links_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2OperationsIDLinksReader is a Reader for the HeadAPIV2OperationsIDLinks structure. +type HeadAPIV2OperationsIDLinksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2OperationsIDLinksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2OperationsIDLinksOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/operations/{id}/links] HeadAPIV2OperationsIDLinks", response, response.Code()) + } +} + +// NewHeadAPIV2OperationsIDLinksOK creates a HeadAPIV2OperationsIDLinksOK with default headers values +func NewHeadAPIV2OperationsIDLinksOK() *HeadAPIV2OperationsIDLinksOK { + return &HeadAPIV2OperationsIDLinksOK{} +} + +/* +HeadAPIV2OperationsIDLinksOK describes a response with status code 200, with default header values. + +All links contained in operation with the given `id` (String UUID). +*/ +type HeadAPIV2OperationsIDLinksOK struct { + Payload []*models.PartialLink +} + +// IsSuccess returns true when this head Api v2 operations Id links o k response has a 2xx status code +func (o *HeadAPIV2OperationsIDLinksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 operations Id links o k response has a 3xx status code +func (o *HeadAPIV2OperationsIDLinksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 operations Id links o k response has a 4xx status code +func (o *HeadAPIV2OperationsIDLinksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 operations Id links o k response has a 5xx status code +func (o *HeadAPIV2OperationsIDLinksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 operations Id links o k response a status code equal to that given +func (o *HeadAPIV2OperationsIDLinksOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 operations Id links o k response +func (o *HeadAPIV2OperationsIDLinksOK) Code() int { + return 200 +} + +func (o *HeadAPIV2OperationsIDLinksOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/links][%d] headApiV2OperationsIdLinksOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDLinksOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/links][%d] headApiV2OperationsIdLinksOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDLinksOK) GetPayload() []*models.PartialLink { + return o.Payload +} + +func (o *HeadAPIV2OperationsIDLinksOK) 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/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_parameters.go new file mode 100644 index 00000000..bbda31ad --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewHeadAPIV2OperationsIDParams creates a new HeadAPIV2OperationsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2OperationsIDParams() *HeadAPIV2OperationsIDParams { + return &HeadAPIV2OperationsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2OperationsIDParamsWithTimeout creates a new HeadAPIV2OperationsIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2OperationsIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDParams { + return &HeadAPIV2OperationsIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2OperationsIDParamsWithContext creates a new HeadAPIV2OperationsIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2OperationsIDParamsWithContext(ctx context.Context) *HeadAPIV2OperationsIDParams { + return &HeadAPIV2OperationsIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2OperationsIDParamsWithHTTPClient creates a new HeadAPIV2OperationsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2OperationsIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDParams { + return &HeadAPIV2OperationsIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2OperationsIDParams contains all the parameters to send to the API endpoint + + for the head API v2 operations ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2OperationsIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the Operation object to be retrieved. + */ + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 operations ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDParams) WithDefaults() *HeadAPIV2OperationsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 operations ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) WithContext(ctx context.Context) *HeadAPIV2OperationsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) WithExclude(exclude []string) *HeadAPIV2OperationsIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) WithID(id string) *HeadAPIV2OperationsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) WithInclude(include []string) *HeadAPIV2OperationsIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 operations ID params +func (o *HeadAPIV2OperationsIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2OperationsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2OperationsID binds the parameter exclude +func (o *HeadAPIV2OperationsIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2OperationsID binds the parameter include +func (o *HeadAPIV2OperationsIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_parameters.go new file mode 100644 index 00000000..3c3650e7 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_parameters.go @@ -0,0 +1,267 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewHeadAPIV2OperationsIDPotentialLinksParams creates a new HeadAPIV2OperationsIDPotentialLinksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2OperationsIDPotentialLinksParams() *HeadAPIV2OperationsIDPotentialLinksParams { + return &HeadAPIV2OperationsIDPotentialLinksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2OperationsIDPotentialLinksParamsWithTimeout creates a new HeadAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2OperationsIDPotentialLinksParamsWithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDPotentialLinksParams { + return &HeadAPIV2OperationsIDPotentialLinksParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2OperationsIDPotentialLinksParamsWithContext creates a new HeadAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a context for a request. +func NewHeadAPIV2OperationsIDPotentialLinksParamsWithContext(ctx context.Context) *HeadAPIV2OperationsIDPotentialLinksParams { + return &HeadAPIV2OperationsIDPotentialLinksParams{ + Context: ctx, + } +} + +// NewHeadAPIV2OperationsIDPotentialLinksParamsWithHTTPClient creates a new HeadAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2OperationsIDPotentialLinksParamsWithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDPotentialLinksParams { + return &HeadAPIV2OperationsIDPotentialLinksParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2OperationsIDPotentialLinksParams contains all the parameters to send to the API endpoint + + for the head API v2 operations ID potential links operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2OperationsIDPotentialLinksParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the operation object to retrieve links for. + */ + ID string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 operations ID potential links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WithDefaults() *HeadAPIV2OperationsIDPotentialLinksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 operations ID potential links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDPotentialLinksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDPotentialLinksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WithContext(ctx context.Context) *HeadAPIV2OperationsIDPotentialLinksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDPotentialLinksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WithExclude(exclude []string) *HeadAPIV2OperationsIDPotentialLinksParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WithID(id string) *HeadAPIV2OperationsIDPotentialLinksParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WithInclude(include []string) *HeadAPIV2OperationsIDPotentialLinksParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WithSort(sort *string) *HeadAPIV2OperationsIDPotentialLinksParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 operations ID potential links params +func (o *HeadAPIV2OperationsIDPotentialLinksParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2OperationsIDPotentialLinksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2OperationsIDPotentialLinks binds the parameter exclude +func (o *HeadAPIV2OperationsIDPotentialLinksParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2OperationsIDPotentialLinks binds the parameter include +func (o *HeadAPIV2OperationsIDPotentialLinksParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_paw_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_paw_parameters.go new file mode 100644 index 00000000..48253249 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_paw_parameters.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewHeadAPIV2OperationsIDPotentialLinksPawParams creates a new HeadAPIV2OperationsIDPotentialLinksPawParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2OperationsIDPotentialLinksPawParams() *HeadAPIV2OperationsIDPotentialLinksPawParams { + return &HeadAPIV2OperationsIDPotentialLinksPawParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2OperationsIDPotentialLinksPawParamsWithTimeout creates a new HeadAPIV2OperationsIDPotentialLinksPawParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2OperationsIDPotentialLinksPawParamsWithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDPotentialLinksPawParams { + return &HeadAPIV2OperationsIDPotentialLinksPawParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2OperationsIDPotentialLinksPawParamsWithContext creates a new HeadAPIV2OperationsIDPotentialLinksPawParams object +// with the ability to set a context for a request. +func NewHeadAPIV2OperationsIDPotentialLinksPawParamsWithContext(ctx context.Context) *HeadAPIV2OperationsIDPotentialLinksPawParams { + return &HeadAPIV2OperationsIDPotentialLinksPawParams{ + Context: ctx, + } +} + +// NewHeadAPIV2OperationsIDPotentialLinksPawParamsWithHTTPClient creates a new HeadAPIV2OperationsIDPotentialLinksPawParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2OperationsIDPotentialLinksPawParamsWithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDPotentialLinksPawParams { + return &HeadAPIV2OperationsIDPotentialLinksPawParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2OperationsIDPotentialLinksPawParams contains all the parameters to send to the API endpoint + + for the head API v2 operations ID potential links paw operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2OperationsIDPotentialLinksPawParams struct { + + // Exclude. + Exclude []string + + /* ID. + + String UUID of the Operation containing desired links. + */ + ID string + + // Include. + Include []string + + /* Paw. + + Agent paw for the specified operation. + */ + Paw string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 operations ID potential links paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WithDefaults() *HeadAPIV2OperationsIDPotentialLinksPawParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 operations ID potential links paw params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WithTimeout(timeout time.Duration) *HeadAPIV2OperationsIDPotentialLinksPawParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WithContext(ctx context.Context) *HeadAPIV2OperationsIDPotentialLinksPawParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WithHTTPClient(client *http.Client) *HeadAPIV2OperationsIDPotentialLinksPawParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WithExclude(exclude []string) *HeadAPIV2OperationsIDPotentialLinksPawParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WithID(id string) *HeadAPIV2OperationsIDPotentialLinksPawParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WithInclude(include []string) *HeadAPIV2OperationsIDPotentialLinksPawParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) SetInclude(include []string) { + o.Include = include +} + +// WithPaw adds the paw to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WithPaw(paw string) *HeadAPIV2OperationsIDPotentialLinksPawParams { + o.SetPaw(paw) + return o +} + +// SetPaw adds the paw to the head API v2 operations ID potential links paw params +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) SetPaw(paw string) { + o.Paw = paw +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param paw + if err := r.SetPathParam("paw", o.Paw); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2OperationsIDPotentialLinksPaw binds the parameter exclude +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2OperationsIDPotentialLinksPaw binds the parameter include +func (o *HeadAPIV2OperationsIDPotentialLinksPawParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_paw_responses.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_paw_responses.go new file mode 100644 index 00000000..bdfc6950 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_paw_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2OperationsIDPotentialLinksPawReader is a Reader for the HeadAPIV2OperationsIDPotentialLinksPaw structure. +type HeadAPIV2OperationsIDPotentialLinksPawReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2OperationsIDPotentialLinksPawReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2OperationsIDPotentialLinksPawOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/operations/{id}/potential-links/{paw}] HeadAPIV2OperationsIDPotentialLinksPaw", response, response.Code()) + } +} + +// NewHeadAPIV2OperationsIDPotentialLinksPawOK creates a HeadAPIV2OperationsIDPotentialLinksPawOK with default headers values +func NewHeadAPIV2OperationsIDPotentialLinksPawOK() *HeadAPIV2OperationsIDPotentialLinksPawOK { + return &HeadAPIV2OperationsIDPotentialLinksPawOK{} +} + +/* +HeadAPIV2OperationsIDPotentialLinksPawOK describes a response with status code 200, with default header values. + +All potential links for operation and the specified agent paw. +*/ +type HeadAPIV2OperationsIDPotentialLinksPawOK struct { + Payload *models.PartialLink +} + +// IsSuccess returns true when this head Api v2 operations Id potential links paw o k response has a 2xx status code +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 operations Id potential links paw o k response has a 3xx status code +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 operations Id potential links paw o k response has a 4xx status code +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 operations Id potential links paw o k response has a 5xx status code +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 operations Id potential links paw o k response a status code equal to that given +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 operations Id potential links paw o k response +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) Code() int { + return 200 +} + +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/potential-links/{paw}][%d] headApiV2OperationsIdPotentialLinksPawOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/potential-links/{paw}][%d] headApiV2OperationsIdPotentialLinksPawOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) GetPayload() *models.PartialLink { + return o.Payload +} + +func (o *HeadAPIV2OperationsIDPotentialLinksPawOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialLink) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_responses.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_responses.go new file mode 100644 index 00000000..8d9ac057 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_potential_links_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2OperationsIDPotentialLinksReader is a Reader for the HeadAPIV2OperationsIDPotentialLinks structure. +type HeadAPIV2OperationsIDPotentialLinksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2OperationsIDPotentialLinksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2OperationsIDPotentialLinksOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/operations/{id}/potential-links] HeadAPIV2OperationsIDPotentialLinks", response, response.Code()) + } +} + +// NewHeadAPIV2OperationsIDPotentialLinksOK creates a HeadAPIV2OperationsIDPotentialLinksOK with default headers values +func NewHeadAPIV2OperationsIDPotentialLinksOK() *HeadAPIV2OperationsIDPotentialLinksOK { + return &HeadAPIV2OperationsIDPotentialLinksOK{} +} + +/* +HeadAPIV2OperationsIDPotentialLinksOK describes a response with status code 200, with default header values. + +Response contains a list of link objects for the requested id. +*/ +type HeadAPIV2OperationsIDPotentialLinksOK struct { + Payload []*models.PartialLink +} + +// IsSuccess returns true when this head Api v2 operations Id potential links o k response has a 2xx status code +func (o *HeadAPIV2OperationsIDPotentialLinksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 operations Id potential links o k response has a 3xx status code +func (o *HeadAPIV2OperationsIDPotentialLinksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 operations Id potential links o k response has a 4xx status code +func (o *HeadAPIV2OperationsIDPotentialLinksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 operations Id potential links o k response has a 5xx status code +func (o *HeadAPIV2OperationsIDPotentialLinksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 operations Id potential links o k response a status code equal to that given +func (o *HeadAPIV2OperationsIDPotentialLinksOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 operations Id potential links o k response +func (o *HeadAPIV2OperationsIDPotentialLinksOK) Code() int { + return 200 +} + +func (o *HeadAPIV2OperationsIDPotentialLinksOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/potential-links][%d] headApiV2OperationsIdPotentialLinksOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDPotentialLinksOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}/potential-links][%d] headApiV2OperationsIdPotentialLinksOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDPotentialLinksOK) GetPayload() []*models.PartialLink { + return o.Payload +} + +func (o *HeadAPIV2OperationsIDPotentialLinksOK) 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/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_responses.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_responses.go new file mode 100644 index 00000000..8896c963 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2OperationsIDReader is a Reader for the HeadAPIV2OperationsID structure. +type HeadAPIV2OperationsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2OperationsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2OperationsIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/operations/{id}] HeadAPIV2OperationsID", response, response.Code()) + } +} + +// NewHeadAPIV2OperationsIDOK creates a HeadAPIV2OperationsIDOK with default headers values +func NewHeadAPIV2OperationsIDOK() *HeadAPIV2OperationsIDOK { + return &HeadAPIV2OperationsIDOK{} +} + +/* +HeadAPIV2OperationsIDOK describes a response with status code 200, with default header values. + +The response is the operation with the specified id, if any. +*/ +type HeadAPIV2OperationsIDOK struct { + Payload *models.PartialOperation +} + +// IsSuccess returns true when this head Api v2 operations Id o k response has a 2xx status code +func (o *HeadAPIV2OperationsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 operations Id o k response has a 3xx status code +func (o *HeadAPIV2OperationsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 operations Id o k response has a 4xx status code +func (o *HeadAPIV2OperationsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 operations Id o k response has a 5xx status code +func (o *HeadAPIV2OperationsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 operations Id o k response a status code equal to that given +func (o *HeadAPIV2OperationsIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 operations Id o k response +func (o *HeadAPIV2OperationsIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2OperationsIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}][%d] headApiV2OperationsIdOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/{id}][%d] headApiV2OperationsIdOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsIDOK) GetPayload() *models.PartialOperation { + return o.Payload +} + +func (o *HeadAPIV2OperationsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialOperation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_parameters.go new file mode 100644 index 00000000..a2d8f319 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewHeadAPIV2OperationsParams creates a new HeadAPIV2OperationsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2OperationsParams() *HeadAPIV2OperationsParams { + return &HeadAPIV2OperationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2OperationsParamsWithTimeout creates a new HeadAPIV2OperationsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2OperationsParamsWithTimeout(timeout time.Duration) *HeadAPIV2OperationsParams { + return &HeadAPIV2OperationsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2OperationsParamsWithContext creates a new HeadAPIV2OperationsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2OperationsParamsWithContext(ctx context.Context) *HeadAPIV2OperationsParams { + return &HeadAPIV2OperationsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2OperationsParamsWithHTTPClient creates a new HeadAPIV2OperationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2OperationsParamsWithHTTPClient(client *http.Client) *HeadAPIV2OperationsParams { + return &HeadAPIV2OperationsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2OperationsParams contains all the parameters to send to the API endpoint + + for the head API v2 operations operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2OperationsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 operations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsParams) WithDefaults() *HeadAPIV2OperationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 operations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) WithTimeout(timeout time.Duration) *HeadAPIV2OperationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) WithContext(ctx context.Context) *HeadAPIV2OperationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) WithHTTPClient(client *http.Client) *HeadAPIV2OperationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) WithExclude(exclude []string) *HeadAPIV2OperationsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) WithInclude(include []string) *HeadAPIV2OperationsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) WithSort(sort *string) *HeadAPIV2OperationsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 operations params +func (o *HeadAPIV2OperationsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2OperationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Operations binds the parameter exclude +func (o *HeadAPIV2OperationsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Operations binds the parameter include +func (o *HeadAPIV2OperationsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_responses.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_responses.go new file mode 100644 index 00000000..46253004 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2OperationsReader is a Reader for the HeadAPIV2Operations structure. +type HeadAPIV2OperationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2OperationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2OperationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/operations] HeadAPIV2Operations", response, response.Code()) + } +} + +// NewHeadAPIV2OperationsOK creates a HeadAPIV2OperationsOK with default headers values +func NewHeadAPIV2OperationsOK() *HeadAPIV2OperationsOK { + return &HeadAPIV2OperationsOK{} +} + +/* +HeadAPIV2OperationsOK describes a response with status code 200, with default header values. + +The response is a list of all operations. +*/ +type HeadAPIV2OperationsOK struct { + Payload []*models.PartialOperation +} + +// IsSuccess returns true when this head Api v2 operations o k response has a 2xx status code +func (o *HeadAPIV2OperationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 operations o k response has a 3xx status code +func (o *HeadAPIV2OperationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 operations o k response has a 4xx status code +func (o *HeadAPIV2OperationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 operations o k response has a 5xx status code +func (o *HeadAPIV2OperationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 operations o k response a status code equal to that given +func (o *HeadAPIV2OperationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 operations o k response +func (o *HeadAPIV2OperationsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2OperationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations][%d] headApiV2OperationsOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations][%d] headApiV2OperationsOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsOK) GetPayload() []*models.PartialOperation { + return o.Payload +} + +func (o *HeadAPIV2OperationsOK) 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/core/capability/caldera/api/client/operationsops/head_api_v2_operations_summary_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_summary_parameters.go new file mode 100644 index 00000000..3da5ecf1 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_summary_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" +) + +// NewHeadAPIV2OperationsSummaryParams creates a new HeadAPIV2OperationsSummaryParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2OperationsSummaryParams() *HeadAPIV2OperationsSummaryParams { + return &HeadAPIV2OperationsSummaryParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2OperationsSummaryParamsWithTimeout creates a new HeadAPIV2OperationsSummaryParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2OperationsSummaryParamsWithTimeout(timeout time.Duration) *HeadAPIV2OperationsSummaryParams { + return &HeadAPIV2OperationsSummaryParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2OperationsSummaryParamsWithContext creates a new HeadAPIV2OperationsSummaryParams object +// with the ability to set a context for a request. +func NewHeadAPIV2OperationsSummaryParamsWithContext(ctx context.Context) *HeadAPIV2OperationsSummaryParams { + return &HeadAPIV2OperationsSummaryParams{ + Context: ctx, + } +} + +// NewHeadAPIV2OperationsSummaryParamsWithHTTPClient creates a new HeadAPIV2OperationsSummaryParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2OperationsSummaryParamsWithHTTPClient(client *http.Client) *HeadAPIV2OperationsSummaryParams { + return &HeadAPIV2OperationsSummaryParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2OperationsSummaryParams contains all the parameters to send to the API endpoint + + for the head API v2 operations summary operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2OperationsSummaryParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 operations summary params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsSummaryParams) WithDefaults() *HeadAPIV2OperationsSummaryParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 operations summary params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2OperationsSummaryParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) WithTimeout(timeout time.Duration) *HeadAPIV2OperationsSummaryParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) WithContext(ctx context.Context) *HeadAPIV2OperationsSummaryParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) WithHTTPClient(client *http.Client) *HeadAPIV2OperationsSummaryParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) WithExclude(exclude []string) *HeadAPIV2OperationsSummaryParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) WithInclude(include []string) *HeadAPIV2OperationsSummaryParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) WithSort(sort *string) *HeadAPIV2OperationsSummaryParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 operations summary params +func (o *HeadAPIV2OperationsSummaryParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2OperationsSummaryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2OperationsSummary binds the parameter exclude +func (o *HeadAPIV2OperationsSummaryParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2OperationsSummary binds the parameter include +func (o *HeadAPIV2OperationsSummaryParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_summary_responses.go b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_summary_responses.go new file mode 100644 index 00000000..e58ab81f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/head_api_v2_operations_summary_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2OperationsSummaryReader is a Reader for the HeadAPIV2OperationsSummary structure. +type HeadAPIV2OperationsSummaryReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2OperationsSummaryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2OperationsSummaryOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/operations/summary] HeadAPIV2OperationsSummary", response, response.Code()) + } +} + +// NewHeadAPIV2OperationsSummaryOK creates a HeadAPIV2OperationsSummaryOK with default headers values +func NewHeadAPIV2OperationsSummaryOK() *HeadAPIV2OperationsSummaryOK { + return &HeadAPIV2OperationsSummaryOK{} +} + +/* +HeadAPIV2OperationsSummaryOK describes a response with status code 200, with default header values. + +The response is a list of all operations. +*/ +type HeadAPIV2OperationsSummaryOK struct { + Payload []*models.PartialOperationSchemaAlt +} + +// IsSuccess returns true when this head Api v2 operations summary o k response has a 2xx status code +func (o *HeadAPIV2OperationsSummaryOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 operations summary o k response has a 3xx status code +func (o *HeadAPIV2OperationsSummaryOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 operations summary o k response has a 4xx status code +func (o *HeadAPIV2OperationsSummaryOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 operations summary o k response has a 5xx status code +func (o *HeadAPIV2OperationsSummaryOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 operations summary o k response a status code equal to that given +func (o *HeadAPIV2OperationsSummaryOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 operations summary o k response +func (o *HeadAPIV2OperationsSummaryOK) Code() int { + return 200 +} + +func (o *HeadAPIV2OperationsSummaryOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/summary][%d] headApiV2OperationsSummaryOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsSummaryOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/operations/summary][%d] headApiV2OperationsSummaryOK %s", 200, payload) +} + +func (o *HeadAPIV2OperationsSummaryOK) GetPayload() []*models.PartialOperationSchemaAlt { + return o.Payload +} + +func (o *HeadAPIV2OperationsSummaryOK) 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/core/capability/caldera/api/client/operationsops/operationsops_client.go b/pkg/core/capability/caldera/api/client/operationsops/operationsops_client.go new file mode 100644 index 00000000..ca5fa4c9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/operationsops_client.go @@ -0,0 +1,1031 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new operationsops API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new operationsops API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new operationsops API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for operationsops API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2OperationsID(params *DeleteAPIV2OperationsIDParams, opts ...ClientOption) (*DeleteAPIV2OperationsIDOK, error) + + GetAPIV2Operations(params *GetAPIV2OperationsParams, opts ...ClientOption) (*GetAPIV2OperationsOK, error) + + GetAPIV2OperationsID(params *GetAPIV2OperationsIDParams, opts ...ClientOption) (*GetAPIV2OperationsIDOK, error) + + GetAPIV2OperationsIDLinks(params *GetAPIV2OperationsIDLinksParams, opts ...ClientOption) (*GetAPIV2OperationsIDLinksOK, error) + + GetAPIV2OperationsIDLinksLinkID(params *GetAPIV2OperationsIDLinksLinkIDParams, opts ...ClientOption) (*GetAPIV2OperationsIDLinksLinkIDOK, error) + + GetAPIV2OperationsIDLinksLinkIDResult(params *GetAPIV2OperationsIDLinksLinkIDResultParams, opts ...ClientOption) (*GetAPIV2OperationsIDLinksLinkIDResultOK, error) + + GetAPIV2OperationsIDPotentialLinks(params *GetAPIV2OperationsIDPotentialLinksParams, opts ...ClientOption) (*GetAPIV2OperationsIDPotentialLinksOK, error) + + GetAPIV2OperationsIDPotentialLinksPaw(params *GetAPIV2OperationsIDPotentialLinksPawParams, opts ...ClientOption) (*GetAPIV2OperationsIDPotentialLinksPawOK, error) + + GetAPIV2OperationsSummary(params *GetAPIV2OperationsSummaryParams, opts ...ClientOption) (*GetAPIV2OperationsSummaryOK, error) + + HeadAPIV2Operations(params *HeadAPIV2OperationsParams, opts ...ClientOption) (*HeadAPIV2OperationsOK, error) + + HeadAPIV2OperationsID(params *HeadAPIV2OperationsIDParams, opts ...ClientOption) (*HeadAPIV2OperationsIDOK, error) + + HeadAPIV2OperationsIDLinks(params *HeadAPIV2OperationsIDLinksParams, opts ...ClientOption) (*HeadAPIV2OperationsIDLinksOK, error) + + HeadAPIV2OperationsIDLinksLinkID(params *HeadAPIV2OperationsIDLinksLinkIDParams, opts ...ClientOption) (*HeadAPIV2OperationsIDLinksLinkIDOK, error) + + HeadAPIV2OperationsIDLinksLinkIDResult(params *HeadAPIV2OperationsIDLinksLinkIDResultParams, opts ...ClientOption) (*HeadAPIV2OperationsIDLinksLinkIDResultOK, error) + + HeadAPIV2OperationsIDPotentialLinks(params *HeadAPIV2OperationsIDPotentialLinksParams, opts ...ClientOption) (*HeadAPIV2OperationsIDPotentialLinksOK, error) + + HeadAPIV2OperationsIDPotentialLinksPaw(params *HeadAPIV2OperationsIDPotentialLinksPawParams, opts ...ClientOption) (*HeadAPIV2OperationsIDPotentialLinksPawOK, error) + + HeadAPIV2OperationsSummary(params *HeadAPIV2OperationsSummaryParams, opts ...ClientOption) (*HeadAPIV2OperationsSummaryOK, error) + + PatchAPIV2OperationsID(params *PatchAPIV2OperationsIDParams, opts ...ClientOption) (*PatchAPIV2OperationsIDOK, error) + + PatchAPIV2OperationsIDLinksLinkID(params *PatchAPIV2OperationsIDLinksLinkIDParams, opts ...ClientOption) (*PatchAPIV2OperationsIDLinksLinkIDOK, error) + + PostAPIV2Operations(params *PostAPIV2OperationsParams, opts ...ClientOption) (*PostAPIV2OperationsOK, error) + + PostAPIV2OperationsIDEventLogs(params *PostAPIV2OperationsIDEventLogsParams, opts ...ClientOption) (*PostAPIV2OperationsIDEventLogsOK, error) + + PostAPIV2OperationsIDPotentialLinks(params *PostAPIV2OperationsIDPotentialLinksParams, opts ...ClientOption) (*PostAPIV2OperationsIDPotentialLinksOK, error) + + PostAPIV2OperationsIDReport(params *PostAPIV2OperationsIDReportParams, opts ...ClientOption) (*PostAPIV2OperationsIDReportOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2OperationsID deletes an operation by operation id + +Delete one Caldera operation from memory based on the operation id (String UUID). +*/ +func (a *Client) DeleteAPIV2OperationsID(params *DeleteAPIV2OperationsIDParams, opts ...ClientOption) (*DeleteAPIV2OperationsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2OperationsIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2OperationsID", + Method: "DELETE", + PathPattern: "/api/v2/operations/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2OperationsIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2OperationsIDOK) + 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 DeleteAPIV2OperationsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Operations retrieves operations + +Retrieve all Caldera operations from memory. Use fields from the `BaseGetAllQuerySchema` in the request body to filter. +*/ +func (a *Client) GetAPIV2Operations(params *GetAPIV2OperationsParams, opts ...ClientOption) (*GetAPIV2OperationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2OperationsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Operations", + Method: "GET", + PathPattern: "/api/v2/operations", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2OperationsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2OperationsOK) + 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 GetAPIV2Operations: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2OperationsID retrieves an operation by operation id + +Retrieve one Caldera operation from memory based on the operation id (String UUID). Use fields from the `BaseGetOneQuerySchema` in the request body to add `include` and `exclude` filters. +*/ +func (a *Client) GetAPIV2OperationsID(params *GetAPIV2OperationsIDParams, opts ...ClientOption) (*GetAPIV2OperationsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2OperationsIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2OperationsID", + Method: "GET", + PathPattern: "/api/v2/operations/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2OperationsIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2OperationsIDOK) + 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 GetAPIV2OperationsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2OperationsIDLinks gets links from operation + +Retrieves all links for a given operation_id. +*/ +func (a *Client) GetAPIV2OperationsIDLinks(params *GetAPIV2OperationsIDLinksParams, opts ...ClientOption) (*GetAPIV2OperationsIDLinksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2OperationsIDLinksParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2OperationsIDLinks", + Method: "GET", + PathPattern: "/api/v2/operations/{id}/links", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2OperationsIDLinksReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2OperationsIDLinksOK) + 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 GetAPIV2OperationsIDLinks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2OperationsIDLinksLinkID retrieves a specified link from an operation + +Retrieve the link with the provided `link_id` (String UUID) from the operation with the given operation `id` (String UUID). Use fields from the `BaseGetOneQuerySchema` in the request body to add `include` and `exclude` filters. +*/ +func (a *Client) GetAPIV2OperationsIDLinksLinkID(params *GetAPIV2OperationsIDLinksLinkIDParams, opts ...ClientOption) (*GetAPIV2OperationsIDLinksLinkIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2OperationsIDLinksLinkIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2OperationsIDLinksLinkID", + Method: "GET", + PathPattern: "/api/v2/operations/{id}/links/{link_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2OperationsIDLinksLinkIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2OperationsIDLinksLinkIDOK) + 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 GetAPIV2OperationsIDLinksLinkID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2OperationsIDLinksLinkIDResult retrieves the result of a link + +Retrieve a dictionary containing a link and its results dictionary based on the operation id (String UUID) and link id (String UUID). Use fields from the `BaseGetOneQuerySchema` in the request body to add `include` and `exclude` filters. +*/ +func (a *Client) GetAPIV2OperationsIDLinksLinkIDResult(params *GetAPIV2OperationsIDLinksLinkIDResultParams, opts ...ClientOption) (*GetAPIV2OperationsIDLinksLinkIDResultOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2OperationsIDLinksLinkIDResultParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2OperationsIDLinksLinkIDResult", + Method: "GET", + PathPattern: "/api/v2/operations/{id}/links/{link_id}/result", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2OperationsIDLinksLinkIDResultReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2OperationsIDLinksLinkIDResultOK) + 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 GetAPIV2OperationsIDLinksLinkIDResult: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2OperationsIDPotentialLinks retrieves potential links for an operation + +Retrieve all potential links for an operation based on the operation id (String UUID). Use fields from the `BaseGetAllQuerySchema` in the request body to add `include`, `exclude`, and `sort` filters. +*/ +func (a *Client) GetAPIV2OperationsIDPotentialLinks(params *GetAPIV2OperationsIDPotentialLinksParams, opts ...ClientOption) (*GetAPIV2OperationsIDPotentialLinksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2OperationsIDPotentialLinksParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2OperationsIDPotentialLinks", + Method: "GET", + PathPattern: "/api/v2/operations/{id}/potential-links", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2OperationsIDPotentialLinksReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2OperationsIDPotentialLinksOK) + 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 GetAPIV2OperationsIDPotentialLinks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2OperationsIDPotentialLinksPaw retrieves potential links for an operation filterd by agent paw id + +Retrieve all potential links for an operation-agent pair based on the operation id (String UUID) and the agent paw (id) (String). Use fields from the `BaseGetAllQuerySchema` in the request body to add `include`, `exclude`, and `sort` filters. +*/ +func (a *Client) GetAPIV2OperationsIDPotentialLinksPaw(params *GetAPIV2OperationsIDPotentialLinksPawParams, opts ...ClientOption) (*GetAPIV2OperationsIDPotentialLinksPawOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2OperationsIDPotentialLinksPawParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2OperationsIDPotentialLinksPaw", + Method: "GET", + PathPattern: "/api/v2/operations/{id}/potential-links/{paw}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2OperationsIDPotentialLinksPawReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2OperationsIDPotentialLinksPawOK) + 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 GetAPIV2OperationsIDPotentialLinksPaw: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2OperationsSummary retrieves operations alternate + +Retrieve all Caldera operations from memory, with an alternate selection of properties. Use fields from the `BaseGetAllQuerySchema` in the request body to filter. +*/ +func (a *Client) GetAPIV2OperationsSummary(params *GetAPIV2OperationsSummaryParams, opts ...ClientOption) (*GetAPIV2OperationsSummaryOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2OperationsSummaryParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2OperationsSummary", + Method: "GET", + PathPattern: "/api/v2/operations/summary", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2OperationsSummaryReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2OperationsSummaryOK) + 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 GetAPIV2OperationsSummary: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Operations retrieves operations + +Retrieve all Caldera operations from memory. Use fields from the `BaseGetAllQuerySchema` in the request body to filter. +*/ +func (a *Client) HeadAPIV2Operations(params *HeadAPIV2OperationsParams, opts ...ClientOption) (*HeadAPIV2OperationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2OperationsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Operations", + Method: "HEAD", + PathPattern: "/api/v2/operations", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2OperationsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2OperationsOK) + 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 HeadAPIV2Operations: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2OperationsID retrieves an operation by operation id + +Retrieve one Caldera operation from memory based on the operation id (String UUID). Use fields from the `BaseGetOneQuerySchema` in the request body to add `include` and `exclude` filters. +*/ +func (a *Client) HeadAPIV2OperationsID(params *HeadAPIV2OperationsIDParams, opts ...ClientOption) (*HeadAPIV2OperationsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2OperationsIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2OperationsID", + Method: "HEAD", + PathPattern: "/api/v2/operations/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2OperationsIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2OperationsIDOK) + 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 HeadAPIV2OperationsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2OperationsIDLinks gets links from operation + +Retrieves all links for a given operation_id. +*/ +func (a *Client) HeadAPIV2OperationsIDLinks(params *HeadAPIV2OperationsIDLinksParams, opts ...ClientOption) (*HeadAPIV2OperationsIDLinksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2OperationsIDLinksParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2OperationsIDLinks", + Method: "HEAD", + PathPattern: "/api/v2/operations/{id}/links", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2OperationsIDLinksReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2OperationsIDLinksOK) + 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 HeadAPIV2OperationsIDLinks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2OperationsIDLinksLinkID retrieves a specified link from an operation + +Retrieve the link with the provided `link_id` (String UUID) from the operation with the given operation `id` (String UUID). Use fields from the `BaseGetOneQuerySchema` in the request body to add `include` and `exclude` filters. +*/ +func (a *Client) HeadAPIV2OperationsIDLinksLinkID(params *HeadAPIV2OperationsIDLinksLinkIDParams, opts ...ClientOption) (*HeadAPIV2OperationsIDLinksLinkIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2OperationsIDLinksLinkIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2OperationsIDLinksLinkID", + Method: "HEAD", + PathPattern: "/api/v2/operations/{id}/links/{link_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2OperationsIDLinksLinkIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2OperationsIDLinksLinkIDOK) + 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 HeadAPIV2OperationsIDLinksLinkID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2OperationsIDLinksLinkIDResult retrieves the result of a link + +Retrieve a dictionary containing a link and its results dictionary based on the operation id (String UUID) and link id (String UUID). Use fields from the `BaseGetOneQuerySchema` in the request body to add `include` and `exclude` filters. +*/ +func (a *Client) HeadAPIV2OperationsIDLinksLinkIDResult(params *HeadAPIV2OperationsIDLinksLinkIDResultParams, opts ...ClientOption) (*HeadAPIV2OperationsIDLinksLinkIDResultOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2OperationsIDLinksLinkIDResultParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2OperationsIDLinksLinkIDResult", + Method: "HEAD", + PathPattern: "/api/v2/operations/{id}/links/{link_id}/result", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2OperationsIDLinksLinkIDResultReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2OperationsIDLinksLinkIDResultOK) + 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 HeadAPIV2OperationsIDLinksLinkIDResult: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2OperationsIDPotentialLinks retrieves potential links for an operation + +Retrieve all potential links for an operation based on the operation id (String UUID). Use fields from the `BaseGetAllQuerySchema` in the request body to add `include`, `exclude`, and `sort` filters. +*/ +func (a *Client) HeadAPIV2OperationsIDPotentialLinks(params *HeadAPIV2OperationsIDPotentialLinksParams, opts ...ClientOption) (*HeadAPIV2OperationsIDPotentialLinksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2OperationsIDPotentialLinksParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2OperationsIDPotentialLinks", + Method: "HEAD", + PathPattern: "/api/v2/operations/{id}/potential-links", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2OperationsIDPotentialLinksReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2OperationsIDPotentialLinksOK) + 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 HeadAPIV2OperationsIDPotentialLinks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2OperationsIDPotentialLinksPaw retrieves potential links for an operation filterd by agent paw id + +Retrieve all potential links for an operation-agent pair based on the operation id (String UUID) and the agent paw (id) (String). Use fields from the `BaseGetAllQuerySchema` in the request body to add `include`, `exclude`, and `sort` filters. +*/ +func (a *Client) HeadAPIV2OperationsIDPotentialLinksPaw(params *HeadAPIV2OperationsIDPotentialLinksPawParams, opts ...ClientOption) (*HeadAPIV2OperationsIDPotentialLinksPawOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2OperationsIDPotentialLinksPawParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2OperationsIDPotentialLinksPaw", + Method: "HEAD", + PathPattern: "/api/v2/operations/{id}/potential-links/{paw}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2OperationsIDPotentialLinksPawReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2OperationsIDPotentialLinksPawOK) + 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 HeadAPIV2OperationsIDPotentialLinksPaw: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2OperationsSummary retrieves operations alternate + +Retrieve all Caldera operations from memory, with an alternate selection of properties. Use fields from the `BaseGetAllQuerySchema` in the request body to filter. +*/ +func (a *Client) HeadAPIV2OperationsSummary(params *HeadAPIV2OperationsSummaryParams, opts ...ClientOption) (*HeadAPIV2OperationsSummaryOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2OperationsSummaryParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2OperationsSummary", + Method: "HEAD", + PathPattern: "/api/v2/operations/summary", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2OperationsSummaryReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2OperationsSummaryOK) + 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 HeadAPIV2OperationsSummary: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2OperationsID updates fields within an operation + +Update one Caldera operation in memory based on the operation id (String UUID). The `state`, `autonomous` and `obfuscator` fields in the operation object may be edited in the request body using the `OperationSchema`. +*/ +func (a *Client) PatchAPIV2OperationsID(params *PatchAPIV2OperationsIDParams, opts ...ClientOption) (*PatchAPIV2OperationsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2OperationsIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2OperationsID", + Method: "PATCH", + PathPattern: "/api/v2/operations/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2OperationsIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2OperationsIDOK) + 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 PatchAPIV2OperationsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2OperationsIDLinksLinkID updates the specified link within an operation + +Update the `command` (String) or `status` (Integer) field within the link with the provided `link_id` (String UUID) from the operation with the given operation `id` (String UUID). +*/ +func (a *Client) PatchAPIV2OperationsIDLinksLinkID(params *PatchAPIV2OperationsIDLinksLinkIDParams, opts ...ClientOption) (*PatchAPIV2OperationsIDLinksLinkIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2OperationsIDLinksLinkIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2OperationsIDLinksLinkID", + Method: "PATCH", + PathPattern: "/api/v2/operations/{id}/links/{link_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2OperationsIDLinksLinkIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2OperationsIDLinksLinkIDOK) + 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 PatchAPIV2OperationsIDLinksLinkID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Operations creates a new caldera operation record + +Create a new Caldera operation using the format provided in the `OperationSchema`. Required schema fields are as follows: "name", "adversary.adversary_id", "planner.id", and "source.id" +*/ +func (a *Client) PostAPIV2Operations(params *PostAPIV2OperationsParams, opts ...ClientOption) (*PostAPIV2OperationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2OperationsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Operations", + Method: "POST", + PathPattern: "/api/v2/operations", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2OperationsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2OperationsOK) + 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 PostAPIV2Operations: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2OperationsIDEventLogs gets operation event logs + +Retrieves the event logs for a given operation_id. +*/ +func (a *Client) PostAPIV2OperationsIDEventLogs(params *PostAPIV2OperationsIDEventLogsParams, opts ...ClientOption) (*PostAPIV2OperationsIDEventLogsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2OperationsIDEventLogsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2OperationsIDEventLogs", + Method: "POST", + PathPattern: "/api/v2/operations/{id}/event-logs", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2OperationsIDEventLogsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2OperationsIDEventLogsOK) + 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 PostAPIV2OperationsIDEventLogs: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2OperationsIDPotentialLinks creates a potential link + +Creates a potential link to be executed by an agent. Create a potential Link using the format provided in the `LinkSchema`. The request body requires `paw`, `executor`, and `ability`. +*/ +func (a *Client) PostAPIV2OperationsIDPotentialLinks(params *PostAPIV2OperationsIDPotentialLinksParams, opts ...ClientOption) (*PostAPIV2OperationsIDPotentialLinksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2OperationsIDPotentialLinksParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2OperationsIDPotentialLinks", + Method: "POST", + PathPattern: "/api/v2/operations/{id}/potential-links", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2OperationsIDPotentialLinksReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2OperationsIDPotentialLinksOK) + 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 PostAPIV2OperationsIDPotentialLinks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2OperationsIDReport gets operation report + +Retrieves the report for a given operation_id. +*/ +func (a *Client) PostAPIV2OperationsIDReport(params *PostAPIV2OperationsIDReportParams, opts ...ClientOption) (*PostAPIV2OperationsIDReportOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2OperationsIDReportParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2OperationsIDReport", + Method: "POST", + PathPattern: "/api/v2/operations/{id}/report", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2OperationsIDReportReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2OperationsIDReportOK) + 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 PostAPIV2OperationsIDReport: 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/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_links_link_id_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_links_link_id_parameters.go new file mode 100644 index 00000000..80a2a4f5 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_links_link_id_parameters.go @@ -0,0 +1,194 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2OperationsIDLinksLinkIDParams creates a new PatchAPIV2OperationsIDLinksLinkIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2OperationsIDLinksLinkIDParams() *PatchAPIV2OperationsIDLinksLinkIDParams { + return &PatchAPIV2OperationsIDLinksLinkIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2OperationsIDLinksLinkIDParamsWithTimeout creates a new PatchAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2OperationsIDLinksLinkIDParamsWithTimeout(timeout time.Duration) *PatchAPIV2OperationsIDLinksLinkIDParams { + return &PatchAPIV2OperationsIDLinksLinkIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2OperationsIDLinksLinkIDParamsWithContext creates a new PatchAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a context for a request. +func NewPatchAPIV2OperationsIDLinksLinkIDParamsWithContext(ctx context.Context) *PatchAPIV2OperationsIDLinksLinkIDParams { + return &PatchAPIV2OperationsIDLinksLinkIDParams{ + Context: ctx, + } +} + +// NewPatchAPIV2OperationsIDLinksLinkIDParamsWithHTTPClient creates a new PatchAPIV2OperationsIDLinksLinkIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2OperationsIDLinksLinkIDParamsWithHTTPClient(client *http.Client) *PatchAPIV2OperationsIDLinksLinkIDParams { + return &PatchAPIV2OperationsIDLinksLinkIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2OperationsIDLinksLinkIDParams contains all the parameters to send to the API endpoint + + for the patch API v2 operations ID links link ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2OperationsIDLinksLinkIDParams struct { + + // Body. + Body *models.PartialLink1 + + /* ID. + + String UUID of the Operation containing desired link. + */ + ID string + + /* LinkID. + + String UUID of the Link with the above operation. + */ + LinkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 operations ID links link ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) WithDefaults() *PatchAPIV2OperationsIDLinksLinkIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 operations ID links link ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) WithTimeout(timeout time.Duration) *PatchAPIV2OperationsIDLinksLinkIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) WithContext(ctx context.Context) *PatchAPIV2OperationsIDLinksLinkIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) WithHTTPClient(client *http.Client) *PatchAPIV2OperationsIDLinksLinkIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) WithBody(body *models.PartialLink1) *PatchAPIV2OperationsIDLinksLinkIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) SetBody(body *models.PartialLink1) { + o.Body = body +} + +// WithID adds the id to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) WithID(id string) *PatchAPIV2OperationsIDLinksLinkIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) SetID(id string) { + o.ID = id +} + +// WithLinkID adds the linkID to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) WithLinkID(linkID string) *PatchAPIV2OperationsIDLinksLinkIDParams { + o.SetLinkID(linkID) + return o +} + +// SetLinkID adds the linkId to the patch API v2 operations ID links link ID params +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) SetLinkID(linkID string) { + o.LinkID = linkID +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2OperationsIDLinksLinkIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param link_id + if err := r.SetPathParam("link_id", o.LinkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_links_link_id_responses.go b/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_links_link_id_responses.go new file mode 100644 index 00000000..5a9fdb9e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_links_link_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2OperationsIDLinksLinkIDReader is a Reader for the PatchAPIV2OperationsIDLinksLinkID structure. +type PatchAPIV2OperationsIDLinksLinkIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2OperationsIDLinksLinkIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2OperationsIDLinksLinkIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/operations/{id}/links/{link_id}] PatchAPIV2OperationsIDLinksLinkID", response, response.Code()) + } +} + +// NewPatchAPIV2OperationsIDLinksLinkIDOK creates a PatchAPIV2OperationsIDLinksLinkIDOK with default headers values +func NewPatchAPIV2OperationsIDLinksLinkIDOK() *PatchAPIV2OperationsIDLinksLinkIDOK { + return &PatchAPIV2OperationsIDLinksLinkIDOK{} +} + +/* +PatchAPIV2OperationsIDLinksLinkIDOK describes a response with status code 200, with default header values. + +The updated link after a successful `PATCH` request. +*/ +type PatchAPIV2OperationsIDLinksLinkIDOK struct { + Payload *models.Link +} + +// IsSuccess returns true when this patch Api v2 operations Id links link Id o k response has a 2xx status code +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 operations Id links link Id o k response has a 3xx status code +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 operations Id links link Id o k response has a 4xx status code +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 operations Id links link Id o k response has a 5xx status code +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 operations Id links link Id o k response a status code equal to that given +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 operations Id links link Id o k response +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) Code() int { + return 200 +} + +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/operations/{id}/links/{link_id}][%d] patchApiV2OperationsIdLinksLinkIdOK %s", 200, payload) +} + +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/operations/{id}/links/{link_id}][%d] patchApiV2OperationsIdLinksLinkIdOK %s", 200, payload) +} + +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) GetPayload() *models.Link { + return o.Payload +} + +func (o *PatchAPIV2OperationsIDLinksLinkIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Link) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_parameters.go new file mode 100644 index 00000000..091f9c4a --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2OperationsIDParams creates a new PatchAPIV2OperationsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2OperationsIDParams() *PatchAPIV2OperationsIDParams { + return &PatchAPIV2OperationsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2OperationsIDParamsWithTimeout creates a new PatchAPIV2OperationsIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2OperationsIDParamsWithTimeout(timeout time.Duration) *PatchAPIV2OperationsIDParams { + return &PatchAPIV2OperationsIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2OperationsIDParamsWithContext creates a new PatchAPIV2OperationsIDParams object +// with the ability to set a context for a request. +func NewPatchAPIV2OperationsIDParamsWithContext(ctx context.Context) *PatchAPIV2OperationsIDParams { + return &PatchAPIV2OperationsIDParams{ + Context: ctx, + } +} + +// NewPatchAPIV2OperationsIDParamsWithHTTPClient creates a new PatchAPIV2OperationsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2OperationsIDParamsWithHTTPClient(client *http.Client) *PatchAPIV2OperationsIDParams { + return &PatchAPIV2OperationsIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2OperationsIDParams contains all the parameters to send to the API endpoint + + for the patch API v2 operations ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2OperationsIDParams struct { + + // Body. + Body *models.PartialOperation1 + + /* ID. + + UUID of the Operation object to be retrieved. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 operations ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2OperationsIDParams) WithDefaults() *PatchAPIV2OperationsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 operations ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2OperationsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) WithTimeout(timeout time.Duration) *PatchAPIV2OperationsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) WithContext(ctx context.Context) *PatchAPIV2OperationsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) WithHTTPClient(client *http.Client) *PatchAPIV2OperationsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) WithBody(body *models.PartialOperation1) *PatchAPIV2OperationsIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) SetBody(body *models.PartialOperation1) { + o.Body = body +} + +// WithID adds the id to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) WithID(id string) *PatchAPIV2OperationsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API v2 operations ID params +func (o *PatchAPIV2OperationsIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2OperationsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_responses.go b/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_responses.go new file mode 100644 index 00000000..8fcf4f1c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/patch_api_v2_operations_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2OperationsIDReader is a Reader for the PatchAPIV2OperationsID structure. +type PatchAPIV2OperationsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2OperationsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2OperationsIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/operations/{id}] PatchAPIV2OperationsID", response, response.Code()) + } +} + +// NewPatchAPIV2OperationsIDOK creates a PatchAPIV2OperationsIDOK with default headers values +func NewPatchAPIV2OperationsIDOK() *PatchAPIV2OperationsIDOK { + return &PatchAPIV2OperationsIDOK{} +} + +/* +PatchAPIV2OperationsIDOK describes a response with status code 200, with default header values. + +The response is the updated operation, including user modifications. +*/ +type PatchAPIV2OperationsIDOK struct { + Payload *models.PartialOperation +} + +// IsSuccess returns true when this patch Api v2 operations Id o k response has a 2xx status code +func (o *PatchAPIV2OperationsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 operations Id o k response has a 3xx status code +func (o *PatchAPIV2OperationsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 operations Id o k response has a 4xx status code +func (o *PatchAPIV2OperationsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 operations Id o k response has a 5xx status code +func (o *PatchAPIV2OperationsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 operations Id o k response a status code equal to that given +func (o *PatchAPIV2OperationsIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 operations Id o k response +func (o *PatchAPIV2OperationsIDOK) Code() int { + return 200 +} + +func (o *PatchAPIV2OperationsIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/operations/{id}][%d] patchApiV2OperationsIdOK %s", 200, payload) +} + +func (o *PatchAPIV2OperationsIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/operations/{id}][%d] patchApiV2OperationsIdOK %s", 200, payload) +} + +func (o *PatchAPIV2OperationsIDOK) GetPayload() *models.PartialOperation { + return o.Payload +} + +func (o *PatchAPIV2OperationsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialOperation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_event_logs_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_event_logs_parameters.go new file mode 100644 index 00000000..04a193d6 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_event_logs_parameters.go @@ -0,0 +1,254 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2OperationsIDEventLogsParams creates a new PostAPIV2OperationsIDEventLogsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2OperationsIDEventLogsParams() *PostAPIV2OperationsIDEventLogsParams { + return &PostAPIV2OperationsIDEventLogsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2OperationsIDEventLogsParamsWithTimeout creates a new PostAPIV2OperationsIDEventLogsParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2OperationsIDEventLogsParamsWithTimeout(timeout time.Duration) *PostAPIV2OperationsIDEventLogsParams { + return &PostAPIV2OperationsIDEventLogsParams{ + timeout: timeout, + } +} + +// NewPostAPIV2OperationsIDEventLogsParamsWithContext creates a new PostAPIV2OperationsIDEventLogsParams object +// with the ability to set a context for a request. +func NewPostAPIV2OperationsIDEventLogsParamsWithContext(ctx context.Context) *PostAPIV2OperationsIDEventLogsParams { + return &PostAPIV2OperationsIDEventLogsParams{ + Context: ctx, + } +} + +// NewPostAPIV2OperationsIDEventLogsParamsWithHTTPClient creates a new PostAPIV2OperationsIDEventLogsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2OperationsIDEventLogsParamsWithHTTPClient(client *http.Client) *PostAPIV2OperationsIDEventLogsParams { + return &PostAPIV2OperationsIDEventLogsParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2OperationsIDEventLogsParams contains all the parameters to send to the API endpoint + + for the post API v2 operations ID event logs operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2OperationsIDEventLogsParams struct { + + // Body. + Body *models.OperationOutputRequest + + // Exclude. + Exclude []string + + // ID. + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 operations ID event logs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2OperationsIDEventLogsParams) WithDefaults() *PostAPIV2OperationsIDEventLogsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 operations ID event logs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2OperationsIDEventLogsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) WithTimeout(timeout time.Duration) *PostAPIV2OperationsIDEventLogsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) WithContext(ctx context.Context) *PostAPIV2OperationsIDEventLogsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) WithHTTPClient(client *http.Client) *PostAPIV2OperationsIDEventLogsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) WithBody(body *models.OperationOutputRequest) *PostAPIV2OperationsIDEventLogsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) SetBody(body *models.OperationOutputRequest) { + o.Body = body +} + +// WithExclude adds the exclude to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) WithExclude(exclude []string) *PostAPIV2OperationsIDEventLogsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) WithID(id string) *PostAPIV2OperationsIDEventLogsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) WithInclude(include []string) *PostAPIV2OperationsIDEventLogsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the post API v2 operations ID event logs params +func (o *PostAPIV2OperationsIDEventLogsParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2OperationsIDEventLogsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamPostAPIV2OperationsIDEventLogs binds the parameter exclude +func (o *PostAPIV2OperationsIDEventLogsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamPostAPIV2OperationsIDEventLogs binds the parameter include +func (o *PostAPIV2OperationsIDEventLogsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_event_logs_responses.go b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_event_logs_responses.go new file mode 100644 index 00000000..98b2bf49 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_event_logs_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2OperationsIDEventLogsReader is a Reader for the PostAPIV2OperationsIDEventLogs structure. +type PostAPIV2OperationsIDEventLogsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2OperationsIDEventLogsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2OperationsIDEventLogsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/operations/{id}/event-logs] PostAPIV2OperationsIDEventLogs", response, response.Code()) + } +} + +// NewPostAPIV2OperationsIDEventLogsOK creates a PostAPIV2OperationsIDEventLogsOK with default headers values +func NewPostAPIV2OperationsIDEventLogsOK() *PostAPIV2OperationsIDEventLogsOK { + return &PostAPIV2OperationsIDEventLogsOK{} +} + +/* +PostAPIV2OperationsIDEventLogsOK describes a response with status code 200, with default header values. + +PostAPIV2OperationsIDEventLogsOK post Api v2 operations Id event logs o k +*/ +type PostAPIV2OperationsIDEventLogsOK struct { + Payload *models.OperationOutputRequest +} + +// IsSuccess returns true when this post Api v2 operations Id event logs o k response has a 2xx status code +func (o *PostAPIV2OperationsIDEventLogsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 operations Id event logs o k response has a 3xx status code +func (o *PostAPIV2OperationsIDEventLogsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 operations Id event logs o k response has a 4xx status code +func (o *PostAPIV2OperationsIDEventLogsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 operations Id event logs o k response has a 5xx status code +func (o *PostAPIV2OperationsIDEventLogsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 operations Id event logs o k response a status code equal to that given +func (o *PostAPIV2OperationsIDEventLogsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 operations Id event logs o k response +func (o *PostAPIV2OperationsIDEventLogsOK) Code() int { + return 200 +} + +func (o *PostAPIV2OperationsIDEventLogsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/operations/{id}/event-logs][%d] postApiV2OperationsIdEventLogsOK %s", 200, payload) +} + +func (o *PostAPIV2OperationsIDEventLogsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/operations/{id}/event-logs][%d] postApiV2OperationsIdEventLogsOK %s", 200, payload) +} + +func (o *PostAPIV2OperationsIDEventLogsOK) GetPayload() *models.OperationOutputRequest { + return o.Payload +} + +func (o *PostAPIV2OperationsIDEventLogsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.OperationOutputRequest) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_potential_links_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_potential_links_parameters.go new file mode 100644 index 00000000..972544f6 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_potential_links_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2OperationsIDPotentialLinksParams creates a new PostAPIV2OperationsIDPotentialLinksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2OperationsIDPotentialLinksParams() *PostAPIV2OperationsIDPotentialLinksParams { + return &PostAPIV2OperationsIDPotentialLinksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2OperationsIDPotentialLinksParamsWithTimeout creates a new PostAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2OperationsIDPotentialLinksParamsWithTimeout(timeout time.Duration) *PostAPIV2OperationsIDPotentialLinksParams { + return &PostAPIV2OperationsIDPotentialLinksParams{ + timeout: timeout, + } +} + +// NewPostAPIV2OperationsIDPotentialLinksParamsWithContext creates a new PostAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a context for a request. +func NewPostAPIV2OperationsIDPotentialLinksParamsWithContext(ctx context.Context) *PostAPIV2OperationsIDPotentialLinksParams { + return &PostAPIV2OperationsIDPotentialLinksParams{ + Context: ctx, + } +} + +// NewPostAPIV2OperationsIDPotentialLinksParamsWithHTTPClient creates a new PostAPIV2OperationsIDPotentialLinksParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2OperationsIDPotentialLinksParamsWithHTTPClient(client *http.Client) *PostAPIV2OperationsIDPotentialLinksParams { + return &PostAPIV2OperationsIDPotentialLinksParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2OperationsIDPotentialLinksParams contains all the parameters to send to the API endpoint + + for the post API v2 operations ID potential links operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2OperationsIDPotentialLinksParams struct { + + // Body. + Body *models.Link + + /* ID. + + UUID of the operation object for the link to be created on. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 operations ID potential links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2OperationsIDPotentialLinksParams) WithDefaults() *PostAPIV2OperationsIDPotentialLinksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 operations ID potential links params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2OperationsIDPotentialLinksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) WithTimeout(timeout time.Duration) *PostAPIV2OperationsIDPotentialLinksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) WithContext(ctx context.Context) *PostAPIV2OperationsIDPotentialLinksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) WithHTTPClient(client *http.Client) *PostAPIV2OperationsIDPotentialLinksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) WithBody(body *models.Link) *PostAPIV2OperationsIDPotentialLinksParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) SetBody(body *models.Link) { + o.Body = body +} + +// WithID adds the id to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) WithID(id string) *PostAPIV2OperationsIDPotentialLinksParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API v2 operations ID potential links params +func (o *PostAPIV2OperationsIDPotentialLinksParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2OperationsIDPotentialLinksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_potential_links_responses.go b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_potential_links_responses.go new file mode 100644 index 00000000..fad98eaa --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_potential_links_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2OperationsIDPotentialLinksReader is a Reader for the PostAPIV2OperationsIDPotentialLinks structure. +type PostAPIV2OperationsIDPotentialLinksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2OperationsIDPotentialLinksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2OperationsIDPotentialLinksOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/operations/{id}/potential-links] PostAPIV2OperationsIDPotentialLinks", response, response.Code()) + } +} + +// NewPostAPIV2OperationsIDPotentialLinksOK creates a PostAPIV2OperationsIDPotentialLinksOK with default headers values +func NewPostAPIV2OperationsIDPotentialLinksOK() *PostAPIV2OperationsIDPotentialLinksOK { + return &PostAPIV2OperationsIDPotentialLinksOK{} +} + +/* +PostAPIV2OperationsIDPotentialLinksOK describes a response with status code 200, with default header values. + +Response contains the newly assigned Link object. +*/ +type PostAPIV2OperationsIDPotentialLinksOK struct { + Payload *models.Link +} + +// IsSuccess returns true when this post Api v2 operations Id potential links o k response has a 2xx status code +func (o *PostAPIV2OperationsIDPotentialLinksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 operations Id potential links o k response has a 3xx status code +func (o *PostAPIV2OperationsIDPotentialLinksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 operations Id potential links o k response has a 4xx status code +func (o *PostAPIV2OperationsIDPotentialLinksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 operations Id potential links o k response has a 5xx status code +func (o *PostAPIV2OperationsIDPotentialLinksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 operations Id potential links o k response a status code equal to that given +func (o *PostAPIV2OperationsIDPotentialLinksOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 operations Id potential links o k response +func (o *PostAPIV2OperationsIDPotentialLinksOK) Code() int { + return 200 +} + +func (o *PostAPIV2OperationsIDPotentialLinksOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/operations/{id}/potential-links][%d] postApiV2OperationsIdPotentialLinksOK %s", 200, payload) +} + +func (o *PostAPIV2OperationsIDPotentialLinksOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/operations/{id}/potential-links][%d] postApiV2OperationsIdPotentialLinksOK %s", 200, payload) +} + +func (o *PostAPIV2OperationsIDPotentialLinksOK) GetPayload() *models.Link { + return o.Payload +} + +func (o *PostAPIV2OperationsIDPotentialLinksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Link) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_report_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_report_parameters.go new file mode 100644 index 00000000..6f7d60ae --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_report_parameters.go @@ -0,0 +1,254 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2OperationsIDReportParams creates a new PostAPIV2OperationsIDReportParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2OperationsIDReportParams() *PostAPIV2OperationsIDReportParams { + return &PostAPIV2OperationsIDReportParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2OperationsIDReportParamsWithTimeout creates a new PostAPIV2OperationsIDReportParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2OperationsIDReportParamsWithTimeout(timeout time.Duration) *PostAPIV2OperationsIDReportParams { + return &PostAPIV2OperationsIDReportParams{ + timeout: timeout, + } +} + +// NewPostAPIV2OperationsIDReportParamsWithContext creates a new PostAPIV2OperationsIDReportParams object +// with the ability to set a context for a request. +func NewPostAPIV2OperationsIDReportParamsWithContext(ctx context.Context) *PostAPIV2OperationsIDReportParams { + return &PostAPIV2OperationsIDReportParams{ + Context: ctx, + } +} + +// NewPostAPIV2OperationsIDReportParamsWithHTTPClient creates a new PostAPIV2OperationsIDReportParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2OperationsIDReportParamsWithHTTPClient(client *http.Client) *PostAPIV2OperationsIDReportParams { + return &PostAPIV2OperationsIDReportParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2OperationsIDReportParams contains all the parameters to send to the API endpoint + + for the post API v2 operations ID report operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2OperationsIDReportParams struct { + + // Body. + Body *models.OperationOutputRequest + + // Exclude. + Exclude []string + + // ID. + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 operations ID report params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2OperationsIDReportParams) WithDefaults() *PostAPIV2OperationsIDReportParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 operations ID report params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2OperationsIDReportParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) WithTimeout(timeout time.Duration) *PostAPIV2OperationsIDReportParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) WithContext(ctx context.Context) *PostAPIV2OperationsIDReportParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) WithHTTPClient(client *http.Client) *PostAPIV2OperationsIDReportParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) WithBody(body *models.OperationOutputRequest) *PostAPIV2OperationsIDReportParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) SetBody(body *models.OperationOutputRequest) { + o.Body = body +} + +// WithExclude adds the exclude to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) WithExclude(exclude []string) *PostAPIV2OperationsIDReportParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) WithID(id string) *PostAPIV2OperationsIDReportParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) WithInclude(include []string) *PostAPIV2OperationsIDReportParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the post API v2 operations ID report params +func (o *PostAPIV2OperationsIDReportParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2OperationsIDReportParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamPostAPIV2OperationsIDReport binds the parameter exclude +func (o *PostAPIV2OperationsIDReportParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamPostAPIV2OperationsIDReport binds the parameter include +func (o *PostAPIV2OperationsIDReportParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_report_responses.go b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_report_responses.go new file mode 100644 index 00000000..7f66bdef --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_id_report_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2OperationsIDReportReader is a Reader for the PostAPIV2OperationsIDReport structure. +type PostAPIV2OperationsIDReportReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2OperationsIDReportReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2OperationsIDReportOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/operations/{id}/report] PostAPIV2OperationsIDReport", response, response.Code()) + } +} + +// NewPostAPIV2OperationsIDReportOK creates a PostAPIV2OperationsIDReportOK with default headers values +func NewPostAPIV2OperationsIDReportOK() *PostAPIV2OperationsIDReportOK { + return &PostAPIV2OperationsIDReportOK{} +} + +/* +PostAPIV2OperationsIDReportOK describes a response with status code 200, with default header values. + +PostAPIV2OperationsIDReportOK post Api v2 operations Id report o k +*/ +type PostAPIV2OperationsIDReportOK struct { + Payload *models.OperationOutputRequest +} + +// IsSuccess returns true when this post Api v2 operations Id report o k response has a 2xx status code +func (o *PostAPIV2OperationsIDReportOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 operations Id report o k response has a 3xx status code +func (o *PostAPIV2OperationsIDReportOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 operations Id report o k response has a 4xx status code +func (o *PostAPIV2OperationsIDReportOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 operations Id report o k response has a 5xx status code +func (o *PostAPIV2OperationsIDReportOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 operations Id report o k response a status code equal to that given +func (o *PostAPIV2OperationsIDReportOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 operations Id report o k response +func (o *PostAPIV2OperationsIDReportOK) Code() int { + return 200 +} + +func (o *PostAPIV2OperationsIDReportOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/operations/{id}/report][%d] postApiV2OperationsIdReportOK %s", 200, payload) +} + +func (o *PostAPIV2OperationsIDReportOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/operations/{id}/report][%d] postApiV2OperationsIdReportOK %s", 200, payload) +} + +func (o *PostAPIV2OperationsIDReportOK) GetPayload() *models.OperationOutputRequest { + return o.Payload +} + +func (o *PostAPIV2OperationsIDReportOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.OperationOutputRequest) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_parameters.go b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_parameters.go new file mode 100644 index 00000000..c410f358 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2OperationsParams creates a new PostAPIV2OperationsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2OperationsParams() *PostAPIV2OperationsParams { + return &PostAPIV2OperationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2OperationsParamsWithTimeout creates a new PostAPIV2OperationsParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2OperationsParamsWithTimeout(timeout time.Duration) *PostAPIV2OperationsParams { + return &PostAPIV2OperationsParams{ + timeout: timeout, + } +} + +// NewPostAPIV2OperationsParamsWithContext creates a new PostAPIV2OperationsParams object +// with the ability to set a context for a request. +func NewPostAPIV2OperationsParamsWithContext(ctx context.Context) *PostAPIV2OperationsParams { + return &PostAPIV2OperationsParams{ + Context: ctx, + } +} + +// NewPostAPIV2OperationsParamsWithHTTPClient creates a new PostAPIV2OperationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2OperationsParamsWithHTTPClient(client *http.Client) *PostAPIV2OperationsParams { + return &PostAPIV2OperationsParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2OperationsParams contains all the parameters to send to the API endpoint + + for the post API v2 operations operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2OperationsParams struct { + + // Body. + Body *models.Operation + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 operations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2OperationsParams) WithDefaults() *PostAPIV2OperationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 operations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2OperationsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 operations params +func (o *PostAPIV2OperationsParams) WithTimeout(timeout time.Duration) *PostAPIV2OperationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 operations params +func (o *PostAPIV2OperationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 operations params +func (o *PostAPIV2OperationsParams) WithContext(ctx context.Context) *PostAPIV2OperationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 operations params +func (o *PostAPIV2OperationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 operations params +func (o *PostAPIV2OperationsParams) WithHTTPClient(client *http.Client) *PostAPIV2OperationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 operations params +func (o *PostAPIV2OperationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 operations params +func (o *PostAPIV2OperationsParams) WithBody(body *models.Operation) *PostAPIV2OperationsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 operations params +func (o *PostAPIV2OperationsParams) SetBody(body *models.Operation) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2OperationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_responses.go b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_responses.go new file mode 100644 index 00000000..5c9458d3 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/operationsops/post_api_v2_operations_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operationsops + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2OperationsReader is a Reader for the PostAPIV2Operations structure. +type PostAPIV2OperationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2OperationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2OperationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/operations] PostAPIV2Operations", response, response.Code()) + } +} + +// NewPostAPIV2OperationsOK creates a PostAPIV2OperationsOK with default headers values +func NewPostAPIV2OperationsOK() *PostAPIV2OperationsOK { + return &PostAPIV2OperationsOK{} +} + +/* +PostAPIV2OperationsOK describes a response with status code 200, with default header values. + +The response is the newly-created operation report. +*/ +type PostAPIV2OperationsOK struct { + Payload *models.Operation +} + +// IsSuccess returns true when this post Api v2 operations o k response has a 2xx status code +func (o *PostAPIV2OperationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 operations o k response has a 3xx status code +func (o *PostAPIV2OperationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 operations o k response has a 4xx status code +func (o *PostAPIV2OperationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 operations o k response has a 5xx status code +func (o *PostAPIV2OperationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 operations o k response a status code equal to that given +func (o *PostAPIV2OperationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 operations o k response +func (o *PostAPIV2OperationsOK) Code() int { + return 200 +} + +func (o *PostAPIV2OperationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/operations][%d] postApiV2OperationsOK %s", 200, payload) +} + +func (o *PostAPIV2OperationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/operations][%d] postApiV2OperationsOK %s", 200, payload) +} + +func (o *PostAPIV2OperationsOK) GetPayload() *models.Operation { + return o.Payload +} + +func (o *PostAPIV2OperationsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Operation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/payloads/delete_api_v2_payloads_name_parameters.go b/pkg/core/capability/caldera/api/client/payloads/delete_api_v2_payloads_name_parameters.go new file mode 100644 index 00000000..68bfbf0a --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/delete_api_v2_payloads_name_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" +) + +// NewDeleteAPIV2PayloadsNameParams creates a new DeleteAPIV2PayloadsNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2PayloadsNameParams() *DeleteAPIV2PayloadsNameParams { + return &DeleteAPIV2PayloadsNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2PayloadsNameParamsWithTimeout creates a new DeleteAPIV2PayloadsNameParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2PayloadsNameParamsWithTimeout(timeout time.Duration) *DeleteAPIV2PayloadsNameParams { + return &DeleteAPIV2PayloadsNameParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2PayloadsNameParamsWithContext creates a new DeleteAPIV2PayloadsNameParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2PayloadsNameParamsWithContext(ctx context.Context) *DeleteAPIV2PayloadsNameParams { + return &DeleteAPIV2PayloadsNameParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2PayloadsNameParamsWithHTTPClient creates a new DeleteAPIV2PayloadsNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2PayloadsNameParamsWithHTTPClient(client *http.Client) *DeleteAPIV2PayloadsNameParams { + return &DeleteAPIV2PayloadsNameParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2PayloadsNameParams contains all the parameters to send to the API endpoint + + for the delete API v2 payloads name operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2PayloadsNameParams struct { + + // Name. + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 payloads name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2PayloadsNameParams) WithDefaults() *DeleteAPIV2PayloadsNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 payloads name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2PayloadsNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 payloads name params +func (o *DeleteAPIV2PayloadsNameParams) WithTimeout(timeout time.Duration) *DeleteAPIV2PayloadsNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 payloads name params +func (o *DeleteAPIV2PayloadsNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 payloads name params +func (o *DeleteAPIV2PayloadsNameParams) WithContext(ctx context.Context) *DeleteAPIV2PayloadsNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 payloads name params +func (o *DeleteAPIV2PayloadsNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 payloads name params +func (o *DeleteAPIV2PayloadsNameParams) WithHTTPClient(client *http.Client) *DeleteAPIV2PayloadsNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 payloads name params +func (o *DeleteAPIV2PayloadsNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithName adds the name to the delete API v2 payloads name params +func (o *DeleteAPIV2PayloadsNameParams) WithName(name string) *DeleteAPIV2PayloadsNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the delete API v2 payloads name params +func (o *DeleteAPIV2PayloadsNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2PayloadsNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/payloads/delete_api_v2_payloads_name_responses.go b/pkg/core/capability/caldera/api/client/payloads/delete_api_v2_payloads_name_responses.go new file mode 100644 index 00000000..048d2d7c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/delete_api_v2_payloads_name_responses.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" +) + +// DeleteAPIV2PayloadsNameReader is a Reader for the DeleteAPIV2PayloadsName structure. +type DeleteAPIV2PayloadsNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2PayloadsNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPIV2PayloadsNameNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewDeleteAPIV2PayloadsNameNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/payloads/{name}] DeleteAPIV2PayloadsName", response, response.Code()) + } +} + +// NewDeleteAPIV2PayloadsNameNoContent creates a DeleteAPIV2PayloadsNameNoContent with default headers values +func NewDeleteAPIV2PayloadsNameNoContent() *DeleteAPIV2PayloadsNameNoContent { + return &DeleteAPIV2PayloadsNameNoContent{} +} + +/* +DeleteAPIV2PayloadsNameNoContent describes a response with status code 204, with default header values. + +Payload has been properly deleted. +*/ +type DeleteAPIV2PayloadsNameNoContent struct { +} + +// IsSuccess returns true when this delete Api v2 payloads name no content response has a 2xx status code +func (o *DeleteAPIV2PayloadsNameNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 payloads name no content response has a 3xx status code +func (o *DeleteAPIV2PayloadsNameNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 payloads name no content response has a 4xx status code +func (o *DeleteAPIV2PayloadsNameNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 payloads name no content response has a 5xx status code +func (o *DeleteAPIV2PayloadsNameNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 payloads name no content response a status code equal to that given +func (o *DeleteAPIV2PayloadsNameNoContent) IsCode(code int) bool { + return code == 204 +} + +// Code gets the status code for the delete Api v2 payloads name no content response +func (o *DeleteAPIV2PayloadsNameNoContent) Code() int { + return 204 +} + +func (o *DeleteAPIV2PayloadsNameNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/v2/payloads/{name}][%d] deleteApiV2PayloadsNameNoContent", 204) +} + +func (o *DeleteAPIV2PayloadsNameNoContent) String() string { + return fmt.Sprintf("[DELETE /api/v2/payloads/{name}][%d] deleteApiV2PayloadsNameNoContent", 204) +} + +func (o *DeleteAPIV2PayloadsNameNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteAPIV2PayloadsNameNotFound creates a DeleteAPIV2PayloadsNameNotFound with default headers values +func NewDeleteAPIV2PayloadsNameNotFound() *DeleteAPIV2PayloadsNameNotFound { + return &DeleteAPIV2PayloadsNameNotFound{} +} + +/* +DeleteAPIV2PayloadsNameNotFound describes a response with status code 404, with default header values. + +Payload not found. +*/ +type DeleteAPIV2PayloadsNameNotFound struct { +} + +// IsSuccess returns true when this delete Api v2 payloads name not found response has a 2xx status code +func (o *DeleteAPIV2PayloadsNameNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete Api v2 payloads name not found response has a 3xx status code +func (o *DeleteAPIV2PayloadsNameNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 payloads name not found response has a 4xx status code +func (o *DeleteAPIV2PayloadsNameNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete Api v2 payloads name not found response has a 5xx status code +func (o *DeleteAPIV2PayloadsNameNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 payloads name not found response a status code equal to that given +func (o *DeleteAPIV2PayloadsNameNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the delete Api v2 payloads name not found response +func (o *DeleteAPIV2PayloadsNameNotFound) Code() int { + return 404 +} + +func (o *DeleteAPIV2PayloadsNameNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v2/payloads/{name}][%d] deleteApiV2PayloadsNameNotFound", 404) +} + +func (o *DeleteAPIV2PayloadsNameNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v2/payloads/{name}][%d] deleteApiV2PayloadsNameNotFound", 404) +} + +func (o *DeleteAPIV2PayloadsNameNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/payloads/get_api_v2_payloads_parameters.go b/pkg/core/capability/caldera/api/client/payloads/get_api_v2_payloads_parameters.go new file mode 100644 index 00000000..95994939 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/get_api_v2_payloads_parameters.go @@ -0,0 +1,240 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" +) + +// NewGetAPIV2PayloadsParams creates a new GetAPIV2PayloadsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2PayloadsParams() *GetAPIV2PayloadsParams { + return &GetAPIV2PayloadsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2PayloadsParamsWithTimeout creates a new GetAPIV2PayloadsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2PayloadsParamsWithTimeout(timeout time.Duration) *GetAPIV2PayloadsParams { + return &GetAPIV2PayloadsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2PayloadsParamsWithContext creates a new GetAPIV2PayloadsParams object +// with the ability to set a context for a request. +func NewGetAPIV2PayloadsParamsWithContext(ctx context.Context) *GetAPIV2PayloadsParams { + return &GetAPIV2PayloadsParams{ + Context: ctx, + } +} + +// NewGetAPIV2PayloadsParamsWithHTTPClient creates a new GetAPIV2PayloadsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2PayloadsParamsWithHTTPClient(client *http.Client) *GetAPIV2PayloadsParams { + return &GetAPIV2PayloadsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2PayloadsParams contains all the parameters to send to the API endpoint + + for the get API v2 payloads operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2PayloadsParams struct { + + // AddPath. + AddPath *bool + + // ExcludePlugins. + ExcludePlugins *bool + + // Sort. + Sort *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 payloads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PayloadsParams) WithDefaults() *GetAPIV2PayloadsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 payloads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PayloadsParams) SetDefaults() { + var ( + addPathDefault = bool(false) + + excludePluginsDefault = bool(false) + + sortDefault = bool(false) + ) + + val := GetAPIV2PayloadsParams{ + AddPath: &addPathDefault, + ExcludePlugins: &excludePluginsDefault, + Sort: &sortDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) WithTimeout(timeout time.Duration) *GetAPIV2PayloadsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) WithContext(ctx context.Context) *GetAPIV2PayloadsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) WithHTTPClient(client *http.Client) *GetAPIV2PayloadsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAddPath adds the addPath to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) WithAddPath(addPath *bool) *GetAPIV2PayloadsParams { + o.SetAddPath(addPath) + return o +} + +// SetAddPath adds the addPath to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) SetAddPath(addPath *bool) { + o.AddPath = addPath +} + +// WithExcludePlugins adds the excludePlugins to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) WithExcludePlugins(excludePlugins *bool) *GetAPIV2PayloadsParams { + o.SetExcludePlugins(excludePlugins) + return o +} + +// SetExcludePlugins adds the excludePlugins to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) SetExcludePlugins(excludePlugins *bool) { + o.ExcludePlugins = excludePlugins +} + +// WithSort adds the sort to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) WithSort(sort *bool) *GetAPIV2PayloadsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 payloads params +func (o *GetAPIV2PayloadsParams) SetSort(sort *bool) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2PayloadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AddPath != nil { + + // query param add_path + var qrAddPath bool + + if o.AddPath != nil { + qrAddPath = *o.AddPath + } + qAddPath := swag.FormatBool(qrAddPath) + if qAddPath != "" { + + if err := r.SetQueryParam("add_path", qAddPath); err != nil { + return err + } + } + } + + if o.ExcludePlugins != nil { + + // query param exclude_plugins + var qrExcludePlugins bool + + if o.ExcludePlugins != nil { + qrExcludePlugins = *o.ExcludePlugins + } + qExcludePlugins := swag.FormatBool(qrExcludePlugins) + if qExcludePlugins != "" { + + if err := r.SetQueryParam("exclude_plugins", qExcludePlugins); err != nil { + return err + } + } + } + + if o.Sort != nil { + + // query param sort + var qrSort bool + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := swag.FormatBool(qrSort) + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/payloads/get_api_v2_payloads_responses.go b/pkg/core/capability/caldera/api/client/payloads/get_api_v2_payloads_responses.go new file mode 100644 index 00000000..088e9de9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/get_api_v2_payloads_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2PayloadsReader is a Reader for the GetAPIV2Payloads structure. +type GetAPIV2PayloadsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2PayloadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2PayloadsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/payloads] GetAPIV2Payloads", response, response.Code()) + } +} + +// NewGetAPIV2PayloadsOK creates a GetAPIV2PayloadsOK with default headers values +func NewGetAPIV2PayloadsOK() *GetAPIV2PayloadsOK { + return &GetAPIV2PayloadsOK{} +} + +/* +GetAPIV2PayloadsOK describes a response with status code 200, with default header values. + +Returns a list of all payloads in PayloadSchema format. +*/ +type GetAPIV2PayloadsOK struct { + Payload *models.Payload +} + +// IsSuccess returns true when this get Api v2 payloads o k response has a 2xx status code +func (o *GetAPIV2PayloadsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 payloads o k response has a 3xx status code +func (o *GetAPIV2PayloadsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 payloads o k response has a 4xx status code +func (o *GetAPIV2PayloadsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 payloads o k response has a 5xx status code +func (o *GetAPIV2PayloadsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 payloads o k response a status code equal to that given +func (o *GetAPIV2PayloadsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 payloads o k response +func (o *GetAPIV2PayloadsOK) Code() int { + return 200 +} + +func (o *GetAPIV2PayloadsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/payloads][%d] getApiV2PayloadsOK %s", 200, payload) +} + +func (o *GetAPIV2PayloadsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/payloads][%d] getApiV2PayloadsOK %s", 200, payload) +} + +func (o *GetAPIV2PayloadsOK) GetPayload() *models.Payload { + return o.Payload +} + +func (o *GetAPIV2PayloadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Payload) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/payloads/head_api_v2_payloads_parameters.go b/pkg/core/capability/caldera/api/client/payloads/head_api_v2_payloads_parameters.go new file mode 100644 index 00000000..8a1f5065 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/head_api_v2_payloads_parameters.go @@ -0,0 +1,240 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" +) + +// NewHeadAPIV2PayloadsParams creates a new HeadAPIV2PayloadsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2PayloadsParams() *HeadAPIV2PayloadsParams { + return &HeadAPIV2PayloadsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2PayloadsParamsWithTimeout creates a new HeadAPIV2PayloadsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2PayloadsParamsWithTimeout(timeout time.Duration) *HeadAPIV2PayloadsParams { + return &HeadAPIV2PayloadsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2PayloadsParamsWithContext creates a new HeadAPIV2PayloadsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2PayloadsParamsWithContext(ctx context.Context) *HeadAPIV2PayloadsParams { + return &HeadAPIV2PayloadsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2PayloadsParamsWithHTTPClient creates a new HeadAPIV2PayloadsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2PayloadsParamsWithHTTPClient(client *http.Client) *HeadAPIV2PayloadsParams { + return &HeadAPIV2PayloadsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2PayloadsParams contains all the parameters to send to the API endpoint + + for the head API v2 payloads operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2PayloadsParams struct { + + // AddPath. + AddPath *bool + + // ExcludePlugins. + ExcludePlugins *bool + + // Sort. + Sort *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 payloads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PayloadsParams) WithDefaults() *HeadAPIV2PayloadsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 payloads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PayloadsParams) SetDefaults() { + var ( + addPathDefault = bool(false) + + excludePluginsDefault = bool(false) + + sortDefault = bool(false) + ) + + val := HeadAPIV2PayloadsParams{ + AddPath: &addPathDefault, + ExcludePlugins: &excludePluginsDefault, + Sort: &sortDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) WithTimeout(timeout time.Duration) *HeadAPIV2PayloadsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) WithContext(ctx context.Context) *HeadAPIV2PayloadsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) WithHTTPClient(client *http.Client) *HeadAPIV2PayloadsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAddPath adds the addPath to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) WithAddPath(addPath *bool) *HeadAPIV2PayloadsParams { + o.SetAddPath(addPath) + return o +} + +// SetAddPath adds the addPath to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) SetAddPath(addPath *bool) { + o.AddPath = addPath +} + +// WithExcludePlugins adds the excludePlugins to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) WithExcludePlugins(excludePlugins *bool) *HeadAPIV2PayloadsParams { + o.SetExcludePlugins(excludePlugins) + return o +} + +// SetExcludePlugins adds the excludePlugins to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) SetExcludePlugins(excludePlugins *bool) { + o.ExcludePlugins = excludePlugins +} + +// WithSort adds the sort to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) WithSort(sort *bool) *HeadAPIV2PayloadsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 payloads params +func (o *HeadAPIV2PayloadsParams) SetSort(sort *bool) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2PayloadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AddPath != nil { + + // query param add_path + var qrAddPath bool + + if o.AddPath != nil { + qrAddPath = *o.AddPath + } + qAddPath := swag.FormatBool(qrAddPath) + if qAddPath != "" { + + if err := r.SetQueryParam("add_path", qAddPath); err != nil { + return err + } + } + } + + if o.ExcludePlugins != nil { + + // query param exclude_plugins + var qrExcludePlugins bool + + if o.ExcludePlugins != nil { + qrExcludePlugins = *o.ExcludePlugins + } + qExcludePlugins := swag.FormatBool(qrExcludePlugins) + if qExcludePlugins != "" { + + if err := r.SetQueryParam("exclude_plugins", qExcludePlugins); err != nil { + return err + } + } + } + + if o.Sort != nil { + + // query param sort + var qrSort bool + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := swag.FormatBool(qrSort) + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/payloads/head_api_v2_payloads_responses.go b/pkg/core/capability/caldera/api/client/payloads/head_api_v2_payloads_responses.go new file mode 100644 index 00000000..0f6e9c74 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/head_api_v2_payloads_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2PayloadsReader is a Reader for the HeadAPIV2Payloads structure. +type HeadAPIV2PayloadsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2PayloadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2PayloadsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/payloads] HeadAPIV2Payloads", response, response.Code()) + } +} + +// NewHeadAPIV2PayloadsOK creates a HeadAPIV2PayloadsOK with default headers values +func NewHeadAPIV2PayloadsOK() *HeadAPIV2PayloadsOK { + return &HeadAPIV2PayloadsOK{} +} + +/* +HeadAPIV2PayloadsOK describes a response with status code 200, with default header values. + +Returns a list of all payloads in PayloadSchema format. +*/ +type HeadAPIV2PayloadsOK struct { + Payload *models.Payload +} + +// IsSuccess returns true when this head Api v2 payloads o k response has a 2xx status code +func (o *HeadAPIV2PayloadsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 payloads o k response has a 3xx status code +func (o *HeadAPIV2PayloadsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 payloads o k response has a 4xx status code +func (o *HeadAPIV2PayloadsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 payloads o k response has a 5xx status code +func (o *HeadAPIV2PayloadsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 payloads o k response a status code equal to that given +func (o *HeadAPIV2PayloadsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 payloads o k response +func (o *HeadAPIV2PayloadsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2PayloadsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/payloads][%d] headApiV2PayloadsOK %s", 200, payload) +} + +func (o *HeadAPIV2PayloadsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/payloads][%d] headApiV2PayloadsOK %s", 200, payload) +} + +func (o *HeadAPIV2PayloadsOK) GetPayload() *models.Payload { + return o.Payload +} + +func (o *HeadAPIV2PayloadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Payload) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/payloads/payloads_client.go b/pkg/core/capability/caldera/api/client/payloads/payloads_client.go new file mode 100644 index 00000000..bd6afc2b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/payloads_client.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new payloads API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new payloads API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new payloads API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for payloads API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2PayloadsName(params *DeleteAPIV2PayloadsNameParams, opts ...ClientOption) (*DeleteAPIV2PayloadsNameNoContent, error) + + GetAPIV2Payloads(params *GetAPIV2PayloadsParams, opts ...ClientOption) (*GetAPIV2PayloadsOK, error) + + HeadAPIV2Payloads(params *HeadAPIV2PayloadsParams, opts ...ClientOption) (*HeadAPIV2PayloadsOK, error) + + PostAPIV2Payloads(params *PostAPIV2PayloadsParams, opts ...ClientOption) (*PostAPIV2PayloadsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2PayloadsName deletes a payload + +Deletes a given payload. +*/ +func (a *Client) DeleteAPIV2PayloadsName(params *DeleteAPIV2PayloadsNameParams, opts ...ClientOption) (*DeleteAPIV2PayloadsNameNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2PayloadsNameParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2PayloadsName", + Method: "DELETE", + PathPattern: "/api/v2/payloads/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2PayloadsNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2PayloadsNameNoContent) + 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 DeleteAPIV2PayloadsName: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Payloads retrieves payloads + +Retrieves all stored payloads. +*/ +func (a *Client) GetAPIV2Payloads(params *GetAPIV2PayloadsParams, opts ...ClientOption) (*GetAPIV2PayloadsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2PayloadsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Payloads", + Method: "GET", + PathPattern: "/api/v2/payloads", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2PayloadsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2PayloadsOK) + 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 GetAPIV2Payloads: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Payloads retrieves payloads + +Retrieves all stored payloads. +*/ +func (a *Client) HeadAPIV2Payloads(params *HeadAPIV2PayloadsParams, opts ...ClientOption) (*HeadAPIV2PayloadsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2PayloadsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Payloads", + Method: "HEAD", + PathPattern: "/api/v2/payloads", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2PayloadsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2PayloadsOK) + 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 HeadAPIV2Payloads: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Payloads creates a payload + +Uploads a payload. +*/ +func (a *Client) PostAPIV2Payloads(params *PostAPIV2PayloadsParams, opts ...ClientOption) (*PostAPIV2PayloadsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2PayloadsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Payloads", + Method: "POST", + PathPattern: "/api/v2/payloads", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2PayloadsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2PayloadsOK) + 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 PostAPIV2Payloads: 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/core/capability/caldera/api/client/payloads/post_api_v2_payloads_parameters.go b/pkg/core/capability/caldera/api/client/payloads/post_api_v2_payloads_parameters.go new file mode 100644 index 00000000..e40c64af --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/post_api_v2_payloads_parameters.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" +) + +// NewPostAPIV2PayloadsParams creates a new PostAPIV2PayloadsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2PayloadsParams() *PostAPIV2PayloadsParams { + return &PostAPIV2PayloadsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2PayloadsParamsWithTimeout creates a new PostAPIV2PayloadsParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2PayloadsParamsWithTimeout(timeout time.Duration) *PostAPIV2PayloadsParams { + return &PostAPIV2PayloadsParams{ + timeout: timeout, + } +} + +// NewPostAPIV2PayloadsParamsWithContext creates a new PostAPIV2PayloadsParams object +// with the ability to set a context for a request. +func NewPostAPIV2PayloadsParamsWithContext(ctx context.Context) *PostAPIV2PayloadsParams { + return &PostAPIV2PayloadsParams{ + Context: ctx, + } +} + +// NewPostAPIV2PayloadsParamsWithHTTPClient creates a new PostAPIV2PayloadsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2PayloadsParamsWithHTTPClient(client *http.Client) *PostAPIV2PayloadsParams { + return &PostAPIV2PayloadsParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2PayloadsParams contains all the parameters to send to the API endpoint + + for the post API v2 payloads operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2PayloadsParams struct { + + // File. + File runtime.NamedReadCloser + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 payloads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2PayloadsParams) WithDefaults() *PostAPIV2PayloadsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 payloads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2PayloadsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 payloads params +func (o *PostAPIV2PayloadsParams) WithTimeout(timeout time.Duration) *PostAPIV2PayloadsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 payloads params +func (o *PostAPIV2PayloadsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 payloads params +func (o *PostAPIV2PayloadsParams) WithContext(ctx context.Context) *PostAPIV2PayloadsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 payloads params +func (o *PostAPIV2PayloadsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 payloads params +func (o *PostAPIV2PayloadsParams) WithHTTPClient(client *http.Client) *PostAPIV2PayloadsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 payloads params +func (o *PostAPIV2PayloadsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFile adds the file to the post API v2 payloads params +func (o *PostAPIV2PayloadsParams) WithFile(file runtime.NamedReadCloser) *PostAPIV2PayloadsParams { + o.SetFile(file) + return o +} + +// SetFile adds the file to the post API v2 payloads params +func (o *PostAPIV2PayloadsParams) SetFile(file runtime.NamedReadCloser) { + o.File = file +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2PayloadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + // form file param file + if err := r.SetFileParam("file", o.File); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/payloads/post_api_v2_payloads_responses.go b/pkg/core/capability/caldera/api/client/payloads/post_api_v2_payloads_responses.go new file mode 100644 index 00000000..f2d786f5 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/payloads/post_api_v2_payloads_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payloads + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2PayloadsReader is a Reader for the PostAPIV2Payloads structure. +type PostAPIV2PayloadsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2PayloadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2PayloadsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/payloads] PostAPIV2Payloads", response, response.Code()) + } +} + +// NewPostAPIV2PayloadsOK creates a PostAPIV2PayloadsOK with default headers values +func NewPostAPIV2PayloadsOK() *PostAPIV2PayloadsOK { + return &PostAPIV2PayloadsOK{} +} + +/* +PostAPIV2PayloadsOK describes a response with status code 200, with default header values. + +The created payload in a list in PayloadSchema format (with name changed in case of a duplicate). +*/ +type PostAPIV2PayloadsOK struct { + Payload *models.Payload +} + +// IsSuccess returns true when this post Api v2 payloads o k response has a 2xx status code +func (o *PostAPIV2PayloadsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 payloads o k response has a 3xx status code +func (o *PostAPIV2PayloadsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 payloads o k response has a 4xx status code +func (o *PostAPIV2PayloadsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 payloads o k response has a 5xx status code +func (o *PostAPIV2PayloadsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 payloads o k response a status code equal to that given +func (o *PostAPIV2PayloadsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 payloads o k response +func (o *PostAPIV2PayloadsOK) Code() int { + return 200 +} + +func (o *PostAPIV2PayloadsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/payloads][%d] postApiV2PayloadsOK %s", 200, payload) +} + +func (o *PostAPIV2PayloadsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/payloads][%d] postApiV2PayloadsOK %s", 200, payload) +} + +func (o *PostAPIV2PayloadsOK) GetPayload() *models.Payload { + return o.Payload +} + +func (o *PostAPIV2PayloadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Payload) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_parameters.go b/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_parameters.go new file mode 100644 index 00000000..79b25d27 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" +) + +// NewGetAPIV2PlannersParams creates a new GetAPIV2PlannersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2PlannersParams() *GetAPIV2PlannersParams { + return &GetAPIV2PlannersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2PlannersParamsWithTimeout creates a new GetAPIV2PlannersParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2PlannersParamsWithTimeout(timeout time.Duration) *GetAPIV2PlannersParams { + return &GetAPIV2PlannersParams{ + timeout: timeout, + } +} + +// NewGetAPIV2PlannersParamsWithContext creates a new GetAPIV2PlannersParams object +// with the ability to set a context for a request. +func NewGetAPIV2PlannersParamsWithContext(ctx context.Context) *GetAPIV2PlannersParams { + return &GetAPIV2PlannersParams{ + Context: ctx, + } +} + +// NewGetAPIV2PlannersParamsWithHTTPClient creates a new GetAPIV2PlannersParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2PlannersParamsWithHTTPClient(client *http.Client) *GetAPIV2PlannersParams { + return &GetAPIV2PlannersParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2PlannersParams contains all the parameters to send to the API endpoint + + for the get API v2 planners operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2PlannersParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 planners params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PlannersParams) WithDefaults() *GetAPIV2PlannersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 planners params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PlannersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 planners params +func (o *GetAPIV2PlannersParams) WithTimeout(timeout time.Duration) *GetAPIV2PlannersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 planners params +func (o *GetAPIV2PlannersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 planners params +func (o *GetAPIV2PlannersParams) WithContext(ctx context.Context) *GetAPIV2PlannersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 planners params +func (o *GetAPIV2PlannersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 planners params +func (o *GetAPIV2PlannersParams) WithHTTPClient(client *http.Client) *GetAPIV2PlannersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 planners params +func (o *GetAPIV2PlannersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 planners params +func (o *GetAPIV2PlannersParams) WithExclude(exclude []string) *GetAPIV2PlannersParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 planners params +func (o *GetAPIV2PlannersParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 planners params +func (o *GetAPIV2PlannersParams) WithInclude(include []string) *GetAPIV2PlannersParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 planners params +func (o *GetAPIV2PlannersParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 planners params +func (o *GetAPIV2PlannersParams) WithSort(sort *string) *GetAPIV2PlannersParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 planners params +func (o *GetAPIV2PlannersParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2PlannersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Planners binds the parameter exclude +func (o *GetAPIV2PlannersParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Planners binds the parameter include +func (o *GetAPIV2PlannersParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_planner_id_parameters.go b/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_planner_id_parameters.go new file mode 100644 index 00000000..0f7f43c1 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_planner_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" +) + +// NewGetAPIV2PlannersPlannerIDParams creates a new GetAPIV2PlannersPlannerIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2PlannersPlannerIDParams() *GetAPIV2PlannersPlannerIDParams { + return &GetAPIV2PlannersPlannerIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2PlannersPlannerIDParamsWithTimeout creates a new GetAPIV2PlannersPlannerIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2PlannersPlannerIDParamsWithTimeout(timeout time.Duration) *GetAPIV2PlannersPlannerIDParams { + return &GetAPIV2PlannersPlannerIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2PlannersPlannerIDParamsWithContext creates a new GetAPIV2PlannersPlannerIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2PlannersPlannerIDParamsWithContext(ctx context.Context) *GetAPIV2PlannersPlannerIDParams { + return &GetAPIV2PlannersPlannerIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2PlannersPlannerIDParamsWithHTTPClient creates a new GetAPIV2PlannersPlannerIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2PlannersPlannerIDParamsWithHTTPClient(client *http.Client) *GetAPIV2PlannersPlannerIDParams { + return &GetAPIV2PlannersPlannerIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2PlannersPlannerIDParams contains all the parameters to send to the API endpoint + + for the get API v2 planners planner ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2PlannersPlannerIDParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + /* PlannerID. + + UUID of the Planner object to be retrieved. + */ + PlannerID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 planners planner ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PlannersPlannerIDParams) WithDefaults() *GetAPIV2PlannersPlannerIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 planners planner ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PlannersPlannerIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) WithTimeout(timeout time.Duration) *GetAPIV2PlannersPlannerIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) WithContext(ctx context.Context) *GetAPIV2PlannersPlannerIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) WithHTTPClient(client *http.Client) *GetAPIV2PlannersPlannerIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) WithExclude(exclude []string) *GetAPIV2PlannersPlannerIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) WithInclude(include []string) *GetAPIV2PlannersPlannerIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) SetInclude(include []string) { + o.Include = include +} + +// WithPlannerID adds the plannerID to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) WithPlannerID(plannerID string) *GetAPIV2PlannersPlannerIDParams { + o.SetPlannerID(plannerID) + return o +} + +// SetPlannerID adds the plannerId to the get API v2 planners planner ID params +func (o *GetAPIV2PlannersPlannerIDParams) SetPlannerID(plannerID string) { + o.PlannerID = plannerID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2PlannersPlannerIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param planner_id + if err := r.SetPathParam("planner_id", o.PlannerID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2PlannersPlannerID binds the parameter exclude +func (o *GetAPIV2PlannersPlannerIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2PlannersPlannerID binds the parameter include +func (o *GetAPIV2PlannersPlannerIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_planner_id_responses.go b/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_planner_id_responses.go new file mode 100644 index 00000000..2a749398 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_planner_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2PlannersPlannerIDReader is a Reader for the GetAPIV2PlannersPlannerID structure. +type GetAPIV2PlannersPlannerIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2PlannersPlannerIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2PlannersPlannerIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/planners/{planner_id}] GetAPIV2PlannersPlannerID", response, response.Code()) + } +} + +// NewGetAPIV2PlannersPlannerIDOK creates a GetAPIV2PlannersPlannerIDOK with default headers values +func NewGetAPIV2PlannersPlannerIDOK() *GetAPIV2PlannersPlannerIDOK { + return &GetAPIV2PlannersPlannerIDOK{} +} + +/* +GetAPIV2PlannersPlannerIDOK describes a response with status code 200, with default header values. + +Returns a planner with the specified id in `PlannerSchema` format. +*/ +type GetAPIV2PlannersPlannerIDOK struct { + Payload *models.PartialPlanner +} + +// IsSuccess returns true when this get Api v2 planners planner Id o k response has a 2xx status code +func (o *GetAPIV2PlannersPlannerIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 planners planner Id o k response has a 3xx status code +func (o *GetAPIV2PlannersPlannerIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 planners planner Id o k response has a 4xx status code +func (o *GetAPIV2PlannersPlannerIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 planners planner Id o k response has a 5xx status code +func (o *GetAPIV2PlannersPlannerIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 planners planner Id o k response a status code equal to that given +func (o *GetAPIV2PlannersPlannerIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 planners planner Id o k response +func (o *GetAPIV2PlannersPlannerIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2PlannersPlannerIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/planners/{planner_id}][%d] getApiV2PlannersPlannerIdOK %s", 200, payload) +} + +func (o *GetAPIV2PlannersPlannerIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/planners/{planner_id}][%d] getApiV2PlannersPlannerIdOK %s", 200, payload) +} + +func (o *GetAPIV2PlannersPlannerIDOK) GetPayload() *models.PartialPlanner { + return o.Payload +} + +func (o *GetAPIV2PlannersPlannerIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialPlanner) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_responses.go b/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_responses.go new file mode 100644 index 00000000..e05b4ff5 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/get_api_v2_planners_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2PlannersReader is a Reader for the GetAPIV2Planners structure. +type GetAPIV2PlannersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2PlannersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2PlannersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/planners] GetAPIV2Planners", response, response.Code()) + } +} + +// NewGetAPIV2PlannersOK creates a GetAPIV2PlannersOK with default headers values +func NewGetAPIV2PlannersOK() *GetAPIV2PlannersOK { + return &GetAPIV2PlannersOK{} +} + +/* +GetAPIV2PlannersOK describes a response with status code 200, with default header values. + +Returns a list of matching planners in `PlannerSchema` format. +*/ +type GetAPIV2PlannersOK struct { + Payload []*models.PartialPlanner +} + +// IsSuccess returns true when this get Api v2 planners o k response has a 2xx status code +func (o *GetAPIV2PlannersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 planners o k response has a 3xx status code +func (o *GetAPIV2PlannersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 planners o k response has a 4xx status code +func (o *GetAPIV2PlannersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 planners o k response has a 5xx status code +func (o *GetAPIV2PlannersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 planners o k response a status code equal to that given +func (o *GetAPIV2PlannersOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 planners o k response +func (o *GetAPIV2PlannersOK) Code() int { + return 200 +} + +func (o *GetAPIV2PlannersOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/planners][%d] getApiV2PlannersOK %s", 200, payload) +} + +func (o *GetAPIV2PlannersOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/planners][%d] getApiV2PlannersOK %s", 200, payload) +} + +func (o *GetAPIV2PlannersOK) GetPayload() []*models.PartialPlanner { + return o.Payload +} + +func (o *GetAPIV2PlannersOK) 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/core/capability/caldera/api/client/planners/head_api_v2_planners_parameters.go b/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_parameters.go new file mode 100644 index 00000000..bb3e8289 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" +) + +// NewHeadAPIV2PlannersParams creates a new HeadAPIV2PlannersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2PlannersParams() *HeadAPIV2PlannersParams { + return &HeadAPIV2PlannersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2PlannersParamsWithTimeout creates a new HeadAPIV2PlannersParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2PlannersParamsWithTimeout(timeout time.Duration) *HeadAPIV2PlannersParams { + return &HeadAPIV2PlannersParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2PlannersParamsWithContext creates a new HeadAPIV2PlannersParams object +// with the ability to set a context for a request. +func NewHeadAPIV2PlannersParamsWithContext(ctx context.Context) *HeadAPIV2PlannersParams { + return &HeadAPIV2PlannersParams{ + Context: ctx, + } +} + +// NewHeadAPIV2PlannersParamsWithHTTPClient creates a new HeadAPIV2PlannersParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2PlannersParamsWithHTTPClient(client *http.Client) *HeadAPIV2PlannersParams { + return &HeadAPIV2PlannersParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2PlannersParams contains all the parameters to send to the API endpoint + + for the head API v2 planners operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2PlannersParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 planners params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PlannersParams) WithDefaults() *HeadAPIV2PlannersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 planners params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PlannersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) WithTimeout(timeout time.Duration) *HeadAPIV2PlannersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) WithContext(ctx context.Context) *HeadAPIV2PlannersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) WithHTTPClient(client *http.Client) *HeadAPIV2PlannersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) WithExclude(exclude []string) *HeadAPIV2PlannersParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) WithInclude(include []string) *HeadAPIV2PlannersParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) WithSort(sort *string) *HeadAPIV2PlannersParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 planners params +func (o *HeadAPIV2PlannersParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2PlannersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Planners binds the parameter exclude +func (o *HeadAPIV2PlannersParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Planners binds the parameter include +func (o *HeadAPIV2PlannersParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_planner_id_parameters.go b/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_planner_id_parameters.go new file mode 100644 index 00000000..72d61cce --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_planner_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" +) + +// NewHeadAPIV2PlannersPlannerIDParams creates a new HeadAPIV2PlannersPlannerIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2PlannersPlannerIDParams() *HeadAPIV2PlannersPlannerIDParams { + return &HeadAPIV2PlannersPlannerIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2PlannersPlannerIDParamsWithTimeout creates a new HeadAPIV2PlannersPlannerIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2PlannersPlannerIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2PlannersPlannerIDParams { + return &HeadAPIV2PlannersPlannerIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2PlannersPlannerIDParamsWithContext creates a new HeadAPIV2PlannersPlannerIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2PlannersPlannerIDParamsWithContext(ctx context.Context) *HeadAPIV2PlannersPlannerIDParams { + return &HeadAPIV2PlannersPlannerIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2PlannersPlannerIDParamsWithHTTPClient creates a new HeadAPIV2PlannersPlannerIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2PlannersPlannerIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2PlannersPlannerIDParams { + return &HeadAPIV2PlannersPlannerIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2PlannersPlannerIDParams contains all the parameters to send to the API endpoint + + for the head API v2 planners planner ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2PlannersPlannerIDParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + /* PlannerID. + + UUID of the Planner object to be retrieved. + */ + PlannerID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 planners planner ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PlannersPlannerIDParams) WithDefaults() *HeadAPIV2PlannersPlannerIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 planners planner ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PlannersPlannerIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2PlannersPlannerIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) WithContext(ctx context.Context) *HeadAPIV2PlannersPlannerIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2PlannersPlannerIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) WithExclude(exclude []string) *HeadAPIV2PlannersPlannerIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) WithInclude(include []string) *HeadAPIV2PlannersPlannerIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) SetInclude(include []string) { + o.Include = include +} + +// WithPlannerID adds the plannerID to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) WithPlannerID(plannerID string) *HeadAPIV2PlannersPlannerIDParams { + o.SetPlannerID(plannerID) + return o +} + +// SetPlannerID adds the plannerId to the head API v2 planners planner ID params +func (o *HeadAPIV2PlannersPlannerIDParams) SetPlannerID(plannerID string) { + o.PlannerID = plannerID +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2PlannersPlannerIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param planner_id + if err := r.SetPathParam("planner_id", o.PlannerID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2PlannersPlannerID binds the parameter exclude +func (o *HeadAPIV2PlannersPlannerIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2PlannersPlannerID binds the parameter include +func (o *HeadAPIV2PlannersPlannerIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_planner_id_responses.go b/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_planner_id_responses.go new file mode 100644 index 00000000..b5dae8ab --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_planner_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2PlannersPlannerIDReader is a Reader for the HeadAPIV2PlannersPlannerID structure. +type HeadAPIV2PlannersPlannerIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2PlannersPlannerIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2PlannersPlannerIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/planners/{planner_id}] HeadAPIV2PlannersPlannerID", response, response.Code()) + } +} + +// NewHeadAPIV2PlannersPlannerIDOK creates a HeadAPIV2PlannersPlannerIDOK with default headers values +func NewHeadAPIV2PlannersPlannerIDOK() *HeadAPIV2PlannersPlannerIDOK { + return &HeadAPIV2PlannersPlannerIDOK{} +} + +/* +HeadAPIV2PlannersPlannerIDOK describes a response with status code 200, with default header values. + +Returns a planner with the specified id in `PlannerSchema` format. +*/ +type HeadAPIV2PlannersPlannerIDOK struct { + Payload *models.PartialPlanner +} + +// IsSuccess returns true when this head Api v2 planners planner Id o k response has a 2xx status code +func (o *HeadAPIV2PlannersPlannerIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 planners planner Id o k response has a 3xx status code +func (o *HeadAPIV2PlannersPlannerIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 planners planner Id o k response has a 4xx status code +func (o *HeadAPIV2PlannersPlannerIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 planners planner Id o k response has a 5xx status code +func (o *HeadAPIV2PlannersPlannerIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 planners planner Id o k response a status code equal to that given +func (o *HeadAPIV2PlannersPlannerIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 planners planner Id o k response +func (o *HeadAPIV2PlannersPlannerIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2PlannersPlannerIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/planners/{planner_id}][%d] headApiV2PlannersPlannerIdOK %s", 200, payload) +} + +func (o *HeadAPIV2PlannersPlannerIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/planners/{planner_id}][%d] headApiV2PlannersPlannerIdOK %s", 200, payload) +} + +func (o *HeadAPIV2PlannersPlannerIDOK) GetPayload() *models.PartialPlanner { + return o.Payload +} + +func (o *HeadAPIV2PlannersPlannerIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialPlanner) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_responses.go b/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_responses.go new file mode 100644 index 00000000..5905c7c8 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/head_api_v2_planners_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2PlannersReader is a Reader for the HeadAPIV2Planners structure. +type HeadAPIV2PlannersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2PlannersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2PlannersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/planners] HeadAPIV2Planners", response, response.Code()) + } +} + +// NewHeadAPIV2PlannersOK creates a HeadAPIV2PlannersOK with default headers values +func NewHeadAPIV2PlannersOK() *HeadAPIV2PlannersOK { + return &HeadAPIV2PlannersOK{} +} + +/* +HeadAPIV2PlannersOK describes a response with status code 200, with default header values. + +Returns a list of matching planners in `PlannerSchema` format. +*/ +type HeadAPIV2PlannersOK struct { + Payload []*models.PartialPlanner +} + +// IsSuccess returns true when this head Api v2 planners o k response has a 2xx status code +func (o *HeadAPIV2PlannersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 planners o k response has a 3xx status code +func (o *HeadAPIV2PlannersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 planners o k response has a 4xx status code +func (o *HeadAPIV2PlannersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 planners o k response has a 5xx status code +func (o *HeadAPIV2PlannersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 planners o k response a status code equal to that given +func (o *HeadAPIV2PlannersOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 planners o k response +func (o *HeadAPIV2PlannersOK) Code() int { + return 200 +} + +func (o *HeadAPIV2PlannersOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/planners][%d] headApiV2PlannersOK %s", 200, payload) +} + +func (o *HeadAPIV2PlannersOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/planners][%d] headApiV2PlannersOK %s", 200, payload) +} + +func (o *HeadAPIV2PlannersOK) GetPayload() []*models.PartialPlanner { + return o.Payload +} + +func (o *HeadAPIV2PlannersOK) 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/core/capability/caldera/api/client/planners/patch_api_v2_planners_planner_id_parameters.go b/pkg/core/capability/caldera/api/client/planners/patch_api_v2_planners_planner_id_parameters.go new file mode 100644 index 00000000..e4ac08e6 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/patch_api_v2_planners_planner_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2PlannersPlannerIDParams creates a new PatchAPIV2PlannersPlannerIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2PlannersPlannerIDParams() *PatchAPIV2PlannersPlannerIDParams { + return &PatchAPIV2PlannersPlannerIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2PlannersPlannerIDParamsWithTimeout creates a new PatchAPIV2PlannersPlannerIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2PlannersPlannerIDParamsWithTimeout(timeout time.Duration) *PatchAPIV2PlannersPlannerIDParams { + return &PatchAPIV2PlannersPlannerIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2PlannersPlannerIDParamsWithContext creates a new PatchAPIV2PlannersPlannerIDParams object +// with the ability to set a context for a request. +func NewPatchAPIV2PlannersPlannerIDParamsWithContext(ctx context.Context) *PatchAPIV2PlannersPlannerIDParams { + return &PatchAPIV2PlannersPlannerIDParams{ + Context: ctx, + } +} + +// NewPatchAPIV2PlannersPlannerIDParamsWithHTTPClient creates a new PatchAPIV2PlannersPlannerIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2PlannersPlannerIDParamsWithHTTPClient(client *http.Client) *PatchAPIV2PlannersPlannerIDParams { + return &PatchAPIV2PlannersPlannerIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2PlannersPlannerIDParams contains all the parameters to send to the API endpoint + + for the patch API v2 planners planner ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2PlannersPlannerIDParams struct { + + // Body. + Body *models.PartialPlanner + + /* PlannerID. + + UUID of the Planner to be updated + */ + PlannerID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 planners planner ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2PlannersPlannerIDParams) WithDefaults() *PatchAPIV2PlannersPlannerIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 planners planner ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2PlannersPlannerIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) WithTimeout(timeout time.Duration) *PatchAPIV2PlannersPlannerIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) WithContext(ctx context.Context) *PatchAPIV2PlannersPlannerIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) WithHTTPClient(client *http.Client) *PatchAPIV2PlannersPlannerIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) WithBody(body *models.PartialPlanner) *PatchAPIV2PlannersPlannerIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) SetBody(body *models.PartialPlanner) { + o.Body = body +} + +// WithPlannerID adds the plannerID to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) WithPlannerID(plannerID string) *PatchAPIV2PlannersPlannerIDParams { + o.SetPlannerID(plannerID) + return o +} + +// SetPlannerID adds the plannerId to the patch API v2 planners planner ID params +func (o *PatchAPIV2PlannersPlannerIDParams) SetPlannerID(plannerID string) { + o.PlannerID = plannerID +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2PlannersPlannerIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param planner_id + if err := r.SetPathParam("planner_id", o.PlannerID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/planners/patch_api_v2_planners_planner_id_responses.go b/pkg/core/capability/caldera/api/client/planners/patch_api_v2_planners_planner_id_responses.go new file mode 100644 index 00000000..4ae99e37 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/patch_api_v2_planners_planner_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2PlannersPlannerIDReader is a Reader for the PatchAPIV2PlannersPlannerID structure. +type PatchAPIV2PlannersPlannerIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2PlannersPlannerIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2PlannersPlannerIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/planners/{planner_id}] PatchAPIV2PlannersPlannerID", response, response.Code()) + } +} + +// NewPatchAPIV2PlannersPlannerIDOK creates a PatchAPIV2PlannersPlannerIDOK with default headers values +func NewPatchAPIV2PlannersPlannerIDOK() *PatchAPIV2PlannersPlannerIDOK { + return &PatchAPIV2PlannersPlannerIDOK{} +} + +/* +PatchAPIV2PlannersPlannerIDOK describes a response with status code 200, with default header values. + +JSON dictionary representation of the replaced Planner. +*/ +type PatchAPIV2PlannersPlannerIDOK struct { + Payload *models.PartialPlanner +} + +// IsSuccess returns true when this patch Api v2 planners planner Id o k response has a 2xx status code +func (o *PatchAPIV2PlannersPlannerIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 planners planner Id o k response has a 3xx status code +func (o *PatchAPIV2PlannersPlannerIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 planners planner Id o k response has a 4xx status code +func (o *PatchAPIV2PlannersPlannerIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 planners planner Id o k response has a 5xx status code +func (o *PatchAPIV2PlannersPlannerIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 planners planner Id o k response a status code equal to that given +func (o *PatchAPIV2PlannersPlannerIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 planners planner Id o k response +func (o *PatchAPIV2PlannersPlannerIDOK) Code() int { + return 200 +} + +func (o *PatchAPIV2PlannersPlannerIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/planners/{planner_id}][%d] patchApiV2PlannersPlannerIdOK %s", 200, payload) +} + +func (o *PatchAPIV2PlannersPlannerIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/planners/{planner_id}][%d] patchApiV2PlannersPlannerIdOK %s", 200, payload) +} + +func (o *PatchAPIV2PlannersPlannerIDOK) GetPayload() *models.PartialPlanner { + return o.Payload +} + +func (o *PatchAPIV2PlannersPlannerIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialPlanner) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/planners/planners_client.go b/pkg/core/capability/caldera/api/client/planners/planners_client.go new file mode 100644 index 00000000..da71db68 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/planners/planners_client.go @@ -0,0 +1,275 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package planners + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new planners API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new planners API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new planners API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for planners API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIV2Planners(params *GetAPIV2PlannersParams, opts ...ClientOption) (*GetAPIV2PlannersOK, error) + + GetAPIV2PlannersPlannerID(params *GetAPIV2PlannersPlannerIDParams, opts ...ClientOption) (*GetAPIV2PlannersPlannerIDOK, error) + + HeadAPIV2Planners(params *HeadAPIV2PlannersParams, opts ...ClientOption) (*HeadAPIV2PlannersOK, error) + + HeadAPIV2PlannersPlannerID(params *HeadAPIV2PlannersPlannerIDParams, opts ...ClientOption) (*HeadAPIV2PlannersPlannerIDOK, error) + + PatchAPIV2PlannersPlannerID(params *PatchAPIV2PlannersPlannerIDParams, opts ...ClientOption) (*PatchAPIV2PlannersPlannerIDOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIV2Planners retrieves planners + +Retrieve Caldera planners by criteria. Supply fields from the `PlannerSchema` to the `include` and `exclude` fields of the `BaseGetAllQuerySchema` in the request body to filter retrieved planners. +*/ +func (a *Client) GetAPIV2Planners(params *GetAPIV2PlannersParams, opts ...ClientOption) (*GetAPIV2PlannersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2PlannersParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Planners", + Method: "GET", + PathPattern: "/api/v2/planners", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2PlannersReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2PlannersOK) + 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 GetAPIV2Planners: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2PlannersPlannerID retrieves a planner by planner id + +Retrieve one Caldera planner based on the planner id (String `UUID`). Supply fields from the `PlannerSchema` to the `include` and `exclude` fields of the `BaseGetOneQuerySchema` in the request body to filter retrieved planners. +*/ +func (a *Client) GetAPIV2PlannersPlannerID(params *GetAPIV2PlannersPlannerIDParams, opts ...ClientOption) (*GetAPIV2PlannersPlannerIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2PlannersPlannerIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2PlannersPlannerID", + Method: "GET", + PathPattern: "/api/v2/planners/{planner_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2PlannersPlannerIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2PlannersPlannerIDOK) + 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 GetAPIV2PlannersPlannerID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Planners retrieves planners + +Retrieve Caldera planners by criteria. Supply fields from the `PlannerSchema` to the `include` and `exclude` fields of the `BaseGetAllQuerySchema` in the request body to filter retrieved planners. +*/ +func (a *Client) HeadAPIV2Planners(params *HeadAPIV2PlannersParams, opts ...ClientOption) (*HeadAPIV2PlannersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2PlannersParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Planners", + Method: "HEAD", + PathPattern: "/api/v2/planners", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2PlannersReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2PlannersOK) + 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 HeadAPIV2Planners: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2PlannersPlannerID retrieves a planner by planner id + +Retrieve one Caldera planner based on the planner id (String `UUID`). Supply fields from the `PlannerSchema` to the `include` and `exclude` fields of the `BaseGetOneQuerySchema` in the request body to filter retrieved planners. +*/ +func (a *Client) HeadAPIV2PlannersPlannerID(params *HeadAPIV2PlannersPlannerIDParams, opts ...ClientOption) (*HeadAPIV2PlannersPlannerIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2PlannersPlannerIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2PlannersPlannerID", + Method: "HEAD", + PathPattern: "/api/v2/planners/{planner_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2PlannersPlannerIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2PlannersPlannerIDOK) + 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 HeadAPIV2PlannersPlannerID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2PlannersPlannerID updates an existing planner + +Updates a planner based on the `PlannerSchema` value provided in the message body. +*/ +func (a *Client) PatchAPIV2PlannersPlannerID(params *PatchAPIV2PlannersPlannerIDParams, opts ...ClientOption) (*PatchAPIV2PlannersPlannerIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2PlannersPlannerIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2PlannersPlannerID", + Method: "PATCH", + PathPattern: "/api/v2/planners/{planner_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2PlannersPlannerIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2PlannersPlannerIDOK) + 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 PatchAPIV2PlannersPlannerID: 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/core/capability/caldera/api/client/plugins/get_api_v2_plugins_name_parameters.go b/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_name_parameters.go new file mode 100644 index 00000000..7c9227b0 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_name_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" +) + +// NewGetAPIV2PluginsNameParams creates a new GetAPIV2PluginsNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2PluginsNameParams() *GetAPIV2PluginsNameParams { + return &GetAPIV2PluginsNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2PluginsNameParamsWithTimeout creates a new GetAPIV2PluginsNameParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2PluginsNameParamsWithTimeout(timeout time.Duration) *GetAPIV2PluginsNameParams { + return &GetAPIV2PluginsNameParams{ + timeout: timeout, + } +} + +// NewGetAPIV2PluginsNameParamsWithContext creates a new GetAPIV2PluginsNameParams object +// with the ability to set a context for a request. +func NewGetAPIV2PluginsNameParamsWithContext(ctx context.Context) *GetAPIV2PluginsNameParams { + return &GetAPIV2PluginsNameParams{ + Context: ctx, + } +} + +// NewGetAPIV2PluginsNameParamsWithHTTPClient creates a new GetAPIV2PluginsNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2PluginsNameParamsWithHTTPClient(client *http.Client) *GetAPIV2PluginsNameParams { + return &GetAPIV2PluginsNameParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2PluginsNameParams contains all the parameters to send to the API endpoint + + for the get API v2 plugins name operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2PluginsNameParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + /* Name. + + The name of the plugin + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 plugins name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PluginsNameParams) WithDefaults() *GetAPIV2PluginsNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 plugins name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PluginsNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) WithTimeout(timeout time.Duration) *GetAPIV2PluginsNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) WithContext(ctx context.Context) *GetAPIV2PluginsNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) WithHTTPClient(client *http.Client) *GetAPIV2PluginsNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) WithExclude(exclude []string) *GetAPIV2PluginsNameParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) WithInclude(include []string) *GetAPIV2PluginsNameParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) SetInclude(include []string) { + o.Include = include +} + +// WithName adds the name to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) WithName(name string) *GetAPIV2PluginsNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the get API v2 plugins name params +func (o *GetAPIV2PluginsNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2PluginsNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2PluginsName binds the parameter exclude +func (o *GetAPIV2PluginsNameParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2PluginsName binds the parameter include +func (o *GetAPIV2PluginsNameParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_name_responses.go b/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_name_responses.go new file mode 100644 index 00000000..e0a6b8d2 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_name_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2PluginsNameReader is a Reader for the GetAPIV2PluginsName structure. +type GetAPIV2PluginsNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2PluginsNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2PluginsNameOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/plugins/{name}] GetAPIV2PluginsName", response, response.Code()) + } +} + +// NewGetAPIV2PluginsNameOK creates a GetAPIV2PluginsNameOK with default headers values +func NewGetAPIV2PluginsNameOK() *GetAPIV2PluginsNameOK { + return &GetAPIV2PluginsNameOK{} +} + +/* +GetAPIV2PluginsNameOK describes a response with status code 200, with default header values. + +Returns a plugin in `PluginSchema` format with the requested name, if it exists. +*/ +type GetAPIV2PluginsNameOK struct { + Payload *models.PartialPlugin +} + +// IsSuccess returns true when this get Api v2 plugins name o k response has a 2xx status code +func (o *GetAPIV2PluginsNameOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 plugins name o k response has a 3xx status code +func (o *GetAPIV2PluginsNameOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 plugins name o k response has a 4xx status code +func (o *GetAPIV2PluginsNameOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 plugins name o k response has a 5xx status code +func (o *GetAPIV2PluginsNameOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 plugins name o k response a status code equal to that given +func (o *GetAPIV2PluginsNameOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 plugins name o k response +func (o *GetAPIV2PluginsNameOK) Code() int { + return 200 +} + +func (o *GetAPIV2PluginsNameOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/plugins/{name}][%d] getApiV2PluginsNameOK %s", 200, payload) +} + +func (o *GetAPIV2PluginsNameOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/plugins/{name}][%d] getApiV2PluginsNameOK %s", 200, payload) +} + +func (o *GetAPIV2PluginsNameOK) GetPayload() *models.PartialPlugin { + return o.Payload +} + +func (o *GetAPIV2PluginsNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialPlugin) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_parameters.go b/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_parameters.go new file mode 100644 index 00000000..132e08b9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" +) + +// NewGetAPIV2PluginsParams creates a new GetAPIV2PluginsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2PluginsParams() *GetAPIV2PluginsParams { + return &GetAPIV2PluginsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2PluginsParamsWithTimeout creates a new GetAPIV2PluginsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2PluginsParamsWithTimeout(timeout time.Duration) *GetAPIV2PluginsParams { + return &GetAPIV2PluginsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2PluginsParamsWithContext creates a new GetAPIV2PluginsParams object +// with the ability to set a context for a request. +func NewGetAPIV2PluginsParamsWithContext(ctx context.Context) *GetAPIV2PluginsParams { + return &GetAPIV2PluginsParams{ + Context: ctx, + } +} + +// NewGetAPIV2PluginsParamsWithHTTPClient creates a new GetAPIV2PluginsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2PluginsParamsWithHTTPClient(client *http.Client) *GetAPIV2PluginsParams { + return &GetAPIV2PluginsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2PluginsParams contains all the parameters to send to the API endpoint + + for the get API v2 plugins operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2PluginsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 plugins params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PluginsParams) WithDefaults() *GetAPIV2PluginsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 plugins params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2PluginsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) WithTimeout(timeout time.Duration) *GetAPIV2PluginsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) WithContext(ctx context.Context) *GetAPIV2PluginsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) WithHTTPClient(client *http.Client) *GetAPIV2PluginsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) WithExclude(exclude []string) *GetAPIV2PluginsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) WithInclude(include []string) *GetAPIV2PluginsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) WithSort(sort *string) *GetAPIV2PluginsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 plugins params +func (o *GetAPIV2PluginsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2PluginsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Plugins binds the parameter exclude +func (o *GetAPIV2PluginsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Plugins binds the parameter include +func (o *GetAPIV2PluginsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_responses.go b/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_responses.go new file mode 100644 index 00000000..1cfb8eb8 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/get_api_v2_plugins_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2PluginsReader is a Reader for the GetAPIV2Plugins structure. +type GetAPIV2PluginsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2PluginsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2PluginsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/plugins] GetAPIV2Plugins", response, response.Code()) + } +} + +// NewGetAPIV2PluginsOK creates a GetAPIV2PluginsOK with default headers values +func NewGetAPIV2PluginsOK() *GetAPIV2PluginsOK { + return &GetAPIV2PluginsOK{} +} + +/* +GetAPIV2PluginsOK describes a response with status code 200, with default header values. + +Returns a list in `PluginSchema` format of all available plugins in the system. +*/ +type GetAPIV2PluginsOK struct { + Payload []*models.PartialPlugin +} + +// IsSuccess returns true when this get Api v2 plugins o k response has a 2xx status code +func (o *GetAPIV2PluginsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 plugins o k response has a 3xx status code +func (o *GetAPIV2PluginsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 plugins o k response has a 4xx status code +func (o *GetAPIV2PluginsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 plugins o k response has a 5xx status code +func (o *GetAPIV2PluginsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 plugins o k response a status code equal to that given +func (o *GetAPIV2PluginsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 plugins o k response +func (o *GetAPIV2PluginsOK) Code() int { + return 200 +} + +func (o *GetAPIV2PluginsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/plugins][%d] getApiV2PluginsOK %s", 200, payload) +} + +func (o *GetAPIV2PluginsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/plugins][%d] getApiV2PluginsOK %s", 200, payload) +} + +func (o *GetAPIV2PluginsOK) GetPayload() []*models.PartialPlugin { + return o.Payload +} + +func (o *GetAPIV2PluginsOK) 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/core/capability/caldera/api/client/plugins/head_api_v2_plugins_name_parameters.go b/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_name_parameters.go new file mode 100644 index 00000000..61479f3b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_name_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" +) + +// NewHeadAPIV2PluginsNameParams creates a new HeadAPIV2PluginsNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2PluginsNameParams() *HeadAPIV2PluginsNameParams { + return &HeadAPIV2PluginsNameParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2PluginsNameParamsWithTimeout creates a new HeadAPIV2PluginsNameParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2PluginsNameParamsWithTimeout(timeout time.Duration) *HeadAPIV2PluginsNameParams { + return &HeadAPIV2PluginsNameParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2PluginsNameParamsWithContext creates a new HeadAPIV2PluginsNameParams object +// with the ability to set a context for a request. +func NewHeadAPIV2PluginsNameParamsWithContext(ctx context.Context) *HeadAPIV2PluginsNameParams { + return &HeadAPIV2PluginsNameParams{ + Context: ctx, + } +} + +// NewHeadAPIV2PluginsNameParamsWithHTTPClient creates a new HeadAPIV2PluginsNameParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2PluginsNameParamsWithHTTPClient(client *http.Client) *HeadAPIV2PluginsNameParams { + return &HeadAPIV2PluginsNameParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2PluginsNameParams contains all the parameters to send to the API endpoint + + for the head API v2 plugins name operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2PluginsNameParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + /* Name. + + The name of the plugin + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 plugins name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PluginsNameParams) WithDefaults() *HeadAPIV2PluginsNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 plugins name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PluginsNameParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) WithTimeout(timeout time.Duration) *HeadAPIV2PluginsNameParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) WithContext(ctx context.Context) *HeadAPIV2PluginsNameParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) WithHTTPClient(client *http.Client) *HeadAPIV2PluginsNameParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) WithExclude(exclude []string) *HeadAPIV2PluginsNameParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) WithInclude(include []string) *HeadAPIV2PluginsNameParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) SetInclude(include []string) { + o.Include = include +} + +// WithName adds the name to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) WithName(name string) *HeadAPIV2PluginsNameParams { + o.SetName(name) + return o +} + +// SetName adds the name to the head API v2 plugins name params +func (o *HeadAPIV2PluginsNameParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2PluginsNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param name + if err := r.SetPathParam("name", o.Name); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2PluginsName binds the parameter exclude +func (o *HeadAPIV2PluginsNameParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2PluginsName binds the parameter include +func (o *HeadAPIV2PluginsNameParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_name_responses.go b/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_name_responses.go new file mode 100644 index 00000000..ac283302 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_name_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2PluginsNameReader is a Reader for the HeadAPIV2PluginsName structure. +type HeadAPIV2PluginsNameReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2PluginsNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2PluginsNameOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/plugins/{name}] HeadAPIV2PluginsName", response, response.Code()) + } +} + +// NewHeadAPIV2PluginsNameOK creates a HeadAPIV2PluginsNameOK with default headers values +func NewHeadAPIV2PluginsNameOK() *HeadAPIV2PluginsNameOK { + return &HeadAPIV2PluginsNameOK{} +} + +/* +HeadAPIV2PluginsNameOK describes a response with status code 200, with default header values. + +Returns a plugin in `PluginSchema` format with the requested name, if it exists. +*/ +type HeadAPIV2PluginsNameOK struct { + Payload *models.PartialPlugin +} + +// IsSuccess returns true when this head Api v2 plugins name o k response has a 2xx status code +func (o *HeadAPIV2PluginsNameOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 plugins name o k response has a 3xx status code +func (o *HeadAPIV2PluginsNameOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 plugins name o k response has a 4xx status code +func (o *HeadAPIV2PluginsNameOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 plugins name o k response has a 5xx status code +func (o *HeadAPIV2PluginsNameOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 plugins name o k response a status code equal to that given +func (o *HeadAPIV2PluginsNameOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 plugins name o k response +func (o *HeadAPIV2PluginsNameOK) Code() int { + return 200 +} + +func (o *HeadAPIV2PluginsNameOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/plugins/{name}][%d] headApiV2PluginsNameOK %s", 200, payload) +} + +func (o *HeadAPIV2PluginsNameOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/plugins/{name}][%d] headApiV2PluginsNameOK %s", 200, payload) +} + +func (o *HeadAPIV2PluginsNameOK) GetPayload() *models.PartialPlugin { + return o.Payload +} + +func (o *HeadAPIV2PluginsNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialPlugin) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_parameters.go b/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_parameters.go new file mode 100644 index 00000000..3c9ff8cf --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" +) + +// NewHeadAPIV2PluginsParams creates a new HeadAPIV2PluginsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2PluginsParams() *HeadAPIV2PluginsParams { + return &HeadAPIV2PluginsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2PluginsParamsWithTimeout creates a new HeadAPIV2PluginsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2PluginsParamsWithTimeout(timeout time.Duration) *HeadAPIV2PluginsParams { + return &HeadAPIV2PluginsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2PluginsParamsWithContext creates a new HeadAPIV2PluginsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2PluginsParamsWithContext(ctx context.Context) *HeadAPIV2PluginsParams { + return &HeadAPIV2PluginsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2PluginsParamsWithHTTPClient creates a new HeadAPIV2PluginsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2PluginsParamsWithHTTPClient(client *http.Client) *HeadAPIV2PluginsParams { + return &HeadAPIV2PluginsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2PluginsParams contains all the parameters to send to the API endpoint + + for the head API v2 plugins operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2PluginsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 plugins params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PluginsParams) WithDefaults() *HeadAPIV2PluginsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 plugins params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2PluginsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) WithTimeout(timeout time.Duration) *HeadAPIV2PluginsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) WithContext(ctx context.Context) *HeadAPIV2PluginsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) WithHTTPClient(client *http.Client) *HeadAPIV2PluginsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) WithExclude(exclude []string) *HeadAPIV2PluginsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) WithInclude(include []string) *HeadAPIV2PluginsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) WithSort(sort *string) *HeadAPIV2PluginsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 plugins params +func (o *HeadAPIV2PluginsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2PluginsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Plugins binds the parameter exclude +func (o *HeadAPIV2PluginsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Plugins binds the parameter include +func (o *HeadAPIV2PluginsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_responses.go b/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_responses.go new file mode 100644 index 00000000..ff8e5879 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/head_api_v2_plugins_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2PluginsReader is a Reader for the HeadAPIV2Plugins structure. +type HeadAPIV2PluginsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2PluginsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2PluginsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/plugins] HeadAPIV2Plugins", response, response.Code()) + } +} + +// NewHeadAPIV2PluginsOK creates a HeadAPIV2PluginsOK with default headers values +func NewHeadAPIV2PluginsOK() *HeadAPIV2PluginsOK { + return &HeadAPIV2PluginsOK{} +} + +/* +HeadAPIV2PluginsOK describes a response with status code 200, with default header values. + +Returns a list in `PluginSchema` format of all available plugins in the system. +*/ +type HeadAPIV2PluginsOK struct { + Payload []*models.PartialPlugin +} + +// IsSuccess returns true when this head Api v2 plugins o k response has a 2xx status code +func (o *HeadAPIV2PluginsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 plugins o k response has a 3xx status code +func (o *HeadAPIV2PluginsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 plugins o k response has a 4xx status code +func (o *HeadAPIV2PluginsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 plugins o k response has a 5xx status code +func (o *HeadAPIV2PluginsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 plugins o k response a status code equal to that given +func (o *HeadAPIV2PluginsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 plugins o k response +func (o *HeadAPIV2PluginsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2PluginsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/plugins][%d] headApiV2PluginsOK %s", 200, payload) +} + +func (o *HeadAPIV2PluginsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/plugins][%d] headApiV2PluginsOK %s", 200, payload) +} + +func (o *HeadAPIV2PluginsOK) GetPayload() []*models.PartialPlugin { + return o.Payload +} + +func (o *HeadAPIV2PluginsOK) 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/core/capability/caldera/api/client/plugins/plugins_client.go b/pkg/core/capability/caldera/api/client/plugins/plugins_client.go new file mode 100644 index 00000000..f3c79e0c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/plugins/plugins_client.go @@ -0,0 +1,233 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package plugins + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new plugins API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new plugins API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new plugins API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for plugins API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIV2Plugins(params *GetAPIV2PluginsParams, opts ...ClientOption) (*GetAPIV2PluginsOK, error) + + GetAPIV2PluginsName(params *GetAPIV2PluginsNameParams, opts ...ClientOption) (*GetAPIV2PluginsNameOK, error) + + HeadAPIV2Plugins(params *HeadAPIV2PluginsParams, opts ...ClientOption) (*HeadAPIV2PluginsOK, error) + + HeadAPIV2PluginsName(params *HeadAPIV2PluginsNameParams, opts ...ClientOption) (*HeadAPIV2PluginsNameOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIV2Plugins retrieves all plugins + +Returns a list of all available plugins in the system, including directory, description,and active status. Supply fields from the `PluginSchema` to the include and exclude fields of the `BaseGetAllQuerySchema` in the request body to filter retrieved plugins. +*/ +func (a *Client) GetAPIV2Plugins(params *GetAPIV2PluginsParams, opts ...ClientOption) (*GetAPIV2PluginsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2PluginsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Plugins", + Method: "GET", + PathPattern: "/api/v2/plugins", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2PluginsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2PluginsOK) + 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 GetAPIV2Plugins: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2PluginsName retrieves plugin by name + +If plugin was found with a matching name, an object containing information about the plugin is returned. +*/ +func (a *Client) GetAPIV2PluginsName(params *GetAPIV2PluginsNameParams, opts ...ClientOption) (*GetAPIV2PluginsNameOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2PluginsNameParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2PluginsName", + Method: "GET", + PathPattern: "/api/v2/plugins/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2PluginsNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2PluginsNameOK) + 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 GetAPIV2PluginsName: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Plugins retrieves all plugins + +Returns a list of all available plugins in the system, including directory, description,and active status. Supply fields from the `PluginSchema` to the include and exclude fields of the `BaseGetAllQuerySchema` in the request body to filter retrieved plugins. +*/ +func (a *Client) HeadAPIV2Plugins(params *HeadAPIV2PluginsParams, opts ...ClientOption) (*HeadAPIV2PluginsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2PluginsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Plugins", + Method: "HEAD", + PathPattern: "/api/v2/plugins", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2PluginsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2PluginsOK) + 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 HeadAPIV2Plugins: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2PluginsName retrieves plugin by name + +If plugin was found with a matching name, an object containing information about the plugin is returned. +*/ +func (a *Client) HeadAPIV2PluginsName(params *HeadAPIV2PluginsNameParams, opts ...ClientOption) (*HeadAPIV2PluginsNameOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2PluginsNameParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2PluginsName", + Method: "HEAD", + PathPattern: "/api/v2/plugins/{name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2PluginsNameReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2PluginsNameOK) + 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 HeadAPIV2PluginsName: 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/core/capability/caldera/api/client/relationships/delete_api_v2_relationships_parameters.go b/pkg/core/capability/caldera/api/client/relationships/delete_api_v2_relationships_parameters.go new file mode 100644 index 00000000..effb170f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/delete_api_v2_relationships_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewDeleteAPIV2RelationshipsParams creates a new DeleteAPIV2RelationshipsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2RelationshipsParams() *DeleteAPIV2RelationshipsParams { + return &DeleteAPIV2RelationshipsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2RelationshipsParamsWithTimeout creates a new DeleteAPIV2RelationshipsParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2RelationshipsParamsWithTimeout(timeout time.Duration) *DeleteAPIV2RelationshipsParams { + return &DeleteAPIV2RelationshipsParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2RelationshipsParamsWithContext creates a new DeleteAPIV2RelationshipsParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2RelationshipsParamsWithContext(ctx context.Context) *DeleteAPIV2RelationshipsParams { + return &DeleteAPIV2RelationshipsParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2RelationshipsParamsWithHTTPClient creates a new DeleteAPIV2RelationshipsParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2RelationshipsParamsWithHTTPClient(client *http.Client) *DeleteAPIV2RelationshipsParams { + return &DeleteAPIV2RelationshipsParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2RelationshipsParams contains all the parameters to send to the API endpoint + + for the delete API v2 relationships operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2RelationshipsParams struct { + + // Body. + Body *models.PartialRelationship + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2RelationshipsParams) WithDefaults() *DeleteAPIV2RelationshipsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2RelationshipsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 relationships params +func (o *DeleteAPIV2RelationshipsParams) WithTimeout(timeout time.Duration) *DeleteAPIV2RelationshipsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 relationships params +func (o *DeleteAPIV2RelationshipsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 relationships params +func (o *DeleteAPIV2RelationshipsParams) WithContext(ctx context.Context) *DeleteAPIV2RelationshipsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 relationships params +func (o *DeleteAPIV2RelationshipsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 relationships params +func (o *DeleteAPIV2RelationshipsParams) WithHTTPClient(client *http.Client) *DeleteAPIV2RelationshipsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 relationships params +func (o *DeleteAPIV2RelationshipsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the delete API v2 relationships params +func (o *DeleteAPIV2RelationshipsParams) WithBody(body *models.PartialRelationship) *DeleteAPIV2RelationshipsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the delete API v2 relationships params +func (o *DeleteAPIV2RelationshipsParams) SetBody(body *models.PartialRelationship) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2RelationshipsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/delete_api_v2_relationships_responses.go b/pkg/core/capability/caldera/api/client/relationships/delete_api_v2_relationships_responses.go new file mode 100644 index 00000000..b2974d9e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/delete_api_v2_relationships_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// DeleteAPIV2RelationshipsReader is a Reader for the DeleteAPIV2Relationships structure. +type DeleteAPIV2RelationshipsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2RelationshipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPIV2RelationshipsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/relationships] DeleteAPIV2Relationships", response, response.Code()) + } +} + +// NewDeleteAPIV2RelationshipsOK creates a DeleteAPIV2RelationshipsOK with default headers values +func NewDeleteAPIV2RelationshipsOK() *DeleteAPIV2RelationshipsOK { + return &DeleteAPIV2RelationshipsOK{} +} + +/* +DeleteAPIV2RelationshipsOK describes a response with status code 200, with default header values. + +Returns the deleted relationship(s), dumped in RelationshipSchema format. +*/ +type DeleteAPIV2RelationshipsOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this delete Api v2 relationships o k response has a 2xx status code +func (o *DeleteAPIV2RelationshipsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 relationships o k response has a 3xx status code +func (o *DeleteAPIV2RelationshipsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 relationships o k response has a 4xx status code +func (o *DeleteAPIV2RelationshipsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 relationships o k response has a 5xx status code +func (o *DeleteAPIV2RelationshipsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 relationships o k response a status code equal to that given +func (o *DeleteAPIV2RelationshipsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete Api v2 relationships o k response +func (o *DeleteAPIV2RelationshipsOK) Code() int { + return 200 +} + +func (o *DeleteAPIV2RelationshipsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/relationships][%d] deleteApiV2RelationshipsOK %s", 200, payload) +} + +func (o *DeleteAPIV2RelationshipsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/relationships][%d] deleteApiV2RelationshipsOK %s", 200, payload) +} + +func (o *DeleteAPIV2RelationshipsOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *DeleteAPIV2RelationshipsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_operation_id_parameters.go b/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_operation_id_parameters.go new file mode 100644 index 00000000..01612a68 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_operation_id_parameters.go @@ -0,0 +1,264 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" +) + +// NewGetAPIV2RelationshipsOperationIDParams creates a new GetAPIV2RelationshipsOperationIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2RelationshipsOperationIDParams() *GetAPIV2RelationshipsOperationIDParams { + return &GetAPIV2RelationshipsOperationIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2RelationshipsOperationIDParamsWithTimeout creates a new GetAPIV2RelationshipsOperationIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2RelationshipsOperationIDParamsWithTimeout(timeout time.Duration) *GetAPIV2RelationshipsOperationIDParams { + return &GetAPIV2RelationshipsOperationIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2RelationshipsOperationIDParamsWithContext creates a new GetAPIV2RelationshipsOperationIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2RelationshipsOperationIDParamsWithContext(ctx context.Context) *GetAPIV2RelationshipsOperationIDParams { + return &GetAPIV2RelationshipsOperationIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2RelationshipsOperationIDParamsWithHTTPClient creates a new GetAPIV2RelationshipsOperationIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2RelationshipsOperationIDParamsWithHTTPClient(client *http.Client) *GetAPIV2RelationshipsOperationIDParams { + return &GetAPIV2RelationshipsOperationIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2RelationshipsOperationIDParams contains all the parameters to send to the API endpoint + + for the get API v2 relationships operation ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2RelationshipsOperationIDParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // OperationID. + OperationID string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 relationships operation ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2RelationshipsOperationIDParams) WithDefaults() *GetAPIV2RelationshipsOperationIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 relationships operation ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2RelationshipsOperationIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) WithTimeout(timeout time.Duration) *GetAPIV2RelationshipsOperationIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) WithContext(ctx context.Context) *GetAPIV2RelationshipsOperationIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) WithHTTPClient(client *http.Client) *GetAPIV2RelationshipsOperationIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) WithExclude(exclude []string) *GetAPIV2RelationshipsOperationIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) WithInclude(include []string) *GetAPIV2RelationshipsOperationIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) SetInclude(include []string) { + o.Include = include +} + +// WithOperationID adds the operationID to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) WithOperationID(operationID string) *GetAPIV2RelationshipsOperationIDParams { + o.SetOperationID(operationID) + return o +} + +// SetOperationID adds the operationId to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) SetOperationID(operationID string) { + o.OperationID = operationID +} + +// WithSort adds the sort to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) WithSort(sort *string) *GetAPIV2RelationshipsOperationIDParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 relationships operation ID params +func (o *GetAPIV2RelationshipsOperationIDParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2RelationshipsOperationIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param operation_id + if err := r.SetPathParam("operation_id", o.OperationID); err != nil { + return err + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2RelationshipsOperationID binds the parameter exclude +func (o *GetAPIV2RelationshipsOperationIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2RelationshipsOperationID binds the parameter include +func (o *GetAPIV2RelationshipsOperationIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_operation_id_responses.go b/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_operation_id_responses.go new file mode 100644 index 00000000..f6996c56 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_operation_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2RelationshipsOperationIDReader is a Reader for the GetAPIV2RelationshipsOperationID structure. +type GetAPIV2RelationshipsOperationIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2RelationshipsOperationIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2RelationshipsOperationIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/relationships/{operation_id}] GetAPIV2RelationshipsOperationID", response, response.Code()) + } +} + +// NewGetAPIV2RelationshipsOperationIDOK creates a GetAPIV2RelationshipsOperationIDOK with default headers values +func NewGetAPIV2RelationshipsOperationIDOK() *GetAPIV2RelationshipsOperationIDOK { + return &GetAPIV2RelationshipsOperationIDOK{} +} + +/* +GetAPIV2RelationshipsOperationIDOK describes a response with status code 200, with default header values. + +Returns a list of matching relationships, dumped in `RelationshipSchema` format. +*/ +type GetAPIV2RelationshipsOperationIDOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this get Api v2 relationships operation Id o k response has a 2xx status code +func (o *GetAPIV2RelationshipsOperationIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 relationships operation Id o k response has a 3xx status code +func (o *GetAPIV2RelationshipsOperationIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 relationships operation Id o k response has a 4xx status code +func (o *GetAPIV2RelationshipsOperationIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 relationships operation Id o k response has a 5xx status code +func (o *GetAPIV2RelationshipsOperationIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 relationships operation Id o k response a status code equal to that given +func (o *GetAPIV2RelationshipsOperationIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 relationships operation Id o k response +func (o *GetAPIV2RelationshipsOperationIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2RelationshipsOperationIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/relationships/{operation_id}][%d] getApiV2RelationshipsOperationIdOK %s", 200, payload) +} + +func (o *GetAPIV2RelationshipsOperationIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/relationships/{operation_id}][%d] getApiV2RelationshipsOperationIdOK %s", 200, payload) +} + +func (o *GetAPIV2RelationshipsOperationIDOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *GetAPIV2RelationshipsOperationIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_parameters.go b/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_parameters.go new file mode 100644 index 00000000..7fbf3ad9 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" +) + +// NewGetAPIV2RelationshipsParams creates a new GetAPIV2RelationshipsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2RelationshipsParams() *GetAPIV2RelationshipsParams { + return &GetAPIV2RelationshipsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2RelationshipsParamsWithTimeout creates a new GetAPIV2RelationshipsParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2RelationshipsParamsWithTimeout(timeout time.Duration) *GetAPIV2RelationshipsParams { + return &GetAPIV2RelationshipsParams{ + timeout: timeout, + } +} + +// NewGetAPIV2RelationshipsParamsWithContext creates a new GetAPIV2RelationshipsParams object +// with the ability to set a context for a request. +func NewGetAPIV2RelationshipsParamsWithContext(ctx context.Context) *GetAPIV2RelationshipsParams { + return &GetAPIV2RelationshipsParams{ + Context: ctx, + } +} + +// NewGetAPIV2RelationshipsParamsWithHTTPClient creates a new GetAPIV2RelationshipsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2RelationshipsParamsWithHTTPClient(client *http.Client) *GetAPIV2RelationshipsParams { + return &GetAPIV2RelationshipsParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2RelationshipsParams contains all the parameters to send to the API endpoint + + for the get API v2 relationships operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2RelationshipsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2RelationshipsParams) WithDefaults() *GetAPIV2RelationshipsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2RelationshipsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) WithTimeout(timeout time.Duration) *GetAPIV2RelationshipsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) WithContext(ctx context.Context) *GetAPIV2RelationshipsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) WithHTTPClient(client *http.Client) *GetAPIV2RelationshipsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) WithExclude(exclude []string) *GetAPIV2RelationshipsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) WithInclude(include []string) *GetAPIV2RelationshipsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) WithSort(sort *string) *GetAPIV2RelationshipsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 relationships params +func (o *GetAPIV2RelationshipsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2RelationshipsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Relationships binds the parameter exclude +func (o *GetAPIV2RelationshipsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Relationships binds the parameter include +func (o *GetAPIV2RelationshipsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_responses.go b/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_responses.go new file mode 100644 index 00000000..03767731 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/get_api_v2_relationships_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2RelationshipsReader is a Reader for the GetAPIV2Relationships structure. +type GetAPIV2RelationshipsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2RelationshipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2RelationshipsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/relationships] GetAPIV2Relationships", response, response.Code()) + } +} + +// NewGetAPIV2RelationshipsOK creates a GetAPIV2RelationshipsOK with default headers values +func NewGetAPIV2RelationshipsOK() *GetAPIV2RelationshipsOK { + return &GetAPIV2RelationshipsOK{} +} + +/* +GetAPIV2RelationshipsOK describes a response with status code 200, with default header values. + +Returns a list of matching relationships, dumped in `RelationshipSchema` format. +*/ +type GetAPIV2RelationshipsOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this get Api v2 relationships o k response has a 2xx status code +func (o *GetAPIV2RelationshipsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 relationships o k response has a 3xx status code +func (o *GetAPIV2RelationshipsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 relationships o k response has a 4xx status code +func (o *GetAPIV2RelationshipsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 relationships o k response has a 5xx status code +func (o *GetAPIV2RelationshipsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 relationships o k response a status code equal to that given +func (o *GetAPIV2RelationshipsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 relationships o k response +func (o *GetAPIV2RelationshipsOK) Code() int { + return 200 +} + +func (o *GetAPIV2RelationshipsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/relationships][%d] getApiV2RelationshipsOK %s", 200, payload) +} + +func (o *GetAPIV2RelationshipsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/relationships][%d] getApiV2RelationshipsOK %s", 200, payload) +} + +func (o *GetAPIV2RelationshipsOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *GetAPIV2RelationshipsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_operation_id_parameters.go b/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_operation_id_parameters.go new file mode 100644 index 00000000..bf262bc4 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_operation_id_parameters.go @@ -0,0 +1,264 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" +) + +// NewHeadAPIV2RelationshipsOperationIDParams creates a new HeadAPIV2RelationshipsOperationIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2RelationshipsOperationIDParams() *HeadAPIV2RelationshipsOperationIDParams { + return &HeadAPIV2RelationshipsOperationIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2RelationshipsOperationIDParamsWithTimeout creates a new HeadAPIV2RelationshipsOperationIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2RelationshipsOperationIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2RelationshipsOperationIDParams { + return &HeadAPIV2RelationshipsOperationIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2RelationshipsOperationIDParamsWithContext creates a new HeadAPIV2RelationshipsOperationIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2RelationshipsOperationIDParamsWithContext(ctx context.Context) *HeadAPIV2RelationshipsOperationIDParams { + return &HeadAPIV2RelationshipsOperationIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2RelationshipsOperationIDParamsWithHTTPClient creates a new HeadAPIV2RelationshipsOperationIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2RelationshipsOperationIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2RelationshipsOperationIDParams { + return &HeadAPIV2RelationshipsOperationIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2RelationshipsOperationIDParams contains all the parameters to send to the API endpoint + + for the head API v2 relationships operation ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2RelationshipsOperationIDParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // OperationID. + OperationID string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 relationships operation ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2RelationshipsOperationIDParams) WithDefaults() *HeadAPIV2RelationshipsOperationIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 relationships operation ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2RelationshipsOperationIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2RelationshipsOperationIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) WithContext(ctx context.Context) *HeadAPIV2RelationshipsOperationIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2RelationshipsOperationIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) WithExclude(exclude []string) *HeadAPIV2RelationshipsOperationIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) WithInclude(include []string) *HeadAPIV2RelationshipsOperationIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) SetInclude(include []string) { + o.Include = include +} + +// WithOperationID adds the operationID to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) WithOperationID(operationID string) *HeadAPIV2RelationshipsOperationIDParams { + o.SetOperationID(operationID) + return o +} + +// SetOperationID adds the operationId to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) SetOperationID(operationID string) { + o.OperationID = operationID +} + +// WithSort adds the sort to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) WithSort(sort *string) *HeadAPIV2RelationshipsOperationIDParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 relationships operation ID params +func (o *HeadAPIV2RelationshipsOperationIDParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2RelationshipsOperationIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + // path param operation_id + if err := r.SetPathParam("operation_id", o.OperationID); err != nil { + return err + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2RelationshipsOperationID binds the parameter exclude +func (o *HeadAPIV2RelationshipsOperationIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2RelationshipsOperationID binds the parameter include +func (o *HeadAPIV2RelationshipsOperationIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_operation_id_responses.go b/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_operation_id_responses.go new file mode 100644 index 00000000..5021d21e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_operation_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2RelationshipsOperationIDReader is a Reader for the HeadAPIV2RelationshipsOperationID structure. +type HeadAPIV2RelationshipsOperationIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2RelationshipsOperationIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2RelationshipsOperationIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/relationships/{operation_id}] HeadAPIV2RelationshipsOperationID", response, response.Code()) + } +} + +// NewHeadAPIV2RelationshipsOperationIDOK creates a HeadAPIV2RelationshipsOperationIDOK with default headers values +func NewHeadAPIV2RelationshipsOperationIDOK() *HeadAPIV2RelationshipsOperationIDOK { + return &HeadAPIV2RelationshipsOperationIDOK{} +} + +/* +HeadAPIV2RelationshipsOperationIDOK describes a response with status code 200, with default header values. + +Returns a list of matching relationships, dumped in `RelationshipSchema` format. +*/ +type HeadAPIV2RelationshipsOperationIDOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this head Api v2 relationships operation Id o k response has a 2xx status code +func (o *HeadAPIV2RelationshipsOperationIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 relationships operation Id o k response has a 3xx status code +func (o *HeadAPIV2RelationshipsOperationIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 relationships operation Id o k response has a 4xx status code +func (o *HeadAPIV2RelationshipsOperationIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 relationships operation Id o k response has a 5xx status code +func (o *HeadAPIV2RelationshipsOperationIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 relationships operation Id o k response a status code equal to that given +func (o *HeadAPIV2RelationshipsOperationIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 relationships operation Id o k response +func (o *HeadAPIV2RelationshipsOperationIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2RelationshipsOperationIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/relationships/{operation_id}][%d] headApiV2RelationshipsOperationIdOK %s", 200, payload) +} + +func (o *HeadAPIV2RelationshipsOperationIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/relationships/{operation_id}][%d] headApiV2RelationshipsOperationIdOK %s", 200, payload) +} + +func (o *HeadAPIV2RelationshipsOperationIDOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *HeadAPIV2RelationshipsOperationIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_parameters.go b/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_parameters.go new file mode 100644 index 00000000..2a4dc230 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" +) + +// NewHeadAPIV2RelationshipsParams creates a new HeadAPIV2RelationshipsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2RelationshipsParams() *HeadAPIV2RelationshipsParams { + return &HeadAPIV2RelationshipsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2RelationshipsParamsWithTimeout creates a new HeadAPIV2RelationshipsParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2RelationshipsParamsWithTimeout(timeout time.Duration) *HeadAPIV2RelationshipsParams { + return &HeadAPIV2RelationshipsParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2RelationshipsParamsWithContext creates a new HeadAPIV2RelationshipsParams object +// with the ability to set a context for a request. +func NewHeadAPIV2RelationshipsParamsWithContext(ctx context.Context) *HeadAPIV2RelationshipsParams { + return &HeadAPIV2RelationshipsParams{ + Context: ctx, + } +} + +// NewHeadAPIV2RelationshipsParamsWithHTTPClient creates a new HeadAPIV2RelationshipsParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2RelationshipsParamsWithHTTPClient(client *http.Client) *HeadAPIV2RelationshipsParams { + return &HeadAPIV2RelationshipsParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2RelationshipsParams contains all the parameters to send to the API endpoint + + for the head API v2 relationships operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2RelationshipsParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2RelationshipsParams) WithDefaults() *HeadAPIV2RelationshipsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2RelationshipsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) WithTimeout(timeout time.Duration) *HeadAPIV2RelationshipsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) WithContext(ctx context.Context) *HeadAPIV2RelationshipsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) WithHTTPClient(client *http.Client) *HeadAPIV2RelationshipsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) WithExclude(exclude []string) *HeadAPIV2RelationshipsParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) WithInclude(include []string) *HeadAPIV2RelationshipsParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) WithSort(sort *string) *HeadAPIV2RelationshipsParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 relationships params +func (o *HeadAPIV2RelationshipsParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2RelationshipsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Relationships binds the parameter exclude +func (o *HeadAPIV2RelationshipsParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Relationships binds the parameter include +func (o *HeadAPIV2RelationshipsParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_responses.go b/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_responses.go new file mode 100644 index 00000000..28b972f0 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/head_api_v2_relationships_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2RelationshipsReader is a Reader for the HeadAPIV2Relationships structure. +type HeadAPIV2RelationshipsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2RelationshipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2RelationshipsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/relationships] HeadAPIV2Relationships", response, response.Code()) + } +} + +// NewHeadAPIV2RelationshipsOK creates a HeadAPIV2RelationshipsOK with default headers values +func NewHeadAPIV2RelationshipsOK() *HeadAPIV2RelationshipsOK { + return &HeadAPIV2RelationshipsOK{} +} + +/* +HeadAPIV2RelationshipsOK describes a response with status code 200, with default header values. + +Returns a list of matching relationships, dumped in `RelationshipSchema` format. +*/ +type HeadAPIV2RelationshipsOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this head Api v2 relationships o k response has a 2xx status code +func (o *HeadAPIV2RelationshipsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 relationships o k response has a 3xx status code +func (o *HeadAPIV2RelationshipsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 relationships o k response has a 4xx status code +func (o *HeadAPIV2RelationshipsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 relationships o k response has a 5xx status code +func (o *HeadAPIV2RelationshipsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 relationships o k response a status code equal to that given +func (o *HeadAPIV2RelationshipsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 relationships o k response +func (o *HeadAPIV2RelationshipsOK) Code() int { + return 200 +} + +func (o *HeadAPIV2RelationshipsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/relationships][%d] headApiV2RelationshipsOK %s", 200, payload) +} + +func (o *HeadAPIV2RelationshipsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/relationships][%d] headApiV2RelationshipsOK %s", 200, payload) +} + +func (o *HeadAPIV2RelationshipsOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *HeadAPIV2RelationshipsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/patch_api_v2_relationships_parameters.go b/pkg/core/capability/caldera/api/client/relationships/patch_api_v2_relationships_parameters.go new file mode 100644 index 00000000..054f447c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/patch_api_v2_relationships_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2RelationshipsParams creates a new PatchAPIV2RelationshipsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2RelationshipsParams() *PatchAPIV2RelationshipsParams { + return &PatchAPIV2RelationshipsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2RelationshipsParamsWithTimeout creates a new PatchAPIV2RelationshipsParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2RelationshipsParamsWithTimeout(timeout time.Duration) *PatchAPIV2RelationshipsParams { + return &PatchAPIV2RelationshipsParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2RelationshipsParamsWithContext creates a new PatchAPIV2RelationshipsParams object +// with the ability to set a context for a request. +func NewPatchAPIV2RelationshipsParamsWithContext(ctx context.Context) *PatchAPIV2RelationshipsParams { + return &PatchAPIV2RelationshipsParams{ + Context: ctx, + } +} + +// NewPatchAPIV2RelationshipsParamsWithHTTPClient creates a new PatchAPIV2RelationshipsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2RelationshipsParamsWithHTTPClient(client *http.Client) *PatchAPIV2RelationshipsParams { + return &PatchAPIV2RelationshipsParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2RelationshipsParams contains all the parameters to send to the API endpoint + + for the patch API v2 relationships operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2RelationshipsParams struct { + + // Body. + Body *models.PartialRelationshipUpdate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2RelationshipsParams) WithDefaults() *PatchAPIV2RelationshipsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2RelationshipsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 relationships params +func (o *PatchAPIV2RelationshipsParams) WithTimeout(timeout time.Duration) *PatchAPIV2RelationshipsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 relationships params +func (o *PatchAPIV2RelationshipsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 relationships params +func (o *PatchAPIV2RelationshipsParams) WithContext(ctx context.Context) *PatchAPIV2RelationshipsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 relationships params +func (o *PatchAPIV2RelationshipsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 relationships params +func (o *PatchAPIV2RelationshipsParams) WithHTTPClient(client *http.Client) *PatchAPIV2RelationshipsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 relationships params +func (o *PatchAPIV2RelationshipsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 relationships params +func (o *PatchAPIV2RelationshipsParams) WithBody(body *models.PartialRelationshipUpdate) *PatchAPIV2RelationshipsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 relationships params +func (o *PatchAPIV2RelationshipsParams) SetBody(body *models.PartialRelationshipUpdate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2RelationshipsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/patch_api_v2_relationships_responses.go b/pkg/core/capability/caldera/api/client/relationships/patch_api_v2_relationships_responses.go new file mode 100644 index 00000000..583d5d64 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/patch_api_v2_relationships_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2RelationshipsReader is a Reader for the PatchAPIV2Relationships structure. +type PatchAPIV2RelationshipsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2RelationshipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2RelationshipsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/relationships] PatchAPIV2Relationships", response, response.Code()) + } +} + +// NewPatchAPIV2RelationshipsOK creates a PatchAPIV2RelationshipsOK with default headers values +func NewPatchAPIV2RelationshipsOK() *PatchAPIV2RelationshipsOK { + return &PatchAPIV2RelationshipsOK{} +} + +/* +PatchAPIV2RelationshipsOK describes a response with status code 200, with default header values. + +Returns the updated relationship(s), dumped in `RelationshipSchema` format. +*/ +type PatchAPIV2RelationshipsOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this patch Api v2 relationships o k response has a 2xx status code +func (o *PatchAPIV2RelationshipsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 relationships o k response has a 3xx status code +func (o *PatchAPIV2RelationshipsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 relationships o k response has a 4xx status code +func (o *PatchAPIV2RelationshipsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 relationships o k response has a 5xx status code +func (o *PatchAPIV2RelationshipsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 relationships o k response a status code equal to that given +func (o *PatchAPIV2RelationshipsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 relationships o k response +func (o *PatchAPIV2RelationshipsOK) Code() int { + return 200 +} + +func (o *PatchAPIV2RelationshipsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/relationships][%d] patchApiV2RelationshipsOK %s", 200, payload) +} + +func (o *PatchAPIV2RelationshipsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/relationships][%d] patchApiV2RelationshipsOK %s", 200, payload) +} + +func (o *PatchAPIV2RelationshipsOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *PatchAPIV2RelationshipsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/post_api_v2_relationships_parameters.go b/pkg/core/capability/caldera/api/client/relationships/post_api_v2_relationships_parameters.go new file mode 100644 index 00000000..8028ceec --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/post_api_v2_relationships_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2RelationshipsParams creates a new PostAPIV2RelationshipsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2RelationshipsParams() *PostAPIV2RelationshipsParams { + return &PostAPIV2RelationshipsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2RelationshipsParamsWithTimeout creates a new PostAPIV2RelationshipsParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2RelationshipsParamsWithTimeout(timeout time.Duration) *PostAPIV2RelationshipsParams { + return &PostAPIV2RelationshipsParams{ + timeout: timeout, + } +} + +// NewPostAPIV2RelationshipsParamsWithContext creates a new PostAPIV2RelationshipsParams object +// with the ability to set a context for a request. +func NewPostAPIV2RelationshipsParamsWithContext(ctx context.Context) *PostAPIV2RelationshipsParams { + return &PostAPIV2RelationshipsParams{ + Context: ctx, + } +} + +// NewPostAPIV2RelationshipsParamsWithHTTPClient creates a new PostAPIV2RelationshipsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2RelationshipsParamsWithHTTPClient(client *http.Client) *PostAPIV2RelationshipsParams { + return &PostAPIV2RelationshipsParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2RelationshipsParams contains all the parameters to send to the API endpoint + + for the post API v2 relationships operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2RelationshipsParams struct { + + // Body. + Body *models.Relationship + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2RelationshipsParams) WithDefaults() *PostAPIV2RelationshipsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2RelationshipsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 relationships params +func (o *PostAPIV2RelationshipsParams) WithTimeout(timeout time.Duration) *PostAPIV2RelationshipsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 relationships params +func (o *PostAPIV2RelationshipsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 relationships params +func (o *PostAPIV2RelationshipsParams) WithContext(ctx context.Context) *PostAPIV2RelationshipsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 relationships params +func (o *PostAPIV2RelationshipsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 relationships params +func (o *PostAPIV2RelationshipsParams) WithHTTPClient(client *http.Client) *PostAPIV2RelationshipsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 relationships params +func (o *PostAPIV2RelationshipsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 relationships params +func (o *PostAPIV2RelationshipsParams) WithBody(body *models.Relationship) *PostAPIV2RelationshipsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 relationships params +func (o *PostAPIV2RelationshipsParams) SetBody(body *models.Relationship) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2RelationshipsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/post_api_v2_relationships_responses.go b/pkg/core/capability/caldera/api/client/relationships/post_api_v2_relationships_responses.go new file mode 100644 index 00000000..50ceac16 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/post_api_v2_relationships_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2RelationshipsReader is a Reader for the PostAPIV2Relationships structure. +type PostAPIV2RelationshipsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2RelationshipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2RelationshipsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/relationships] PostAPIV2Relationships", response, response.Code()) + } +} + +// NewPostAPIV2RelationshipsOK creates a PostAPIV2RelationshipsOK with default headers values +func NewPostAPIV2RelationshipsOK() *PostAPIV2RelationshipsOK { + return &PostAPIV2RelationshipsOK{} +} + +/* +PostAPIV2RelationshipsOK describes a response with status code 200, with default header values. + +Returns the created relationship, dumped in `RelationshipSchema` format. +*/ +type PostAPIV2RelationshipsOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this post Api v2 relationships o k response has a 2xx status code +func (o *PostAPIV2RelationshipsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 relationships o k response has a 3xx status code +func (o *PostAPIV2RelationshipsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 relationships o k response has a 4xx status code +func (o *PostAPIV2RelationshipsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 relationships o k response has a 5xx status code +func (o *PostAPIV2RelationshipsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 relationships o k response a status code equal to that given +func (o *PostAPIV2RelationshipsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 relationships o k response +func (o *PostAPIV2RelationshipsOK) Code() int { + return 200 +} + +func (o *PostAPIV2RelationshipsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/relationships][%d] postApiV2RelationshipsOK %s", 200, payload) +} + +func (o *PostAPIV2RelationshipsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/relationships][%d] postApiV2RelationshipsOK %s", 200, payload) +} + +func (o *PostAPIV2RelationshipsOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *PostAPIV2RelationshipsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/relationships/relationships_client.go b/pkg/core/capability/caldera/api/client/relationships/relationships_client.go new file mode 100644 index 00000000..05a67f74 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/relationships/relationships_client.go @@ -0,0 +1,359 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package relationships + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new relationships API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new relationships API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new relationships API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for relationships API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2Relationships(params *DeleteAPIV2RelationshipsParams, opts ...ClientOption) (*DeleteAPIV2RelationshipsOK, error) + + GetAPIV2Relationships(params *GetAPIV2RelationshipsParams, opts ...ClientOption) (*GetAPIV2RelationshipsOK, error) + + GetAPIV2RelationshipsOperationID(params *GetAPIV2RelationshipsOperationIDParams, opts ...ClientOption) (*GetAPIV2RelationshipsOperationIDOK, error) + + HeadAPIV2Relationships(params *HeadAPIV2RelationshipsParams, opts ...ClientOption) (*HeadAPIV2RelationshipsOK, error) + + HeadAPIV2RelationshipsOperationID(params *HeadAPIV2RelationshipsOperationIDParams, opts ...ClientOption) (*HeadAPIV2RelationshipsOperationIDOK, error) + + PatchAPIV2Relationships(params *PatchAPIV2RelationshipsParams, opts ...ClientOption) (*PatchAPIV2RelationshipsOK, error) + + PostAPIV2Relationships(params *PostAPIV2RelationshipsParams, opts ...ClientOption) (*PostAPIV2RelationshipsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2Relationships deletes one or more relationships + +Delete relationships using the format provided in the RelationshipSchema. This will delete all relationships that match the criteria specified in the payload. +*/ +func (a *Client) DeleteAPIV2Relationships(params *DeleteAPIV2RelationshipsParams, opts ...ClientOption) (*DeleteAPIV2RelationshipsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2RelationshipsParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2Relationships", + Method: "DELETE", + PathPattern: "/api/v2/relationships", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2RelationshipsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2RelationshipsOK) + 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 DeleteAPIV2Relationships: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Relationships retrieves relationships + +Retrieve relationships by criteria. Use fields from the `RelationshipSchema` in the request body to filter retrieved relationships. +*/ +func (a *Client) GetAPIV2Relationships(params *GetAPIV2RelationshipsParams, opts ...ClientOption) (*GetAPIV2RelationshipsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2RelationshipsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Relationships", + Method: "GET", + PathPattern: "/api/v2/relationships", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2RelationshipsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2RelationshipsOK) + 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 GetAPIV2Relationships: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2RelationshipsOperationID retrieves relationships by operation id + +Retrieve relationships associated with an operation. Returned relationships will be either user-generated relationships or learned relationships. +*/ +func (a *Client) GetAPIV2RelationshipsOperationID(params *GetAPIV2RelationshipsOperationIDParams, opts ...ClientOption) (*GetAPIV2RelationshipsOperationIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2RelationshipsOperationIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2RelationshipsOperationID", + Method: "GET", + PathPattern: "/api/v2/relationships/{operation_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2RelationshipsOperationIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2RelationshipsOperationIDOK) + 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 GetAPIV2RelationshipsOperationID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Relationships retrieves relationships + +Retrieve relationships by criteria. Use fields from the `RelationshipSchema` in the request body to filter retrieved relationships. +*/ +func (a *Client) HeadAPIV2Relationships(params *HeadAPIV2RelationshipsParams, opts ...ClientOption) (*HeadAPIV2RelationshipsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2RelationshipsParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Relationships", + Method: "HEAD", + PathPattern: "/api/v2/relationships", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2RelationshipsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2RelationshipsOK) + 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 HeadAPIV2Relationships: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2RelationshipsOperationID retrieves relationships by operation id + +Retrieve relationships associated with an operation. Returned relationships will be either user-generated relationships or learned relationships. +*/ +func (a *Client) HeadAPIV2RelationshipsOperationID(params *HeadAPIV2RelationshipsOperationIDParams, opts ...ClientOption) (*HeadAPIV2RelationshipsOperationIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2RelationshipsOperationIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2RelationshipsOperationID", + Method: "HEAD", + PathPattern: "/api/v2/relationships/{operation_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2RelationshipsOperationIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2RelationshipsOperationIDOK) + 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 HeadAPIV2RelationshipsOperationID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2Relationships updates one or more relationships + +Update existing relationships using the format provided in the `RelationshipSchema`. This will update all relationships that match the criteria specified in the payload. +*/ +func (a *Client) PatchAPIV2Relationships(params *PatchAPIV2RelationshipsParams, opts ...ClientOption) (*PatchAPIV2RelationshipsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2RelationshipsParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2Relationships", + Method: "PATCH", + PathPattern: "/api/v2/relationships", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2RelationshipsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2RelationshipsOK) + 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 PatchAPIV2Relationships: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Relationships creates a relationship + +Create a new relationship using the format provided in the `RelationshipSchema`. +*/ +func (a *Client) PostAPIV2Relationships(params *PostAPIV2RelationshipsParams, opts ...ClientOption) (*PostAPIV2RelationshipsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2RelationshipsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Relationships", + Method: "POST", + PathPattern: "/api/v2/relationships", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2RelationshipsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2RelationshipsOK) + 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 PostAPIV2Relationships: 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/core/capability/caldera/api/client/schedules/delete_api_v2_schedules_id_parameters.go b/pkg/core/capability/caldera/api/client/schedules/delete_api_v2_schedules_id_parameters.go new file mode 100644 index 00000000..66299133 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/delete_api_v2_schedules_id_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" +) + +// NewDeleteAPIV2SchedulesIDParams creates a new DeleteAPIV2SchedulesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2SchedulesIDParams() *DeleteAPIV2SchedulesIDParams { + return &DeleteAPIV2SchedulesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2SchedulesIDParamsWithTimeout creates a new DeleteAPIV2SchedulesIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2SchedulesIDParamsWithTimeout(timeout time.Duration) *DeleteAPIV2SchedulesIDParams { + return &DeleteAPIV2SchedulesIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2SchedulesIDParamsWithContext creates a new DeleteAPIV2SchedulesIDParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2SchedulesIDParamsWithContext(ctx context.Context) *DeleteAPIV2SchedulesIDParams { + return &DeleteAPIV2SchedulesIDParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2SchedulesIDParamsWithHTTPClient creates a new DeleteAPIV2SchedulesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2SchedulesIDParamsWithHTTPClient(client *http.Client) *DeleteAPIV2SchedulesIDParams { + return &DeleteAPIV2SchedulesIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2SchedulesIDParams contains all the parameters to send to the API endpoint + + for the delete API v2 schedules ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2SchedulesIDParams struct { + + /* ID. + + UUID of the Schedule to be retrieved. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2SchedulesIDParams) WithDefaults() *DeleteAPIV2SchedulesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2SchedulesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 schedules ID params +func (o *DeleteAPIV2SchedulesIDParams) WithTimeout(timeout time.Duration) *DeleteAPIV2SchedulesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 schedules ID params +func (o *DeleteAPIV2SchedulesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 schedules ID params +func (o *DeleteAPIV2SchedulesIDParams) WithContext(ctx context.Context) *DeleteAPIV2SchedulesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 schedules ID params +func (o *DeleteAPIV2SchedulesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 schedules ID params +func (o *DeleteAPIV2SchedulesIDParams) WithHTTPClient(client *http.Client) *DeleteAPIV2SchedulesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 schedules ID params +func (o *DeleteAPIV2SchedulesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API v2 schedules ID params +func (o *DeleteAPIV2SchedulesIDParams) WithID(id string) *DeleteAPIV2SchedulesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API v2 schedules ID params +func (o *DeleteAPIV2SchedulesIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2SchedulesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/delete_api_v2_schedules_id_responses.go b/pkg/core/capability/caldera/api/client/schedules/delete_api_v2_schedules_id_responses.go new file mode 100644 index 00000000..5485900b --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/delete_api_v2_schedules_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// DeleteAPIV2SchedulesIDReader is a Reader for the DeleteAPIV2SchedulesID structure. +type DeleteAPIV2SchedulesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2SchedulesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPIV2SchedulesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/schedules/{id}] DeleteAPIV2SchedulesID", response, response.Code()) + } +} + +// NewDeleteAPIV2SchedulesIDOK creates a DeleteAPIV2SchedulesIDOK with default headers values +func NewDeleteAPIV2SchedulesIDOK() *DeleteAPIV2SchedulesIDOK { + return &DeleteAPIV2SchedulesIDOK{} +} + +/* +DeleteAPIV2SchedulesIDOK describes a response with status code 200, with default header values. + +Returns HTTP 204 No Content status code if Schedule is deleted successfully. +*/ +type DeleteAPIV2SchedulesIDOK struct { + Payload *models.Schedule +} + +// IsSuccess returns true when this delete Api v2 schedules Id o k response has a 2xx status code +func (o *DeleteAPIV2SchedulesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 schedules Id o k response has a 3xx status code +func (o *DeleteAPIV2SchedulesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 schedules Id o k response has a 4xx status code +func (o *DeleteAPIV2SchedulesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 schedules Id o k response has a 5xx status code +func (o *DeleteAPIV2SchedulesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 schedules Id o k response a status code equal to that given +func (o *DeleteAPIV2SchedulesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete Api v2 schedules Id o k response +func (o *DeleteAPIV2SchedulesIDOK) Code() int { + return 200 +} + +func (o *DeleteAPIV2SchedulesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/schedules/{id}][%d] deleteApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *DeleteAPIV2SchedulesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/schedules/{id}][%d] deleteApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *DeleteAPIV2SchedulesIDOK) GetPayload() *models.Schedule { + return o.Payload +} + +func (o *DeleteAPIV2SchedulesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Schedule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_id_parameters.go b/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_id_parameters.go new file mode 100644 index 00000000..bb94d4aa --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" +) + +// NewGetAPIV2SchedulesIDParams creates a new GetAPIV2SchedulesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2SchedulesIDParams() *GetAPIV2SchedulesIDParams { + return &GetAPIV2SchedulesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2SchedulesIDParamsWithTimeout creates a new GetAPIV2SchedulesIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2SchedulesIDParamsWithTimeout(timeout time.Duration) *GetAPIV2SchedulesIDParams { + return &GetAPIV2SchedulesIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2SchedulesIDParamsWithContext creates a new GetAPIV2SchedulesIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2SchedulesIDParamsWithContext(ctx context.Context) *GetAPIV2SchedulesIDParams { + return &GetAPIV2SchedulesIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2SchedulesIDParamsWithHTTPClient creates a new GetAPIV2SchedulesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2SchedulesIDParamsWithHTTPClient(client *http.Client) *GetAPIV2SchedulesIDParams { + return &GetAPIV2SchedulesIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2SchedulesIDParams contains all the parameters to send to the API endpoint + + for the get API v2 schedules ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2SchedulesIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the Schedule to be retrieved. + */ + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2SchedulesIDParams) WithDefaults() *GetAPIV2SchedulesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2SchedulesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) WithTimeout(timeout time.Duration) *GetAPIV2SchedulesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) WithContext(ctx context.Context) *GetAPIV2SchedulesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) WithHTTPClient(client *http.Client) *GetAPIV2SchedulesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) WithExclude(exclude []string) *GetAPIV2SchedulesIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) WithID(id string) *GetAPIV2SchedulesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) WithInclude(include []string) *GetAPIV2SchedulesIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 schedules ID params +func (o *GetAPIV2SchedulesIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2SchedulesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2SchedulesID binds the parameter exclude +func (o *GetAPIV2SchedulesIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2SchedulesID binds the parameter include +func (o *GetAPIV2SchedulesIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_id_responses.go b/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_id_responses.go new file mode 100644 index 00000000..5ea9b6da --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2SchedulesIDReader is a Reader for the GetAPIV2SchedulesID structure. +type GetAPIV2SchedulesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2SchedulesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2SchedulesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/schedules/{id}] GetAPIV2SchedulesID", response, response.Code()) + } +} + +// NewGetAPIV2SchedulesIDOK creates a GetAPIV2SchedulesIDOK with default headers values +func NewGetAPIV2SchedulesIDOK() *GetAPIV2SchedulesIDOK { + return &GetAPIV2SchedulesIDOK{} +} + +/* +GetAPIV2SchedulesIDOK describes a response with status code 200, with default header values. + +The response is a single dumped Scheduled object. +*/ +type GetAPIV2SchedulesIDOK struct { + Payload *models.PartialSchedule +} + +// IsSuccess returns true when this get Api v2 schedules Id o k response has a 2xx status code +func (o *GetAPIV2SchedulesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 schedules Id o k response has a 3xx status code +func (o *GetAPIV2SchedulesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 schedules Id o k response has a 4xx status code +func (o *GetAPIV2SchedulesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 schedules Id o k response has a 5xx status code +func (o *GetAPIV2SchedulesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 schedules Id o k response a status code equal to that given +func (o *GetAPIV2SchedulesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 schedules Id o k response +func (o *GetAPIV2SchedulesIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2SchedulesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/schedules/{id}][%d] getApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *GetAPIV2SchedulesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/schedules/{id}][%d] getApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *GetAPIV2SchedulesIDOK) GetPayload() *models.PartialSchedule { + return o.Payload +} + +func (o *GetAPIV2SchedulesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialSchedule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_parameters.go b/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_parameters.go new file mode 100644 index 00000000..50983f60 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" +) + +// NewGetAPIV2SchedulesParams creates a new GetAPIV2SchedulesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2SchedulesParams() *GetAPIV2SchedulesParams { + return &GetAPIV2SchedulesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2SchedulesParamsWithTimeout creates a new GetAPIV2SchedulesParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2SchedulesParamsWithTimeout(timeout time.Duration) *GetAPIV2SchedulesParams { + return &GetAPIV2SchedulesParams{ + timeout: timeout, + } +} + +// NewGetAPIV2SchedulesParamsWithContext creates a new GetAPIV2SchedulesParams object +// with the ability to set a context for a request. +func NewGetAPIV2SchedulesParamsWithContext(ctx context.Context) *GetAPIV2SchedulesParams { + return &GetAPIV2SchedulesParams{ + Context: ctx, + } +} + +// NewGetAPIV2SchedulesParamsWithHTTPClient creates a new GetAPIV2SchedulesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2SchedulesParamsWithHTTPClient(client *http.Client) *GetAPIV2SchedulesParams { + return &GetAPIV2SchedulesParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2SchedulesParams contains all the parameters to send to the API endpoint + + for the get API v2 schedules operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2SchedulesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 schedules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2SchedulesParams) WithDefaults() *GetAPIV2SchedulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 schedules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2SchedulesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) WithTimeout(timeout time.Duration) *GetAPIV2SchedulesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) WithContext(ctx context.Context) *GetAPIV2SchedulesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) WithHTTPClient(client *http.Client) *GetAPIV2SchedulesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) WithExclude(exclude []string) *GetAPIV2SchedulesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) WithInclude(include []string) *GetAPIV2SchedulesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) WithSort(sort *string) *GetAPIV2SchedulesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 schedules params +func (o *GetAPIV2SchedulesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2SchedulesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Schedules binds the parameter exclude +func (o *GetAPIV2SchedulesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Schedules binds the parameter include +func (o *GetAPIV2SchedulesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_responses.go b/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_responses.go new file mode 100644 index 00000000..9f414dd5 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/get_api_v2_schedules_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2SchedulesReader is a Reader for the GetAPIV2Schedules structure. +type GetAPIV2SchedulesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2SchedulesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2SchedulesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/schedules] GetAPIV2Schedules", response, response.Code()) + } +} + +// NewGetAPIV2SchedulesOK creates a GetAPIV2SchedulesOK with default headers values +func NewGetAPIV2SchedulesOK() *GetAPIV2SchedulesOK { + return &GetAPIV2SchedulesOK{} +} + +/* +GetAPIV2SchedulesOK describes a response with status code 200, with default header values. + +The response is a list of all scheduled operations. +*/ +type GetAPIV2SchedulesOK struct { + Payload []*models.PartialSchedule +} + +// IsSuccess returns true when this get Api v2 schedules o k response has a 2xx status code +func (o *GetAPIV2SchedulesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 schedules o k response has a 3xx status code +func (o *GetAPIV2SchedulesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 schedules o k response has a 4xx status code +func (o *GetAPIV2SchedulesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 schedules o k response has a 5xx status code +func (o *GetAPIV2SchedulesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 schedules o k response a status code equal to that given +func (o *GetAPIV2SchedulesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 schedules o k response +func (o *GetAPIV2SchedulesOK) Code() int { + return 200 +} + +func (o *GetAPIV2SchedulesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/schedules][%d] getApiV2SchedulesOK %s", 200, payload) +} + +func (o *GetAPIV2SchedulesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/schedules][%d] getApiV2SchedulesOK %s", 200, payload) +} + +func (o *GetAPIV2SchedulesOK) GetPayload() []*models.PartialSchedule { + return o.Payload +} + +func (o *GetAPIV2SchedulesOK) 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/core/capability/caldera/api/client/schedules/head_api_v2_schedules_id_parameters.go b/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_id_parameters.go new file mode 100644 index 00000000..e970835c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" +) + +// NewHeadAPIV2SchedulesIDParams creates a new HeadAPIV2SchedulesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2SchedulesIDParams() *HeadAPIV2SchedulesIDParams { + return &HeadAPIV2SchedulesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2SchedulesIDParamsWithTimeout creates a new HeadAPIV2SchedulesIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2SchedulesIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2SchedulesIDParams { + return &HeadAPIV2SchedulesIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2SchedulesIDParamsWithContext creates a new HeadAPIV2SchedulesIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2SchedulesIDParamsWithContext(ctx context.Context) *HeadAPIV2SchedulesIDParams { + return &HeadAPIV2SchedulesIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2SchedulesIDParamsWithHTTPClient creates a new HeadAPIV2SchedulesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2SchedulesIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2SchedulesIDParams { + return &HeadAPIV2SchedulesIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2SchedulesIDParams contains all the parameters to send to the API endpoint + + for the head API v2 schedules ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2SchedulesIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + UUID of the Schedule to be retrieved. + */ + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2SchedulesIDParams) WithDefaults() *HeadAPIV2SchedulesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2SchedulesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2SchedulesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) WithContext(ctx context.Context) *HeadAPIV2SchedulesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2SchedulesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) WithExclude(exclude []string) *HeadAPIV2SchedulesIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) WithID(id string) *HeadAPIV2SchedulesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) WithInclude(include []string) *HeadAPIV2SchedulesIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 schedules ID params +func (o *HeadAPIV2SchedulesIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2SchedulesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2SchedulesID binds the parameter exclude +func (o *HeadAPIV2SchedulesIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2SchedulesID binds the parameter include +func (o *HeadAPIV2SchedulesIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_id_responses.go b/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_id_responses.go new file mode 100644 index 00000000..b3282557 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2SchedulesIDReader is a Reader for the HeadAPIV2SchedulesID structure. +type HeadAPIV2SchedulesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2SchedulesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2SchedulesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/schedules/{id}] HeadAPIV2SchedulesID", response, response.Code()) + } +} + +// NewHeadAPIV2SchedulesIDOK creates a HeadAPIV2SchedulesIDOK with default headers values +func NewHeadAPIV2SchedulesIDOK() *HeadAPIV2SchedulesIDOK { + return &HeadAPIV2SchedulesIDOK{} +} + +/* +HeadAPIV2SchedulesIDOK describes a response with status code 200, with default header values. + +The response is a single dumped Scheduled object. +*/ +type HeadAPIV2SchedulesIDOK struct { + Payload *models.PartialSchedule +} + +// IsSuccess returns true when this head Api v2 schedules Id o k response has a 2xx status code +func (o *HeadAPIV2SchedulesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 schedules Id o k response has a 3xx status code +func (o *HeadAPIV2SchedulesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 schedules Id o k response has a 4xx status code +func (o *HeadAPIV2SchedulesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 schedules Id o k response has a 5xx status code +func (o *HeadAPIV2SchedulesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 schedules Id o k response a status code equal to that given +func (o *HeadAPIV2SchedulesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 schedules Id o k response +func (o *HeadAPIV2SchedulesIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2SchedulesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/schedules/{id}][%d] headApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *HeadAPIV2SchedulesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/schedules/{id}][%d] headApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *HeadAPIV2SchedulesIDOK) GetPayload() *models.PartialSchedule { + return o.Payload +} + +func (o *HeadAPIV2SchedulesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialSchedule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_parameters.go b/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_parameters.go new file mode 100644 index 00000000..31b6cf07 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" +) + +// NewHeadAPIV2SchedulesParams creates a new HeadAPIV2SchedulesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2SchedulesParams() *HeadAPIV2SchedulesParams { + return &HeadAPIV2SchedulesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2SchedulesParamsWithTimeout creates a new HeadAPIV2SchedulesParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2SchedulesParamsWithTimeout(timeout time.Duration) *HeadAPIV2SchedulesParams { + return &HeadAPIV2SchedulesParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2SchedulesParamsWithContext creates a new HeadAPIV2SchedulesParams object +// with the ability to set a context for a request. +func NewHeadAPIV2SchedulesParamsWithContext(ctx context.Context) *HeadAPIV2SchedulesParams { + return &HeadAPIV2SchedulesParams{ + Context: ctx, + } +} + +// NewHeadAPIV2SchedulesParamsWithHTTPClient creates a new HeadAPIV2SchedulesParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2SchedulesParamsWithHTTPClient(client *http.Client) *HeadAPIV2SchedulesParams { + return &HeadAPIV2SchedulesParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2SchedulesParams contains all the parameters to send to the API endpoint + + for the head API v2 schedules operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2SchedulesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 schedules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2SchedulesParams) WithDefaults() *HeadAPIV2SchedulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 schedules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2SchedulesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) WithTimeout(timeout time.Duration) *HeadAPIV2SchedulesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) WithContext(ctx context.Context) *HeadAPIV2SchedulesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) WithHTTPClient(client *http.Client) *HeadAPIV2SchedulesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) WithExclude(exclude []string) *HeadAPIV2SchedulesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) WithInclude(include []string) *HeadAPIV2SchedulesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) WithSort(sort *string) *HeadAPIV2SchedulesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 schedules params +func (o *HeadAPIV2SchedulesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2SchedulesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Schedules binds the parameter exclude +func (o *HeadAPIV2SchedulesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Schedules binds the parameter include +func (o *HeadAPIV2SchedulesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_responses.go b/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_responses.go new file mode 100644 index 00000000..a4a28368 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/head_api_v2_schedules_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2SchedulesReader is a Reader for the HeadAPIV2Schedules structure. +type HeadAPIV2SchedulesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2SchedulesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2SchedulesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/schedules] HeadAPIV2Schedules", response, response.Code()) + } +} + +// NewHeadAPIV2SchedulesOK creates a HeadAPIV2SchedulesOK with default headers values +func NewHeadAPIV2SchedulesOK() *HeadAPIV2SchedulesOK { + return &HeadAPIV2SchedulesOK{} +} + +/* +HeadAPIV2SchedulesOK describes a response with status code 200, with default header values. + +The response is a list of all scheduled operations. +*/ +type HeadAPIV2SchedulesOK struct { + Payload []*models.PartialSchedule +} + +// IsSuccess returns true when this head Api v2 schedules o k response has a 2xx status code +func (o *HeadAPIV2SchedulesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 schedules o k response has a 3xx status code +func (o *HeadAPIV2SchedulesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 schedules o k response has a 4xx status code +func (o *HeadAPIV2SchedulesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 schedules o k response has a 5xx status code +func (o *HeadAPIV2SchedulesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 schedules o k response a status code equal to that given +func (o *HeadAPIV2SchedulesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 schedules o k response +func (o *HeadAPIV2SchedulesOK) Code() int { + return 200 +} + +func (o *HeadAPIV2SchedulesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/schedules][%d] headApiV2SchedulesOK %s", 200, payload) +} + +func (o *HeadAPIV2SchedulesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/schedules][%d] headApiV2SchedulesOK %s", 200, payload) +} + +func (o *HeadAPIV2SchedulesOK) GetPayload() []*models.PartialSchedule { + return o.Payload +} + +func (o *HeadAPIV2SchedulesOK) 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/core/capability/caldera/api/client/schedules/patch_api_v2_schedules_id_parameters.go b/pkg/core/capability/caldera/api/client/schedules/patch_api_v2_schedules_id_parameters.go new file mode 100644 index 00000000..c8ff2521 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/patch_api_v2_schedules_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2SchedulesIDParams creates a new PatchAPIV2SchedulesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2SchedulesIDParams() *PatchAPIV2SchedulesIDParams { + return &PatchAPIV2SchedulesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2SchedulesIDParamsWithTimeout creates a new PatchAPIV2SchedulesIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2SchedulesIDParamsWithTimeout(timeout time.Duration) *PatchAPIV2SchedulesIDParams { + return &PatchAPIV2SchedulesIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2SchedulesIDParamsWithContext creates a new PatchAPIV2SchedulesIDParams object +// with the ability to set a context for a request. +func NewPatchAPIV2SchedulesIDParamsWithContext(ctx context.Context) *PatchAPIV2SchedulesIDParams { + return &PatchAPIV2SchedulesIDParams{ + Context: ctx, + } +} + +// NewPatchAPIV2SchedulesIDParamsWithHTTPClient creates a new PatchAPIV2SchedulesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2SchedulesIDParamsWithHTTPClient(client *http.Client) *PatchAPIV2SchedulesIDParams { + return &PatchAPIV2SchedulesIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2SchedulesIDParams contains all the parameters to send to the API endpoint + + for the patch API v2 schedules ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2SchedulesIDParams struct { + + // Body. + Body *models.PartialSchedule1 + + /* ID. + + UUID of the Schedule to be retrieved. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2SchedulesIDParams) WithDefaults() *PatchAPIV2SchedulesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2SchedulesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) WithTimeout(timeout time.Duration) *PatchAPIV2SchedulesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) WithContext(ctx context.Context) *PatchAPIV2SchedulesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) WithHTTPClient(client *http.Client) *PatchAPIV2SchedulesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) WithBody(body *models.PartialSchedule1) *PatchAPIV2SchedulesIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) SetBody(body *models.PartialSchedule1) { + o.Body = body +} + +// WithID adds the id to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) WithID(id string) *PatchAPIV2SchedulesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API v2 schedules ID params +func (o *PatchAPIV2SchedulesIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2SchedulesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/patch_api_v2_schedules_id_responses.go b/pkg/core/capability/caldera/api/client/schedules/patch_api_v2_schedules_id_responses.go new file mode 100644 index 00000000..23f5ec63 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/patch_api_v2_schedules_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2SchedulesIDReader is a Reader for the PatchAPIV2SchedulesID structure. +type PatchAPIV2SchedulesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2SchedulesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2SchedulesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/schedules/{id}] PatchAPIV2SchedulesID", response, response.Code()) + } +} + +// NewPatchAPIV2SchedulesIDOK creates a PatchAPIV2SchedulesIDOK with default headers values +func NewPatchAPIV2SchedulesIDOK() *PatchAPIV2SchedulesIDOK { + return &PatchAPIV2SchedulesIDOK{} +} + +/* +PatchAPIV2SchedulesIDOK describes a response with status code 200, with default header values. + +The response is a dump of the newly updated Schedule object. +*/ +type PatchAPIV2SchedulesIDOK struct { + Payload *models.Schedule +} + +// IsSuccess returns true when this patch Api v2 schedules Id o k response has a 2xx status code +func (o *PatchAPIV2SchedulesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 schedules Id o k response has a 3xx status code +func (o *PatchAPIV2SchedulesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 schedules Id o k response has a 4xx status code +func (o *PatchAPIV2SchedulesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 schedules Id o k response has a 5xx status code +func (o *PatchAPIV2SchedulesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 schedules Id o k response a status code equal to that given +func (o *PatchAPIV2SchedulesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 schedules Id o k response +func (o *PatchAPIV2SchedulesIDOK) Code() int { + return 200 +} + +func (o *PatchAPIV2SchedulesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/schedules/{id}][%d] patchApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *PatchAPIV2SchedulesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/schedules/{id}][%d] patchApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *PatchAPIV2SchedulesIDOK) GetPayload() *models.Schedule { + return o.Payload +} + +func (o *PatchAPIV2SchedulesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Schedule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/post_api_v2_schedules_parameters.go b/pkg/core/capability/caldera/api/client/schedules/post_api_v2_schedules_parameters.go new file mode 100644 index 00000000..462921fd --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/post_api_v2_schedules_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2SchedulesParams creates a new PostAPIV2SchedulesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2SchedulesParams() *PostAPIV2SchedulesParams { + return &PostAPIV2SchedulesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2SchedulesParamsWithTimeout creates a new PostAPIV2SchedulesParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2SchedulesParamsWithTimeout(timeout time.Duration) *PostAPIV2SchedulesParams { + return &PostAPIV2SchedulesParams{ + timeout: timeout, + } +} + +// NewPostAPIV2SchedulesParamsWithContext creates a new PostAPIV2SchedulesParams object +// with the ability to set a context for a request. +func NewPostAPIV2SchedulesParamsWithContext(ctx context.Context) *PostAPIV2SchedulesParams { + return &PostAPIV2SchedulesParams{ + Context: ctx, + } +} + +// NewPostAPIV2SchedulesParamsWithHTTPClient creates a new PostAPIV2SchedulesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2SchedulesParamsWithHTTPClient(client *http.Client) *PostAPIV2SchedulesParams { + return &PostAPIV2SchedulesParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2SchedulesParams contains all the parameters to send to the API endpoint + + for the post API v2 schedules operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2SchedulesParams struct { + + // Body. + Body *models.Schedule + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 schedules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2SchedulesParams) WithDefaults() *PostAPIV2SchedulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 schedules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2SchedulesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 schedules params +func (o *PostAPIV2SchedulesParams) WithTimeout(timeout time.Duration) *PostAPIV2SchedulesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 schedules params +func (o *PostAPIV2SchedulesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 schedules params +func (o *PostAPIV2SchedulesParams) WithContext(ctx context.Context) *PostAPIV2SchedulesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 schedules params +func (o *PostAPIV2SchedulesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 schedules params +func (o *PostAPIV2SchedulesParams) WithHTTPClient(client *http.Client) *PostAPIV2SchedulesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 schedules params +func (o *PostAPIV2SchedulesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 schedules params +func (o *PostAPIV2SchedulesParams) WithBody(body *models.Schedule) *PostAPIV2SchedulesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 schedules params +func (o *PostAPIV2SchedulesParams) SetBody(body *models.Schedule) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2SchedulesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/post_api_v2_schedules_responses.go b/pkg/core/capability/caldera/api/client/schedules/post_api_v2_schedules_responses.go new file mode 100644 index 00000000..e35abef5 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/post_api_v2_schedules_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2SchedulesReader is a Reader for the PostAPIV2Schedules structure. +type PostAPIV2SchedulesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2SchedulesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2SchedulesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/schedules] PostAPIV2Schedules", response, response.Code()) + } +} + +// NewPostAPIV2SchedulesOK creates a PostAPIV2SchedulesOK with default headers values +func NewPostAPIV2SchedulesOK() *PostAPIV2SchedulesOK { + return &PostAPIV2SchedulesOK{} +} + +/* +PostAPIV2SchedulesOK describes a response with status code 200, with default header values. + +The response is a dump of the newly created Schedule object. +*/ +type PostAPIV2SchedulesOK struct { + Payload *models.Schedule +} + +// IsSuccess returns true when this post Api v2 schedules o k response has a 2xx status code +func (o *PostAPIV2SchedulesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 schedules o k response has a 3xx status code +func (o *PostAPIV2SchedulesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 schedules o k response has a 4xx status code +func (o *PostAPIV2SchedulesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 schedules o k response has a 5xx status code +func (o *PostAPIV2SchedulesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 schedules o k response a status code equal to that given +func (o *PostAPIV2SchedulesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 schedules o k response +func (o *PostAPIV2SchedulesOK) Code() int { + return 200 +} + +func (o *PostAPIV2SchedulesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/schedules][%d] postApiV2SchedulesOK %s", 200, payload) +} + +func (o *PostAPIV2SchedulesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/schedules][%d] postApiV2SchedulesOK %s", 200, payload) +} + +func (o *PostAPIV2SchedulesOK) GetPayload() *models.Schedule { + return o.Payload +} + +func (o *PostAPIV2SchedulesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Schedule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/put_api_v2_schedules_id_parameters.go b/pkg/core/capability/caldera/api/client/schedules/put_api_v2_schedules_id_parameters.go new file mode 100644 index 00000000..fe38c2fc --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/put_api_v2_schedules_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPutAPIV2SchedulesIDParams creates a new PutAPIV2SchedulesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPutAPIV2SchedulesIDParams() *PutAPIV2SchedulesIDParams { + return &PutAPIV2SchedulesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPutAPIV2SchedulesIDParamsWithTimeout creates a new PutAPIV2SchedulesIDParams object +// with the ability to set a timeout on a request. +func NewPutAPIV2SchedulesIDParamsWithTimeout(timeout time.Duration) *PutAPIV2SchedulesIDParams { + return &PutAPIV2SchedulesIDParams{ + timeout: timeout, + } +} + +// NewPutAPIV2SchedulesIDParamsWithContext creates a new PutAPIV2SchedulesIDParams object +// with the ability to set a context for a request. +func NewPutAPIV2SchedulesIDParamsWithContext(ctx context.Context) *PutAPIV2SchedulesIDParams { + return &PutAPIV2SchedulesIDParams{ + Context: ctx, + } +} + +// NewPutAPIV2SchedulesIDParamsWithHTTPClient creates a new PutAPIV2SchedulesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPutAPIV2SchedulesIDParamsWithHTTPClient(client *http.Client) *PutAPIV2SchedulesIDParams { + return &PutAPIV2SchedulesIDParams{ + HTTPClient: client, + } +} + +/* +PutAPIV2SchedulesIDParams contains all the parameters to send to the API endpoint + + for the put API v2 schedules ID operation. + + Typically these are written to a http.Request. +*/ +type PutAPIV2SchedulesIDParams struct { + + // Body. + Body *models.PartialSchedule2 + + /* ID. + + UUID of the Schedule to be retrieved. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the put API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2SchedulesIDParams) WithDefaults() *PutAPIV2SchedulesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put API v2 schedules ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2SchedulesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) WithTimeout(timeout time.Duration) *PutAPIV2SchedulesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) WithContext(ctx context.Context) *PutAPIV2SchedulesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) WithHTTPClient(client *http.Client) *PutAPIV2SchedulesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) WithBody(body *models.PartialSchedule2) *PutAPIV2SchedulesIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) SetBody(body *models.PartialSchedule2) { + o.Body = body +} + +// WithID adds the id to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) WithID(id string) *PutAPIV2SchedulesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the put API v2 schedules ID params +func (o *PutAPIV2SchedulesIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAPIV2SchedulesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/put_api_v2_schedules_id_responses.go b/pkg/core/capability/caldera/api/client/schedules/put_api_v2_schedules_id_responses.go new file mode 100644 index 00000000..b254ed14 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/put_api_v2_schedules_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PutAPIV2SchedulesIDReader is a Reader for the PutAPIV2SchedulesID structure. +type PutAPIV2SchedulesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAPIV2SchedulesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPutAPIV2SchedulesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PUT /api/v2/schedules/{id}] PutAPIV2SchedulesID", response, response.Code()) + } +} + +// NewPutAPIV2SchedulesIDOK creates a PutAPIV2SchedulesIDOK with default headers values +func NewPutAPIV2SchedulesIDOK() *PutAPIV2SchedulesIDOK { + return &PutAPIV2SchedulesIDOK{} +} + +/* +PutAPIV2SchedulesIDOK describes a response with status code 200, with default header values. + +The response is a dump of the newly replaced Schedule object. +*/ +type PutAPIV2SchedulesIDOK struct { + Payload *models.Schedule +} + +// IsSuccess returns true when this put Api v2 schedules Id o k response has a 2xx status code +func (o *PutAPIV2SchedulesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put Api v2 schedules Id o k response has a 3xx status code +func (o *PutAPIV2SchedulesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put Api v2 schedules Id o k response has a 4xx status code +func (o *PutAPIV2SchedulesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this put Api v2 schedules Id o k response has a 5xx status code +func (o *PutAPIV2SchedulesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put Api v2 schedules Id o k response a status code equal to that given +func (o *PutAPIV2SchedulesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the put Api v2 schedules Id o k response +func (o *PutAPIV2SchedulesIDOK) Code() int { + return 200 +} + +func (o *PutAPIV2SchedulesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/schedules/{id}][%d] putApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *PutAPIV2SchedulesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/schedules/{id}][%d] putApiV2SchedulesIdOK %s", 200, payload) +} + +func (o *PutAPIV2SchedulesIDOK) GetPayload() *models.Schedule { + return o.Payload +} + +func (o *PutAPIV2SchedulesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Schedule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/schedules/schedules_client.go b/pkg/core/capability/caldera/api/client/schedules/schedules_client.go new file mode 100644 index 00000000..da2e4d1f --- /dev/null +++ b/pkg/core/capability/caldera/api/client/schedules/schedules_client.go @@ -0,0 +1,401 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package schedules + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new schedules API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new schedules API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new schedules API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for schedules API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2SchedulesID(params *DeleteAPIV2SchedulesIDParams, opts ...ClientOption) (*DeleteAPIV2SchedulesIDOK, error) + + GetAPIV2Schedules(params *GetAPIV2SchedulesParams, opts ...ClientOption) (*GetAPIV2SchedulesOK, error) + + GetAPIV2SchedulesID(params *GetAPIV2SchedulesIDParams, opts ...ClientOption) (*GetAPIV2SchedulesIDOK, error) + + HeadAPIV2Schedules(params *HeadAPIV2SchedulesParams, opts ...ClientOption) (*HeadAPIV2SchedulesOK, error) + + HeadAPIV2SchedulesID(params *HeadAPIV2SchedulesIDParams, opts ...ClientOption) (*HeadAPIV2SchedulesIDOK, error) + + PatchAPIV2SchedulesID(params *PatchAPIV2SchedulesIDParams, opts ...ClientOption) (*PatchAPIV2SchedulesIDOK, error) + + PostAPIV2Schedules(params *PostAPIV2SchedulesParams, opts ...ClientOption) (*PostAPIV2SchedulesOK, error) + + PutAPIV2SchedulesID(params *PutAPIV2SchedulesIDParams, opts ...ClientOption) (*PutAPIV2SchedulesIDOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2SchedulesID deletes schedule + +Deletes a Schedule object from the data service. +*/ +func (a *Client) DeleteAPIV2SchedulesID(params *DeleteAPIV2SchedulesIDParams, opts ...ClientOption) (*DeleteAPIV2SchedulesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2SchedulesIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2SchedulesID", + Method: "DELETE", + PathPattern: "/api/v2/schedules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2SchedulesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2SchedulesIDOK) + 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 DeleteAPIV2SchedulesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Schedules retrieves schedules + +Returns all stored schedules. +*/ +func (a *Client) GetAPIV2Schedules(params *GetAPIV2SchedulesParams, opts ...ClientOption) (*GetAPIV2SchedulesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2SchedulesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Schedules", + Method: "GET", + PathPattern: "/api/v2/schedules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2SchedulesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2SchedulesOK) + 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 GetAPIV2Schedules: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2SchedulesID retrieves schedule + +Retrieves Schedule by UUID, as specified by {id} in the request url. +*/ +func (a *Client) GetAPIV2SchedulesID(params *GetAPIV2SchedulesIDParams, opts ...ClientOption) (*GetAPIV2SchedulesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2SchedulesIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2SchedulesID", + Method: "GET", + PathPattern: "/api/v2/schedules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2SchedulesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2SchedulesIDOK) + 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 GetAPIV2SchedulesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Schedules retrieves schedules + +Returns all stored schedules. +*/ +func (a *Client) HeadAPIV2Schedules(params *HeadAPIV2SchedulesParams, opts ...ClientOption) (*HeadAPIV2SchedulesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2SchedulesParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Schedules", + Method: "HEAD", + PathPattern: "/api/v2/schedules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2SchedulesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2SchedulesOK) + 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 HeadAPIV2Schedules: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2SchedulesID retrieves schedule + +Retrieves Schedule by UUID, as specified by {id} in the request url. +*/ +func (a *Client) HeadAPIV2SchedulesID(params *HeadAPIV2SchedulesIDParams, opts ...ClientOption) (*HeadAPIV2SchedulesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2SchedulesIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2SchedulesID", + Method: "HEAD", + PathPattern: "/api/v2/schedules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2SchedulesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2SchedulesIDOK) + 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 HeadAPIV2SchedulesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2SchedulesID updates schedule + +Use fields from the ScheduleSchema in the request body to update an existing Schedule. +*/ +func (a *Client) PatchAPIV2SchedulesID(params *PatchAPIV2SchedulesIDParams, opts ...ClientOption) (*PatchAPIV2SchedulesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2SchedulesIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2SchedulesID", + Method: "PATCH", + PathPattern: "/api/v2/schedules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2SchedulesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2SchedulesIDOK) + 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 PatchAPIV2SchedulesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Schedules creates schedule + +Use fields from the ScheduleSchema in the request body to create a new Schedule. +*/ +func (a *Client) PostAPIV2Schedules(params *PostAPIV2SchedulesParams, opts ...ClientOption) (*PostAPIV2SchedulesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2SchedulesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Schedules", + Method: "POST", + PathPattern: "/api/v2/schedules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2SchedulesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2SchedulesOK) + 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 PostAPIV2Schedules: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PutAPIV2SchedulesID replaces schedule + +Use fields from the ScheduleSchema in the request body to replace an existing Schedule or create a new Schedule. +*/ +func (a *Client) PutAPIV2SchedulesID(params *PutAPIV2SchedulesIDParams, opts ...ClientOption) (*PutAPIV2SchedulesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAPIV2SchedulesIDParams() + } + op := &runtime.ClientOperation{ + ID: "PutAPIV2SchedulesID", + Method: "PUT", + PathPattern: "/api/v2/schedules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutAPIV2SchedulesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PutAPIV2SchedulesIDOK) + 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 PutAPIV2SchedulesID: 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/core/capability/caldera/api/client/sources/delete_api_v2_sources_id_parameters.go b/pkg/core/capability/caldera/api/client/sources/delete_api_v2_sources_id_parameters.go new file mode 100644 index 00000000..df6676c7 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/delete_api_v2_sources_id_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" +) + +// NewDeleteAPIV2SourcesIDParams creates a new DeleteAPIV2SourcesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIV2SourcesIDParams() *DeleteAPIV2SourcesIDParams { + return &DeleteAPIV2SourcesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIV2SourcesIDParamsWithTimeout creates a new DeleteAPIV2SourcesIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIV2SourcesIDParamsWithTimeout(timeout time.Duration) *DeleteAPIV2SourcesIDParams { + return &DeleteAPIV2SourcesIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPIV2SourcesIDParamsWithContext creates a new DeleteAPIV2SourcesIDParams object +// with the ability to set a context for a request. +func NewDeleteAPIV2SourcesIDParamsWithContext(ctx context.Context) *DeleteAPIV2SourcesIDParams { + return &DeleteAPIV2SourcesIDParams{ + Context: ctx, + } +} + +// NewDeleteAPIV2SourcesIDParamsWithHTTPClient creates a new DeleteAPIV2SourcesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIV2SourcesIDParamsWithHTTPClient(client *http.Client) *DeleteAPIV2SourcesIDParams { + return &DeleteAPIV2SourcesIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIV2SourcesIDParams contains all the parameters to send to the API endpoint + + for the delete API v2 sources ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIV2SourcesIDParams struct { + + /* ID. + + The id of the Fact Source to be deleted. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2SourcesIDParams) WithDefaults() *DeleteAPIV2SourcesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2SourcesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API v2 sources ID params +func (o *DeleteAPIV2SourcesIDParams) WithTimeout(timeout time.Duration) *DeleteAPIV2SourcesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API v2 sources ID params +func (o *DeleteAPIV2SourcesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API v2 sources ID params +func (o *DeleteAPIV2SourcesIDParams) WithContext(ctx context.Context) *DeleteAPIV2SourcesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API v2 sources ID params +func (o *DeleteAPIV2SourcesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API v2 sources ID params +func (o *DeleteAPIV2SourcesIDParams) WithHTTPClient(client *http.Client) *DeleteAPIV2SourcesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API v2 sources ID params +func (o *DeleteAPIV2SourcesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API v2 sources ID params +func (o *DeleteAPIV2SourcesIDParams) WithID(id string) *DeleteAPIV2SourcesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API v2 sources ID params +func (o *DeleteAPIV2SourcesIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIV2SourcesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/delete_api_v2_sources_id_responses.go b/pkg/core/capability/caldera/api/client/sources/delete_api_v2_sources_id_responses.go new file mode 100644 index 00000000..04e5e427 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/delete_api_v2_sources_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// DeleteAPIV2SourcesIDReader is a Reader for the DeleteAPIV2SourcesID structure. +type DeleteAPIV2SourcesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIV2SourcesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPIV2SourcesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/sources/{id}] DeleteAPIV2SourcesID", response, response.Code()) + } +} + +// NewDeleteAPIV2SourcesIDOK creates a DeleteAPIV2SourcesIDOK with default headers values +func NewDeleteAPIV2SourcesIDOK() *DeleteAPIV2SourcesIDOK { + return &DeleteAPIV2SourcesIDOK{} +} + +/* +DeleteAPIV2SourcesIDOK describes a response with status code 200, with default header values. + +Returns DELETE status. +*/ +type DeleteAPIV2SourcesIDOK struct { + Payload *models.Source +} + +// IsSuccess returns true when this delete Api v2 sources Id o k response has a 2xx status code +func (o *DeleteAPIV2SourcesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api v2 sources Id o k response has a 3xx status code +func (o *DeleteAPIV2SourcesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api v2 sources Id o k response has a 4xx status code +func (o *DeleteAPIV2SourcesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api v2 sources Id o k response has a 5xx status code +func (o *DeleteAPIV2SourcesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api v2 sources Id o k response a status code equal to that given +func (o *DeleteAPIV2SourcesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete Api v2 sources Id o k response +func (o *DeleteAPIV2SourcesIDOK) Code() int { + return 200 +} + +func (o *DeleteAPIV2SourcesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/sources/{id}][%d] deleteApiV2SourcesIdOK %s", 200, payload) +} + +func (o *DeleteAPIV2SourcesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v2/sources/{id}][%d] deleteApiV2SourcesIdOK %s", 200, payload) +} + +func (o *DeleteAPIV2SourcesIDOK) GetPayload() *models.Source { + return o.Payload +} + +func (o *DeleteAPIV2SourcesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Source) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_id_parameters.go b/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_id_parameters.go new file mode 100644 index 00000000..c2035bdb --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" +) + +// NewGetAPIV2SourcesIDParams creates a new GetAPIV2SourcesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2SourcesIDParams() *GetAPIV2SourcesIDParams { + return &GetAPIV2SourcesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2SourcesIDParamsWithTimeout creates a new GetAPIV2SourcesIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2SourcesIDParamsWithTimeout(timeout time.Duration) *GetAPIV2SourcesIDParams { + return &GetAPIV2SourcesIDParams{ + timeout: timeout, + } +} + +// NewGetAPIV2SourcesIDParamsWithContext creates a new GetAPIV2SourcesIDParams object +// with the ability to set a context for a request. +func NewGetAPIV2SourcesIDParamsWithContext(ctx context.Context) *GetAPIV2SourcesIDParams { + return &GetAPIV2SourcesIDParams{ + Context: ctx, + } +} + +// NewGetAPIV2SourcesIDParamsWithHTTPClient creates a new GetAPIV2SourcesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2SourcesIDParamsWithHTTPClient(client *http.Client) *GetAPIV2SourcesIDParams { + return &GetAPIV2SourcesIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2SourcesIDParams contains all the parameters to send to the API endpoint + + for the get API v2 sources ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2SourcesIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + The id of the Fact Source + */ + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2SourcesIDParams) WithDefaults() *GetAPIV2SourcesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2SourcesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) WithTimeout(timeout time.Duration) *GetAPIV2SourcesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) WithContext(ctx context.Context) *GetAPIV2SourcesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) WithHTTPClient(client *http.Client) *GetAPIV2SourcesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) WithExclude(exclude []string) *GetAPIV2SourcesIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) WithID(id string) *GetAPIV2SourcesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) WithInclude(include []string) *GetAPIV2SourcesIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 sources ID params +func (o *GetAPIV2SourcesIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2SourcesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2SourcesID binds the parameter exclude +func (o *GetAPIV2SourcesIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2SourcesID binds the parameter include +func (o *GetAPIV2SourcesIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_id_responses.go b/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_id_responses.go new file mode 100644 index 00000000..4afd9ff4 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2SourcesIDReader is a Reader for the GetAPIV2SourcesID structure. +type GetAPIV2SourcesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2SourcesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2SourcesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/sources/{id}] GetAPIV2SourcesID", response, response.Code()) + } +} + +// NewGetAPIV2SourcesIDOK creates a GetAPIV2SourcesIDOK with default headers values +func NewGetAPIV2SourcesIDOK() *GetAPIV2SourcesIDOK { + return &GetAPIV2SourcesIDOK{} +} + +/* +GetAPIV2SourcesIDOK describes a response with status code 200, with default header values. + +Returns a single Source dumped in SourceSchema format. +*/ +type GetAPIV2SourcesIDOK struct { + Payload *models.PartialSource +} + +// IsSuccess returns true when this get Api v2 sources Id o k response has a 2xx status code +func (o *GetAPIV2SourcesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 sources Id o k response has a 3xx status code +func (o *GetAPIV2SourcesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 sources Id o k response has a 4xx status code +func (o *GetAPIV2SourcesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 sources Id o k response has a 5xx status code +func (o *GetAPIV2SourcesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 sources Id o k response a status code equal to that given +func (o *GetAPIV2SourcesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 sources Id o k response +func (o *GetAPIV2SourcesIDOK) Code() int { + return 200 +} + +func (o *GetAPIV2SourcesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/sources/{id}][%d] getApiV2SourcesIdOK %s", 200, payload) +} + +func (o *GetAPIV2SourcesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/sources/{id}][%d] getApiV2SourcesIdOK %s", 200, payload) +} + +func (o *GetAPIV2SourcesIDOK) GetPayload() *models.PartialSource { + return o.Payload +} + +func (o *GetAPIV2SourcesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialSource) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_parameters.go b/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_parameters.go new file mode 100644 index 00000000..f11db0ca --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" +) + +// NewGetAPIV2SourcesParams creates a new GetAPIV2SourcesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIV2SourcesParams() *GetAPIV2SourcesParams { + return &GetAPIV2SourcesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIV2SourcesParamsWithTimeout creates a new GetAPIV2SourcesParams object +// with the ability to set a timeout on a request. +func NewGetAPIV2SourcesParamsWithTimeout(timeout time.Duration) *GetAPIV2SourcesParams { + return &GetAPIV2SourcesParams{ + timeout: timeout, + } +} + +// NewGetAPIV2SourcesParamsWithContext creates a new GetAPIV2SourcesParams object +// with the ability to set a context for a request. +func NewGetAPIV2SourcesParamsWithContext(ctx context.Context) *GetAPIV2SourcesParams { + return &GetAPIV2SourcesParams{ + Context: ctx, + } +} + +// NewGetAPIV2SourcesParamsWithHTTPClient creates a new GetAPIV2SourcesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIV2SourcesParamsWithHTTPClient(client *http.Client) *GetAPIV2SourcesParams { + return &GetAPIV2SourcesParams{ + HTTPClient: client, + } +} + +/* +GetAPIV2SourcesParams contains all the parameters to send to the API endpoint + + for the get API v2 sources operation. + + Typically these are written to a http.Request. +*/ +type GetAPIV2SourcesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API v2 sources params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2SourcesParams) WithDefaults() *GetAPIV2SourcesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API v2 sources params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIV2SourcesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API v2 sources params +func (o *GetAPIV2SourcesParams) WithTimeout(timeout time.Duration) *GetAPIV2SourcesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API v2 sources params +func (o *GetAPIV2SourcesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API v2 sources params +func (o *GetAPIV2SourcesParams) WithContext(ctx context.Context) *GetAPIV2SourcesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API v2 sources params +func (o *GetAPIV2SourcesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API v2 sources params +func (o *GetAPIV2SourcesParams) WithHTTPClient(client *http.Client) *GetAPIV2SourcesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API v2 sources params +func (o *GetAPIV2SourcesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the get API v2 sources params +func (o *GetAPIV2SourcesParams) WithExclude(exclude []string) *GetAPIV2SourcesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the get API v2 sources params +func (o *GetAPIV2SourcesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the get API v2 sources params +func (o *GetAPIV2SourcesParams) WithInclude(include []string) *GetAPIV2SourcesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the get API v2 sources params +func (o *GetAPIV2SourcesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the get API v2 sources params +func (o *GetAPIV2SourcesParams) WithSort(sort *string) *GetAPIV2SourcesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the get API v2 sources params +func (o *GetAPIV2SourcesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIV2SourcesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamGetAPIV2Sources binds the parameter exclude +func (o *GetAPIV2SourcesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamGetAPIV2Sources binds the parameter include +func (o *GetAPIV2SourcesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_responses.go b/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_responses.go new file mode 100644 index 00000000..112c0357 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/get_api_v2_sources_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// GetAPIV2SourcesReader is a Reader for the GetAPIV2Sources structure. +type GetAPIV2SourcesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIV2SourcesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIV2SourcesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /api/v2/sources] GetAPIV2Sources", response, response.Code()) + } +} + +// NewGetAPIV2SourcesOK creates a GetAPIV2SourcesOK with default headers values +func NewGetAPIV2SourcesOK() *GetAPIV2SourcesOK { + return &GetAPIV2SourcesOK{} +} + +/* +GetAPIV2SourcesOK describes a response with status code 200, with default header values. + +Returns a list of all Sources dumped in SourceSchema format. +*/ +type GetAPIV2SourcesOK struct { + Payload []*models.PartialSource +} + +// IsSuccess returns true when this get Api v2 sources o k response has a 2xx status code +func (o *GetAPIV2SourcesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api v2 sources o k response has a 3xx status code +func (o *GetAPIV2SourcesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api v2 sources o k response has a 4xx status code +func (o *GetAPIV2SourcesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api v2 sources o k response has a 5xx status code +func (o *GetAPIV2SourcesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api v2 sources o k response a status code equal to that given +func (o *GetAPIV2SourcesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get Api v2 sources o k response +func (o *GetAPIV2SourcesOK) Code() int { + return 200 +} + +func (o *GetAPIV2SourcesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/sources][%d] getApiV2SourcesOK %s", 200, payload) +} + +func (o *GetAPIV2SourcesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/sources][%d] getApiV2SourcesOK %s", 200, payload) +} + +func (o *GetAPIV2SourcesOK) GetPayload() []*models.PartialSource { + return o.Payload +} + +func (o *GetAPIV2SourcesOK) 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/core/capability/caldera/api/client/sources/head_api_v2_sources_id_parameters.go b/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_id_parameters.go new file mode 100644 index 00000000..630c4d1e --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_id_parameters.go @@ -0,0 +1,236 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" +) + +// NewHeadAPIV2SourcesIDParams creates a new HeadAPIV2SourcesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2SourcesIDParams() *HeadAPIV2SourcesIDParams { + return &HeadAPIV2SourcesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2SourcesIDParamsWithTimeout creates a new HeadAPIV2SourcesIDParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2SourcesIDParamsWithTimeout(timeout time.Duration) *HeadAPIV2SourcesIDParams { + return &HeadAPIV2SourcesIDParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2SourcesIDParamsWithContext creates a new HeadAPIV2SourcesIDParams object +// with the ability to set a context for a request. +func NewHeadAPIV2SourcesIDParamsWithContext(ctx context.Context) *HeadAPIV2SourcesIDParams { + return &HeadAPIV2SourcesIDParams{ + Context: ctx, + } +} + +// NewHeadAPIV2SourcesIDParamsWithHTTPClient creates a new HeadAPIV2SourcesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2SourcesIDParamsWithHTTPClient(client *http.Client) *HeadAPIV2SourcesIDParams { + return &HeadAPIV2SourcesIDParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2SourcesIDParams contains all the parameters to send to the API endpoint + + for the head API v2 sources ID operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2SourcesIDParams struct { + + // Exclude. + Exclude []string + + /* ID. + + The id of the Fact Source + */ + ID string + + // Include. + Include []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2SourcesIDParams) WithDefaults() *HeadAPIV2SourcesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2SourcesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) WithTimeout(timeout time.Duration) *HeadAPIV2SourcesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) WithContext(ctx context.Context) *HeadAPIV2SourcesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) WithHTTPClient(client *http.Client) *HeadAPIV2SourcesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) WithExclude(exclude []string) *HeadAPIV2SourcesIDParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithID adds the id to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) WithID(id string) *HeadAPIV2SourcesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) SetID(id string) { + o.ID = id +} + +// WithInclude adds the include to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) WithInclude(include []string) *HeadAPIV2SourcesIDParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 sources ID params +func (o *HeadAPIV2SourcesIDParams) SetInclude(include []string) { + o.Include = include +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2SourcesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2SourcesID binds the parameter exclude +func (o *HeadAPIV2SourcesIDParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2SourcesID binds the parameter include +func (o *HeadAPIV2SourcesIDParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_id_responses.go b/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_id_responses.go new file mode 100644 index 00000000..edf2bd68 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2SourcesIDReader is a Reader for the HeadAPIV2SourcesID structure. +type HeadAPIV2SourcesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2SourcesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2SourcesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/sources/{id}] HeadAPIV2SourcesID", response, response.Code()) + } +} + +// NewHeadAPIV2SourcesIDOK creates a HeadAPIV2SourcesIDOK with default headers values +func NewHeadAPIV2SourcesIDOK() *HeadAPIV2SourcesIDOK { + return &HeadAPIV2SourcesIDOK{} +} + +/* +HeadAPIV2SourcesIDOK describes a response with status code 200, with default header values. + +Returns a single Source dumped in SourceSchema format. +*/ +type HeadAPIV2SourcesIDOK struct { + Payload *models.PartialSource +} + +// IsSuccess returns true when this head Api v2 sources Id o k response has a 2xx status code +func (o *HeadAPIV2SourcesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 sources Id o k response has a 3xx status code +func (o *HeadAPIV2SourcesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 sources Id o k response has a 4xx status code +func (o *HeadAPIV2SourcesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 sources Id o k response has a 5xx status code +func (o *HeadAPIV2SourcesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 sources Id o k response a status code equal to that given +func (o *HeadAPIV2SourcesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 sources Id o k response +func (o *HeadAPIV2SourcesIDOK) Code() int { + return 200 +} + +func (o *HeadAPIV2SourcesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/sources/{id}][%d] headApiV2SourcesIdOK %s", 200, payload) +} + +func (o *HeadAPIV2SourcesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/sources/{id}][%d] headApiV2SourcesIdOK %s", 200, payload) +} + +func (o *HeadAPIV2SourcesIDOK) GetPayload() *models.PartialSource { + return o.Payload +} + +func (o *HeadAPIV2SourcesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PartialSource) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_parameters.go b/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_parameters.go new file mode 100644 index 00000000..aa8ba14d --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" +) + +// NewHeadAPIV2SourcesParams creates a new HeadAPIV2SourcesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewHeadAPIV2SourcesParams() *HeadAPIV2SourcesParams { + return &HeadAPIV2SourcesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeadAPIV2SourcesParamsWithTimeout creates a new HeadAPIV2SourcesParams object +// with the ability to set a timeout on a request. +func NewHeadAPIV2SourcesParamsWithTimeout(timeout time.Duration) *HeadAPIV2SourcesParams { + return &HeadAPIV2SourcesParams{ + timeout: timeout, + } +} + +// NewHeadAPIV2SourcesParamsWithContext creates a new HeadAPIV2SourcesParams object +// with the ability to set a context for a request. +func NewHeadAPIV2SourcesParamsWithContext(ctx context.Context) *HeadAPIV2SourcesParams { + return &HeadAPIV2SourcesParams{ + Context: ctx, + } +} + +// NewHeadAPIV2SourcesParamsWithHTTPClient creates a new HeadAPIV2SourcesParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeadAPIV2SourcesParamsWithHTTPClient(client *http.Client) *HeadAPIV2SourcesParams { + return &HeadAPIV2SourcesParams{ + HTTPClient: client, + } +} + +/* +HeadAPIV2SourcesParams contains all the parameters to send to the API endpoint + + for the head API v2 sources operation. + + Typically these are written to a http.Request. +*/ +type HeadAPIV2SourcesParams struct { + + // Exclude. + Exclude []string + + // Include. + Include []string + + // Sort. + Sort *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the head API v2 sources params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2SourcesParams) WithDefaults() *HeadAPIV2SourcesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the head API v2 sources params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeadAPIV2SourcesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) WithTimeout(timeout time.Duration) *HeadAPIV2SourcesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) WithContext(ctx context.Context) *HeadAPIV2SourcesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) WithHTTPClient(client *http.Client) *HeadAPIV2SourcesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExclude adds the exclude to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) WithExclude(exclude []string) *HeadAPIV2SourcesParams { + o.SetExclude(exclude) + return o +} + +// SetExclude adds the exclude to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) SetExclude(exclude []string) { + o.Exclude = exclude +} + +// WithInclude adds the include to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) WithInclude(include []string) *HeadAPIV2SourcesParams { + o.SetInclude(include) + return o +} + +// SetInclude adds the include to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) SetInclude(include []string) { + o.Include = include +} + +// WithSort adds the sort to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) WithSort(sort *string) *HeadAPIV2SourcesParams { + o.SetSort(sort) + return o +} + +// SetSort adds the sort to the head API v2 sources params +func (o *HeadAPIV2SourcesParams) SetSort(sort *string) { + o.Sort = sort +} + +// WriteToRequest writes these params to a swagger request +func (o *HeadAPIV2SourcesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Exclude != nil { + + // binding items for exclude + joinedExclude := o.bindParamExclude(reg) + + // query array param exclude + if err := r.SetQueryParam("exclude", joinedExclude...); err != nil { + return err + } + } + + if o.Include != nil { + + // binding items for include + joinedInclude := o.bindParamInclude(reg) + + // query array param include + if err := r.SetQueryParam("include", joinedInclude...); err != nil { + return err + } + } + + if o.Sort != nil { + + // query param sort + var qrSort string + + if o.Sort != nil { + qrSort = *o.Sort + } + qSort := qrSort + if qSort != "" { + + if err := r.SetQueryParam("sort", qSort); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamHeadAPIV2Sources binds the parameter exclude +func (o *HeadAPIV2SourcesParams) bindParamExclude(formats strfmt.Registry) []string { + excludeIR := o.Exclude + + var excludeIC []string + for _, excludeIIR := range excludeIR { // explode []string + + excludeIIV := excludeIIR // string as string + excludeIC = append(excludeIC, excludeIIV) + } + + // items.CollectionFormat: "multi" + excludeIS := swag.JoinByFormat(excludeIC, "multi") + + return excludeIS +} + +// bindParamHeadAPIV2Sources binds the parameter include +func (o *HeadAPIV2SourcesParams) bindParamInclude(formats strfmt.Registry) []string { + includeIR := o.Include + + var includeIC []string + for _, includeIIR := range includeIR { // explode []string + + includeIIV := includeIIR // string as string + includeIC = append(includeIC, includeIIV) + } + + // items.CollectionFormat: "multi" + includeIS := swag.JoinByFormat(includeIC, "multi") + + return includeIS +} diff --git a/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_responses.go b/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_responses.go new file mode 100644 index 00000000..ed0ef332 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/head_api_v2_sources_responses.go @@ -0,0 +1,104 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// HeadAPIV2SourcesReader is a Reader for the HeadAPIV2Sources structure. +type HeadAPIV2SourcesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeadAPIV2SourcesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeadAPIV2SourcesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /api/v2/sources] HeadAPIV2Sources", response, response.Code()) + } +} + +// NewHeadAPIV2SourcesOK creates a HeadAPIV2SourcesOK with default headers values +func NewHeadAPIV2SourcesOK() *HeadAPIV2SourcesOK { + return &HeadAPIV2SourcesOK{} +} + +/* +HeadAPIV2SourcesOK describes a response with status code 200, with default header values. + +Returns a list of all Sources dumped in SourceSchema format. +*/ +type HeadAPIV2SourcesOK struct { + Payload []*models.PartialSource +} + +// IsSuccess returns true when this head Api v2 sources o k response has a 2xx status code +func (o *HeadAPIV2SourcesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this head Api v2 sources o k response has a 3xx status code +func (o *HeadAPIV2SourcesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this head Api v2 sources o k response has a 4xx status code +func (o *HeadAPIV2SourcesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this head Api v2 sources o k response has a 5xx status code +func (o *HeadAPIV2SourcesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this head Api v2 sources o k response a status code equal to that given +func (o *HeadAPIV2SourcesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the head Api v2 sources o k response +func (o *HeadAPIV2SourcesOK) Code() int { + return 200 +} + +func (o *HeadAPIV2SourcesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/sources][%d] headApiV2SourcesOK %s", 200, payload) +} + +func (o *HeadAPIV2SourcesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[HEAD /api/v2/sources][%d] headApiV2SourcesOK %s", 200, payload) +} + +func (o *HeadAPIV2SourcesOK) GetPayload() []*models.PartialSource { + return o.Payload +} + +func (o *HeadAPIV2SourcesOK) 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/core/capability/caldera/api/client/sources/patch_api_v2_sources_id_parameters.go b/pkg/core/capability/caldera/api/client/sources/patch_api_v2_sources_id_parameters.go new file mode 100644 index 00000000..06ae51ba --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/patch_api_v2_sources_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPatchAPIV2SourcesIDParams creates a new PatchAPIV2SourcesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIV2SourcesIDParams() *PatchAPIV2SourcesIDParams { + return &PatchAPIV2SourcesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIV2SourcesIDParamsWithTimeout creates a new PatchAPIV2SourcesIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIV2SourcesIDParamsWithTimeout(timeout time.Duration) *PatchAPIV2SourcesIDParams { + return &PatchAPIV2SourcesIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIV2SourcesIDParamsWithContext creates a new PatchAPIV2SourcesIDParams object +// with the ability to set a context for a request. +func NewPatchAPIV2SourcesIDParamsWithContext(ctx context.Context) *PatchAPIV2SourcesIDParams { + return &PatchAPIV2SourcesIDParams{ + Context: ctx, + } +} + +// NewPatchAPIV2SourcesIDParamsWithHTTPClient creates a new PatchAPIV2SourcesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIV2SourcesIDParamsWithHTTPClient(client *http.Client) *PatchAPIV2SourcesIDParams { + return &PatchAPIV2SourcesIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIV2SourcesIDParams contains all the parameters to send to the API endpoint + + for the patch API v2 sources ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIV2SourcesIDParams struct { + + // Body. + Body *models.PartialSource + + /* ID. + + The id of the Fact Source. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2SourcesIDParams) WithDefaults() *PatchAPIV2SourcesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIV2SourcesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) WithTimeout(timeout time.Duration) *PatchAPIV2SourcesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) WithContext(ctx context.Context) *PatchAPIV2SourcesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) WithHTTPClient(client *http.Client) *PatchAPIV2SourcesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) WithBody(body *models.PartialSource) *PatchAPIV2SourcesIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) SetBody(body *models.PartialSource) { + o.Body = body +} + +// WithID adds the id to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) WithID(id string) *PatchAPIV2SourcesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API v2 sources ID params +func (o *PatchAPIV2SourcesIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIV2SourcesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/patch_api_v2_sources_id_responses.go b/pkg/core/capability/caldera/api/client/sources/patch_api_v2_sources_id_responses.go new file mode 100644 index 00000000..e09ca20a --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/patch_api_v2_sources_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PatchAPIV2SourcesIDReader is a Reader for the PatchAPIV2SourcesID structure. +type PatchAPIV2SourcesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIV2SourcesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIV2SourcesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PATCH /api/v2/sources/{id}] PatchAPIV2SourcesID", response, response.Code()) + } +} + +// NewPatchAPIV2SourcesIDOK creates a PatchAPIV2SourcesIDOK with default headers values +func NewPatchAPIV2SourcesIDOK() *PatchAPIV2SourcesIDOK { + return &PatchAPIV2SourcesIDOK{} +} + +/* +PatchAPIV2SourcesIDOK describes a response with status code 200, with default header values. + +Returns a single Source dumped in SourceSchema format. +*/ +type PatchAPIV2SourcesIDOK struct { + Payload *models.Source +} + +// IsSuccess returns true when this patch Api v2 sources Id o k response has a 2xx status code +func (o *PatchAPIV2SourcesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api v2 sources Id o k response has a 3xx status code +func (o *PatchAPIV2SourcesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api v2 sources Id o k response has a 4xx status code +func (o *PatchAPIV2SourcesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api v2 sources Id o k response has a 5xx status code +func (o *PatchAPIV2SourcesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api v2 sources Id o k response a status code equal to that given +func (o *PatchAPIV2SourcesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the patch Api v2 sources Id o k response +func (o *PatchAPIV2SourcesIDOK) Code() int { + return 200 +} + +func (o *PatchAPIV2SourcesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/sources/{id}][%d] patchApiV2SourcesIdOK %s", 200, payload) +} + +func (o *PatchAPIV2SourcesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v2/sources/{id}][%d] patchApiV2SourcesIdOK %s", 200, payload) +} + +func (o *PatchAPIV2SourcesIDOK) GetPayload() *models.Source { + return o.Payload +} + +func (o *PatchAPIV2SourcesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Source) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/post_api_v2_sources_parameters.go b/pkg/core/capability/caldera/api/client/sources/post_api_v2_sources_parameters.go new file mode 100644 index 00000000..3e0375fa --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/post_api_v2_sources_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPostAPIV2SourcesParams creates a new PostAPIV2SourcesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIV2SourcesParams() *PostAPIV2SourcesParams { + return &PostAPIV2SourcesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIV2SourcesParamsWithTimeout creates a new PostAPIV2SourcesParams object +// with the ability to set a timeout on a request. +func NewPostAPIV2SourcesParamsWithTimeout(timeout time.Duration) *PostAPIV2SourcesParams { + return &PostAPIV2SourcesParams{ + timeout: timeout, + } +} + +// NewPostAPIV2SourcesParamsWithContext creates a new PostAPIV2SourcesParams object +// with the ability to set a context for a request. +func NewPostAPIV2SourcesParamsWithContext(ctx context.Context) *PostAPIV2SourcesParams { + return &PostAPIV2SourcesParams{ + Context: ctx, + } +} + +// NewPostAPIV2SourcesParamsWithHTTPClient creates a new PostAPIV2SourcesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIV2SourcesParamsWithHTTPClient(client *http.Client) *PostAPIV2SourcesParams { + return &PostAPIV2SourcesParams{ + HTTPClient: client, + } +} + +/* +PostAPIV2SourcesParams contains all the parameters to send to the API endpoint + + for the post API v2 sources operation. + + Typically these are written to a http.Request. +*/ +type PostAPIV2SourcesParams struct { + + // Body. + Body *models.Source + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API v2 sources params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2SourcesParams) WithDefaults() *PostAPIV2SourcesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API v2 sources params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIV2SourcesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API v2 sources params +func (o *PostAPIV2SourcesParams) WithTimeout(timeout time.Duration) *PostAPIV2SourcesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API v2 sources params +func (o *PostAPIV2SourcesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API v2 sources params +func (o *PostAPIV2SourcesParams) WithContext(ctx context.Context) *PostAPIV2SourcesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API v2 sources params +func (o *PostAPIV2SourcesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API v2 sources params +func (o *PostAPIV2SourcesParams) WithHTTPClient(client *http.Client) *PostAPIV2SourcesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API v2 sources params +func (o *PostAPIV2SourcesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API v2 sources params +func (o *PostAPIV2SourcesParams) WithBody(body *models.Source) *PostAPIV2SourcesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API v2 sources params +func (o *PostAPIV2SourcesParams) SetBody(body *models.Source) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIV2SourcesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/post_api_v2_sources_responses.go b/pkg/core/capability/caldera/api/client/sources/post_api_v2_sources_responses.go new file mode 100644 index 00000000..2467b87c --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/post_api_v2_sources_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PostAPIV2SourcesReader is a Reader for the PostAPIV2Sources structure. +type PostAPIV2SourcesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIV2SourcesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIV2SourcesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /api/v2/sources] PostAPIV2Sources", response, response.Code()) + } +} + +// NewPostAPIV2SourcesOK creates a PostAPIV2SourcesOK with default headers values +func NewPostAPIV2SourcesOK() *PostAPIV2SourcesOK { + return &PostAPIV2SourcesOK{} +} + +/* +PostAPIV2SourcesOK describes a response with status code 200, with default header values. + +Returns a single Source dumped in SourceSchema format. +*/ +type PostAPIV2SourcesOK struct { + Payload *models.Source +} + +// IsSuccess returns true when this post Api v2 sources o k response has a 2xx status code +func (o *PostAPIV2SourcesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api v2 sources o k response has a 3xx status code +func (o *PostAPIV2SourcesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api v2 sources o k response has a 4xx status code +func (o *PostAPIV2SourcesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api v2 sources o k response has a 5xx status code +func (o *PostAPIV2SourcesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api v2 sources o k response a status code equal to that given +func (o *PostAPIV2SourcesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the post Api v2 sources o k response +func (o *PostAPIV2SourcesOK) Code() int { + return 200 +} + +func (o *PostAPIV2SourcesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/sources][%d] postApiV2SourcesOK %s", 200, payload) +} + +func (o *PostAPIV2SourcesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/sources][%d] postApiV2SourcesOK %s", 200, payload) +} + +func (o *PostAPIV2SourcesOK) GetPayload() *models.Source { + return o.Payload +} + +func (o *PostAPIV2SourcesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Source) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/put_api_v2_sources_id_parameters.go b/pkg/core/capability/caldera/api/client/sources/put_api_v2_sources_id_parameters.go new file mode 100644 index 00000000..08af8b79 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/put_api_v2_sources_id_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// NewPutAPIV2SourcesIDParams creates a new PutAPIV2SourcesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPutAPIV2SourcesIDParams() *PutAPIV2SourcesIDParams { + return &PutAPIV2SourcesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPutAPIV2SourcesIDParamsWithTimeout creates a new PutAPIV2SourcesIDParams object +// with the ability to set a timeout on a request. +func NewPutAPIV2SourcesIDParamsWithTimeout(timeout time.Duration) *PutAPIV2SourcesIDParams { + return &PutAPIV2SourcesIDParams{ + timeout: timeout, + } +} + +// NewPutAPIV2SourcesIDParamsWithContext creates a new PutAPIV2SourcesIDParams object +// with the ability to set a context for a request. +func NewPutAPIV2SourcesIDParamsWithContext(ctx context.Context) *PutAPIV2SourcesIDParams { + return &PutAPIV2SourcesIDParams{ + Context: ctx, + } +} + +// NewPutAPIV2SourcesIDParamsWithHTTPClient creates a new PutAPIV2SourcesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPutAPIV2SourcesIDParamsWithHTTPClient(client *http.Client) *PutAPIV2SourcesIDParams { + return &PutAPIV2SourcesIDParams{ + HTTPClient: client, + } +} + +/* +PutAPIV2SourcesIDParams contains all the parameters to send to the API endpoint + + for the put API v2 sources ID operation. + + Typically these are written to a http.Request. +*/ +type PutAPIV2SourcesIDParams struct { + + // Body. + Body *models.PartialSource + + /* ID. + + The id of the Fact Source. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the put API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2SourcesIDParams) WithDefaults() *PutAPIV2SourcesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put API v2 sources ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAPIV2SourcesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) WithTimeout(timeout time.Duration) *PutAPIV2SourcesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) WithContext(ctx context.Context) *PutAPIV2SourcesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) WithHTTPClient(client *http.Client) *PutAPIV2SourcesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) WithBody(body *models.PartialSource) *PutAPIV2SourcesIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) SetBody(body *models.PartialSource) { + o.Body = body +} + +// WithID adds the id to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) WithID(id string) *PutAPIV2SourcesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the put API v2 sources ID params +func (o *PutAPIV2SourcesIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAPIV2SourcesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/put_api_v2_sources_id_responses.go b/pkg/core/capability/caldera/api/client/sources/put_api_v2_sources_id_responses.go new file mode 100644 index 00000000..4548f122 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/put_api_v2_sources_id_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "soarca/pkg/core/capability/caldera/api/models" +) + +// PutAPIV2SourcesIDReader is a Reader for the PutAPIV2SourcesID structure. +type PutAPIV2SourcesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAPIV2SourcesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPutAPIV2SourcesIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[PUT /api/v2/sources/{id}] PutAPIV2SourcesID", response, response.Code()) + } +} + +// NewPutAPIV2SourcesIDOK creates a PutAPIV2SourcesIDOK with default headers values +func NewPutAPIV2SourcesIDOK() *PutAPIV2SourcesIDOK { + return &PutAPIV2SourcesIDOK{} +} + +/* +PutAPIV2SourcesIDOK describes a response with status code 200, with default header values. + +Returns a single Source dumped in SourceSchema format. +*/ +type PutAPIV2SourcesIDOK struct { + Payload *models.Source +} + +// IsSuccess returns true when this put Api v2 sources Id o k response has a 2xx status code +func (o *PutAPIV2SourcesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put Api v2 sources Id o k response has a 3xx status code +func (o *PutAPIV2SourcesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put Api v2 sources Id o k response has a 4xx status code +func (o *PutAPIV2SourcesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this put Api v2 sources Id o k response has a 5xx status code +func (o *PutAPIV2SourcesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put Api v2 sources Id o k response a status code equal to that given +func (o *PutAPIV2SourcesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the put Api v2 sources Id o k response +func (o *PutAPIV2SourcesIDOK) Code() int { + return 200 +} + +func (o *PutAPIV2SourcesIDOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/sources/{id}][%d] putApiV2SourcesIdOK %s", 200, payload) +} + +func (o *PutAPIV2SourcesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/sources/{id}][%d] putApiV2SourcesIdOK %s", 200, payload) +} + +func (o *PutAPIV2SourcesIDOK) GetPayload() *models.Source { + return o.Payload +} + +func (o *PutAPIV2SourcesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Source) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/core/capability/caldera/api/client/sources/sources_client.go b/pkg/core/capability/caldera/api/client/sources/sources_client.go new file mode 100644 index 00000000..378a6610 --- /dev/null +++ b/pkg/core/capability/caldera/api/client/sources/sources_client.go @@ -0,0 +1,401 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package sources + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new sources API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new sources API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new sources API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for sources API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIV2SourcesID(params *DeleteAPIV2SourcesIDParams, opts ...ClientOption) (*DeleteAPIV2SourcesIDOK, error) + + GetAPIV2Sources(params *GetAPIV2SourcesParams, opts ...ClientOption) (*GetAPIV2SourcesOK, error) + + GetAPIV2SourcesID(params *GetAPIV2SourcesIDParams, opts ...ClientOption) (*GetAPIV2SourcesIDOK, error) + + HeadAPIV2Sources(params *HeadAPIV2SourcesParams, opts ...ClientOption) (*HeadAPIV2SourcesOK, error) + + HeadAPIV2SourcesID(params *HeadAPIV2SourcesIDParams, opts ...ClientOption) (*HeadAPIV2SourcesIDOK, error) + + PatchAPIV2SourcesID(params *PatchAPIV2SourcesIDParams, opts ...ClientOption) (*PatchAPIV2SourcesIDOK, error) + + PostAPIV2Sources(params *PostAPIV2SourcesParams, opts ...ClientOption) (*PostAPIV2SourcesOK, error) + + PutAPIV2SourcesID(params *PutAPIV2SourcesIDParams, opts ...ClientOption) (*PutAPIV2SourcesIDOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIV2SourcesID deletes an existing fact source + +Delete a Fact Source, given its id. +*/ +func (a *Client) DeleteAPIV2SourcesID(params *DeleteAPIV2SourcesIDParams, opts ...ClientOption) (*DeleteAPIV2SourcesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIV2SourcesIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIV2SourcesID", + Method: "DELETE", + PathPattern: "/api/v2/sources/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIV2SourcesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIV2SourcesIDOK) + 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 DeleteAPIV2SourcesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2Sources retrieves all fact sources + +Returns a list of all Fact Sources, including custom-created ones. +*/ +func (a *Client) GetAPIV2Sources(params *GetAPIV2SourcesParams, opts ...ClientOption) (*GetAPIV2SourcesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2SourcesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2Sources", + Method: "GET", + PathPattern: "/api/v2/sources", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2SourcesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2SourcesOK) + 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 GetAPIV2Sources: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIV2SourcesID retrieves a fact source by its id + +Returns a Fact Source, given a source id. +*/ +func (a *Client) GetAPIV2SourcesID(params *GetAPIV2SourcesIDParams, opts ...ClientOption) (*GetAPIV2SourcesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIV2SourcesIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIV2SourcesID", + Method: "GET", + PathPattern: "/api/v2/sources/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIV2SourcesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIV2SourcesIDOK) + 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 GetAPIV2SourcesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2Sources retrieves all fact sources + +Returns a list of all Fact Sources, including custom-created ones. +*/ +func (a *Client) HeadAPIV2Sources(params *HeadAPIV2SourcesParams, opts ...ClientOption) (*HeadAPIV2SourcesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2SourcesParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2Sources", + Method: "HEAD", + PathPattern: "/api/v2/sources", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2SourcesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2SourcesOK) + 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 HeadAPIV2Sources: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeadAPIV2SourcesID retrieves a fact source by its id + +Returns a Fact Source, given a source id. +*/ +func (a *Client) HeadAPIV2SourcesID(params *HeadAPIV2SourcesIDParams, opts ...ClientOption) (*HeadAPIV2SourcesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeadAPIV2SourcesIDParams() + } + op := &runtime.ClientOperation{ + ID: "HeadAPIV2SourcesID", + Method: "HEAD", + PathPattern: "/api/v2/sources/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &HeadAPIV2SourcesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeadAPIV2SourcesIDOK) + 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 HeadAPIV2SourcesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIV2SourcesID updates an existing fact source + +Returns an updated Fact Source. All fields in a Fact Source can be updated, except for "id" and "adjustments". +*/ +func (a *Client) PatchAPIV2SourcesID(params *PatchAPIV2SourcesIDParams, opts ...ClientOption) (*PatchAPIV2SourcesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIV2SourcesIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIV2SourcesID", + Method: "PATCH", + PathPattern: "/api/v2/sources/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIV2SourcesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIV2SourcesIDOK) + 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 PatchAPIV2SourcesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIV2Sources creates a fact source + +Create a new Fact Source using the format provided in the SourceSchema. +*/ +func (a *Client) PostAPIV2Sources(params *PostAPIV2SourcesParams, opts ...ClientOption) (*PostAPIV2SourcesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIV2SourcesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIV2Sources", + Method: "POST", + PathPattern: "/api/v2/sources", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIV2SourcesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIV2SourcesOK) + 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 PostAPIV2Sources: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PutAPIV2SourcesID updates an existing or create a new fact source + +Use fields from the SourceSchema in the request body to replace an existing Fact Source or create a new Fact Source. +*/ +func (a *Client) PutAPIV2SourcesID(params *PutAPIV2SourcesIDParams, opts ...ClientOption) (*PutAPIV2SourcesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAPIV2SourcesIDParams() + } + op := &runtime.ClientOperation{ + ID: "PutAPIV2SourcesID", + Method: "PUT", + PathPattern: "/api/v2/sources/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PutAPIV2SourcesIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PutAPIV2SourcesIDOK) + 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 PutAPIV2SourcesID: 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/core/capability/caldera/api/models/ability.go b/pkg/core/capability/caldera/api/models/ability.go new file mode 100644 index 00000000..ef7224ad --- /dev/null +++ b/pkg/core/capability/caldera/api/models/ability.go @@ -0,0 +1,248 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Ability ability +// +// swagger:model Ability +type Ability struct { + + // ability id + AbilityID string `json:"ability_id,omitempty"` + + // access + Access struct { + Access + } `json:"access,omitempty"` + + // additional info + AdditionalInfo map[string]string `json:"additional_info,omitempty"` + + // buckets + Buckets []string `json:"buckets"` + + // delete payload + DeletePayload *bool `json:"delete_payload,omitempty"` + + // description + Description *string `json:"description,omitempty"` + + // executors + Executors []*Executor `json:"executors"` + + // name + Name *string `json:"name,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // privilege + Privilege *string `json:"privilege,omitempty"` + + // repeatable + Repeatable *bool `json:"repeatable,omitempty"` + + // requirements + Requirements []*Requirement `json:"requirements"` + + // singleton + Singleton *bool `json:"singleton,omitempty"` + + // tactic + Tactic *string `json:"tactic,omitempty"` + + // technique id + TechniqueID *string `json:"technique_id,omitempty"` + + // technique name + TechniqueName *string `json:"technique_name,omitempty"` +} + +// Validate validates this ability +func (m *Ability) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccess(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExecutors(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRequirements(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Ability) validateAccess(formats strfmt.Registry) error { + if swag.IsZero(m.Access) { // not required + return nil + } + + return nil +} + +func (m *Ability) validateExecutors(formats strfmt.Registry) error { + if swag.IsZero(m.Executors) { // not required + return nil + } + + for i := 0; i < len(m.Executors); i++ { + if swag.IsZero(m.Executors[i]) { // not required + continue + } + + if m.Executors[i] != nil { + if err := m.Executors[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Ability) validateRequirements(formats strfmt.Registry) error { + if swag.IsZero(m.Requirements) { // not required + return nil + } + + for i := 0; i < len(m.Requirements); i++ { + if swag.IsZero(m.Requirements[i]) { // not required + continue + } + + if m.Requirements[i] != nil { + if err := m.Requirements[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("requirements" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("requirements" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this ability based on the context it is used +func (m *Ability) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccess(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateExecutors(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRequirements(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Ability) contextValidateAccess(ctx context.Context, formats strfmt.Registry) error { + + return nil +} + +func (m *Ability) contextValidateExecutors(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Executors); i++ { + + if m.Executors[i] != nil { + + if swag.IsZero(m.Executors[i]) { // not required + return nil + } + + if err := m.Executors[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Ability) contextValidateRequirements(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Requirements); i++ { + + if m.Requirements[i] != nil { + + if swag.IsZero(m.Requirements[i]) { // not required + return nil + } + + if err := m.Requirements[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("requirements" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("requirements" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Ability) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Ability) UnmarshalBinary(b []byte) error { + var res Ability + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/access.go b/pkg/core/capability/caldera/api/models/access.go new file mode 100644 index 00000000..bf591d90 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/access.go @@ -0,0 +1,50 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Access access +// +// swagger:model Access +type Access struct { + + // access + Access interface{} `json:"access,omitempty"` +} + +// Validate validates this access +func (m *Access) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this access based on context it is used +func (m *Access) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Access) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Access) UnmarshalBinary(b []byte) error { + var res Access + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/adjustment.go b/pkg/core/capability/caldera/api/models/adjustment.go new file mode 100644 index 00000000..e44ad727 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/adjustment.go @@ -0,0 +1,59 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Adjustment adjustment +// +// swagger:model Adjustment +type Adjustment struct { + + // ability id + AbilityID string `json:"ability_id,omitempty"` + + // offset + Offset int64 `json:"offset,omitempty"` + + // trait + Trait string `json:"trait,omitempty"` + + // value + Value string `json:"value,omitempty"` +} + +// Validate validates this adjustment +func (m *Adjustment) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this adjustment based on context it is used +func (m *Adjustment) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Adjustment) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Adjustment) UnmarshalBinary(b []byte) error { + var res Adjustment + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/adversary.go b/pkg/core/capability/caldera/api/models/adversary.go new file mode 100644 index 00000000..ef3a5eca --- /dev/null +++ b/pkg/core/capability/caldera/api/models/adversary.go @@ -0,0 +1,92 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Adversary adversary +// +// swagger:model Adversary +type Adversary struct { + + // adversary id + AdversaryID string `json:"adversary_id,omitempty"` + + // atomic ordering + AtomicOrdering []string `json:"atomic_ordering"` + + // description + Description string `json:"description,omitempty"` + + // has repeatable abilities + // Read Only: true + HasRepeatableAbilities *bool `json:"has_repeatable_abilities,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // objective + Objective string `json:"objective,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // tags + Tags []string `json:"tags"` +} + +// Validate validates this adversary +func (m *Adversary) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this adversary based on the context it is used +func (m *Adversary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHasRepeatableAbilities(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Adversary) contextValidateHasRepeatableAbilities(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "has_repeatable_abilities", "body", m.HasRepeatableAbilities); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Adversary) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Adversary) UnmarshalBinary(b []byte) error { + var res Adversary + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/agent.go b/pkg/core/capability/caldera/api/models/agent.go new file mode 100644 index 00000000..bc97f842 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/agent.go @@ -0,0 +1,256 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Agent agent +// +// swagger:model Agent +type Agent struct { + + // architecture + Architecture string `json:"architecture,omitempty"` + + // available contacts + AvailableContacts []string `json:"available_contacts"` + + // contact + Contact string `json:"contact,omitempty"` + + // created + // Read Only: true + Created string `json:"created,omitempty"` + + // deadman enabled + DeadmanEnabled *bool `json:"deadman_enabled,omitempty"` + + // display name + // Read Only: true + DisplayName string `json:"display_name,omitempty"` + + // exe name + ExeName string `json:"exe_name,omitempty"` + + // executors + Executors []string `json:"executors"` + + // group + Group string `json:"group,omitempty"` + + // host + Host string `json:"host,omitempty"` + + // host ip addrs + HostIPAddrs []string `json:"host_ip_addrs"` + + // last seen + // Read Only: true + LastSeen string `json:"last_seen,omitempty"` + + // links + // Read Only: true + Links []*Link `json:"links"` + + // location + Location string `json:"location,omitempty"` + + // origin link id + OriginLinkID string `json:"origin_link_id,omitempty"` + + // paw + Paw *string `json:"paw,omitempty"` + + // pending contact + PendingContact string `json:"pending_contact,omitempty"` + + // pid + Pid int64 `json:"pid,omitempty"` + + // platform + Platform string `json:"platform,omitempty"` + + // ppid + Ppid int64 `json:"ppid,omitempty"` + + // privilege + Privilege string `json:"privilege,omitempty"` + + // proxy chain + ProxyChain [][]string `json:"proxy_chain"` + + // proxy receivers + ProxyReceivers map[string][]string `json:"proxy_receivers,omitempty"` + + // server + Server string `json:"server,omitempty"` + + // sleep max + SleepMax int64 `json:"sleep_max,omitempty"` + + // sleep min + SleepMin int64 `json:"sleep_min,omitempty"` + + // trusted + Trusted bool `json:"trusted,omitempty"` + + // upstream dest + UpstreamDest *string `json:"upstream_dest,omitempty"` + + // username + Username string `json:"username,omitempty"` + + // watchdog + Watchdog int64 `json:"watchdog,omitempty"` +} + +// Validate validates this agent +func (m *Agent) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLinks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Agent) validateLinks(formats strfmt.Registry) error { + if swag.IsZero(m.Links) { // not required + return nil + } + + for i := 0; i < len(m.Links); i++ { + if swag.IsZero(m.Links[i]) { // not required + continue + } + + if m.Links[i] != nil { + if err := m.Links[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("links" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("links" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this agent based on the context it is used +func (m *Agent) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreated(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDisplayName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLastSeen(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLinks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Agent) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "created", "body", string(m.Created)); err != nil { + return err + } + + return nil +} + +func (m *Agent) contextValidateDisplayName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "display_name", "body", string(m.DisplayName)); err != nil { + return err + } + + return nil +} + +func (m *Agent) contextValidateLastSeen(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "last_seen", "body", string(m.LastSeen)); err != nil { + return err + } + + return nil +} + +func (m *Agent) contextValidateLinks(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "links", "body", []*Link(m.Links)); err != nil { + return err + } + + for i := 0; i < len(m.Links); i++ { + + if m.Links[i] != nil { + + if swag.IsZero(m.Links[i]) { // not required + return nil + } + + if err := m.Links[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("links" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("links" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Agent) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Agent) UnmarshalBinary(b []byte) error { + var res Agent + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/agent1.go b/pkg/core/capability/caldera/api/models/agent1.go new file mode 100644 index 00000000..35c98409 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/agent1.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 + +// Agent1 agent1 +// +// swagger:model Agent1 +type Agent1 interface{} diff --git a/pkg/core/capability/caldera/api/models/agent_config_update.go b/pkg/core/capability/caldera/api/models/agent_config_update.go new file mode 100644 index 00000000..2060ae3f --- /dev/null +++ b/pkg/core/capability/caldera/api/models/agent_config_update.go @@ -0,0 +1,92 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// AgentConfigUpdate agent config update +// +// swagger:model AgentConfigUpdate +type AgentConfigUpdate struct { + + // bootstrap abilities + BootstrapAbilities []string `json:"bootstrap_abilities"` + + // deadman abilities + DeadmanAbilities []string `json:"deadman_abilities"` + + // deployments + // Read Only: true + Deployments []string `json:"deployments"` + + // implant name + ImplantName string `json:"implant_name,omitempty"` + + // sleep max + SleepMax int64 `json:"sleep_max,omitempty"` + + // sleep min + SleepMin int64 `json:"sleep_min,omitempty"` + + // untrusted timer + UntrustedTimer int64 `json:"untrusted_timer,omitempty"` + + // watchdog + Watchdog int64 `json:"watchdog,omitempty"` +} + +// Validate validates this agent config update +func (m *AgentConfigUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this agent config update based on the context it is used +func (m *AgentConfigUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeployments(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AgentConfigUpdate) contextValidateDeployments(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "deployments", "body", []string(m.Deployments)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AgentConfigUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AgentConfigUpdate) UnmarshalBinary(b []byte) error { + var res AgentConfigUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/caldera_info.go b/pkg/core/capability/caldera/api/models/caldera_info.go new file mode 100644 index 00000000..db890fd3 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/caldera_info.go @@ -0,0 +1,130 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CalderaInfo caldera info +// +// swagger:model CalderaInfo +type CalderaInfo struct { + + // access + Access string `json:"access,omitempty"` + + // application + Application string `json:"application,omitempty"` + + // plugins + Plugins []*Plugin `json:"plugins"` + + // version + Version string `json:"version,omitempty"` +} + +// Validate validates this caldera info +func (m *CalderaInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePlugins(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CalderaInfo) validatePlugins(formats strfmt.Registry) error { + if swag.IsZero(m.Plugins) { // not required + return nil + } + + for i := 0; i < len(m.Plugins); i++ { + if swag.IsZero(m.Plugins[i]) { // not required + continue + } + + if m.Plugins[i] != nil { + if err := m.Plugins[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("plugins" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("plugins" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this caldera info based on the context it is used +func (m *CalderaInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePlugins(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CalderaInfo) contextValidatePlugins(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Plugins); i++ { + + if m.Plugins[i] != nil { + + if swag.IsZero(m.Plugins[i]) { // not required + return nil + } + + if err := m.Plugins[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("plugins" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("plugins" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CalderaInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CalderaInfo) UnmarshalBinary(b []byte) error { + var res CalderaInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/config_update.go b/pkg/core/capability/caldera/api/models/config_update.go new file mode 100644 index 00000000..79f5bd1f --- /dev/null +++ b/pkg/core/capability/caldera/api/models/config_update.go @@ -0,0 +1,88 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ConfigUpdate config update +// +// swagger:model ConfigUpdate +type ConfigUpdate struct { + + // prop + // Required: true + Prop *string `json:"prop"` + + // value + // Required: true + Value *string `json:"value"` +} + +// Validate validates this config update +func (m *ConfigUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateProp(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ConfigUpdate) validateProp(formats strfmt.Registry) error { + + if err := validate.Required("prop", "body", m.Prop); err != nil { + return err + } + + return nil +} + +func (m *ConfigUpdate) validateValue(formats strfmt.Registry) error { + + if err := validate.Required("value", "body", m.Value); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this config update based on context it is used +func (m *ConfigUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ConfigUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ConfigUpdate) UnmarshalBinary(b []byte) error { + var res ConfigUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/deploy_commands.go b/pkg/core/capability/caldera/api/models/deploy_commands.go new file mode 100644 index 00000000..eee264f5 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/deploy_commands.go @@ -0,0 +1,53 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DeployCommands deploy commands +// +// swagger:model DeployCommands +type DeployCommands struct { + + // abilities + Abilities []map[string]interface{} `json:"abilities"` + + // app config + AppConfig map[string]interface{} `json:"app_config,omitempty"` +} + +// Validate validates this deploy commands +func (m *DeployCommands) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this deploy commands based on context it is used +func (m *DeployCommands) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DeployCommands) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DeployCommands) UnmarshalBinary(b []byte) error { + var res DeployCommands + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/executor.go b/pkg/core/capability/caldera/api/models/executor.go new file mode 100644 index 00000000..c63b7455 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/executor.go @@ -0,0 +1,216 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Executor executor +// +// swagger:model Executor +type Executor struct { + + // additional info + AdditionalInfo map[string]string `json:"additional_info,omitempty"` + + // build target + BuildTarget *string `json:"build_target,omitempty"` + + // cleanup + Cleanup []string `json:"cleanup"` + + // code + Code *string `json:"code,omitempty"` + + // command + Command *string `json:"command,omitempty"` + + // language + Language *string `json:"language,omitempty"` + + // name + Name *string `json:"name,omitempty"` + + // parsers + Parsers []*Parser `json:"parsers"` + + // payloads + Payloads []string `json:"payloads"` + + // platform + Platform *string `json:"platform,omitempty"` + + // timeout + Timeout *int64 `json:"timeout,omitempty"` + + // uploads + Uploads []string `json:"uploads"` + + // variations + Variations []*Variation `json:"variations"` +} + +// Validate validates this executor +func (m *Executor) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateParsers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVariations(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Executor) validateParsers(formats strfmt.Registry) error { + if swag.IsZero(m.Parsers) { // not required + return nil + } + + for i := 0; i < len(m.Parsers); i++ { + if swag.IsZero(m.Parsers[i]) { // not required + continue + } + + if m.Parsers[i] != nil { + if err := m.Parsers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("parsers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("parsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Executor) validateVariations(formats strfmt.Registry) error { + if swag.IsZero(m.Variations) { // not required + return nil + } + + for i := 0; i < len(m.Variations); i++ { + if swag.IsZero(m.Variations[i]) { // not required + continue + } + + if m.Variations[i] != nil { + if err := m.Variations[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("variations" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("variations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this executor based on the context it is used +func (m *Executor) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateParsers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVariations(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Executor) contextValidateParsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Parsers); i++ { + + if m.Parsers[i] != nil { + + if swag.IsZero(m.Parsers[i]) { // not required + return nil + } + + if err := m.Parsers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("parsers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("parsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Executor) contextValidateVariations(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Variations); i++ { + + if m.Variations[i] != nil { + + if swag.IsZero(m.Variations[i]) { // not required + return nil + } + + if err := m.Variations[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("variations" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("variations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Executor) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Executor) UnmarshalBinary(b []byte) error { + var res Executor + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/fact.go b/pkg/core/capability/caldera/api/models/fact.go new file mode 100644 index 00000000..1ed31e3a --- /dev/null +++ b/pkg/core/capability/caldera/api/models/fact.go @@ -0,0 +1,154 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Fact fact +// +// swagger:model Fact +type Fact struct { + + // collected by + CollectedBy []string `json:"collected_by"` + + // created + // Read Only: true + Created string `json:"created,omitempty"` + + // limit count + LimitCount int64 `json:"limit_count,omitempty"` + + // links + Links []string `json:"links"` + + // name + // Read Only: true + Name string `json:"name,omitempty"` + + // origin type + OriginType interface{} `json:"origin_type,omitempty"` + + // relationships + Relationships []string `json:"relationships"` + + // score + Score int64 `json:"score,omitempty"` + + // source + Source *string `json:"source,omitempty"` + + // technique id + TechniqueID *string `json:"technique_id,omitempty"` + + // trait + // Required: true + Trait *string `json:"trait"` + + // unique + // Read Only: true + Unique string `json:"unique,omitempty"` + + // value + Value interface{} `json:"value,omitempty"` +} + +// Validate validates this fact +func (m *Fact) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTrait(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Fact) validateTrait(formats strfmt.Registry) error { + + if err := validate.Required("trait", "body", m.Trait); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this fact based on the context it is used +func (m *Fact) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreated(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnique(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Fact) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "created", "body", string(m.Created)); err != nil { + return err + } + + return nil +} + +func (m *Fact) contextValidateName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "name", "body", string(m.Name)); err != nil { + return err + } + + return nil +} + +func (m *Fact) contextValidateUnique(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "unique", "body", string(m.Unique)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Fact) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Fact) UnmarshalBinary(b []byte) error { + var res Fact + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/goal.go b/pkg/core/capability/caldera/api/models/goal.go new file mode 100644 index 00000000..30650eea --- /dev/null +++ b/pkg/core/capability/caldera/api/models/goal.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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Goal goal +// +// swagger:model Goal +type Goal struct { + + // achieved + // Read Only: true + Achieved *bool `json:"achieved,omitempty"` + + // count + Count int64 `json:"count,omitempty"` + + // operator + Operator string `json:"operator,omitempty"` + + // target + Target string `json:"target,omitempty"` + + // value + Value string `json:"value,omitempty"` +} + +// Validate validates this goal +func (m *Goal) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this goal based on the context it is used +func (m *Goal) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAchieved(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Goal) contextValidateAchieved(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "achieved", "body", m.Achieved); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Goal) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Goal) UnmarshalBinary(b []byte) error { + var res Goal + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/host.go b/pkg/core/capability/caldera/api/models/host.go new file mode 100644 index 00000000..f0dd3822 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/host.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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Host host +// +// swagger:model Host +type Host struct { + + // display name + // Read Only: true + DisplayName string `json:"display_name,omitempty"` + + // host + Host string `json:"host,omitempty"` + + // host ip addrs + HostIPAddrs []string `json:"host_ip_addrs"` + + // platform + Platform string `json:"platform,omitempty"` + + // reachable hosts + ReachableHosts []string `json:"reachable_hosts"` +} + +// Validate validates this host +func (m *Host) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this host based on the context it is used +func (m *Host) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDisplayName(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Host) contextValidateDisplayName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "display_name", "body", string(m.DisplayName)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Host) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Host) UnmarshalBinary(b []byte) error { + var res Host + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/link.go b/pkg/core/capability/caldera/api/models/link.go new file mode 100644 index 00000000..67452ac7 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/link.go @@ -0,0 +1,452 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Link link +// +// swagger:model Link +type Link struct { + + // ability + Ability *Ability `json:"ability,omitempty"` + + // agent reported time + AgentReportedTime *string `json:"agent_reported_time,omitempty"` + + // cleanup + Cleanup int64 `json:"cleanup,omitempty"` + + // collect + Collect string `json:"collect,omitempty"` + + // command + Command string `json:"command,omitempty"` + + // deadman + Deadman bool `json:"deadman,omitempty"` + + // decide + Decide string `json:"decide,omitempty"` + + // executor + Executor *Executor `json:"executor,omitempty"` + + // facts + Facts []*Fact `json:"facts"` + + // finish + Finish string `json:"finish,omitempty"` + + // host + Host *string `json:"host,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // jitter + Jitter int64 `json:"jitter,omitempty"` + + // output + Output string `json:"output,omitempty"` + + // paw + Paw string `json:"paw,omitempty"` + + // pid + Pid string `json:"pid,omitempty"` + + // pin + Pin int64 `json:"pin,omitempty"` + + // plaintext command + PlaintextCommand string `json:"plaintext_command,omitempty"` + + // relationships + Relationships []*Relationship `json:"relationships"` + + // score + Score int64 `json:"score,omitempty"` + + // status + Status *int64 `json:"status,omitempty"` + + // unique + Unique string `json:"unique,omitempty"` + + // used + Used []*Fact `json:"used"` + + // visibility + Visibility *Visibility `json:"visibility,omitempty"` +} + +// Validate validates this link +func (m *Link) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAbility(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExecutor(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFacts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRelationships(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisibility(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Link) validateAbility(formats strfmt.Registry) error { + if swag.IsZero(m.Ability) { // not required + return nil + } + + if m.Ability != nil { + if err := m.Ability.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ability") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ability") + } + return err + } + } + + return nil +} + +func (m *Link) validateExecutor(formats strfmt.Registry) error { + if swag.IsZero(m.Executor) { // not required + return nil + } + + if m.Executor != nil { + if err := m.Executor.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executor") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executor") + } + return err + } + } + + return nil +} + +func (m *Link) validateFacts(formats strfmt.Registry) error { + if swag.IsZero(m.Facts) { // not required + return nil + } + + for i := 0; i < len(m.Facts); i++ { + if swag.IsZero(m.Facts[i]) { // not required + continue + } + + if m.Facts[i] != nil { + if err := m.Facts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("facts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("facts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Link) validateRelationships(formats strfmt.Registry) error { + if swag.IsZero(m.Relationships) { // not required + return nil + } + + for i := 0; i < len(m.Relationships); i++ { + if swag.IsZero(m.Relationships[i]) { // not required + continue + } + + if m.Relationships[i] != nil { + if err := m.Relationships[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relationships" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relationships" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Link) validateUsed(formats strfmt.Registry) error { + if swag.IsZero(m.Used) { // not required + return nil + } + + for i := 0; i < len(m.Used); i++ { + if swag.IsZero(m.Used[i]) { // not required + continue + } + + if m.Used[i] != nil { + if err := m.Used[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("used" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("used" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Link) validateVisibility(formats strfmt.Registry) error { + if swag.IsZero(m.Visibility) { // not required + return nil + } + + if m.Visibility != nil { + if err := m.Visibility.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("visibility") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("visibility") + } + return err + } + } + + return nil +} + +// ContextValidate validate this link based on the context it is used +func (m *Link) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAbility(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateExecutor(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFacts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRelationships(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsed(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVisibility(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Link) contextValidateAbility(ctx context.Context, formats strfmt.Registry) error { + + if m.Ability != nil { + + if swag.IsZero(m.Ability) { // not required + return nil + } + + if err := m.Ability.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ability") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ability") + } + return err + } + } + + return nil +} + +func (m *Link) contextValidateExecutor(ctx context.Context, formats strfmt.Registry) error { + + if m.Executor != nil { + + if swag.IsZero(m.Executor) { // not required + return nil + } + + if err := m.Executor.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executor") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executor") + } + return err + } + } + + return nil +} + +func (m *Link) contextValidateFacts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Facts); i++ { + + if m.Facts[i] != nil { + + if swag.IsZero(m.Facts[i]) { // not required + return nil + } + + if err := m.Facts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("facts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("facts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Link) contextValidateRelationships(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Relationships); i++ { + + if m.Relationships[i] != nil { + + if swag.IsZero(m.Relationships[i]) { // not required + return nil + } + + if err := m.Relationships[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relationships" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relationships" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Link) contextValidateUsed(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Used); i++ { + + if m.Used[i] != nil { + + if swag.IsZero(m.Used[i]) { // not required + return nil + } + + if err := m.Used[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("used" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("used" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Link) contextValidateVisibility(ctx context.Context, formats strfmt.Registry) error { + + if m.Visibility != nil { + + if swag.IsZero(m.Visibility) { // not required + return nil + } + + if err := m.Visibility.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("visibility") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("visibility") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Link) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Link) UnmarshalBinary(b []byte) error { + var res Link + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/link_result.go b/pkg/core/capability/caldera/api/models/link_result.go new file mode 100644 index 00000000..d8705f12 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/link_result.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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// LinkResult link result +// +// swagger:model LinkResult +type LinkResult struct { + + // link + Link *PartialLink `json:"link,omitempty"` + + // result + Result string `json:"result,omitempty"` +} + +// Validate validates this link result +func (m *LinkResult) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLink(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LinkResult) validateLink(formats strfmt.Registry) error { + if swag.IsZero(m.Link) { // not required + return nil + } + + if m.Link != nil { + if err := m.Link.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("link") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("link") + } + return err + } + } + + return nil +} + +// ContextValidate validate this link result based on the context it is used +func (m *LinkResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLink(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LinkResult) contextValidateLink(ctx context.Context, formats strfmt.Registry) error { + + if m.Link != nil { + + if swag.IsZero(m.Link) { // not required + return nil + } + + if err := m.Link.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("link") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("link") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LinkResult) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LinkResult) UnmarshalBinary(b []byte) error { + var res LinkResult + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/objective.go b/pkg/core/capability/caldera/api/models/objective.go new file mode 100644 index 00000000..7da2246c --- /dev/null +++ b/pkg/core/capability/caldera/api/models/objective.go @@ -0,0 +1,148 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Objective objective +// +// swagger:model Objective +type Objective struct { + + // description + Description string `json:"description,omitempty"` + + // goals + Goals []*Goal `json:"goals"` + + // id + ID string `json:"id,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // percentage + // Read Only: true + Percentage float64 `json:"percentage,omitempty"` +} + +// Validate validates this objective +func (m *Objective) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGoals(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Objective) validateGoals(formats strfmt.Registry) error { + if swag.IsZero(m.Goals) { // not required + return nil + } + + for i := 0; i < len(m.Goals); i++ { + if swag.IsZero(m.Goals[i]) { // not required + continue + } + + if m.Goals[i] != nil { + if err := m.Goals[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("goals" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("goals" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this objective based on the context it is used +func (m *Objective) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGoals(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePercentage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Objective) contextValidateGoals(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Goals); i++ { + + if m.Goals[i] != nil { + + if swag.IsZero(m.Goals[i]) { // not required + return nil + } + + if err := m.Goals[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("goals" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("goals" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Objective) contextValidatePercentage(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "percentage", "body", float64(m.Percentage)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Objective) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Objective) UnmarshalBinary(b []byte) error { + var res Objective + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/operation.go b/pkg/core/capability/caldera/api/models/operation.go new file mode 100644 index 00000000..b4d3c290 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/operation.go @@ -0,0 +1,396 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Operation operation +// +// swagger:model Operation +type Operation struct { + + // adversary + Adversary *Adversary `json:"adversary,omitempty"` + + // auto close + AutoClose bool `json:"auto_close,omitempty"` + + // autonomous + Autonomous int64 `json:"autonomous,omitempty"` + + // chain + // Read Only: true + Chain interface{} `json:"chain,omitempty"` + + // group + Group string `json:"group,omitempty"` + + // host group + // Read Only: true + HostGroup []*Agent `json:"host_group"` + + // id + ID string `json:"id,omitempty"` + + // jitter + Jitter string `json:"jitter,omitempty"` + + // name + // Required: true + Name *string `json:"name"` + + // obfuscator + Obfuscator string `json:"obfuscator,omitempty"` + + // objective + Objective *Objective `json:"objective,omitempty"` + + // planner + Planner *Planner `json:"planner,omitempty"` + + // source + Source *Source `json:"source,omitempty"` + + // start + // Read Only: true + Start string `json:"start,omitempty"` + + // state + State string `json:"state,omitempty"` + + // use learning parsers + UseLearningParsers bool `json:"use_learning_parsers,omitempty"` + + // visibility + Visibility int64 `json:"visibility,omitempty"` +} + +// Validate validates this operation +func (m *Operation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAdversary(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHostGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateObjective(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePlanner(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Operation) validateAdversary(formats strfmt.Registry) error { + if swag.IsZero(m.Adversary) { // not required + return nil + } + + if m.Adversary != nil { + if err := m.Adversary.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adversary") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adversary") + } + return err + } + } + + return nil +} + +func (m *Operation) validateHostGroup(formats strfmt.Registry) error { + if swag.IsZero(m.HostGroup) { // not required + return nil + } + + for i := 0; i < len(m.HostGroup); i++ { + if swag.IsZero(m.HostGroup[i]) { // not required + continue + } + + if m.HostGroup[i] != nil { + if err := m.HostGroup[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("host_group" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("host_group" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Operation) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Operation) validateObjective(formats strfmt.Registry) error { + if swag.IsZero(m.Objective) { // not required + return nil + } + + if m.Objective != nil { + if err := m.Objective.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("objective") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("objective") + } + return err + } + } + + return nil +} + +func (m *Operation) validatePlanner(formats strfmt.Registry) error { + if swag.IsZero(m.Planner) { // not required + return nil + } + + if m.Planner != nil { + if err := m.Planner.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("planner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("planner") + } + return err + } + } + + return nil +} + +func (m *Operation) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this operation based on the context it is used +func (m *Operation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAdversary(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHostGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateObjective(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePlanner(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStart(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Operation) contextValidateAdversary(ctx context.Context, formats strfmt.Registry) error { + + if m.Adversary != nil { + + if swag.IsZero(m.Adversary) { // not required + return nil + } + + if err := m.Adversary.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adversary") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adversary") + } + return err + } + } + + return nil +} + +func (m *Operation) contextValidateHostGroup(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "host_group", "body", []*Agent(m.HostGroup)); err != nil { + return err + } + + for i := 0; i < len(m.HostGroup); i++ { + + if m.HostGroup[i] != nil { + + if swag.IsZero(m.HostGroup[i]) { // not required + return nil + } + + if err := m.HostGroup[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("host_group" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("host_group" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Operation) contextValidateObjective(ctx context.Context, formats strfmt.Registry) error { + + if m.Objective != nil { + + if swag.IsZero(m.Objective) { // not required + return nil + } + + if err := m.Objective.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("objective") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("objective") + } + return err + } + } + + return nil +} + +func (m *Operation) contextValidatePlanner(ctx context.Context, formats strfmt.Registry) error { + + if m.Planner != nil { + + if swag.IsZero(m.Planner) { // not required + return nil + } + + if err := m.Planner.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("planner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("planner") + } + return err + } + } + + return nil +} + +func (m *Operation) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *Operation) contextValidateStart(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "start", "body", string(m.Start)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Operation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Operation) UnmarshalBinary(b []byte) error { + var res Operation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/operation1.go b/pkg/core/capability/caldera/api/models/operation1.go new file mode 100644 index 00000000..285ebac7 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/operation1.go @@ -0,0 +1,56 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Operation1 operation1 +// +// swagger:model Operation1 +type Operation1 struct { + + // autonomous + Autonomous int64 `json:"autonomous,omitempty"` + + // obfuscator + Obfuscator string `json:"obfuscator,omitempty"` + + // state + State string `json:"state,omitempty"` +} + +// Validate validates this operation1 +func (m *Operation1) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this operation1 based on context it is used +func (m *Operation1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Operation1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Operation1) UnmarshalBinary(b []byte) error { + var res Operation1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/operation_output_request.go b/pkg/core/capability/caldera/api/models/operation_output_request.go new file mode 100644 index 00000000..c5049d51 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/operation_output_request.go @@ -0,0 +1,50 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// OperationOutputRequest operation output request +// +// swagger:model OperationOutputRequest +type OperationOutputRequest struct { + + // enable agent output + EnableAgentOutput bool `json:"enable_agent_output,omitempty"` +} + +// Validate validates this operation output request +func (m *OperationOutputRequest) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this operation output request based on context it is used +func (m *OperationOutputRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *OperationOutputRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OperationOutputRequest) UnmarshalBinary(b []byte) error { + var res OperationOutputRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/parser.go b/pkg/core/capability/caldera/api/models/parser.go new file mode 100644 index 00000000..48578025 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/parser.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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Parser parser +// +// swagger:model Parser +type Parser struct { + + // module + Module string `json:"module,omitempty"` + + // parserconfigs + Parserconfigs []*ParserConfig `json:"parserconfigs"` +} + +// Validate validates this parser +func (m *Parser) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateParserconfigs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Parser) validateParserconfigs(formats strfmt.Registry) error { + if swag.IsZero(m.Parserconfigs) { // not required + return nil + } + + for i := 0; i < len(m.Parserconfigs); i++ { + if swag.IsZero(m.Parserconfigs[i]) { // not required + continue + } + + if m.Parserconfigs[i] != nil { + if err := m.Parserconfigs[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("parserconfigs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("parserconfigs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this parser based on the context it is used +func (m *Parser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateParserconfigs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Parser) contextValidateParserconfigs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Parserconfigs); i++ { + + if m.Parserconfigs[i] != nil { + + if swag.IsZero(m.Parserconfigs[i]) { // not required + return nil + } + + if err := m.Parserconfigs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("parserconfigs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("parserconfigs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Parser) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Parser) UnmarshalBinary(b []byte) error { + var res Parser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/parser_config.go b/pkg/core/capability/caldera/api/models/parser_config.go new file mode 100644 index 00000000..f2389781 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/parser_config.go @@ -0,0 +1,163 @@ +// 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 ( + "context" + "encoding/json" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ParserConfig parser config +// +// swagger:model ParserConfig +type ParserConfig struct { + + // custom parser vals + CustomParserVals map[string]string `json:"custom_parser_vals,omitempty"` + + // edge + Edge *string `json:"edge,omitempty"` + + // source + Source string `json:"source,omitempty"` + + // target + Target *string `json:"target,omitempty"` + + // parser config additional properties + ParserConfigAdditionalProperties map[string]interface{} `json:"-"` +} + +// UnmarshalJSON unmarshals this object with additional properties from JSON +func (m *ParserConfig) UnmarshalJSON(data []byte) error { + // stage 1, bind the properties + var stage1 struct { + + // custom parser vals + CustomParserVals map[string]string `json:"custom_parser_vals,omitempty"` + + // edge + Edge *string `json:"edge,omitempty"` + + // source + Source string `json:"source,omitempty"` + + // target + Target *string `json:"target,omitempty"` + } + if err := json.Unmarshal(data, &stage1); err != nil { + return err + } + var rcv ParserConfig + + rcv.CustomParserVals = stage1.CustomParserVals + rcv.Edge = stage1.Edge + rcv.Source = stage1.Source + rcv.Target = stage1.Target + *m = rcv + + // stage 2, remove properties and add to map + stage2 := make(map[string]json.RawMessage) + if err := json.Unmarshal(data, &stage2); err != nil { + return err + } + + delete(stage2, "custom_parser_vals") + delete(stage2, "edge") + delete(stage2, "source") + delete(stage2, "target") + // stage 3, add additional properties values + if len(stage2) > 0 { + result := make(map[string]interface{}) + for k, v := range stage2 { + var toadd interface{} + if err := json.Unmarshal(v, &toadd); err != nil { + return err + } + result[k] = toadd + } + m.ParserConfigAdditionalProperties = result + } + + return nil +} + +// MarshalJSON marshals this object with additional properties into a JSON object +func (m ParserConfig) MarshalJSON() ([]byte, error) { + var stage1 struct { + + // custom parser vals + CustomParserVals map[string]string `json:"custom_parser_vals,omitempty"` + + // edge + Edge *string `json:"edge,omitempty"` + + // source + Source string `json:"source,omitempty"` + + // target + Target *string `json:"target,omitempty"` + } + + stage1.CustomParserVals = m.CustomParserVals + stage1.Edge = m.Edge + stage1.Source = m.Source + stage1.Target = m.Target + + // make JSON object for known properties + props, err := json.Marshal(stage1) + if err != nil { + return nil, err + } + + if len(m.ParserConfigAdditionalProperties) == 0 { // no additional properties + return props, nil + } + + // make JSON object for the additional properties + additional, err := json.Marshal(m.ParserConfigAdditionalProperties) + if err != nil { + return nil, err + } + + if len(props) < 3 { // "{}": only additional properties + return additional, nil + } + + // concatenate the 2 objects + return swag.ConcatJSON(props, additional), nil +} + +// Validate validates this parser config +func (m *ParserConfig) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this parser config based on context it is used +func (m *ParserConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ParserConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ParserConfig) UnmarshalBinary(b []byte) error { + var res ParserConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_ability.go b/pkg/core/capability/caldera/api/models/partial_ability.go new file mode 100644 index 00000000..bdc18a24 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_ability.go @@ -0,0 +1,248 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialAbility partial ability +// +// swagger:model Partial-Ability +type PartialAbility struct { + + // ability id + AbilityID string `json:"ability_id,omitempty"` + + // access + Access struct { + Access + } `json:"access,omitempty"` + + // additional info + AdditionalInfo map[string]string `json:"additional_info,omitempty"` + + // buckets + Buckets []string `json:"buckets"` + + // delete payload + DeletePayload *bool `json:"delete_payload,omitempty"` + + // description + Description *string `json:"description,omitempty"` + + // executors + Executors []*Executor `json:"executors"` + + // name + Name *string `json:"name,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // privilege + Privilege *string `json:"privilege,omitempty"` + + // repeatable + Repeatable *bool `json:"repeatable,omitempty"` + + // requirements + Requirements []*Requirement `json:"requirements"` + + // singleton + Singleton *bool `json:"singleton,omitempty"` + + // tactic + Tactic *string `json:"tactic,omitempty"` + + // technique id + TechniqueID *string `json:"technique_id,omitempty"` + + // technique name + TechniqueName *string `json:"technique_name,omitempty"` +} + +// Validate validates this partial ability +func (m *PartialAbility) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccess(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExecutors(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRequirements(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialAbility) validateAccess(formats strfmt.Registry) error { + if swag.IsZero(m.Access) { // not required + return nil + } + + return nil +} + +func (m *PartialAbility) validateExecutors(formats strfmt.Registry) error { + if swag.IsZero(m.Executors) { // not required + return nil + } + + for i := 0; i < len(m.Executors); i++ { + if swag.IsZero(m.Executors[i]) { // not required + continue + } + + if m.Executors[i] != nil { + if err := m.Executors[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialAbility) validateRequirements(formats strfmt.Registry) error { + if swag.IsZero(m.Requirements) { // not required + return nil + } + + for i := 0; i < len(m.Requirements); i++ { + if swag.IsZero(m.Requirements[i]) { // not required + continue + } + + if m.Requirements[i] != nil { + if err := m.Requirements[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("requirements" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("requirements" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this partial ability based on the context it is used +func (m *PartialAbility) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccess(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateExecutors(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRequirements(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialAbility) contextValidateAccess(ctx context.Context, formats strfmt.Registry) error { + + return nil +} + +func (m *PartialAbility) contextValidateExecutors(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Executors); i++ { + + if m.Executors[i] != nil { + + if swag.IsZero(m.Executors[i]) { // not required + return nil + } + + if err := m.Executors[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialAbility) contextValidateRequirements(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Requirements); i++ { + + if m.Requirements[i] != nil { + + if swag.IsZero(m.Requirements[i]) { // not required + return nil + } + + if err := m.Requirements[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("requirements" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("requirements" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialAbility) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialAbility) UnmarshalBinary(b []byte) error { + var res PartialAbility + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_ability1.go b/pkg/core/capability/caldera/api/models/partial_ability1.go new file mode 100644 index 00000000..d52c6818 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_ability1.go @@ -0,0 +1,154 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialAbility1 partial ability1 +// +// swagger:model Partial-Ability1 +type PartialAbility1 struct { + + // buckets + Buckets []string `json:"buckets"` + + // delete payload + DeletePayload *bool `json:"delete_payload,omitempty"` + + // description + Description *string `json:"description,omitempty"` + + // executors + Executors []*Executor `json:"executors"` + + // name + Name *string `json:"name,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // privilege + Privilege *string `json:"privilege,omitempty"` + + // repeatable + Repeatable *bool `json:"repeatable,omitempty"` + + // singleton + Singleton *bool `json:"singleton,omitempty"` + + // tactic + Tactic *string `json:"tactic,omitempty"` + + // technique id + TechniqueID *string `json:"technique_id,omitempty"` + + // technique name + TechniqueName *string `json:"technique_name,omitempty"` +} + +// Validate validates this partial ability1 +func (m *PartialAbility1) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExecutors(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialAbility1) validateExecutors(formats strfmt.Registry) error { + if swag.IsZero(m.Executors) { // not required + return nil + } + + for i := 0; i < len(m.Executors); i++ { + if swag.IsZero(m.Executors[i]) { // not required + continue + } + + if m.Executors[i] != nil { + if err := m.Executors[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this partial ability1 based on the context it is used +func (m *PartialAbility1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateExecutors(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialAbility1) contextValidateExecutors(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Executors); i++ { + + if m.Executors[i] != nil { + + if swag.IsZero(m.Executors[i]) { // not required + return nil + } + + if err := m.Executors[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialAbility1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialAbility1) UnmarshalBinary(b []byte) error { + var res PartialAbility1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_adversary.go b/pkg/core/capability/caldera/api/models/partial_adversary.go new file mode 100644 index 00000000..238ca011 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_adversary.go @@ -0,0 +1,92 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PartialAdversary partial adversary +// +// swagger:model Partial-Adversary +type PartialAdversary struct { + + // adversary id + AdversaryID string `json:"adversary_id,omitempty"` + + // atomic ordering + AtomicOrdering []string `json:"atomic_ordering"` + + // description + Description string `json:"description,omitempty"` + + // has repeatable abilities + // Read Only: true + HasRepeatableAbilities *bool `json:"has_repeatable_abilities,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // objective + Objective string `json:"objective,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // tags + Tags []string `json:"tags"` +} + +// Validate validates this partial adversary +func (m *PartialAdversary) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this partial adversary based on the context it is used +func (m *PartialAdversary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHasRepeatableAbilities(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialAdversary) contextValidateHasRepeatableAbilities(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "has_repeatable_abilities", "body", m.HasRepeatableAbilities); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialAdversary) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialAdversary) UnmarshalBinary(b []byte) error { + var res PartialAdversary + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_adversary1.go b/pkg/core/capability/caldera/api/models/partial_adversary1.go new file mode 100644 index 00000000..dc790302 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_adversary1.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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PartialAdversary1 partial adversary1 +// +// swagger:model Partial-Adversary1 +type PartialAdversary1 struct { + + // atomic ordering + AtomicOrdering []string `json:"atomic_ordering"` + + // description + Description string `json:"description,omitempty"` + + // has repeatable abilities + // Read Only: true + HasRepeatableAbilities *bool `json:"has_repeatable_abilities,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // objective + Objective string `json:"objective,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // tags + Tags []string `json:"tags"` +} + +// Validate validates this partial adversary1 +func (m *PartialAdversary1) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this partial adversary1 based on the context it is used +func (m *PartialAdversary1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHasRepeatableAbilities(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialAdversary1) contextValidateHasRepeatableAbilities(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "has_repeatable_abilities", "body", m.HasRepeatableAbilities); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialAdversary1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialAdversary1) UnmarshalBinary(b []byte) error { + var res PartialAdversary1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_agent.go b/pkg/core/capability/caldera/api/models/partial_agent.go new file mode 100644 index 00000000..e671927f --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_agent.go @@ -0,0 +1,256 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PartialAgent partial agent +// +// swagger:model Partial-Agent +type PartialAgent struct { + + // architecture + Architecture string `json:"architecture,omitempty"` + + // available contacts + AvailableContacts []string `json:"available_contacts"` + + // contact + Contact string `json:"contact,omitempty"` + + // created + // Read Only: true + Created string `json:"created,omitempty"` + + // deadman enabled + DeadmanEnabled *bool `json:"deadman_enabled,omitempty"` + + // display name + // Read Only: true + DisplayName string `json:"display_name,omitempty"` + + // exe name + ExeName string `json:"exe_name,omitempty"` + + // executors + Executors []string `json:"executors"` + + // group + Group string `json:"group,omitempty"` + + // host + Host string `json:"host,omitempty"` + + // host ip addrs + HostIPAddrs []string `json:"host_ip_addrs"` + + // last seen + // Read Only: true + LastSeen string `json:"last_seen,omitempty"` + + // links + // Read Only: true + Links []*Link `json:"links"` + + // location + Location string `json:"location,omitempty"` + + // origin link id + OriginLinkID string `json:"origin_link_id,omitempty"` + + // paw + Paw *string `json:"paw,omitempty"` + + // pending contact + PendingContact string `json:"pending_contact,omitempty"` + + // pid + Pid int64 `json:"pid,omitempty"` + + // platform + Platform string `json:"platform,omitempty"` + + // ppid + Ppid int64 `json:"ppid,omitempty"` + + // privilege + Privilege string `json:"privilege,omitempty"` + + // proxy chain + ProxyChain [][]string `json:"proxy_chain"` + + // proxy receivers + ProxyReceivers map[string][]string `json:"proxy_receivers,omitempty"` + + // server + Server string `json:"server,omitempty"` + + // sleep max + SleepMax int64 `json:"sleep_max,omitempty"` + + // sleep min + SleepMin int64 `json:"sleep_min,omitempty"` + + // trusted + Trusted bool `json:"trusted,omitempty"` + + // upstream dest + UpstreamDest *string `json:"upstream_dest,omitempty"` + + // username + Username string `json:"username,omitempty"` + + // watchdog + Watchdog int64 `json:"watchdog,omitempty"` +} + +// Validate validates this partial agent +func (m *PartialAgent) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLinks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialAgent) validateLinks(formats strfmt.Registry) error { + if swag.IsZero(m.Links) { // not required + return nil + } + + for i := 0; i < len(m.Links); i++ { + if swag.IsZero(m.Links[i]) { // not required + continue + } + + if m.Links[i] != nil { + if err := m.Links[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("links" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("links" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this partial agent based on the context it is used +func (m *PartialAgent) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreated(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDisplayName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLastSeen(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLinks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialAgent) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "created", "body", string(m.Created)); err != nil { + return err + } + + return nil +} + +func (m *PartialAgent) contextValidateDisplayName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "display_name", "body", string(m.DisplayName)); err != nil { + return err + } + + return nil +} + +func (m *PartialAgent) contextValidateLastSeen(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "last_seen", "body", string(m.LastSeen)); err != nil { + return err + } + + return nil +} + +func (m *PartialAgent) contextValidateLinks(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "links", "body", []*Link(m.Links)); err != nil { + return err + } + + for i := 0; i < len(m.Links); i++ { + + if m.Links[i] != nil { + + if swag.IsZero(m.Links[i]) { // not required + return nil + } + + if err := m.Links[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("links" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("links" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialAgent) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialAgent) UnmarshalBinary(b []byte) error { + var res PartialAgent + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_agent1.go b/pkg/core/capability/caldera/api/models/partial_agent1.go new file mode 100644 index 00000000..5cb8d905 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_agent1.go @@ -0,0 +1,65 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialAgent1 partial agent1 +// +// swagger:model Partial-Agent1 +type PartialAgent1 struct { + + // group + Group string `json:"group,omitempty"` + + // pending contact + PendingContact string `json:"pending_contact,omitempty"` + + // sleep max + SleepMax int64 `json:"sleep_max,omitempty"` + + // sleep min + SleepMin int64 `json:"sleep_min,omitempty"` + + // trusted + Trusted bool `json:"trusted,omitempty"` + + // watchdog + Watchdog int64 `json:"watchdog,omitempty"` +} + +// Validate validates this partial agent1 +func (m *PartialAgent1) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this partial agent1 based on context it is used +func (m *PartialAgent1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PartialAgent1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialAgent1) UnmarshalBinary(b []byte) error { + var res PartialAgent1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_fact.go b/pkg/core/capability/caldera/api/models/partial_fact.go new file mode 100644 index 00000000..62b914cd --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_fact.go @@ -0,0 +1,135 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PartialFact partial fact +// +// swagger:model Partial-Fact +type PartialFact struct { + + // collected by + CollectedBy []string `json:"collected_by"` + + // created + // Read Only: true + Created string `json:"created,omitempty"` + + // limit count + LimitCount int64 `json:"limit_count,omitempty"` + + // links + Links []string `json:"links"` + + // name + // Read Only: true + Name string `json:"name,omitempty"` + + // origin type + OriginType interface{} `json:"origin_type,omitempty"` + + // relationships + Relationships []string `json:"relationships"` + + // score + Score int64 `json:"score,omitempty"` + + // source + Source *string `json:"source,omitempty"` + + // technique id + TechniqueID *string `json:"technique_id,omitempty"` + + // trait + Trait string `json:"trait,omitempty"` + + // unique + // Read Only: true + Unique string `json:"unique,omitempty"` + + // value + Value interface{} `json:"value,omitempty"` +} + +// Validate validates this partial fact +func (m *PartialFact) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this partial fact based on the context it is used +func (m *PartialFact) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreated(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnique(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialFact) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "created", "body", string(m.Created)); err != nil { + return err + } + + return nil +} + +func (m *PartialFact) contextValidateName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "name", "body", string(m.Name)); err != nil { + return err + } + + return nil +} + +func (m *PartialFact) contextValidateUnique(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "unique", "body", string(m.Unique)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialFact) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialFact) UnmarshalBinary(b []byte) error { + var res PartialFact + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_fact_update_request.go b/pkg/core/capability/caldera/api/models/partial_fact_update_request.go new file mode 100644 index 00000000..deab78c5 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_fact_update_request.go @@ -0,0 +1,160 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialFactUpdateRequest partial fact update request +// +// swagger:model Partial-FactUpdateRequest +type PartialFactUpdateRequest struct { + + // criteria + Criteria *PartialFact `json:"criteria,omitempty"` + + // updates + Updates *PartialFact `json:"updates,omitempty"` +} + +// Validate validates this partial fact update request +func (m *PartialFactUpdateRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCriteria(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdates(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialFactUpdateRequest) validateCriteria(formats strfmt.Registry) error { + if swag.IsZero(m.Criteria) { // not required + return nil + } + + if m.Criteria != nil { + if err := m.Criteria.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("criteria") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("criteria") + } + return err + } + } + + return nil +} + +func (m *PartialFactUpdateRequest) validateUpdates(formats strfmt.Registry) error { + if swag.IsZero(m.Updates) { // not required + return nil + } + + if m.Updates != nil { + if err := m.Updates.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("updates") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("updates") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial fact update request based on the context it is used +func (m *PartialFactUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCriteria(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUpdates(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialFactUpdateRequest) contextValidateCriteria(ctx context.Context, formats strfmt.Registry) error { + + if m.Criteria != nil { + + if swag.IsZero(m.Criteria) { // not required + return nil + } + + if err := m.Criteria.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("criteria") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("criteria") + } + return err + } + } + + return nil +} + +func (m *PartialFactUpdateRequest) contextValidateUpdates(ctx context.Context, formats strfmt.Registry) error { + + if m.Updates != nil { + + if swag.IsZero(m.Updates) { // not required + return nil + } + + if err := m.Updates.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("updates") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("updates") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialFactUpdateRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialFactUpdateRequest) UnmarshalBinary(b []byte) error { + var res PartialFactUpdateRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_link.go b/pkg/core/capability/caldera/api/models/partial_link.go new file mode 100644 index 00000000..14f05dea --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_link.go @@ -0,0 +1,452 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialLink partial link +// +// swagger:model Partial-Link +type PartialLink struct { + + // ability + Ability *Ability `json:"ability,omitempty"` + + // agent reported time + AgentReportedTime *string `json:"agent_reported_time,omitempty"` + + // cleanup + Cleanup int64 `json:"cleanup,omitempty"` + + // collect + Collect string `json:"collect,omitempty"` + + // command + Command string `json:"command,omitempty"` + + // deadman + Deadman bool `json:"deadman,omitempty"` + + // decide + Decide string `json:"decide,omitempty"` + + // executor + Executor *Executor `json:"executor,omitempty"` + + // facts + Facts []*Fact `json:"facts"` + + // finish + Finish string `json:"finish,omitempty"` + + // host + Host *string `json:"host,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // jitter + Jitter int64 `json:"jitter,omitempty"` + + // output + Output string `json:"output,omitempty"` + + // paw + Paw string `json:"paw,omitempty"` + + // pid + Pid string `json:"pid,omitempty"` + + // pin + Pin int64 `json:"pin,omitempty"` + + // plaintext command + PlaintextCommand string `json:"plaintext_command,omitempty"` + + // relationships + Relationships []*Relationship `json:"relationships"` + + // score + Score int64 `json:"score,omitempty"` + + // status + Status *int64 `json:"status,omitempty"` + + // unique + Unique string `json:"unique,omitempty"` + + // used + Used []*Fact `json:"used"` + + // visibility + Visibility *Visibility `json:"visibility,omitempty"` +} + +// Validate validates this partial link +func (m *PartialLink) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAbility(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExecutor(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFacts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRelationships(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisibility(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialLink) validateAbility(formats strfmt.Registry) error { + if swag.IsZero(m.Ability) { // not required + return nil + } + + if m.Ability != nil { + if err := m.Ability.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ability") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ability") + } + return err + } + } + + return nil +} + +func (m *PartialLink) validateExecutor(formats strfmt.Registry) error { + if swag.IsZero(m.Executor) { // not required + return nil + } + + if m.Executor != nil { + if err := m.Executor.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executor") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executor") + } + return err + } + } + + return nil +} + +func (m *PartialLink) validateFacts(formats strfmt.Registry) error { + if swag.IsZero(m.Facts) { // not required + return nil + } + + for i := 0; i < len(m.Facts); i++ { + if swag.IsZero(m.Facts[i]) { // not required + continue + } + + if m.Facts[i] != nil { + if err := m.Facts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("facts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("facts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialLink) validateRelationships(formats strfmt.Registry) error { + if swag.IsZero(m.Relationships) { // not required + return nil + } + + for i := 0; i < len(m.Relationships); i++ { + if swag.IsZero(m.Relationships[i]) { // not required + continue + } + + if m.Relationships[i] != nil { + if err := m.Relationships[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relationships" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relationships" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialLink) validateUsed(formats strfmt.Registry) error { + if swag.IsZero(m.Used) { // not required + return nil + } + + for i := 0; i < len(m.Used); i++ { + if swag.IsZero(m.Used[i]) { // not required + continue + } + + if m.Used[i] != nil { + if err := m.Used[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("used" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("used" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialLink) validateVisibility(formats strfmt.Registry) error { + if swag.IsZero(m.Visibility) { // not required + return nil + } + + if m.Visibility != nil { + if err := m.Visibility.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("visibility") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("visibility") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial link based on the context it is used +func (m *PartialLink) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAbility(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateExecutor(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFacts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRelationships(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsed(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVisibility(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialLink) contextValidateAbility(ctx context.Context, formats strfmt.Registry) error { + + if m.Ability != nil { + + if swag.IsZero(m.Ability) { // not required + return nil + } + + if err := m.Ability.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ability") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ability") + } + return err + } + } + + return nil +} + +func (m *PartialLink) contextValidateExecutor(ctx context.Context, formats strfmt.Registry) error { + + if m.Executor != nil { + + if swag.IsZero(m.Executor) { // not required + return nil + } + + if err := m.Executor.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executor") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executor") + } + return err + } + } + + return nil +} + +func (m *PartialLink) contextValidateFacts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Facts); i++ { + + if m.Facts[i] != nil { + + if swag.IsZero(m.Facts[i]) { // not required + return nil + } + + if err := m.Facts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("facts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("facts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialLink) contextValidateRelationships(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Relationships); i++ { + + if m.Relationships[i] != nil { + + if swag.IsZero(m.Relationships[i]) { // not required + return nil + } + + if err := m.Relationships[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relationships" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relationships" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialLink) contextValidateUsed(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Used); i++ { + + if m.Used[i] != nil { + + if swag.IsZero(m.Used[i]) { // not required + return nil + } + + if err := m.Used[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("used" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("used" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialLink) contextValidateVisibility(ctx context.Context, formats strfmt.Registry) error { + + if m.Visibility != nil { + + if swag.IsZero(m.Visibility) { // not required + return nil + } + + if err := m.Visibility.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("visibility") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("visibility") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialLink) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialLink) UnmarshalBinary(b []byte) error { + var res PartialLink + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_link1.go b/pkg/core/capability/caldera/api/models/partial_link1.go new file mode 100644 index 00000000..3cfc05c6 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_link1.go @@ -0,0 +1,53 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialLink1 partial link1 +// +// swagger:model Partial-Link1 +type PartialLink1 struct { + + // command + Command string `json:"command,omitempty"` + + // status + Status *int64 `json:"status,omitempty"` +} + +// Validate validates this partial link1 +func (m *PartialLink1) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this partial link1 based on context it is used +func (m *PartialLink1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PartialLink1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialLink1) UnmarshalBinary(b []byte) error { + var res PartialLink1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_obfuscator.go b/pkg/core/capability/caldera/api/models/partial_obfuscator.go new file mode 100644 index 00000000..60842edc --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_obfuscator.go @@ -0,0 +1,56 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialObfuscator partial obfuscator +// +// swagger:model Partial-Obfuscator +type PartialObfuscator struct { + + // description + Description string `json:"description,omitempty"` + + // module + Module string `json:"module,omitempty"` + + // name + Name string `json:"name,omitempty"` +} + +// Validate validates this partial obfuscator +func (m *PartialObfuscator) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this partial obfuscator based on context it is used +func (m *PartialObfuscator) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PartialObfuscator) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialObfuscator) UnmarshalBinary(b []byte) error { + var res PartialObfuscator + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_objective.go b/pkg/core/capability/caldera/api/models/partial_objective.go new file mode 100644 index 00000000..d1ddc4e3 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_objective.go @@ -0,0 +1,148 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PartialObjective partial objective +// +// swagger:model Partial-Objective +type PartialObjective struct { + + // description + Description string `json:"description,omitempty"` + + // goals + Goals []*Goal `json:"goals"` + + // id + ID string `json:"id,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // percentage + // Read Only: true + Percentage float64 `json:"percentage,omitempty"` +} + +// Validate validates this partial objective +func (m *PartialObjective) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGoals(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialObjective) validateGoals(formats strfmt.Registry) error { + if swag.IsZero(m.Goals) { // not required + return nil + } + + for i := 0; i < len(m.Goals); i++ { + if swag.IsZero(m.Goals[i]) { // not required + continue + } + + if m.Goals[i] != nil { + if err := m.Goals[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("goals" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("goals" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this partial objective based on the context it is used +func (m *PartialObjective) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGoals(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePercentage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialObjective) contextValidateGoals(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Goals); i++ { + + if m.Goals[i] != nil { + + if swag.IsZero(m.Goals[i]) { // not required + return nil + } + + if err := m.Goals[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("goals" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("goals" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialObjective) contextValidatePercentage(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "percentage", "body", float64(m.Percentage)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialObjective) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialObjective) UnmarshalBinary(b []byte) error { + var res PartialObjective + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_objective1.go b/pkg/core/capability/caldera/api/models/partial_objective1.go new file mode 100644 index 00000000..85d3a52f --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_objective1.go @@ -0,0 +1,127 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialObjective1 partial objective1 +// +// swagger:model Partial-Objective1 +type PartialObjective1 struct { + + // description + Description string `json:"description,omitempty"` + + // goals + Goals []*Goal `json:"goals"` + + // name + Name string `json:"name,omitempty"` +} + +// Validate validates this partial objective1 +func (m *PartialObjective1) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGoals(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialObjective1) validateGoals(formats strfmt.Registry) error { + if swag.IsZero(m.Goals) { // not required + return nil + } + + for i := 0; i < len(m.Goals); i++ { + if swag.IsZero(m.Goals[i]) { // not required + continue + } + + if m.Goals[i] != nil { + if err := m.Goals[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("goals" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("goals" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this partial objective1 based on the context it is used +func (m *PartialObjective1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGoals(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialObjective1) contextValidateGoals(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Goals); i++ { + + if m.Goals[i] != nil { + + if swag.IsZero(m.Goals[i]) { // not required + return nil + } + + if err := m.Goals[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("goals" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("goals" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialObjective1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialObjective1) UnmarshalBinary(b []byte) error { + var res PartialObjective1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_operation.go b/pkg/core/capability/caldera/api/models/partial_operation.go new file mode 100644 index 00000000..0eb4ba9f --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_operation.go @@ -0,0 +1,382 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PartialOperation partial operation +// +// swagger:model Partial-Operation +type PartialOperation struct { + + // adversary + Adversary *Adversary `json:"adversary,omitempty"` + + // auto close + AutoClose bool `json:"auto_close,omitempty"` + + // autonomous + Autonomous int64 `json:"autonomous,omitempty"` + + // chain + // Read Only: true + Chain interface{} `json:"chain,omitempty"` + + // group + Group string `json:"group,omitempty"` + + // host group + // Read Only: true + HostGroup []*Agent `json:"host_group"` + + // id + ID string `json:"id,omitempty"` + + // jitter + Jitter string `json:"jitter,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // obfuscator + Obfuscator string `json:"obfuscator,omitempty"` + + // objective + Objective *Objective `json:"objective,omitempty"` + + // planner + Planner *Planner `json:"planner,omitempty"` + + // source + Source *Source `json:"source,omitempty"` + + // start + // Read Only: true + Start string `json:"start,omitempty"` + + // state + State string `json:"state,omitempty"` + + // use learning parsers + UseLearningParsers bool `json:"use_learning_parsers,omitempty"` + + // visibility + Visibility int64 `json:"visibility,omitempty"` +} + +// Validate validates this partial operation +func (m *PartialOperation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAdversary(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHostGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateObjective(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePlanner(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialOperation) validateAdversary(formats strfmt.Registry) error { + if swag.IsZero(m.Adversary) { // not required + return nil + } + + if m.Adversary != nil { + if err := m.Adversary.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adversary") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adversary") + } + return err + } + } + + return nil +} + +func (m *PartialOperation) validateHostGroup(formats strfmt.Registry) error { + if swag.IsZero(m.HostGroup) { // not required + return nil + } + + for i := 0; i < len(m.HostGroup); i++ { + if swag.IsZero(m.HostGroup[i]) { // not required + continue + } + + if m.HostGroup[i] != nil { + if err := m.HostGroup[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("host_group" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("host_group" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialOperation) validateObjective(formats strfmt.Registry) error { + if swag.IsZero(m.Objective) { // not required + return nil + } + + if m.Objective != nil { + if err := m.Objective.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("objective") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("objective") + } + return err + } + } + + return nil +} + +func (m *PartialOperation) validatePlanner(formats strfmt.Registry) error { + if swag.IsZero(m.Planner) { // not required + return nil + } + + if m.Planner != nil { + if err := m.Planner.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("planner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("planner") + } + return err + } + } + + return nil +} + +func (m *PartialOperation) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial operation based on the context it is used +func (m *PartialOperation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAdversary(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHostGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateObjective(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePlanner(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStart(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialOperation) contextValidateAdversary(ctx context.Context, formats strfmt.Registry) error { + + if m.Adversary != nil { + + if swag.IsZero(m.Adversary) { // not required + return nil + } + + if err := m.Adversary.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adversary") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adversary") + } + return err + } + } + + return nil +} + +func (m *PartialOperation) contextValidateHostGroup(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "host_group", "body", []*Agent(m.HostGroup)); err != nil { + return err + } + + for i := 0; i < len(m.HostGroup); i++ { + + if m.HostGroup[i] != nil { + + if swag.IsZero(m.HostGroup[i]) { // not required + return nil + } + + if err := m.HostGroup[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("host_group" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("host_group" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialOperation) contextValidateObjective(ctx context.Context, formats strfmt.Registry) error { + + if m.Objective != nil { + + if swag.IsZero(m.Objective) { // not required + return nil + } + + if err := m.Objective.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("objective") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("objective") + } + return err + } + } + + return nil +} + +func (m *PartialOperation) contextValidatePlanner(ctx context.Context, formats strfmt.Registry) error { + + if m.Planner != nil { + + if swag.IsZero(m.Planner) { // not required + return nil + } + + if err := m.Planner.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("planner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("planner") + } + return err + } + } + + return nil +} + +func (m *PartialOperation) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *PartialOperation) contextValidateStart(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "start", "body", string(m.Start)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialOperation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialOperation) UnmarshalBinary(b []byte) error { + var res PartialOperation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_operation1.go b/pkg/core/capability/caldera/api/models/partial_operation1.go new file mode 100644 index 00000000..58d3921e --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_operation1.go @@ -0,0 +1,56 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialOperation1 partial operation1 +// +// swagger:model Partial-Operation1 +type PartialOperation1 struct { + + // autonomous + Autonomous int64 `json:"autonomous,omitempty"` + + // obfuscator + Obfuscator string `json:"obfuscator,omitempty"` + + // state + State string `json:"state,omitempty"` +} + +// Validate validates this partial operation1 +func (m *PartialOperation1) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this partial operation1 based on context it is used +func (m *PartialOperation1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PartialOperation1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialOperation1) UnmarshalBinary(b []byte) error { + var res PartialOperation1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_operation_schema_alt.go b/pkg/core/capability/caldera/api/models/partial_operation_schema_alt.go new file mode 100644 index 00000000..792fae15 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_operation_schema_alt.go @@ -0,0 +1,486 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PartialOperationSchemaAlt partial operation schema alt +// +// swagger:model Partial-OperationSchemaAlt +type PartialOperationSchemaAlt struct { + + // adversary + Adversary *Adversary `json:"adversary,omitempty"` + + // agents + Agents map[string]Agent `json:"agents,omitempty"` + + // auto close + AutoClose bool `json:"auto_close,omitempty"` + + // autonomous + Autonomous int64 `json:"autonomous,omitempty"` + + // chain + // Read Only: true + Chain interface{} `json:"chain,omitempty"` + + // group + Group string `json:"group,omitempty"` + + // host group + // Read Only: true + HostGroup []*Agent `json:"host_group"` + + // hosts + Hosts map[string]Host `json:"hosts,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // jitter + Jitter string `json:"jitter,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // obfuscator + Obfuscator string `json:"obfuscator,omitempty"` + + // objective + Objective *Objective `json:"objective,omitempty"` + + // planner + Planner *Planner `json:"planner,omitempty"` + + // source + Source *Source `json:"source,omitempty"` + + // start + // Read Only: true + Start string `json:"start,omitempty"` + + // state + State string `json:"state,omitempty"` + + // use learning parsers + UseLearningParsers bool `json:"use_learning_parsers,omitempty"` + + // visibility + Visibility int64 `json:"visibility,omitempty"` +} + +// Validate validates this partial operation schema alt +func (m *PartialOperationSchemaAlt) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAdversary(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAgents(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHostGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHosts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateObjective(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePlanner(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialOperationSchemaAlt) validateAdversary(formats strfmt.Registry) error { + if swag.IsZero(m.Adversary) { // not required + return nil + } + + if m.Adversary != nil { + if err := m.Adversary.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adversary") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adversary") + } + return err + } + } + + return nil +} + +func (m *PartialOperationSchemaAlt) validateAgents(formats strfmt.Registry) error { + if swag.IsZero(m.Agents) { // not required + return nil + } + + for k := range m.Agents { + + if err := validate.Required("agents"+"."+k, "body", m.Agents[k]); err != nil { + return err + } + if val, ok := m.Agents[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("agents" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("agents" + "." + k) + } + return err + } + } + + } + + return nil +} + +func (m *PartialOperationSchemaAlt) validateHostGroup(formats strfmt.Registry) error { + if swag.IsZero(m.HostGroup) { // not required + return nil + } + + for i := 0; i < len(m.HostGroup); i++ { + if swag.IsZero(m.HostGroup[i]) { // not required + continue + } + + if m.HostGroup[i] != nil { + if err := m.HostGroup[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("host_group" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("host_group" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialOperationSchemaAlt) validateHosts(formats strfmt.Registry) error { + if swag.IsZero(m.Hosts) { // not required + return nil + } + + for k := range m.Hosts { + + if err := validate.Required("hosts"+"."+k, "body", m.Hosts[k]); err != nil { + return err + } + if val, ok := m.Hosts[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + k) + } + return err + } + } + + } + + return nil +} + +func (m *PartialOperationSchemaAlt) validateObjective(formats strfmt.Registry) error { + if swag.IsZero(m.Objective) { // not required + return nil + } + + if m.Objective != nil { + if err := m.Objective.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("objective") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("objective") + } + return err + } + } + + return nil +} + +func (m *PartialOperationSchemaAlt) validatePlanner(formats strfmt.Registry) error { + if swag.IsZero(m.Planner) { // not required + return nil + } + + if m.Planner != nil { + if err := m.Planner.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("planner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("planner") + } + return err + } + } + + return nil +} + +func (m *PartialOperationSchemaAlt) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial operation schema alt based on the context it is used +func (m *PartialOperationSchemaAlt) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAdversary(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAgents(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHostGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHosts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateObjective(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePlanner(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStart(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialOperationSchemaAlt) contextValidateAdversary(ctx context.Context, formats strfmt.Registry) error { + + if m.Adversary != nil { + + if swag.IsZero(m.Adversary) { // not required + return nil + } + + if err := m.Adversary.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adversary") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adversary") + } + return err + } + } + + return nil +} + +func (m *PartialOperationSchemaAlt) contextValidateAgents(ctx context.Context, formats strfmt.Registry) error { + + for k := range m.Agents { + + if val, ok := m.Agents[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + +func (m *PartialOperationSchemaAlt) contextValidateHostGroup(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "host_group", "body", []*Agent(m.HostGroup)); err != nil { + return err + } + + for i := 0; i < len(m.HostGroup); i++ { + + if m.HostGroup[i] != nil { + + if swag.IsZero(m.HostGroup[i]) { // not required + return nil + } + + if err := m.HostGroup[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("host_group" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("host_group" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialOperationSchemaAlt) contextValidateHosts(ctx context.Context, formats strfmt.Registry) error { + + for k := range m.Hosts { + + if val, ok := m.Hosts[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + +func (m *PartialOperationSchemaAlt) contextValidateObjective(ctx context.Context, formats strfmt.Registry) error { + + if m.Objective != nil { + + if swag.IsZero(m.Objective) { // not required + return nil + } + + if err := m.Objective.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("objective") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("objective") + } + return err + } + } + + return nil +} + +func (m *PartialOperationSchemaAlt) contextValidatePlanner(ctx context.Context, formats strfmt.Registry) error { + + if m.Planner != nil { + + if swag.IsZero(m.Planner) { // not required + return nil + } + + if err := m.Planner.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("planner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("planner") + } + return err + } + } + + return nil +} + +func (m *PartialOperationSchemaAlt) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *PartialOperationSchemaAlt) contextValidateStart(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "start", "body", string(m.Start)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialOperationSchemaAlt) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialOperationSchemaAlt) UnmarshalBinary(b []byte) error { + var res PartialOperationSchemaAlt + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_planner.go b/pkg/core/capability/caldera/api/models/partial_planner.go new file mode 100644 index 00000000..0ba33217 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_planner.go @@ -0,0 +1,145 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialPlanner partial planner +// +// swagger:model Partial-Planner +type PartialPlanner struct { + + // allow repeatable abilities + AllowRepeatableAbilities bool `json:"allow_repeatable_abilities,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // ignore enforcement modules + IgnoreEnforcementModules []string `json:"ignore_enforcement_modules"` + + // module + Module string `json:"module,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // params + Params map[string]interface{} `json:"params,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // stopping conditions + StoppingConditions []*Fact `json:"stopping_conditions"` +} + +// Validate validates this partial planner +func (m *PartialPlanner) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStoppingConditions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialPlanner) validateStoppingConditions(formats strfmt.Registry) error { + if swag.IsZero(m.StoppingConditions) { // not required + return nil + } + + for i := 0; i < len(m.StoppingConditions); i++ { + if swag.IsZero(m.StoppingConditions[i]) { // not required + continue + } + + if m.StoppingConditions[i] != nil { + if err := m.StoppingConditions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("stopping_conditions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("stopping_conditions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this partial planner based on the context it is used +func (m *PartialPlanner) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStoppingConditions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialPlanner) contextValidateStoppingConditions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StoppingConditions); i++ { + + if m.StoppingConditions[i] != nil { + + if swag.IsZero(m.StoppingConditions[i]) { // not required + return nil + } + + if err := m.StoppingConditions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("stopping_conditions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("stopping_conditions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialPlanner) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialPlanner) UnmarshalBinary(b []byte) error { + var res PartialPlanner + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_plugin.go b/pkg/core/capability/caldera/api/models/partial_plugin.go new file mode 100644 index 00000000..7b9bd276 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_plugin.go @@ -0,0 +1,65 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialPlugin partial plugin +// +// swagger:model Partial-Plugin +type PartialPlugin struct { + + // access + Access int64 `json:"access,omitempty"` + + // address + Address string `json:"address,omitempty"` + + // data dir + DataDir string `json:"data_dir,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // enabled + Enabled bool `json:"enabled,omitempty"` + + // name + Name string `json:"name,omitempty"` +} + +// Validate validates this partial plugin +func (m *PartialPlugin) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this partial plugin based on context it is used +func (m *PartialPlugin) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PartialPlugin) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialPlugin) UnmarshalBinary(b []byte) error { + var res PartialPlugin + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_relationship.go b/pkg/core/capability/caldera/api/models/partial_relationship.go new file mode 100644 index 00000000..4fcce0a9 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_relationship.go @@ -0,0 +1,187 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PartialRelationship partial relationship +// +// swagger:model Partial-Relationship +type PartialRelationship struct { + + // edge + Edge *string `json:"edge,omitempty"` + + // origin + Origin *string `json:"origin,omitempty"` + + // score + Score int64 `json:"score,omitempty"` + + // source + Source *Fact `json:"source,omitempty"` + + // target + Target *Fact `json:"target,omitempty"` + + // unique + // Read Only: true + Unique string `json:"unique,omitempty"` +} + +// Validate validates this partial relationship +func (m *PartialRelationship) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialRelationship) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *PartialRelationship) validateTarget(formats strfmt.Registry) error { + if swag.IsZero(m.Target) { // not required + return nil + } + + if m.Target != nil { + if err := m.Target.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial relationship based on the context it is used +func (m *PartialRelationship) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTarget(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnique(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialRelationship) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *PartialRelationship) contextValidateTarget(ctx context.Context, formats strfmt.Registry) error { + + if m.Target != nil { + + if swag.IsZero(m.Target) { // not required + return nil + } + + if err := m.Target.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target") + } + return err + } + } + + return nil +} + +func (m *PartialRelationship) contextValidateUnique(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "unique", "body", string(m.Unique)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialRelationship) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialRelationship) UnmarshalBinary(b []byte) error { + var res PartialRelationship + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_relationship_update.go b/pkg/core/capability/caldera/api/models/partial_relationship_update.go new file mode 100644 index 00000000..29ae8a05 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_relationship_update.go @@ -0,0 +1,160 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialRelationshipUpdate partial relationship update +// +// swagger:model Partial-RelationshipUpdate +type PartialRelationshipUpdate struct { + + // criteria + Criteria *PartialRelationship `json:"criteria,omitempty"` + + // updates + Updates *PartialRelationship `json:"updates,omitempty"` +} + +// Validate validates this partial relationship update +func (m *PartialRelationshipUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCriteria(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdates(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialRelationshipUpdate) validateCriteria(formats strfmt.Registry) error { + if swag.IsZero(m.Criteria) { // not required + return nil + } + + if m.Criteria != nil { + if err := m.Criteria.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("criteria") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("criteria") + } + return err + } + } + + return nil +} + +func (m *PartialRelationshipUpdate) validateUpdates(formats strfmt.Registry) error { + if swag.IsZero(m.Updates) { // not required + return nil + } + + if m.Updates != nil { + if err := m.Updates.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("updates") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("updates") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial relationship update based on the context it is used +func (m *PartialRelationshipUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCriteria(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUpdates(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialRelationshipUpdate) contextValidateCriteria(ctx context.Context, formats strfmt.Registry) error { + + if m.Criteria != nil { + + if swag.IsZero(m.Criteria) { // not required + return nil + } + + if err := m.Criteria.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("criteria") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("criteria") + } + return err + } + } + + return nil +} + +func (m *PartialRelationshipUpdate) contextValidateUpdates(ctx context.Context, formats strfmt.Registry) error { + + if m.Updates != nil { + + if swag.IsZero(m.Updates) { // not required + return nil + } + + if err := m.Updates.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("updates") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("updates") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialRelationshipUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialRelationshipUpdate) UnmarshalBinary(b []byte) error { + var res PartialRelationshipUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_schedule.go b/pkg/core/capability/caldera/api/models/partial_schedule.go new file mode 100644 index 00000000..7511670b --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_schedule.go @@ -0,0 +1,116 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialSchedule partial schedule +// +// swagger:model Partial-Schedule +type PartialSchedule struct { + + // id + ID string `json:"id,omitempty"` + + // schedule + // Example: 5 4 * * * + Schedule string `json:"schedule,omitempty"` + + // task + Task *Operation `json:"task,omitempty"` +} + +// Validate validates this partial schedule +func (m *PartialSchedule) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTask(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialSchedule) validateTask(formats strfmt.Registry) error { + if swag.IsZero(m.Task) { // not required + return nil + } + + if m.Task != nil { + if err := m.Task.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial schedule based on the context it is used +func (m *PartialSchedule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTask(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialSchedule) contextValidateTask(ctx context.Context, formats strfmt.Registry) error { + + if m.Task != nil { + + if swag.IsZero(m.Task) { // not required + return nil + } + + if err := m.Task.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialSchedule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialSchedule) UnmarshalBinary(b []byte) error { + var res PartialSchedule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_schedule1.go b/pkg/core/capability/caldera/api/models/partial_schedule1.go new file mode 100644 index 00000000..a170b04a --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_schedule1.go @@ -0,0 +1,113 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialSchedule1 partial schedule1 +// +// swagger:model Partial-Schedule1 +type PartialSchedule1 struct { + + // schedule + // Example: 5 4 * * * + Schedule string `json:"schedule,omitempty"` + + // task + Task *Operation1 `json:"task,omitempty"` +} + +// Validate validates this partial schedule1 +func (m *PartialSchedule1) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTask(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialSchedule1) validateTask(formats strfmt.Registry) error { + if swag.IsZero(m.Task) { // not required + return nil + } + + if m.Task != nil { + if err := m.Task.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial schedule1 based on the context it is used +func (m *PartialSchedule1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTask(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialSchedule1) contextValidateTask(ctx context.Context, formats strfmt.Registry) error { + + if m.Task != nil { + + if swag.IsZero(m.Task) { // not required + return nil + } + + if err := m.Task.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialSchedule1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialSchedule1) UnmarshalBinary(b []byte) error { + var res PartialSchedule1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_schedule2.go b/pkg/core/capability/caldera/api/models/partial_schedule2.go new file mode 100644 index 00000000..599b026c --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_schedule2.go @@ -0,0 +1,113 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialSchedule2 partial schedule2 +// +// swagger:model Partial-Schedule2 +type PartialSchedule2 struct { + + // schedule + // Example: 5 4 * * * + Schedule string `json:"schedule,omitempty"` + + // task + Task *Operation `json:"task,omitempty"` +} + +// Validate validates this partial schedule2 +func (m *PartialSchedule2) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTask(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialSchedule2) validateTask(formats strfmt.Registry) error { + if swag.IsZero(m.Task) { // not required + return nil + } + + if m.Task != nil { + if err := m.Task.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task") + } + return err + } + } + + return nil +} + +// ContextValidate validate this partial schedule2 based on the context it is used +func (m *PartialSchedule2) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTask(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialSchedule2) contextValidateTask(ctx context.Context, formats strfmt.Registry) error { + + if m.Task != nil { + + if swag.IsZero(m.Task) { // not required + return nil + } + + if err := m.Task.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialSchedule2) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialSchedule2) UnmarshalBinary(b []byte) error { + var res PartialSchedule2 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/partial_source.go b/pkg/core/capability/caldera/api/models/partial_source.go new file mode 100644 index 00000000..124eaad0 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/partial_source.go @@ -0,0 +1,316 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PartialSource partial source +// +// swagger:model Partial-Source +type PartialSource struct { + + // adjustments + Adjustments []*Adjustment `json:"adjustments"` + + // facts + Facts []*Fact `json:"facts"` + + // id + ID string `json:"id,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // relationships + Relationships []*Relationship `json:"relationships"` + + // rules + Rules []*Rule `json:"rules"` +} + +// Validate validates this partial source +func (m *PartialSource) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAdjustments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFacts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRelationships(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialSource) validateAdjustments(formats strfmt.Registry) error { + if swag.IsZero(m.Adjustments) { // not required + return nil + } + + for i := 0; i < len(m.Adjustments); i++ { + if swag.IsZero(m.Adjustments[i]) { // not required + continue + } + + if m.Adjustments[i] != nil { + if err := m.Adjustments[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adjustments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adjustments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialSource) validateFacts(formats strfmt.Registry) error { + if swag.IsZero(m.Facts) { // not required + return nil + } + + for i := 0; i < len(m.Facts); i++ { + if swag.IsZero(m.Facts[i]) { // not required + continue + } + + if m.Facts[i] != nil { + if err := m.Facts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("facts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("facts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialSource) validateRelationships(formats strfmt.Registry) error { + if swag.IsZero(m.Relationships) { // not required + return nil + } + + for i := 0; i < len(m.Relationships); i++ { + if swag.IsZero(m.Relationships[i]) { // not required + continue + } + + if m.Relationships[i] != nil { + if err := m.Relationships[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relationships" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relationships" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialSource) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this partial source based on the context it is used +func (m *PartialSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAdjustments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFacts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRelationships(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PartialSource) contextValidateAdjustments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Adjustments); i++ { + + if m.Adjustments[i] != nil { + + if swag.IsZero(m.Adjustments[i]) { // not required + return nil + } + + if err := m.Adjustments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adjustments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adjustments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialSource) contextValidateFacts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Facts); i++ { + + if m.Facts[i] != nil { + + if swag.IsZero(m.Facts[i]) { // not required + return nil + } + + if err := m.Facts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("facts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("facts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialSource) contextValidateRelationships(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Relationships); i++ { + + if m.Relationships[i] != nil { + + if swag.IsZero(m.Relationships[i]) { // not required + return nil + } + + if err := m.Relationships[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relationships" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relationships" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PartialSource) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PartialSource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PartialSource) UnmarshalBinary(b []byte) error { + var res PartialSource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/payload.go b/pkg/core/capability/caldera/api/models/payload.go new file mode 100644 index 00000000..7c213947 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/payload.go @@ -0,0 +1,50 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Payload payload +// +// swagger:model Payload +type Payload struct { + + // payloads + Payloads []string `json:"payloads"` +} + +// Validate validates this payload +func (m *Payload) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this payload based on context it is used +func (m *Payload) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Payload) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Payload) UnmarshalBinary(b []byte) error { + var res Payload + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/planner.go b/pkg/core/capability/caldera/api/models/planner.go new file mode 100644 index 00000000..024f68d4 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/planner.go @@ -0,0 +1,145 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Planner planner +// +// swagger:model Planner +type Planner struct { + + // allow repeatable abilities + AllowRepeatableAbilities bool `json:"allow_repeatable_abilities,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // ignore enforcement modules + IgnoreEnforcementModules []string `json:"ignore_enforcement_modules"` + + // module + Module string `json:"module,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // params + Params map[string]interface{} `json:"params,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // stopping conditions + StoppingConditions []*Fact `json:"stopping_conditions"` +} + +// Validate validates this planner +func (m *Planner) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStoppingConditions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Planner) validateStoppingConditions(formats strfmt.Registry) error { + if swag.IsZero(m.StoppingConditions) { // not required + return nil + } + + for i := 0; i < len(m.StoppingConditions); i++ { + if swag.IsZero(m.StoppingConditions[i]) { // not required + continue + } + + if m.StoppingConditions[i] != nil { + if err := m.StoppingConditions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("stopping_conditions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("stopping_conditions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this planner based on the context it is used +func (m *Planner) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStoppingConditions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Planner) contextValidateStoppingConditions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StoppingConditions); i++ { + + if m.StoppingConditions[i] != nil { + + if swag.IsZero(m.StoppingConditions[i]) { // not required + return nil + } + + if err := m.StoppingConditions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("stopping_conditions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("stopping_conditions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Planner) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Planner) UnmarshalBinary(b []byte) error { + var res Planner + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/plugin.go b/pkg/core/capability/caldera/api/models/plugin.go new file mode 100644 index 00000000..fbfaf3dd --- /dev/null +++ b/pkg/core/capability/caldera/api/models/plugin.go @@ -0,0 +1,80 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Plugin plugin +// +// swagger:model Plugin +type Plugin struct { + + // address + Address string `json:"address,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // enabled + Enabled bool `json:"enabled,omitempty"` + + // name + // Required: true + Name *string `json:"name"` +} + +// Validate validates this plugin +func (m *Plugin) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Plugin) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this plugin based on context it is used +func (m *Plugin) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Plugin) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Plugin) UnmarshalBinary(b []byte) error { + var res Plugin + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/relationship.go b/pkg/core/capability/caldera/api/models/relationship.go new file mode 100644 index 00000000..bb4a2774 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/relationship.go @@ -0,0 +1,185 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Relationship relationship +// +// swagger:model Relationship +type Relationship struct { + + // edge + Edge *string `json:"edge,omitempty"` + + // origin + Origin *string `json:"origin,omitempty"` + + // score + Score int64 `json:"score,omitempty"` + + // source + // Required: true + Source *Fact `json:"source"` + + // target + Target *Fact `json:"target,omitempty"` + + // unique + // Read Only: true + Unique string `json:"unique,omitempty"` +} + +// Validate validates this relationship +func (m *Relationship) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Relationship) validateSource(formats strfmt.Registry) error { + + if err := validate.Required("source", "body", m.Source); err != nil { + return err + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *Relationship) validateTarget(formats strfmt.Registry) error { + if swag.IsZero(m.Target) { // not required + return nil + } + + if m.Target != nil { + if err := m.Target.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target") + } + return err + } + } + + return nil +} + +// ContextValidate validate this relationship based on the context it is used +func (m *Relationship) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTarget(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnique(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Relationship) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *Relationship) contextValidateTarget(ctx context.Context, formats strfmt.Registry) error { + + if m.Target != nil { + + if swag.IsZero(m.Target) { // not required + return nil + } + + if err := m.Target.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target") + } + return err + } + } + + return nil +} + +func (m *Relationship) contextValidateUnique(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "unique", "body", string(m.Unique)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Relationship) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Relationship) UnmarshalBinary(b []byte) error { + var res Relationship + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/requirement.go b/pkg/core/capability/caldera/api/models/requirement.go new file mode 100644 index 00000000..ccc1ea07 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/requirement.go @@ -0,0 +1,53 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Requirement requirement +// +// swagger:model Requirement +type Requirement struct { + + // module + Module string `json:"module,omitempty"` + + // relationship match + RelationshipMatch []map[string]interface{} `json:"relationship_match"` +} + +// Validate validates this requirement +func (m *Requirement) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this requirement based on context it is used +func (m *Requirement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Requirement) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Requirement) UnmarshalBinary(b []byte) error { + var res Requirement + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/rule.go b/pkg/core/capability/caldera/api/models/rule.go new file mode 100644 index 00000000..5c93bebe --- /dev/null +++ b/pkg/core/capability/caldera/api/models/rule.go @@ -0,0 +1,91 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Rule rule +// +// swagger:model Rule +type Rule struct { + + // action + // Required: true + Action interface{} `json:"action"` + + // match + Match string `json:"match,omitempty"` + + // trait + // Required: true + Trait *string `json:"trait"` +} + +// Validate validates this rule +func (m *Rule) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTrait(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Rule) validateAction(formats strfmt.Registry) error { + + if m.Action == nil { + return errors.Required("action", "body", nil) + } + + return nil +} + +func (m *Rule) validateTrait(formats strfmt.Registry) error { + + if err := validate.Required("trait", "body", m.Trait); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this rule based on context it is used +func (m *Rule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Rule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Rule) UnmarshalBinary(b []byte) error { + var res Rule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/schedule.go b/pkg/core/capability/caldera/api/models/schedule.go new file mode 100644 index 00000000..1d268a3b --- /dev/null +++ b/pkg/core/capability/caldera/api/models/schedule.go @@ -0,0 +1,131 @@ +// 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 ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Schedule schedule +// +// swagger:model Schedule +type Schedule struct { + + // id + ID string `json:"id,omitempty"` + + // schedule + // Example: 5 4 * * * + // Required: true + Schedule *string `json:"schedule"` + + // task + Task *Operation `json:"task,omitempty"` +} + +// Validate validates this schedule +func (m *Schedule) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSchedule(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTask(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Schedule) validateSchedule(formats strfmt.Registry) error { + + if err := validate.Required("schedule", "body", m.Schedule); err != nil { + return err + } + + return nil +} + +func (m *Schedule) validateTask(formats strfmt.Registry) error { + if swag.IsZero(m.Task) { // not required + return nil + } + + if m.Task != nil { + if err := m.Task.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task") + } + return err + } + } + + return nil +} + +// ContextValidate validate this schedule based on the context it is used +func (m *Schedule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTask(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Schedule) contextValidateTask(ctx context.Context, formats strfmt.Registry) error { + + if m.Task != nil { + + if swag.IsZero(m.Task) { // not required + return nil + } + + if err := m.Task.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Schedule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Schedule) UnmarshalBinary(b []byte) error { + var res Schedule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/source.go b/pkg/core/capability/caldera/api/models/source.go new file mode 100644 index 00000000..42f2a576 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/source.go @@ -0,0 +1,316 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Source source +// +// swagger:model Source +type Source struct { + + // adjustments + Adjustments []*Adjustment `json:"adjustments"` + + // facts + Facts []*Fact `json:"facts"` + + // id + ID string `json:"id,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // plugin + Plugin *string `json:"plugin,omitempty"` + + // relationships + Relationships []*Relationship `json:"relationships"` + + // rules + Rules []*Rule `json:"rules"` +} + +// Validate validates this source +func (m *Source) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAdjustments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFacts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRelationships(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Source) validateAdjustments(formats strfmt.Registry) error { + if swag.IsZero(m.Adjustments) { // not required + return nil + } + + for i := 0; i < len(m.Adjustments); i++ { + if swag.IsZero(m.Adjustments[i]) { // not required + continue + } + + if m.Adjustments[i] != nil { + if err := m.Adjustments[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adjustments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adjustments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Source) validateFacts(formats strfmt.Registry) error { + if swag.IsZero(m.Facts) { // not required + return nil + } + + for i := 0; i < len(m.Facts); i++ { + if swag.IsZero(m.Facts[i]) { // not required + continue + } + + if m.Facts[i] != nil { + if err := m.Facts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("facts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("facts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Source) validateRelationships(formats strfmt.Registry) error { + if swag.IsZero(m.Relationships) { // not required + return nil + } + + for i := 0; i < len(m.Relationships); i++ { + if swag.IsZero(m.Relationships[i]) { // not required + continue + } + + if m.Relationships[i] != nil { + if err := m.Relationships[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relationships" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relationships" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Source) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this source based on the context it is used +func (m *Source) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAdjustments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFacts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRelationships(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Source) contextValidateAdjustments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Adjustments); i++ { + + if m.Adjustments[i] != nil { + + if swag.IsZero(m.Adjustments[i]) { // not required + return nil + } + + if err := m.Adjustments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("adjustments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("adjustments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Source) contextValidateFacts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Facts); i++ { + + if m.Facts[i] != nil { + + if swag.IsZero(m.Facts[i]) { // not required + return nil + } + + if err := m.Facts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("facts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("facts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Source) contextValidateRelationships(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Relationships); i++ { + + if m.Relationships[i] != nil { + + if swag.IsZero(m.Relationships[i]) { // not required + return nil + } + + if err := m.Relationships[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relationships" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relationships" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Source) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Source) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Source) UnmarshalBinary(b []byte) error { + var res Source + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/variation.go b/pkg/core/capability/caldera/api/models/variation.go new file mode 100644 index 00000000..0c57d4b9 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/variation.go @@ -0,0 +1,53 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Variation variation +// +// swagger:model Variation +type Variation struct { + + // command + Command string `json:"command,omitempty"` + + // description + Description string `json:"description,omitempty"` +} + +// Validate validates this variation +func (m *Variation) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this variation based on context it is used +func (m *Variation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Variation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Variation) UnmarshalBinary(b []byte) error { + var res Variation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/core/capability/caldera/api/models/visibility.go b/pkg/core/capability/caldera/api/models/visibility.go new file mode 100644 index 00000000..b1994622 --- /dev/null +++ b/pkg/core/capability/caldera/api/models/visibility.go @@ -0,0 +1,53 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Visibility visibility +// +// swagger:model Visibility +type Visibility struct { + + // adjustments + Adjustments []int64 `json:"adjustments"` + + // score + Score int64 `json:"score,omitempty"` +} + +// Validate validates this visibility +func (m *Visibility) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this visibility based on context it is used +func (m *Visibility) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Visibility) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Visibility) UnmarshalBinary(b []byte) error { + var res Visibility + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}