diff --git a/go.mod b/go.mod index d919591..990da93 100644 --- a/go.mod +++ b/go.mod @@ -5,15 +5,10 @@ go 1.15 //replace github.com/IBM/schematics-go-sdk/schematicsv2 => /Users/sundeepmulampaka/goblueprint/src/github.ibm.com/schematics-sdk/schematics-go-sdk/schematicsv2 require ( - github.com/IBM/schematics-go-sdk/schematicsv2 v1.2.3 - github.com/IBM/go-sdk-core/v5 v5.10.1 - github.com/IBM/ibm-iae-go-sdk v0.5.0 // indirect - github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect - github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect - github.com/go-openapi/strfmt v0.21.3 - github.com/go-stack/stack v1.8.1 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.17.0 - github.com/stretchr/testify v1.8.0 -) \ No newline at end of file + github.com/IBM/go-sdk-core/v5 v5.10.2 + github.com/go-openapi/strfmt v0.21.3 + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.18.0 + github.com/stretchr/testify v1.8.0 +) diff --git a/go.sum b/go.sum index 28c0315..9f58a1b 100644 --- a/go.sum +++ b/go.sum @@ -1,196 +1,165 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/IBM/go-sdk-core/v5 v5.5.1 h1:Hb4xB1BL8L6uCnskIqSCxF9wLfOmj4+sVzM5vFtuhs4= -github.com/IBM/go-sdk-core/v5 v5.5.1/go.mod h1:Sn+z+qTDREQvCr+UFa22TqqfXNxx3o723y8GsfLV8e0= +github.com/IBM/go-sdk-core/v5 v5.10.2 h1:bfqhYNwwpJ3zJQSYpF3umhmRIKaa762itvJkTAWCCLU= +github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= 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/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= -github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/strfmt v0.20.1 h1:1VgxvehFne1mbChGeCmZ5pc0LxUf6yaACVSIYAR91Xc= -github.com/go-openapi/strfmt v0.20.1/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= -github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= -github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= -github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= -github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= -github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= -github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= -github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= -github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= -github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= -github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= -github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= -github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= -github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= -github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= -github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/go-openapi/errors v0.20.2 h1:dxy7PGTqEh94zj2E3h1cUmQQWiM1+aeCROfAr02EmK8= +github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= +github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +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-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM= -github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ= +github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= -github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= -github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 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.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= -github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +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/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= -github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ= +github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.10.3 h1:gph6h/qe9GSUw1NhH1gp+qb+h8rXD8Cy60Z32Qw3ELA= -github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.18.0 h1:ngbYoRctxjl8SiF7XgP0NxBFbfHcg3wfHMMaFHWwMTM= +github.com/onsi/gomega v1.18.0/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -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 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/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 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -go.mongodb.org/mongo-driver v1.5.1 h1:9nOVLGDfOaZ9R0tBumx/BcuqkbFpyTCU2r/Po7A2azI= -go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg= +go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0 h1:wBouT66WTYFXdxfVdz9sVWARVd/2vfGcmI45D2gj45M= -golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/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-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 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 h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= @@ -200,9 +169,10 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/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-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/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= diff --git a/schematicsv1/schematics_v1.go b/schematicsv1/schematics_v1.go index 2ecb1a2..826838f 100644 --- a/schematicsv1/schematics_v1.go +++ b/schematicsv1/schematics_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.46.1-a5569134-20220316-164819 + * IBM OpenAPI SDK Code Generator Version: 3.49.0-be9b22fb-20220504-154308 */ // Package schematicsv1 : Operations and models for the SchematicsV1 service @@ -530,6 +530,9 @@ func (schematics *SchematicsV1) ListWorkspacesWithContext(ctx context.Context, l if listWorkspacesOptions.Limit != nil { builder.AddQuery("limit", fmt.Sprint(*listWorkspacesOptions.Limit)) } + if listWorkspacesOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*listWorkspacesOptions.Profile)) + } request, err := builder.Build() if err != nil { @@ -669,6 +672,9 @@ func (schematics *SchematicsV1) CreateWorkspaceWithContext(ctx context.Context, if createWorkspaceOptions.WorkspaceStatus != nil { body["workspace_status"] = createWorkspaceOptions.WorkspaceStatus } + if createWorkspaceOptions.AgentID != nil { + body["agent_id"] = createWorkspaceOptions.AgentID + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -849,6 +855,9 @@ func (schematics *SchematicsV1) ReplaceWorkspaceWithContext(ctx context.Context, if replaceWorkspaceOptions.WorkspaceStatusMsg != nil { body["workspace_status_msg"] = replaceWorkspaceOptions.WorkspaceStatusMsg } + if replaceWorkspaceOptions.AgentID != nil { + body["agent_id"] = replaceWorkspaceOptions.AgentID + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -1037,6 +1046,9 @@ func (schematics *SchematicsV1) UpdateWorkspaceWithContext(ctx context.Context, if updateWorkspaceOptions.WorkspaceStatusMsg != nil { body["workspace_status_msg"] = updateWorkspaceOptions.WorkspaceStatusMsg } + if updateWorkspaceOptions.AgentID != nil { + body["agent_id"] = updateWorkspaceOptions.AgentID + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -1593,6 +1605,7 @@ func (schematics *SchematicsV1) GetWorkspaceResourcesWithContext(ctx context.Con } // GetWorkspaceState : Get Terraform statefile URL +// This API is deprecated, and is replaced by the `GET /v2/jobs/{job_id}/files`, with `file_type` equal `state_file`. // Retrieve the URL to the Terraform statefile (`terraform.tfstate`). You use the URL to access the Terraform statefile. // The Terraform statefile includes detailed information about the IBM Cloud resources that you provisioned with IBM // Cloud Schematics and Schematics uses the file to determine future create, modify, or delete actions for your @@ -1664,6 +1677,7 @@ func (schematics *SchematicsV1) GetWorkspaceStateWithContext(ctx context.Context } // GetWorkspaceTemplateState : Show Terraform statefile content +// This API is deprecated, and is replaced by the `GET /v2/jobs/{job_id}/files`, with `file_type` equal `state_file`. // Show the content of the Terraform statefile (`terraform.tfstate`) that was created when your Terraform template was // applied in IBM Cloud. The statefile holds detailed information about the IBM Cloud resources that were created by IBM // Cloud Schematics and Schematics uses the file to determine future create, modify, or delete actions for your @@ -1857,7 +1871,7 @@ func (schematics *SchematicsV1) GetWorkspaceLogUrlsWithContext(ctx context.Conte return } -// GetTemplateLogs : Show logs for the latest action for a workspace template +// GetTemplateLogs : Show latest logs for a workspace template // Show the Terraform logs for the most recent job of a template that ran against your workspace. // //

Authorization

@@ -2589,7 +2603,7 @@ func (schematics *SchematicsV1) UploadTemplateTarActionWithContext(ctx context.C return } -// ListWorkspaceActivities : List all workspace jobs +// ListWorkspaceActivities : List workspace jobs // Retrieve a list of all jobs that ran against a workspace. Jobs are generated when you use the `apply`, `plan`, // `destroy`, and `refresh`, command API. func (schematics *SchematicsV1) ListWorkspaceActivities(listWorkspaceActivitiesOptions *ListWorkspaceActivitiesOptions) (result *WorkspaceActivities, response *core.DetailedResponse, err error) { @@ -3306,6 +3320,9 @@ func (schematics *SchematicsV1) ListJobsWithContext(ctx context.Context, listJob if listJobsOptions.ActionID != nil { builder.AddQuery("action_id", fmt.Sprint(*listJobsOptions.ActionID)) } + if listJobsOptions.WorkspaceID != nil { + builder.AddQuery("workspace_id", fmt.Sprint(*listJobsOptions.WorkspaceID)) + } if listJobsOptions.List != nil { builder.AddQuery("list", fmt.Sprint(*listJobsOptions.List)) } @@ -3967,25 +3984,21 @@ func (schematics *SchematicsV1) GetWorkspaceDeletionJobStatusWithContext(ctx con return } -// ListInventories : List all inventory definitions -// Retrieve a list of all Schematics inventories that depends on the API endpoint that you have access. For example, if -// you use an API endpoint for a geography, such as North America, only inventories that are created in `us-south` or -// `us-east` are retrieved. For more information, about supported API endpoints, see -// [APIendpoints](/apidocs/schematics#api-endpoints). +// ListBlueprint : Get all the blueprint instances, in the Account +// Get all the blueprint instances, in the Account, associated with a Service // -//

Authorization

+//

Authorization

// -// Schematics support generic authorization for its resources. -// For more information, about Schematics access and permissions, see -// [Schematics service access roles and required -// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) ListInventories(listInventoriesOptions *ListInventoriesOptions) (result *InventoryResourceRecordList, response *core.DetailedResponse, err error) { - return schematics.ListInventoriesWithContext(context.Background(), listInventoriesOptions) +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) ListBlueprint(listBlueprintOptions *ListBlueprintOptions) (result *BlueprintList, response *core.DetailedResponse, err error) { + return schematics.ListBlueprintWithContext(context.Background(), listBlueprintOptions) } -// ListInventoriesWithContext is an alternate form of the ListInventories method which supports a Context parameter -func (schematics *SchematicsV1) ListInventoriesWithContext(ctx context.Context, listInventoriesOptions *ListInventoriesOptions) (result *InventoryResourceRecordList, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInventoriesOptions, "listInventoriesOptions") +// ListBlueprintWithContext is an alternate form of the ListBlueprint method which supports a Context parameter +func (schematics *SchematicsV1) ListBlueprintWithContext(ctx context.Context, listBlueprintOptions *ListBlueprintOptions) (result *BlueprintList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBlueprintOptions, "listBlueprintOptions") if err != nil { return } @@ -3993,32 +4006,26 @@ func (schematics *SchematicsV1) ListInventoriesWithContext(ctx context.Context, builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/blueprints`, nil) if err != nil { return } - for headerName, headerValue := range listInventoriesOptions.Headers { + for headerName, headerValue := range listBlueprintOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListInventories") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListBlueprint") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listInventoriesOptions.Offset != nil { - builder.AddQuery("offset", fmt.Sprint(*listInventoriesOptions.Offset)) - } - if listInventoriesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInventoriesOptions.Limit)) - } - if listInventoriesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listInventoriesOptions.Sort)) + if listBlueprintOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*listBlueprintOptions.Offset)) } - if listInventoriesOptions.Profile != nil { - builder.AddQuery("profile", fmt.Sprint(*listInventoriesOptions.Profile)) + if listBlueprintOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBlueprintOptions.Limit)) } request, err := builder.Build() @@ -4032,7 +4039,7 @@ func (schematics *SchematicsV1) ListInventoriesWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInventoryResourceRecordList) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBlueprintList) if err != nil { return } @@ -4042,33 +4049,25 @@ func (schematics *SchematicsV1) ListInventoriesWithContext(ctx context.Context, return } -// CreateInventory : Create an inventory definition -// Create an IBM Cloud Schematics inventory as a single IBM Cloud resource where you want to run Ansible playbook by -// using Schematics actions. For more information, about inventory host groups, refer to [creating static and dynamic -// inventory for Schematics actions](https://cloud.ibm.com/docs/schematics?topic=schematics-inventories-setup). -// -// **Note** you cannot update the location and region, resource group once an action is created. Also, make sure your -// IP addresses are in the [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). -// If your Git repository already contains a host file. Schematics does not overwrite the host file already present in -// your Git repository. +// CreateBlueprint : Create a new blueprint +// Create a new blueprint // -//

Authorization

+//

Authorization

// -// Schematics support generic authorization for its resources. -// For more information, about Schematics access and permissions, see -// [Schematics service access roles and required -// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) CreateInventory(createInventoryOptions *CreateInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { - return schematics.CreateInventoryWithContext(context.Background(), createInventoryOptions) +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) CreateBlueprint(createBlueprintOptions *CreateBlueprintOptions) (result *Blueprint, response *core.DetailedResponse, err error) { + return schematics.CreateBlueprintWithContext(context.Background(), createBlueprintOptions) } -// CreateInventoryWithContext is an alternate form of the CreateInventory method which supports a Context parameter -func (schematics *SchematicsV1) CreateInventoryWithContext(ctx context.Context, createInventoryOptions *CreateInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInventoryOptions, "createInventoryOptions cannot be nil") +// CreateBlueprintWithContext is an alternate form of the CreateBlueprint method which supports a Context parameter +func (schematics *SchematicsV1) CreateBlueprintWithContext(ctx context.Context, createBlueprintOptions *CreateBlueprintOptions) (result *Blueprint, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBlueprintOptions, "createBlueprintOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createInventoryOptions, "createInventoryOptions") + err = core.ValidateStruct(createBlueprintOptions, "createBlueprintOptions") if err != nil { return } @@ -4076,16 +4075,16 @@ func (schematics *SchematicsV1) CreateInventoryWithContext(ctx context.Context, builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/blueprints`, nil) if err != nil { return } - for headerName, headerValue := range createInventoryOptions.Headers { + for headerName, headerValue := range createBlueprintOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateInventory") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateBlueprint") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4093,23 +4092,47 @@ func (schematics *SchematicsV1) CreateInventoryWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") body := make(map[string]interface{}) - if createInventoryOptions.Name != nil { - body["name"] = createInventoryOptions.Name + if createBlueprintOptions.Name != nil { + body["name"] = createBlueprintOptions.Name } - if createInventoryOptions.Description != nil { - body["description"] = createInventoryOptions.Description + if createBlueprintOptions.SchemaVersion != nil { + body["schema_version"] = createBlueprintOptions.SchemaVersion } - if createInventoryOptions.Location != nil { - body["location"] = createInventoryOptions.Location + if createBlueprintOptions.Source != nil { + body["source"] = createBlueprintOptions.Source } - if createInventoryOptions.ResourceGroup != nil { - body["resource_group"] = createInventoryOptions.ResourceGroup + if createBlueprintOptions.Config != nil { + body["config"] = createBlueprintOptions.Config } - if createInventoryOptions.InventoriesIni != nil { - body["inventories_ini"] = createInventoryOptions.InventoriesIni + if createBlueprintOptions.Description != nil { + body["description"] = createBlueprintOptions.Description } - if createInventoryOptions.ResourceQueries != nil { - body["resource_queries"] = createInventoryOptions.ResourceQueries + if createBlueprintOptions.ResourceGroup != nil { + body["resource_group"] = createBlueprintOptions.ResourceGroup + } + if createBlueprintOptions.Tags != nil { + body["tags"] = createBlueprintOptions.Tags + } + if createBlueprintOptions.Location != nil { + body["location"] = createBlueprintOptions.Location + } + if createBlueprintOptions.Inputs != nil { + body["inputs"] = createBlueprintOptions.Inputs + } + if createBlueprintOptions.Settings != nil { + body["settings"] = createBlueprintOptions.Settings + } + if createBlueprintOptions.Flow != nil { + body["flow"] = createBlueprintOptions.Flow + } + if createBlueprintOptions.SysLock != nil { + body["sys_lock"] = createBlueprintOptions.SysLock + } + if createBlueprintOptions.UserState != nil { + body["user_state"] = createBlueprintOptions.UserState + } + if createBlueprintOptions.State != nil { + body["state"] = createBlueprintOptions.State } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -4127,7 +4150,7 @@ func (schematics *SchematicsV1) CreateInventoryWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInventoryResourceRecord) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBlueprint) if err != nil { return } @@ -4137,60 +4160,53 @@ func (schematics *SchematicsV1) CreateInventoryWithContext(ctx context.Context, return } -// GetInventory : Get the inventory definition -// Use this API to retrieve the detailed information for a resource inventory definition used to target an action in -// your IBM Cloud account. For more information, about inventory get, refer to [ibmcloud schematics inventory -// get](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-get-inv). -// -// **Note** you can fetch only the location and region, resource group from where your inventory is created. -// Also, make sure your IP addresses are in the -// [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). +// GetBlueprint : Get the blueprint details +// Get the blueprint details // -//

Authorization

+//

Authorization

// -// Schematics support generic authorization for its resources. -// For more information, about Schematics access and permissions, see -// [Schematics service access roles and required -// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) GetInventory(getInventoryOptions *GetInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { - return schematics.GetInventoryWithContext(context.Background(), getInventoryOptions) +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) GetBlueprint(getBlueprintOptions *GetBlueprintOptions) (result *Blueprint, response *core.DetailedResponse, err error) { + return schematics.GetBlueprintWithContext(context.Background(), getBlueprintOptions) } -// GetInventoryWithContext is an alternate form of the GetInventory method which supports a Context parameter -func (schematics *SchematicsV1) GetInventoryWithContext(ctx context.Context, getInventoryOptions *GetInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInventoryOptions, "getInventoryOptions cannot be nil") +// GetBlueprintWithContext is an alternate form of the GetBlueprint method which supports a Context parameter +func (schematics *SchematicsV1) GetBlueprintWithContext(ctx context.Context, getBlueprintOptions *GetBlueprintOptions) (result *Blueprint, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBlueprintOptions, "getBlueprintOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getInventoryOptions, "getInventoryOptions") + err = core.ValidateStruct(getBlueprintOptions, "getBlueprintOptions") if err != nil { return } pathParamsMap := map[string]string{ - "inventory_id": *getInventoryOptions.InventoryID, + "blueprint_id": *getBlueprintOptions.BlueprintID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories/{inventory_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/blueprints/{blueprint_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getInventoryOptions.Headers { + for headerName, headerValue := range getBlueprintOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetInventory") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetBlueprint") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getInventoryOptions.Profile != nil { - builder.AddQuery("profile", fmt.Sprint(*getInventoryOptions.Profile)) + if getBlueprintOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*getBlueprintOptions.Profile)) } request, err := builder.Build() @@ -4204,7 +4220,7 @@ func (schematics *SchematicsV1) GetInventoryWithContext(ctx context.Context, get return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInventoryResourceRecord) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBlueprint) if err != nil { return } @@ -4214,77 +4230,98 @@ func (schematics *SchematicsV1) GetInventoryWithContext(ctx context.Context, get return } -// ReplaceInventory : Update an inventory definition -// Use this API to update the inventory definition resource used to target an action. For more information, about -// inventory update, refer to [ibmcloud schematics inventory -// update](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-update-inv). +// ReplaceBlueprint : Replace the blueprint details +// Replace the blueprint details // -// **Note** you cannot update the location and region, resource group once an action is created. -// Also, make sure your IP addresses are in the -// [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). -// -//

Authorization

+//

Authorization

// -// Schematics support generic authorization for its resources. -// For more information, about Schematics access and permissions, see -// [Schematics service access roles and required -// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) ReplaceInventory(replaceInventoryOptions *ReplaceInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { - return schematics.ReplaceInventoryWithContext(context.Background(), replaceInventoryOptions) +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) ReplaceBlueprint(replaceBlueprintOptions *ReplaceBlueprintOptions) (result *Blueprint, response *core.DetailedResponse, err error) { + return schematics.ReplaceBlueprintWithContext(context.Background(), replaceBlueprintOptions) } -// ReplaceInventoryWithContext is an alternate form of the ReplaceInventory method which supports a Context parameter -func (schematics *SchematicsV1) ReplaceInventoryWithContext(ctx context.Context, replaceInventoryOptions *ReplaceInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceInventoryOptions, "replaceInventoryOptions cannot be nil") +// ReplaceBlueprintWithContext is an alternate form of the ReplaceBlueprint method which supports a Context parameter +func (schematics *SchematicsV1) ReplaceBlueprintWithContext(ctx context.Context, replaceBlueprintOptions *ReplaceBlueprintOptions) (result *Blueprint, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceBlueprintOptions, "replaceBlueprintOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceInventoryOptions, "replaceInventoryOptions") + err = core.ValidateStruct(replaceBlueprintOptions, "replaceBlueprintOptions") if err != nil { return } pathParamsMap := map[string]string{ - "inventory_id": *replaceInventoryOptions.InventoryID, + "blueprint_id": *replaceBlueprintOptions.BlueprintID, } builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories/{inventory_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/blueprints/{blueprint_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceInventoryOptions.Headers { + for headerName, headerValue := range replaceBlueprintOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ReplaceInventory") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ReplaceBlueprint") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") + if replaceBlueprintOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*replaceBlueprintOptions.Profile)) + } + body := make(map[string]interface{}) - if replaceInventoryOptions.Name != nil { - body["name"] = replaceInventoryOptions.Name + if replaceBlueprintOptions.Name != nil { + body["name"] = replaceBlueprintOptions.Name } - if replaceInventoryOptions.Description != nil { - body["description"] = replaceInventoryOptions.Description + if replaceBlueprintOptions.SchemaVersion != nil { + body["schema_version"] = replaceBlueprintOptions.SchemaVersion } - if replaceInventoryOptions.Location != nil { - body["location"] = replaceInventoryOptions.Location + if replaceBlueprintOptions.Source != nil { + body["source"] = replaceBlueprintOptions.Source } - if replaceInventoryOptions.ResourceGroup != nil { - body["resource_group"] = replaceInventoryOptions.ResourceGroup + if replaceBlueprintOptions.Config != nil { + body["config"] = replaceBlueprintOptions.Config } - if replaceInventoryOptions.InventoriesIni != nil { - body["inventories_ini"] = replaceInventoryOptions.InventoriesIni + if replaceBlueprintOptions.Description != nil { + body["description"] = replaceBlueprintOptions.Description } - if replaceInventoryOptions.ResourceQueries != nil { - body["resource_queries"] = replaceInventoryOptions.ResourceQueries + if replaceBlueprintOptions.ResourceGroup != nil { + body["resource_group"] = replaceBlueprintOptions.ResourceGroup + } + if replaceBlueprintOptions.Tags != nil { + body["tags"] = replaceBlueprintOptions.Tags + } + if replaceBlueprintOptions.Location != nil { + body["location"] = replaceBlueprintOptions.Location + } + if replaceBlueprintOptions.Inputs != nil { + body["inputs"] = replaceBlueprintOptions.Inputs + } + if replaceBlueprintOptions.Settings != nil { + body["settings"] = replaceBlueprintOptions.Settings + } + if replaceBlueprintOptions.Flow != nil { + body["flow"] = replaceBlueprintOptions.Flow + } + if replaceBlueprintOptions.SysLock != nil { + body["sys_lock"] = replaceBlueprintOptions.SysLock + } + if replaceBlueprintOptions.UserState != nil { + body["user_state"] = replaceBlueprintOptions.UserState + } + if replaceBlueprintOptions.State != nil { + body["state"] = replaceBlueprintOptions.State } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -4302,7 +4339,7 @@ func (schematics *SchematicsV1) ReplaceInventoryWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInventoryResourceRecord) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBlueprint) if err != nil { return } @@ -4312,61 +4349,56 @@ func (schematics *SchematicsV1) ReplaceInventoryWithContext(ctx context.Context, return } -// DeleteInventory : Delete inventory definition -// Use this API to delete the resource inventory definition by using the inventory ID that you want to run against. For -// more information, about inventory delete, refer to [ibmcloud schematics inventory -// delete](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-delete-inventory). -// -// **Note** you cannot delete the location and region, resource group from where your inventory is created. Also, make -// sure your IP addresses are in the -// [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). +// DeleteBlueprint : Delete the blueprint +// Delete the blueprint // -//

Authorization

+//

Authorization

// -// Schematics support generic authorization for its resources. -// For more information, about Schematics access and permissions, see -// [Schematics service access roles and required -// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) DeleteInventory(deleteInventoryOptions *DeleteInventoryOptions) (response *core.DetailedResponse, err error) { - return schematics.DeleteInventoryWithContext(context.Background(), deleteInventoryOptions) +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) DeleteBlueprint(deleteBlueprintOptions *DeleteBlueprintOptions) (response *core.DetailedResponse, err error) { + return schematics.DeleteBlueprintWithContext(context.Background(), deleteBlueprintOptions) } -// DeleteInventoryWithContext is an alternate form of the DeleteInventory method which supports a Context parameter -func (schematics *SchematicsV1) DeleteInventoryWithContext(ctx context.Context, deleteInventoryOptions *DeleteInventoryOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInventoryOptions, "deleteInventoryOptions cannot be nil") +// DeleteBlueprintWithContext is an alternate form of the DeleteBlueprint method which supports a Context parameter +func (schematics *SchematicsV1) DeleteBlueprintWithContext(ctx context.Context, deleteBlueprintOptions *DeleteBlueprintOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBlueprintOptions, "deleteBlueprintOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteInventoryOptions, "deleteInventoryOptions") + err = core.ValidateStruct(deleteBlueprintOptions, "deleteBlueprintOptions") if err != nil { return } pathParamsMap := map[string]string{ - "inventory_id": *deleteInventoryOptions.InventoryID, + "blueprint_id": *deleteBlueprintOptions.BlueprintID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories/{inventory_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/blueprints/{blueprint_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteInventoryOptions.Headers { + for headerName, headerValue := range deleteBlueprintOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeleteInventory") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeleteBlueprint") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteInventoryOptions.Force != nil { - builder.AddHeader("force", fmt.Sprint(*deleteInventoryOptions.Force)) + builder.AddHeader("Accept", "application/json") + + if deleteBlueprintOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*deleteBlueprintOptions.Profile)) } - if deleteInventoryOptions.Propagate != nil { - builder.AddHeader("propagate", fmt.Sprint(*deleteInventoryOptions.Propagate)) + if deleteBlueprintOptions.Destroy != nil { + builder.AddQuery("destroy", fmt.Sprint(*deleteBlueprintOptions.Destroy)) } request, err := builder.Build() @@ -4379,24 +4411,25 @@ func (schematics *SchematicsV1) DeleteInventoryWithContext(ctx context.Context, return } -// ListResourceQuery : List resource queries -// Retrieve the list of resource query definitions that you have access to. The list of resource queries that is -// returned depends on the API endpoint that you use. For example, if you use an API endpoint for a geography, such as -// North America, only resource query definitions that are created in `us-south` or `us-east` are retrieved. For more -// information, about supported API endpoints, see [API endpoints](/apidocs/schematics#api-endpoints). -//

Authorization

+// ListInventories : List inventory definitions +// Retrieve a list of all Schematics inventories that depends on the API endpoint that you have access. For example, if +// you use an API endpoint for a geography, such as North America, only inventories that are created in `us-south` or +// `us-east` are retrieved. For more information, about supported API endpoints, see +// [APIendpoints](/apidocs/schematics#api-endpoints). +// +//

Authorization

// // Schematics support generic authorization for its resources. // For more information, about Schematics access and permissions, see // [Schematics service access roles and required // permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) ListResourceQuery(listResourceQueryOptions *ListResourceQueryOptions) (result *ResourceQueryRecordList, response *core.DetailedResponse, err error) { - return schematics.ListResourceQueryWithContext(context.Background(), listResourceQueryOptions) +func (schematics *SchematicsV1) ListInventories(listInventoriesOptions *ListInventoriesOptions) (result *InventoryResourceRecordList, response *core.DetailedResponse, err error) { + return schematics.ListInventoriesWithContext(context.Background(), listInventoriesOptions) } -// ListResourceQueryWithContext is an alternate form of the ListResourceQuery method which supports a Context parameter -func (schematics *SchematicsV1) ListResourceQueryWithContext(ctx context.Context, listResourceQueryOptions *ListResourceQueryOptions) (result *ResourceQueryRecordList, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listResourceQueryOptions, "listResourceQueryOptions") +// ListInventoriesWithContext is an alternate form of the ListInventories method which supports a Context parameter +func (schematics *SchematicsV1) ListInventoriesWithContext(ctx context.Context, listInventoriesOptions *ListInventoriesOptions) (result *InventoryResourceRecordList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInventoriesOptions, "listInventoriesOptions") if err != nil { return } @@ -4404,32 +4437,32 @@ func (schematics *SchematicsV1) ListResourceQueryWithContext(ctx context.Context builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories`, nil) if err != nil { return } - for headerName, headerValue := range listResourceQueryOptions.Headers { + for headerName, headerValue := range listInventoriesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListResourceQuery") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListInventories") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listResourceQueryOptions.Offset != nil { - builder.AddQuery("offset", fmt.Sprint(*listResourceQueryOptions.Offset)) + if listInventoriesOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*listInventoriesOptions.Offset)) } - if listResourceQueryOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listResourceQueryOptions.Limit)) + if listInventoriesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInventoriesOptions.Limit)) } - if listResourceQueryOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listResourceQueryOptions.Sort)) + if listInventoriesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listInventoriesOptions.Sort)) } - if listResourceQueryOptions.Profile != nil { - builder.AddQuery("profile", fmt.Sprint(*listResourceQueryOptions.Profile)) + if listInventoriesOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*listInventoriesOptions.Profile)) } request, err := builder.Build() @@ -4443,7 +4476,7 @@ func (schematics *SchematicsV1) ListResourceQueryWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryRecordList) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInventoryResourceRecordList) if err != nil { return } @@ -4453,32 +4486,33 @@ func (schematics *SchematicsV1) ListResourceQueryWithContext(ctx context.Context return } -// CreateResourceQuery : Create resource query -// Use this API to create a resource query definition that will be used to select an IBM Cloud resource or a group of -// resources as the dynamic inventory for the Schematics Actions. For more information, about resource query commands, -// refer to [ibmcloud schematics resource query -// create](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-create-rq). -// **Note** you cannot update the location and region, resource group once an action is created. Also, make sure your -// IP addresses are in the [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). If -// your Git repository already contains a host file. Schematics does not overwrite the host file already present in +// CreateInventory : Create an inventory definition +// Create an IBM Cloud Schematics inventory as a single IBM Cloud resource where you want to run Ansible playbook by +// using Schematics actions. For more information, about inventory host groups, refer to [creating static and dynamic +// inventory for Schematics actions](https://cloud.ibm.com/docs/schematics?topic=schematics-inventories-setup). +// +// **Note** you cannot update the location and region, resource group once an action is created. Also, make sure your +// IP addresses are in the [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). +// If your Git repository already contains a host file. Schematics does not overwrite the host file already present in // your Git repository. -//

Authorization

+// +//

Authorization

// // Schematics support generic authorization for its resources. // For more information, about Schematics access and permissions, see // [Schematics service access roles and required // permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) CreateResourceQuery(createResourceQueryOptions *CreateResourceQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { - return schematics.CreateResourceQueryWithContext(context.Background(), createResourceQueryOptions) +func (schematics *SchematicsV1) CreateInventory(createInventoryOptions *CreateInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { + return schematics.CreateInventoryWithContext(context.Background(), createInventoryOptions) } -// CreateResourceQueryWithContext is an alternate form of the CreateResourceQuery method which supports a Context parameter -func (schematics *SchematicsV1) CreateResourceQueryWithContext(ctx context.Context, createResourceQueryOptions *CreateResourceQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createResourceQueryOptions, "createResourceQueryOptions cannot be nil") +// CreateInventoryWithContext is an alternate form of the CreateInventory method which supports a Context parameter +func (schematics *SchematicsV1) CreateInventoryWithContext(ctx context.Context, createInventoryOptions *CreateInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInventoryOptions, "createInventoryOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createResourceQueryOptions, "createResourceQueryOptions") + err = core.ValidateStruct(createInventoryOptions, "createInventoryOptions") if err != nil { return } @@ -4486,16 +4520,16 @@ func (schematics *SchematicsV1) CreateResourceQueryWithContext(ctx context.Conte builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories`, nil) if err != nil { return } - for headerName, headerValue := range createResourceQueryOptions.Headers { + for headerName, headerValue := range createInventoryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateResourceQuery") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateInventory") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4503,14 +4537,23 @@ func (schematics *SchematicsV1) CreateResourceQueryWithContext(ctx context.Conte builder.AddHeader("Content-Type", "application/json") body := make(map[string]interface{}) - if createResourceQueryOptions.Type != nil { - body["type"] = createResourceQueryOptions.Type + if createInventoryOptions.Name != nil { + body["name"] = createInventoryOptions.Name } - if createResourceQueryOptions.Name != nil { - body["name"] = createResourceQueryOptions.Name + if createInventoryOptions.Description != nil { + body["description"] = createInventoryOptions.Description } - if createResourceQueryOptions.Queries != nil { - body["queries"] = createResourceQueryOptions.Queries + if createInventoryOptions.Location != nil { + body["location"] = createInventoryOptions.Location + } + if createInventoryOptions.ResourceGroup != nil { + body["resource_group"] = createInventoryOptions.ResourceGroup + } + if createInventoryOptions.InventoriesIni != nil { + body["inventories_ini"] = createInventoryOptions.InventoriesIni + } + if createInventoryOptions.ResourceQueries != nil { + body["resource_queries"] = createInventoryOptions.ResourceQueries } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -4528,7 +4571,7 @@ func (schematics *SchematicsV1) CreateResourceQueryWithContext(ctx context.Conte return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryRecord) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInventoryResourceRecord) if err != nil { return } @@ -4538,53 +4581,62 @@ func (schematics *SchematicsV1) CreateResourceQueryWithContext(ctx context.Conte return } -// GetResourcesQuery : Get resources query -// Use this API to retrieve the information resource query by Id. For more information, about resource query commands, -// refer to [ibmcloud schematics resource query -// get](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-get-rq). -//

Authorization

+// GetInventory : Get an inventory definition +// Use this API to retrieve the detailed information for a resource inventory definition used to target an action in +// your IBM Cloud account. For more information, about inventory get, refer to [ibmcloud schematics inventory +// get](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-get-inv). +// +// **Note** you can fetch only the location and region, resource group from where your inventory is created. +// Also, make sure your IP addresses are in the +// [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). +// +//

Authorization

// // Schematics support generic authorization for its resources. // For more information, about Schematics access and permissions, see // [Schematics service access roles and required // permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) GetResourcesQuery(getResourcesQueryOptions *GetResourcesQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { - return schematics.GetResourcesQueryWithContext(context.Background(), getResourcesQueryOptions) +func (schematics *SchematicsV1) GetInventory(getInventoryOptions *GetInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { + return schematics.GetInventoryWithContext(context.Background(), getInventoryOptions) } -// GetResourcesQueryWithContext is an alternate form of the GetResourcesQuery method which supports a Context parameter -func (schematics *SchematicsV1) GetResourcesQueryWithContext(ctx context.Context, getResourcesQueryOptions *GetResourcesQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getResourcesQueryOptions, "getResourcesQueryOptions cannot be nil") +// GetInventoryWithContext is an alternate form of the GetInventory method which supports a Context parameter +func (schematics *SchematicsV1) GetInventoryWithContext(ctx context.Context, getInventoryOptions *GetInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInventoryOptions, "getInventoryOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getResourcesQueryOptions, "getResourcesQueryOptions") + err = core.ValidateStruct(getInventoryOptions, "getInventoryOptions") if err != nil { return } pathParamsMap := map[string]string{ - "query_id": *getResourcesQueryOptions.QueryID, + "inventory_id": *getInventoryOptions.InventoryID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories/{inventory_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getResourcesQueryOptions.Headers { + for headerName, headerValue := range getInventoryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetResourcesQuery") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetInventory") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if getInventoryOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*getInventoryOptions.Profile)) + } + request, err := builder.Build() if err != nil { return @@ -4596,7 +4648,7 @@ func (schematics *SchematicsV1) GetResourcesQueryWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryRecord) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInventoryResourceRecord) if err != nil { return } @@ -4606,51 +4658,53 @@ func (schematics *SchematicsV1) GetResourcesQueryWithContext(ctx context.Context return } -// ReplaceResourcesQuery : Replace resources query definition -// Use this API to replace the resource query definition used to build the dynamic inventory for the Schematics Action. -// For more information, about resource query commands, refer to [ibmcloud schematics resource query -// update](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-update-rq). -// **Note** you cannot update the location and region, resource group once a resource query is created. Also, make sure -// your IP addresses are in the +// ReplaceInventory : Update an inventory definition +// Use this API to update the inventory definition resource used to target an action. For more information, about +// inventory update, refer to [ibmcloud schematics inventory +// update](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-update-inv). +// +// **Note** you cannot update the location and region, resource group once an action is created. +// Also, make sure your IP addresses are in the // [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). -//

Authorization

+// +//

Authorization

// // Schematics support generic authorization for its resources. // For more information, about Schematics access and permissions, see // [Schematics service access roles and required // permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) ReplaceResourcesQuery(replaceResourcesQueryOptions *ReplaceResourcesQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { - return schematics.ReplaceResourcesQueryWithContext(context.Background(), replaceResourcesQueryOptions) +func (schematics *SchematicsV1) ReplaceInventory(replaceInventoryOptions *ReplaceInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { + return schematics.ReplaceInventoryWithContext(context.Background(), replaceInventoryOptions) } -// ReplaceResourcesQueryWithContext is an alternate form of the ReplaceResourcesQuery method which supports a Context parameter -func (schematics *SchematicsV1) ReplaceResourcesQueryWithContext(ctx context.Context, replaceResourcesQueryOptions *ReplaceResourcesQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceResourcesQueryOptions, "replaceResourcesQueryOptions cannot be nil") +// ReplaceInventoryWithContext is an alternate form of the ReplaceInventory method which supports a Context parameter +func (schematics *SchematicsV1) ReplaceInventoryWithContext(ctx context.Context, replaceInventoryOptions *ReplaceInventoryOptions) (result *InventoryResourceRecord, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceInventoryOptions, "replaceInventoryOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceResourcesQueryOptions, "replaceResourcesQueryOptions") + err = core.ValidateStruct(replaceInventoryOptions, "replaceInventoryOptions") if err != nil { return } pathParamsMap := map[string]string{ - "query_id": *replaceResourcesQueryOptions.QueryID, + "inventory_id": *replaceInventoryOptions.InventoryID, } builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories/{inventory_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceResourcesQueryOptions.Headers { + for headerName, headerValue := range replaceInventoryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ReplaceResourcesQuery") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ReplaceInventory") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4658,14 +4712,23 @@ func (schematics *SchematicsV1) ReplaceResourcesQueryWithContext(ctx context.Con builder.AddHeader("Content-Type", "application/json") body := make(map[string]interface{}) - if replaceResourcesQueryOptions.Type != nil { - body["type"] = replaceResourcesQueryOptions.Type + if replaceInventoryOptions.Name != nil { + body["name"] = replaceInventoryOptions.Name } - if replaceResourcesQueryOptions.Name != nil { - body["name"] = replaceResourcesQueryOptions.Name + if replaceInventoryOptions.Description != nil { + body["description"] = replaceInventoryOptions.Description } - if replaceResourcesQueryOptions.Queries != nil { - body["queries"] = replaceResourcesQueryOptions.Queries + if replaceInventoryOptions.Location != nil { + body["location"] = replaceInventoryOptions.Location + } + if replaceInventoryOptions.ResourceGroup != nil { + body["resource_group"] = replaceInventoryOptions.ResourceGroup + } + if replaceInventoryOptions.InventoriesIni != nil { + body["inventories_ini"] = replaceInventoryOptions.InventoriesIni + } + if replaceInventoryOptions.ResourceQueries != nil { + body["resource_queries"] = replaceInventoryOptions.ResourceQueries } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -4683,7 +4746,7 @@ func (schematics *SchematicsV1) ReplaceResourcesQueryWithContext(ctx context.Con return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryRecord) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInventoryResourceRecord) if err != nil { return } @@ -4693,117 +4756,124 @@ func (schematics *SchematicsV1) ReplaceResourcesQueryWithContext(ctx context.Con return } -// ExecuteResourceQuery : Run the resource query -// Run the resource query. -func (schematics *SchematicsV1) ExecuteResourceQuery(executeResourceQueryOptions *ExecuteResourceQueryOptions) (result *ResourceQueryResponseRecord, response *core.DetailedResponse, err error) { - return schematics.ExecuteResourceQueryWithContext(context.Background(), executeResourceQueryOptions) +// DeleteInventory : Delete an inventory definition +// Use this API to delete the resource inventory definition by using the inventory ID that you want to run against. For +// more information, about inventory delete, refer to [ibmcloud schematics inventory +// delete](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-delete-inventory). +// +// **Note** you cannot delete the location and region, resource group from where your inventory is created. Also, make +// sure your IP addresses are in the +// [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see +// [Schematics service access roles and required +// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) DeleteInventory(deleteInventoryOptions *DeleteInventoryOptions) (response *core.DetailedResponse, err error) { + return schematics.DeleteInventoryWithContext(context.Background(), deleteInventoryOptions) } -// ExecuteResourceQueryWithContext is an alternate form of the ExecuteResourceQuery method which supports a Context parameter -func (schematics *SchematicsV1) ExecuteResourceQueryWithContext(ctx context.Context, executeResourceQueryOptions *ExecuteResourceQueryOptions) (result *ResourceQueryResponseRecord, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(executeResourceQueryOptions, "executeResourceQueryOptions cannot be nil") +// DeleteInventoryWithContext is an alternate form of the DeleteInventory method which supports a Context parameter +func (schematics *SchematicsV1) DeleteInventoryWithContext(ctx context.Context, deleteInventoryOptions *DeleteInventoryOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInventoryOptions, "deleteInventoryOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(executeResourceQueryOptions, "executeResourceQueryOptions") + err = core.ValidateStruct(deleteInventoryOptions, "deleteInventoryOptions") if err != nil { return } pathParamsMap := map[string]string{ - "query_id": *executeResourceQueryOptions.QueryID, + "inventory_id": *deleteInventoryOptions.InventoryID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/inventories/{inventory_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range executeResourceQueryOptions.Headers { + for headerName, headerValue := range deleteInventoryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ExecuteResourceQuery") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeleteInventory") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteInventoryOptions.Force != nil { + builder.AddHeader("force", fmt.Sprint(*deleteInventoryOptions.Force)) + } + if deleteInventoryOptions.Propagate != nil { + builder.AddHeader("propagate", fmt.Sprint(*deleteInventoryOptions.Propagate)) + } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = schematics.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryResponseRecord) - if err != nil { - return - } - response.Result = result - } + response, err = schematics.Service.Request(request, nil) return } -// DeleteResourcesQuery : Delete resources query -// Use this API to delete the resource query definition by Id. For more information, about resource query commands, -// refer to [ibmcloud schematics resource query -// delete](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-delete-resource-query). -// +// ListResourceQuery : List resource queries +// Retrieve the list of resource query definitions that you have access to. The list of resource queries that is +// returned depends on the API endpoint that you use. For example, if you use an API endpoint for a geography, such as +// North America, only resource query definitions that are created in `us-south` or `us-east` are retrieved. For more +// information, about supported API endpoints, see [API endpoints](/apidocs/schematics#api-endpoints). //

Authorization

// // Schematics support generic authorization for its resources. // For more information, about Schematics access and permissions, see // [Schematics service access roles and required // permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) DeleteResourcesQuery(deleteResourcesQueryOptions *DeleteResourcesQueryOptions) (response *core.DetailedResponse, err error) { - return schematics.DeleteResourcesQueryWithContext(context.Background(), deleteResourcesQueryOptions) +func (schematics *SchematicsV1) ListResourceQuery(listResourceQueryOptions *ListResourceQueryOptions) (result *ResourceQueryRecordList, response *core.DetailedResponse, err error) { + return schematics.ListResourceQueryWithContext(context.Background(), listResourceQueryOptions) } -// DeleteResourcesQueryWithContext is an alternate form of the DeleteResourcesQuery method which supports a Context parameter -func (schematics *SchematicsV1) DeleteResourcesQueryWithContext(ctx context.Context, deleteResourcesQueryOptions *DeleteResourcesQueryOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteResourcesQueryOptions, "deleteResourcesQueryOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteResourcesQueryOptions, "deleteResourcesQueryOptions") +// ListResourceQueryWithContext is an alternate form of the ListResourceQuery method which supports a Context parameter +func (schematics *SchematicsV1) ListResourceQueryWithContext(ctx context.Context, listResourceQueryOptions *ListResourceQueryOptions) (result *ResourceQueryRecordList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listResourceQueryOptions, "listResourceQueryOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "query_id": *deleteResourcesQueryOptions.QueryID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query`, nil) if err != nil { return } - for headerName, headerValue := range deleteResourcesQueryOptions.Headers { + for headerName, headerValue := range listResourceQueryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeleteResourcesQuery") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListResourceQuery") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteResourcesQueryOptions.Force != nil { - builder.AddHeader("force", fmt.Sprint(*deleteResourcesQueryOptions.Force)) + builder.AddHeader("Accept", "application/json") + + if listResourceQueryOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*listResourceQueryOptions.Offset)) } - if deleteResourcesQueryOptions.Propagate != nil { - builder.AddHeader("propagate", fmt.Sprint(*deleteResourcesQueryOptions.Propagate)) + if listResourceQueryOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listResourceQueryOptions.Limit)) + } + if listResourceQueryOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listResourceQueryOptions.Sort)) + } + if listResourceQueryOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*listResourceQueryOptions.Profile)) } request, err := builder.Build() @@ -4811,55 +4881,85 @@ func (schematics *SchematicsV1) DeleteResourcesQueryWithContext(ctx context.Cont return } - response, err = schematics.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryRecordList) + if err != nil { + return + } + response.Result = result + } return } -// GetKmsSettings : Get KMS settings -// Retrieve the kms instance that is integrated with Schematics for the **byok** and **kyok**. For each geographic -// location supported in Schematics we can have different kms settings. For example `US` and `EU` will have different -// kms settings. +// CreateResourceQuery : Create resource query +// Use this API to create a resource query definition that will be used to select an IBM Cloud resource or a group of +// resources as the dynamic inventory for the Schematics Actions. For more information, about resource query commands, +// refer to [ibmcloud schematics resource query +// create](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-create-rq). +// **Note** you cannot update the location and region, resource group once an action is created. Also, make sure your +// IP addresses are in the [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). If +// your Git repository already contains a host file. Schematics does not overwrite the host file already present in +// your Git repository. //

Authorization

// // Schematics support generic authorization for its resources. // For more information, about Schematics access and permissions, see // [Schematics service access roles and required // permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) GetKmsSettings(getKmsSettingsOptions *GetKmsSettingsOptions) (result *KMSSettings, response *core.DetailedResponse, err error) { - return schematics.GetKmsSettingsWithContext(context.Background(), getKmsSettingsOptions) +func (schematics *SchematicsV1) CreateResourceQuery(createResourceQueryOptions *CreateResourceQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { + return schematics.CreateResourceQueryWithContext(context.Background(), createResourceQueryOptions) } -// GetKmsSettingsWithContext is an alternate form of the GetKmsSettings method which supports a Context parameter -func (schematics *SchematicsV1) GetKmsSettingsWithContext(ctx context.Context, getKmsSettingsOptions *GetKmsSettingsOptions) (result *KMSSettings, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getKmsSettingsOptions, "getKmsSettingsOptions cannot be nil") +// CreateResourceQueryWithContext is an alternate form of the CreateResourceQuery method which supports a Context parameter +func (schematics *SchematicsV1) CreateResourceQueryWithContext(ctx context.Context, createResourceQueryOptions *CreateResourceQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createResourceQueryOptions, "createResourceQueryOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getKmsSettingsOptions, "getKmsSettingsOptions") + err = core.ValidateStruct(createResourceQueryOptions, "createResourceQueryOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/kms`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query`, nil) if err != nil { return } - for headerName, headerValue := range getKmsSettingsOptions.Headers { + for headerName, headerValue := range createResourceQueryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetKmsSettings") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateResourceQuery") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") - builder.AddQuery("location", fmt.Sprint(*getKmsSettingsOptions.Location)) + body := make(map[string]interface{}) + if createResourceQueryOptions.Type != nil { + body["type"] = createResourceQueryOptions.Type + } + if createResourceQueryOptions.Name != nil { + body["name"] = createResourceQueryOptions.Name + } + if createResourceQueryOptions.Queries != nil { + body["queries"] = createResourceQueryOptions.Queries + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } request, err := builder.Build() if err != nil { @@ -4872,7 +4972,7 @@ func (schematics *SchematicsV1) GetKmsSettingsWithContext(ctx context.Context, g return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKMSSettings) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryRecord) if err != nil { return } @@ -4882,70 +4982,52 @@ func (schematics *SchematicsV1) GetKmsSettingsWithContext(ctx context.Context, g return } -// UpdateKmsSettings : Update KMS settings -// Replace or Update kms settings for a given location can be updated. -// **Note** you can update the kms settings only once. For example, if you use an API endpoint for a geography, such as -// North America, only kms settings for that region can be retrieved. +// GetResourcesQuery : Get resources query +// Use this API to retrieve the information resource query by Id. For more information, about resource query commands, +// refer to [ibmcloud schematics resource query +// get](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-get-rq). //

Authorization

// // Schematics support generic authorization for its resources. // For more information, about Schematics access and permissions, see // [Schematics service access roles and required // permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) UpdateKmsSettings(updateKmsSettingsOptions *UpdateKmsSettingsOptions) (result *KMSSettings, response *core.DetailedResponse, err error) { - return schematics.UpdateKmsSettingsWithContext(context.Background(), updateKmsSettingsOptions) +func (schematics *SchematicsV1) GetResourcesQuery(getResourcesQueryOptions *GetResourcesQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { + return schematics.GetResourcesQueryWithContext(context.Background(), getResourcesQueryOptions) } -// UpdateKmsSettingsWithContext is an alternate form of the UpdateKmsSettings method which supports a Context parameter -func (schematics *SchematicsV1) UpdateKmsSettingsWithContext(ctx context.Context, updateKmsSettingsOptions *UpdateKmsSettingsOptions) (result *KMSSettings, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateKmsSettingsOptions, "updateKmsSettingsOptions cannot be nil") +// GetResourcesQueryWithContext is an alternate form of the GetResourcesQuery method which supports a Context parameter +func (schematics *SchematicsV1) GetResourcesQueryWithContext(ctx context.Context, getResourcesQueryOptions *GetResourcesQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getResourcesQueryOptions, "getResourcesQueryOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateKmsSettingsOptions, "updateKmsSettingsOptions") + err = core.ValidateStruct(getResourcesQueryOptions, "getResourcesQueryOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.PUT) + pathParamsMap := map[string]string{ + "query_id": *getResourcesQueryOptions.QueryID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/kms`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateKmsSettingsOptions.Headers { + for headerName, headerValue := range getResourcesQueryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "UpdateKmsSettings") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetResourcesQuery") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - body := make(map[string]interface{}) - if updateKmsSettingsOptions.Location != nil { - body["location"] = updateKmsSettingsOptions.Location - } - if updateKmsSettingsOptions.EncryptionScheme != nil { - body["encryption_scheme"] = updateKmsSettingsOptions.EncryptionScheme - } - if updateKmsSettingsOptions.ResourceGroup != nil { - body["resource_group"] = updateKmsSettingsOptions.ResourceGroup - } - if updateKmsSettingsOptions.PrimaryCrk != nil { - body["primary_crk"] = updateKmsSettingsOptions.PrimaryCrk - } - if updateKmsSettingsOptions.SecondaryCrk != nil { - body["secondary_crk"] = updateKmsSettingsOptions.SecondaryCrk - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } request, err := builder.Build() if err != nil { @@ -4958,7 +5040,7 @@ func (schematics *SchematicsV1) UpdateKmsSettingsWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKMSSettings) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryRecord) if err != nil { return } @@ -4968,59 +5050,70 @@ func (schematics *SchematicsV1) UpdateKmsSettingsWithContext(ctx context.Context return } -// ListKms : List KMS instances -// Lists the kms instances of your IBM Cloud account to find your Key Protect or Hyper Protect Crypto Services by using -// the location and encrypted scheme. -// -//

Authorization

+// ReplaceResourcesQuery : Update resources query definition +// Use this API to update the resource query definition used to build the dynamic inventory for the Schematics Action. +// For more information, about resource query commands, refer to [ibmcloud schematics resource query +// update](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-update-rq). +// **Note** you cannot update the location and region, resource group once a resource query is created. Also, make sure +// your IP addresses are in the +// [allowlist](https://cloud.ibm.com/docs/schematics?topic=schematics-allowed-ipaddresses). +//

Authorization

// // Schematics support generic authorization for its resources. // For more information, about Schematics access and permissions, see // [Schematics service access roles and required // permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). -func (schematics *SchematicsV1) ListKms(listKmsOptions *ListKmsOptions) (result *KMSDiscovery, response *core.DetailedResponse, err error) { - return schematics.ListKmsWithContext(context.Background(), listKmsOptions) +func (schematics *SchematicsV1) ReplaceResourcesQuery(replaceResourcesQueryOptions *ReplaceResourcesQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { + return schematics.ReplaceResourcesQueryWithContext(context.Background(), replaceResourcesQueryOptions) } -// ListKmsWithContext is an alternate form of the ListKms method which supports a Context parameter -func (schematics *SchematicsV1) ListKmsWithContext(ctx context.Context, listKmsOptions *ListKmsOptions) (result *KMSDiscovery, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listKmsOptions, "listKmsOptions cannot be nil") +// ReplaceResourcesQueryWithContext is an alternate form of the ReplaceResourcesQuery method which supports a Context parameter +func (schematics *SchematicsV1) ReplaceResourcesQueryWithContext(ctx context.Context, replaceResourcesQueryOptions *ReplaceResourcesQueryOptions) (result *ResourceQueryRecord, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceResourcesQueryOptions, "replaceResourcesQueryOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listKmsOptions, "listKmsOptions") + err = core.ValidateStruct(replaceResourcesQueryOptions, "replaceResourcesQueryOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "query_id": *replaceResourcesQueryOptions.QueryID, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/kms_instances`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listKmsOptions.Headers { + for headerName, headerValue := range replaceResourcesQueryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListKms") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ReplaceResourcesQuery") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") - builder.AddQuery("encryption_scheme", fmt.Sprint(*listKmsOptions.EncryptionScheme)) - builder.AddQuery("location", fmt.Sprint(*listKmsOptions.Location)) - if listKmsOptions.ResourceGroup != nil { - builder.AddQuery("resource_group", fmt.Sprint(*listKmsOptions.ResourceGroup)) + body := make(map[string]interface{}) + if replaceResourcesQueryOptions.Type != nil { + body["type"] = replaceResourcesQueryOptions.Type } - if listKmsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listKmsOptions.Limit)) + if replaceResourcesQueryOptions.Name != nil { + body["name"] = replaceResourcesQueryOptions.Name } - if listKmsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listKmsOptions.Sort)) + if replaceResourcesQueryOptions.Queries != nil { + body["queries"] = replaceResourcesQueryOptions.Queries + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -5034,7 +5127,7 @@ func (schematics *SchematicsV1) ListKmsWithContext(ctx context.Context, listKmsO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKMSDiscovery) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryRecord) if err != nil { return } @@ -5044,47 +5137,45 @@ func (schematics *SchematicsV1) ListKmsWithContext(ctx context.Context, listKmsO return } -// ListConnection : Get all connection definition for external datastore -// Get all external connection definition. -func (schematics *SchematicsV1) ListConnection(listConnectionOptions *ListConnectionOptions) (result *ConnectionList, response *core.DetailedResponse, err error) { - return schematics.ListConnectionWithContext(context.Background(), listConnectionOptions) +// ExecuteResourceQuery : Run the resource query +// Run the resource query. +func (schematics *SchematicsV1) ExecuteResourceQuery(executeResourceQueryOptions *ExecuteResourceQueryOptions) (result *ResourceQueryResponseRecord, response *core.DetailedResponse, err error) { + return schematics.ExecuteResourceQueryWithContext(context.Background(), executeResourceQueryOptions) } -// ListConnectionWithContext is an alternate form of the ListConnection method which supports a Context parameter -func (schematics *SchematicsV1) ListConnectionWithContext(ctx context.Context, listConnectionOptions *ListConnectionOptions) (result *ConnectionList, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listConnectionOptions, "listConnectionOptions") +// ExecuteResourceQueryWithContext is an alternate form of the ExecuteResourceQuery method which supports a Context parameter +func (schematics *SchematicsV1) ExecuteResourceQueryWithContext(ctx context.Context, executeResourceQueryOptions *ExecuteResourceQueryOptions) (result *ResourceQueryResponseRecord, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(executeResourceQueryOptions, "executeResourceQueryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(executeResourceQueryOptions, "executeResourceQueryOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "query_id": *executeResourceQueryOptions.QueryID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/connections`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listConnectionOptions.Headers { + for headerName, headerValue := range executeResourceQueryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListConnection") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ExecuteResourceQuery") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listConnectionOptions.Offset != nil { - builder.AddQuery("offset", fmt.Sprint(*listConnectionOptions.Offset)) - } - if listConnectionOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listConnectionOptions.Limit)) - } - if listConnectionOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listConnectionOptions.Sort)) - } - request, err := builder.Build() if err != nil { return @@ -5096,7 +5187,7 @@ func (schematics *SchematicsV1) ListConnectionWithContext(ctx context.Context, l return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalConnectionList) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceQueryResponseRecord) if err != nil { return } @@ -5106,67 +5197,117 @@ func (schematics *SchematicsV1) ListConnectionWithContext(ctx context.Context, l return } -// CreateConnection : Register an connection definition for an external datastore -// Register an external connection definition. -func (schematics *SchematicsV1) CreateConnection(createConnectionOptions *CreateConnectionOptions) (result *Connection, response *core.DetailedResponse, err error) { - return schematics.CreateConnectionWithContext(context.Background(), createConnectionOptions) +// DeleteResourcesQuery : Delete resources query +// Use this API to delete the resource query definition by Id. For more information, about resource query commands, +// refer to [ibmcloud schematics resource query +// delete](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-delete-resource-query). +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see +// [Schematics service access roles and required +// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) DeleteResourcesQuery(deleteResourcesQueryOptions *DeleteResourcesQueryOptions) (response *core.DetailedResponse, err error) { + return schematics.DeleteResourcesQueryWithContext(context.Background(), deleteResourcesQueryOptions) } -// CreateConnectionWithContext is an alternate form of the CreateConnection method which supports a Context parameter -func (schematics *SchematicsV1) CreateConnectionWithContext(ctx context.Context, createConnectionOptions *CreateConnectionOptions) (result *Connection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createConnectionOptions, "createConnectionOptions cannot be nil") +// DeleteResourcesQueryWithContext is an alternate form of the DeleteResourcesQuery method which supports a Context parameter +func (schematics *SchematicsV1) DeleteResourcesQueryWithContext(ctx context.Context, deleteResourcesQueryOptions *DeleteResourcesQueryOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteResourcesQueryOptions, "deleteResourcesQueryOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createConnectionOptions, "createConnectionOptions") + err = core.ValidateStruct(deleteResourcesQueryOptions, "deleteResourcesQueryOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "query_id": *deleteResourcesQueryOptions.QueryID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/connections`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/resources_query/{query_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createConnectionOptions.Headers { + for headerName, headerValue := range deleteResourcesQueryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateConnection") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeleteResourcesQuery") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - body := make(map[string]interface{}) - if createConnectionOptions.Name != nil { - body["name"] = createConnectionOptions.Name + if deleteResourcesQueryOptions.Force != nil { + builder.AddHeader("force", fmt.Sprint(*deleteResourcesQueryOptions.Force)) } - if createConnectionOptions.Description != nil { - body["description"] = createConnectionOptions.Description + if deleteResourcesQueryOptions.Propagate != nil { + builder.AddHeader("propagate", fmt.Sprint(*deleteResourcesQueryOptions.Propagate)) } - if createConnectionOptions.ResourceGroup != nil { - body["resource_group"] = createConnectionOptions.ResourceGroup + + request, err := builder.Build() + if err != nil { + return } - if createConnectionOptions.Location != nil { - body["location"] = createConnectionOptions.Location + + response, err = schematics.Service.Request(request, nil) + + return +} + +// ListAgent : Get all registered/unregistered agents in the Account +// Get all registered or unregistered agents, in the Account. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) ListAgent(listAgentOptions *ListAgentOptions) (result *AgentList, response *core.DetailedResponse, err error) { + return schematics.ListAgentWithContext(context.Background(), listAgentOptions) +} + +// ListAgentWithContext is an alternate form of the ListAgent method which supports a Context parameter +func (schematics *SchematicsV1) ListAgentWithContext(ctx context.Context, listAgentOptions *ListAgentOptions) (result *AgentList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listAgentOptions, "listAgentOptions") + if err != nil { + return } - if createConnectionOptions.Tags != nil { - body["tags"] = createConnectionOptions.Tags + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/agents`, nil) + if err != nil { + return } - if createConnectionOptions.ConnectionType != nil { - body["connection_type"] = createConnectionOptions.ConnectionType + + for headerName, headerValue := range listAgentOptions.Headers { + builder.AddHeader(headerName, headerValue) } - if createConnectionOptions.ConnectionProperties != nil { - body["connection_properties"] = createConnectionOptions.ConnectionProperties + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListAgent") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return + builder.AddHeader("Accept", "application/json") + + if listAgentOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*listAgentOptions.Offset)) + } + if listAgentOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listAgentOptions.Limit)) + } + if listAgentOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*listAgentOptions.Profile)) + } + if listAgentOptions.Filter != nil { + builder.AddQuery("filter", fmt.Sprint(*listAgentOptions.Filter)) } request, err := builder.Build() @@ -5180,7 +5321,7 @@ func (schematics *SchematicsV1) CreateConnectionWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAgentList) if err != nil { return } @@ -5190,44 +5331,83 @@ func (schematics *SchematicsV1) CreateConnectionWithContext(ctx context.Context, return } -// GetConnection : Get connection definition for external datastore -// Get the external connection definition. -func (schematics *SchematicsV1) GetConnection(getConnectionOptions *GetConnectionOptions) (result *ConnectionLite, response *core.DetailedResponse, err error) { - return schematics.GetConnectionWithContext(context.Background(), getConnectionOptions) +// RegisterAgent : Register the agent with schematics +// Register the agent with schematics +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) RegisterAgent(registerAgentOptions *RegisterAgentOptions) (result *Agent, response *core.DetailedResponse, err error) { + return schematics.RegisterAgentWithContext(context.Background(), registerAgentOptions) } -// GetConnectionWithContext is an alternate form of the GetConnection method which supports a Context parameter -func (schematics *SchematicsV1) GetConnectionWithContext(ctx context.Context, getConnectionOptions *GetConnectionOptions) (result *ConnectionLite, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getConnectionOptions, "getConnectionOptions cannot be nil") +// RegisterAgentWithContext is an alternate form of the RegisterAgent method which supports a Context parameter +func (schematics *SchematicsV1) RegisterAgentWithContext(ctx context.Context, registerAgentOptions *RegisterAgentOptions) (result *Agent, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(registerAgentOptions, "registerAgentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getConnectionOptions, "getConnectionOptions") + err = core.ValidateStruct(registerAgentOptions, "registerAgentOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "connection_id": *getConnectionOptions.ConnectionID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/connections/{connection_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/agents`, nil) if err != nil { return } - for headerName, headerValue := range getConnectionOptions.Headers { + for headerName, headerValue := range registerAgentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetConnection") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "RegisterAgent") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if registerAgentOptions.Name != nil { + body["name"] = registerAgentOptions.Name + } + if registerAgentOptions.AgentLocation != nil { + body["agent_location"] = registerAgentOptions.AgentLocation + } + if registerAgentOptions.Location != nil { + body["location"] = registerAgentOptions.Location + } + if registerAgentOptions.ProfileID != nil { + body["profile_id"] = registerAgentOptions.ProfileID + } + if registerAgentOptions.Description != nil { + body["description"] = registerAgentOptions.Description + } + if registerAgentOptions.ResourceGroup != nil { + body["resource_group"] = registerAgentOptions.ResourceGroup + } + if registerAgentOptions.Tags != nil { + body["tags"] = registerAgentOptions.Tags + } + if registerAgentOptions.UserState != nil { + body["user_state"] = registerAgentOptions.UserState + } + if registerAgentOptions.ConnectionState != nil { + body["connection_state"] = registerAgentOptions.ConnectionState + } + if registerAgentOptions.SystemState != nil { + body["system_state"] = registerAgentOptions.SystemState + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } request, err := builder.Build() if err != nil { @@ -5240,7 +5420,7 @@ func (schematics *SchematicsV1) GetConnectionWithContext(ctx context.Context, ge return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalConnectionLite) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAgent) if err != nil { return } @@ -5250,146 +5430,170 @@ func (schematics *SchematicsV1) GetConnectionWithContext(ctx context.Context, ge return } -// DeleteConnection : Unregister connection definition -// Delete the Schematics external data source connection definition. -func (schematics *SchematicsV1) DeleteConnection(deleteConnectionOptions *DeleteConnectionOptions) (response *core.DetailedResponse, err error) { - return schematics.DeleteConnectionWithContext(context.Background(), deleteConnectionOptions) +// GetAgent : Get the registered agent details +// Reterive list the registered agent details +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) GetAgent(getAgentOptions *GetAgentOptions) (result *Agent, response *core.DetailedResponse, err error) { + return schematics.GetAgentWithContext(context.Background(), getAgentOptions) } -// DeleteConnectionWithContext is an alternate form of the DeleteConnection method which supports a Context parameter -func (schematics *SchematicsV1) DeleteConnectionWithContext(ctx context.Context, deleteConnectionOptions *DeleteConnectionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteConnectionOptions, "deleteConnectionOptions cannot be nil") +// GetAgentWithContext is an alternate form of the GetAgent method which supports a Context parameter +func (schematics *SchematicsV1) GetAgentWithContext(ctx context.Context, getAgentOptions *GetAgentOptions) (result *Agent, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getAgentOptions, "getAgentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteConnectionOptions, "deleteConnectionOptions") + err = core.ValidateStruct(getAgentOptions, "getAgentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "connection_id": *deleteConnectionOptions.ConnectionID, + "agent_id": *getAgentOptions.AgentID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/connections/{connection_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/agents/{agent_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteConnectionOptions.Headers { + for headerName, headerValue := range getAgentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeleteConnection") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetAgent") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + + if getAgentOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*getAgentOptions.Profile)) + } request, err := builder.Build() if err != nil { return } - response, err = schematics.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAgent) + if err != nil { + return + } + response.Result = result + } return } -// ListDatasources : Get all datasources registered with Schematics -// Get all datasource registered with Schematics. -func (schematics *SchematicsV1) ListDatasources(listDatasourcesOptions *ListDatasourcesOptions) (result *DatasourceList, response *core.DetailedResponse, err error) { - return schematics.ListDatasourcesWithContext(context.Background(), listDatasourcesOptions) +// DeleteAgent : Deregister the agent +// Deregistering an agent. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) DeleteAgent(deleteAgentOptions *DeleteAgentOptions) (response *core.DetailedResponse, err error) { + return schematics.DeleteAgentWithContext(context.Background(), deleteAgentOptions) } -// ListDatasourcesWithContext is an alternate form of the ListDatasources method which supports a Context parameter -func (schematics *SchematicsV1) ListDatasourcesWithContext(ctx context.Context, listDatasourcesOptions *ListDatasourcesOptions) (result *DatasourceList, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDatasourcesOptions, "listDatasourcesOptions") +// DeleteAgentWithContext is an alternate form of the DeleteAgent method which supports a Context parameter +func (schematics *SchematicsV1) DeleteAgentWithContext(ctx context.Context, deleteAgentOptions *DeleteAgentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteAgentOptions, "deleteAgentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteAgentOptions, "deleteAgentOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "agent_id": *deleteAgentOptions.AgentID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/datasources`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/agents/{agent_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listDatasourcesOptions.Headers { + for headerName, headerValue := range deleteAgentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListDatasources") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeleteAgent") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - - if listDatasourcesOptions.Offset != nil { - builder.AddQuery("offset", fmt.Sprint(*listDatasourcesOptions.Offset)) - } - if listDatasourcesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDatasourcesOptions.Limit)) - } - if listDatasourcesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listDatasourcesOptions.Sort)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = schematics.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatasourceList) - if err != nil { - return - } - response.Result = result - } + response, err = schematics.Service.Request(request, nil) return } -// CreateDatasource : Register a datasource definition -// Register a datasource definition. -func (schematics *SchematicsV1) CreateDatasource(createDatasourceOptions *CreateDatasourceOptions) (result *Datasource, response *core.DetailedResponse, err error) { - return schematics.CreateDatasourceWithContext(context.Background(), createDatasourceOptions) +// UpdateAgentRegistration : Update the agent registration +// Update the agent registeration. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) UpdateAgentRegistration(updateAgentRegistrationOptions *UpdateAgentRegistrationOptions) (result *Agent, response *core.DetailedResponse, err error) { + return schematics.UpdateAgentRegistrationWithContext(context.Background(), updateAgentRegistrationOptions) } -// CreateDatasourceWithContext is an alternate form of the CreateDatasource method which supports a Context parameter -func (schematics *SchematicsV1) CreateDatasourceWithContext(ctx context.Context, createDatasourceOptions *CreateDatasourceOptions) (result *Datasource, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDatasourceOptions, "createDatasourceOptions cannot be nil") +// UpdateAgentRegistrationWithContext is an alternate form of the UpdateAgentRegistration method which supports a Context parameter +func (schematics *SchematicsV1) UpdateAgentRegistrationWithContext(ctx context.Context, updateAgentRegistrationOptions *UpdateAgentRegistrationOptions) (result *Agent, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateAgentRegistrationOptions, "updateAgentRegistrationOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createDatasourceOptions, "createDatasourceOptions") + err = core.ValidateStruct(updateAgentRegistrationOptions, "updateAgentRegistrationOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "agent_id": *updateAgentRegistrationOptions.AgentID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/datasources`, nil) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/agents/{agent_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createDatasourceOptions.Headers { + for headerName, headerValue := range updateAgentRegistrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateDatasource") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "UpdateAgentRegistration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -5397,20 +5601,35 @@ func (schematics *SchematicsV1) CreateDatasourceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") body := make(map[string]interface{}) - if createDatasourceOptions.Name != nil { - body["name"] = createDatasourceOptions.Name + if updateAgentRegistrationOptions.Name != nil { + body["name"] = updateAgentRegistrationOptions.Name } - if createDatasourceOptions.Description != nil { - body["description"] = createDatasourceOptions.Description + if updateAgentRegistrationOptions.AgentLocation != nil { + body["agent_location"] = updateAgentRegistrationOptions.AgentLocation } - if createDatasourceOptions.ResourceGroup != nil { - body["resource_group"] = createDatasourceOptions.ResourceGroup + if updateAgentRegistrationOptions.Location != nil { + body["location"] = updateAgentRegistrationOptions.Location } - if createDatasourceOptions.Tags != nil { - body["tags"] = createDatasourceOptions.Tags + if updateAgentRegistrationOptions.ProfileID != nil { + body["profile_id"] = updateAgentRegistrationOptions.ProfileID } - if createDatasourceOptions.Connection != nil { - body["connection"] = createDatasourceOptions.Connection + if updateAgentRegistrationOptions.Description != nil { + body["description"] = updateAgentRegistrationOptions.Description + } + if updateAgentRegistrationOptions.ResourceGroup != nil { + body["resource_group"] = updateAgentRegistrationOptions.ResourceGroup + } + if updateAgentRegistrationOptions.Tags != nil { + body["tags"] = updateAgentRegistrationOptions.Tags + } + if updateAgentRegistrationOptions.UserState != nil { + body["user_state"] = updateAgentRegistrationOptions.UserState + } + if updateAgentRegistrationOptions.ConnectionState != nil { + body["connection_state"] = updateAgentRegistrationOptions.ConnectionState + } + if updateAgentRegistrationOptions.SystemState != nil { + body["system_state"] = updateAgentRegistrationOptions.SystemState } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -5428,7 +5647,7 @@ func (schematics *SchematicsV1) CreateDatasourceWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatasource) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAgent) if err != nil { return } @@ -5438,48 +5657,50 @@ func (schematics *SchematicsV1) CreateDatasourceWithContext(ctx context.Context, return } -// GetData : Get data from the datasource -// Get data from the datasource. -func (schematics *SchematicsV1) GetData(getDataOptions *GetDataOptions) (result *PreviewData, response *core.DetailedResponse, err error) { - return schematics.GetDataWithContext(context.Background(), getDataOptions) +// GetKmsSettings : Get a KMS settings +// Retrieve the kms instance that is integrated with Schematics for the **byok** and **kyok**. For each geographic +// location supported in Schematics we can have different kms settings. For example `US` and `EU` will have different +// kms settings. +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see +// [Schematics service access roles and required +// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) GetKmsSettings(getKmsSettingsOptions *GetKmsSettingsOptions) (result *KMSSettings, response *core.DetailedResponse, err error) { + return schematics.GetKmsSettingsWithContext(context.Background(), getKmsSettingsOptions) } -// GetDataWithContext is an alternate form of the GetData method which supports a Context parameter -func (schematics *SchematicsV1) GetDataWithContext(ctx context.Context, getDataOptions *GetDataOptions) (result *PreviewData, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDataOptions, "getDataOptions cannot be nil") +// GetKmsSettingsWithContext is an alternate form of the GetKmsSettings method which supports a Context parameter +func (schematics *SchematicsV1) GetKmsSettingsWithContext(ctx context.Context, getKmsSettingsOptions *GetKmsSettingsOptions) (result *KMSSettings, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getKmsSettingsOptions, "getKmsSettingsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getDataOptions, "getDataOptions") + err = core.ValidateStruct(getKmsSettingsOptions, "getKmsSettingsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "datasource_id": *getDataOptions.DatasourceID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = schematics.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/datasources/{datasource_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/kms`, nil) if err != nil { return } - for headerName, headerValue := range getDataOptions.Headers { + for headerName, headerValue := range getKmsSettingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetData") + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetKmsSettings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getDataOptions.Preview != nil { - builder.AddQuery("preview", fmt.Sprint(*getDataOptions.Preview)) - } + builder.AddQuery("location", fmt.Sprint(*getKmsSettingsOptions.Location)) request, err := builder.Build() if err != nil { @@ -5492,7 +5713,7 @@ func (schematics *SchematicsV1) GetDataWithContext(ctx context.Context, getDataO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPreviewData) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKMSSettings) if err != nil { return } @@ -5502,162 +5723,2866 @@ func (schematics *SchematicsV1) GetDataWithContext(ctx context.Context, getDataO return } -// Action : Complete Action details with user inputs and system generated data. -type Action struct { - // The unique name of your action. The name can be up to 128 characters long and can include alphanumeric characters, - // spaces, dashes, and underscores. **Example** you can use the name to stop action. - Name *string `json:"name,omitempty"` - - // Action description. - Description *string `json:"description,omitempty"` +// UpdateKmsSettings : Update a KMS settings +// Replace or Update kms settings for a given location can be updated. +// **Note** you can update the kms settings only once. For example, if you use an API endpoint for a geography, such as +// North America, only kms settings for that region can be retrieved. +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see +// [Schematics service access roles and required +// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) UpdateKmsSettings(updateKmsSettingsOptions *UpdateKmsSettingsOptions) (result *KMSSettings, response *core.DetailedResponse, err error) { + return schematics.UpdateKmsSettingsWithContext(context.Background(), updateKmsSettingsOptions) +} - // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the - // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// UpdateKmsSettingsWithContext is an alternate form of the UpdateKmsSettings method which supports a Context parameter +func (schematics *SchematicsV1) UpdateKmsSettingsWithContext(ctx context.Context, updateKmsSettingsOptions *UpdateKmsSettingsOptions) (result *KMSSettings, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateKmsSettingsOptions, "updateKmsSettingsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateKmsSettingsOptions, "updateKmsSettingsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/kms`, nil) + if err != nil { + return + } + + for headerName, headerValue := range updateKmsSettingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "UpdateKmsSettings") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateKmsSettingsOptions.Location != nil { + body["location"] = updateKmsSettingsOptions.Location + } + if updateKmsSettingsOptions.EncryptionScheme != nil { + body["encryption_scheme"] = updateKmsSettingsOptions.EncryptionScheme + } + if updateKmsSettingsOptions.ResourceGroup != nil { + body["resource_group"] = updateKmsSettingsOptions.ResourceGroup + } + if updateKmsSettingsOptions.PrimaryCrk != nil { + body["primary_crk"] = updateKmsSettingsOptions.PrimaryCrk + } + if updateKmsSettingsOptions.SecondaryCrk != nil { + body["secondary_crk"] = updateKmsSettingsOptions.SecondaryCrk + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKMSSettings) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListKms : List KMS instances +// Lists the kms instances of your IBM Cloud account to find your Key Protect or Hyper Protect Crypto Services by using +// the location and encrypted scheme. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see +// [Schematics service access roles and required +// permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) ListKms(listKmsOptions *ListKmsOptions) (result *KMSDiscovery, response *core.DetailedResponse, err error) { + return schematics.ListKmsWithContext(context.Background(), listKmsOptions) +} + +// ListKmsWithContext is an alternate form of the ListKms method which supports a Context parameter +func (schematics *SchematicsV1) ListKmsWithContext(ctx context.Context, listKmsOptions *ListKmsOptions) (result *KMSDiscovery, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listKmsOptions, "listKmsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listKmsOptions, "listKmsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/kms_instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listKmsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListKms") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("encryption_scheme", fmt.Sprint(*listKmsOptions.EncryptionScheme)) + builder.AddQuery("location", fmt.Sprint(*listKmsOptions.Location)) + if listKmsOptions.ResourceGroup != nil { + builder.AddQuery("resource_group", fmt.Sprint(*listKmsOptions.ResourceGroup)) + } + if listKmsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listKmsOptions.Limit)) + } + if listKmsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listKmsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKMSDiscovery) + if err != nil { + return + } + response.Result = result + } + + return +} + +// FetchJobs : Fetch the jobs for the Schematics agent +// Fetch the jobs for the Schematics agent. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) FetchJobs(fetchJobsOptions *FetchJobsOptions) (result *AgentJob, response *core.DetailedResponse, err error) { + return schematics.FetchJobsWithContext(context.Background(), fetchJobsOptions) +} + +// FetchJobsWithContext is an alternate form of the FetchJobs method which supports a Context parameter +func (schematics *SchematicsV1) FetchJobsWithContext(ctx context.Context, fetchJobsOptions *FetchJobsOptions) (result *AgentJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(fetchJobsOptions, "fetchJobsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(fetchJobsOptions, "fetchJobsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/agent_jobs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range fetchJobsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "FetchJobs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if fetchJobsOptions.AgentID != nil { + body["agent_id"] = fetchJobsOptions.AgentID + } + if fetchJobsOptions.JobCount != nil { + body["job_count"] = fetchJobsOptions.JobCount + } + if fetchJobsOptions.JobType != nil { + body["job_type"] = fetchJobsOptions.JobType + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAgentJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetAgentJobFiles : Get job files for agent execution +// Get job files for agent execution. Schematics Agent uses this API to get repo-files in zip/tar format. The +// repo-files includes GitHub files, variable store file, env values file, state file, temp files etc., +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) GetAgentJobFiles(getAgentJobFilesOptions *GetAgentJobFilesOptions) (response *core.DetailedResponse, err error) { + return schematics.GetAgentJobFilesWithContext(context.Background(), getAgentJobFilesOptions) +} + +// GetAgentJobFilesWithContext is an alternate form of the GetAgentJobFiles method which supports a Context parameter +func (schematics *SchematicsV1) GetAgentJobFilesWithContext(ctx context.Context, getAgentJobFilesOptions *GetAgentJobFilesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getAgentJobFilesOptions, "getAgentJobFilesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getAgentJobFilesOptions, "getAgentJobFilesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "job_id": *getAgentJobFilesOptions.JobID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/agent_jobs/{job_id}/files`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getAgentJobFilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetAgentJobFiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = schematics.Service.Request(request, nil) + + return +} + +// PostAgentJobFiles : Upload the output files of the agent job run +// Schematics Agent uploads the output - terraform state, terraform logs and temp files, using this API. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) PostAgentJobFiles(postAgentJobFilesOptions *PostAgentJobFilesOptions) (response *core.DetailedResponse, err error) { + return schematics.PostAgentJobFilesWithContext(context.Background(), postAgentJobFilesOptions) +} + +// PostAgentJobFilesWithContext is an alternate form of the PostAgentJobFiles method which supports a Context parameter +func (schematics *SchematicsV1) PostAgentJobFilesWithContext(ctx context.Context, postAgentJobFilesOptions *PostAgentJobFilesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(postAgentJobFilesOptions, "postAgentJobFilesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(postAgentJobFilesOptions, "postAgentJobFilesOptions") + if err != nil { + return + } + if (postAgentJobFilesOptions.File == nil) { + err = fmt.Errorf("at least one of or file must be supplied") + return + } + + pathParamsMap := map[string]string{ + "job_id": *postAgentJobFilesOptions.JobID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/agent_jobs/{job_id}/files`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range postAgentJobFilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "PostAgentJobFiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("file_type", fmt.Sprint(*postAgentJobFilesOptions.FileType)) + + if postAgentJobFilesOptions.File != nil { + builder.AddFormData("file", "filename", + core.StringNilMapper(postAgentJobFilesOptions.FileContentType), postAgentJobFilesOptions.File) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = schematics.Service.Request(request, nil) + + return +} + +// UpdateJobStatus : Update the Schematics agent job status +// Update the Schematics agent job status +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) UpdateJobStatus(updateJobStatusOptions *UpdateJobStatusOptions) (response *core.DetailedResponse, err error) { + return schematics.UpdateJobStatusWithContext(context.Background(), updateJobStatusOptions) +} + +// UpdateJobStatusWithContext is an alternate form of the UpdateJobStatus method which supports a Context parameter +func (schematics *SchematicsV1) UpdateJobStatusWithContext(ctx context.Context, updateJobStatusOptions *UpdateJobStatusOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateJobStatusOptions, "updateJobStatusOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateJobStatusOptions, "updateJobStatusOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "job_id": *updateJobStatusOptions.JobID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/agent_jobs/{job_id}/status`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateJobStatusOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "UpdateJobStatus") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateJobStatusOptions.AgentSubID != nil { + body["agent_sub_id"] = updateJobStatusOptions.AgentSubID + } + if updateJobStatusOptions.DocType != nil { + body["doc_type"] = updateJobStatusOptions.DocType + } + if updateJobStatusOptions.WorkspaceStatus != nil { + body["workspace_status"] = updateJobStatusOptions.WorkspaceStatus + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = schematics.Service.Request(request, nil) + + return +} + +// UpdateVariablesMetadata : Update variables metadata for the schematics resource +// Update the variables metadata for the schematics resource. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) UpdateVariablesMetadata(updateVariablesMetadataOptions *UpdateVariablesMetadataOptions) (response *core.DetailedResponse, err error) { + return schematics.UpdateVariablesMetadataWithContext(context.Background(), updateVariablesMetadataOptions) +} + +// UpdateVariablesMetadataWithContext is an alternate form of the UpdateVariablesMetadata method which supports a Context parameter +func (schematics *SchematicsV1) UpdateVariablesMetadataWithContext(ctx context.Context, updateVariablesMetadataOptions *UpdateVariablesMetadataOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVariablesMetadataOptions, "updateVariablesMetadataOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVariablesMetadataOptions, "updateVariablesMetadataOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "job_id": *updateVariablesMetadataOptions.JobID, + "w_id": *updateVariablesMetadataOptions.WID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/agent_jobs/{job_id}/workspaces/{w_id}/variables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVariablesMetadataOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "UpdateVariablesMetadata") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateVariablesMetadataOptions.DocType != nil { + body["doc_type"] = updateVariablesMetadataOptions.DocType + } + if updateVariablesMetadataOptions.WorkspaceVariables != nil { + body["workspace_variables"] = updateVariablesMetadataOptions.WorkspaceVariables + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = schematics.Service.Request(request, nil) + + return +} + +// ListPolicy : Get all policies in the account +// Reterive a list of all policies from the account that you have access. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) ListPolicy(listPolicyOptions *ListPolicyOptions) (result *PolicyList, response *core.DetailedResponse, err error) { + return schematics.ListPolicyWithContext(context.Background(), listPolicyOptions) +} + +// ListPolicyWithContext is an alternate form of the ListPolicy method which supports a Context parameter +func (schematics *SchematicsV1) ListPolicyWithContext(ctx context.Context, listPolicyOptions *ListPolicyOptions) (result *PolicyList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPolicyOptions, "listPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listPolicyOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*listPolicyOptions.Offset)) + } + if listPolicyOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPolicyOptions.Limit)) + } + if listPolicyOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*listPolicyOptions.Profile)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicyList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreatePolicy : Create a new policy in account +// Create a new policy in account +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) CreatePolicy(createPolicyOptions *CreatePolicyOptions) (result *Policy, response *core.DetailedResponse, err error) { + return schematics.CreatePolicyWithContext(context.Background(), createPolicyOptions) +} + +// CreatePolicyWithContext is an alternate form of the CreatePolicy method which supports a Context parameter +func (schematics *SchematicsV1) CreatePolicyWithContext(ctx context.Context, createPolicyOptions *CreatePolicyOptions) (result *Policy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPolicyOptions, "createPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createPolicyOptions, "createPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreatePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createPolicyOptions.PolicyKind != nil { + body["policy_kind"] = createPolicyOptions.PolicyKind + } + if createPolicyOptions.Name != nil { + body["name"] = createPolicyOptions.Name + } + if createPolicyOptions.Description != nil { + body["description"] = createPolicyOptions.Description + } + if createPolicyOptions.ResourceGroup != nil { + body["resource_group"] = createPolicyOptions.ResourceGroup + } + if createPolicyOptions.Tags != nil { + body["tags"] = createPolicyOptions.Tags + } + if createPolicyOptions.Location != nil { + body["location"] = createPolicyOptions.Location + } + if createPolicyOptions.State != nil { + body["state"] = createPolicyOptions.State + } + if createPolicyOptions.PolicyTarget != nil { + body["policy_target"] = createPolicyOptions.PolicyTarget + } + if createPolicyOptions.PolicyParameter != nil { + body["policy_parameter"] = createPolicyOptions.PolicyParameter + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetPolicy : Get the policy details identified by policy_id +// Retrieve the detailed information of a policy details identified by policy_id. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) GetPolicy(getPolicyOptions *GetPolicyOptions) (result *Policy, response *core.DetailedResponse, err error) { + return schematics.GetPolicyWithContext(context.Background(), getPolicyOptions) +} + +// GetPolicyWithContext is an alternate form of the GetPolicy method which supports a Context parameter +func (schematics *SchematicsV1) GetPolicyWithContext(ctx context.Context, getPolicyOptions *GetPolicyOptions) (result *Policy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPolicyOptions, "getPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getPolicyOptions, "getPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "policy_id": *getPolicyOptions.PolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/policies/{policy_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getPolicyOptions.Profile != nil { + builder.AddQuery("profile", fmt.Sprint(*getPolicyOptions.Profile)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeletePolicy : Delete policy identified by policy_id +// Delete the policy. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) DeletePolicy(deletePolicyOptions *DeletePolicyOptions) (response *core.DetailedResponse, err error) { + return schematics.DeletePolicyWithContext(context.Background(), deletePolicyOptions) +} + +// DeletePolicyWithContext is an alternate form of the DeletePolicy method which supports a Context parameter +func (schematics *SchematicsV1) DeletePolicyWithContext(ctx context.Context, deletePolicyOptions *DeletePolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePolicyOptions, "deletePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deletePolicyOptions, "deletePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "policy_id": *deletePolicyOptions.PolicyID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/policies/{policy_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deletePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeletePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = schematics.Service.Request(request, nil) + + return +} + +// UpdatePolicy : Update the policy details +// Update or replace the policy details. +// +//

Authorization

+// +// Schematics support generic authorization for its resources. +// For more information, about Schematics access and permissions, see [Schematics service access +// roles and required permissions](https://cloud.ibm.com/docs/schematics?topic=schematics-access#access-roles). +func (schematics *SchematicsV1) UpdatePolicy(updatePolicyOptions *UpdatePolicyOptions) (result *Policy, response *core.DetailedResponse, err error) { + return schematics.UpdatePolicyWithContext(context.Background(), updatePolicyOptions) +} + +// UpdatePolicyWithContext is an alternate form of the UpdatePolicy method which supports a Context parameter +func (schematics *SchematicsV1) UpdatePolicyWithContext(ctx context.Context, updatePolicyOptions *UpdatePolicyOptions) (result *Policy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePolicyOptions, "updatePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updatePolicyOptions, "updatePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "policy_id": *updatePolicyOptions.PolicyID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/policies/{policy_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updatePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "UpdatePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updatePolicyOptions.PolicyKind != nil { + body["policy_kind"] = updatePolicyOptions.PolicyKind + } + if updatePolicyOptions.Name != nil { + body["name"] = updatePolicyOptions.Name + } + if updatePolicyOptions.Description != nil { + body["description"] = updatePolicyOptions.Description + } + if updatePolicyOptions.ResourceGroup != nil { + body["resource_group"] = updatePolicyOptions.ResourceGroup + } + if updatePolicyOptions.Tags != nil { + body["tags"] = updatePolicyOptions.Tags + } + if updatePolicyOptions.Location != nil { + body["location"] = updatePolicyOptions.Location + } + if updatePolicyOptions.State != nil { + body["state"] = updatePolicyOptions.State + } + if updatePolicyOptions.PolicyTarget != nil { + body["policy_target"] = updatePolicyOptions.PolicyTarget + } + if updatePolicyOptions.PolicyParameter != nil { + body["policy_parameter"] = updatePolicyOptions.PolicyParameter + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListConnection : Get connection definition +// Get all external connection definition. +func (schematics *SchematicsV1) ListConnection(listConnectionOptions *ListConnectionOptions) (result *ConnectionList, response *core.DetailedResponse, err error) { + return schematics.ListConnectionWithContext(context.Background(), listConnectionOptions) +} + +// ListConnectionWithContext is an alternate form of the ListConnection method which supports a Context parameter +func (schematics *SchematicsV1) ListConnectionWithContext(ctx context.Context, listConnectionOptions *ListConnectionOptions) (result *ConnectionList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listConnectionOptions, "listConnectionOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/connections`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listConnectionOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*listConnectionOptions.Offset)) + } + if listConnectionOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listConnectionOptions.Limit)) + } + if listConnectionOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listConnectionOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalConnectionList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateConnection : Register an connection definition for an external datastore +// Register an external connection definition. +func (schematics *SchematicsV1) CreateConnection(createConnectionOptions *CreateConnectionOptions) (result *Connection, response *core.DetailedResponse, err error) { + return schematics.CreateConnectionWithContext(context.Background(), createConnectionOptions) +} + +// CreateConnectionWithContext is an alternate form of the CreateConnection method which supports a Context parameter +func (schematics *SchematicsV1) CreateConnectionWithContext(ctx context.Context, createConnectionOptions *CreateConnectionOptions) (result *Connection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createConnectionOptions, "createConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createConnectionOptions, "createConnectionOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/connections`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createConnectionOptions.Name != nil { + body["name"] = createConnectionOptions.Name + } + if createConnectionOptions.Description != nil { + body["description"] = createConnectionOptions.Description + } + if createConnectionOptions.ResourceGroup != nil { + body["resource_group"] = createConnectionOptions.ResourceGroup + } + if createConnectionOptions.Location != nil { + body["location"] = createConnectionOptions.Location + } + if createConnectionOptions.Tags != nil { + body["tags"] = createConnectionOptions.Tags + } + if createConnectionOptions.ConnectionType != nil { + body["connection_type"] = createConnectionOptions.ConnectionType + } + if createConnectionOptions.ConnectionProperties != nil { + body["connection_properties"] = createConnectionOptions.ConnectionProperties + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalConnection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetConnection : Get connection definition for external datastore +// Get the external connection definition. +func (schematics *SchematicsV1) GetConnection(getConnectionOptions *GetConnectionOptions) (result *ConnectionLite, response *core.DetailedResponse, err error) { + return schematics.GetConnectionWithContext(context.Background(), getConnectionOptions) +} + +// GetConnectionWithContext is an alternate form of the GetConnection method which supports a Context parameter +func (schematics *SchematicsV1) GetConnectionWithContext(ctx context.Context, getConnectionOptions *GetConnectionOptions) (result *ConnectionLite, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getConnectionOptions, "getConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getConnectionOptions, "getConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "connection_id": *getConnectionOptions.ConnectionID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/connections/{connection_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalConnectionLite) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteConnection : Unregister connection definition +// Delete the Schematics external data source connection definition. +func (schematics *SchematicsV1) DeleteConnection(deleteConnectionOptions *DeleteConnectionOptions) (response *core.DetailedResponse, err error) { + return schematics.DeleteConnectionWithContext(context.Background(), deleteConnectionOptions) +} + +// DeleteConnectionWithContext is an alternate form of the DeleteConnection method which supports a Context parameter +func (schematics *SchematicsV1) DeleteConnectionWithContext(ctx context.Context, deleteConnectionOptions *DeleteConnectionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteConnectionOptions, "deleteConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteConnectionOptions, "deleteConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "connection_id": *deleteConnectionOptions.ConnectionID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/connections/{connection_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "DeleteConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = schematics.Service.Request(request, nil) + + return +} + +// ListDatasources : Get all datasources registered with Schematics +// Get all datasource registered with Schematics. +func (schematics *SchematicsV1) ListDatasources(listDatasourcesOptions *ListDatasourcesOptions) (result *DatasourceList, response *core.DetailedResponse, err error) { + return schematics.ListDatasourcesWithContext(context.Background(), listDatasourcesOptions) +} + +// ListDatasourcesWithContext is an alternate form of the ListDatasources method which supports a Context parameter +func (schematics *SchematicsV1) ListDatasourcesWithContext(ctx context.Context, listDatasourcesOptions *ListDatasourcesOptions) (result *DatasourceList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDatasourcesOptions, "listDatasourcesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/datasources`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDatasourcesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "ListDatasources") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listDatasourcesOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*listDatasourcesOptions.Offset)) + } + if listDatasourcesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDatasourcesOptions.Limit)) + } + if listDatasourcesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listDatasourcesOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatasourceList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateDatasource : Register a datasource definition +// Register a datasource definition. +func (schematics *SchematicsV1) CreateDatasource(createDatasourceOptions *CreateDatasourceOptions) (result *Datasource, response *core.DetailedResponse, err error) { + return schematics.CreateDatasourceWithContext(context.Background(), createDatasourceOptions) +} + +// CreateDatasourceWithContext is an alternate form of the CreateDatasource method which supports a Context parameter +func (schematics *SchematicsV1) CreateDatasourceWithContext(ctx context.Context, createDatasourceOptions *CreateDatasourceOptions) (result *Datasource, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDatasourceOptions, "createDatasourceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createDatasourceOptions, "createDatasourceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/datasources`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDatasourceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "CreateDatasource") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createDatasourceOptions.Name != nil { + body["name"] = createDatasourceOptions.Name + } + if createDatasourceOptions.Description != nil { + body["description"] = createDatasourceOptions.Description + } + if createDatasourceOptions.ResourceGroup != nil { + body["resource_group"] = createDatasourceOptions.ResourceGroup + } + if createDatasourceOptions.Tags != nil { + body["tags"] = createDatasourceOptions.Tags + } + if createDatasourceOptions.Type != nil { + body["type"] = createDatasourceOptions.Type + } + if createDatasourceOptions.Connection != nil { + body["connection"] = createDatasourceOptions.Connection + } + if createDatasourceOptions.DatasourceProperties != nil { + body["datasource_properties"] = createDatasourceOptions.DatasourceProperties + } + if createDatasourceOptions.Location != nil { + body["location"] = createDatasourceOptions.Location + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatasource) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetData : Get a data from the datasource +// Get data from the datasource. +func (schematics *SchematicsV1) GetData(getDataOptions *GetDataOptions) (result *PreviewData, response *core.DetailedResponse, err error) { + return schematics.GetDataWithContext(context.Background(), getDataOptions) +} + +// GetDataWithContext is an alternate form of the GetData method which supports a Context parameter +func (schematics *SchematicsV1) GetDataWithContext(ctx context.Context, getDataOptions *GetDataOptions) (result *PreviewData, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDataOptions, "getDataOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDataOptions, "getDataOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "datasource_id": *getDataOptions.DatasourceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = schematics.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(schematics.Service.Options.URL, `/v2/settings/datasources/{datasource_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDataOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("schematics", "V1", "GetData") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getDataOptions.Preview != nil { + builder.AddQuery("preview", fmt.Sprint(*getDataOptions.Preview)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = schematics.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPreviewData) + if err != nil { + return + } + response.Result = result + } + + return +} + +// Action : Complete Action details with user inputs and system generated data. +type Action struct { + // The unique name of your action. The name can be up to 128 characters long and can include alphanumeric characters, + // spaces, dashes, and underscores. **Example** you can use the name to stop action. + Name *string `json:"name,omitempty"` + + // Action description. + Description *string `json:"description,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + + // Resource-group name for an action. By default, an action is created in `Default` resource group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then + // `bastion_connection_type` is not supported. + BastionConnectionType *string `json:"bastion_connection_type,omitempty"` + + // Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows + // system with the public IPs and do not support Bastion host. + InventoryConnectionType *string `json:"inventory_connection_type,omitempty"` + + // Action tags. + Tags []string `json:"tags,omitempty"` + + // User defined status of the Schematics object. + UserState *UserState `json:"user_state,omitempty"` + + // URL of the `README` file, for the source URL. + SourceReadmeURL *string `json:"source_readme_url,omitempty"` + + // Source of templates, playbooks, or controls. + Source *ExternalSource `json:"source,omitempty"` + + // Type of source for the Template. + SourceType *string `json:"source_type,omitempty"` + + // Schematics job command parameter (playbook-name). + CommandParameter *string `json:"command_parameter,omitempty"` + + // Target inventory record ID, used by the action or ansible playbook. + Inventory *string `json:"inventory,omitempty"` + + // credentials of the Action. + Credentials []CredentialVariableData `json:"credentials,omitempty"` + + // Describes a bastion resource. + Bastion *BastionResourceDefinition `json:"bastion,omitempty"` + + // User editable credential variable data and system generated reference to the value. + BastionCredential *CredentialVariableData `json:"bastion_credential,omitempty"` + + // Inventory of host and host group for the playbook in `INI` file format. For example, `"targets_ini": + // "[webserverhost] + // 172.22.192.6 + // [dbhost] + // 172.22.192.5"`. For more information, about an inventory host group syntax, see [Inventory host + // groups](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-inventory-host-grps). + TargetsIni *string `json:"targets_ini,omitempty"` + + // Input variables for the Action. + Inputs []VariableData `json:"inputs,omitempty"` + + // Output variables for the Action. + Outputs []VariableData `json:"outputs,omitempty"` + + // Environment variables for the Action. + Settings []VariableData `json:"settings,omitempty"` + + // Action ID. + ID *string `json:"id,omitempty"` + + // Action Cloud Resource Name. + Crn *string `json:"crn,omitempty"` + + // Action account ID. + Account *string `json:"account,omitempty"` + + // Action Playbook Source creation time. + SourceCreatedAt *strfmt.DateTime `json:"source_created_at,omitempty"` + + // E-mail address of user who created the Action Playbook Source. + SourceCreatedBy *string `json:"source_created_by,omitempty"` + + // The action playbook updation time. + SourceUpdatedAt *strfmt.DateTime `json:"source_updated_at,omitempty"` + + // E-mail address of user who updated the action playbook source. + SourceUpdatedBy *string `json:"source_updated_by,omitempty"` + + // Action creation time. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // E-mail address of the user who created an action. + CreatedBy *string `json:"created_by,omitempty"` + + // Action updation time. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // E-mail address of the user who updated an action. + UpdatedBy *string `json:"updated_by,omitempty"` + + // Computed state of the Action. + State *ActionState `json:"state,omitempty"` + + // Playbook names retrieved from the repository. + PlaybookNames []string `json:"playbook_names,omitempty"` + + // System lock status. + SysLock *SystemLock `json:"sys_lock,omitempty"` +} + +// Constants associated with the Action.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + Action_Location_EuDe = "eu-de" + Action_Location_EuGb = "eu-gb" + Action_Location_UsEast = "us-east" + Action_Location_UsSouth = "us-south" +) + +// Constants associated with the Action.BastionConnectionType property. +// Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then +// `bastion_connection_type` is not supported. +const ( + Action_BastionConnectionType_Ssh = "ssh" +) + +// Constants associated with the Action.InventoryConnectionType property. +// Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system +// with the public IPs and do not support Bastion host. +const ( + Action_InventoryConnectionType_Ssh = "ssh" + Action_InventoryConnectionType_Winrm = "winrm" +) + +// Constants associated with the Action.SourceType property. +// Type of source for the Template. +const ( + Action_SourceType_GitHub = "git_hub" + Action_SourceType_GitHubEnterprise = "git_hub_enterprise" + Action_SourceType_GitLab = "git_lab" + Action_SourceType_IbmCloudCatalog = "ibm_cloud_catalog" + Action_SourceType_IbmGitLab = "ibm_git_lab" + Action_SourceType_Local = "local" +) + +// UnmarshalAction unmarshals an instance of Action from the specified map of raw messages. +func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Action) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bastion_connection_type", &obj.BastionConnectionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "inventory_connection_type", &obj.InventoryConnectionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_state", &obj.UserState, UnmarshalUserState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_readme_url", &obj.SourceReadmeURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalExternalSource) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_type", &obj.SourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "command_parameter", &obj.CommandParameter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "inventory", &obj.Inventory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "credentials", &obj.Credentials, UnmarshalCredentialVariableData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "bastion", &obj.Bastion, UnmarshalBastionResourceDefinition) + if err != nil { + return + } + err = core.UnmarshalModel(m, "bastion_credential", &obj.BastionCredential, UnmarshalCredentialVariableData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "targets_ini", &obj.TargetsIni) + if err != nil { + return + } + err = core.UnmarshalModel(m, "inputs", &obj.Inputs, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "outputs", &obj.Outputs, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "settings", &obj.Settings, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.Crn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account", &obj.Account) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_created_at", &obj.SourceCreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_created_by", &obj.SourceCreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_updated_at", &obj.SourceUpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_updated_by", &obj.SourceUpdatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalActionState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "playbook_names", &obj.PlaybookNames) + if err != nil { + return + } + err = core.UnmarshalModel(m, "sys_lock", &obj.SysLock, UnmarshalSystemLock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ActionList : List of Action definition response. +type ActionList struct { + // Total number of records. + TotalCount *int64 `json:"total_count,omitempty"` + + // Number of records returned. + Limit *int64 `json:"limit" validate:"required"` + + // Skipped number of records. + Offset *int64 `json:"offset" validate:"required"` + + // List of action records. + Actions []ActionLite `json:"actions,omitempty"` +} + +// UnmarshalActionList unmarshals an instance of ActionList from the specified map of raw messages. +func UnmarshalActionList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ActionList) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalActionLite) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ActionLite : Action summary profile with user inputs and system generated data. +type ActionLite struct { + // Action name (unique for an account). + Name *string `json:"name,omitempty"` + + // Action description. + Description *string `json:"description,omitempty"` + + // Action Id. + ID *string `json:"id,omitempty"` + + // Action Cloud Resource Name. + Crn *string `json:"crn,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + + // Resource-group name for the Action. By default, Action will be created in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // name of the namespace. + Namespace *string `json:"namespace,omitempty"` + + // Action tags. + Tags []string `json:"tags,omitempty"` + + // Name of the selected playbook. + PlaybookName *string `json:"playbook_name,omitempty"` + + // User defined status of the Schematics object. + UserState *UserState `json:"user_state,omitempty"` + + // Computed state of the Action. + State *ActionLiteState `json:"state,omitempty"` + + // System lock status. + SysLock *SystemLock `json:"sys_lock,omitempty"` + + // Action creation time. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // Email address of user who created the action. + CreatedBy *string `json:"created_by,omitempty"` + + // Action updation time. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // Email address of user who updated the action. + UpdatedBy *string `json:"updated_by,omitempty"` +} + +// Constants associated with the ActionLite.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + ActionLite_Location_EuDe = "eu-de" + ActionLite_Location_EuGb = "eu-gb" + ActionLite_Location_UsEast = "us-east" + ActionLite_Location_UsSouth = "us-south" +) + +// UnmarshalActionLite unmarshals an instance of ActionLite from the specified map of raw messages. +func UnmarshalActionLite(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ActionLite) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.Crn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "playbook_name", &obj.PlaybookName) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_state", &obj.UserState, UnmarshalUserState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalActionLiteState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "sys_lock", &obj.SysLock, UnmarshalSystemLock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ActionLiteState : Computed state of the Action. +type ActionLiteState struct { + // Status of automation (workspace or action). + StatusCode *string `json:"status_code,omitempty"` + + // Automation status message - to be displayed along with the status_code. + StatusMessage *string `json:"status_message,omitempty"` +} + +// Constants associated with the ActionLiteState.StatusCode property. +// Status of automation (workspace or action). +const ( + ActionLiteState_StatusCode_Critical = "critical" + ActionLiteState_StatusCode_Disabled = "disabled" + ActionLiteState_StatusCode_Normal = "normal" + ActionLiteState_StatusCode_Pending = "pending" +) + +// UnmarshalActionLiteState unmarshals an instance of ActionLiteState from the specified map of raw messages. +func UnmarshalActionLiteState(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ActionLiteState) + err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status_message", &obj.StatusMessage) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ActionState : Computed state of the Action. +type ActionState struct { + // Status of automation (workspace or action). + StatusCode *string `json:"status_code,omitempty"` + + // Job id reference for this status. + StatusJobID *string `json:"status_job_id,omitempty"` + + // Automation status message - to be displayed along with the status_code. + StatusMessage *string `json:"status_message,omitempty"` +} + +// Constants associated with the ActionState.StatusCode property. +// Status of automation (workspace or action). +const ( + ActionState_StatusCode_Critical = "critical" + ActionState_StatusCode_Disabled = "disabled" + ActionState_StatusCode_Normal = "normal" + ActionState_StatusCode_Pending = "pending" +) + +// UnmarshalActionState unmarshals an instance of ActionState from the specified map of raw messages. +func UnmarshalActionState(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ActionState) + err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status_job_id", &obj.StatusJobID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status_message", &obj.StatusMessage) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Agent : The agent registration details, with user inputs and system generated data. +type Agent struct { + // The name of the agent (must be unique, for an account). + Name *string `json:"name" validate:"required"` + + // Agent description. + Description *string `json:"description,omitempty"` + + // The resource-group name for the agent. By default, Agent will be registered in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Tags for the agent. + Tags []string `json:"tags,omitempty"` + + // The location where agent is deployed in the user environment. + AgentLocation *string `json:"agent_location" validate:"required"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, // provisioned using Schematics. - Location *string `json:"location,omitempty"` + Location *string `json:"location" validate:"required"` + + // The IAM trusted profile id, used by the Agent instance. + ProfileID *string `json:"profile_id" validate:"required"` + + // The Agent crn, obtained from the Schematics Agent deployment configuration. + AgentCrn *string `json:"agent_crn,omitempty"` + + // The Agent registration id. + ID *string `json:"id,omitempty"` + + // The Agent registration date-time. + RegisteredAt *strfmt.DateTime `json:"registered_at,omitempty"` + + // The email address of an user who registered the Agent. + RegisteredBy *string `json:"registered_by,omitempty"` + + // The Agent registration updation time. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // Email address of user who updated the Agent registration. + UpdatedBy *string `json:"updated_by,omitempty"` + + // User defined status of the agent. + UserState *AgentUserState `json:"user_state,omitempty"` + + // Connection status of the agent. + ConnectionState *ConnectionState `json:"connection_state,omitempty"` + + // Computed state of the agent. + SystemState *AgentSystemState `json:"system_state,omitempty"` +} + +// Constants associated with the Agent.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + Agent_Location_EuDe = "eu-de" + Agent_Location_EuGb = "eu-gb" + Agent_Location_UsEast = "us-east" + Agent_Location_UsSouth = "us-south" +) + +// NewAgent : Instantiate Agent (Generic Model Constructor) +func (*SchematicsV1) NewAgent(name string, agentLocation string, location string, profileID string) (_model *Agent, err error) { + _model = &Agent{ + Name: core.StringPtr(name), + AgentLocation: core.StringPtr(agentLocation), + Location: core.StringPtr(location), + ProfileID: core.StringPtr(profileID), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalAgent unmarshals an instance of Agent from the specified map of raw messages. +func UnmarshalAgent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Agent) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "agent_location", &obj.AgentLocation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "profile_id", &obj.ProfileID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "agent_crn", &obj.AgentCrn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "registered_at", &obj.RegisteredAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "registered_by", &obj.RegisteredBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_state", &obj.UserState, UnmarshalAgentUserState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connection_state", &obj.ConnectionState, UnmarshalConnectionState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "system_state", &obj.SystemState, UnmarshalAgentSystemState) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentAssignmentPolicyParameter : Parameters for the `agent_assignment_policy`. +type AgentAssignmentPolicyParameter struct { + // Types of schematics object selector. + SelectorKind *string `json:"selector_kind,omitempty"` + + // The static selectors of schematics object ids (workspace, action or blueprint) for the Schematics policy. + SelectorIds []string `json:"selector_ids,omitempty"` + + // The selectors to dynamically list of schematics object ids (workspace, action or blueprint) for the Schematics + // policy. + SelectorScope []PolicyObjectSelector `json:"selector_scope,omitempty"` +} + +// Constants associated with the AgentAssignmentPolicyParameter.SelectorKind property. +// Types of schematics object selector. +const ( + AgentAssignmentPolicyParameter_SelectorKind_Ids = "ids" + AgentAssignmentPolicyParameter_SelectorKind_Scoped = "scoped" +) + +// UnmarshalAgentAssignmentPolicyParameter unmarshals an instance of AgentAssignmentPolicyParameter from the specified map of raw messages. +func UnmarshalAgentAssignmentPolicyParameter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentAssignmentPolicyParameter) + err = core.UnmarshalPrimitive(m, "selector_kind", &obj.SelectorKind) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "selector_ids", &obj.SelectorIds) + if err != nil { + return + } + err = core.UnmarshalModel(m, "selector_scope", &obj.SelectorScope, UnmarshalPolicyObjectSelector) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentInfo : Agent name, Agent id and associated policy ID information. +type AgentInfo struct { + // agent id which is binded to with the workspace. + ID *string `json:"id,omitempty"` + + // Agent name which is binded to with the workspace. + Name *string `json:"name,omitempty"` + + // ID of the agent assignment policy created for workspaces. + AssignmentPolicyID *string `json:"assignment_policy_id,omitempty"` +} + +// UnmarshalAgentInfo unmarshals an instance of AgentInfo from the specified map of raw messages. +func UnmarshalAgentInfo(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentInfo) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "assignment_policy_id", &obj.AssignmentPolicyID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentJob : Agent Jobs. +type AgentJob struct { + // Schematics Agent id. + AgentID *string `json:"agent_id" validate:"required"` + + // Number of jobs. By default return upto 4 remote jobs. + JobCount *int64 `json:"job_count" validate:"required"` + + // Types of job supported by the Agent. + JobType *string `json:"job_type" validate:"required"` + + // Job details. + JobDetails []AgentJobDetails `json:"job_details,omitempty"` + + // Job status. + JobStatus []AgentJobStatus `json:"job_status,omitempty"` + + // Job variables. + JobVariables []AgentJobVariables `json:"job_variables,omitempty"` +} + +// Constants associated with the AgentJob.JobType property. +// Types of job supported by the Agent. +const ( + AgentJob_JobType_SandboxJob = "sandbox_job" + AgentJob_JobType_WorkspaceJob = "workspace_job" +) + +// NewAgentJob : Instantiate AgentJob (Generic Model Constructor) +func (*SchematicsV1) NewAgentJob(agentID string, jobCount int64, jobType string) (_model *AgentJob, err error) { + _model = &AgentJob{ + AgentID: core.StringPtr(agentID), + JobCount: core.Int64Ptr(jobCount), + JobType: core.StringPtr(jobType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalAgentJob unmarshals an instance of AgentJob from the specified map of raw messages. +func UnmarshalAgentJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentJob) + err = core.UnmarshalPrimitive(m, "agent_id", &obj.AgentID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "job_count", &obj.JobCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "job_details", &obj.JobDetails, UnmarshalAgentJobDetails) + if err != nil { + return + } + err = core.UnmarshalModel(m, "job_status", &obj.JobStatus, UnmarshalAgentJobStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "job_variables", &obj.JobVariables, UnmarshalAgentJobVariables) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentJobDetails : Agent job details. +type AgentJobDetails struct { + // Schematics job id or workspace activity id. + JobID *string `json:"job_id,omitempty"` + + // ID of the current request transaction. + RequestID *string `json:"request_id,omitempty"` + + // Types of job supported by the Agent. + JobType *string `json:"job_type,omitempty"` + + // Agent job - workspace details. + WorkspaceJobDetails *AgentWorkspaceDoc `json:"workspace_job_details,omitempty"` +} + +// Constants associated with the AgentJobDetails.JobType property. +// Types of job supported by the Agent. +const ( + AgentJobDetails_JobType_SandboxJob = "sandbox_job" + AgentJobDetails_JobType_WorkspaceJob = "workspace_job" +) + +// UnmarshalAgentJobDetails unmarshals an instance of AgentJobDetails from the specified map of raw messages. +func UnmarshalAgentJobDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentJobDetails) + err = core.UnmarshalPrimitive(m, "job_id", &obj.JobID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "request_id", &obj.RequestID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "workspace_job_details", &obj.WorkspaceJobDetails, UnmarshalAgentWorkspaceDoc) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentJobStatus : Agent job status. +type AgentJobStatus struct { + // Id of the JobRunner that processed the request. + AgentSubID *string `json:"agent_sub_id,omitempty"` + + // Name of the Schematics automation resource. + DocType *string `json:"doc_type,omitempty"` + + // Agent job - workspace job status. + WorkspaceStatus *AgentWorkspaceStatusDoc `json:"workspace_status,omitempty"` +} + +// Constants associated with the AgentJobStatus.DocType property. +// Name of the Schematics automation resource. +const ( + AgentJobStatus_DocType_Action = "action" + AgentJobStatus_DocType_Blueprint = "blueprint" + AgentJobStatus_DocType_Environment = "environment" + AgentJobStatus_DocType_System = "system" + AgentJobStatus_DocType_Workspace = "workspace" +) + +// UnmarshalAgentJobStatus unmarshals an instance of AgentJobStatus from the specified map of raw messages. +func UnmarshalAgentJobStatus(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentJobStatus) + err = core.UnmarshalPrimitive(m, "agent_sub_id", &obj.AgentSubID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "doc_type", &obj.DocType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "workspace_status", &obj.WorkspaceStatus, UnmarshalAgentWorkspaceStatusDoc) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentJobVariables : Update variables metadata. +type AgentJobVariables struct { + // Name of the Schematics automation resource. + DocType *string `json:"doc_type,omitempty"` + + // Update workspace variables. + WorkspaceVariables *AgentWorkspaceVariablesDoc `json:"workspace_variables,omitempty"` +} + +// Constants associated with the AgentJobVariables.DocType property. +// Name of the Schematics automation resource. +const ( + AgentJobVariables_DocType_Action = "action" + AgentJobVariables_DocType_Blueprint = "blueprint" + AgentJobVariables_DocType_Environment = "environment" + AgentJobVariables_DocType_System = "system" + AgentJobVariables_DocType_Workspace = "workspace" +) + +// UnmarshalAgentJobVariables unmarshals an instance of AgentJobVariables from the specified map of raw messages. +func UnmarshalAgentJobVariables(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentJobVariables) + err = core.UnmarshalPrimitive(m, "doc_type", &obj.DocType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "workspace_variables", &obj.WorkspaceVariables, UnmarshalAgentWorkspaceVariablesDoc) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentList : The list of agent details. +type AgentList struct { + // The total number of records. + TotalCount *int64 `json:"total_count,omitempty"` + + // The number of records returned. + Limit *int64 `json:"limit,omitempty"` + + // The skipped number of records. + Offset *int64 `json:"offset" validate:"required"` + + // The list of agents in the account. + Agents []Agent `json:"agents,omitempty"` +} + +// UnmarshalAgentList unmarshals an instance of AgentList from the specified map of raw messages. +func UnmarshalAgentList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentList) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalModel(m, "agents", &obj.Agents, UnmarshalAgent) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentUserState : User defined status of the agent. +type AgentUserState struct { + // User-defined states + // * `enable` Agent is enabled by the user. + // * `disable` Agent is disbaled by the user. + State *string `json:"state,omitempty"` + + // Name of the User who set the state of the Object. + SetBy *string `json:"set_by,omitempty"` + + // When the User who set the state of the Object. + SetAt *strfmt.DateTime `json:"set_at,omitempty"` +} + +// Constants associated with the AgentUserState.State property. +// User-defined states +// * `enable` Agent is enabled by the user. +// * `disable` Agent is disbaled by the user. +const ( + AgentUserState_State_Disable = "disable" + AgentUserState_State_Enable = "enable" +) + +// UnmarshalAgentUserState unmarshals an instance of AgentUserState from the specified map of raw messages. +func UnmarshalAgentUserState(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentUserState) + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "set_by", &obj.SetBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "set_at", &obj.SetAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentWorkspaceDoc : Agent job - workspace details. +type AgentWorkspaceDoc struct { + Settings []VariableData `json:"settings,omitempty"` + + // Workspace details. + Workspace *WorkspaceResponse `json:"workspace,omitempty"` + + // Information about the workspace jobs. + Job *WorkspaceActivity `json:"job,omitempty"` +} + +// UnmarshalAgentWorkspaceDoc unmarshals an instance of AgentWorkspaceDoc from the specified map of raw messages. +func UnmarshalAgentWorkspaceDoc(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentWorkspaceDoc) + err = core.UnmarshalModel(m, "settings", &obj.Settings, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "workspace", &obj.Workspace, UnmarshalWorkspaceResponse) + if err != nil { + return + } + err = core.UnmarshalModel(m, "job", &obj.Job, UnmarshalWorkspaceActivity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentWorkspaceStatusDoc : Agent job - workspace job status. +type AgentWorkspaceStatusDoc struct { + // The unique identifier of the workspace. + WorkspaceID *string `json:"workspace_id,omitempty"` + + // The status of the workspace. + // + // **Active**: After you successfully ran your infrastructure code by applying your Terraform execution plan, the + // state of your workspace changes to `Active`. + // + // **Connecting**: Schematics tries to connect to the template in your source repo. If successfully connected, the + // template is downloaded and metadata, such as input parameters, is extracted. After the template is downloaded, the + // state of the workspace changes to `Scanning`. + // + // **Draft**: The workspace is created without a reference to a GitHub or GitLab repository. + // + // **Failed**: If errors occur during the execution of your infrastructure code in IBM Cloud Schematics, your + // workspace status is set to `Failed`. + // + // **Inactive**: The Terraform template was scanned successfully and the workspace creation is complete. You can now + // start running Schematics plan and apply jobs to provision the IBM Cloud resources that you specified in your + // template. If you have an `Active` workspace and decide to remove all your resources, your workspace is set to + // `Inactive` after all your resources are removed. + // + // **In progress**: When you instruct IBM Cloud Schematics to run your infrastructure code by applying your Terraform + // execution plan, the status of our workspace changes to `In progress`. + // + // **Scanning**: The download of the Terraform template is complete and vulnerability scanning started. If the scan + // is successful, the workspace state changes to `Inactive`. If errors in your template are found, the state changes to + // `Template Error`. + // + // **Stopped**: The Schematics plan, apply, or destroy job was cancelled manually. + // + // **Template Error**: The Schematics template contains errors and cannot be processed. + WorkspaceStatus *string `json:"workspace_status,omitempty"` + + // If set to true, the workspace is unlocked. + UnlockWorkspace *bool `json:"unlock_workspace,omitempty"` + + // The status of your activity or job. To retrieve the URL to your job logs, use the GET + // /v1/workspaces/{id}/actions/{action_id}/logs API. + // + // * **COMPLETED**: The job completed successfully. + // * **CREATED**: The job was created, but the provisioning, modification, or removal of IBM Cloud resources has not + // started yet. + // * **FAILED**: An error occurred during the plan, apply, or destroy job. Use the job ID to retrieve the URL to the + // log files for your job. + // * **IN PROGRESS**: The job is in progress. You can use the log_url to access the logs. + JobStatus *string `json:"job_status,omitempty"` + + // Summary information extracted from the job logs. + JobLogSummary *LogSummary `json:"job_log_summary,omitempty"` +} + +// UnmarshalAgentWorkspaceStatusDoc unmarshals an instance of AgentWorkspaceStatusDoc from the specified map of raw messages. +func UnmarshalAgentWorkspaceStatusDoc(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentWorkspaceStatusDoc) + err = core.UnmarshalPrimitive(m, "workspace_id", &obj.WorkspaceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "workspace_status", &obj.WorkspaceStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "unlock_workspace", &obj.UnlockWorkspace) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "job_status", &obj.JobStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "job_log_summary", &obj.JobLogSummary, UnmarshalLogSummary) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentWorkspaceVariablesDoc : Update workspace variables. +type AgentWorkspaceVariablesDoc struct { + // The unique identifier of the workspace. + WorkspaceID *string `json:"workspace_id,omitempty"` + + // Inputs variables for the workspace. + Inputs []VariableData `json:"inputs,omitempty"` + + // Input environemnt settings for workspace. + Settings []VariableData `json:"settings,omitempty"` +} + +// UnmarshalAgentWorkspaceVariablesDoc unmarshals an instance of AgentWorkspaceVariablesDoc from the specified map of raw messages. +func UnmarshalAgentWorkspaceVariablesDoc(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentWorkspaceVariablesDoc) + err = core.UnmarshalPrimitive(m, "workspace_id", &obj.WorkspaceID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "inputs", &obj.Inputs, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "settings", &obj.Settings, UnmarshalVariableData) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AgentSystemState : Computed state of the agent. +type AgentSystemState struct { + // Status while registering the agent. + State *string `json:"state,omitempty"` + + // The Agent status message. + Message *string `json:"message,omitempty"` +} + +// Constants associated with the AgentSystemState.State property. +// Status while registering the agent. +const ( + AgentSystemState_State_Error = "error" + AgentSystemState_State_Normal = "normal" +) + +// UnmarshalAgentSystemState unmarshals an instance of AgentSystemState from the specified map of raw messages. +func UnmarshalAgentSystemState(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AgentSystemState) + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ApplyWorkspaceCommandOptions : The ApplyWorkspaceCommand options. +type ApplyWorkspaceCommandOptions struct { + // The ID of the workspace for which you want to run a Schematics `apply` job. To find the workspace ID, use the `GET + // /workspaces` API. + WID *string `json:"w_id" validate:"required,ne="` + + // The IAM refresh token for the user or service identity. + // + // **Retrieving refresh token**: + // * Use `export IBMCLOUD_API_KEY=`, and execute `curl -X POST + // "https://iam.cloud.ibm.com/identity/token" -H "Content-Type: application/x-www-form-urlencoded" -d + // "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=$IBMCLOUD_API_KEY" -u bx:bx`. + // * For more information, about creating IAM access token and API Docs, refer, [IAM access + // token](/apidocs/iam-identity-token-api#gettoken-password) and [Create API + // key](/apidocs/iam-identity-token-api#create-api-key). + // + // **Limitation**: + // * If the token is expired, you can use `refresh token` to get a new IAM access token. + // * The `refresh_token` parameter cannot be used to retrieve a new IAM access token. + // * When the IAM access token is about to expire, use the API key to create a new access token. + RefreshToken *string `json:"refresh_token" validate:"required"` + + // Workspace job options template. + ActionOptions *WorkspaceActivityOptionsTemplate `json:"action_options,omitempty"` + + // The IAM delegated token for your IBM Cloud account. This token is required for requests that are sent via the UI + // only. + DelegatedToken *string `json:"delegated_token,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} - // Resource-group name for an action. By default, an action is created in `Default` resource group. - ResourceGroup *string `json:"resource_group,omitempty"` +// NewApplyWorkspaceCommandOptions : Instantiate ApplyWorkspaceCommandOptions +func (*SchematicsV1) NewApplyWorkspaceCommandOptions(wID string, refreshToken string) *ApplyWorkspaceCommandOptions { + return &ApplyWorkspaceCommandOptions{ + WID: core.StringPtr(wID), + RefreshToken: core.StringPtr(refreshToken), + } +} - // Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then - // `bastion_connection_type` is not supported. - BastionConnectionType *string `json:"bastion_connection_type,omitempty"` +// SetWID : Allow user to set WID +func (_options *ApplyWorkspaceCommandOptions) SetWID(wID string) *ApplyWorkspaceCommandOptions { + _options.WID = core.StringPtr(wID) + return _options +} - // Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system - // with the public IPs and do not support Bastion host. - InventoryConnectionType *string `json:"inventory_connection_type,omitempty"` +// SetRefreshToken : Allow user to set RefreshToken +func (_options *ApplyWorkspaceCommandOptions) SetRefreshToken(refreshToken string) *ApplyWorkspaceCommandOptions { + _options.RefreshToken = core.StringPtr(refreshToken) + return _options +} - // Action tags. - Tags []string `json:"tags,omitempty"` +// SetActionOptions : Allow user to set ActionOptions +func (_options *ApplyWorkspaceCommandOptions) SetActionOptions(actionOptions *WorkspaceActivityOptionsTemplate) *ApplyWorkspaceCommandOptions { + _options.ActionOptions = actionOptions + return _options +} - // User defined status of the Schematics object. - UserState *UserState `json:"user_state,omitempty"` +// SetDelegatedToken : Allow user to set DelegatedToken +func (_options *ApplyWorkspaceCommandOptions) SetDelegatedToken(delegatedToken string) *ApplyWorkspaceCommandOptions { + _options.DelegatedToken = core.StringPtr(delegatedToken) + return _options +} - // URL of the `README` file, for the source URL. - SourceReadmeURL *string `json:"source_readme_url,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *ApplyWorkspaceCommandOptions) SetHeaders(param map[string]string) *ApplyWorkspaceCommandOptions { + options.Headers = param + return options +} - // Source of templates, playbooks, or controls. - Source *ExternalSource `json:"source,omitempty"` +// BastionResourceDefinition : Describes a bastion resource. +type BastionResourceDefinition struct { + // Bastion Name; the name must be unique. + Name *string `json:"name,omitempty"` - // Type of source for the Template. - SourceType *string `json:"source_type,omitempty"` + // Reference to the Inventory resource definition. + Host *string `json:"host,omitempty"` +} - // Schematics job command parameter (playbook-name). - CommandParameter *string `json:"command_parameter,omitempty"` +// UnmarshalBastionResourceDefinition unmarshals an instance of BastionResourceDefinition from the specified map of raw messages. +func UnmarshalBastionResourceDefinition(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BastionResourceDefinition) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "host", &obj.Host) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Target inventory record ID, used by the action or ansible playbook. - Inventory *string `json:"inventory,omitempty"` +// Blueprint : Blueprint details with user inputs and system generated data. +type Blueprint struct { + // Blueprint name (unique for an account). + Name *string `json:"name" validate:"required"` - // credentials of the Action. - Credentials []VariableData `json:"credentials,omitempty"` + // Schema version. + SchemaVersion *string `json:"schema_version,omitempty"` - // Describes a bastion resource. - Bastion *BastionResourceDefinition `json:"bastion,omitempty"` + // Source of templates, playbooks, or controls. + Source *ExternalSource `json:"source,omitempty"` - // User editable variable data and system generated reference to the value. - BastionCredential *VariableData `json:"bastion_credential,omitempty"` + // Blueprint input configuration definition. + Config []BlueprintConfigItem `json:"config,omitempty"` - // Inventory of host and host group for the playbook in `INI` file format. For example, `"targets_ini": - // "[webserverhost] - // 172.22.192.6 - // [dbhost] - // 172.22.192.5"`. For more information, about an inventory host group syntax, see [Inventory host - // groups](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-reference#schematics-inventory-host-grps). - TargetsIni *string `json:"targets_ini,omitempty"` + // Blueprint description. + Description *string `json:"description,omitempty"` - // Input variables for the Action. - Inputs []VariableData `json:"inputs,omitempty"` + // Resource-group name for the Blueprint. By default, Blueprint will be created in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` - // Output variables for the Action. - Outputs []VariableData `json:"outputs,omitempty"` + // Blueprint instance tags. + Tags []string `json:"tags,omitempty"` - // Environment variables for the Action. - Settings []VariableData `json:"settings,omitempty"` + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` - // Action ID. - ID *string `json:"id,omitempty"` + // Additional inputs configuration for the blueprint. + Inputs []VariableData `json:"inputs,omitempty"` - // Action Cloud Resource Name. - Crn *string `json:"crn,omitempty"` + // Input environemnt settings for blueprint. + Settings []VariableData `json:"settings,omitempty"` - // Action account ID. - Account *string `json:"account,omitempty"` + // Output variables for the blueprint. + Outputs []VariableData `json:"outputs,omitempty"` - // Action Playbook Source creation time. - SourceCreatedAt *strfmt.DateTime `json:"source_created_at,omitempty"` + // Components of the blueprint. + Modules []BlueprintModule `json:"modules,omitempty"` - // E-mail address of user who created the Action Playbook Source. - SourceCreatedBy *string `json:"source_created_by,omitempty"` + // Flow definitions for all the Blueprint command. + Flow *BlueprintFlow `json:"flow,omitempty"` - // The action playbook updation time. - SourceUpdatedAt *strfmt.DateTime `json:"source_updated_at,omitempty"` + // System generated Blueprint Id. + BlueprintID *string `json:"blueprint_id,omitempty"` - // E-mail address of user who updated the action playbook source. - SourceUpdatedBy *string `json:"source_updated_by,omitempty"` + // Blueprint CRN. + Crn *string `json:"crn,omitempty"` - // Action creation time. + // Account id. + Account *string `json:"account,omitempty"` + + // Blueprint creation time. CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` - // E-mail address of the user who created an action. + // User who created the Blueprint. CreatedBy *string `json:"created_by,omitempty"` - // Action updation time. + // Blueprint updation time. UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` - // E-mail address of the user who updated an action. + // User who updated the Blueprint. UpdatedBy *string `json:"updated_by,omitempty"` - // Computed state of the Action. - State *ActionState `json:"state,omitempty"` - - // Playbook names retrieved from the repository. - PlaybookNames []string `json:"playbook_names,omitempty"` - // System lock status. SysLock *SystemLock `json:"sys_lock,omitempty"` + + // User defined status of the Schematics object. + UserState *UserState `json:"user_state,omitempty"` + + // Computed state of the Blueprint. + State *BlueprintLiteState `json:"state,omitempty"` } -// Constants associated with the Action.Location property. +// Constants associated with the Blueprint.Location property. // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, // provisioned using Schematics. const ( - Action_Location_EuDe = "eu-de" - Action_Location_EuGb = "eu-gb" - Action_Location_UsEast = "us-east" - Action_Location_UsSouth = "us-south" + Blueprint_Location_EuDe = "eu-de" + Blueprint_Location_EuGb = "eu-gb" + Blueprint_Location_UsEast = "us-east" + Blueprint_Location_UsSouth = "us-south" ) -// Constants associated with the Action.BastionConnectionType property. -// Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then -// `bastion_connection_type` is not supported. -const ( - Action_BastionConnectionType_Ssh = "ssh" -) +// NewBlueprint : Instantiate Blueprint (Generic Model Constructor) +func (*SchematicsV1) NewBlueprint(name string) (_model *Blueprint, err error) { + _model = &Blueprint{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} -// Constants associated with the Action.InventoryConnectionType property. -// Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system -// with the public IPs and do not support Bastion host. -const ( - Action_InventoryConnectionType_Ssh = "ssh" - Action_InventoryConnectionType_Winrm = "winrm" -) +// UnmarshalBlueprint unmarshals an instance of Blueprint from the specified map of raw messages. +func UnmarshalBlueprint(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Blueprint) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "schema_version", &obj.SchemaVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalExternalSource) + if err != nil { + return + } + err = core.UnmarshalModel(m, "config", &obj.Config, UnmarshalBlueprintConfigItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalModel(m, "inputs", &obj.Inputs, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "settings", &obj.Settings, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "outputs", &obj.Outputs, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "modules", &obj.Modules, UnmarshalBlueprintModule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "flow", &obj.Flow, UnmarshalBlueprintFlow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "blueprint_id", &obj.BlueprintID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.Crn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account", &obj.Account) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "sys_lock", &obj.SysLock, UnmarshalSystemLock) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_state", &obj.UserState, UnmarshalUserState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalBlueprintLiteState) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} -// Constants associated with the Action.SourceType property. -// Type of source for the Template. -const ( - Action_SourceType_ExternalScm = "external_scm" - Action_SourceType_GitHub = "git_hub" - Action_SourceType_GitHubEnterprise = "git_hub_enterprise" - Action_SourceType_GitLab = "git_lab" - Action_SourceType_IbmCloudCatalog = "ibm_cloud_catalog" - Action_SourceType_IbmGitLab = "ibm_git_lab" - Action_SourceType_Local = "local" -) +// BlueprintConfigItem : Blueprint configuration item. +type BlueprintConfigItem struct { + // Name of the blueprint configuration item. + Name *string `json:"name,omitempty"` + + // Description for the blueprint configuration item. + Description *string `json:"description,omitempty"` + + // Source of templates, playbooks, or controls. + Source *ExternalSource `json:"source,omitempty"` -// UnmarshalAction unmarshals an instance of Action from the specified map of raw messages. -func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Action) + // Input variables and values for the blueprint configuration item. + Inputs []BlueprintVariableData `json:"inputs,omitempty"` +} + +// UnmarshalBlueprintConfigItem unmarshals an instance of BlueprintConfigItem from the specified map of raw messages. +func UnmarshalBlueprintConfigItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintConfigItem) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -5666,75 +8591,262 @@ func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err erro if err != nil { return } - err = core.UnmarshalPrimitive(m, "location", &obj.Location) + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalExternalSource) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) + err = core.UnmarshalModel(m, "inputs", &obj.Inputs, UnmarshalBlueprintVariableData) if err != nil { return } - err = core.UnmarshalPrimitive(m, "bastion_connection_type", &obj.BastionConnectionType) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BlueprintFlow : Flow definitions for all the Blueprint command. +type BlueprintFlow struct { + // Blueprint flow specification. + Specs []BlueprintFlowSpecs `json:"specs,omitempty"` +} + +// UnmarshalBlueprintFlow unmarshals an instance of BlueprintFlow from the specified map of raw messages. +func UnmarshalBlueprintFlow(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintFlow) + err = core.UnmarshalModel(m, "specs", &obj.Specs, UnmarshalBlueprintFlowSpecs) if err != nil { return } - err = core.UnmarshalPrimitive(m, "inventory_connection_type", &obj.InventoryConnectionType) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BlueprintFlowSequenceFlow : BlueprintFlowSequenceFlow struct +type BlueprintFlowSequenceFlow struct { + // Sequence number in the order or execution. + SequenceNumber *int64 `json:"sequence_number,omitempty"` + + // Name of the layer or module to run this command. + ItemName *string `json:"item_name,omitempty"` +} + +// UnmarshalBlueprintFlowSequenceFlow unmarshals an instance of BlueprintFlowSequenceFlow from the specified map of raw messages. +func UnmarshalBlueprintFlowSequenceFlow(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintFlowSequenceFlow) + err = core.UnmarshalPrimitive(m, "sequence_number", &obj.SequenceNumber) if err != nil { return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "item_name", &obj.ItemName) if err != nil { return } - err = core.UnmarshalModel(m, "user_state", &obj.UserState, UnmarshalUserState) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BlueprintFlowSpecs : BlueprintFlowSpecs struct +type BlueprintFlowSpecs struct { + // Schematics job command name. + CommandName *string `json:"command_name,omitempty"` + + // Type of Blueprint flow specification. + FlowType *string `json:"flow_type,omitempty"` + + // Ordered items in the simple sequence. + SequenceFlow []BlueprintFlowSequenceFlow `json:"sequence_flow,omitempty"` + + // Placeholder for conditional flow. + ConditionalFlow *string `json:"conditional_flow,omitempty"` +} + +// Constants associated with the BlueprintFlowSpecs.CommandName property. +// Schematics job command name. +const ( + BlueprintFlowSpecs_CommandName_AnsiblePlaybookCheck = "ansible_playbook_check" + BlueprintFlowSpecs_CommandName_AnsiblePlaybookRun = "ansible_playbook_run" + BlueprintFlowSpecs_CommandName_BlueprintCreateInit = "blueprint_create_init" + BlueprintFlowSpecs_CommandName_BlueprintDelete = "blueprint_delete" + BlueprintFlowSpecs_CommandName_BlueprintDestroy = "blueprint_destroy" + BlueprintFlowSpecs_CommandName_BlueprintInstall = "blueprint_install" + BlueprintFlowSpecs_CommandName_BlueprintUpdateInit = "blueprint_update_init" + BlueprintFlowSpecs_CommandName_CreateAction = "create_action" + BlueprintFlowSpecs_CommandName_CreateCart = "create_cart" + BlueprintFlowSpecs_CommandName_CreateEnvironment = "create_environment" + BlueprintFlowSpecs_CommandName_CreateWorkspace = "create_workspace" + BlueprintFlowSpecs_CommandName_DeleteAction = "delete_action" + BlueprintFlowSpecs_CommandName_DeleteEnvironment = "delete_environment" + BlueprintFlowSpecs_CommandName_DeleteWorkspace = "delete_workspace" + BlueprintFlowSpecs_CommandName_EnvironmentCreateInit = "environment_create_init" + BlueprintFlowSpecs_CommandName_EnvironmentInstall = "environment_install" + BlueprintFlowSpecs_CommandName_EnvironmentUninstall = "environment_uninstall" + BlueprintFlowSpecs_CommandName_EnvironmentUpdateInit = "environment_update_init" + BlueprintFlowSpecs_CommandName_PatchAction = "patch_action" + BlueprintFlowSpecs_CommandName_PatchWorkspace = "patch_workspace" + BlueprintFlowSpecs_CommandName_PutAction = "put_action" + BlueprintFlowSpecs_CommandName_PutEnvironment = "put_environment" + BlueprintFlowSpecs_CommandName_PutWorkspace = "put_workspace" + BlueprintFlowSpecs_CommandName_RepositoryProcess = "repository_process" + BlueprintFlowSpecs_CommandName_SystemKeyDelete = "system_key_delete" + BlueprintFlowSpecs_CommandName_SystemKeyDisable = "system_key_disable" + BlueprintFlowSpecs_CommandName_SystemKeyEnable = "system_key_enable" + BlueprintFlowSpecs_CommandName_SystemKeyRestore = "system_key_restore" + BlueprintFlowSpecs_CommandName_SystemKeyRotate = "system_key_rotate" + BlueprintFlowSpecs_CommandName_TerraformCommands = "terraform_commands" + BlueprintFlowSpecs_CommandName_WorkspaceApply = "workspace_apply" + BlueprintFlowSpecs_CommandName_WorkspaceDestroy = "workspace_destroy" + BlueprintFlowSpecs_CommandName_WorkspacePlan = "workspace_plan" + BlueprintFlowSpecs_CommandName_WorkspaceRefresh = "workspace_refresh" +) + +// Constants associated with the BlueprintFlowSpecs.FlowType property. +// Type of Blueprint flow specification. +const ( + BlueprintFlowSpecs_FlowType_ConditionalFlow = "conditional_flow" + BlueprintFlowSpecs_FlowType_SequenceFlow = "sequence_flow" +) + +// UnmarshalBlueprintFlowSpecs unmarshals an instance of BlueprintFlowSpecs from the specified map of raw messages. +func UnmarshalBlueprintFlowSpecs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintFlowSpecs) + err = core.UnmarshalPrimitive(m, "command_name", &obj.CommandName) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_readme_url", &obj.SourceReadmeURL) + err = core.UnmarshalPrimitive(m, "flow_type", &obj.FlowType) if err != nil { return } - err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalExternalSource) + err = core.UnmarshalModel(m, "sequence_flow", &obj.SequenceFlow, UnmarshalBlueprintFlowSequenceFlow) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_type", &obj.SourceType) + err = core.UnmarshalPrimitive(m, "conditional_flow", &obj.ConditionalFlow) if err != nil { return } - err = core.UnmarshalPrimitive(m, "command_parameter", &obj.CommandParameter) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BlueprintList : List of Blueprints. +type BlueprintList struct { + // Total number of Blueprint records. + TotalCount *int64 `json:"total_count,omitempty"` + + // Number of Blueprint records returned. + Limit *int64 `json:"limit,omitempty"` + + // Skipped number of Blueprint records. + Offset *int64 `json:"offset" validate:"required"` + + // List of Blueprints. + Blueprints []BlueprintLite `json:"blueprints,omitempty"` +} + +// UnmarshalBlueprintList unmarshals an instance of BlueprintList from the specified map of raw messages. +func UnmarshalBlueprintList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintList) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } - err = core.UnmarshalPrimitive(m, "inventory", &obj.Inventory) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalModel(m, "credentials", &obj.Credentials, UnmarshalVariableData) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { return } - err = core.UnmarshalModel(m, "bastion", &obj.Bastion, UnmarshalBastionResourceDefinition) + err = core.UnmarshalModel(m, "blueprints", &obj.Blueprints, UnmarshalBlueprintLite) if err != nil { return } - err = core.UnmarshalModel(m, "bastion_credential", &obj.BastionCredential, UnmarshalVariableData) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BlueprintLite : Blueprint summary profile. +type BlueprintLite struct { + // Blueprint name (unique for an account). + Name *string `json:"name,omitempty"` + + // Blueprint description. + Description *string `json:"description,omitempty"` + + // Resource-group name for the Blueprint. By default, Blueprint will be created in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Blueprint tags. + Tags []string `json:"tags,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + + // System generated Blueprint Id. + ID *string `json:"id,omitempty"` + + // Blueprint CRN. + Crn *string `json:"crn,omitempty"` + + // Account id for the Blueprint. + Account *string `json:"account,omitempty"` + + // Blueprint creation time. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // User who created the Cart order. + CreatedBy *string `json:"created_by,omitempty"` + + // Blueprint updation time. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // User who updated the Cart order. + UpdatedBy *string `json:"updated_by,omitempty"` + + // System lock status. + SysLock *SystemLock `json:"sys_lock,omitempty"` + + // User defined status of the Schematics object. + UserState *UserState `json:"user_state,omitempty"` + + // Computed state of the Blueprint. + State *BlueprintLiteState `json:"state,omitempty"` +} + +// Constants associated with the BlueprintLite.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + BlueprintLite_Location_EuDe = "eu-de" + BlueprintLite_Location_EuGb = "eu-gb" + BlueprintLite_Location_UsEast = "us-east" + BlueprintLite_Location_UsSouth = "us-south" +) + +// UnmarshalBlueprintLite unmarshals an instance of BlueprintLite from the specified map of raw messages. +func UnmarshalBlueprintLite(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintLite) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "targets_ini", &obj.TargetsIni) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { return } - err = core.UnmarshalModel(m, "inputs", &obj.Inputs, UnmarshalVariableData) + err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) if err != nil { return } - err = core.UnmarshalModel(m, "outputs", &obj.Outputs, UnmarshalVariableData) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { return } - err = core.UnmarshalModel(m, "settings", &obj.Settings, UnmarshalVariableData) + err = core.UnmarshalPrimitive(m, "location", &obj.Location) if err != nil { return } @@ -5750,22 +8862,6 @@ func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err erro if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_created_at", &obj.SourceCreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_created_by", &obj.SourceCreatedBy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_updated_at", &obj.SourceUpdatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "source_updated_by", &obj.SourceUpdatedBy) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -5782,15 +8878,15 @@ func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err erro if err != nil { return } - err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalActionState) + err = core.UnmarshalModel(m, "sys_lock", &obj.SysLock, UnmarshalSystemLock) if err != nil { return } - err = core.UnmarshalPrimitive(m, "playbook_names", &obj.PlaybookNames) + err = core.UnmarshalModel(m, "user_state", &obj.UserState, UnmarshalUserState) if err != nil { return } - err = core.UnmarshalModel(m, "sys_lock", &obj.SysLock, UnmarshalSystemLock) + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalBlueprintLiteState) if err != nil { return } @@ -5798,37 +8894,40 @@ func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err erro return } -// ActionList : List of Action definition response. -type ActionList struct { - // Total number of records. - TotalCount *int64 `json:"total_count,omitempty"` - - // Number of records returned. - Limit *int64 `json:"limit" validate:"required"` - - // Skipped number of records. - Offset *int64 `json:"offset" validate:"required"` +// BlueprintLiteState : Computed state of the Blueprint. +type BlueprintLiteState struct { + // User-defined states + // * `Blueprint_Create_Init` When Create Blueprint POST API is invoked and CreateBlueprint process is initiated. + // * `Blueprint_Create_InProgress` When Create Blueprint process is in progress. + // * `Blueprint_Create_Success` Repos are downloaded and underlying objects are created + // * `Blueprint_Create_Failed` Failed to create Blueprint or underlying schematics objects. + StatusCode *string `json:"status_code,omitempty"` - // List of action records. - Actions []ActionLite `json:"actions,omitempty"` + // Automation status message - to be displayed along with the status_code. + StatusMessage *string `json:"status_message,omitempty"` } -// UnmarshalActionList unmarshals an instance of ActionList from the specified map of raw messages. -func UnmarshalActionList(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ActionList) - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) +// Constants associated with the BlueprintLiteState.StatusCode property. +// User-defined states +// * `Blueprint_Create_Init` When Create Blueprint POST API is invoked and CreateBlueprint process is initiated. +// * `Blueprint_Create_InProgress` When Create Blueprint process is in progress. +// * `Blueprint_Create_Success` Repos are downloaded and underlying objects are created +// * `Blueprint_Create_Failed` Failed to create Blueprint or underlying schematics objects. +const ( + BlueprintLiteState_StatusCode_BlueprintCreateFailed = "Blueprint_Create_Failed" + BlueprintLiteState_StatusCode_BlueprintCreateInit = "Blueprint_Create_Init" + BlueprintLiteState_StatusCode_BlueprintCreateInprogress = "Blueprint_Create_InProgress" + BlueprintLiteState_StatusCode_BlueprintCreateSuccess = "Blueprint_Create_Success" +) + +// UnmarshalBlueprintLiteState unmarshals an instance of BlueprintLiteState from the specified map of raw messages. +func UnmarshalBlueprintLiteState(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintLiteState) + err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) if err != nil { return } - err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalActionLite) + err = core.UnmarshalPrimitive(m, "status_message", &obj.StatusMessage) if err != nil { return } @@ -5836,134 +8935,166 @@ func UnmarshalActionList(m map[string]json.RawMessage, result interface{}) (err return } -// ActionLite : Action summary profile with user inputs and system generated data. -type ActionLite struct { - // Action name (unique for an account). +// BlueprintModule : Component for the Blueprint. +type BlueprintModule struct { + // Module id. + ModuleID *string `json:"module_id,omitempty"` + + // Name of the Schematics automation resource. + ModuleType *string `json:"module_type,omitempty"` + + // Name of the module. Name *string `json:"name,omitempty"` - // Action description. - Description *string `json:"description,omitempty"` + // Layer for the module. + Layer *string `json:"layer,omitempty"` - // Action Id. - ID *string `json:"id,omitempty"` + // Source of templates, playbooks, or controls. + Source *ExternalSource `json:"source,omitempty"` - // Action Cloud Resource Name. - Crn *string `json:"crn,omitempty"` + // Array of injectable terraform blocks. + Injectors []InjectTerraformTemplateInner `json:"injectors,omitempty"` - // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the - // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, - // provisioned using Schematics. - Location *string `json:"location,omitempty"` + // Tags used by the module. + Tags *string `json:"tags,omitempty"` - // Resource-group name for the Action. By default, Action will be created in Default Resource Group. - ResourceGroup *string `json:"resource_group,omitempty"` + // The description of the module. + Description *string `json:"description,omitempty"` - // name of the namespace. - Namespace *string `json:"namespace,omitempty"` + // The timestamp when the module was created. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` - // Action tags. - Tags []string `json:"tags,omitempty"` + // The user ID that created the module. + CreatedBy *string `json:"created_by,omitempty"` - // Name of the selected playbook. - PlaybookName *string `json:"playbook_name,omitempty"` + // The timestamp when the module was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` - // User defined status of the Schematics object. - UserState *UserState `json:"user_state,omitempty"` + // The user ID that updated the module. + UpdatedBy *string `json:"updated_by,omitempty"` - // Computed state of the Action. - State *ActionLiteState `json:"state,omitempty"` + // The Terraform version of the module that was used to run your Terraform code. + Version []string `json:"version,omitempty"` - // System lock status. - SysLock *SystemLock `json:"sys_lock,omitempty"` + // Status of the module. + Status *string `json:"status,omitempty"` - // Action creation time. - CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + // Location of the module. + Location *string `json:"location,omitempty"` - // Email address of user who created the action. - CreatedBy *string `json:"created_by,omitempty"` + // Inputs used by the module. + Inputs []BlueprintVariableData `json:"inputs,omitempty"` - // Action updation time. - UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + // Environment settings for the module. + Settings []BlueprintVariableData `json:"settings,omitempty"` - // Email address of user who updated the action. - UpdatedBy *string `json:"updated_by,omitempty"` + // True, when the blueprint module settings is updated or changed. + Updated *bool `json:"updated,omitempty"` + + // True, when there are deletions in the blueprint module settings. + Deleted *bool `json:"deleted,omitempty"` + + // Outputs from the module. + Outputs []BlueprintVariableData `json:"outputs,omitempty"` + + // Status of the last job executed by the module. + LastJob *BlueprintModuleLastJob `json:"last_job,omitempty"` } -// Constants associated with the ActionLite.Location property. -// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the -// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, -// provisioned using Schematics. +// Constants associated with the BlueprintModule.ModuleType property. +// Name of the Schematics automation resource. const ( - ActionLite_Location_EuDe = "eu-de" - ActionLite_Location_EuGb = "eu-gb" - ActionLite_Location_UsEast = "us-east" - ActionLite_Location_UsSouth = "us-south" + BlueprintModule_ModuleType_Action = "action" + BlueprintModule_ModuleType_Blueprint = "blueprint" + BlueprintModule_ModuleType_Environment = "environment" + BlueprintModule_ModuleType_System = "system" + BlueprintModule_ModuleType_Workspace = "workspace" ) -// UnmarshalActionLite unmarshals an instance of ActionLite from the specified map of raw messages. -func UnmarshalActionLite(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ActionLite) +// UnmarshalBlueprintModule unmarshals an instance of BlueprintModule from the specified map of raw messages. +func UnmarshalBlueprintModule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintModule) + err = core.UnmarshalPrimitive(m, "module_id", &obj.ModuleID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "module_type", &obj.ModuleType) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "layer", &obj.Layer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalExternalSource) + if err != nil { + return + } + err = core.UnmarshalModel(m, "injectors", &obj.Injectors, UnmarshalInjectTerraformTemplateInner) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.Crn) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "location", &obj.Location) + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) if err != nil { return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { return } - err = core.UnmarshalPrimitive(m, "playbook_name", &obj.PlaybookName) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { return } - err = core.UnmarshalModel(m, "user_state", &obj.UserState, UnmarshalUserState) + err = core.UnmarshalPrimitive(m, "location", &obj.Location) if err != nil { return } - err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalActionLiteState) + err = core.UnmarshalModel(m, "inputs", &obj.Inputs, UnmarshalBlueprintVariableData) if err != nil { return } - err = core.UnmarshalModel(m, "sys_lock", &obj.SysLock, UnmarshalSystemLock) + err = core.UnmarshalModel(m, "settings", &obj.Settings, UnmarshalBlueprintVariableData) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + err = core.UnmarshalPrimitive(m, "deleted", &obj.Deleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + err = core.UnmarshalModel(m, "outputs", &obj.Outputs, UnmarshalBlueprintVariableData) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + err = core.UnmarshalModel(m, "last_job", &obj.LastJob, UnmarshalBlueprintModuleLastJob) if err != nil { return } @@ -5971,72 +9102,103 @@ func UnmarshalActionLite(m map[string]json.RawMessage, result interface{}) (err return } -// ActionLiteState : Computed state of the Action. -type ActionLiteState struct { - // Status of automation (workspace or action). - StatusCode *string `json:"status_code,omitempty"` +// BlueprintModuleLastJob : Status of the last job executed by the module. +type BlueprintModuleLastJob struct { + // Name of the Schematics automation resource. + CommandObject *string `json:"command_object,omitempty"` - // Automation status message - to be displayed along with the status_code. - StatusMessage *string `json:"status_message,omitempty"` + // Name of the command object id, maps to workspace_name or action_name. + CommandObjectName *string `json:"command_object_name,omitempty"` + + // Module command object id, maps to workspace_id or action_id. + CommandObjectID *string `json:"command_object_id,omitempty"` + + // Schematics job command name. + CommandName *string `json:"command_name,omitempty"` + + // Status of Jobs. + JobStatus *string `json:"job_status,omitempty"` } -// Constants associated with the ActionLiteState.StatusCode property. -// Status of automation (workspace or action). +// Constants associated with the BlueprintModuleLastJob.CommandObject property. +// Name of the Schematics automation resource. const ( - ActionLiteState_StatusCode_Critical = "critical" - ActionLiteState_StatusCode_Disabled = "disabled" - ActionLiteState_StatusCode_Normal = "normal" - ActionLiteState_StatusCode_Pending = "pending" + BlueprintModuleLastJob_CommandObject_Action = "action" + BlueprintModuleLastJob_CommandObject_Blueprint = "blueprint" + BlueprintModuleLastJob_CommandObject_Environment = "environment" + BlueprintModuleLastJob_CommandObject_System = "system" + BlueprintModuleLastJob_CommandObject_Workspace = "workspace" ) -// UnmarshalActionLiteState unmarshals an instance of ActionLiteState from the specified map of raw messages. -func UnmarshalActionLiteState(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ActionLiteState) - err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) +// Constants associated with the BlueprintModuleLastJob.CommandName property. +// Schematics job command name. +const ( + BlueprintModuleLastJob_CommandName_AnsiblePlaybookCheck = "ansible_playbook_check" + BlueprintModuleLastJob_CommandName_AnsiblePlaybookRun = "ansible_playbook_run" + BlueprintModuleLastJob_CommandName_BlueprintCreateInit = "blueprint_create_init" + BlueprintModuleLastJob_CommandName_BlueprintDelete = "blueprint_delete" + BlueprintModuleLastJob_CommandName_BlueprintDestroy = "blueprint_destroy" + BlueprintModuleLastJob_CommandName_BlueprintInstall = "blueprint_install" + BlueprintModuleLastJob_CommandName_BlueprintUpdateInit = "blueprint_update_init" + BlueprintModuleLastJob_CommandName_CreateAction = "create_action" + BlueprintModuleLastJob_CommandName_CreateCart = "create_cart" + BlueprintModuleLastJob_CommandName_CreateEnvironment = "create_environment" + BlueprintModuleLastJob_CommandName_CreateWorkspace = "create_workspace" + BlueprintModuleLastJob_CommandName_DeleteAction = "delete_action" + BlueprintModuleLastJob_CommandName_DeleteEnvironment = "delete_environment" + BlueprintModuleLastJob_CommandName_DeleteWorkspace = "delete_workspace" + BlueprintModuleLastJob_CommandName_EnvironmentCreateInit = "environment_create_init" + BlueprintModuleLastJob_CommandName_EnvironmentInstall = "environment_install" + BlueprintModuleLastJob_CommandName_EnvironmentUninstall = "environment_uninstall" + BlueprintModuleLastJob_CommandName_EnvironmentUpdateInit = "environment_update_init" + BlueprintModuleLastJob_CommandName_PatchAction = "patch_action" + BlueprintModuleLastJob_CommandName_PatchWorkspace = "patch_workspace" + BlueprintModuleLastJob_CommandName_PutAction = "put_action" + BlueprintModuleLastJob_CommandName_PutEnvironment = "put_environment" + BlueprintModuleLastJob_CommandName_PutWorkspace = "put_workspace" + BlueprintModuleLastJob_CommandName_RepositoryProcess = "repository_process" + BlueprintModuleLastJob_CommandName_SystemKeyDelete = "system_key_delete" + BlueprintModuleLastJob_CommandName_SystemKeyDisable = "system_key_disable" + BlueprintModuleLastJob_CommandName_SystemKeyEnable = "system_key_enable" + BlueprintModuleLastJob_CommandName_SystemKeyRestore = "system_key_restore" + BlueprintModuleLastJob_CommandName_SystemKeyRotate = "system_key_rotate" + BlueprintModuleLastJob_CommandName_TerraformCommands = "terraform_commands" + BlueprintModuleLastJob_CommandName_WorkspaceApply = "workspace_apply" + BlueprintModuleLastJob_CommandName_WorkspaceDestroy = "workspace_destroy" + BlueprintModuleLastJob_CommandName_WorkspacePlan = "workspace_plan" + BlueprintModuleLastJob_CommandName_WorkspaceRefresh = "workspace_refresh" +) + +// Constants associated with the BlueprintModuleLastJob.JobStatus property. +// Status of Jobs. +const ( + BlueprintModuleLastJob_JobStatus_JobCancelled = "job_cancelled" + BlueprintModuleLastJob_JobStatus_JobFailed = "job_failed" + BlueprintModuleLastJob_JobStatus_JobFinished = "job_finished" + BlueprintModuleLastJob_JobStatus_JobInProgress = "job_in_progress" + BlueprintModuleLastJob_JobStatus_JobPending = "job_pending" +) + +// UnmarshalBlueprintModuleLastJob unmarshals an instance of BlueprintModuleLastJob from the specified map of raw messages. +func UnmarshalBlueprintModuleLastJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintModuleLastJob) + err = core.UnmarshalPrimitive(m, "command_object", &obj.CommandObject) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status_message", &obj.StatusMessage) + err = core.UnmarshalPrimitive(m, "command_object_name", &obj.CommandObjectName) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ActionState : Computed state of the Action. -type ActionState struct { - // Status of automation (workspace or action). - StatusCode *string `json:"status_code,omitempty"` - - // Job id reference for this status. - StatusJobID *string `json:"status_job_id,omitempty"` - - // Automation status message - to be displayed along with the status_code. - StatusMessage *string `json:"status_message,omitempty"` -} - -// Constants associated with the ActionState.StatusCode property. -// Status of automation (workspace or action). -const ( - ActionState_StatusCode_Critical = "critical" - ActionState_StatusCode_Disabled = "disabled" - ActionState_StatusCode_Normal = "normal" - ActionState_StatusCode_Pending = "pending" -) - -// UnmarshalActionState unmarshals an instance of ActionState from the specified map of raw messages. -func UnmarshalActionState(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ActionState) - err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) + err = core.UnmarshalPrimitive(m, "command_object_id", &obj.CommandObjectID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status_job_id", &obj.StatusJobID) + err = core.UnmarshalPrimitive(m, "command_name", &obj.CommandName) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status_message", &obj.StatusMessage) + err = core.UnmarshalPrimitive(m, "job_status", &obj.JobStatus) if err != nil { return } @@ -6044,94 +9206,30 @@ func UnmarshalActionState(m map[string]json.RawMessage, result interface{}) (err return } -// ApplyWorkspaceCommandOptions : The ApplyWorkspaceCommand options. -type ApplyWorkspaceCommandOptions struct { - // The ID of the workspace for which you want to run a Schematics `apply` job. To find the workspace ID, use the `GET - // /workspaces` API. - WID *string `json:"w_id" validate:"required,ne="` - - // The IAM refresh token for the user or service identity. - // - // **Retrieving refresh token**: - // * Use `export IBMCLOUD_API_KEY=`, and execute `curl -X POST - // "https://iam.cloud.ibm.com/identity/token" -H "Content-Type: application/x-www-form-urlencoded" -d - // "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=$IBMCLOUD_API_KEY" -u bx:bx`. - // * For more information, about creating IAM access token and API Docs, refer, [IAM access - // token](/apidocs/iam-identity-token-api#gettoken-password) and [Create API - // key](/apidocs/iam-identity-token-api#create-api-key). - // - // **Limitation**: - // * If the token is expired, you can use `refresh token` to get a new IAM access token. - // * The `refresh_token` parameter cannot be used to retrieve a new IAM access token. - // * When the IAM access token is about to expire, use the API key to create a new access token. - RefreshToken *string `json:"refresh_token" validate:"required"` - - // Workspace job options template. - ActionOptions *WorkspaceActivityOptionsTemplate `json:"action_options,omitempty"` - - // The IAM delegated token for your IBM Cloud account. This token is required for requests that are sent via the UI - // only. - DelegatedToken *string `json:"delegated_token,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewApplyWorkspaceCommandOptions : Instantiate ApplyWorkspaceCommandOptions -func (*SchematicsV1) NewApplyWorkspaceCommandOptions(wID string, refreshToken string) *ApplyWorkspaceCommandOptions { - return &ApplyWorkspaceCommandOptions{ - WID: core.StringPtr(wID), - RefreshToken: core.StringPtr(refreshToken), - } -} - -// SetWID : Allow user to set WID -func (_options *ApplyWorkspaceCommandOptions) SetWID(wID string) *ApplyWorkspaceCommandOptions { - _options.WID = core.StringPtr(wID) - return _options -} - -// SetRefreshToken : Allow user to set RefreshToken -func (_options *ApplyWorkspaceCommandOptions) SetRefreshToken(refreshToken string) *ApplyWorkspaceCommandOptions { - _options.RefreshToken = core.StringPtr(refreshToken) - return _options -} - -// SetActionOptions : Allow user to set ActionOptions -func (_options *ApplyWorkspaceCommandOptions) SetActionOptions(actionOptions *WorkspaceActivityOptionsTemplate) *ApplyWorkspaceCommandOptions { - _options.ActionOptions = actionOptions - return _options -} - -// SetDelegatedToken : Allow user to set DelegatedToken -func (_options *ApplyWorkspaceCommandOptions) SetDelegatedToken(delegatedToken string) *ApplyWorkspaceCommandOptions { - _options.DelegatedToken = core.StringPtr(delegatedToken) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ApplyWorkspaceCommandOptions) SetHeaders(param map[string]string) *ApplyWorkspaceCommandOptions { - options.Headers = param - return options -} - -// BastionResourceDefinition : Describes a bastion resource. -type BastionResourceDefinition struct { - // Bastion Name(Unique). +// BlueprintVariableData : User editable variable data & system generated reference to value. +type BlueprintVariableData struct { + // Name of the variable. Name *string `json:"name,omitempty"` - // Reference to the Inventory resource definition. - Host *string `json:"host,omitempty"` + // Value for the variable or reference to the value. + Value *string `json:"value,omitempty"` + + // Reference link to the variable value By default the expression will point to self.value. + Link *string `json:"link,omitempty"` } -// UnmarshalBastionResourceDefinition unmarshals an instance of BastionResourceDefinition from the specified map of raw messages. -func UnmarshalBastionResourceDefinition(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BastionResourceDefinition) +// UnmarshalBlueprintVariableData unmarshals an instance of BlueprintVariableData from the specified map of raw messages. +func UnmarshalBlueprintVariableData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BlueprintVariableData) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "host", &obj.Host) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "link", &obj.Link) if err != nil { return } @@ -6214,6 +9312,79 @@ func UnmarshalCatalogRef(m map[string]json.RawMessage, result interface{}) (err return } +// CatalogSource : The connection details to the IBM Cloud Catalog source. +type CatalogSource struct { + // The name of the private catalog. + CatalogName *string `json:"catalog_name,omitempty"` + + // The name of an offering in the IBM Cloud Catalog. + OfferingName *string `json:"offering_name,omitempty"` + + // The version string of an offering in the IBM Cloud Catalog. + OfferingVersion *string `json:"offering_version,omitempty"` + + // The type of an offering, in the IBM Cloud Catalog. + OfferingKind *string `json:"offering_kind,omitempty"` + + // The ID of a private catalog. + CatalogID *string `json:"catalog_id,omitempty"` + + // The ID of an offering in the IBM Cloud Catalog. + OfferingID *string `json:"offering_id,omitempty"` + + // The ID of an offering version the IBM Cloud Catalog. + OfferingVersionID *string `json:"offering_version_id,omitempty"` + + // The repository URL of an offering, in the IBM Cloud Catalog. + OfferingRepoURL *string `json:"offering_repo_url,omitempty"` + + // Root folder name in .tgz file. + OfferingProvisionerWorkingDirectory *string `json:"offering_provisioner_working_directory,omitempty"` +} + +// UnmarshalCatalogSource unmarshals an instance of CatalogSource from the specified map of raw messages. +func UnmarshalCatalogSource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogSource) + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_name", &obj.OfferingName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_version", &obj.OfferingVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_kind", &obj.OfferingKind) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_id", &obj.OfferingID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_version_id", &obj.OfferingVersionID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_repo_url", &obj.OfferingRepoURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_provisioner_working_directory", &obj.OfferingProvisionerWorkingDirectory) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // CommandsInfo : Workspace commands run as part of the job. type CommandsInfo struct { // Name of the command. @@ -6477,11 +9648,46 @@ func UnmarshalConnectionLite(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ConnectionState : Connection status of the agent. +type ConnectionState struct { + // Agent Connection Status + // * `Connected` When Schematics is able to connect to the agent. + // * `Disconnected` When Schematics is able not connect to the agent. + State *string `json:"state,omitempty"` + + // When the connection state is modified. + CheckedAt *strfmt.DateTime `json:"checked_at,omitempty"` +} + +// Constants associated with the ConnectionState.State property. +// Agent Connection Status +// * `Connected` When Schematics is able to connect to the agent. +// * `Disconnected` When Schematics is able not connect to the agent. +const ( + ConnectionState_State_Connected = "Connected" + ConnectionState_State_Disconnected = "Disconnected" +) + +// UnmarshalConnectionState unmarshals an instance of ConnectionState from the specified map of raw messages. +func UnmarshalConnectionState(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConnectionState) + err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + err = core.UnmarshalPrimitive(m, "checked_at", &obj.CheckedAt) if err != nil { return } @@ -6506,12 +9712,12 @@ type CreateActionOptions struct { // Resource-group name for an action. By default, an action is created in `Default` resource group. ResourceGroup *string `json:"resource_group,omitempty"` - // Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then + // Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then // `bastion_connection_type` is not supported. BastionConnectionType *string `json:"bastion_connection_type,omitempty"` - // Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system - // with the public IPs and do not support Bastion host. + // Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows + // system with the public IPs and do not support Bastion host. InventoryConnectionType *string `json:"inventory_connection_type,omitempty"` // Action tags. @@ -6536,13 +9742,13 @@ type CreateActionOptions struct { Inventory *string `json:"inventory,omitempty"` // credentials of the Action. - Credentials []VariableData `json:"credentials,omitempty"` + Credentials []CredentialVariableData `json:"credentials,omitempty"` // Describes a bastion resource. Bastion *BastionResourceDefinition `json:"bastion,omitempty"` - // User editable variable data and system generated reference to the value. - BastionCredential *VariableData `json:"bastion_credential,omitempty"` + // User editable credential variable data and system generated reference to the value. + BastionCredential *CredentialVariableData `json:"bastion_credential,omitempty"` // Inventory of host and host group for the playbook in `INI` file format. For example, `"targets_ini": // "[webserverhost] @@ -6587,14 +9793,14 @@ const ( ) // Constants associated with the CreateActionOptions.BastionConnectionType property. -// Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then +// Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then // `bastion_connection_type` is not supported. const ( CreateActionOptions_BastionConnectionType_Ssh = "ssh" ) // Constants associated with the CreateActionOptions.InventoryConnectionType property. -// Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system +// Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system // with the public IPs and do not support Bastion host. const ( CreateActionOptions_InventoryConnectionType_Ssh = "ssh" @@ -6604,7 +9810,6 @@ const ( // Constants associated with the CreateActionOptions.SourceType property. // Type of source for the Template. const ( - CreateActionOptions_SourceType_ExternalScm = "external_scm" CreateActionOptions_SourceType_GitHub = "git_hub" CreateActionOptions_SourceType_GitHubEnterprise = "git_hub_enterprise" CreateActionOptions_SourceType_GitLab = "git_lab" @@ -6697,7 +9902,7 @@ func (_options *CreateActionOptions) SetInventory(inventory string) *CreateActio } // SetCredentials : Allow user to set Credentials -func (_options *CreateActionOptions) SetCredentials(credentials []VariableData) *CreateActionOptions { +func (_options *CreateActionOptions) SetCredentials(credentials []CredentialVariableData) *CreateActionOptions { _options.Credentials = credentials return _options } @@ -6709,7 +9914,7 @@ func (_options *CreateActionOptions) SetBastion(bastion *BastionResourceDefiniti } // SetBastionCredential : Allow user to set BastionCredential -func (_options *CreateActionOptions) SetBastionCredential(bastionCredential *VariableData) *CreateActionOptions { +func (_options *CreateActionOptions) SetBastionCredential(bastionCredential *CredentialVariableData) *CreateActionOptions { _options.BastionCredential = bastionCredential return _options } @@ -6762,6 +9967,164 @@ func (options *CreateActionOptions) SetHeaders(param map[string]string) *CreateA return options } +// CreateBlueprintOptions : The CreateBlueprint options. +type CreateBlueprintOptions struct { + // Blueprint name (unique for an account). + Name *string `json:"name" validate:"required"` + + // Schema version. + SchemaVersion *string `json:"schema_version,omitempty"` + + // Source of templates, playbooks, or controls. + Source *ExternalSource `json:"source,omitempty"` + + // Blueprint input configuration definition. + Config []BlueprintConfigItem `json:"config,omitempty"` + + // Blueprint description. + Description *string `json:"description,omitempty"` + + // Resource-group name for the Blueprint. By default, Blueprint will be created in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Blueprint instance tags. + Tags []string `json:"tags,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + + // Additional inputs configuration for the blueprint. + Inputs []VariableData `json:"inputs,omitempty"` + + // Input environemnt settings for blueprint. + Settings []VariableData `json:"settings,omitempty"` + + // Flow definitions for all the Blueprint command. + Flow *BlueprintFlow `json:"flow,omitempty"` + + // System lock status. + SysLock *SystemLock `json:"sys_lock,omitempty"` + + // User defined status of the Schematics object. + UserState *UserState `json:"user_state,omitempty"` + + // Computed state of the Blueprint. + State *BlueprintLiteState `json:"state,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateBlueprintOptions.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + CreateBlueprintOptions_Location_EuDe = "eu-de" + CreateBlueprintOptions_Location_EuGb = "eu-gb" + CreateBlueprintOptions_Location_UsEast = "us-east" + CreateBlueprintOptions_Location_UsSouth = "us-south" +) + +// NewCreateBlueprintOptions : Instantiate CreateBlueprintOptions +func (*SchematicsV1) NewCreateBlueprintOptions(name string) *CreateBlueprintOptions { + return &CreateBlueprintOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *CreateBlueprintOptions) SetName(name string) *CreateBlueprintOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSchemaVersion : Allow user to set SchemaVersion +func (_options *CreateBlueprintOptions) SetSchemaVersion(schemaVersion string) *CreateBlueprintOptions { + _options.SchemaVersion = core.StringPtr(schemaVersion) + return _options +} + +// SetSource : Allow user to set Source +func (_options *CreateBlueprintOptions) SetSource(source *ExternalSource) *CreateBlueprintOptions { + _options.Source = source + return _options +} + +// SetConfig : Allow user to set Config +func (_options *CreateBlueprintOptions) SetConfig(config []BlueprintConfigItem) *CreateBlueprintOptions { + _options.Config = config + return _options +} + +// SetDescription : Allow user to set Description +func (_options *CreateBlueprintOptions) SetDescription(description string) *CreateBlueprintOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateBlueprintOptions) SetResourceGroup(resourceGroup string) *CreateBlueprintOptions { + _options.ResourceGroup = core.StringPtr(resourceGroup) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *CreateBlueprintOptions) SetTags(tags []string) *CreateBlueprintOptions { + _options.Tags = tags + return _options +} + +// SetLocation : Allow user to set Location +func (_options *CreateBlueprintOptions) SetLocation(location string) *CreateBlueprintOptions { + _options.Location = core.StringPtr(location) + return _options +} + +// SetInputs : Allow user to set Inputs +func (_options *CreateBlueprintOptions) SetInputs(inputs []VariableData) *CreateBlueprintOptions { + _options.Inputs = inputs + return _options +} + +// SetSettings : Allow user to set Settings +func (_options *CreateBlueprintOptions) SetSettings(settings []VariableData) *CreateBlueprintOptions { + _options.Settings = settings + return _options +} + +// SetFlow : Allow user to set Flow +func (_options *CreateBlueprintOptions) SetFlow(flow *BlueprintFlow) *CreateBlueprintOptions { + _options.Flow = flow + return _options +} + +// SetSysLock : Allow user to set SysLock +func (_options *CreateBlueprintOptions) SetSysLock(sysLock *SystemLock) *CreateBlueprintOptions { + _options.SysLock = sysLock + return _options +} + +// SetUserState : Allow user to set UserState +func (_options *CreateBlueprintOptions) SetUserState(userState *UserState) *CreateBlueprintOptions { + _options.UserState = userState + return _options +} + +// SetState : Allow user to set State +func (_options *CreateBlueprintOptions) SetState(state *BlueprintLiteState) *CreateBlueprintOptions { + _options.State = state + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBlueprintOptions) SetHeaders(param map[string]string) *CreateBlueprintOptions { + options.Headers = param + return options +} + // CreateConnectionOptions : The CreateConnection options. type CreateConnectionOptions struct { // connection name (unique for an account). @@ -6868,13 +10231,41 @@ type CreateDatasourceOptions struct { // data source tags. Tags []string `json:"tags,omitempty"` + // Datasource types. + Type *string `json:"type,omitempty"` + // Named connection from settings. Connection *string `json:"connection,omitempty"` + DatasourceProperties []VariableData `json:"datasource_properties,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } +// Constants associated with the CreateDatasourceOptions.Type property. +// Datasource types. +const ( + CreateDatasourceOptions_Type_External = "external" + CreateDatasourceOptions_Type_Internal = "internal" +) + +// Constants associated with the CreateDatasourceOptions.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + CreateDatasourceOptions_Location_EuDe = "eu-de" + CreateDatasourceOptions_Location_EuGb = "eu-gb" + CreateDatasourceOptions_Location_UsEast = "us-east" + CreateDatasourceOptions_Location_UsSouth = "us-south" +) + // NewCreateDatasourceOptions : Instantiate CreateDatasourceOptions func (*SchematicsV1) NewCreateDatasourceOptions() *CreateDatasourceOptions { return &CreateDatasourceOptions{} @@ -6904,12 +10295,30 @@ func (_options *CreateDatasourceOptions) SetTags(tags []string) *CreateDatasourc return _options } +// SetType : Allow user to set Type +func (_options *CreateDatasourceOptions) SetType(typeVar string) *CreateDatasourceOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + // SetConnection : Allow user to set Connection func (_options *CreateDatasourceOptions) SetConnection(connection string) *CreateDatasourceOptions { _options.Connection = core.StringPtr(connection) return _options } +// SetDatasourceProperties : Allow user to set DatasourceProperties +func (_options *CreateDatasourceOptions) SetDatasourceProperties(datasourceProperties []VariableData) *CreateDatasourceOptions { + _options.DatasourceProperties = datasourceProperties + return _options +} + +// SetLocation : Allow user to set Location +func (_options *CreateDatasourceOptions) SetLocation(location string) *CreateDatasourceOptions { + _options.Location = core.StringPtr(location) + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateDatasourceOptions) SetHeaders(param map[string]string) *CreateDatasourceOptions { options.Headers = param @@ -7070,6 +10479,7 @@ type CreateJobOptions struct { // Name of the Schematics automation resource. const ( CreateJobOptions_CommandObject_Action = "action" + CreateJobOptions_CommandObject_Blueprint = "blueprint" CreateJobOptions_CommandObject_Environment = "environment" CreateJobOptions_CommandObject_System = "system" CreateJobOptions_CommandObject_Workspace = "workspace" @@ -7080,6 +10490,11 @@ const ( const ( CreateJobOptions_CommandName_AnsiblePlaybookCheck = "ansible_playbook_check" CreateJobOptions_CommandName_AnsiblePlaybookRun = "ansible_playbook_run" + CreateJobOptions_CommandName_BlueprintCreateInit = "blueprint_create_init" + CreateJobOptions_CommandName_BlueprintDelete = "blueprint_delete" + CreateJobOptions_CommandName_BlueprintDestroy = "blueprint_destroy" + CreateJobOptions_CommandName_BlueprintInstall = "blueprint_install" + CreateJobOptions_CommandName_BlueprintUpdateInit = "blueprint_update_init" CreateJobOptions_CommandName_CreateAction = "create_action" CreateJobOptions_CommandName_CreateCart = "create_cart" CreateJobOptions_CommandName_CreateEnvironment = "create_environment" @@ -7087,9 +10502,10 @@ const ( CreateJobOptions_CommandName_DeleteAction = "delete_action" CreateJobOptions_CommandName_DeleteEnvironment = "delete_environment" CreateJobOptions_CommandName_DeleteWorkspace = "delete_workspace" - CreateJobOptions_CommandName_EnvironmentInit = "environment_init" + CreateJobOptions_CommandName_EnvironmentCreateInit = "environment_create_init" CreateJobOptions_CommandName_EnvironmentInstall = "environment_install" CreateJobOptions_CommandName_EnvironmentUninstall = "environment_uninstall" + CreateJobOptions_CommandName_EnvironmentUpdateInit = "environment_update_init" CreateJobOptions_CommandName_PatchAction = "patch_action" CreateJobOptions_CommandName_PatchWorkspace = "patch_workspace" CreateJobOptions_CommandName_PutAction = "put_action" @@ -7144,74 +10560,195 @@ func (_options *CreateJobOptions) SetCommandObjectID(commandObjectID string) *Cr return _options } -// SetCommandName : Allow user to set CommandName -func (_options *CreateJobOptions) SetCommandName(commandName string) *CreateJobOptions { - _options.CommandName = core.StringPtr(commandName) - return _options +// SetCommandName : Allow user to set CommandName +func (_options *CreateJobOptions) SetCommandName(commandName string) *CreateJobOptions { + _options.CommandName = core.StringPtr(commandName) + return _options +} + +// SetCommandParameter : Allow user to set CommandParameter +func (_options *CreateJobOptions) SetCommandParameter(commandParameter string) *CreateJobOptions { + _options.CommandParameter = core.StringPtr(commandParameter) + return _options +} + +// SetCommandOptions : Allow user to set CommandOptions +func (_options *CreateJobOptions) SetCommandOptions(commandOptions []string) *CreateJobOptions { + _options.CommandOptions = commandOptions + return _options +} + +// SetInputs : Allow user to set Inputs +func (_options *CreateJobOptions) SetInputs(inputs []VariableData) *CreateJobOptions { + _options.Inputs = inputs + return _options +} + +// SetSettings : Allow user to set Settings +func (_options *CreateJobOptions) SetSettings(settings []VariableData) *CreateJobOptions { + _options.Settings = settings + return _options +} + +// SetTags : Allow user to set Tags +func (_options *CreateJobOptions) SetTags(tags []string) *CreateJobOptions { + _options.Tags = tags + return _options +} + +// SetLocation : Allow user to set Location +func (_options *CreateJobOptions) SetLocation(location string) *CreateJobOptions { + _options.Location = core.StringPtr(location) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *CreateJobOptions) SetStatus(status *JobStatus) *CreateJobOptions { + _options.Status = status + return _options +} + +// SetData : Allow user to set Data +func (_options *CreateJobOptions) SetData(data *JobData) *CreateJobOptions { + _options.Data = data + return _options +} + +// SetBastion : Allow user to set Bastion +func (_options *CreateJobOptions) SetBastion(bastion *BastionResourceDefinition) *CreateJobOptions { + _options.Bastion = bastion + return _options +} + +// SetLogSummary : Allow user to set LogSummary +func (_options *CreateJobOptions) SetLogSummary(logSummary *JobLogSummary) *CreateJobOptions { + _options.LogSummary = logSummary + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateJobOptions) SetHeaders(param map[string]string) *CreateJobOptions { + options.Headers = param + return options +} + +// CreatePolicyOptions : The CreatePolicy options. +type CreatePolicyOptions struct { + // Policy kind or categories for managing and deriving policy decision + // * `agent_assignment_policy` Agent assignment policy for job execution. + PolicyKind *string `json:"policy_kind" validate:"required"` + + // Name of Schematics customization policy. + Name *string `json:"name,omitempty"` + + // The description of Schematics customization policy. + Description *string `json:"description,omitempty"` + + // The resource group name for the policy. By default, Policy will be created in `default` Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Tags for the Schematics customization policy. + Tags []string `json:"tags,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + + // User defined status of the Schematics object. + State *UserState `json:"state,omitempty"` + + // The objects for the Schematics policy. + PolicyTarget *PolicyObjects `json:"policy_target,omitempty"` + + // The parameter to tune the Schematics policy. + PolicyParameter *PolicyParameter `json:"policy_parameter,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreatePolicyOptions.PolicyKind property. +// Policy kind or categories for managing and deriving policy decision +// * `agent_assignment_policy` Agent assignment policy for job execution. +const ( + CreatePolicyOptions_PolicyKind_AgentAssignmentPolicy = "agent_assignment_policy" +) + +// Constants associated with the CreatePolicyOptions.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + CreatePolicyOptions_Location_EuDe = "eu-de" + CreatePolicyOptions_Location_EuGb = "eu-gb" + CreatePolicyOptions_Location_UsEast = "us-east" + CreatePolicyOptions_Location_UsSouth = "us-south" +) + +// NewCreatePolicyOptions : Instantiate CreatePolicyOptions +func (*SchematicsV1) NewCreatePolicyOptions(policyKind string) *CreatePolicyOptions { + return &CreatePolicyOptions{ + PolicyKind: core.StringPtr(policyKind), + } } -// SetCommandParameter : Allow user to set CommandParameter -func (_options *CreateJobOptions) SetCommandParameter(commandParameter string) *CreateJobOptions { - _options.CommandParameter = core.StringPtr(commandParameter) +// SetPolicyKind : Allow user to set PolicyKind +func (_options *CreatePolicyOptions) SetPolicyKind(policyKind string) *CreatePolicyOptions { + _options.PolicyKind = core.StringPtr(policyKind) return _options } -// SetCommandOptions : Allow user to set CommandOptions -func (_options *CreateJobOptions) SetCommandOptions(commandOptions []string) *CreateJobOptions { - _options.CommandOptions = commandOptions +// SetName : Allow user to set Name +func (_options *CreatePolicyOptions) SetName(name string) *CreatePolicyOptions { + _options.Name = core.StringPtr(name) return _options } -// SetInputs : Allow user to set Inputs -func (_options *CreateJobOptions) SetInputs(inputs []VariableData) *CreateJobOptions { - _options.Inputs = inputs +// SetDescription : Allow user to set Description +func (_options *CreatePolicyOptions) SetDescription(description string) *CreatePolicyOptions { + _options.Description = core.StringPtr(description) return _options } -// SetSettings : Allow user to set Settings -func (_options *CreateJobOptions) SetSettings(settings []VariableData) *CreateJobOptions { - _options.Settings = settings +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePolicyOptions) SetResourceGroup(resourceGroup string) *CreatePolicyOptions { + _options.ResourceGroup = core.StringPtr(resourceGroup) return _options } // SetTags : Allow user to set Tags -func (_options *CreateJobOptions) SetTags(tags []string) *CreateJobOptions { +func (_options *CreatePolicyOptions) SetTags(tags []string) *CreatePolicyOptions { _options.Tags = tags return _options } // SetLocation : Allow user to set Location -func (_options *CreateJobOptions) SetLocation(location string) *CreateJobOptions { +func (_options *CreatePolicyOptions) SetLocation(location string) *CreatePolicyOptions { _options.Location = core.StringPtr(location) return _options } -// SetStatus : Allow user to set Status -func (_options *CreateJobOptions) SetStatus(status *JobStatus) *CreateJobOptions { - _options.Status = status - return _options -} - -// SetData : Allow user to set Data -func (_options *CreateJobOptions) SetData(data *JobData) *CreateJobOptions { - _options.Data = data +// SetState : Allow user to set State +func (_options *CreatePolicyOptions) SetState(state *UserState) *CreatePolicyOptions { + _options.State = state return _options } -// SetBastion : Allow user to set Bastion -func (_options *CreateJobOptions) SetBastion(bastion *BastionResourceDefinition) *CreateJobOptions { - _options.Bastion = bastion +// SetPolicyTarget : Allow user to set PolicyTarget +func (_options *CreatePolicyOptions) SetPolicyTarget(policyTarget *PolicyObjects) *CreatePolicyOptions { + _options.PolicyTarget = policyTarget return _options } -// SetLogSummary : Allow user to set LogSummary -func (_options *CreateJobOptions) SetLogSummary(logSummary *JobLogSummary) *CreateJobOptions { - _options.LogSummary = logSummary +// SetPolicyParameter : Allow user to set PolicyParameter +func (_options *CreatePolicyOptions) SetPolicyParameter(policyParameter *PolicyParameter) *CreatePolicyOptions { + _options.PolicyParameter = policyParameter return _options } // SetHeaders : Allow user to set Headers -func (options *CreateJobOptions) SetHeaders(param map[string]string) *CreateJobOptions { +func (options *CreatePolicyOptions) SetHeaders(param map[string]string) *CreatePolicyOptions { options.Headers = param return options } @@ -7385,6 +10922,9 @@ type CreateWorkspaceOptions struct { // WorkspaceStatusRequest -. WorkspaceStatus *WorkspaceStatusRequest `json:"workspace_status,omitempty"` + // agent id which is binded to with the workspace. + AgentID *string `json:"agent_id,omitempty"` + // The personal access token to authenticate with your private GitHub or GitLab repository and access your Terraform // template. XGithubToken *string `json:"X-Github-token,omitempty"` @@ -7482,6 +11022,12 @@ func (_options *CreateWorkspaceOptions) SetWorkspaceStatus(workspaceStatus *Work return _options } +// SetAgentID : Allow user to set AgentID +func (_options *CreateWorkspaceOptions) SetAgentID(agentID string) *CreateWorkspaceOptions { + _options.AgentID = core.StringPtr(agentID) + return _options +} + // SetXGithubToken : Allow user to set XGithubToken func (_options *CreateWorkspaceOptions) SetXGithubToken(xGithubToken string) *CreateWorkspaceOptions { _options.XGithubToken = core.StringPtr(xGithubToken) @@ -7494,6 +11040,161 @@ func (options *CreateWorkspaceOptions) SetHeaders(param map[string]string) *Crea return options } +// CredentialVariableData : User editable credential variable data and system generated reference to the value. +type CredentialVariableData struct { + // The name of the credential variable. + Name *string `json:"name,omitempty"` + + // The credential value for the variable or reference to the value. For example, `value = ""`. **Note** The SSH key should contain `\n` at the end of the key details in case of command line or API + // calls. + Value *string `json:"value,omitempty"` + + // True, will ignore the data in the value attribute, instead the data in metadata.default_value will be used. + UseDefault *bool `json:"use_default,omitempty"` + + // An user editable metadata for the credential variables. + Metadata *CredentialVariableMetadata `json:"metadata,omitempty"` + + // The reference link to the variable value By default the expression points to `$self.value`. + Link *string `json:"link,omitempty"` +} + +// UnmarshalCredentialVariableData unmarshals an instance of CredentialVariableData from the specified map of raw messages. +func UnmarshalCredentialVariableData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CredentialVariableData) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "use_default", &obj.UseDefault) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalCredentialVariableMetadata) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "link", &obj.Link) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CredentialVariableMetadata : An user editable metadata for the credential variables. +type CredentialVariableMetadata struct { + // Type of the variable. + Type *string `json:"type,omitempty"` + + // The list of aliases for the variable name. + Aliases []string `json:"aliases,omitempty"` + + // The description of the meta data. + Description *string `json:"description,omitempty"` + + // Cloud data type of the credential variable. eg. api_key, iam_token, profile_id. + CloudDataType *string `json:"cloud_data_type,omitempty"` + + // Default value for the variable only if the override value is not specified. + DefaultValue *string `json:"default_value,omitempty"` + + // The status of the link. + LinkStatus *string `json:"link_status,omitempty"` + + // Is the variable readonly ?. + Immutable *bool `json:"immutable,omitempty"` + + // If **true**, the variable is not displayed on UI or Command line. + Hidden *bool `json:"hidden,omitempty"` + + // If the variable required?. + Required *bool `json:"required,omitempty"` + + // The relative position of this variable in a list. + Position *int64 `json:"position,omitempty"` + + // The display name of the group this variable belongs to. + GroupBy *string `json:"group_by,omitempty"` + + // The source of this meta-data. + Source *string `json:"source,omitempty"` +} + +// Constants associated with the CredentialVariableMetadata.Type property. +// Type of the variable. +const ( + CredentialVariableMetadata_Type_Link = "link" + CredentialVariableMetadata_Type_String = "string" +) + +// Constants associated with the CredentialVariableMetadata.LinkStatus property. +// The status of the link. +const ( + CredentialVariableMetadata_LinkStatus_Broken = "broken" + CredentialVariableMetadata_LinkStatus_Normal = "normal" +) + +// UnmarshalCredentialVariableMetadata unmarshals an instance of CredentialVariableMetadata from the specified map of raw messages. +func UnmarshalCredentialVariableMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CredentialVariableMetadata) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aliases", &obj.Aliases) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cloud_data_type", &obj.CloudDataType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default_value", &obj.DefaultValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "link_status", &obj.LinkStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "immutable", &obj.Immutable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hidden", &obj.Hidden) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "required", &obj.Required) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "position", &obj.Position) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "group_by", &obj.GroupBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // Datasource : External datasource definition. type Datasource struct { // External data source name (unique for an account). @@ -7508,9 +11209,19 @@ type Datasource struct { // data source tags. Tags []string `json:"tags,omitempty"` + // Datasource types. + Type *string `json:"type,omitempty"` + // Named connection from settings. Connection *string `json:"connection,omitempty"` + DatasourceProperties []VariableData `json:"datasource_properties,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + // Generated datasource id. ID *string `json:"id,omitempty"` @@ -7530,6 +11241,24 @@ type Datasource struct { UpdatedBy *string `json:"updated_by,omitempty"` } +// Constants associated with the Datasource.Type property. +// Datasource types. +const ( + Datasource_Type_External = "external" + Datasource_Type_Internal = "internal" +) + +// Constants associated with the Datasource.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + Datasource_Location_EuDe = "eu-de" + Datasource_Location_EuGb = "eu-gb" + Datasource_Location_UsEast = "us-east" + Datasource_Location_UsSouth = "us-south" +) + // UnmarshalDatasource unmarshals an instance of Datasource from the specified map of raw messages. func UnmarshalDatasource(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(Datasource) @@ -7549,10 +11278,22 @@ func UnmarshalDatasource(m map[string]json.RawMessage, result interface{}) (err if err != nil { return } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "connection", &obj.Connection) if err != nil { return } + err = core.UnmarshalModel(m, "datasource_properties", &obj.DatasourceProperties, UnmarshalVariableData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -7733,14 +11474,95 @@ func (_options *DeleteActionOptions) SetForce(force bool) *DeleteActionOptions { return _options } -// SetPropagate : Allow user to set Propagate -func (_options *DeleteActionOptions) SetPropagate(propagate bool) *DeleteActionOptions { - _options.Propagate = core.BoolPtr(propagate) +// SetPropagate : Allow user to set Propagate +func (_options *DeleteActionOptions) SetPropagate(propagate bool) *DeleteActionOptions { + _options.Propagate = core.BoolPtr(propagate) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteActionOptions) SetHeaders(param map[string]string) *DeleteActionOptions { + options.Headers = param + return options +} + +// DeleteAgentOptions : The DeleteAgent options. +type DeleteAgentOptions struct { + // Agent ID to get the details of agent. + AgentID *string `json:"agent_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteAgentOptions : Instantiate DeleteAgentOptions +func (*SchematicsV1) NewDeleteAgentOptions(agentID string) *DeleteAgentOptions { + return &DeleteAgentOptions{ + AgentID: core.StringPtr(agentID), + } +} + +// SetAgentID : Allow user to set AgentID +func (_options *DeleteAgentOptions) SetAgentID(agentID string) *DeleteAgentOptions { + _options.AgentID = core.StringPtr(agentID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteAgentOptions) SetHeaders(param map[string]string) *DeleteAgentOptions { + options.Headers = param + return options +} + +// DeleteBlueprintOptions : The DeleteBlueprint options. +type DeleteBlueprintOptions struct { + // Environment Id. Use `GET /v2/blueprints` API to look up the order ids in your IBM Cloud account. + BlueprintID *string `json:"blueprint_id" validate:"required,ne="` + + // Level of details returned by the get method. + Profile *string `json:"profile,omitempty"` + + // Destroy the resources before deleting the blueprint. + Destroy *bool `json:"destroy,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the DeleteBlueprintOptions.Profile property. +// Level of details returned by the get method. +const ( + DeleteBlueprintOptions_Profile_Ids = "ids" + DeleteBlueprintOptions_Profile_Summary = "summary" +) + +// NewDeleteBlueprintOptions : Instantiate DeleteBlueprintOptions +func (*SchematicsV1) NewDeleteBlueprintOptions(blueprintID string) *DeleteBlueprintOptions { + return &DeleteBlueprintOptions{ + BlueprintID: core.StringPtr(blueprintID), + } +} + +// SetBlueprintID : Allow user to set BlueprintID +func (_options *DeleteBlueprintOptions) SetBlueprintID(blueprintID string) *DeleteBlueprintOptions { + _options.BlueprintID = core.StringPtr(blueprintID) + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *DeleteBlueprintOptions) SetProfile(profile string) *DeleteBlueprintOptions { + _options.Profile = core.StringPtr(profile) + return _options +} + +// SetDestroy : Allow user to set Destroy +func (_options *DeleteBlueprintOptions) SetDestroy(destroy bool) *DeleteBlueprintOptions { + _options.Destroy = core.BoolPtr(destroy) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteActionOptions) SetHeaders(param map[string]string) *DeleteActionOptions { +func (options *DeleteBlueprintOptions) SetHeaders(param map[string]string) *DeleteBlueprintOptions { options.Headers = param return options } @@ -7889,6 +11711,34 @@ func (options *DeleteJobOptions) SetHeaders(param map[string]string) *DeleteJobO return options } +// DeletePolicyOptions : The DeletePolicy options. +type DeletePolicyOptions struct { + // ID to get the details of policy. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePolicyOptions : Instantiate DeletePolicyOptions +func (*SchematicsV1) NewDeletePolicyOptions(policyID string) *DeletePolicyOptions { + return &DeletePolicyOptions{ + PolicyID: core.StringPtr(policyID), + } +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *DeletePolicyOptions) SetPolicyID(policyID string) *DeletePolicyOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePolicyOptions) SetHeaders(param map[string]string) *DeletePolicyOptions { + options.Headers = param + return options +} + // DeleteResourcesQueryOptions : The DeleteResourcesQuery options. type DeleteResourcesQueryOptions struct { // Resource query Id. Use `GET /v2/resource_query` API to look up the Resource query definition Ids in your IBM Cloud @@ -8276,16 +12126,15 @@ type ExternalSource struct { SourceType *string `json:"source_type" validate:"required"` // The connection details to the Git source repository. - Git *ExternalSourceGit `json:"git,omitempty"` + Git *GitSource `json:"git,omitempty"` // The connection details to the IBM Cloud Catalog source. - Catalog *ExternalSourceCatalog `json:"catalog,omitempty"` + Catalog *CatalogSource `json:"catalog,omitempty"` } // Constants associated with the ExternalSource.SourceType property. // Type of source for the Template. const ( - ExternalSource_SourceType_ExternalScm = "external_scm" ExternalSource_SourceType_GitHub = "git_hub" ExternalSource_SourceType_GitHubEnterprise = "git_hub_enterprise" ExternalSource_SourceType_GitLab = "git_lab" @@ -8310,11 +12159,11 @@ func UnmarshalExternalSource(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } - err = core.UnmarshalModel(m, "git", &obj.Git, UnmarshalExternalSourceGit) + err = core.UnmarshalModel(m, "git", &obj.Git, UnmarshalGitSource) if err != nil { return } - err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalExternalSourceCatalog) + err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalCatalogSource) if err != nil { return } @@ -8322,115 +12171,59 @@ func UnmarshalExternalSource(m map[string]json.RawMessage, result interface{}) ( return } -// ExternalSourceCatalog : The connection details to the IBM Cloud Catalog source. -type ExternalSourceCatalog struct { - // The name of the private catalog. - CatalogName *string `json:"catalog_name,omitempty"` - - // The name of an offering in the IBM Cloud Catalog. - OfferingName *string `json:"offering_name,omitempty"` - - // The version string of an offering in the IBM Cloud Catalog. - OfferingVersion *string `json:"offering_version,omitempty"` - - // The type of an offering, in the IBM Cloud Catalog. - OfferingKind *string `json:"offering_kind,omitempty"` +// FetchJobsOptions : The FetchJobs options. +type FetchJobsOptions struct { + // Schematics Agent id. + AgentID *string `json:"agent_id" validate:"required"` - // The ID of an offering in the IBM Cloud Catalog. - OfferingID *string `json:"offering_id,omitempty"` + // Number of jobs. By default return upto 4 remote jobs. + JobCount *int64 `json:"job_count" validate:"required"` - // The ID of an offering version the IBM Cloud Catalog. - OfferingVersionID *string `json:"offering_version_id,omitempty"` + // Types of job supported by the Agent. + JobType *string `json:"job_type" validate:"required"` - // The repository URL of an offering, in the IBM Cloud Catalog. - OfferingRepoURL *string `json:"offering_repo_url,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalExternalSourceCatalog unmarshals an instance of ExternalSourceCatalog from the specified map of raw messages. -func UnmarshalExternalSourceCatalog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ExternalSourceCatalog) - err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_name", &obj.OfferingName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_version", &obj.OfferingVersion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_kind", &obj.OfferingKind) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_id", &obj.OfferingID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_version_id", &obj.OfferingVersionID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_repo_url", &obj.OfferingRepoURL) - if err != nil { - return +// Constants associated with the FetchJobsOptions.JobType property. +// Types of job supported by the Agent. +const ( + FetchJobsOptions_JobType_SandboxJob = "sandbox_job" + FetchJobsOptions_JobType_WorkspaceJob = "workspace_job" +) + +// NewFetchJobsOptions : Instantiate FetchJobsOptions +func (*SchematicsV1) NewFetchJobsOptions(agentID string, jobCount int64, jobType string) *FetchJobsOptions { + return &FetchJobsOptions{ + AgentID: core.StringPtr(agentID), + JobCount: core.Int64Ptr(jobCount), + JobType: core.StringPtr(jobType), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// ExternalSourceGit : The connection details to the Git source repository. -type ExternalSourceGit struct { - // The complete URL which is computed by the **git_repo_url**, **git_repo_folder**, and **branch**. - ComputedGitRepoURL *string `json:"computed_git_repo_url,omitempty"` - - // The URL to the Git repository that can be used to clone the template. - GitRepoURL *string `json:"git_repo_url,omitempty"` - - // The Personal Access Token (PAT) to connect to the Git URLs. - GitToken *string `json:"git_token,omitempty"` - - // The name of the folder in the Git repository, that contains the template. - GitRepoFolder *string `json:"git_repo_folder,omitempty"` +// SetAgentID : Allow user to set AgentID +func (_options *FetchJobsOptions) SetAgentID(agentID string) *FetchJobsOptions { + _options.AgentID = core.StringPtr(agentID) + return _options +} - // The name of the release tag that are used to fetch the Git repository. - GitRelease *string `json:"git_release,omitempty"` +// SetJobCount : Allow user to set JobCount +func (_options *FetchJobsOptions) SetJobCount(jobCount int64) *FetchJobsOptions { + _options.JobCount = core.Int64Ptr(jobCount) + return _options +} - // The name of the branch that are used to fetch the Git repository. - GitBranch *string `json:"git_branch,omitempty"` +// SetJobType : Allow user to set JobType +func (_options *FetchJobsOptions) SetJobType(jobType string) *FetchJobsOptions { + _options.JobType = core.StringPtr(jobType) + return _options } -// UnmarshalExternalSourceGit unmarshals an instance of ExternalSourceGit from the specified map of raw messages. -func UnmarshalExternalSourceGit(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ExternalSourceGit) - err = core.UnmarshalPrimitive(m, "computed_git_repo_url", &obj.ComputedGitRepoURL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "git_repo_url", &obj.GitRepoURL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "git_token", &obj.GitToken) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "git_repo_folder", &obj.GitRepoFolder) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "git_release", &obj.GitRelease) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "git_branch", &obj.GitBranch) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *FetchJobsOptions) SetHeaders(param map[string]string) *FetchJobsOptions { + options.Headers = param + return options } // GetActionOptions : The GetAction options. @@ -8449,6 +12242,7 @@ type GetActionOptions struct { // Level of details returned by the get method. const ( GetActionOptions_Profile_Detailed = "detailed" + GetActionOptions_Profile_Ids = "ids" GetActionOptions_Profile_Summary = "summary" ) @@ -8477,6 +12271,79 @@ func (options *GetActionOptions) SetHeaders(param map[string]string) *GetActionO return options } +// GetAgentJobFilesOptions : The GetAgentJobFiles options. +type GetAgentJobFilesOptions struct { + // Job Id. Use `GET /v2/jobs` API to look up the Job Ids in your IBM Cloud account. + JobID *string `json:"job_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetAgentJobFilesOptions : Instantiate GetAgentJobFilesOptions +func (*SchematicsV1) NewGetAgentJobFilesOptions(jobID string) *GetAgentJobFilesOptions { + return &GetAgentJobFilesOptions{ + JobID: core.StringPtr(jobID), + } +} + +// SetJobID : Allow user to set JobID +func (_options *GetAgentJobFilesOptions) SetJobID(jobID string) *GetAgentJobFilesOptions { + _options.JobID = core.StringPtr(jobID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetAgentJobFilesOptions) SetHeaders(param map[string]string) *GetAgentJobFilesOptions { + options.Headers = param + return options +} + +// GetAgentOptions : The GetAgent options. +type GetAgentOptions struct { + // Agent ID to get the details of agent. + AgentID *string `json:"agent_id" validate:"required,ne="` + + // Level of details returned by the get method. + Profile *string `json:"profile,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the GetAgentOptions.Profile property. +// Level of details returned by the get method. +const ( + GetAgentOptions_Profile_Detailed = "detailed" + GetAgentOptions_Profile_Ids = "ids" + GetAgentOptions_Profile_Summary = "summary" +) + +// NewGetAgentOptions : Instantiate GetAgentOptions +func (*SchematicsV1) NewGetAgentOptions(agentID string) *GetAgentOptions { + return &GetAgentOptions{ + AgentID: core.StringPtr(agentID), + } +} + +// SetAgentID : Allow user to set AgentID +func (_options *GetAgentOptions) SetAgentID(agentID string) *GetAgentOptions { + _options.AgentID = core.StringPtr(agentID) + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *GetAgentOptions) SetProfile(profile string) *GetAgentOptions { + _options.Profile = core.StringPtr(profile) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetAgentOptions) SetHeaders(param map[string]string) *GetAgentOptions { + options.Headers = param + return options +} + // GetAllWorkspaceInputsOptions : The GetAllWorkspaceInputs options. type GetAllWorkspaceInputsOptions struct { // The ID of the workspace for which you want to retrieve input parameters and values. To find the workspace ID, use @@ -8506,6 +12373,50 @@ func (options *GetAllWorkspaceInputsOptions) SetHeaders(param map[string]string) return options } +// GetBlueprintOptions : The GetBlueprint options. +type GetBlueprintOptions struct { + // Environment Id. Use `GET /v2/blueprints` API to look up the order ids in your IBM Cloud account. + BlueprintID *string `json:"blueprint_id" validate:"required,ne="` + + // Level of details returned by the get method. + Profile *string `json:"profile,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the GetBlueprintOptions.Profile property. +// Level of details returned by the get method. +const ( + GetBlueprintOptions_Profile_Ids = "ids" + GetBlueprintOptions_Profile_Summary = "summary" +) + +// NewGetBlueprintOptions : Instantiate GetBlueprintOptions +func (*SchematicsV1) NewGetBlueprintOptions(blueprintID string) *GetBlueprintOptions { + return &GetBlueprintOptions{ + BlueprintID: core.StringPtr(blueprintID), + } +} + +// SetBlueprintID : Allow user to set BlueprintID +func (_options *GetBlueprintOptions) SetBlueprintID(blueprintID string) *GetBlueprintOptions { + _options.BlueprintID = core.StringPtr(blueprintID) + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *GetBlueprintOptions) SetProfile(profile string) *GetBlueprintOptions { + _options.Profile = core.StringPtr(profile) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBlueprintOptions) SetHeaders(param map[string]string) *GetBlueprintOptions { + options.Headers = param + return options +} + // GetConnectionOptions : The GetConnection options. type GetConnectionOptions struct { // The ID of the connection. To find the connection ID, use the `GET /v2/connections` API. @@ -8595,6 +12506,7 @@ type GetInventoryOptions struct { // Level of details returned by the get method. const ( GetInventoryOptions_Profile_Detailed = "detailed" + GetInventoryOptions_Profile_Ids = "ids" GetInventoryOptions_Profile_Summary = "summary" ) @@ -8638,8 +12550,11 @@ type GetJobFilesOptions struct { // Constants associated with the GetJobFilesOptions.FileType property. // The type of file you want to download eg.state_file, plan_json. const ( + GetJobFilesOptions_FileType_LogFile = "log_file" GetJobFilesOptions_FileType_PlanJSON = "plan_json" + GetJobFilesOptions_FileType_ReadmeFile = "readme_file" GetJobFilesOptions_FileType_StateFile = "state_file" + GetJobFilesOptions_FileType_TemplateRepo = "template_repo" ) // NewGetJobFilesOptions : Instantiate GetJobFilesOptions @@ -8684,6 +12599,7 @@ type GetJobOptions struct { // Level of details returned by the get method. const ( GetJobOptions_Profile_Detailed = "detailed" + GetJobOptions_Profile_Ids = "ids" GetJobOptions_Profile_Summary = "summary" ) @@ -8740,6 +12656,51 @@ func (options *GetKmsSettingsOptions) SetHeaders(param map[string]string) *GetKm return options } +// GetPolicyOptions : The GetPolicy options. +type GetPolicyOptions struct { + // ID to get the details of policy. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // Level of details returned by the get method. + Profile *string `json:"profile,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the GetPolicyOptions.Profile property. +// Level of details returned by the get method. +const ( + GetPolicyOptions_Profile_Detailed = "detailed" + GetPolicyOptions_Profile_Ids = "ids" + GetPolicyOptions_Profile_Summary = "summary" +) + +// NewGetPolicyOptions : Instantiate GetPolicyOptions +func (*SchematicsV1) NewGetPolicyOptions(policyID string) *GetPolicyOptions { + return &GetPolicyOptions{ + PolicyID: core.StringPtr(policyID), + } +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *GetPolicyOptions) SetPolicyID(policyID string) *GetPolicyOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *GetPolicyOptions) SetProfile(profile string) *GetPolicyOptions { + _options.Profile = core.StringPtr(profile) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPolicyOptions) SetHeaders(param map[string]string) *GetPolicyOptions { + options.Headers = param + return options +} + // GetResourcesQueryOptions : The GetResourcesQuery options. type GetResourcesQueryOptions struct { // Resource query Id. Use `GET /v2/resource_query` API to look up the Resource query definition Ids in your IBM Cloud @@ -9370,16 +13331,68 @@ func (_options *GetWorkspaceTemplateStateOptions) SetWID(wID string) *GetWorkspa return _options } -// SetTID : Allow user to set TID -func (_options *GetWorkspaceTemplateStateOptions) SetTID(tID string) *GetWorkspaceTemplateStateOptions { - _options.TID = core.StringPtr(tID) - return _options +// SetTID : Allow user to set TID +func (_options *GetWorkspaceTemplateStateOptions) SetTID(tID string) *GetWorkspaceTemplateStateOptions { + _options.TID = core.StringPtr(tID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetWorkspaceTemplateStateOptions) SetHeaders(param map[string]string) *GetWorkspaceTemplateStateOptions { + options.Headers = param + return options +} + +// GitSource : The connection details to the Git source repository. +type GitSource struct { + // The complete URL which is computed by the **git_repo_url**, **git_repo_folder**, and **branch**. + ComputedGitRepoURL *string `json:"computed_git_repo_url,omitempty"` + + // The URL to the Git repository that can be used to clone the template. + GitRepoURL *string `json:"git_repo_url,omitempty"` + + // The Personal Access Token (PAT) to connect to the Git URLs. + GitToken *string `json:"git_token,omitempty"` + + // The name of the folder in the Git repository, that contains the template. + GitRepoFolder *string `json:"git_repo_folder,omitempty"` + + // The name of the release tag that are used to fetch the Git repository. + GitRelease *string `json:"git_release,omitempty"` + + // The name of the branch that are used to fetch the Git repository. + GitBranch *string `json:"git_branch,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *GetWorkspaceTemplateStateOptions) SetHeaders(param map[string]string) *GetWorkspaceTemplateStateOptions { - options.Headers = param - return options +// UnmarshalGitSource unmarshals an instance of GitSource from the specified map of raw messages. +func UnmarshalGitSource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(GitSource) + err = core.UnmarshalPrimitive(m, "computed_git_repo_url", &obj.ComputedGitRepoURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "git_repo_url", &obj.GitRepoURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "git_token", &obj.GitToken) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "git_repo_folder", &obj.GitRepoFolder) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "git_release", &obj.GitRelease) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "git_branch", &obj.GitBranch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } // InjectTerraformTemplateInnerTftParametersItem : InjectTerraformTemplateInnerTftParametersItem struct @@ -9687,6 +13700,7 @@ type Job struct { // Name of the Schematics automation resource. const ( Job_CommandObject_Action = "action" + Job_CommandObject_Blueprint = "blueprint" Job_CommandObject_Environment = "environment" Job_CommandObject_System = "system" Job_CommandObject_Workspace = "workspace" @@ -9697,6 +13711,11 @@ const ( const ( Job_CommandName_AnsiblePlaybookCheck = "ansible_playbook_check" Job_CommandName_AnsiblePlaybookRun = "ansible_playbook_run" + Job_CommandName_BlueprintCreateInit = "blueprint_create_init" + Job_CommandName_BlueprintDelete = "blueprint_delete" + Job_CommandName_BlueprintDestroy = "blueprint_destroy" + Job_CommandName_BlueprintInstall = "blueprint_install" + Job_CommandName_BlueprintUpdateInit = "blueprint_update_init" Job_CommandName_CreateAction = "create_action" Job_CommandName_CreateCart = "create_cart" Job_CommandName_CreateEnvironment = "create_environment" @@ -9704,9 +13723,10 @@ const ( Job_CommandName_DeleteAction = "delete_action" Job_CommandName_DeleteEnvironment = "delete_environment" Job_CommandName_DeleteWorkspace = "delete_workspace" - Job_CommandName_EnvironmentInit = "environment_init" + Job_CommandName_EnvironmentCreateInit = "environment_create_init" Job_CommandName_EnvironmentInstall = "environment_install" Job_CommandName_EnvironmentUninstall = "environment_uninstall" + Job_CommandName_EnvironmentUpdateInit = "environment_update_init" Job_CommandName_PatchAction = "patch_action" Job_CommandName_PatchWorkspace = "patch_workspace" Job_CommandName_PutAction = "put_action" @@ -10138,7 +14158,6 @@ type JobDataWorkItem struct { // Constants associated with the JobDataWorkItem.SourceType property. // Type of source for the Template. const ( - JobDataWorkItem_SourceType_ExternalScm = "external_scm" JobDataWorkItem_SourceType_GitHub = "git_hub" JobDataWorkItem_SourceType_GitHubEnterprise = "git_hub_enterprise" JobDataWorkItem_SourceType_GitLab = "git_lab" @@ -10219,6 +14238,7 @@ type JobDataWorkItemLastJob struct { // Name of the Schematics automation resource. const ( JobDataWorkItemLastJob_CommandObject_Action = "action" + JobDataWorkItemLastJob_CommandObject_Blueprint = "blueprint" JobDataWorkItemLastJob_CommandObject_Environment = "environment" JobDataWorkItemLastJob_CommandObject_System = "system" JobDataWorkItemLastJob_CommandObject_Workspace = "workspace" @@ -10229,6 +14249,11 @@ const ( const ( JobDataWorkItemLastJob_CommandName_AnsiblePlaybookCheck = "ansible_playbook_check" JobDataWorkItemLastJob_CommandName_AnsiblePlaybookRun = "ansible_playbook_run" + JobDataWorkItemLastJob_CommandName_BlueprintCreateInit = "blueprint_create_init" + JobDataWorkItemLastJob_CommandName_BlueprintDelete = "blueprint_delete" + JobDataWorkItemLastJob_CommandName_BlueprintDestroy = "blueprint_destroy" + JobDataWorkItemLastJob_CommandName_BlueprintInstall = "blueprint_install" + JobDataWorkItemLastJob_CommandName_BlueprintUpdateInit = "blueprint_update_init" JobDataWorkItemLastJob_CommandName_CreateAction = "create_action" JobDataWorkItemLastJob_CommandName_CreateCart = "create_cart" JobDataWorkItemLastJob_CommandName_CreateEnvironment = "create_environment" @@ -10236,9 +14261,10 @@ const ( JobDataWorkItemLastJob_CommandName_DeleteAction = "delete_action" JobDataWorkItemLastJob_CommandName_DeleteEnvironment = "delete_environment" JobDataWorkItemLastJob_CommandName_DeleteWorkspace = "delete_workspace" - JobDataWorkItemLastJob_CommandName_EnvironmentInit = "environment_init" + JobDataWorkItemLastJob_CommandName_EnvironmentCreateInit = "environment_create_init" JobDataWorkItemLastJob_CommandName_EnvironmentInstall = "environment_install" JobDataWorkItemLastJob_CommandName_EnvironmentUninstall = "environment_uninstall" + JobDataWorkItemLastJob_CommandName_EnvironmentUpdateInit = "environment_update_init" JobDataWorkItemLastJob_CommandName_PatchAction = "patch_action" JobDataWorkItemLastJob_CommandName_PatchWorkspace = "patch_workspace" JobDataWorkItemLastJob_CommandName_PutAction = "put_action" @@ -10389,6 +14415,7 @@ type JobFileData struct { // The type of output file generated by the Job. const ( JobFileData_FileType_PlanJSON = "plan_json" + JobFileData_FileType_QuoteJSON = "quote_json" JobFileData_FileType_StateFile = "state_file" ) @@ -10562,6 +14589,7 @@ type JobLite struct { // Name of the Schematics automation resource. const ( JobLite_CommandObject_Action = "action" + JobLite_CommandObject_Blueprint = "blueprint" JobLite_CommandObject_Environment = "environment" JobLite_CommandObject_System = "system" JobLite_CommandObject_Workspace = "workspace" @@ -10572,6 +14600,11 @@ const ( const ( JobLite_CommandName_AnsiblePlaybookCheck = "ansible_playbook_check" JobLite_CommandName_AnsiblePlaybookRun = "ansible_playbook_run" + JobLite_CommandName_BlueprintCreateInit = "blueprint_create_init" + JobLite_CommandName_BlueprintDelete = "blueprint_delete" + JobLite_CommandName_BlueprintDestroy = "blueprint_destroy" + JobLite_CommandName_BlueprintInstall = "blueprint_install" + JobLite_CommandName_BlueprintUpdateInit = "blueprint_update_init" JobLite_CommandName_CreateAction = "create_action" JobLite_CommandName_CreateCart = "create_cart" JobLite_CommandName_CreateEnvironment = "create_environment" @@ -10579,9 +14612,10 @@ const ( JobLite_CommandName_DeleteAction = "delete_action" JobLite_CommandName_DeleteEnvironment = "delete_environment" JobLite_CommandName_DeleteWorkspace = "delete_workspace" - JobLite_CommandName_EnvironmentInit = "environment_init" + JobLite_CommandName_EnvironmentCreateInit = "environment_create_init" JobLite_CommandName_EnvironmentInstall = "environment_install" JobLite_CommandName_EnvironmentUninstall = "environment_uninstall" + JobLite_CommandName_EnvironmentUpdateInit = "environment_update_init" JobLite_CommandName_PatchAction = "patch_action" JobLite_CommandName_PatchWorkspace = "patch_workspace" JobLite_CommandName_PutAction = "put_action" @@ -11939,7 +15973,7 @@ func UnmarshalLastJob(m map[string]json.RawMessage, result interface{}) (err err type ListActionsOptions struct { // The starting position of the item in the list of items. For example, if you have three workspaces in your account, // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. - // If you have 6 workspaces and you want to list the details for workspaces 2-6, enter 1. To limit the number of + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not // supported and are ignored. Offset *int64 `json:"offset,omitempty"` @@ -12002,11 +16036,125 @@ func (options *ListActionsOptions) SetHeaders(param map[string]string) *ListActi return options } +// ListAgentOptions : The ListAgent options. +type ListAgentOptions struct { + // The starting position of the item in the list of items. For example, if you have three workspaces in your account, + // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of + // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not + // supported and are ignored. + Offset *int64 `json:"offset,omitempty"` + + // The maximum number of items that you want to list. The number must be a positive integer between 1 and 2000. If no + // value is provided, 100 is used by default. + Limit *int64 `json:"limit,omitempty"` + + // Level of details returned by the get method. + Profile *string `json:"profile,omitempty"` + + // Use `new` to get all unregistered agents; use `saved` to get all registered agents. + Filter *string `json:"filter,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListAgentOptions.Profile property. +// Level of details returned by the get method. +const ( + ListAgentOptions_Profile_Detailed = "detailed" + ListAgentOptions_Profile_Ids = "ids" + ListAgentOptions_Profile_Summary = "summary" +) + +// Constants associated with the ListAgentOptions.Filter property. +// Use `new` to get all unregistered agents; use `saved` to get all registered agents. +const ( + ListAgentOptions_Filter_All = "all" + ListAgentOptions_Filter_New = "new" + ListAgentOptions_Filter_Saved = "saved" +) + +// NewListAgentOptions : Instantiate ListAgentOptions +func (*SchematicsV1) NewListAgentOptions() *ListAgentOptions { + return &ListAgentOptions{} +} + +// SetOffset : Allow user to set Offset +func (_options *ListAgentOptions) SetOffset(offset int64) *ListAgentOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListAgentOptions) SetLimit(limit int64) *ListAgentOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *ListAgentOptions) SetProfile(profile string) *ListAgentOptions { + _options.Profile = core.StringPtr(profile) + return _options +} + +// SetFilter : Allow user to set Filter +func (_options *ListAgentOptions) SetFilter(filter string) *ListAgentOptions { + _options.Filter = core.StringPtr(filter) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListAgentOptions) SetHeaders(param map[string]string) *ListAgentOptions { + options.Headers = param + return options +} + +// ListBlueprintOptions : The ListBlueprint options. +type ListBlueprintOptions struct { + // The starting position of the item in the list of items. For example, if you have three workspaces in your account, + // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of + // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not + // supported and are ignored. + Offset *int64 `json:"offset,omitempty"` + + // The maximum number of items that you want to list. The number must be a positive integer between 1 and 2000. If no + // value is provided, 100 is used by default. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBlueprintOptions : Instantiate ListBlueprintOptions +func (*SchematicsV1) NewListBlueprintOptions() *ListBlueprintOptions { + return &ListBlueprintOptions{} +} + +// SetOffset : Allow user to set Offset +func (_options *ListBlueprintOptions) SetOffset(offset int64) *ListBlueprintOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBlueprintOptions) SetLimit(limit int64) *ListBlueprintOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBlueprintOptions) SetHeaders(param map[string]string) *ListBlueprintOptions { + options.Headers = param + return options +} + // ListConnectionOptions : The ListConnection options. type ListConnectionOptions struct { // The starting position of the item in the list of items. For example, if you have three workspaces in your account, // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. - // If you have 6 workspaces and you want to list the details for workspaces 2-6, enter 1. To limit the number of + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not // supported and are ignored. Offset *int64 `json:"offset,omitempty"` @@ -12057,7 +16205,7 @@ func (options *ListConnectionOptions) SetHeaders(param map[string]string) *ListC type ListDatasourcesOptions struct { // The starting position of the item in the list of items. For example, if you have three workspaces in your account, // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. - // If you have 6 workspaces and you want to list the details for workspaces 2-6, enter 1. To limit the number of + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not // supported and are ignored. Offset *int64 `json:"offset,omitempty"` @@ -12108,7 +16256,7 @@ func (options *ListDatasourcesOptions) SetHeaders(param map[string]string) *List type ListInventoriesOptions struct { // The starting position of the item in the list of items. For example, if you have three workspaces in your account, // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. - // If you have 6 workspaces and you want to list the details for workspaces 2-6, enter 1. To limit the number of + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not // supported and are ignored. Offset *int64 `json:"offset,omitempty"` @@ -12203,7 +16351,7 @@ func (options *ListJobLogsOptions) SetHeaders(param map[string]string) *ListJobL type ListJobsOptions struct { // The starting position of the item in the list of items. For example, if you have three workspaces in your account, // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. - // If you have 6 workspaces and you want to list the details for workspaces 2-6, enter 1. To limit the number of + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not // supported and are ignored. Offset *int64 `json:"offset,omitempty"` @@ -12220,7 +16368,7 @@ type ListJobsOptions struct { // Level of details returned by the get method. Profile *string `json:"profile,omitempty"` - // Name of the resource (workspace, actions or controls). + // Name of the resource (workspaces, actions, environment or controls). Resource *string `json:"resource,omitempty"` // The Resource Id. It could be an Action-id or Workspace-id. @@ -12229,6 +16377,9 @@ type ListJobsOptions struct { // Action Id. ActionID *string `json:"action_id,omitempty"` + // Workspace Id. + WorkspaceID *string `json:"workspace_id,omitempty"` + // list jobs. List *string `json:"list,omitempty"` @@ -12244,10 +16395,12 @@ const ( ) // Constants associated with the ListJobsOptions.Resource property. -// Name of the resource (workspace, actions or controls). +// Name of the resource (workspaces, actions, environment or controls). const ( ListJobsOptions_Resource_Action = "action" - ListJobsOptions_Resource_Workspace = "workspace" + ListJobsOptions_Resource_Actions = "actions" + ListJobsOptions_Resource_Environment = "environment" + ListJobsOptions_Resource_Workspaces = "workspaces" ) // Constants associated with the ListJobsOptions.List property. @@ -12303,28 +16456,193 @@ func (_options *ListJobsOptions) SetActionID(actionID string) *ListJobsOptions { return _options } -// SetList : Allow user to set List -func (_options *ListJobsOptions) SetList(list string) *ListJobsOptions { - _options.List = core.StringPtr(list) +// SetWorkspaceID : Allow user to set WorkspaceID +func (_options *ListJobsOptions) SetWorkspaceID(workspaceID string) *ListJobsOptions { + _options.WorkspaceID = core.StringPtr(workspaceID) + return _options +} + +// SetList : Allow user to set List +func (_options *ListJobsOptions) SetList(list string) *ListJobsOptions { + _options.List = core.StringPtr(list) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListJobsOptions) SetHeaders(param map[string]string) *ListJobsOptions { + options.Headers = param + return options +} + +// ListKmsOptions : The ListKms options. +type ListKmsOptions struct { + // The encryption scheme to be used. + EncryptionScheme *string `json:"encryption_scheme" validate:"required"` + + // The location of the Resource. + Location *string `json:"location" validate:"required"` + + // The resource group (by default, fetch from all resource groups). + ResourceGroup *string `json:"resource_group,omitempty"` + + // The maximum number of items that you want to list. The number must be a positive integer between 1 and 2000. If no + // value is provided, 100 is used by default. + Limit *int64 `json:"limit,omitempty"` + + // Name of the field to sort-by; Use the '.' character to delineate sub-resources and sub-fields (eg. + // owner.last_name). Prepend the field with '+' or '-', indicating 'ascending' or 'descending' (default is ascending) + // Ignore unrecognized or unsupported sort field. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListKmsOptions : Instantiate ListKmsOptions +func (*SchematicsV1) NewListKmsOptions(encryptionScheme string, location string) *ListKmsOptions { + return &ListKmsOptions{ + EncryptionScheme: core.StringPtr(encryptionScheme), + Location: core.StringPtr(location), + } +} + +// SetEncryptionScheme : Allow user to set EncryptionScheme +func (_options *ListKmsOptions) SetEncryptionScheme(encryptionScheme string) *ListKmsOptions { + _options.EncryptionScheme = core.StringPtr(encryptionScheme) + return _options +} + +// SetLocation : Allow user to set Location +func (_options *ListKmsOptions) SetLocation(location string) *ListKmsOptions { + _options.Location = core.StringPtr(location) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *ListKmsOptions) SetResourceGroup(resourceGroup string) *ListKmsOptions { + _options.ResourceGroup = core.StringPtr(resourceGroup) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListKmsOptions) SetLimit(limit int64) *ListKmsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListKmsOptions) SetSort(sort string) *ListKmsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListKmsOptions) SetHeaders(param map[string]string) *ListKmsOptions { + options.Headers = param + return options +} + +// ListLocationsOptions : The ListLocations options. +type ListLocationsOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLocationsOptions : Instantiate ListLocationsOptions +func (*SchematicsV1) NewListLocationsOptions() *ListLocationsOptions { + return &ListLocationsOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListLocationsOptions) SetHeaders(param map[string]string) *ListLocationsOptions { + options.Headers = param + return options +} + +// ListPolicyOptions : The ListPolicy options. +type ListPolicyOptions struct { + // The starting position of the item in the list of items. For example, if you have three workspaces in your account, + // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of + // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not + // supported and are ignored. + Offset *int64 `json:"offset,omitempty"` + + // The maximum number of items that you want to list. The number must be a positive integer between 1 and 2000. If no + // value is provided, 100 is used by default. + Limit *int64 `json:"limit,omitempty"` + + // Level of details returned by the get method. + Profile *string `json:"profile,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListPolicyOptions.Profile property. +// Level of details returned by the get method. +const ( + ListPolicyOptions_Profile_Detailed = "detailed" + ListPolicyOptions_Profile_Ids = "ids" + ListPolicyOptions_Profile_Summary = "summary" +) + +// NewListPolicyOptions : Instantiate ListPolicyOptions +func (*SchematicsV1) NewListPolicyOptions() *ListPolicyOptions { + return &ListPolicyOptions{} +} + +// SetOffset : Allow user to set Offset +func (_options *ListPolicyOptions) SetOffset(offset int64) *ListPolicyOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPolicyOptions) SetLimit(limit int64) *ListPolicyOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *ListPolicyOptions) SetProfile(profile string) *ListPolicyOptions { + _options.Profile = core.StringPtr(profile) return _options } // SetHeaders : Allow user to set Headers -func (options *ListJobsOptions) SetHeaders(param map[string]string) *ListJobsOptions { +func (options *ListPolicyOptions) SetHeaders(param map[string]string) *ListPolicyOptions { options.Headers = param return options } -// ListKmsOptions : The ListKms options. -type ListKmsOptions struct { - // The encryption scheme to be used. - EncryptionScheme *string `json:"encryption_scheme" validate:"required"` +// ListResourceGroupOptions : The ListResourceGroup options. +type ListResourceGroupOptions struct { - // The location of the Resource. - Location *string `json:"location" validate:"required"` + // Allows users to set headers on API requests + Headers map[string]string +} - // The resource group (by default, fetch from all resource groups). - ResourceGroup *string `json:"resource_group,omitempty"` +// NewListResourceGroupOptions : Instantiate ListResourceGroupOptions +func (*SchematicsV1) NewListResourceGroupOptions() *ListResourceGroupOptions { + return &ListResourceGroupOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceGroupOptions) SetHeaders(param map[string]string) *ListResourceGroupOptions { + options.Headers = param + return options +} + +// ListResourceQueryOptions : The ListResourceQuery options. +type ListResourceQueryOptions struct { + // The starting position of the item in the list of items. For example, if you have three workspaces in your account, + // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of + // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not + // supported and are ignored. + Offset *int64 `json:"offset,omitempty"` // The maximum number of items that you want to list. The number must be a positive integer between 1 and 2000. If no // value is provided, 100 is used by default. @@ -12335,95 +16653,129 @@ type ListKmsOptions struct { // Ignore unrecognized or unsupported sort field. Sort *string `json:"sort,omitempty"` + // Level of details returned by the get method. + Profile *string `json:"profile,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } -// NewListKmsOptions : Instantiate ListKmsOptions -func (*SchematicsV1) NewListKmsOptions(encryptionScheme string, location string) *ListKmsOptions { - return &ListKmsOptions{ - EncryptionScheme: core.StringPtr(encryptionScheme), - Location: core.StringPtr(location), - } -} - -// SetEncryptionScheme : Allow user to set EncryptionScheme -func (_options *ListKmsOptions) SetEncryptionScheme(encryptionScheme string) *ListKmsOptions { - _options.EncryptionScheme = core.StringPtr(encryptionScheme) - return _options -} +// Constants associated with the ListResourceQueryOptions.Profile property. +// Level of details returned by the get method. +const ( + ListResourceQueryOptions_Profile_Ids = "ids" + ListResourceQueryOptions_Profile_Summary = "summary" +) -// SetLocation : Allow user to set Location -func (_options *ListKmsOptions) SetLocation(location string) *ListKmsOptions { - _options.Location = core.StringPtr(location) - return _options +// NewListResourceQueryOptions : Instantiate ListResourceQueryOptions +func (*SchematicsV1) NewListResourceQueryOptions() *ListResourceQueryOptions { + return &ListResourceQueryOptions{} } -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *ListKmsOptions) SetResourceGroup(resourceGroup string) *ListKmsOptions { - _options.ResourceGroup = core.StringPtr(resourceGroup) +// SetOffset : Allow user to set Offset +func (_options *ListResourceQueryOptions) SetOffset(offset int64) *ListResourceQueryOptions { + _options.Offset = core.Int64Ptr(offset) return _options } // SetLimit : Allow user to set Limit -func (_options *ListKmsOptions) SetLimit(limit int64) *ListKmsOptions { +func (_options *ListResourceQueryOptions) SetLimit(limit int64) *ListResourceQueryOptions { _options.Limit = core.Int64Ptr(limit) return _options } // SetSort : Allow user to set Sort -func (_options *ListKmsOptions) SetSort(sort string) *ListKmsOptions { +func (_options *ListResourceQueryOptions) SetSort(sort string) *ListResourceQueryOptions { _options.Sort = core.StringPtr(sort) return _options } +// SetProfile : Allow user to set Profile +func (_options *ListResourceQueryOptions) SetProfile(profile string) *ListResourceQueryOptions { + _options.Profile = core.StringPtr(profile) + return _options +} + // SetHeaders : Allow user to set Headers -func (options *ListKmsOptions) SetHeaders(param map[string]string) *ListKmsOptions { +func (options *ListResourceQueryOptions) SetHeaders(param map[string]string) *ListResourceQueryOptions { options.Headers = param return options } -// ListLocationsOptions : The ListLocations options. -type ListLocationsOptions struct { +// ListSchematicsLocationOptions : The ListSchematicsLocation options. +type ListSchematicsLocationOptions struct { // Allows users to set headers on API requests Headers map[string]string } -// NewListLocationsOptions : Instantiate ListLocationsOptions -func (*SchematicsV1) NewListLocationsOptions() *ListLocationsOptions { - return &ListLocationsOptions{} +// NewListSchematicsLocationOptions : Instantiate ListSchematicsLocationOptions +func (*SchematicsV1) NewListSchematicsLocationOptions() *ListSchematicsLocationOptions { + return &ListSchematicsLocationOptions{} } // SetHeaders : Allow user to set Headers -func (options *ListLocationsOptions) SetHeaders(param map[string]string) *ListLocationsOptions { +func (options *ListSchematicsLocationOptions) SetHeaders(param map[string]string) *ListSchematicsLocationOptions { options.Headers = param return options } -// ListResourceGroupOptions : The ListResourceGroup options. -type ListResourceGroupOptions struct { +// ListWorkspaceActivitiesOptions : The ListWorkspaceActivities options. +type ListWorkspaceActivitiesOptions struct { + // The ID of the workspace. To find the workspace ID, use the `GET /v1/workspaces` API. + WID *string `json:"w_id" validate:"required,ne="` + + // The starting position of the item in the list of items. For example, if you have three workspaces in your account, + // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of + // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not + // supported and are ignored. + Offset *int64 `json:"offset,omitempty"` + + // The maximum number of items that you want to list. The number must be a positive integer between 1 and 2000. If no + // value is provided, 100 is used by default. + Limit *int64 `json:"limit,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewListResourceGroupOptions : Instantiate ListResourceGroupOptions -func (*SchematicsV1) NewListResourceGroupOptions() *ListResourceGroupOptions { - return &ListResourceGroupOptions{} +// NewListWorkspaceActivitiesOptions : Instantiate ListWorkspaceActivitiesOptions +func (*SchematicsV1) NewListWorkspaceActivitiesOptions(wID string) *ListWorkspaceActivitiesOptions { + return &ListWorkspaceActivitiesOptions{ + WID: core.StringPtr(wID), + } +} + +// SetWID : Allow user to set WID +func (_options *ListWorkspaceActivitiesOptions) SetWID(wID string) *ListWorkspaceActivitiesOptions { + _options.WID = core.StringPtr(wID) + return _options +} + +// SetOffset : Allow user to set Offset +func (_options *ListWorkspaceActivitiesOptions) SetOffset(offset int64) *ListWorkspaceActivitiesOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListWorkspaceActivitiesOptions) SetLimit(limit int64) *ListWorkspaceActivitiesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options } // SetHeaders : Allow user to set Headers -func (options *ListResourceGroupOptions) SetHeaders(param map[string]string) *ListResourceGroupOptions { +func (options *ListWorkspaceActivitiesOptions) SetHeaders(param map[string]string) *ListWorkspaceActivitiesOptions { options.Headers = param return options } -// ListResourceQueryOptions : The ListResourceQuery options. -type ListResourceQueryOptions struct { +// ListWorkspacesOptions : The ListWorkspaces options. +type ListWorkspacesOptions struct { // The starting position of the item in the list of items. For example, if you have three workspaces in your account, // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. - // If you have 6 workspaces and you want to list the details for workspaces 2-6, enter 1. To limit the number of + // If you have 6 workspaces and you want to list the details for workspaces `2-6`, enter 1. To limit the number of // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not // supported and are ignored. Offset *int64 `json:"offset,omitempty"` @@ -12432,11 +16784,6 @@ type ListResourceQueryOptions struct { // value is provided, 100 is used by default. Limit *int64 `json:"limit,omitempty"` - // Name of the field to sort-by; Use the '.' character to delineate sub-resources and sub-fields (eg. - // owner.last_name). Prepend the field with '+' or '-', indicating 'ascending' or 'descending' (default is ascending) - // Ignore unrecognized or unsupported sort field. - Sort *string `json:"sort,omitempty"` - // Level of details returned by the get method. Profile *string `json:"profile,omitempty"` @@ -12444,180 +16791,410 @@ type ListResourceQueryOptions struct { Headers map[string]string } -// Constants associated with the ListResourceQueryOptions.Profile property. +// Constants associated with the ListWorkspacesOptions.Profile property. // Level of details returned by the get method. const ( - ListResourceQueryOptions_Profile_Ids = "ids" - ListResourceQueryOptions_Profile_Summary = "summary" + ListWorkspacesOptions_Profile_Ids = "ids" + ListWorkspacesOptions_Profile_Summary = "summary" ) -// NewListResourceQueryOptions : Instantiate ListResourceQueryOptions -func (*SchematicsV1) NewListResourceQueryOptions() *ListResourceQueryOptions { - return &ListResourceQueryOptions{} -} +// NewListWorkspacesOptions : Instantiate ListWorkspacesOptions +func (*SchematicsV1) NewListWorkspacesOptions() *ListWorkspacesOptions { + return &ListWorkspacesOptions{} +} + +// SetOffset : Allow user to set Offset +func (_options *ListWorkspacesOptions) SetOffset(offset int64) *ListWorkspacesOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListWorkspacesOptions) SetLimit(limit int64) *ListWorkspacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *ListWorkspacesOptions) SetProfile(profile string) *ListWorkspacesOptions { + _options.Profile = core.StringPtr(profile) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListWorkspacesOptions) SetHeaders(param map[string]string) *ListWorkspacesOptions { + options.Headers = param + return options +} + +// LogStoreResponse : Log file URL for job that ran against your workspace. +type LogStoreResponse struct { + // The provisioning engine that was used for the job. + EngineName *string `json:"engine_name,omitempty"` + + // The version of the provisioning engine that was used for the job. + EngineVersion *string `json:"engine_version,omitempty"` + + // The ID that was assigned to your Terraform template of IBM Cloud catalog software template. + ID *string `json:"id,omitempty"` + + // The URL to access the logs that were created during the plan, apply, or destroy job. + LogStoreURL *string `json:"log_store_url,omitempty"` +} + +// UnmarshalLogStoreResponse unmarshals an instance of LogStoreResponse from the specified map of raw messages. +func UnmarshalLogStoreResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LogStoreResponse) + err = core.UnmarshalPrimitive(m, "engine_name", &obj.EngineName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "engine_version", &obj.EngineVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "log_store_url", &obj.LogStoreURL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LogStoreResponseList : List of log file URL that ran against your workspace. +type LogStoreResponseList struct { + // Runtime data. + RuntimeData []LogStoreResponse `json:"runtime_data,omitempty"` +} + +// UnmarshalLogStoreResponseList unmarshals an instance of LogStoreResponseList from the specified map of raw messages. +func UnmarshalLogStoreResponseList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LogStoreResponseList) + err = core.UnmarshalModel(m, "runtime_data", &obj.RuntimeData, UnmarshalLogStoreResponse) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LogSummary : Summary information extracted from the job logs. +type LogSummary struct { + // The status of your activity or job. To retrieve the URL to your job logs, use the GET + // /v1/workspaces/{id}/actions/{action_id}/logs API. + // + // * **COMPLETED**: The job completed successfully. + // * **CREATED**: The job was created, but the provisioning, modification, or removal of IBM Cloud resources has not + // started yet. + // * **FAILED**: An error occurred during the plan, apply, or destroy job. Use the job ID to retrieve the URL to the + // log files for your job. + // * **IN PROGRESS**: The job is in progress. You can use the log_url to access the logs. + ActivityStatus *string `json:"activity_status,omitempty"` + + // Template detected type. + DetectedTemplateType *string `json:"detected_template_type,omitempty"` + + // Numner of discarded files. + DiscardedFiles *int64 `json:"discarded_files,omitempty"` + + // Numner of errors in log. + Error *string `json:"error,omitempty"` + + // Numner of resources added. + ResourcesAdded *int64 `json:"resources_added,omitempty"` -// SetOffset : Allow user to set Offset -func (_options *ListResourceQueryOptions) SetOffset(offset int64) *ListResourceQueryOptions { - _options.Offset = core.Int64Ptr(offset) - return _options -} + // Numner of resources destroyed. + ResourcesDestroyed *int64 `json:"resources_destroyed,omitempty"` -// SetLimit : Allow user to set Limit -func (_options *ListResourceQueryOptions) SetLimit(limit int64) *ListResourceQueryOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} + // Numner of resources modified. + ResourcesModified *int64 `json:"resources_modified,omitempty"` -// SetSort : Allow user to set Sort -func (_options *ListResourceQueryOptions) SetSort(sort string) *ListResourceQueryOptions { - _options.Sort = core.StringPtr(sort) - return _options -} + // Numner of filed scanned. + ScannedFiles *int64 `json:"scanned_files,omitempty"` -// SetProfile : Allow user to set Profile -func (_options *ListResourceQueryOptions) SetProfile(profile string) *ListResourceQueryOptions { - _options.Profile = core.StringPtr(profile) - return _options + // Numner of template variables. + TemplateVariableCount *int64 `json:"template_variable_count,omitempty"` + + // Elapsed time to run the job. + TimeTaken *float64 `json:"time_taken,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *ListResourceQueryOptions) SetHeaders(param map[string]string) *ListResourceQueryOptions { - options.Headers = param - return options +// UnmarshalLogSummary unmarshals an instance of LogSummary from the specified map of raw messages. +func UnmarshalLogSummary(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LogSummary) + err = core.UnmarshalPrimitive(m, "activity_status", &obj.ActivityStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "detected_template_type", &obj.DetectedTemplateType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "discarded_files", &obj.DiscardedFiles) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "error", &obj.Error) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resources_added", &obj.ResourcesAdded) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resources_destroyed", &obj.ResourcesDestroyed) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resources_modified", &obj.ResourcesModified) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "scanned_files", &obj.ScannedFiles) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "template_variable_count", &obj.TemplateVariableCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "time_taken", &obj.TimeTaken) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// ListSchematicsLocationOptions : The ListSchematicsLocation options. -type ListSchematicsLocationOptions struct { +// OutputValuesInner : OutputValuesInner struct +type OutputValuesInner struct { + // The subfolder in the GitHub or GitLab repository where your Terraform template is stored. If the template is stored + // in the root directory, `.` is returned. + Folder *string `json:"folder,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string -} + // The ID that was assigned to your Terraform template or IBM Cloud catalog software template. + ID *string `json:"id,omitempty"` -// NewListSchematicsLocationOptions : Instantiate ListSchematicsLocationOptions -func (*SchematicsV1) NewListSchematicsLocationOptions() *ListSchematicsLocationOptions { - return &ListSchematicsLocationOptions{} + // A list of Terraform output values. + OutputValues []interface{} `json:"output_values,omitempty"` + + // The Terraform version that was used to apply your template. + ValueType *string `json:"value_type,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *ListSchematicsLocationOptions) SetHeaders(param map[string]string) *ListSchematicsLocationOptions { - options.Headers = param - return options +// UnmarshalOutputValuesInner unmarshals an instance of OutputValuesInner from the specified map of raw messages. +func UnmarshalOutputValuesInner(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OutputValuesInner) + err = core.UnmarshalPrimitive(m, "folder", &obj.Folder) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "output_values", &obj.OutputValues) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value_type", &obj.ValueType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// ListWorkspaceActivitiesOptions : The ListWorkspaceActivities options. -type ListWorkspaceActivitiesOptions struct { - // The ID of the workspace. To find the workspace ID, use the `GET /v1/workspaces` API. +// PlanWorkspaceCommandOptions : The PlanWorkspaceCommand options. +type PlanWorkspaceCommandOptions struct { + // The ID of the workspace, for which you want to run a Schematics `plan` job. To find the ID of your workspace, use + // the `GET /v1/workspaces` API. WID *string `json:"w_id" validate:"required,ne="` - // The starting position of the item in the list of items. For example, if you have three workspaces in your account, - // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. - // If you have 6 workspaces and you want to list the details for workspaces 2-6, enter 1. To limit the number of - // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not - // supported and are ignored. - Offset *int64 `json:"offset,omitempty"` + // The IAM refresh token for the user or service identity. + // + // **Retrieving refresh token**: + // * Use `export IBMCLOUD_API_KEY=`, and execute `curl -X POST + // "https://iam.cloud.ibm.com/identity/token" -H "Content-Type: application/x-www-form-urlencoded" -d + // "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=$IBMCLOUD_API_KEY" -u bx:bx`. + // * For more information, about creating IAM access token and API Docs, refer, [IAM access + // token](/apidocs/iam-identity-token-api#gettoken-password) and [Create API + // key](/apidocs/iam-identity-token-api#create-api-key). + // + // **Limitation**: + // * If the token is expired, you can use `refresh token` to get a new IAM access token. + // * The `refresh_token` parameter cannot be used to retrieve a new IAM access token. + // * When the IAM access token is about to expire, use the API key to create a new access token. + RefreshToken *string `json:"refresh_token" validate:"required"` - // The maximum number of items that you want to list. The number must be a positive integer between 1 and 2000. If no - // value is provided, 100 is used by default. - Limit *int64 `json:"limit,omitempty"` + // Workspace job options template. + ActionOptions *WorkspaceActivityOptionsTemplate `json:"action_options,omitempty"` + + // The IAM delegated token for your IBM Cloud account. This token is required for requests that are sent via the UI + // only. + DelegatedToken *string `json:"delegated_token,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewListWorkspaceActivitiesOptions : Instantiate ListWorkspaceActivitiesOptions -func (*SchematicsV1) NewListWorkspaceActivitiesOptions(wID string) *ListWorkspaceActivitiesOptions { - return &ListWorkspaceActivitiesOptions{ +// NewPlanWorkspaceCommandOptions : Instantiate PlanWorkspaceCommandOptions +func (*SchematicsV1) NewPlanWorkspaceCommandOptions(wID string, refreshToken string) *PlanWorkspaceCommandOptions { + return &PlanWorkspaceCommandOptions{ WID: core.StringPtr(wID), + RefreshToken: core.StringPtr(refreshToken), } } // SetWID : Allow user to set WID -func (_options *ListWorkspaceActivitiesOptions) SetWID(wID string) *ListWorkspaceActivitiesOptions { +func (_options *PlanWorkspaceCommandOptions) SetWID(wID string) *PlanWorkspaceCommandOptions { _options.WID = core.StringPtr(wID) return _options } -// SetOffset : Allow user to set Offset -func (_options *ListWorkspaceActivitiesOptions) SetOffset(offset int64) *ListWorkspaceActivitiesOptions { - _options.Offset = core.Int64Ptr(offset) +// SetRefreshToken : Allow user to set RefreshToken +func (_options *PlanWorkspaceCommandOptions) SetRefreshToken(refreshToken string) *PlanWorkspaceCommandOptions { + _options.RefreshToken = core.StringPtr(refreshToken) return _options } -// SetLimit : Allow user to set Limit -func (_options *ListWorkspaceActivitiesOptions) SetLimit(limit int64) *ListWorkspaceActivitiesOptions { - _options.Limit = core.Int64Ptr(limit) +// SetActionOptions : Allow user to set ActionOptions +func (_options *PlanWorkspaceCommandOptions) SetActionOptions(actionOptions *WorkspaceActivityOptionsTemplate) *PlanWorkspaceCommandOptions { + _options.ActionOptions = actionOptions + return _options +} + +// SetDelegatedToken : Allow user to set DelegatedToken +func (_options *PlanWorkspaceCommandOptions) SetDelegatedToken(delegatedToken string) *PlanWorkspaceCommandOptions { + _options.DelegatedToken = core.StringPtr(delegatedToken) return _options } // SetHeaders : Allow user to set Headers -func (options *ListWorkspaceActivitiesOptions) SetHeaders(param map[string]string) *ListWorkspaceActivitiesOptions { +func (options *PlanWorkspaceCommandOptions) SetHeaders(param map[string]string) *PlanWorkspaceCommandOptions { options.Headers = param return options } -// ListWorkspacesOptions : The ListWorkspaces options. -type ListWorkspacesOptions struct { - // The starting position of the item in the list of items. For example, if you have three workspaces in your account, - // the first workspace is assigned position number 0, the second workspace is assigned position number 1, and so forth. - // If you have 6 workspaces and you want to list the details for workspaces 2-6, enter 1. To limit the number of - // workspaces that is returned, use the `limit` option in addition to the `offset` option. Negative numbers are not - // supported and are ignored. - Offset *int64 `json:"offset,omitempty"` +// Policy : Detailed information about the Schematics customization policy. This policy can be used to customize the behaviour or +// the core Schematics service. +type Policy struct { + // Name of Schematics customization policy. + Name *string `json:"name,omitempty"` - // The maximum number of items that you want to list. The number must be a positive integer between 1 and 2000. If no - // value is provided, 100 is used by default. - Limit *int64 `json:"limit,omitempty"` + // The description of Schematics customization policy. + Description *string `json:"description,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string -} + // The resource group name for the policy. By default, Policy will be created in `default` Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` -// NewListWorkspacesOptions : Instantiate ListWorkspacesOptions -func (*SchematicsV1) NewListWorkspacesOptions() *ListWorkspacesOptions { - return &ListWorkspacesOptions{} -} + // Tags for the Schematics customization policy. + Tags []string `json:"tags,omitempty"` -// SetOffset : Allow user to set Offset -func (_options *ListWorkspacesOptions) SetOffset(offset int64) *ListWorkspacesOptions { - _options.Offset = core.Int64Ptr(offset) - return _options -} + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` -// SetLimit : Allow user to set Limit -func (_options *ListWorkspacesOptions) SetLimit(limit int64) *ListWorkspacesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} + // User defined status of the Schematics object. + State *UserState `json:"state,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *ListWorkspacesOptions) SetHeaders(param map[string]string) *ListWorkspacesOptions { - options.Headers = param - return options -} + // Policy kind or categories for managing and deriving policy decision + // * `agent_assignment_policy` Agent assignment policy for job execution. + PolicyKind *string `json:"policy_kind" validate:"required"` -// LogStoreResponse : Log file URL for job that ran against your workspace. -type LogStoreResponse struct { - // The provisioning engine that was used for the job. - EngineName *string `json:"engine_name,omitempty"` + // The objects for the Schematics policy. + PolicyTarget *PolicyObjects `json:"policy_target,omitempty"` - // The version of the provisioning engine that was used for the job. - EngineVersion *string `json:"engine_version,omitempty"` + // The parameter to tune the Schematics policy. + PolicyParameter *PolicyParameter `json:"policy_parameter,omitempty"` + + // The system generated policy Id. + ID *string `json:"id,omitempty"` + + // The policy CRN. + Crn *string `json:"crn,omitempty"` + + // The Account id. + Account *string `json:"account,omitempty"` + + // The policy creation time. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The user who created the policy. + CreatedBy *string `json:"created_by,omitempty"` + + // The policy updation time. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` +} - // The ID that was assigned to your Terraform template of IBM Cloud catalog software template. - ID *string `json:"id,omitempty"` +// Constants associated with the Policy.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + Policy_Location_EuDe = "eu-de" + Policy_Location_EuGb = "eu-gb" + Policy_Location_UsEast = "us-east" + Policy_Location_UsSouth = "us-south" +) - // The URL to access the logs that were created during the plan, apply, or destroy job. - LogStoreURL *string `json:"log_store_url,omitempty"` +// Constants associated with the Policy.PolicyKind property. +// Policy kind or categories for managing and deriving policy decision +// * `agent_assignment_policy` Agent assignment policy for job execution. +const ( + Policy_PolicyKind_AgentAssignmentPolicy = "agent_assignment_policy" +) + +// NewPolicy : Instantiate Policy (Generic Model Constructor) +func (*SchematicsV1) NewPolicy(policyKind string) (_model *Policy, err error) { + _model = &Policy{ + PolicyKind: core.StringPtr(policyKind), + } + err = core.ValidateStruct(_model, "required parameters") + return } -// UnmarshalLogStoreResponse unmarshals an instance of LogStoreResponse from the specified map of raw messages. -func UnmarshalLogStoreResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LogStoreResponse) - err = core.UnmarshalPrimitive(m, "engine_name", &obj.EngineName) +// UnmarshalPolicy unmarshals an instance of Policy from the specified map of raw messages. +func UnmarshalPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Policy) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "engine_version", &obj.EngineVersion) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalUserState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_kind", &obj.PolicyKind) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policy_target", &obj.PolicyTarget, UnmarshalPolicyObjects) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policy_parameter", &obj.PolicyParameter, UnmarshalPolicyParameter) if err != nil { return } @@ -12625,7 +17202,23 @@ func UnmarshalLogStoreResponse(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalPrimitive(m, "log_store_url", &obj.LogStoreURL) + err = core.UnmarshalPrimitive(m, "crn", &obj.Crn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account", &obj.Account) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { return } @@ -12633,16 +17226,37 @@ func UnmarshalLogStoreResponse(m map[string]json.RawMessage, result interface{}) return } -// LogStoreResponseList : List of log file URL that ran against your workspace. -type LogStoreResponseList struct { - // Runtime data. - RuntimeData []LogStoreResponse `json:"runtime_data,omitempty"` +// PolicyList : The list of Schematics customization policies. +type PolicyList struct { + // The total number of policy records. + TotalCount *int64 `json:"total_count,omitempty"` + + // The number of policy records returned. + Limit *int64 `json:"limit,omitempty"` + + // The skipped number of policy records. + Offset *int64 `json:"offset" validate:"required"` + + // The list of Schematics policies. + Policies []PolicyLite `json:"policies,omitempty"` } -// UnmarshalLogStoreResponseList unmarshals an instance of LogStoreResponseList from the specified map of raw messages. -func UnmarshalLogStoreResponseList(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LogStoreResponseList) - err = core.UnmarshalModel(m, "runtime_data", &obj.RuntimeData, UnmarshalLogStoreResponse) +// UnmarshalPolicyList unmarshals an instance of PolicyList from the specified map of raw messages. +func UnmarshalPolicyList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PolicyList) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalPolicyLite) if err != nil { return } @@ -12650,87 +17264,121 @@ func UnmarshalLogStoreResponseList(m map[string]json.RawMessage, result interfac return } -// LogSummary : Summary information extracted from the job logs. -type LogSummary struct { - // The status of your activity or job. To retrieve the URL to your job logs, use the GET - // /v1/workspaces/{id}/actions/{action_id}/logs API. - // - // * **COMPLETED**: The job completed successfully. - // * **CREATED**: The job was created, but the provisioning, modification, or removal of IBM Cloud resources has not - // started yet. - // * **FAILED**: An error occurred during the plan, apply, or destroy job. Use the job ID to retrieve the URL to the - // log files for your job. - // * **IN PROGRESS**: The job is in progress. You can use the log_url to access the logs. - ActivityStatus *string `json:"activity_status,omitempty"` +// PolicyLite : The summary of Schematics policy. +type PolicyLite struct { + // The name of Schematics customization policy. + Name *string `json:"name,omitempty"` - // Template detected type. - DetectedTemplateType *string `json:"detected_template_type,omitempty"` + // The system generated Policy Id. + ID *string `json:"id,omitempty"` - // Numner of discarded files. - DiscardedFiles *int64 `json:"discarded_files,omitempty"` + // The policy CRN. + Crn *string `json:"crn,omitempty"` - // Numner of errors in log. - Error *string `json:"error,omitempty"` + // The Account id. + Account *string `json:"account,omitempty"` - // Numner of resources added. - ResourcesAdded *int64 `json:"resources_added,omitempty"` + // The description of Schematics customization policy. + Description *string `json:"description,omitempty"` - // Numner of resources destroyed. - ResourcesDestroyed *int64 `json:"resources_destroyed,omitempty"` + // Resource-group name for the Policy. By default, Policy will be created in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` - // Numner of resources modified. - ResourcesModified *int64 `json:"resources_modified,omitempty"` + // Tags for the Schematics customization policy. + Tags []string `json:"tags,omitempty"` - // Numner of filed scanned. - ScannedFiles *int64 `json:"scanned_files,omitempty"` + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` - // Numner of template variables. - TemplateVariableCount *int64 `json:"template_variable_count,omitempty"` + // User defined status of the Schematics object. + State *UserState `json:"state,omitempty"` - // Elapsed time to run the job. - TimeTaken *float64 `json:"time_taken,omitempty"` + // Policy kind or categories for managing and deriving policy decision + // * `agent_assignment_policy` Agent assignment policy for job execution. + PolicyKind *string `json:"policy_kind,omitempty"` + + // The policy creation time. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The user who created the Policy. + CreatedBy *string `json:"created_by,omitempty"` + + // The policy updation time. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` } -// UnmarshalLogSummary unmarshals an instance of LogSummary from the specified map of raw messages. -func UnmarshalLogSummary(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LogSummary) - err = core.UnmarshalPrimitive(m, "activity_status", &obj.ActivityStatus) +// Constants associated with the PolicyLite.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + PolicyLite_Location_EuDe = "eu-de" + PolicyLite_Location_EuGb = "eu-gb" + PolicyLite_Location_UsEast = "us-east" + PolicyLite_Location_UsSouth = "us-south" +) + +// Constants associated with the PolicyLite.PolicyKind property. +// Policy kind or categories for managing and deriving policy decision +// * `agent_assignment_policy` Agent assignment policy for job execution. +const ( + PolicyLite_PolicyKind_AgentAssignmentPolicy = "agent_assignment_policy" +) + +// UnmarshalPolicyLite unmarshals an instance of PolicyLite from the specified map of raw messages. +func UnmarshalPolicyLite(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PolicyLite) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "detected_template_type", &obj.DetectedTemplateType) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "discarded_files", &obj.DiscardedFiles) + err = core.UnmarshalPrimitive(m, "crn", &obj.Crn) if err != nil { return } - err = core.UnmarshalPrimitive(m, "error", &obj.Error) + err = core.UnmarshalPrimitive(m, "account", &obj.Account) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resources_added", &obj.ResourcesAdded) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resources_destroyed", &obj.ResourcesDestroyed) + err = core.UnmarshalPrimitive(m, "resource_group", &obj.ResourceGroup) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resources_modified", &obj.ResourcesModified) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "scanned_files", &obj.ScannedFiles) + err = core.UnmarshalPrimitive(m, "location", &obj.Location) if err != nil { return } - err = core.UnmarshalPrimitive(m, "template_variable_count", &obj.TemplateVariableCount) + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalUserState) if err != nil { return } - err = core.UnmarshalPrimitive(m, "time_taken", &obj.TimeTaken) + err = core.UnmarshalPrimitive(m, "policy_kind", &obj.PolicyKind) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { return } @@ -12738,38 +17386,57 @@ func UnmarshalLogSummary(m map[string]json.RawMessage, result interface{}) (err return } -// OutputValuesInner : OutputValuesInner struct -type OutputValuesInner struct { - // The subfolder in the GitHub or GitLab repository where your Terraform template is stored. If the template is stored - // in the root directory, `.` is returned. - Folder *string `json:"folder,omitempty"` +// PolicyObjectSelector : Selector rule to dynamically select Schematics object based on the following metadata attributes. The rule can be +// defined as follows ((tags in ["policy:secured-job", "policy:dept_id:A00132"]) AND (resource_grous in ["default", +// "sales_rg"])). +type PolicyObjectSelector struct { + // The type of Schematics object selector. + Kind *string `json:"kind,omitempty"` - // The ID that was assigned to your Terraform template or IBM Cloud catalog software template. - ID *string `json:"id,omitempty"` + // The tag based selector. + Tags []string `json:"tags,omitempty"` - // A list of Terraform output values. - OutputValues []interface{} `json:"output_values,omitempty"` + // The resource group based selector. + ResourceGroups []string `json:"resource_groups,omitempty"` - // The Terraform version that was used to apply your template. - ValueType *string `json:"value_type,omitempty"` + // The location based selector. + Locations []string `json:"locations,omitempty"` } -// UnmarshalOutputValuesInner unmarshals an instance of OutputValuesInner from the specified map of raw messages. -func UnmarshalOutputValuesInner(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OutputValuesInner) - err = core.UnmarshalPrimitive(m, "folder", &obj.Folder) +// Constants associated with the PolicyObjectSelector.Kind property. +// The type of Schematics object selector. +const ( + PolicyObjectSelector_Kind_Agent = "agent" + PolicyObjectSelector_Kind_Workspace = "workspace" +) + +// Constants associated with the PolicyObjectSelector.Locations property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + PolicyObjectSelector_Locations_EuDe = "eu-de" + PolicyObjectSelector_Locations_EuGb = "eu-gb" + PolicyObjectSelector_Locations_UsEast = "us-east" + PolicyObjectSelector_Locations_UsSouth = "us-south" +) + +// UnmarshalPolicyObjectSelector unmarshals an instance of PolicyObjectSelector from the specified map of raw messages. +func UnmarshalPolicyObjectSelector(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PolicyObjectSelector) + err = core.UnmarshalPrimitive(m, "kind", &obj.Kind) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "output_values", &obj.OutputValues) + err = core.UnmarshalPrimitive(m, "resource_groups", &obj.ResourceGroups) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value_type", &obj.ValueType) + err = core.UnmarshalPrimitive(m, "locations", &obj.Locations) if err != nil { return } @@ -12777,73 +17444,124 @@ func UnmarshalOutputValuesInner(m map[string]json.RawMessage, result interface{} return } -// PlanWorkspaceCommandOptions : The PlanWorkspaceCommand options. -type PlanWorkspaceCommandOptions struct { - // The ID of the workspace, for which you want to run a Schematics `plan` job. To find the ID of your workspace, use - // the `GET /v1/workspaces` API. - WID *string `json:"w_id" validate:"required,ne="` +// PolicyObjects : The objects for the Schematics policy. +type PolicyObjects struct { + // Types of schematics object selector. + SelectorKind *string `json:"selector_kind,omitempty"` - // The IAM refresh token for the user or service identity. - // - // **Retrieving refresh token**: - // * Use `export IBMCLOUD_API_KEY=`, and execute `curl -X POST - // "https://iam.cloud.ibm.com/identity/token" -H "Content-Type: application/x-www-form-urlencoded" -d - // "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=$IBMCLOUD_API_KEY" -u bx:bx`. - // * For more information, about creating IAM access token and API Docs, refer, [IAM access - // token](/apidocs/iam-identity-token-api#gettoken-password) and [Create API - // key](/apidocs/iam-identity-token-api#create-api-key). - // - // **Limitation**: - // * If the token is expired, you can use `refresh token` to get a new IAM access token. - // * The `refresh_token` parameter cannot be used to retrieve a new IAM access token. - // * When the IAM access token is about to expire, use the API key to create a new access token. - RefreshToken *string `json:"refresh_token" validate:"required"` + // Static selectors of schematics object ids (agent, workspace, action or blueprint) for the Schematics policy. + SelectorIds []string `json:"selector_ids,omitempty"` + + // Selectors to dynamically list of schematics object ids (agent, workspace, action or blueprint) for the Schematics + // policy. + SelectorScope []PolicyObjectSelector `json:"selector_scope,omitempty"` +} + +// Constants associated with the PolicyObjects.SelectorKind property. +// Types of schematics object selector. +const ( + PolicyObjects_SelectorKind_Ids = "ids" + PolicyObjects_SelectorKind_Scoped = "scoped" +) + +// UnmarshalPolicyObjects unmarshals an instance of PolicyObjects from the specified map of raw messages. +func UnmarshalPolicyObjects(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PolicyObjects) + err = core.UnmarshalPrimitive(m, "selector_kind", &obj.SelectorKind) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "selector_ids", &obj.SelectorIds) + if err != nil { + return + } + err = core.UnmarshalModel(m, "selector_scope", &obj.SelectorScope, UnmarshalPolicyObjectSelector) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PolicyParameter : The parameter to tune the Schematics policy. +type PolicyParameter struct { + // Parameters for the `agent_assignment_policy`. + AgentAssignmentPolicyParameter *AgentAssignmentPolicyParameter `json:"agent_assignment_policy_parameter,omitempty"` +} + +// UnmarshalPolicyParameter unmarshals an instance of PolicyParameter from the specified map of raw messages. +func UnmarshalPolicyParameter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PolicyParameter) + err = core.UnmarshalModel(m, "agent_assignment_policy_parameter", &obj.AgentAssignmentPolicyParameter, UnmarshalAgentAssignmentPolicyParameter) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Workspace job options template. - ActionOptions *WorkspaceActivityOptionsTemplate `json:"action_options,omitempty"` +// PostAgentJobFilesOptions : The PostAgentJobFiles options. +type PostAgentJobFilesOptions struct { + // Job Id. Use `GET /v2/jobs` API to look up the Job Ids in your IBM Cloud account. + JobID *string `json:"job_id" validate:"required,ne="` - // The IAM delegated token for your IBM Cloud account. This token is required for requests that are sent via the UI - // only. - DelegatedToken *string `json:"delegated_token,omitempty"` + // The type of file you want to download eg.state_file, plan_json. + FileType *string `json:"file_type" validate:"required"` + + // Job file e.g., log file, state file. + File io.ReadCloser `json:"file,omitempty"` + + // The content type of file. + FileContentType *string `json:"file_content_type,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewPlanWorkspaceCommandOptions : Instantiate PlanWorkspaceCommandOptions -func (*SchematicsV1) NewPlanWorkspaceCommandOptions(wID string, refreshToken string) *PlanWorkspaceCommandOptions { - return &PlanWorkspaceCommandOptions{ - WID: core.StringPtr(wID), - RefreshToken: core.StringPtr(refreshToken), +// Constants associated with the PostAgentJobFilesOptions.FileType property. +// The type of file you want to download eg.state_file, plan_json. +const ( + PostAgentJobFilesOptions_FileType_LogFile = "log_file" + PostAgentJobFilesOptions_FileType_PlanJSON = "plan_json" + PostAgentJobFilesOptions_FileType_ReadmeFile = "readme_file" + PostAgentJobFilesOptions_FileType_StateFile = "state_file" + PostAgentJobFilesOptions_FileType_TemplateRepo = "template_repo" +) + +// NewPostAgentJobFilesOptions : Instantiate PostAgentJobFilesOptions +func (*SchematicsV1) NewPostAgentJobFilesOptions(jobID string, fileType string) *PostAgentJobFilesOptions { + return &PostAgentJobFilesOptions{ + JobID: core.StringPtr(jobID), + FileType: core.StringPtr(fileType), } } -// SetWID : Allow user to set WID -func (_options *PlanWorkspaceCommandOptions) SetWID(wID string) *PlanWorkspaceCommandOptions { - _options.WID = core.StringPtr(wID) +// SetJobID : Allow user to set JobID +func (_options *PostAgentJobFilesOptions) SetJobID(jobID string) *PostAgentJobFilesOptions { + _options.JobID = core.StringPtr(jobID) return _options } -// SetRefreshToken : Allow user to set RefreshToken -func (_options *PlanWorkspaceCommandOptions) SetRefreshToken(refreshToken string) *PlanWorkspaceCommandOptions { - _options.RefreshToken = core.StringPtr(refreshToken) +// SetFileType : Allow user to set FileType +func (_options *PostAgentJobFilesOptions) SetFileType(fileType string) *PostAgentJobFilesOptions { + _options.FileType = core.StringPtr(fileType) return _options } -// SetActionOptions : Allow user to set ActionOptions -func (_options *PlanWorkspaceCommandOptions) SetActionOptions(actionOptions *WorkspaceActivityOptionsTemplate) *PlanWorkspaceCommandOptions { - _options.ActionOptions = actionOptions +// SetFile : Allow user to set File +func (_options *PostAgentJobFilesOptions) SetFile(file io.ReadCloser) *PostAgentJobFilesOptions { + _options.File = file return _options } -// SetDelegatedToken : Allow user to set DelegatedToken -func (_options *PlanWorkspaceCommandOptions) SetDelegatedToken(delegatedToken string) *PlanWorkspaceCommandOptions { - _options.DelegatedToken = core.StringPtr(delegatedToken) +// SetFileContentType : Allow user to set FileContentType +func (_options *PostAgentJobFilesOptions) SetFileContentType(fileContentType string) *PostAgentJobFilesOptions { + _options.FileContentType = core.StringPtr(fileContentType) return _options } // SetHeaders : Allow user to set Headers -func (options *PlanWorkspaceCommandOptions) SetHeaders(param map[string]string) *PlanWorkspaceCommandOptions { +func (options *PostAgentJobFilesOptions) SetHeaders(param map[string]string) *PostAgentJobFilesOptions { options.Headers = param return options } @@ -12856,8 +17574,7 @@ type PreviewData struct { // Name of the connection used to fetch the data. Connection *string `json:"connection,omitempty"` - // User editable variable data and system generated reference to the value. - Data *VariableData `json:"data,omitempty"` + Data []VariableData `json:"data,omitempty"` // Version of the data fetched from the external store. Version *string `json:"version,omitempty"` @@ -12939,7 +17656,6 @@ type ProcessTemplateMetaDataOptions struct { // Constants associated with the ProcessTemplateMetaDataOptions.SourceType property. // Type of source for the Template. const ( - ProcessTemplateMetaDataOptions_SourceType_ExternalScm = "external_scm" ProcessTemplateMetaDataOptions_SourceType_GitHub = "git_hub" ProcessTemplateMetaDataOptions_SourceType_GitHubEnterprise = "git_hub_enterprise" ProcessTemplateMetaDataOptions_SourceType_GitLab = "git_lab" @@ -13054,6 +17770,315 @@ func (options *RefreshWorkspaceCommandOptions) SetHeaders(param map[string]strin return options } +// RegisterAgentOptions : The RegisterAgent options. +type RegisterAgentOptions struct { + // The name of the agent (must be unique, for an account). + Name *string `json:"name" validate:"required"` + + // The location where agent is deployed in the user environment. + AgentLocation *string `json:"agent_location" validate:"required"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location" validate:"required"` + + // The IAM trusted profile id, used by the Agent instance. + ProfileID *string `json:"profile_id" validate:"required"` + + // Agent description. + Description *string `json:"description,omitempty"` + + // The resource-group name for the agent. By default, Agent will be registered in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Tags for the agent. + Tags []string `json:"tags,omitempty"` + + // User defined status of the agent. + UserState *AgentUserState `json:"user_state,omitempty"` + + // Connection status of the agent. + ConnectionState *ConnectionState `json:"connection_state,omitempty"` + + // Computed state of the agent. + SystemState *AgentSystemState `json:"system_state,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the RegisterAgentOptions.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + RegisterAgentOptions_Location_EuDe = "eu-de" + RegisterAgentOptions_Location_EuGb = "eu-gb" + RegisterAgentOptions_Location_UsEast = "us-east" + RegisterAgentOptions_Location_UsSouth = "us-south" +) + +// NewRegisterAgentOptions : Instantiate RegisterAgentOptions +func (*SchematicsV1) NewRegisterAgentOptions(name string, agentLocation string, location string, profileID string) *RegisterAgentOptions { + return &RegisterAgentOptions{ + Name: core.StringPtr(name), + AgentLocation: core.StringPtr(agentLocation), + Location: core.StringPtr(location), + ProfileID: core.StringPtr(profileID), + } +} + +// SetName : Allow user to set Name +func (_options *RegisterAgentOptions) SetName(name string) *RegisterAgentOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetAgentLocation : Allow user to set AgentLocation +func (_options *RegisterAgentOptions) SetAgentLocation(agentLocation string) *RegisterAgentOptions { + _options.AgentLocation = core.StringPtr(agentLocation) + return _options +} + +// SetLocation : Allow user to set Location +func (_options *RegisterAgentOptions) SetLocation(location string) *RegisterAgentOptions { + _options.Location = core.StringPtr(location) + return _options +} + +// SetProfileID : Allow user to set ProfileID +func (_options *RegisterAgentOptions) SetProfileID(profileID string) *RegisterAgentOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *RegisterAgentOptions) SetDescription(description string) *RegisterAgentOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *RegisterAgentOptions) SetResourceGroup(resourceGroup string) *RegisterAgentOptions { + _options.ResourceGroup = core.StringPtr(resourceGroup) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *RegisterAgentOptions) SetTags(tags []string) *RegisterAgentOptions { + _options.Tags = tags + return _options +} + +// SetUserState : Allow user to set UserState +func (_options *RegisterAgentOptions) SetUserState(userState *AgentUserState) *RegisterAgentOptions { + _options.UserState = userState + return _options +} + +// SetConnectionState : Allow user to set ConnectionState +func (_options *RegisterAgentOptions) SetConnectionState(connectionState *ConnectionState) *RegisterAgentOptions { + _options.ConnectionState = connectionState + return _options +} + +// SetSystemState : Allow user to set SystemState +func (_options *RegisterAgentOptions) SetSystemState(systemState *AgentSystemState) *RegisterAgentOptions { + _options.SystemState = systemState + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RegisterAgentOptions) SetHeaders(param map[string]string) *RegisterAgentOptions { + options.Headers = param + return options +} + +// ReplaceBlueprintOptions : The ReplaceBlueprint options. +type ReplaceBlueprintOptions struct { + // Environment Id. Use `GET /v2/blueprints` API to look up the order ids in your IBM Cloud account. + BlueprintID *string `json:"blueprint_id" validate:"required,ne="` + + // Blueprint name (unique for an account). + Name *string `json:"name" validate:"required"` + + // Schema version. + SchemaVersion *string `json:"schema_version,omitempty"` + + // Source of templates, playbooks, or controls. + Source *ExternalSource `json:"source,omitempty"` + + // Blueprint input configuration definition. + Config []BlueprintConfigItem `json:"config,omitempty"` + + // Blueprint description. + Description *string `json:"description,omitempty"` + + // Resource-group name for the Blueprint. By default, Blueprint will be created in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Blueprint instance tags. + Tags []string `json:"tags,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + + // Additional inputs configuration for the blueprint. + Inputs []VariableData `json:"inputs,omitempty"` + + // Input environemnt settings for blueprint. + Settings []VariableData `json:"settings,omitempty"` + + // Flow definitions for all the Blueprint command. + Flow *BlueprintFlow `json:"flow,omitempty"` + + // System lock status. + SysLock *SystemLock `json:"sys_lock,omitempty"` + + // User defined status of the Schematics object. + UserState *UserState `json:"user_state,omitempty"` + + // Computed state of the Blueprint. + State *BlueprintLiteState `json:"state,omitempty"` + + // Level of details returned by the get method. + Profile *string `json:"profile,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ReplaceBlueprintOptions.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + ReplaceBlueprintOptions_Location_EuDe = "eu-de" + ReplaceBlueprintOptions_Location_EuGb = "eu-gb" + ReplaceBlueprintOptions_Location_UsEast = "us-east" + ReplaceBlueprintOptions_Location_UsSouth = "us-south" +) + +// Constants associated with the ReplaceBlueprintOptions.Profile property. +// Level of details returned by the get method. +const ( + ReplaceBlueprintOptions_Profile_Ids = "ids" + ReplaceBlueprintOptions_Profile_Summary = "summary" +) + +// NewReplaceBlueprintOptions : Instantiate ReplaceBlueprintOptions +func (*SchematicsV1) NewReplaceBlueprintOptions(blueprintID string, name string) *ReplaceBlueprintOptions { + return &ReplaceBlueprintOptions{ + BlueprintID: core.StringPtr(blueprintID), + Name: core.StringPtr(name), + } +} + +// SetBlueprintID : Allow user to set BlueprintID +func (_options *ReplaceBlueprintOptions) SetBlueprintID(blueprintID string) *ReplaceBlueprintOptions { + _options.BlueprintID = core.StringPtr(blueprintID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ReplaceBlueprintOptions) SetName(name string) *ReplaceBlueprintOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSchemaVersion : Allow user to set SchemaVersion +func (_options *ReplaceBlueprintOptions) SetSchemaVersion(schemaVersion string) *ReplaceBlueprintOptions { + _options.SchemaVersion = core.StringPtr(schemaVersion) + return _options +} + +// SetSource : Allow user to set Source +func (_options *ReplaceBlueprintOptions) SetSource(source *ExternalSource) *ReplaceBlueprintOptions { + _options.Source = source + return _options +} + +// SetConfig : Allow user to set Config +func (_options *ReplaceBlueprintOptions) SetConfig(config []BlueprintConfigItem) *ReplaceBlueprintOptions { + _options.Config = config + return _options +} + +// SetDescription : Allow user to set Description +func (_options *ReplaceBlueprintOptions) SetDescription(description string) *ReplaceBlueprintOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *ReplaceBlueprintOptions) SetResourceGroup(resourceGroup string) *ReplaceBlueprintOptions { + _options.ResourceGroup = core.StringPtr(resourceGroup) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *ReplaceBlueprintOptions) SetTags(tags []string) *ReplaceBlueprintOptions { + _options.Tags = tags + return _options +} + +// SetLocation : Allow user to set Location +func (_options *ReplaceBlueprintOptions) SetLocation(location string) *ReplaceBlueprintOptions { + _options.Location = core.StringPtr(location) + return _options +} + +// SetInputs : Allow user to set Inputs +func (_options *ReplaceBlueprintOptions) SetInputs(inputs []VariableData) *ReplaceBlueprintOptions { + _options.Inputs = inputs + return _options +} + +// SetSettings : Allow user to set Settings +func (_options *ReplaceBlueprintOptions) SetSettings(settings []VariableData) *ReplaceBlueprintOptions { + _options.Settings = settings + return _options +} + +// SetFlow : Allow user to set Flow +func (_options *ReplaceBlueprintOptions) SetFlow(flow *BlueprintFlow) *ReplaceBlueprintOptions { + _options.Flow = flow + return _options +} + +// SetSysLock : Allow user to set SysLock +func (_options *ReplaceBlueprintOptions) SetSysLock(sysLock *SystemLock) *ReplaceBlueprintOptions { + _options.SysLock = sysLock + return _options +} + +// SetUserState : Allow user to set UserState +func (_options *ReplaceBlueprintOptions) SetUserState(userState *UserState) *ReplaceBlueprintOptions { + _options.UserState = userState + return _options +} + +// SetState : Allow user to set State +func (_options *ReplaceBlueprintOptions) SetState(state *BlueprintLiteState) *ReplaceBlueprintOptions { + _options.State = state + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *ReplaceBlueprintOptions) SetProfile(profile string) *ReplaceBlueprintOptions { + _options.Profile = core.StringPtr(profile) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceBlueprintOptions) SetHeaders(param map[string]string) *ReplaceBlueprintOptions { + options.Headers = param + return options +} + // ReplaceInventoryOptions : The ReplaceInventory options. type ReplaceInventoryOptions struct { // Resource Inventory Id. Use `GET /v2/inventories` API to look up the Resource Inventory definition Ids in your IBM @@ -13326,6 +18351,9 @@ type ReplaceWorkspaceOptions struct { // Information about the last job that ran against the workspace. -. WorkspaceStatusMsg *WorkspaceStatusMessage `json:"workspace_status_msg,omitempty"` + // agent id that process workspace jobs. + AgentID *string `json:"agent_id,omitempty"` + // The personal access token to authenticate with your private GitHub or GitLab repository and access your Terraform // template. XGithubToken *string `json:"X-Github-token,omitempty"` @@ -13413,6 +18441,12 @@ func (_options *ReplaceWorkspaceOptions) SetWorkspaceStatusMsg(workspaceStatusMs return _options } +// SetAgentID : Allow user to set AgentID +func (_options *ReplaceWorkspaceOptions) SetAgentID(agentID string) *ReplaceWorkspaceOptions { + _options.AgentID = core.StringPtr(agentID) + return _options +} + // SetXGithubToken : Allow user to set XGithubToken func (_options *ReplaceWorkspaceOptions) SetXGithubToken(xGithubToken string) *ReplaceWorkspaceOptions { _options.XGithubToken = core.StringPtr(xGithubToken) @@ -14679,9 +19713,9 @@ type TemplateSourceDataRequest struct { Injectors []InjectTerraformTemplateInner `json:"injectors,omitempty"` // The Terraform version that you want to use to run your Terraform code. Enter `terraform_v1.1` to use Terraform - // version 1.1, and `terraform_v1.0` to use Terraform version 1.0. This is a required variable. Make sure that your - // Terraform config files are compatible with the Terraform version that you select. For more information, refer to - // [Terraform + // version 1.1, and `terraform_v1.0` to use Terraform version 1.0. This is a required variable. If the Terraform + // version is not specified, By default, Schematics selects the version from your template. For more information, refer + // to [Terraform // version](https://cloud.ibm.com/docs/schematics?topic=schematics-workspace-setup&interface=ui#create-workspace_ui). Type *string `json:"type,omitempty"` @@ -14695,7 +19729,7 @@ type TemplateSourceDataRequest struct { Values *string `json:"values,omitempty"` // List of values metadata. - ValuesMetadata []interface{} `json:"values_metadata,omitempty"` + ValuesMetadata []VariableMetadata `json:"values_metadata,omitempty"` // VariablesRequest -. Variablestore []WorkspaceVariableRequest `json:"variablestore,omitempty"` @@ -14740,7 +19774,7 @@ func UnmarshalTemplateSourceDataRequest(m map[string]json.RawMessage, result int if err != nil { return } - err = core.UnmarshalPrimitive(m, "values_metadata", &obj.ValuesMetadata) + err = core.UnmarshalModel(m, "values_metadata", &obj.ValuesMetadata, UnmarshalVariableMetadata) if err != nil { return } @@ -14784,7 +19818,7 @@ type TemplateSourceDataResponse struct { Values *string `json:"values,omitempty"` // A list of input variables that are associated with the workspace. - ValuesMetadata []interface{} `json:"values_metadata,omitempty"` + ValuesMetadata []VariableMetadata `json:"values_metadata,omitempty"` // The API endpoint to access the input variables that you defined for your template. ValuesURL *string `json:"values_url,omitempty"` @@ -14828,7 +19862,7 @@ func UnmarshalTemplateSourceDataResponse(m map[string]json.RawMessage, result in if err != nil { return } - err = core.UnmarshalPrimitive(m, "values_metadata", &obj.ValuesMetadata) + err = core.UnmarshalModel(m, "values_metadata", &obj.ValuesMetadata, UnmarshalVariableMetadata) if err != nil { return } @@ -14886,13 +19920,14 @@ func UnmarshalTemplateStateStore(m map[string]json.RawMessage, result interface{ // TemplateValues : Information about the input variables that are declared in the template that your workspace points to. type TemplateValues struct { - ValuesMetadata []interface{} `json:"values_metadata,omitempty"` + // Information about workspace variable metadata. + ValuesMetadata []VariableMetadata `json:"values_metadata,omitempty"` } // UnmarshalTemplateValues unmarshals an instance of TemplateValues from the specified map of raw messages. func UnmarshalTemplateValues(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(TemplateValues) - err = core.UnmarshalPrimitive(m, "values_metadata", &obj.ValuesMetadata) + err = core.UnmarshalModel(m, "values_metadata", &obj.ValuesMetadata, UnmarshalVariableMetadata) if err != nil { return } @@ -14982,12 +20017,12 @@ type UpdateActionOptions struct { // Resource-group name for an action. By default, an action is created in `Default` resource group. ResourceGroup *string `json:"resource_group,omitempty"` - // Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then + // Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then // `bastion_connection_type` is not supported. BastionConnectionType *string `json:"bastion_connection_type,omitempty"` - // Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system - // with the public IPs and do not support Bastion host. + // Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows + // system with the public IPs and do not support Bastion host. InventoryConnectionType *string `json:"inventory_connection_type,omitempty"` // Action tags. @@ -15012,13 +20047,13 @@ type UpdateActionOptions struct { Inventory *string `json:"inventory,omitempty"` // credentials of the Action. - Credentials []VariableData `json:"credentials,omitempty"` + Credentials []CredentialVariableData `json:"credentials,omitempty"` // Describes a bastion resource. Bastion *BastionResourceDefinition `json:"bastion,omitempty"` - // User editable variable data and system generated reference to the value. - BastionCredential *VariableData `json:"bastion_credential,omitempty"` + // User editable credential variable data and system generated reference to the value. + BastionCredential *CredentialVariableData `json:"bastion_credential,omitempty"` // Inventory of host and host group for the playbook in `INI` file format. For example, `"targets_ini": // "[webserverhost] @@ -15063,14 +20098,14 @@ const ( ) // Constants associated with the UpdateActionOptions.BastionConnectionType property. -// Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then +// Type of connection to be used when connecting to bastion host. If the `inventory_connection_type=winrm`, then // `bastion_connection_type` is not supported. const ( UpdateActionOptions_BastionConnectionType_Ssh = "ssh" ) // Constants associated with the UpdateActionOptions.InventoryConnectionType property. -// Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system +// Type of connection to be used when connecting to remote host. **Note** Currently, WinRM supports only Windows system // with the public IPs and do not support Bastion host. const ( UpdateActionOptions_InventoryConnectionType_Ssh = "ssh" @@ -15080,7 +20115,6 @@ const ( // Constants associated with the UpdateActionOptions.SourceType property. // Type of source for the Template. const ( - UpdateActionOptions_SourceType_ExternalScm = "external_scm" UpdateActionOptions_SourceType_GitHub = "git_hub" UpdateActionOptions_SourceType_GitHubEnterprise = "git_hub_enterprise" UpdateActionOptions_SourceType_GitLab = "git_lab" @@ -15181,7 +20215,7 @@ func (_options *UpdateActionOptions) SetInventory(inventory string) *UpdateActio } // SetCredentials : Allow user to set Credentials -func (_options *UpdateActionOptions) SetCredentials(credentials []VariableData) *UpdateActionOptions { +func (_options *UpdateActionOptions) SetCredentials(credentials []CredentialVariableData) *UpdateActionOptions { _options.Credentials = credentials return _options } @@ -15193,7 +20227,7 @@ func (_options *UpdateActionOptions) SetBastion(bastion *BastionResourceDefiniti } // SetBastionCredential : Allow user to set BastionCredential -func (_options *UpdateActionOptions) SetBastionCredential(bastionCredential *VariableData) *UpdateActionOptions { +func (_options *UpdateActionOptions) SetBastionCredential(bastionCredential *CredentialVariableData) *UpdateActionOptions { _options.BastionCredential = bastionCredential return _options } @@ -15246,6 +20280,141 @@ func (options *UpdateActionOptions) SetHeaders(param map[string]string) *UpdateA return options } +// UpdateAgentRegistrationOptions : The UpdateAgentRegistration options. +type UpdateAgentRegistrationOptions struct { + // Agent ID to get the details of agent. + AgentID *string `json:"agent_id" validate:"required,ne="` + + // The name of the agent (must be unique, for an account). + Name *string `json:"name" validate:"required"` + + // The location where agent is deployed in the user environment. + AgentLocation *string `json:"agent_location" validate:"required"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location" validate:"required"` + + // The IAM trusted profile id, used by the Agent instance. + ProfileID *string `json:"profile_id" validate:"required"` + + // Agent description. + Description *string `json:"description,omitempty"` + + // The resource-group name for the agent. By default, Agent will be registered in Default Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Tags for the agent. + Tags []string `json:"tags,omitempty"` + + // User defined status of the agent. + UserState *AgentUserState `json:"user_state,omitempty"` + + // Connection status of the agent. + ConnectionState *ConnectionState `json:"connection_state,omitempty"` + + // Computed state of the agent. + SystemState *AgentSystemState `json:"system_state,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the UpdateAgentRegistrationOptions.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + UpdateAgentRegistrationOptions_Location_EuDe = "eu-de" + UpdateAgentRegistrationOptions_Location_EuGb = "eu-gb" + UpdateAgentRegistrationOptions_Location_UsEast = "us-east" + UpdateAgentRegistrationOptions_Location_UsSouth = "us-south" +) + +// NewUpdateAgentRegistrationOptions : Instantiate UpdateAgentRegistrationOptions +func (*SchematicsV1) NewUpdateAgentRegistrationOptions(agentID string, name string, agentLocation string, location string, profileID string) *UpdateAgentRegistrationOptions { + return &UpdateAgentRegistrationOptions{ + AgentID: core.StringPtr(agentID), + Name: core.StringPtr(name), + AgentLocation: core.StringPtr(agentLocation), + Location: core.StringPtr(location), + ProfileID: core.StringPtr(profileID), + } +} + +// SetAgentID : Allow user to set AgentID +func (_options *UpdateAgentRegistrationOptions) SetAgentID(agentID string) *UpdateAgentRegistrationOptions { + _options.AgentID = core.StringPtr(agentID) + return _options +} + +// SetName : Allow user to set Name +func (_options *UpdateAgentRegistrationOptions) SetName(name string) *UpdateAgentRegistrationOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetAgentLocation : Allow user to set AgentLocation +func (_options *UpdateAgentRegistrationOptions) SetAgentLocation(agentLocation string) *UpdateAgentRegistrationOptions { + _options.AgentLocation = core.StringPtr(agentLocation) + return _options +} + +// SetLocation : Allow user to set Location +func (_options *UpdateAgentRegistrationOptions) SetLocation(location string) *UpdateAgentRegistrationOptions { + _options.Location = core.StringPtr(location) + return _options +} + +// SetProfileID : Allow user to set ProfileID +func (_options *UpdateAgentRegistrationOptions) SetProfileID(profileID string) *UpdateAgentRegistrationOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *UpdateAgentRegistrationOptions) SetDescription(description string) *UpdateAgentRegistrationOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *UpdateAgentRegistrationOptions) SetResourceGroup(resourceGroup string) *UpdateAgentRegistrationOptions { + _options.ResourceGroup = core.StringPtr(resourceGroup) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *UpdateAgentRegistrationOptions) SetTags(tags []string) *UpdateAgentRegistrationOptions { + _options.Tags = tags + return _options +} + +// SetUserState : Allow user to set UserState +func (_options *UpdateAgentRegistrationOptions) SetUserState(userState *AgentUserState) *UpdateAgentRegistrationOptions { + _options.UserState = userState + return _options +} + +// SetConnectionState : Allow user to set ConnectionState +func (_options *UpdateAgentRegistrationOptions) SetConnectionState(connectionState *ConnectionState) *UpdateAgentRegistrationOptions { + _options.ConnectionState = connectionState + return _options +} + +// SetSystemState : Allow user to set SystemState +func (_options *UpdateAgentRegistrationOptions) SetSystemState(systemState *AgentSystemState) *UpdateAgentRegistrationOptions { + _options.SystemState = systemState + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateAgentRegistrationOptions) SetHeaders(param map[string]string) *UpdateAgentRegistrationOptions { + options.Headers = param + return options +} + // UpdateJobOptions : The UpdateJob options. type UpdateJobOptions struct { // Job Id. Use `GET /v2/jobs` API to look up the Job Ids in your IBM Cloud account. @@ -15316,6 +20485,7 @@ type UpdateJobOptions struct { // Name of the Schematics automation resource. const ( UpdateJobOptions_CommandObject_Action = "action" + UpdateJobOptions_CommandObject_Blueprint = "blueprint" UpdateJobOptions_CommandObject_Environment = "environment" UpdateJobOptions_CommandObject_System = "system" UpdateJobOptions_CommandObject_Workspace = "workspace" @@ -15326,6 +20496,11 @@ const ( const ( UpdateJobOptions_CommandName_AnsiblePlaybookCheck = "ansible_playbook_check" UpdateJobOptions_CommandName_AnsiblePlaybookRun = "ansible_playbook_run" + UpdateJobOptions_CommandName_BlueprintCreateInit = "blueprint_create_init" + UpdateJobOptions_CommandName_BlueprintDelete = "blueprint_delete" + UpdateJobOptions_CommandName_BlueprintDestroy = "blueprint_destroy" + UpdateJobOptions_CommandName_BlueprintInstall = "blueprint_install" + UpdateJobOptions_CommandName_BlueprintUpdateInit = "blueprint_update_init" UpdateJobOptions_CommandName_CreateAction = "create_action" UpdateJobOptions_CommandName_CreateCart = "create_cart" UpdateJobOptions_CommandName_CreateEnvironment = "create_environment" @@ -15333,9 +20508,10 @@ const ( UpdateJobOptions_CommandName_DeleteAction = "delete_action" UpdateJobOptions_CommandName_DeleteEnvironment = "delete_environment" UpdateJobOptions_CommandName_DeleteWorkspace = "delete_workspace" - UpdateJobOptions_CommandName_EnvironmentInit = "environment_init" + UpdateJobOptions_CommandName_EnvironmentCreateInit = "environment_create_init" UpdateJobOptions_CommandName_EnvironmentInstall = "environment_install" UpdateJobOptions_CommandName_EnvironmentUninstall = "environment_uninstall" + UpdateJobOptions_CommandName_EnvironmentUpdateInit = "environment_update_init" UpdateJobOptions_CommandName_PatchAction = "patch_action" UpdateJobOptions_CommandName_PatchWorkspace = "patch_workspace" UpdateJobOptions_CommandName_PutAction = "put_action" @@ -15469,6 +20645,71 @@ func (options *UpdateJobOptions) SetHeaders(param map[string]string) *UpdateJobO return options } +// UpdateJobStatusOptions : The UpdateJobStatus options. +type UpdateJobStatusOptions struct { + // Job Id. Use `GET /v2/jobs` API to look up the Job Ids in your IBM Cloud account. + JobID *string `json:"job_id" validate:"required,ne="` + + // Id of the JobRunner that processed the request. + AgentSubID *string `json:"agent_sub_id,omitempty"` + + // Name of the Schematics automation resource. + DocType *string `json:"doc_type,omitempty"` + + // Agent job - workspace job status. + WorkspaceStatus *AgentWorkspaceStatusDoc `json:"workspace_status,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the UpdateJobStatusOptions.DocType property. +// Name of the Schematics automation resource. +const ( + UpdateJobStatusOptions_DocType_Action = "action" + UpdateJobStatusOptions_DocType_Blueprint = "blueprint" + UpdateJobStatusOptions_DocType_Environment = "environment" + UpdateJobStatusOptions_DocType_System = "system" + UpdateJobStatusOptions_DocType_Workspace = "workspace" +) + +// NewUpdateJobStatusOptions : Instantiate UpdateJobStatusOptions +func (*SchematicsV1) NewUpdateJobStatusOptions(jobID string) *UpdateJobStatusOptions { + return &UpdateJobStatusOptions{ + JobID: core.StringPtr(jobID), + } +} + +// SetJobID : Allow user to set JobID +func (_options *UpdateJobStatusOptions) SetJobID(jobID string) *UpdateJobStatusOptions { + _options.JobID = core.StringPtr(jobID) + return _options +} + +// SetAgentSubID : Allow user to set AgentSubID +func (_options *UpdateJobStatusOptions) SetAgentSubID(agentSubID string) *UpdateJobStatusOptions { + _options.AgentSubID = core.StringPtr(agentSubID) + return _options +} + +// SetDocType : Allow user to set DocType +func (_options *UpdateJobStatusOptions) SetDocType(docType string) *UpdateJobStatusOptions { + _options.DocType = core.StringPtr(docType) + return _options +} + +// SetWorkspaceStatus : Allow user to set WorkspaceStatus +func (_options *UpdateJobStatusOptions) SetWorkspaceStatus(workspaceStatus *AgentWorkspaceStatusDoc) *UpdateJobStatusOptions { + _options.WorkspaceStatus = workspaceStatus + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateJobStatusOptions) SetHeaders(param map[string]string) *UpdateJobStatusOptions { + options.Headers = param + return options +} + // UpdateKmsSettingsOptions : The UpdateKmsSettings options. type UpdateKmsSettingsOptions struct { // The location to integrate kms instance. For example, location can be `US` and `EU`. @@ -15531,6 +20772,203 @@ func (options *UpdateKmsSettingsOptions) SetHeaders(param map[string]string) *Up return options } +// UpdatePolicyOptions : The UpdatePolicy options. +type UpdatePolicyOptions struct { + // ID to get the details of policy. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // Policy kind or categories for managing and deriving policy decision + // * `agent_assignment_policy` Agent assignment policy for job execution. + PolicyKind *string `json:"policy_kind" validate:"required"` + + // Name of Schematics customization policy. + Name *string `json:"name,omitempty"` + + // The description of Schematics customization policy. + Description *string `json:"description,omitempty"` + + // The resource group name for the policy. By default, Policy will be created in `default` Resource Group. + ResourceGroup *string `json:"resource_group,omitempty"` + + // Tags for the Schematics customization policy. + Tags []string `json:"tags,omitempty"` + + // List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the + // right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, + // provisioned using Schematics. + Location *string `json:"location,omitempty"` + + // User defined status of the Schematics object. + State *UserState `json:"state,omitempty"` + + // The objects for the Schematics policy. + PolicyTarget *PolicyObjects `json:"policy_target,omitempty"` + + // The parameter to tune the Schematics policy. + PolicyParameter *PolicyParameter `json:"policy_parameter,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the UpdatePolicyOptions.PolicyKind property. +// Policy kind or categories for managing and deriving policy decision +// * `agent_assignment_policy` Agent assignment policy for job execution. +const ( + UpdatePolicyOptions_PolicyKind_AgentAssignmentPolicy = "agent_assignment_policy" +) + +// Constants associated with the UpdatePolicyOptions.Location property. +// List of locations supported by IBM Cloud Schematics service. While creating your workspace or action, choose the +// right region, since it cannot be changed. Note, this does not limit the location of the IBM Cloud resources, +// provisioned using Schematics. +const ( + UpdatePolicyOptions_Location_EuDe = "eu-de" + UpdatePolicyOptions_Location_EuGb = "eu-gb" + UpdatePolicyOptions_Location_UsEast = "us-east" + UpdatePolicyOptions_Location_UsSouth = "us-south" +) + +// NewUpdatePolicyOptions : Instantiate UpdatePolicyOptions +func (*SchematicsV1) NewUpdatePolicyOptions(policyID string, policyKind string) *UpdatePolicyOptions { + return &UpdatePolicyOptions{ + PolicyID: core.StringPtr(policyID), + PolicyKind: core.StringPtr(policyKind), + } +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *UpdatePolicyOptions) SetPolicyID(policyID string) *UpdatePolicyOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetPolicyKind : Allow user to set PolicyKind +func (_options *UpdatePolicyOptions) SetPolicyKind(policyKind string) *UpdatePolicyOptions { + _options.PolicyKind = core.StringPtr(policyKind) + return _options +} + +// SetName : Allow user to set Name +func (_options *UpdatePolicyOptions) SetName(name string) *UpdatePolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *UpdatePolicyOptions) SetDescription(description string) *UpdatePolicyOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *UpdatePolicyOptions) SetResourceGroup(resourceGroup string) *UpdatePolicyOptions { + _options.ResourceGroup = core.StringPtr(resourceGroup) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *UpdatePolicyOptions) SetTags(tags []string) *UpdatePolicyOptions { + _options.Tags = tags + return _options +} + +// SetLocation : Allow user to set Location +func (_options *UpdatePolicyOptions) SetLocation(location string) *UpdatePolicyOptions { + _options.Location = core.StringPtr(location) + return _options +} + +// SetState : Allow user to set State +func (_options *UpdatePolicyOptions) SetState(state *UserState) *UpdatePolicyOptions { + _options.State = state + return _options +} + +// SetPolicyTarget : Allow user to set PolicyTarget +func (_options *UpdatePolicyOptions) SetPolicyTarget(policyTarget *PolicyObjects) *UpdatePolicyOptions { + _options.PolicyTarget = policyTarget + return _options +} + +// SetPolicyParameter : Allow user to set PolicyParameter +func (_options *UpdatePolicyOptions) SetPolicyParameter(policyParameter *PolicyParameter) *UpdatePolicyOptions { + _options.PolicyParameter = policyParameter + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePolicyOptions) SetHeaders(param map[string]string) *UpdatePolicyOptions { + options.Headers = param + return options +} + +// UpdateVariablesMetadataOptions : The UpdateVariablesMetadata options. +type UpdateVariablesMetadataOptions struct { + // Job Id. Use `GET /v2/jobs` API to look up the Job Ids in your IBM Cloud account. + JobID *string `json:"job_id" validate:"required,ne="` + + // The ID of the workspace. To find the workspace ID, use the `GET /v1/workspaces` API. + WID *string `json:"w_id" validate:"required,ne="` + + // Name of the Schematics automation resource. + DocType *string `json:"doc_type,omitempty"` + + // Update workspace variables. + WorkspaceVariables *AgentWorkspaceVariablesDoc `json:"workspace_variables,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the UpdateVariablesMetadataOptions.DocType property. +// Name of the Schematics automation resource. +const ( + UpdateVariablesMetadataOptions_DocType_Action = "action" + UpdateVariablesMetadataOptions_DocType_Blueprint = "blueprint" + UpdateVariablesMetadataOptions_DocType_Environment = "environment" + UpdateVariablesMetadataOptions_DocType_System = "system" + UpdateVariablesMetadataOptions_DocType_Workspace = "workspace" +) + +// NewUpdateVariablesMetadataOptions : Instantiate UpdateVariablesMetadataOptions +func (*SchematicsV1) NewUpdateVariablesMetadataOptions(jobID string, wID string) *UpdateVariablesMetadataOptions { + return &UpdateVariablesMetadataOptions{ + JobID: core.StringPtr(jobID), + WID: core.StringPtr(wID), + } +} + +// SetJobID : Allow user to set JobID +func (_options *UpdateVariablesMetadataOptions) SetJobID(jobID string) *UpdateVariablesMetadataOptions { + _options.JobID = core.StringPtr(jobID) + return _options +} + +// SetWID : Allow user to set WID +func (_options *UpdateVariablesMetadataOptions) SetWID(wID string) *UpdateVariablesMetadataOptions { + _options.WID = core.StringPtr(wID) + return _options +} + +// SetDocType : Allow user to set DocType +func (_options *UpdateVariablesMetadataOptions) SetDocType(docType string) *UpdateVariablesMetadataOptions { + _options.DocType = core.StringPtr(docType) + return _options +} + +// SetWorkspaceVariables : Allow user to set WorkspaceVariables +func (_options *UpdateVariablesMetadataOptions) SetWorkspaceVariables(workspaceVariables *AgentWorkspaceVariablesDoc) *UpdateVariablesMetadataOptions { + _options.WorkspaceVariables = workspaceVariables + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVariablesMetadataOptions) SetHeaders(param map[string]string) *UpdateVariablesMetadataOptions { + options.Headers = param + return options +} + // UpdateWorkspaceOptions : The UpdateWorkspace options. type UpdateWorkspaceOptions struct { // The ID of the workspace. To find the workspace ID, use the `GET /v1/workspaces` API. @@ -15571,6 +21009,9 @@ type UpdateWorkspaceOptions struct { // Information about the last job that ran against the workspace. -. WorkspaceStatusMsg *WorkspaceStatusMessage `json:"workspace_status_msg,omitempty"` + // agent id that process workspace jobs. + AgentID *string `json:"agent_id,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -15654,6 +21095,12 @@ func (_options *UpdateWorkspaceOptions) SetWorkspaceStatusMsg(workspaceStatusMsg return _options } +// SetAgentID : Allow user to set AgentID +func (_options *UpdateWorkspaceOptions) SetAgentID(agentID string) *UpdateWorkspaceOptions { + _options.AgentID = core.StringPtr(agentID) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateWorkspaceOptions) SetHeaders(param map[string]string) *UpdateWorkspaceOptions { options.Headers = param @@ -16639,6 +22086,9 @@ type WorkspaceResponse struct { // Information about the last job that ran against the workspace. -. WorkspaceStatusMsg *WorkspaceStatusMessage `json:"workspace_status_msg,omitempty"` + + // Agent name, Agent id and associated policy ID information. + AgentInfo *AgentInfo `json:"agent_info,omitempty"` } // UnmarshalWorkspaceResponse unmarshals an instance of WorkspaceResponse from the specified map of raw messages. @@ -16756,6 +22206,10 @@ func UnmarshalWorkspaceResponse(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "agent_info", &obj.AgentInfo, UnmarshalAgentInfo) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } diff --git a/schematicsv1/schematics_v1_test.go b/schematicsv1/schematics_v1_test.go index d7d9701..78cacec 100644 --- a/schematicsv1/schematics_v1_test.go +++ b/schematicsv1/schematics_v1_test.go @@ -989,30 +989,32 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the ProcessTemplateMetaDataOptions model processTemplateMetaDataOptionsModel := new(schematicsv1.ProcessTemplateMetaDataOptions) @@ -1087,30 +1089,32 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the ProcessTemplateMetaDataOptions model processTemplateMetaDataOptionsModel := new(schematicsv1.ProcessTemplateMetaDataOptions) @@ -1193,30 +1197,32 @@ var _ = Describe(`SchematicsV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the ProcessTemplateMetaDataOptions model processTemplateMetaDataOptionsModel := new(schematicsv1.ProcessTemplateMetaDataOptions) @@ -1242,30 +1248,32 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the ProcessTemplateMetaDataOptions model processTemplateMetaDataOptionsModel := new(schematicsv1.ProcessTemplateMetaDataOptions) @@ -1312,30 +1320,32 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the ProcessTemplateMetaDataOptions model processTemplateMetaDataOptionsModel := new(schematicsv1.ProcessTemplateMetaDataOptions) @@ -1371,6 +1381,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) @@ -1388,6 +1399,7 @@ var _ = Describe(`SchematicsV1`, func() { listWorkspacesOptionsModel := new(schematicsv1.ListWorkspacesOptions) listWorkspacesOptionsModel.Offset = core.Int64Ptr(int64(0)) listWorkspacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listWorkspacesOptionsModel.Profile = core.StringPtr("ids") listWorkspacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := schematicsService.ListWorkspaces(listWorkspacesOptionsModel) @@ -1420,13 +1432,14 @@ var _ = Describe(`SchematicsV1`, func() { Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"count": 5, "limit": 5, "offset": 6, "workspaces": [{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}]}`) + fmt.Fprintf(res, "%s", `{"count": 5, "limit": 5, "offset": 6, "workspaces": [{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}]}`) })) }) It(`Invoke ListWorkspaces successfully with retries`, func() { @@ -1442,6 +1455,7 @@ var _ = Describe(`SchematicsV1`, func() { listWorkspacesOptionsModel := new(schematicsv1.ListWorkspacesOptions) listWorkspacesOptionsModel.Offset = core.Int64Ptr(int64(0)) listWorkspacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listWorkspacesOptionsModel.Profile = core.StringPtr("ids") listWorkspacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -1480,10 +1494,11 @@ var _ = Describe(`SchematicsV1`, func() { Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"count": 5, "limit": 5, "offset": 6, "workspaces": [{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}]}`) + fmt.Fprintf(res, "%s", `{"count": 5, "limit": 5, "offset": 6, "workspaces": [{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}]}`) })) }) It(`Invoke ListWorkspaces successfully`, func() { @@ -1504,6 +1519,7 @@ var _ = Describe(`SchematicsV1`, func() { listWorkspacesOptionsModel := new(schematicsv1.ListWorkspacesOptions) listWorkspacesOptionsModel.Offset = core.Int64Ptr(int64(0)) listWorkspacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listWorkspacesOptionsModel.Profile = core.StringPtr("ids") listWorkspacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -1525,6 +1541,7 @@ var _ = Describe(`SchematicsV1`, func() { listWorkspacesOptionsModel := new(schematicsv1.ListWorkspacesOptions) listWorkspacesOptionsModel.Offset = core.Int64Ptr(int64(0)) listWorkspacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listWorkspacesOptionsModel.Profile = core.StringPtr("ids") listWorkspacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") @@ -1560,6 +1577,7 @@ var _ = Describe(`SchematicsV1`, func() { listWorkspacesOptionsModel := new(schematicsv1.ListWorkspacesOptions) listWorkspacesOptionsModel.Offset = core.Int64Ptr(int64(0)) listWorkspacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listWorkspacesOptionsModel.Profile = core.StringPtr("ids") listWorkspacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -1650,6 +1668,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -1670,7 +1710,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoRequest model @@ -1706,6 +1746,7 @@ var _ = Describe(`SchematicsV1`, func() { createWorkspaceOptionsModel.TemplateRepo = templateRepoRequestModel createWorkspaceOptionsModel.Type = []string{"testString"} createWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusRequestModel + createWorkspaceOptionsModel.AgentID = core.StringPtr("testString") createWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") createWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -1761,7 +1802,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}`) + fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}`) })) }) It(`Invoke CreateWorkspace successfully with retries`, func() { @@ -1823,6 +1864,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -1843,7 +1906,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoRequest model @@ -1879,6 +1942,7 @@ var _ = Describe(`SchematicsV1`, func() { createWorkspaceOptionsModel.TemplateRepo = templateRepoRequestModel createWorkspaceOptionsModel.Type = []string{"testString"} createWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusRequestModel + createWorkspaceOptionsModel.AgentID = core.StringPtr("testString") createWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") createWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -1937,7 +2001,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}`) + fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}`) })) }) It(`Invoke CreateWorkspace successfully`, func() { @@ -2004,6 +2068,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -2024,7 +2110,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoRequest model @@ -2060,6 +2146,7 @@ var _ = Describe(`SchematicsV1`, func() { createWorkspaceOptionsModel.TemplateRepo = templateRepoRequestModel createWorkspaceOptionsModel.Type = []string{"testString"} createWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusRequestModel + createWorkspaceOptionsModel.AgentID = core.StringPtr("testString") createWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") createWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -2128,6 +2215,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -2148,7 +2257,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoRequest model @@ -2184,6 +2293,7 @@ var _ = Describe(`SchematicsV1`, func() { createWorkspaceOptionsModel.TemplateRepo = templateRepoRequestModel createWorkspaceOptionsModel.Type = []string{"testString"} createWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusRequestModel + createWorkspaceOptionsModel.AgentID = core.StringPtr("testString") createWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") createWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -2266,6 +2376,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -2286,7 +2418,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoRequest model @@ -2322,6 +2454,7 @@ var _ = Describe(`SchematicsV1`, func() { createWorkspaceOptionsModel.TemplateRepo = templateRepoRequestModel createWorkspaceOptionsModel.Type = []string{"testString"} createWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusRequestModel + createWorkspaceOptionsModel.AgentID = core.StringPtr("testString") createWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") createWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -2400,7 +2533,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}`) + fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}`) })) }) It(`Invoke GetWorkspace successfully with retries`, func() { @@ -2454,7 +2587,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}`) + fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}`) })) }) It(`Invoke GetWorkspace successfully`, func() { @@ -2625,6 +2758,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -2645,7 +2800,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -2684,6 +2839,7 @@ var _ = Describe(`SchematicsV1`, func() { replaceWorkspaceOptionsModel.Type = []string{"testString"} replaceWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel replaceWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + replaceWorkspaceOptionsModel.AgentID = core.StringPtr("testString") replaceWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") replaceWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -2739,7 +2895,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}`) + fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}`) })) }) It(`Invoke ReplaceWorkspace successfully with retries`, func() { @@ -2801,6 +2957,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -2821,7 +2999,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -2860,6 +3038,7 @@ var _ = Describe(`SchematicsV1`, func() { replaceWorkspaceOptionsModel.Type = []string{"testString"} replaceWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel replaceWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + replaceWorkspaceOptionsModel.AgentID = core.StringPtr("testString") replaceWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") replaceWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -2918,7 +3097,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}`) + fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}`) })) }) It(`Invoke ReplaceWorkspace successfully`, func() { @@ -2985,6 +3164,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -3005,7 +3206,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -3044,6 +3245,7 @@ var _ = Describe(`SchematicsV1`, func() { replaceWorkspaceOptionsModel.Type = []string{"testString"} replaceWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel replaceWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + replaceWorkspaceOptionsModel.AgentID = core.StringPtr("testString") replaceWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") replaceWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -3112,6 +3314,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -3132,7 +3356,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -3171,6 +3395,7 @@ var _ = Describe(`SchematicsV1`, func() { replaceWorkspaceOptionsModel.Type = []string{"testString"} replaceWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel replaceWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + replaceWorkspaceOptionsModel.AgentID = core.StringPtr("testString") replaceWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") replaceWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -3260,6 +3485,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -3280,7 +3527,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -3319,6 +3566,7 @@ var _ = Describe(`SchematicsV1`, func() { replaceWorkspaceOptionsModel.Type = []string{"testString"} replaceWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel replaceWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + replaceWorkspaceOptionsModel.AgentID = core.StringPtr("testString") replaceWorkspaceOptionsModel.XGithubToken = core.StringPtr("testString") replaceWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -3589,6 +3837,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -3609,7 +3879,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -3648,6 +3918,7 @@ var _ = Describe(`SchematicsV1`, func() { updateWorkspaceOptionsModel.Type = []string{"testString"} updateWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel updateWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + updateWorkspaceOptionsModel.AgentID = core.StringPtr("testString") updateWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := schematicsService.UpdateWorkspace(updateWorkspaceOptionsModel) @@ -3700,7 +3971,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}`) + fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}`) })) }) It(`Invoke UpdateWorkspace successfully with retries`, func() { @@ -3762,17 +4033,39 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} - // Construct an instance of the WorkspaceVariableRequest model - workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) - workspaceVariableRequestModel.Description = core.StringPtr("testString") - workspaceVariableRequestModel.Name = core.StringPtr("testString") - workspaceVariableRequestModel.Secure = core.BoolPtr(true) - workspaceVariableRequestModel.Type = core.StringPtr("testString") - workspaceVariableRequestModel.UseDefault = core.BoolPtr(true) - workspaceVariableRequestModel.Value = core.StringPtr("testString") - - // Construct an instance of the TemplateSourceDataRequest model - templateSourceDataRequestModel := new(schematicsv1.TemplateSourceDataRequest) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the WorkspaceVariableRequest model + workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) + workspaceVariableRequestModel.Description = core.StringPtr("testString") + workspaceVariableRequestModel.Name = core.StringPtr("testString") + workspaceVariableRequestModel.Secure = core.BoolPtr(true) + workspaceVariableRequestModel.Type = core.StringPtr("testString") + workspaceVariableRequestModel.UseDefault = core.BoolPtr(true) + workspaceVariableRequestModel.Value = core.StringPtr("testString") + + // Construct an instance of the TemplateSourceDataRequest model + templateSourceDataRequestModel := new(schematicsv1.TemplateSourceDataRequest) templateSourceDataRequestModel.EnvValues = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} templateSourceDataRequestModel.EnvValuesMetadata = []schematicsv1.EnvironmentValuesMetadata{*environmentValuesMetadataModel} templateSourceDataRequestModel.Folder = core.StringPtr("testString") @@ -3782,7 +4075,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -3821,6 +4114,7 @@ var _ = Describe(`SchematicsV1`, func() { updateWorkspaceOptionsModel.Type = []string{"testString"} updateWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel updateWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + updateWorkspaceOptionsModel.AgentID = core.StringPtr("testString") updateWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -3876,7 +4170,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}}`) + fmt.Fprintf(res, "%s", `{"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}`) })) }) It(`Invoke UpdateWorkspace successfully`, func() { @@ -3943,6 +4237,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -3963,7 +4279,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -4002,6 +4318,7 @@ var _ = Describe(`SchematicsV1`, func() { updateWorkspaceOptionsModel.Type = []string{"testString"} updateWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel updateWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + updateWorkspaceOptionsModel.AgentID = core.StringPtr("testString") updateWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -4069,6 +4386,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -4089,7 +4428,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -4128,6 +4467,7 @@ var _ = Describe(`SchematicsV1`, func() { updateWorkspaceOptionsModel.Type = []string{"testString"} updateWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel updateWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + updateWorkspaceOptionsModel.AgentID = core.StringPtr("testString") updateWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") @@ -4216,6 +4556,28 @@ var _ = Describe(`SchematicsV1`, func() { injectTerraformTemplateInnerModel.TftName = core.StringPtr("testString") injectTerraformTemplateInnerModel.TftParameters = []schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) workspaceVariableRequestModel.Description = core.StringPtr("testString") @@ -4236,7 +4598,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} // Construct an instance of the TemplateRepoUpdateRequest model @@ -4275,6 +4637,7 @@ var _ = Describe(`SchematicsV1`, func() { updateWorkspaceOptionsModel.Type = []string{"testString"} updateWorkspaceOptionsModel.WorkspaceStatus = workspaceStatusUpdateRequestModel updateWorkspaceOptionsModel.WorkspaceStatusMsg = workspaceStatusMessageModel + updateWorkspaceOptionsModel.AgentID = core.StringPtr("testString") updateWorkspaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -4824,7 +5187,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"values_metadata": [{"anyKey": "anyValue"}]}`) + fmt.Fprintf(res, "%s", `{"values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}]}`) })) }) It(`Invoke GetWorkspaceInputs successfully with retries`, func() { @@ -4879,7 +5242,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"values_metadata": [{"anyKey": "anyValue"}]}`) + fmt.Fprintf(res, "%s", `{"values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}]}`) })) }) It(`Invoke GetWorkspaceInputs successfully`, func() { @@ -5349,7 +5712,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_created_on": "ClusterCreatedOn", "cluster_id": "ClusterID", "cluster_name": "ClusterName", "cluster_type": "ClusterType", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID", "worker_count": 11, "worker_machine_type": "WorkerMachineType"}, "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}]}`) + fmt.Fprintf(res, "%s", `{"runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_created_on": "ClusterCreatedOn", "cluster_id": "ClusterID", "cluster_name": "ClusterName", "cluster_type": "ClusterType", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID", "worker_count": 11, "worker_machine_type": "WorkerMachineType"}, "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}]}`) })) }) It(`Invoke GetAllWorkspaceInputs successfully with retries`, func() { @@ -5403,7 +5766,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_created_on": "ClusterCreatedOn", "cluster_id": "ClusterID", "cluster_name": "ClusterName", "cluster_type": "ClusterType", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID", "worker_count": 11, "worker_machine_type": "WorkerMachineType"}, "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"anyKey": "anyValue"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}]}`) + fmt.Fprintf(res, "%s", `{"runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_created_on": "ClusterCreatedOn", "cluster_id": "ClusterID", "cluster_name": "ClusterName", "cluster_type": "ClusterType", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID", "worker_count": 11, "worker_machine_type": "WorkerMachineType"}, "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}]}`) })) }) It(`Invoke GetAllWorkspaceInputs successfully`, func() { @@ -7609,30 +7972,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -7663,11 +8055,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -7695,9 +8082,9 @@ var _ = Describe(`SchematicsV1`, func() { createActionOptionsModel.SourceType = core.StringPtr("local") createActionOptionsModel.CommandParameter = core.StringPtr("testString") createActionOptionsModel.Inventory = core.StringPtr("testString") - createActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + createActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} createActionOptionsModel.Bastion = bastionResourceDefinitionModel - createActionOptionsModel.BastionCredential = variableDataModel + createActionOptionsModel.BastionCredential = credentialVariableDataModel createActionOptionsModel.TargetsIni = core.StringPtr("testString") createActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} createActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -7759,7 +8146,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) + fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) })) }) It(`Invoke CreateAction successfully with retries`, func() { @@ -7777,30 +8164,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -7831,11 +8247,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -7863,9 +8274,9 @@ var _ = Describe(`SchematicsV1`, func() { createActionOptionsModel.SourceType = core.StringPtr("local") createActionOptionsModel.CommandParameter = core.StringPtr("testString") createActionOptionsModel.Inventory = core.StringPtr("testString") - createActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + createActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} createActionOptionsModel.Bastion = bastionResourceDefinitionModel - createActionOptionsModel.BastionCredential = variableDataModel + createActionOptionsModel.BastionCredential = credentialVariableDataModel createActionOptionsModel.TargetsIni = core.StringPtr("testString") createActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} createActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -7930,7 +8341,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) + fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) })) }) It(`Invoke CreateAction successfully`, func() { @@ -7953,30 +8364,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -8007,11 +8447,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -8039,9 +8474,9 @@ var _ = Describe(`SchematicsV1`, func() { createActionOptionsModel.SourceType = core.StringPtr("local") createActionOptionsModel.CommandParameter = core.StringPtr("testString") createActionOptionsModel.Inventory = core.StringPtr("testString") - createActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + createActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} createActionOptionsModel.Bastion = bastionResourceDefinitionModel - createActionOptionsModel.BastionCredential = variableDataModel + createActionOptionsModel.BastionCredential = credentialVariableDataModel createActionOptionsModel.TargetsIni = core.StringPtr("testString") createActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} createActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -8072,30 +8507,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -8126,11 +8590,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -8158,9 +8617,9 @@ var _ = Describe(`SchematicsV1`, func() { createActionOptionsModel.SourceType = core.StringPtr("local") createActionOptionsModel.CommandParameter = core.StringPtr("testString") createActionOptionsModel.Inventory = core.StringPtr("testString") - createActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + createActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} createActionOptionsModel.Bastion = bastionResourceDefinitionModel - createActionOptionsModel.BastionCredential = variableDataModel + createActionOptionsModel.BastionCredential = credentialVariableDataModel createActionOptionsModel.TargetsIni = core.StringPtr("testString") createActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} createActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -8205,30 +8664,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -8259,11 +8747,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -8291,9 +8774,9 @@ var _ = Describe(`SchematicsV1`, func() { createActionOptionsModel.SourceType = core.StringPtr("local") createActionOptionsModel.CommandParameter = core.StringPtr("testString") createActionOptionsModel.Inventory = core.StringPtr("testString") - createActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + createActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} createActionOptionsModel.Bastion = bastionResourceDefinitionModel - createActionOptionsModel.BastionCredential = variableDataModel + createActionOptionsModel.BastionCredential = credentialVariableDataModel createActionOptionsModel.TargetsIni = core.StringPtr("testString") createActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} createActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -8381,7 +8864,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) + fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) })) }) It(`Invoke GetAction successfully with retries`, func() { @@ -8437,7 +8920,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) + fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) })) }) It(`Invoke GetAction successfully`, func() { @@ -8643,30 +9126,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -8697,11 +9209,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -8730,9 +9237,9 @@ var _ = Describe(`SchematicsV1`, func() { updateActionOptionsModel.SourceType = core.StringPtr("local") updateActionOptionsModel.CommandParameter = core.StringPtr("testString") updateActionOptionsModel.Inventory = core.StringPtr("testString") - updateActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + updateActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} updateActionOptionsModel.Bastion = bastionResourceDefinitionModel - updateActionOptionsModel.BastionCredential = variableDataModel + updateActionOptionsModel.BastionCredential = credentialVariableDataModel updateActionOptionsModel.TargetsIni = core.StringPtr("testString") updateActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} updateActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -8794,7 +9301,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) + fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) })) }) It(`Invoke UpdateAction successfully with retries`, func() { @@ -8812,30 +9319,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -8866,11 +9402,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -8899,9 +9430,9 @@ var _ = Describe(`SchematicsV1`, func() { updateActionOptionsModel.SourceType = core.StringPtr("local") updateActionOptionsModel.CommandParameter = core.StringPtr("testString") updateActionOptionsModel.Inventory = core.StringPtr("testString") - updateActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + updateActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} updateActionOptionsModel.Bastion = bastionResourceDefinitionModel - updateActionOptionsModel.BastionCredential = variableDataModel + updateActionOptionsModel.BastionCredential = credentialVariableDataModel updateActionOptionsModel.TargetsIni = core.StringPtr("testString") updateActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} updateActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -8966,7 +9497,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) + fmt.Fprintf(res, "%s", `{"name": "Stop Action", "description": "The description of your action. The description can be up to 2048 characters long in size. **Example** you can use the description to stop the targets.", "location": "us-south", "resource_group": "ResourceGroup", "bastion_connection_type": "ssh", "inventory_connection_type": "ssh", "tags": ["Tags"], "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "source_readme_url": "SourceReadmeURL", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "source_type": "local", "command_parameter": "CommandParameter", "inventory": "Inventory", "credentials": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "bastion": {"name": "Name", "host": "Host"}, "bastion_credential": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "string", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "immutable": false, "hidden": true, "required": true, "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "targets_ini": "TargetsIni", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "id": "ID", "crn": "Crn", "account": "Account", "source_created_at": "2019-01-01T12:00:00.000Z", "source_created_by": "SourceCreatedBy", "source_updated_at": "2019-01-01T12:00:00.000Z", "source_updated_by": "SourceUpdatedBy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "state": {"status_code": "normal", "status_job_id": "StatusJobID", "status_message": "StatusMessage"}, "playbook_names": ["PlaybookNames"], "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}}`) })) }) It(`Invoke UpdateAction successfully`, func() { @@ -8989,30 +9520,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -9043,11 +9603,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -9076,9 +9631,9 @@ var _ = Describe(`SchematicsV1`, func() { updateActionOptionsModel.SourceType = core.StringPtr("local") updateActionOptionsModel.CommandParameter = core.StringPtr("testString") updateActionOptionsModel.Inventory = core.StringPtr("testString") - updateActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + updateActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} updateActionOptionsModel.Bastion = bastionResourceDefinitionModel - updateActionOptionsModel.BastionCredential = variableDataModel + updateActionOptionsModel.BastionCredential = credentialVariableDataModel updateActionOptionsModel.TargetsIni = core.StringPtr("testString") updateActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} updateActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -9109,30 +9664,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -9163,11 +9747,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -9196,9 +9775,9 @@ var _ = Describe(`SchematicsV1`, func() { updateActionOptionsModel.SourceType = core.StringPtr("local") updateActionOptionsModel.CommandParameter = core.StringPtr("testString") updateActionOptionsModel.Inventory = core.StringPtr("testString") - updateActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + updateActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} updateActionOptionsModel.Bastion = bastionResourceDefinitionModel - updateActionOptionsModel.BastionCredential = variableDataModel + updateActionOptionsModel.BastionCredential = credentialVariableDataModel updateActionOptionsModel.TargetsIni = core.StringPtr("testString") updateActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} updateActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -9250,30 +9829,59 @@ var _ = Describe(`SchematicsV1`, func() { userStateModel.SetBy = core.StringPtr("testString") userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -9304,11 +9912,6 @@ var _ = Describe(`SchematicsV1`, func() { variableDataModel.UseDefault = core.BoolPtr(true) variableDataModel.Metadata = variableMetadataModel - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) actionStateModel.StatusCode = core.StringPtr("normal") @@ -9337,9 +9940,9 @@ var _ = Describe(`SchematicsV1`, func() { updateActionOptionsModel.SourceType = core.StringPtr("local") updateActionOptionsModel.CommandParameter = core.StringPtr("testString") updateActionOptionsModel.Inventory = core.StringPtr("testString") - updateActionOptionsModel.Credentials = []schematicsv1.VariableData{*variableDataModel} + updateActionOptionsModel.Credentials = []schematicsv1.CredentialVariableData{*credentialVariableDataModel} updateActionOptionsModel.Bastion = bastionResourceDefinitionModel - updateActionOptionsModel.BastionCredential = variableDataModel + updateActionOptionsModel.BastionCredential = credentialVariableDataModel updateActionOptionsModel.TargetsIni = core.StringPtr("testString") updateActionOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} updateActionOptionsModel.Outputs = []schematicsv1.VariableData{*variableDataModel} @@ -11718,9 +12321,10 @@ var _ = Describe(`SchematicsV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) - Expect(req.URL.Query()["resource"]).To(Equal([]string{"workspace"})) + Expect(req.URL.Query()["resource"]).To(Equal([]string{"workspaces"})) Expect(req.URL.Query()["resource_id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["action_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["workspace_id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["list"]).To(Equal([]string{"all"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) @@ -11741,9 +12345,10 @@ var _ = Describe(`SchematicsV1`, func() { listJobsOptionsModel.Limit = core.Int64Ptr(int64(1)) listJobsOptionsModel.Sort = core.StringPtr("testString") listJobsOptionsModel.Profile = core.StringPtr("ids") - listJobsOptionsModel.Resource = core.StringPtr("workspace") + listJobsOptionsModel.Resource = core.StringPtr("workspaces") listJobsOptionsModel.ResourceID = core.StringPtr("testString") listJobsOptionsModel.ActionID = core.StringPtr("testString") + listJobsOptionsModel.WorkspaceID = core.StringPtr("testString") listJobsOptionsModel.List = core.StringPtr("all") listJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -11779,9 +12384,10 @@ var _ = Describe(`SchematicsV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) - Expect(req.URL.Query()["resource"]).To(Equal([]string{"workspace"})) + Expect(req.URL.Query()["resource"]).To(Equal([]string{"workspaces"})) Expect(req.URL.Query()["resource_id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["action_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["workspace_id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["list"]).To(Equal([]string{"all"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -11807,9 +12413,10 @@ var _ = Describe(`SchematicsV1`, func() { listJobsOptionsModel.Limit = core.Int64Ptr(int64(1)) listJobsOptionsModel.Sort = core.StringPtr("testString") listJobsOptionsModel.Profile = core.StringPtr("ids") - listJobsOptionsModel.Resource = core.StringPtr("workspace") + listJobsOptionsModel.Resource = core.StringPtr("workspaces") listJobsOptionsModel.ResourceID = core.StringPtr("testString") listJobsOptionsModel.ActionID = core.StringPtr("testString") + listJobsOptionsModel.WorkspaceID = core.StringPtr("testString") listJobsOptionsModel.List = core.StringPtr("all") listJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -11851,9 +12458,10 @@ var _ = Describe(`SchematicsV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) - Expect(req.URL.Query()["resource"]).To(Equal([]string{"workspace"})) + Expect(req.URL.Query()["resource"]).To(Equal([]string{"workspaces"})) Expect(req.URL.Query()["resource_id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["action_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["workspace_id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["list"]).To(Equal([]string{"all"})) // Set mock response res.Header().Set("Content-type", "application/json") @@ -11881,9 +12489,10 @@ var _ = Describe(`SchematicsV1`, func() { listJobsOptionsModel.Limit = core.Int64Ptr(int64(1)) listJobsOptionsModel.Sort = core.StringPtr("testString") listJobsOptionsModel.Profile = core.StringPtr("ids") - listJobsOptionsModel.Resource = core.StringPtr("workspace") + listJobsOptionsModel.Resource = core.StringPtr("workspaces") listJobsOptionsModel.ResourceID = core.StringPtr("testString") listJobsOptionsModel.ActionID = core.StringPtr("testString") + listJobsOptionsModel.WorkspaceID = core.StringPtr("testString") listJobsOptionsModel.List = core.StringPtr("all") listJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -11908,9 +12517,10 @@ var _ = Describe(`SchematicsV1`, func() { listJobsOptionsModel.Limit = core.Int64Ptr(int64(1)) listJobsOptionsModel.Sort = core.StringPtr("testString") listJobsOptionsModel.Profile = core.StringPtr("ids") - listJobsOptionsModel.Resource = core.StringPtr("workspace") + listJobsOptionsModel.Resource = core.StringPtr("workspaces") listJobsOptionsModel.ResourceID = core.StringPtr("testString") listJobsOptionsModel.ActionID = core.StringPtr("testString") + listJobsOptionsModel.WorkspaceID = core.StringPtr("testString") listJobsOptionsModel.List = core.StringPtr("all") listJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -11949,9 +12559,10 @@ var _ = Describe(`SchematicsV1`, func() { listJobsOptionsModel.Limit = core.Int64Ptr(int64(1)) listJobsOptionsModel.Sort = core.StringPtr("testString") listJobsOptionsModel.Profile = core.StringPtr("ids") - listJobsOptionsModel.Resource = core.StringPtr("workspace") + listJobsOptionsModel.Resource = core.StringPtr("workspaces") listJobsOptionsModel.ResourceID = core.StringPtr("testString") listJobsOptionsModel.ActionID = core.StringPtr("testString") + listJobsOptionsModel.WorkspaceID = core.StringPtr("testString") listJobsOptionsModel.List = core.StringPtr("all") listJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -12138,30 +12749,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -12318,7 +12931,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) + fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) })) }) It(`Invoke CreateJob successfully with retries`, func() { @@ -12475,30 +13088,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -12658,7 +13273,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) + fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) })) }) It(`Invoke CreateJob successfully`, func() { @@ -12820,30 +13435,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -13108,30 +13725,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -13417,30 +14036,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -13623,7 +14244,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) + fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) })) }) It(`Invoke GetJob successfully with retries`, func() { @@ -13679,7 +14300,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) + fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) })) }) It(`Invoke GetJob successfully`, func() { @@ -13948,30 +14569,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -14129,7 +14752,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) + fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) })) }) It(`Invoke UpdateJob successfully with retries`, func() { @@ -14286,30 +14909,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -14470,7 +15095,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) + fmt.Fprintf(res, "%s", `{"command_object": "workspace", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "command_parameter": "CommandParameter", "command_options": ["CommandOptions"], "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "tags": ["Tags"], "id": "ID", "name": "Name", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "submitted_at": "2019-01-01T12:00:00.000Z", "submitted_by": "SubmittedBy", "start_at": "2019-01-01T12:00:00.000Z", "end_at": "2019-01-01T12:00:00.000Z", "duration": "Duration", "status": {"position_in_queue": 15, "total_in_queue": 12, "workspace_job_status": {"workspace_name": "WorkspaceName", "status_code": "job_pending", "status_message": "StatusMessage", "flow_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "template_status": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z", "commands": [{"name": "Name", "outcome": "Outcome"}]}, "action_job_status": {"action_name": "ActionName", "status_code": "job_pending", "status_message": "StatusMessage", "bastion_status_code": "none", "bastion_status_message": "BastionStatusMessage", "targets_status_code": "none", "targets_status_message": "TargetsStatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}, "system_job_status": {"system_status_message": "SystemStatusMessage", "system_status_code": "job_pending", "schematics_resource_status": [{"status_code": "job_pending", "status_message": "StatusMessage", "schematics_resource_id": "SchematicsResourceID", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_status": {"flow_id": "FlowID", "flow_name": "FlowName", "status_code": "job_pending", "status_message": "StatusMessage", "workitems": [{"workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName", "job_id": "JobID", "status_code": "job_pending", "status_message": "StatusMessage", "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "data": {"job_type": "repo_download_job", "workspace_job_data": {"workspace_name": "WorkspaceName", "flow_id": "FlowID", "flow_name": "FlowName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "template_data": [{"template_id": "TemplateID", "template_name": "TemplateName", "flow_index": 9, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}, "action_job_data": {"action_name": "ActionName", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "updated_at": "2019-01-01T12:00:00.000Z", "inventory_record": {"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}, "materialized_inventory": "MaterializedInventory"}, "system_job_data": {"key_id": "KeyID", "schematics_resource_id": ["SchematicsResourceID"], "updated_at": "2019-01-01T12:00:00.000Z"}, "flow_job_data": {"flow_id": "FlowID", "flow_name": "FlowName", "workitems": [{"command_object_id": "CommandObjectID", "command_object_name": "CommandObjectName", "layers": "Layers", "source_type": "local", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_id": "JobID", "job_status": "job_pending"}, "updated_at": "2019-01-01T12:00:00.000Z"}], "updated_at": "2019-01-01T12:00:00.000Z"}}, "bastion": {"name": "Name", "host": "Host"}, "log_summary": {"job_id": "JobID", "job_type": "repo_download_job", "log_start_at": "2019-01-01T12:00:00.000Z", "log_analyzed_till": "2019-01-01T12:00:00.000Z", "elapsed_time": 11, "log_errors": [{"error_code": "ErrorCode", "error_msg": "ErrorMsg", "error_count": 10}], "repo_download_job": {"scanned_file_count": 16, "quarantined_file_count": 20, "detected_filetype": "DetectedFiletype", "inputs_count": "InputsCount", "outputs_count": "OutputsCount"}, "workspace_job": {"resources_add": 12, "resources_modify": 15, "resources_destroy": 16}, "flow_job": {"workitems_completed": 18, "workitems_pending": 16, "workitems_failed": 15, "workitems": [{"workspace_id": "WorkspaceID", "job_id": "JobID", "resources_add": 12, "resources_modify": 15, "resources_destroy": 16, "log_url": "LogURL"}]}, "action_job": {"target_count": 11, "task_count": 9, "play_count": 9, "recap": {"target": ["Target"], "ok": 2, "changed": 7, "failed": 6, "skipped": 7, "unreachable": 11}}, "system_job": {"target_count": 11, "success": 7, "failed": 6}}, "log_store_url": "LogStoreURL", "state_store_url": "StateStoreURL", "results_url": "ResultsURL", "updated_at": "2019-01-01T12:00:00.000Z", "job_runner_id": "JobRunnerID"}`) })) }) It(`Invoke UpdateJob successfully`, func() { @@ -14632,30 +15257,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -14921,30 +15548,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -15231,30 +15860,32 @@ var _ = Describe(`SchematicsV1`, func() { jobDataSystemModel.SchematicsResourceID = []string{"testString"} jobDataSystemModel.UpdatedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -15675,7 +16306,7 @@ var _ = Describe(`SchematicsV1`, func() { // Verify the contents of the request Expect(req.URL.EscapedPath()).To(Equal(getJobFilesPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["file_type"]).To(Equal([]string{"state_file"})) + Expect(req.URL.Query()["file_type"]).To(Equal([]string{"template_repo"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) @@ -15692,7 +16323,7 @@ var _ = Describe(`SchematicsV1`, func() { // Construct an instance of the GetJobFilesOptions model getJobFilesOptionsModel := new(schematicsv1.GetJobFilesOptions) getJobFilesOptionsModel.JobID = core.StringPtr("testString") - getJobFilesOptionsModel.FileType = core.StringPtr("state_file") + getJobFilesOptionsModel.FileType = core.StringPtr("template_repo") getJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := schematicsService.GetJobFiles(getJobFilesOptionsModel) @@ -15723,7 +16354,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(req.URL.EscapedPath()).To(Equal(getJobFilesPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["file_type"]).To(Equal([]string{"state_file"})) + Expect(req.URL.Query()["file_type"]).To(Equal([]string{"template_repo"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -15745,7 +16376,7 @@ var _ = Describe(`SchematicsV1`, func() { // Construct an instance of the GetJobFilesOptions model getJobFilesOptionsModel := new(schematicsv1.GetJobFilesOptions) getJobFilesOptionsModel.JobID = core.StringPtr("testString") - getJobFilesOptionsModel.FileType = core.StringPtr("state_file") + getJobFilesOptionsModel.FileType = core.StringPtr("template_repo") getJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -15782,7 +16413,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(req.URL.EscapedPath()).To(Equal(getJobFilesPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["file_type"]).To(Equal([]string{"state_file"})) + Expect(req.URL.Query()["file_type"]).To(Equal([]string{"template_repo"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) @@ -15806,7 +16437,7 @@ var _ = Describe(`SchematicsV1`, func() { // Construct an instance of the GetJobFilesOptions model getJobFilesOptionsModel := new(schematicsv1.GetJobFilesOptions) getJobFilesOptionsModel.JobID = core.StringPtr("testString") - getJobFilesOptionsModel.FileType = core.StringPtr("state_file") + getJobFilesOptionsModel.FileType = core.StringPtr("template_repo") getJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -15827,7 +16458,7 @@ var _ = Describe(`SchematicsV1`, func() { // Construct an instance of the GetJobFilesOptions model getJobFilesOptionsModel := new(schematicsv1.GetJobFilesOptions) getJobFilesOptionsModel.JobID = core.StringPtr("testString") - getJobFilesOptionsModel.FileType = core.StringPtr("state_file") + getJobFilesOptionsModel.FileType = core.StringPtr("template_repo") getJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") @@ -15869,7 +16500,7 @@ var _ = Describe(`SchematicsV1`, func() { // Construct an instance of the GetJobFilesOptions model getJobFilesOptionsModel := new(schematicsv1.GetJobFilesOptions) getJobFilesOptionsModel.JobID = core.StringPtr("testString") - getJobFilesOptionsModel.FileType = core.StringPtr("state_file") + getJobFilesOptionsModel.FileType = core.StringPtr("template_repo") getJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -16362,26 +16993,24 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ListInventories(listInventoriesOptions *ListInventoriesOptions) - Operation response error`, func() { - listInventoriesPath := "/v2/inventories" + Describe(`ListBlueprint(listBlueprintOptions *ListBlueprintOptions) - Operation response error`, func() { + listBlueprintPath := "/v2/blueprints" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInventoriesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBlueprintPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInventories with error: Operation response processing error`, func() { + It(`Invoke ListBlueprint with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16389,22 +17018,20 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListInventoriesOptions model - listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) - listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) - listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) - listInventoriesOptionsModel.Sort = core.StringPtr("testString") - listInventoriesOptionsModel.Profile = core.StringPtr("ids") - listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBlueprintOptions model + listBlueprintOptionsModel := new(schematicsv1.ListBlueprintOptions) + listBlueprintOptionsModel.Offset = core.Int64Ptr(int64(0)) + listBlueprintOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.ListInventories(listInventoriesOptionsModel) + result, response, operationErr := schematicsService.ListBlueprint(listBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.ListInventories(listInventoriesOptionsModel) + result, response, operationErr = schematicsService.ListBlueprint(listBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -16414,31 +17041,29 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ListInventories(listInventoriesOptions *ListInventoriesOptions)`, func() { - listInventoriesPath := "/v2/inventories" + Describe(`ListBlueprint(listBlueprintOptions *ListBlueprintOptions)`, func() { + listBlueprintPath := "/v2/blueprints" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInventoriesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBlueprintPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "inventories": [{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}]}`) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "blueprints": [{"name": "MySatelliteLocation", "description": "Creates satellite location in AWS", "resource_group": "ResourceGroup", "tags": ["Tags"], "location": "us-south", "id": "ID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}, "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "state": {"status_code": "Blueprint_Create_Init", "status_message": "StatusMessage"}}]}`) })) }) - It(`Invoke ListInventories successfully with retries`, func() { + It(`Invoke ListBlueprint successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16447,24 +17072,22 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the ListInventoriesOptions model - listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) - listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) - listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) - listInventoriesOptionsModel.Sort = core.StringPtr("testString") - listInventoriesOptionsModel.Profile = core.StringPtr("ids") - listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBlueprintOptions model + listBlueprintOptionsModel := new(schematicsv1.ListBlueprintOptions) + listBlueprintOptionsModel.Offset = core.Int64Ptr(int64(0)) + listBlueprintOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.ListInventoriesWithContext(ctx, listInventoriesOptionsModel) + _, _, operationErr := schematicsService.ListBlueprintWithContext(ctx, listBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.ListInventories(listInventoriesOptionsModel) + result, response, operationErr := schematicsService.ListBlueprint(listBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16472,7 +17095,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.ListInventoriesWithContext(ctx, listInventoriesOptionsModel) + _, _, operationErr = schematicsService.ListBlueprintWithContext(ctx, listBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16486,20 +17109,18 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInventoriesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBlueprintPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "inventories": [{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}]}`) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "blueprints": [{"name": "MySatelliteLocation", "description": "Creates satellite location in AWS", "resource_group": "ResourceGroup", "tags": ["Tags"], "location": "us-south", "id": "ID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}, "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "state": {"status_code": "Blueprint_Create_Init", "status_message": "StatusMessage"}}]}`) })) }) - It(`Invoke ListInventories successfully`, func() { + It(`Invoke ListBlueprint successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16508,27 +17129,25 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.ListInventories(nil) + result, response, operationErr := schematicsService.ListBlueprint(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInventoriesOptions model - listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) - listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) - listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) - listInventoriesOptionsModel.Sort = core.StringPtr("testString") - listInventoriesOptionsModel.Profile = core.StringPtr("ids") - listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBlueprintOptions model + listBlueprintOptionsModel := new(schematicsv1.ListBlueprintOptions) + listBlueprintOptionsModel.Offset = core.Int64Ptr(int64(0)) + listBlueprintOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.ListInventories(listInventoriesOptionsModel) + result, response, operationErr = schematicsService.ListBlueprint(listBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInventories with error: Operation request error`, func() { + It(`Invoke ListBlueprint with error: Operation request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16536,17 +17155,15 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListInventoriesOptions model - listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) - listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) - listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) - listInventoriesOptionsModel.Sort = core.StringPtr("testString") - listInventoriesOptionsModel.Profile = core.StringPtr("ids") - listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBlueprintOptions model + listBlueprintOptionsModel := new(schematicsv1.ListBlueprintOptions) + listBlueprintOptionsModel.Offset = core.Int64Ptr(int64(0)) + listBlueprintOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.ListInventories(listInventoriesOptionsModel) + result, response, operationErr := schematicsService.ListBlueprint(listBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -16565,7 +17182,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInventories successfully`, func() { + It(`Invoke ListBlueprint successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16573,16 +17190,14 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListInventoriesOptions model - listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) - listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) - listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) - listInventoriesOptionsModel.Sort = core.StringPtr("testString") - listInventoriesOptionsModel.Profile = core.StringPtr("ids") - listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBlueprintOptions model + listBlueprintOptionsModel := new(schematicsv1.ListBlueprintOptions) + listBlueprintOptionsModel.Offset = core.Int64Ptr(int64(0)) + listBlueprintOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.ListInventories(listInventoriesOptionsModel) + result, response, operationErr := schematicsService.ListBlueprint(listBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -16594,22 +17209,22 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`CreateInventory(createInventoryOptions *CreateInventoryOptions) - Operation response error`, func() { - createInventoryPath := "/v2/inventories" + Describe(`CreateBlueprint(createBlueprintOptions *CreateBlueprintOptions) - Operation response error`, func() { + createBlueprintPath := "/v2/blueprints" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(createBlueprintPath)) Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInventory with error: Operation response processing error`, func() { + It(`Invoke CreateBlueprint with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16617,24 +17232,120 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the CreateInventoryOptions model - createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) - createInventoryOptionsModel.Name = core.StringPtr("testString") - createInventoryOptionsModel.Description = core.StringPtr("testString") - createInventoryOptionsModel.Location = core.StringPtr("us-south") - createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - createInventoryOptionsModel.ResourceQueries = []string{"testString"} - createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the CreateBlueprintOptions model + createBlueprintOptionsModel := new(schematicsv1.CreateBlueprintOptions) + createBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + createBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + createBlueprintOptionsModel.Source = externalSourceModel + createBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + createBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + createBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + createBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + createBlueprintOptionsModel.Location = core.StringPtr("us-south") + createBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Flow = blueprintFlowModel + createBlueprintOptionsModel.SysLock = systemLockModel + createBlueprintOptionsModel.UserState = userStateModel + createBlueprintOptionsModel.State = blueprintLiteStateModel + createBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.CreateInventory(createInventoryOptionsModel) + result, response, operationErr := schematicsService.CreateBlueprint(createBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.CreateInventory(createInventoryOptionsModel) + result, response, operationErr = schematicsService.CreateBlueprint(createBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -16644,15 +17355,15 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`CreateInventory(createInventoryOptions *CreateInventoryOptions)`, func() { - createInventoryPath := "/v2/inventories" + Describe(`CreateBlueprint(createBlueprintOptions *CreateBlueprintOptions)`, func() { + createBlueprintPath := "/v2/blueprints" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(createBlueprintPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -16677,10 +17388,10 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) + fmt.Fprintf(res, "%s", `{"name": "Toronto Dev Environtment", "schema_version": "1.0", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "config": [{"name": "Name", "description": "Description", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "link": "Link"}]}], "description": "Deploys dev environtment instance in Toronto Region", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "modules": [{"module_id": "ModuleID", "module_type": "workspace", "name": "Name", "layer": "Layer", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "injectors": [{"tft_git_url": "TftGitURL", "tft_git_token": "TftGitToken", "tft_prefix": "TftPrefix", "injection_type": "InjectionType", "tft_name": "TftName", "tft_parameters": [{"name": "Name", "value": "Value"}]}], "tags": "Tags", "description": "Description", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "version": ["Version"], "status": "Status", "location": "Location", "inputs": [{"name": "Name", "value": "Value", "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "link": "Link"}], "updated": false, "deleted": false, "outputs": [{"name": "Name", "value": "Value", "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_status": "job_pending"}}], "flow": {"specs": [{"command_name": "workspace_plan", "flow_type": "sequence_flow", "sequence_flow": [{"sequence_number": 14, "item_name": "ItemName"}], "conditional_flow": "ConditionalFlow"}]}, "blueprint_id": "BlueprintID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}, "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "state": {"status_code": "Blueprint_Create_Init", "status_message": "StatusMessage"}}`) })) }) - It(`Invoke CreateInventory successfully with retries`, func() { + It(`Invoke CreateBlueprint successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16689,26 +17400,122 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the CreateInventoryOptions model - createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) - createInventoryOptionsModel.Name = core.StringPtr("testString") - createInventoryOptionsModel.Description = core.StringPtr("testString") - createInventoryOptionsModel.Location = core.StringPtr("us-south") - createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - createInventoryOptionsModel.ResourceQueries = []string{"testString"} - createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the CreateBlueprintOptions model + createBlueprintOptionsModel := new(schematicsv1.CreateBlueprintOptions) + createBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + createBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + createBlueprintOptionsModel.Source = externalSourceModel + createBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + createBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + createBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + createBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + createBlueprintOptionsModel.Location = core.StringPtr("us-south") + createBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Flow = blueprintFlowModel + createBlueprintOptionsModel.SysLock = systemLockModel + createBlueprintOptionsModel.UserState = userStateModel + createBlueprintOptionsModel.State = blueprintLiteStateModel + createBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.CreateInventoryWithContext(ctx, createInventoryOptionsModel) + _, _, operationErr := schematicsService.CreateBlueprintWithContext(ctx, createBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.CreateInventory(createInventoryOptionsModel) + result, response, operationErr := schematicsService.CreateBlueprint(createBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16716,7 +17523,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.CreateInventoryWithContext(ctx, createInventoryOptionsModel) + _, _, operationErr = schematicsService.CreateBlueprintWithContext(ctx, createBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16730,7 +17537,7 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(createBlueprintPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -16752,10 +17559,10 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) + fmt.Fprintf(res, "%s", `{"name": "Toronto Dev Environtment", "schema_version": "1.0", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "config": [{"name": "Name", "description": "Description", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "link": "Link"}]}], "description": "Deploys dev environtment instance in Toronto Region", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "modules": [{"module_id": "ModuleID", "module_type": "workspace", "name": "Name", "layer": "Layer", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "injectors": [{"tft_git_url": "TftGitURL", "tft_git_token": "TftGitToken", "tft_prefix": "TftPrefix", "injection_type": "InjectionType", "tft_name": "TftName", "tft_parameters": [{"name": "Name", "value": "Value"}]}], "tags": "Tags", "description": "Description", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "version": ["Version"], "status": "Status", "location": "Location", "inputs": [{"name": "Name", "value": "Value", "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "link": "Link"}], "updated": false, "deleted": false, "outputs": [{"name": "Name", "value": "Value", "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_status": "job_pending"}}], "flow": {"specs": [{"command_name": "workspace_plan", "flow_type": "sequence_flow", "sequence_flow": [{"sequence_number": 14, "item_name": "ItemName"}], "conditional_flow": "ConditionalFlow"}]}, "blueprint_id": "BlueprintID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}, "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "state": {"status_code": "Blueprint_Create_Init", "status_message": "StatusMessage"}}`) })) }) - It(`Invoke CreateInventory successfully`, func() { + It(`Invoke CreateBlueprint successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16764,29 +17571,125 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.CreateInventory(nil) + result, response, operationErr := schematicsService.CreateBlueprint(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateInventoryOptions model - createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) - createInventoryOptionsModel.Name = core.StringPtr("testString") - createInventoryOptionsModel.Description = core.StringPtr("testString") - createInventoryOptionsModel.Location = core.StringPtr("us-south") - createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - createInventoryOptionsModel.ResourceQueries = []string{"testString"} - createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the CreateBlueprintOptions model + createBlueprintOptionsModel := new(schematicsv1.CreateBlueprintOptions) + createBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + createBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + createBlueprintOptionsModel.Source = externalSourceModel + createBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + createBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + createBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + createBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + createBlueprintOptionsModel.Location = core.StringPtr("us-south") + createBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Flow = blueprintFlowModel + createBlueprintOptionsModel.SysLock = systemLockModel + createBlueprintOptionsModel.UserState = userStateModel + createBlueprintOptionsModel.State = blueprintLiteStateModel + createBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.CreateInventory(createInventoryOptionsModel) + result, response, operationErr = schematicsService.CreateBlueprint(createBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInventory with error: Operation request error`, func() { + It(`Invoke CreateBlueprint with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16794,61 +17697,260 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the CreateInventoryOptions model - createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) - createInventoryOptionsModel.Name = core.StringPtr("testString") - createInventoryOptionsModel.Description = core.StringPtr("testString") - createInventoryOptionsModel.Location = core.StringPtr("us-south") - createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - createInventoryOptionsModel.ResourceQueries = []string{"testString"} - createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := schematicsService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.CreateInventory(createInventoryOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke CreateInventory successfully`, func() { - schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(schematicsService).ToNot(BeNil()) + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") - // Construct an instance of the CreateInventoryOptions model - createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) - createInventoryOptionsModel.Name = core.StringPtr("testString") - createInventoryOptionsModel.Description = core.StringPtr("testString") - createInventoryOptionsModel.Location = core.StringPtr("us-south") - createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - createInventoryOptionsModel.ResourceQueries = []string{"testString"} - createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel - // Invoke operation - result, response, operationErr := schematicsService.CreateInventory(createInventoryOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") - // Verify a nil result + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the CreateBlueprintOptions model + createBlueprintOptionsModel := new(schematicsv1.CreateBlueprintOptions) + createBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + createBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + createBlueprintOptionsModel.Source = externalSourceModel + createBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + createBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + createBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + createBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + createBlueprintOptionsModel.Location = core.StringPtr("us-south") + createBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Flow = blueprintFlowModel + createBlueprintOptionsModel.SysLock = systemLockModel + createBlueprintOptionsModel.UserState = userStateModel + createBlueprintOptionsModel.State = blueprintLiteStateModel + createBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.CreateBlueprint(createBlueprintOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateBlueprintOptions model with no property values + createBlueprintOptionsModelNew := new(schematicsv1.CreateBlueprintOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.CreateBlueprint(createBlueprintOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke CreateBlueprint successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the CreateBlueprintOptions model + createBlueprintOptionsModel := new(schematicsv1.CreateBlueprintOptions) + createBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + createBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + createBlueprintOptionsModel.Source = externalSourceModel + createBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + createBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + createBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + createBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + createBlueprintOptionsModel.Location = core.StringPtr("us-south") + createBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + createBlueprintOptionsModel.Flow = blueprintFlowModel + createBlueprintOptionsModel.SysLock = systemLockModel + createBlueprintOptionsModel.UserState = userStateModel + createBlueprintOptionsModel.State = blueprintLiteStateModel + createBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.CreateBlueprint(createBlueprintOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result Expect(result).To(BeNil()) }) AfterEach(func() { @@ -16856,23 +17958,23 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`GetInventory(getInventoryOptions *GetInventoryOptions) - Operation response error`, func() { - getInventoryPath := "/v2/inventories/testString" + Describe(`GetBlueprint(getBlueprintOptions *GetBlueprintOptions) - Operation response error`, func() { + getBlueprintPath := "/v2/blueprints/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBlueprintPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInventory with error: Operation response processing error`, func() { + It(`Invoke GetBlueprint with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16880,20 +17982,20 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetInventoryOptions model - getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) - getInventoryOptionsModel.InventoryID = core.StringPtr("testString") - getInventoryOptionsModel.Profile = core.StringPtr("summary") - getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBlueprintOptions model + getBlueprintOptionsModel := new(schematicsv1.GetBlueprintOptions) + getBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + getBlueprintOptionsModel.Profile = core.StringPtr("ids") + getBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.GetInventory(getInventoryOptionsModel) + result, response, operationErr := schematicsService.GetBlueprint(getBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.GetInventory(getInventoryOptionsModel) + result, response, operationErr = schematicsService.GetBlueprint(getBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -16903,28 +18005,28 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`GetInventory(getInventoryOptions *GetInventoryOptions)`, func() { - getInventoryPath := "/v2/inventories/testString" + Describe(`GetBlueprint(getBlueprintOptions *GetBlueprintOptions)`, func() { + getBlueprintPath := "/v2/blueprints/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBlueprintPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) + fmt.Fprintf(res, "%s", `{"name": "Toronto Dev Environtment", "schema_version": "1.0", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "config": [{"name": "Name", "description": "Description", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "link": "Link"}]}], "description": "Deploys dev environtment instance in Toronto Region", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "modules": [{"module_id": "ModuleID", "module_type": "workspace", "name": "Name", "layer": "Layer", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "injectors": [{"tft_git_url": "TftGitURL", "tft_git_token": "TftGitToken", "tft_prefix": "TftPrefix", "injection_type": "InjectionType", "tft_name": "TftName", "tft_parameters": [{"name": "Name", "value": "Value"}]}], "tags": "Tags", "description": "Description", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "version": ["Version"], "status": "Status", "location": "Location", "inputs": [{"name": "Name", "value": "Value", "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "link": "Link"}], "updated": false, "deleted": false, "outputs": [{"name": "Name", "value": "Value", "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_status": "job_pending"}}], "flow": {"specs": [{"command_name": "workspace_plan", "flow_type": "sequence_flow", "sequence_flow": [{"sequence_number": 14, "item_name": "ItemName"}], "conditional_flow": "ConditionalFlow"}]}, "blueprint_id": "BlueprintID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}, "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "state": {"status_code": "Blueprint_Create_Init", "status_message": "StatusMessage"}}`) })) }) - It(`Invoke GetInventory successfully with retries`, func() { + It(`Invoke GetBlueprint successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16933,22 +18035,22 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the GetInventoryOptions model - getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) - getInventoryOptionsModel.InventoryID = core.StringPtr("testString") - getInventoryOptionsModel.Profile = core.StringPtr("summary") - getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBlueprintOptions model + getBlueprintOptionsModel := new(schematicsv1.GetBlueprintOptions) + getBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + getBlueprintOptionsModel.Profile = core.StringPtr("ids") + getBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.GetInventoryWithContext(ctx, getInventoryOptionsModel) + _, _, operationErr := schematicsService.GetBlueprintWithContext(ctx, getBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.GetInventory(getInventoryOptionsModel) + result, response, operationErr := schematicsService.GetBlueprint(getBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16956,7 +18058,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.GetInventoryWithContext(ctx, getInventoryOptionsModel) + _, _, operationErr = schematicsService.GetBlueprintWithContext(ctx, getBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16970,17 +18072,17 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBlueprintPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) + fmt.Fprintf(res, "%s", `{"name": "Toronto Dev Environtment", "schema_version": "1.0", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "config": [{"name": "Name", "description": "Description", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "link": "Link"}]}], "description": "Deploys dev environtment instance in Toronto Region", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "modules": [{"module_id": "ModuleID", "module_type": "workspace", "name": "Name", "layer": "Layer", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "injectors": [{"tft_git_url": "TftGitURL", "tft_git_token": "TftGitToken", "tft_prefix": "TftPrefix", "injection_type": "InjectionType", "tft_name": "TftName", "tft_parameters": [{"name": "Name", "value": "Value"}]}], "tags": "Tags", "description": "Description", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "version": ["Version"], "status": "Status", "location": "Location", "inputs": [{"name": "Name", "value": "Value", "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "link": "Link"}], "updated": false, "deleted": false, "outputs": [{"name": "Name", "value": "Value", "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_status": "job_pending"}}], "flow": {"specs": [{"command_name": "workspace_plan", "flow_type": "sequence_flow", "sequence_flow": [{"sequence_number": 14, "item_name": "ItemName"}], "conditional_flow": "ConditionalFlow"}]}, "blueprint_id": "BlueprintID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}, "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "state": {"status_code": "Blueprint_Create_Init", "status_message": "StatusMessage"}}`) })) }) - It(`Invoke GetInventory successfully`, func() { + It(`Invoke GetBlueprint successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16989,25 +18091,25 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.GetInventory(nil) + result, response, operationErr := schematicsService.GetBlueprint(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInventoryOptions model - getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) - getInventoryOptionsModel.InventoryID = core.StringPtr("testString") - getInventoryOptionsModel.Profile = core.StringPtr("summary") - getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBlueprintOptions model + getBlueprintOptionsModel := new(schematicsv1.GetBlueprintOptions) + getBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + getBlueprintOptionsModel.Profile = core.StringPtr("ids") + getBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.GetInventory(getInventoryOptionsModel) + result, response, operationErr = schematicsService.GetBlueprint(getBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInventory with error: Operation validation and request error`, func() { + It(`Invoke GetBlueprint with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17015,23 +18117,23 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetInventoryOptions model - getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) - getInventoryOptionsModel.InventoryID = core.StringPtr("testString") - getInventoryOptionsModel.Profile = core.StringPtr("summary") - getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBlueprintOptions model + getBlueprintOptionsModel := new(schematicsv1.GetBlueprintOptions) + getBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + getBlueprintOptionsModel.Profile = core.StringPtr("ids") + getBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.GetInventory(getInventoryOptionsModel) + result, response, operationErr := schematicsService.GetBlueprint(getBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInventoryOptions model with no property values - getInventoryOptionsModelNew := new(schematicsv1.GetInventoryOptions) + // Construct a second instance of the GetBlueprintOptions model with no property values + getBlueprintOptionsModelNew := new(schematicsv1.GetBlueprintOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = schematicsService.GetInventory(getInventoryOptionsModelNew) + result, response, operationErr = schematicsService.GetBlueprint(getBlueprintOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -17049,7 +18151,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInventory successfully`, func() { + It(`Invoke GetBlueprint successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17057,14 +18159,14 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetInventoryOptions model - getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) - getInventoryOptionsModel.InventoryID = core.StringPtr("testString") - getInventoryOptionsModel.Profile = core.StringPtr("summary") - getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBlueprintOptions model + getBlueprintOptionsModel := new(schematicsv1.GetBlueprintOptions) + getBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + getBlueprintOptionsModel.Profile = core.StringPtr("ids") + getBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.GetInventory(getInventoryOptionsModel) + result, response, operationErr := schematicsService.GetBlueprint(getBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -17076,22 +18178,23 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ReplaceInventory(replaceInventoryOptions *ReplaceInventoryOptions) - Operation response error`, func() { - replaceInventoryPath := "/v2/inventories/testString" + Describe(`ReplaceBlueprint(replaceBlueprintOptions *ReplaceBlueprintOptions) - Operation response error`, func() { + replaceBlueprintPath := "/v2/blueprints/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(replaceBlueprintPath)) Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ReplaceInventory with error: Operation response processing error`, func() { + It(`Invoke ReplaceBlueprint with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17099,25 +18202,122 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ReplaceInventoryOptions model - replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) - replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") - replaceInventoryOptionsModel.Name = core.StringPtr("testString") - replaceInventoryOptionsModel.Description = core.StringPtr("testString") - replaceInventoryOptionsModel.Location = core.StringPtr("us-south") - replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} - replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the ReplaceBlueprintOptions model + replaceBlueprintOptionsModel := new(schematicsv1.ReplaceBlueprintOptions) + replaceBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + replaceBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + replaceBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + replaceBlueprintOptionsModel.Source = externalSourceModel + replaceBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + replaceBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + replaceBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + replaceBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + replaceBlueprintOptionsModel.Location = core.StringPtr("us-south") + replaceBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Flow = blueprintFlowModel + replaceBlueprintOptionsModel.SysLock = systemLockModel + replaceBlueprintOptionsModel.UserState = userStateModel + replaceBlueprintOptionsModel.State = blueprintLiteStateModel + replaceBlueprintOptionsModel.Profile = core.StringPtr("ids") + replaceBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.ReplaceInventory(replaceInventoryOptionsModel) + result, response, operationErr := schematicsService.ReplaceBlueprint(replaceBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.ReplaceInventory(replaceInventoryOptionsModel) + result, response, operationErr = schematicsService.ReplaceBlueprint(replaceBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -17127,15 +18327,15 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ReplaceInventory(replaceInventoryOptions *ReplaceInventoryOptions)`, func() { - replaceInventoryPath := "/v2/inventories/testString" + Describe(`ReplaceBlueprint(replaceBlueprintOptions *ReplaceBlueprintOptions)`, func() { + replaceBlueprintPath := "/v2/blueprints/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(replaceBlueprintPath)) Expect(req.Method).To(Equal("PUT")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -17154,16 +18354,17 @@ var _ = Describe(`SchematicsV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) + fmt.Fprintf(res, "%s", `{"name": "Toronto Dev Environtment", "schema_version": "1.0", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "config": [{"name": "Name", "description": "Description", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "link": "Link"}]}], "description": "Deploys dev environtment instance in Toronto Region", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "modules": [{"module_id": "ModuleID", "module_type": "workspace", "name": "Name", "layer": "Layer", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "injectors": [{"tft_git_url": "TftGitURL", "tft_git_token": "TftGitToken", "tft_prefix": "TftPrefix", "injection_type": "InjectionType", "tft_name": "TftName", "tft_parameters": [{"name": "Name", "value": "Value"}]}], "tags": "Tags", "description": "Description", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "version": ["Version"], "status": "Status", "location": "Location", "inputs": [{"name": "Name", "value": "Value", "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "link": "Link"}], "updated": false, "deleted": false, "outputs": [{"name": "Name", "value": "Value", "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_status": "job_pending"}}], "flow": {"specs": [{"command_name": "workspace_plan", "flow_type": "sequence_flow", "sequence_flow": [{"sequence_number": 14, "item_name": "ItemName"}], "conditional_flow": "ConditionalFlow"}]}, "blueprint_id": "BlueprintID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}, "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "state": {"status_code": "Blueprint_Create_Init", "status_message": "StatusMessage"}}`) })) }) - It(`Invoke ReplaceInventory successfully with retries`, func() { + It(`Invoke ReplaceBlueprint successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17172,27 +18373,124 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the ReplaceInventoryOptions model - replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) - replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") - replaceInventoryOptionsModel.Name = core.StringPtr("testString") - replaceInventoryOptionsModel.Description = core.StringPtr("testString") - replaceInventoryOptionsModel.Location = core.StringPtr("us-south") - replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} - replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the ReplaceBlueprintOptions model + replaceBlueprintOptionsModel := new(schematicsv1.ReplaceBlueprintOptions) + replaceBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + replaceBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + replaceBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + replaceBlueprintOptionsModel.Source = externalSourceModel + replaceBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + replaceBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + replaceBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + replaceBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + replaceBlueprintOptionsModel.Location = core.StringPtr("us-south") + replaceBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Flow = blueprintFlowModel + replaceBlueprintOptionsModel.SysLock = systemLockModel + replaceBlueprintOptionsModel.UserState = userStateModel + replaceBlueprintOptionsModel.State = blueprintLiteStateModel + replaceBlueprintOptionsModel.Profile = core.StringPtr("ids") + replaceBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.ReplaceInventoryWithContext(ctx, replaceInventoryOptionsModel) + _, _, operationErr := schematicsService.ReplaceBlueprintWithContext(ctx, replaceBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.ReplaceInventory(replaceInventoryOptionsModel) + result, response, operationErr := schematicsService.ReplaceBlueprint(replaceBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -17200,7 +18498,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.ReplaceInventoryWithContext(ctx, replaceInventoryOptionsModel) + _, _, operationErr = schematicsService.ReplaceBlueprintWithContext(ctx, replaceBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -17214,7 +18512,7 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceInventoryPath)) + Expect(req.URL.EscapedPath()).To(Equal(replaceBlueprintPath)) Expect(req.Method).To(Equal("PUT")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -17233,13 +18531,14 @@ var _ = Describe(`SchematicsV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) + fmt.Fprintf(res, "%s", `{"name": "Toronto Dev Environtment", "schema_version": "1.0", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "config": [{"name": "Name", "description": "Description", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "inputs": [{"name": "Name", "value": "Value", "link": "Link"}]}], "description": "Deploys dev environtment instance in Toronto Region", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "outputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "modules": [{"module_id": "ModuleID", "module_type": "workspace", "name": "Name", "layer": "Layer", "source": {"source_type": "local", "git": {"computed_git_repo_url": "ComputedGitRepoURL", "git_repo_url": "GitRepoURL", "git_token": "GitToken", "git_repo_folder": "GitRepoFolder", "git_release": "GitRelease", "git_branch": "GitBranch"}, "catalog": {"catalog_name": "CatalogName", "offering_name": "OfferingName", "offering_version": "OfferingVersion", "offering_kind": "OfferingKind", "catalog_id": "CatalogID", "offering_id": "OfferingID", "offering_version_id": "OfferingVersionID", "offering_repo_url": "OfferingRepoURL", "offering_provisioner_working_directory": "OfferingProvisionerWorkingDirectory"}}, "injectors": [{"tft_git_url": "TftGitURL", "tft_git_token": "TftGitToken", "tft_prefix": "TftPrefix", "injection_type": "InjectionType", "tft_name": "TftName", "tft_parameters": [{"name": "Name", "value": "Value"}]}], "tags": "Tags", "description": "Description", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "version": ["Version"], "status": "Status", "location": "Location", "inputs": [{"name": "Name", "value": "Value", "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "link": "Link"}], "updated": false, "deleted": false, "outputs": [{"name": "Name", "value": "Value", "link": "Link"}], "last_job": {"command_object": "workspace", "command_object_name": "CommandObjectName", "command_object_id": "CommandObjectID", "command_name": "workspace_plan", "job_status": "job_pending"}}], "flow": {"specs": [{"command_name": "workspace_plan", "flow_type": "sequence_flow", "sequence_flow": [{"sequence_number": 14, "item_name": "ItemName"}], "conditional_flow": "ConditionalFlow"}]}, "blueprint_id": "BlueprintID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "sys_lock": {"sys_locked": false, "sys_locked_by": "SysLockedBy", "sys_locked_at": "2019-01-01T12:00:00.000Z"}, "user_state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "state": {"status_code": "Blueprint_Create_Init", "status_message": "StatusMessage"}}`) })) }) - It(`Invoke ReplaceInventory successfully`, func() { + It(`Invoke ReplaceBlueprint successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17248,30 +18547,127 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.ReplaceInventory(nil) + result, response, operationErr := schematicsService.ReplaceBlueprint(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ReplaceInventoryOptions model - replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) - replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") - replaceInventoryOptionsModel.Name = core.StringPtr("testString") - replaceInventoryOptionsModel.Description = core.StringPtr("testString") - replaceInventoryOptionsModel.Location = core.StringPtr("us-south") - replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} - replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the ReplaceBlueprintOptions model + replaceBlueprintOptionsModel := new(schematicsv1.ReplaceBlueprintOptions) + replaceBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + replaceBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + replaceBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + replaceBlueprintOptionsModel.Source = externalSourceModel + replaceBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + replaceBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + replaceBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + replaceBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + replaceBlueprintOptionsModel.Location = core.StringPtr("us-south") + replaceBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Flow = blueprintFlowModel + replaceBlueprintOptionsModel.SysLock = systemLockModel + replaceBlueprintOptionsModel.UserState = userStateModel + replaceBlueprintOptionsModel.State = blueprintLiteStateModel + replaceBlueprintOptionsModel.Profile = core.StringPtr("ids") + replaceBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.ReplaceInventory(replaceInventoryOptionsModel) + result, response, operationErr = schematicsService.ReplaceBlueprint(replaceBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ReplaceInventory with error: Operation validation and request error`, func() { + It(`Invoke ReplaceBlueprint with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17279,28 +18675,125 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ReplaceInventoryOptions model - replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) - replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") - replaceInventoryOptionsModel.Name = core.StringPtr("testString") - replaceInventoryOptionsModel.Description = core.StringPtr("testString") - replaceInventoryOptionsModel.Location = core.StringPtr("us-south") - replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} - replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the ReplaceBlueprintOptions model + replaceBlueprintOptionsModel := new(schematicsv1.ReplaceBlueprintOptions) + replaceBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + replaceBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + replaceBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + replaceBlueprintOptionsModel.Source = externalSourceModel + replaceBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + replaceBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + replaceBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + replaceBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + replaceBlueprintOptionsModel.Location = core.StringPtr("us-south") + replaceBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Flow = blueprintFlowModel + replaceBlueprintOptionsModel.SysLock = systemLockModel + replaceBlueprintOptionsModel.UserState = userStateModel + replaceBlueprintOptionsModel.State = blueprintLiteStateModel + replaceBlueprintOptionsModel.Profile = core.StringPtr("ids") + replaceBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.ReplaceInventory(replaceInventoryOptionsModel) + result, response, operationErr := schematicsService.ReplaceBlueprint(replaceBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ReplaceInventoryOptions model with no property values - replaceInventoryOptionsModelNew := new(schematicsv1.ReplaceInventoryOptions) + // Construct a second instance of the ReplaceBlueprintOptions model with no property values + replaceBlueprintOptionsModelNew := new(schematicsv1.ReplaceBlueprintOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = schematicsService.ReplaceInventory(replaceInventoryOptionsModelNew) + result, response, operationErr = schematicsService.ReplaceBlueprint(replaceBlueprintOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -17318,7 +18811,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ReplaceInventory successfully`, func() { + It(`Invoke ReplaceBlueprint successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17326,74 +18819,169 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ReplaceInventoryOptions model - replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) - replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") - replaceInventoryOptionsModel.Name = core.StringPtr("testString") - replaceInventoryOptionsModel.Description = core.StringPtr("testString") - replaceInventoryOptionsModel.Location = core.StringPtr("us-south") - replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") - replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") - replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} - replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := schematicsService.ReplaceInventory(replaceInventoryOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInventory(deleteInventoryOptions *DeleteInventoryOptions)`, func() { - deleteInventoryPath := "/v2/inventories/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInventoryPath)) - Expect(req.Method).To(Equal("DELETE")) + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel - Expect(req.Header["Force"]).ToNot(BeNil()) - Expect(req.Header["Force"][0]).To(Equal(fmt.Sprintf("%v", true))) - Expect(req.Header["Propagate"]).ToNot(BeNil()) - Expect(req.Header["Propagate"][0]).To(Equal(fmt.Sprintf("%v", true))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInventory successfully`, func() { - schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(schematicsService).ToNot(BeNil()) + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") - // Invoke operation with nil options model (negative test) - response, operationErr := schematicsService.DeleteInventory(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} - // Construct an instance of the DeleteInventoryOptions model - deleteInventoryOptionsModel := new(schematicsv1.DeleteInventoryOptions) - deleteInventoryOptionsModel.InventoryID = core.StringPtr("testString") - deleteInventoryOptionsModel.Force = core.BoolPtr(true) - deleteInventoryOptionsModel.Propagate = core.BoolPtr(true) - deleteInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + + // Construct an instance of the ReplaceBlueprintOptions model + replaceBlueprintOptionsModel := new(schematicsv1.ReplaceBlueprintOptions) + replaceBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + replaceBlueprintOptionsModel.Name = core.StringPtr("Toronto Dev Environtment") + replaceBlueprintOptionsModel.SchemaVersion = core.StringPtr("1.0") + replaceBlueprintOptionsModel.Source = externalSourceModel + replaceBlueprintOptionsModel.Config = []schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel} + replaceBlueprintOptionsModel.Description = core.StringPtr("Deploys dev environtment instance in Toronto Region") + replaceBlueprintOptionsModel.ResourceGroup = core.StringPtr("Default") + replaceBlueprintOptionsModel.Tags = []string{"blueprint:Tor-Dev"} + replaceBlueprintOptionsModel.Location = core.StringPtr("us-south") + replaceBlueprintOptionsModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Settings = []schematicsv1.VariableData{*variableDataModel} + replaceBlueprintOptionsModel.Flow = blueprintFlowModel + replaceBlueprintOptionsModel.SysLock = systemLockModel + replaceBlueprintOptionsModel.UserState = userStateModel + replaceBlueprintOptionsModel.State = blueprintLiteStateModel + replaceBlueprintOptionsModel.Profile = core.StringPtr("ids") + replaceBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.ReplaceBlueprint(replaceBlueprintOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteBlueprint(deleteBlueprintOptions *DeleteBlueprintOptions)`, func() { + deleteBlueprintPath := "/v2/blueprints/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteBlueprintPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) + // TODO: Add check for destroy query parameter + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteBlueprint successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.DeleteBlueprint(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteBlueprintOptions model + deleteBlueprintOptionsModel := new(schematicsv1.DeleteBlueprintOptions) + deleteBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + deleteBlueprintOptionsModel.Profile = core.StringPtr("ids") + deleteBlueprintOptionsModel.Destroy = core.BoolPtr(true) + deleteBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = schematicsService.DeleteInventory(deleteInventoryOptionsModel) + response, operationErr = schematicsService.DeleteBlueprint(deleteBlueprintOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInventory with error: Operation validation and request error`, func() { + It(`Invoke DeleteBlueprint with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17401,23 +18989,23 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the DeleteInventoryOptions model - deleteInventoryOptionsModel := new(schematicsv1.DeleteInventoryOptions) - deleteInventoryOptionsModel.InventoryID = core.StringPtr("testString") - deleteInventoryOptionsModel.Force = core.BoolPtr(true) - deleteInventoryOptionsModel.Propagate = core.BoolPtr(true) - deleteInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBlueprintOptions model + deleteBlueprintOptionsModel := new(schematicsv1.DeleteBlueprintOptions) + deleteBlueprintOptionsModel.BlueprintID = core.StringPtr("testString") + deleteBlueprintOptionsModel.Profile = core.StringPtr("ids") + deleteBlueprintOptionsModel.Destroy = core.BoolPtr(true) + deleteBlueprintOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := schematicsService.DeleteInventory(deleteInventoryOptionsModel) + response, operationErr := schematicsService.DeleteBlueprint(deleteBlueprintOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInventoryOptions model with no property values - deleteInventoryOptionsModelNew := new(schematicsv1.DeleteInventoryOptions) + // Construct a second instance of the DeleteBlueprintOptions model with no property values + deleteBlueprintOptionsModelNew := new(schematicsv1.DeleteBlueprintOptions) // Invoke operation with invalid model (negative test) - response, operationErr = schematicsService.DeleteInventory(deleteInventoryOptionsModelNew) + response, operationErr = schematicsService.DeleteBlueprint(deleteBlueprintOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -17426,15 +19014,15 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ListResourceQuery(listResourceQueryOptions *ListResourceQueryOptions) - Operation response error`, func() { - listResourceQueryPath := "/v2/resources_query" + Describe(`ListInventories(listInventoriesOptions *ListInventoriesOptions) - Operation response error`, func() { + listInventoriesPath := "/v2/inventories" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listResourceQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInventoriesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) @@ -17445,7 +19033,7 @@ var _ = Describe(`SchematicsV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListResourceQuery with error: Operation response processing error`, func() { + It(`Invoke ListInventories with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17453,22 +19041,22 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListResourceQueryOptions model - listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) - listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) - listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) - listResourceQueryOptionsModel.Sort = core.StringPtr("testString") - listResourceQueryOptionsModel.Profile = core.StringPtr("ids") - listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInventoriesOptions model + listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) + listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) + listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInventoriesOptionsModel.Sort = core.StringPtr("testString") + listInventoriesOptionsModel.Profile = core.StringPtr("ids") + listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + result, response, operationErr := schematicsService.ListInventories(listInventoriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + result, response, operationErr = schematicsService.ListInventories(listInventoriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -17478,15 +19066,15 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ListResourceQuery(listResourceQueryOptions *ListResourceQueryOptions)`, func() { - listResourceQueryPath := "/v2/resources_query" + Describe(`ListInventories(listInventoriesOptions *ListInventoriesOptions)`, func() { + listInventoriesPath := "/v2/inventories" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listResourceQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInventoriesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) @@ -17499,10 +19087,10 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "resource_queries": [{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}]}`) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "inventories": [{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}]}`) })) }) - It(`Invoke ListResourceQuery successfully with retries`, func() { + It(`Invoke ListInventories successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17511,24 +19099,24 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the ListResourceQueryOptions model - listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) - listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) - listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) - listResourceQueryOptionsModel.Sort = core.StringPtr("testString") - listResourceQueryOptionsModel.Profile = core.StringPtr("ids") - listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInventoriesOptions model + listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) + listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) + listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInventoriesOptionsModel.Sort = core.StringPtr("testString") + listInventoriesOptionsModel.Profile = core.StringPtr("ids") + listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.ListResourceQueryWithContext(ctx, listResourceQueryOptionsModel) + _, _, operationErr := schematicsService.ListInventoriesWithContext(ctx, listInventoriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + result, response, operationErr := schematicsService.ListInventories(listInventoriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -17536,7 +19124,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.ListResourceQueryWithContext(ctx, listResourceQueryOptionsModel) + _, _, operationErr = schematicsService.ListInventoriesWithContext(ctx, listInventoriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -17550,7 +19138,7 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listResourceQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInventoriesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) @@ -17560,10 +19148,10 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "resource_queries": [{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}]}`) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "inventories": [{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}]}`) })) }) - It(`Invoke ListResourceQuery successfully`, func() { + It(`Invoke ListInventories successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17572,27 +19160,27 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.ListResourceQuery(nil) + result, response, operationErr := schematicsService.ListInventories(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListResourceQueryOptions model - listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) - listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) - listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) - listResourceQueryOptionsModel.Sort = core.StringPtr("testString") - listResourceQueryOptionsModel.Profile = core.StringPtr("ids") - listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInventoriesOptions model + listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) + listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) + listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInventoriesOptionsModel.Sort = core.StringPtr("testString") + listInventoriesOptionsModel.Profile = core.StringPtr("ids") + listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + result, response, operationErr = schematicsService.ListInventories(listInventoriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListResourceQuery with error: Operation request error`, func() { + It(`Invoke ListInventories with error: Operation request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17600,17 +19188,17 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListResourceQueryOptions model - listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) - listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) - listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) - listResourceQueryOptionsModel.Sort = core.StringPtr("testString") - listResourceQueryOptionsModel.Profile = core.StringPtr("ids") - listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInventoriesOptions model + listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) + listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) + listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInventoriesOptionsModel.Sort = core.StringPtr("testString") + listInventoriesOptionsModel.Profile = core.StringPtr("ids") + listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + result, response, operationErr := schematicsService.ListInventories(listInventoriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -17629,7 +19217,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListResourceQuery successfully`, func() { + It(`Invoke ListInventories successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17637,16 +19225,16 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListResourceQueryOptions model - listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) - listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) - listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) - listResourceQueryOptionsModel.Sort = core.StringPtr("testString") - listResourceQueryOptionsModel.Profile = core.StringPtr("ids") - listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInventoriesOptions model + listInventoriesOptionsModel := new(schematicsv1.ListInventoriesOptions) + listInventoriesOptionsModel.Offset = core.Int64Ptr(int64(0)) + listInventoriesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInventoriesOptionsModel.Sort = core.StringPtr("testString") + listInventoriesOptionsModel.Profile = core.StringPtr("ids") + listInventoriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + result, response, operationErr := schematicsService.ListInventories(listInventoriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -17658,22 +19246,22 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`CreateResourceQuery(createResourceQueryOptions *CreateResourceQueryOptions) - Operation response error`, func() { - createResourceQueryPath := "/v2/resources_query" + Describe(`CreateInventory(createInventoryOptions *CreateInventoryOptions) - Operation response error`, func() { + createInventoryPath := "/v2/inventories" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createResourceQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInventoryPath)) Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateResourceQuery with error: Operation response processing error`, func() { + It(`Invoke CreateInventory with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17681,33 +19269,24 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the CreateResourceQueryOptions model - createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) - createResourceQueryOptionsModel.Type = core.StringPtr("vsi") - createResourceQueryOptionsModel.Name = core.StringPtr("testString") - createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInventoryOptions model + createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) + createInventoryOptionsModel.Name = core.StringPtr("testString") + createInventoryOptionsModel.Description = core.StringPtr("testString") + createInventoryOptionsModel.Location = core.StringPtr("us-south") + createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + createInventoryOptionsModel.ResourceQueries = []string{"testString"} + createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + result, response, operationErr := schematicsService.CreateInventory(createInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + result, response, operationErr = schematicsService.CreateInventory(createInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -17717,15 +19296,15 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`CreateResourceQuery(createResourceQueryOptions *CreateResourceQueryOptions)`, func() { - createResourceQueryPath := "/v2/resources_query" + Describe(`CreateInventory(createInventoryOptions *CreateInventoryOptions)`, func() { + createInventoryPath := "/v2/inventories" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createResourceQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInventoryPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -17750,10 +19329,10 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) })) }) - It(`Invoke CreateResourceQuery successfully with retries`, func() { + It(`Invoke CreateInventory successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17762,35 +19341,26 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the CreateResourceQueryOptions model - createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) - createResourceQueryOptionsModel.Type = core.StringPtr("vsi") - createResourceQueryOptionsModel.Name = core.StringPtr("testString") - createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInventoryOptions model + createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) + createInventoryOptionsModel.Name = core.StringPtr("testString") + createInventoryOptionsModel.Description = core.StringPtr("testString") + createInventoryOptionsModel.Location = core.StringPtr("us-south") + createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + createInventoryOptionsModel.ResourceQueries = []string{"testString"} + createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.CreateResourceQueryWithContext(ctx, createResourceQueryOptionsModel) + _, _, operationErr := schematicsService.CreateInventoryWithContext(ctx, createInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + result, response, operationErr := schematicsService.CreateInventory(createInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -17798,7 +19368,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.CreateResourceQueryWithContext(ctx, createResourceQueryOptionsModel) + _, _, operationErr = schematicsService.CreateInventoryWithContext(ctx, createInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -17812,7 +19382,7 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createResourceQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInventoryPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -17834,10 +19404,10 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) })) }) - It(`Invoke CreateResourceQuery successfully`, func() { + It(`Invoke CreateInventory successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17846,38 +19416,29 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.CreateResourceQuery(nil) + result, response, operationErr := schematicsService.CreateInventory(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the CreateResourceQueryOptions model - createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) - createResourceQueryOptionsModel.Type = core.StringPtr("vsi") - createResourceQueryOptionsModel.Name = core.StringPtr("testString") - createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInventoryOptions model + createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) + createInventoryOptionsModel.Name = core.StringPtr("testString") + createInventoryOptionsModel.Description = core.StringPtr("testString") + createInventoryOptionsModel.Location = core.StringPtr("us-south") + createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + createInventoryOptionsModel.ResourceQueries = []string{"testString"} + createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + result, response, operationErr = schematicsService.CreateInventory(createInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateResourceQuery with error: Operation request error`, func() { + It(`Invoke CreateInventory with error: Operation request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17885,28 +19446,19 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the CreateResourceQueryOptions model - createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) - createResourceQueryOptionsModel.Type = core.StringPtr("vsi") - createResourceQueryOptionsModel.Name = core.StringPtr("testString") - createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInventoryOptions model + createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) + createInventoryOptionsModel.Name = core.StringPtr("testString") + createInventoryOptionsModel.Description = core.StringPtr("testString") + createInventoryOptionsModel.Location = core.StringPtr("us-south") + createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + createInventoryOptionsModel.ResourceQueries = []string{"testString"} + createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + result, response, operationErr := schematicsService.CreateInventory(createInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -17925,7 +19477,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke CreateResourceQuery successfully`, func() { + It(`Invoke CreateInventory successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17933,27 +19485,18 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the CreateResourceQueryOptions model - createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) - createResourceQueryOptionsModel.Type = core.StringPtr("vsi") - createResourceQueryOptionsModel.Name = core.StringPtr("testString") - createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInventoryOptions model + createInventoryOptionsModel := new(schematicsv1.CreateInventoryOptions) + createInventoryOptionsModel.Name = core.StringPtr("testString") + createInventoryOptionsModel.Description = core.StringPtr("testString") + createInventoryOptionsModel.Location = core.StringPtr("us-south") + createInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + createInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + createInventoryOptionsModel.ResourceQueries = []string{"testString"} + createInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + result, response, operationErr := schematicsService.CreateInventory(createInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -17965,22 +19508,23 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`GetResourcesQuery(getResourcesQueryOptions *GetResourcesQueryOptions) - Operation response error`, func() { - getResourcesQueryPath := "/v2/resources_query/testString" + Describe(`GetInventory(getInventoryOptions *GetInventoryOptions) - Operation response error`, func() { + getInventoryPath := "/v2/inventories/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getResourcesQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInventoryPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetResourcesQuery with error: Operation response processing error`, func() { + It(`Invoke GetInventory with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -17988,19 +19532,20 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetResourcesQueryOptions model - getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) - getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInventoryOptions model + getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) + getInventoryOptionsModel.InventoryID = core.StringPtr("testString") + getInventoryOptionsModel.Profile = core.StringPtr("summary") + getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + result, response, operationErr := schematicsService.GetInventory(getInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + result, response, operationErr = schematicsService.GetInventory(getInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -18010,27 +19555,28 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`GetResourcesQuery(getResourcesQueryOptions *GetResourcesQueryOptions)`, func() { - getResourcesQueryPath := "/v2/resources_query/testString" + Describe(`GetInventory(getInventoryOptions *GetInventoryOptions)`, func() { + getInventoryPath := "/v2/inventories/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getResourcesQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInventoryPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) })) }) - It(`Invoke GetResourcesQuery successfully with retries`, func() { + It(`Invoke GetInventory successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18039,21 +19585,22 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the GetResourcesQueryOptions model - getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) - getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInventoryOptions model + getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) + getInventoryOptionsModel.InventoryID = core.StringPtr("testString") + getInventoryOptionsModel.Profile = core.StringPtr("summary") + getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.GetResourcesQueryWithContext(ctx, getResourcesQueryOptionsModel) + _, _, operationErr := schematicsService.GetInventoryWithContext(ctx, getInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + result, response, operationErr := schematicsService.GetInventory(getInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -18061,7 +19608,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.GetResourcesQueryWithContext(ctx, getResourcesQueryOptionsModel) + _, _, operationErr = schematicsService.GetInventoryWithContext(ctx, getInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -18075,16 +19622,17 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getResourcesQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInventoryPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) })) }) - It(`Invoke GetResourcesQuery successfully`, func() { + It(`Invoke GetInventory successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18093,24 +19641,25 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.GetResourcesQuery(nil) + result, response, operationErr := schematicsService.GetInventory(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetResourcesQueryOptions model - getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) - getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInventoryOptions model + getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) + getInventoryOptionsModel.InventoryID = core.StringPtr("testString") + getInventoryOptionsModel.Profile = core.StringPtr("summary") + getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + result, response, operationErr = schematicsService.GetInventory(getInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetResourcesQuery with error: Operation validation and request error`, func() { + It(`Invoke GetInventory with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18118,22 +19667,23 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetResourcesQueryOptions model - getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) - getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInventoryOptions model + getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) + getInventoryOptionsModel.InventoryID = core.StringPtr("testString") + getInventoryOptionsModel.Profile = core.StringPtr("summary") + getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + result, response, operationErr := schematicsService.GetInventory(getInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetResourcesQueryOptions model with no property values - getResourcesQueryOptionsModelNew := new(schematicsv1.GetResourcesQueryOptions) + // Construct a second instance of the GetInventoryOptions model with no property values + getInventoryOptionsModelNew := new(schematicsv1.GetInventoryOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = schematicsService.GetResourcesQuery(getResourcesQueryOptionsModelNew) + result, response, operationErr = schematicsService.GetInventory(getInventoryOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -18151,7 +19701,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetResourcesQuery successfully`, func() { + It(`Invoke GetInventory successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18159,13 +19709,14 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetResourcesQueryOptions model - getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) - getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInventoryOptions model + getInventoryOptionsModel := new(schematicsv1.GetInventoryOptions) + getInventoryOptionsModel.InventoryID = core.StringPtr("testString") + getInventoryOptionsModel.Profile = core.StringPtr("summary") + getInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + result, response, operationErr := schematicsService.GetInventory(getInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -18177,22 +19728,22 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ReplaceResourcesQuery(replaceResourcesQueryOptions *ReplaceResourcesQueryOptions) - Operation response error`, func() { - replaceResourcesQueryPath := "/v2/resources_query/testString" + Describe(`ReplaceInventory(replaceInventoryOptions *ReplaceInventoryOptions) - Operation response error`, func() { + replaceInventoryPath := "/v2/inventories/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceResourcesQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(replaceInventoryPath)) Expect(req.Method).To(Equal("PUT")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ReplaceResourcesQuery with error: Operation response processing error`, func() { + It(`Invoke ReplaceInventory with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18200,34 +19751,25 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the ReplaceResourcesQueryOptions model - replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) - replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") - replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceInventoryOptions model + replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) + replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") + replaceInventoryOptionsModel.Name = core.StringPtr("testString") + replaceInventoryOptionsModel.Description = core.StringPtr("testString") + replaceInventoryOptionsModel.Location = core.StringPtr("us-south") + replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} + replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + result, response, operationErr := schematicsService.ReplaceInventory(replaceInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + result, response, operationErr = schematicsService.ReplaceInventory(replaceInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -18237,15 +19779,15 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ReplaceResourcesQuery(replaceResourcesQueryOptions *ReplaceResourcesQueryOptions)`, func() { - replaceResourcesQueryPath := "/v2/resources_query/testString" + Describe(`ReplaceInventory(replaceInventoryOptions *ReplaceInventoryOptions)`, func() { + replaceInventoryPath := "/v2/inventories/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceResourcesQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(replaceInventoryPath)) Expect(req.Method).To(Equal("PUT")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -18270,10 +19812,10 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) })) }) - It(`Invoke ReplaceResourcesQuery successfully with retries`, func() { + It(`Invoke ReplaceInventory successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18282,36 +19824,27 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the ReplaceResourcesQueryOptions model - replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) - replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") - replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceInventoryOptions model + replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) + replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") + replaceInventoryOptionsModel.Name = core.StringPtr("testString") + replaceInventoryOptionsModel.Description = core.StringPtr("testString") + replaceInventoryOptionsModel.Location = core.StringPtr("us-south") + replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} + replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.ReplaceResourcesQueryWithContext(ctx, replaceResourcesQueryOptionsModel) + _, _, operationErr := schematicsService.ReplaceInventoryWithContext(ctx, replaceInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + result, response, operationErr := schematicsService.ReplaceInventory(replaceInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -18319,7 +19852,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.ReplaceResourcesQueryWithContext(ctx, replaceResourcesQueryOptionsModel) + _, _, operationErr = schematicsService.ReplaceInventoryWithContext(ctx, replaceInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -18333,7 +19866,7 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceResourcesQueryPath)) + Expect(req.URL.EscapedPath()).To(Equal(replaceInventoryPath)) Expect(req.Method).To(Equal("PUT")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -18355,10 +19888,10 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + fmt.Fprintf(res, "%s", `{"name": "Name", "id": "ID", "description": "Description", "location": "us-south", "resource_group": "ResourceGroup", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "inventories_ini": "InventoriesIni", "resource_queries": ["ResourceQueries"]}`) })) }) - It(`Invoke ReplaceResourcesQuery successfully`, func() { + It(`Invoke ReplaceInventory successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18367,39 +19900,30 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.ReplaceResourcesQuery(nil) + result, response, operationErr := schematicsService.ReplaceInventory(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the ReplaceResourcesQueryOptions model - replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) - replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") - replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceInventoryOptions model + replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) + replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") + replaceInventoryOptionsModel.Name = core.StringPtr("testString") + replaceInventoryOptionsModel.Description = core.StringPtr("testString") + replaceInventoryOptionsModel.Location = core.StringPtr("us-south") + replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} + replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + result, response, operationErr = schematicsService.ReplaceInventory(replaceInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ReplaceResourcesQuery with error: Operation validation and request error`, func() { + It(`Invoke ReplaceInventory with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18407,37 +19931,28 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") - - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} - - // Construct an instance of the ReplaceResourcesQueryOptions model - replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) - replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") - replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceInventoryOptions model + replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) + replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") + replaceInventoryOptionsModel.Name = core.StringPtr("testString") + replaceInventoryOptionsModel.Description = core.StringPtr("testString") + replaceInventoryOptionsModel.Location = core.StringPtr("us-south") + replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} + replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + result, response, operationErr := schematicsService.ReplaceInventory(replaceInventoryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ReplaceResourcesQueryOptions model with no property values - replaceResourcesQueryOptionsModelNew := new(schematicsv1.ReplaceResourcesQueryOptions) + // Construct a second instance of the ReplaceInventoryOptions model with no property values + replaceInventoryOptionsModelNew := new(schematicsv1.ReplaceInventoryOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModelNew) + result, response, operationErr = schematicsService.ReplaceInventory(replaceInventoryOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -18455,7 +19970,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ReplaceResourcesQuery successfully`, func() { + It(`Invoke ReplaceInventory successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18463,55 +19978,4209 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ResourceQueryParam model - resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) - resourceQueryParamModel.Name = core.StringPtr("testString") - resourceQueryParamModel.Value = core.StringPtr("testString") - resourceQueryParamModel.Description = core.StringPtr("testString") + // Construct an instance of the ReplaceInventoryOptions model + replaceInventoryOptionsModel := new(schematicsv1.ReplaceInventoryOptions) + replaceInventoryOptionsModel.InventoryID = core.StringPtr("testString") + replaceInventoryOptionsModel.Name = core.StringPtr("testString") + replaceInventoryOptionsModel.Description = core.StringPtr("testString") + replaceInventoryOptionsModel.Location = core.StringPtr("us-south") + replaceInventoryOptionsModel.ResourceGroup = core.StringPtr("testString") + replaceInventoryOptionsModel.InventoriesIni = core.StringPtr("testString") + replaceInventoryOptionsModel.ResourceQueries = []string{"testString"} + replaceInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the ResourceQuery model - resourceQueryModel := new(schematicsv1.ResourceQuery) - resourceQueryModel.QueryType = core.StringPtr("workspaces") - resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} - resourceQueryModel.QuerySelect = []string{"testString"} + // Invoke operation + result, response, operationErr := schematicsService.ReplaceInventory(replaceInventoryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the ReplaceResourcesQueryOptions model - replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) - replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") - replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") - replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} - replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInventory(deleteInventoryOptions *DeleteInventoryOptions)`, func() { + deleteInventoryPath := "/v2/inventories/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Invoke operation - result, response, operationErr := schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteInventoryPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Force"]).ToNot(BeNil()) + Expect(req.Header["Force"][0]).To(Equal(fmt.Sprintf("%v", true))) + Expect(req.Header["Propagate"]).ToNot(BeNil()) + Expect(req.Header["Propagate"][0]).To(Equal(fmt.Sprintf("%v", true))) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInventory successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.DeleteInventory(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInventoryOptions model + deleteInventoryOptionsModel := new(schematicsv1.DeleteInventoryOptions) + deleteInventoryOptionsModel.InventoryID = core.StringPtr("testString") + deleteInventoryOptionsModel.Force = core.BoolPtr(true) + deleteInventoryOptionsModel.Propagate = core.BoolPtr(true) + deleteInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = schematicsService.DeleteInventory(deleteInventoryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInventory with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the DeleteInventoryOptions model + deleteInventoryOptionsModel := new(schematicsv1.DeleteInventoryOptions) + deleteInventoryOptionsModel.InventoryID = core.StringPtr("testString") + deleteInventoryOptionsModel.Force = core.BoolPtr(true) + deleteInventoryOptionsModel.Propagate = core.BoolPtr(true) + deleteInventoryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := schematicsService.DeleteInventory(deleteInventoryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInventoryOptions model with no property values + deleteInventoryOptionsModelNew := new(schematicsv1.DeleteInventoryOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = schematicsService.DeleteInventory(deleteInventoryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListResourceQuery(listResourceQueryOptions *ListResourceQueryOptions) - Operation response error`, func() { + listResourceQueryPath := "/v2/resources_query" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listResourceQueryPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListResourceQuery with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListResourceQueryOptions model + listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) + listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) + listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) + listResourceQueryOptionsModel.Sort = core.StringPtr("testString") + listResourceQueryOptionsModel.Profile = core.StringPtr("ids") + listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListResourceQuery(listResourceQueryOptions *ListResourceQueryOptions)`, func() { + listResourceQueryPath := "/v2/resources_query" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listResourceQueryPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "resource_queries": [{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}]}`) + })) + }) + It(`Invoke ListResourceQuery successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the ListResourceQueryOptions model + listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) + listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) + listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) + listResourceQueryOptionsModel.Sort = core.StringPtr("testString") + listResourceQueryOptionsModel.Profile = core.StringPtr("ids") + listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.ListResourceQueryWithContext(ctx, listResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.ListResourceQueryWithContext(ctx, listResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listResourceQueryPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"ids"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "resource_queries": [{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}]}`) + })) + }) + It(`Invoke ListResourceQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.ListResourceQuery(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListResourceQueryOptions model + listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) + listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) + listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) + listResourceQueryOptionsModel.Sort = core.StringPtr("testString") + listResourceQueryOptionsModel.Profile = core.StringPtr("ids") + listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListResourceQuery with error: Operation request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListResourceQueryOptions model + listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) + listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) + listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) + listResourceQueryOptionsModel.Sort = core.StringPtr("testString") + listResourceQueryOptionsModel.Profile = core.StringPtr("ids") + listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListResourceQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListResourceQueryOptions model + listResourceQueryOptionsModel := new(schematicsv1.ListResourceQueryOptions) + listResourceQueryOptionsModel.Offset = core.Int64Ptr(int64(0)) + listResourceQueryOptionsModel.Limit = core.Int64Ptr(int64(1)) + listResourceQueryOptionsModel.Sort = core.StringPtr("testString") + listResourceQueryOptionsModel.Profile = core.StringPtr("ids") + listResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.ListResourceQuery(listResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateResourceQuery(createResourceQueryOptions *CreateResourceQueryOptions) - Operation response error`, func() { + createResourceQueryPath := "/v2/resources_query" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createResourceQueryPath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateResourceQuery with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the CreateResourceQueryOptions model + createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) + createResourceQueryOptionsModel.Type = core.StringPtr("vsi") + createResourceQueryOptionsModel.Name = core.StringPtr("testString") + createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateResourceQuery(createResourceQueryOptions *CreateResourceQueryOptions)`, func() { + createResourceQueryPath := "/v2/resources_query" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createResourceQueryPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + })) + }) + It(`Invoke CreateResourceQuery successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the CreateResourceQueryOptions model + createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) + createResourceQueryOptionsModel.Type = core.StringPtr("vsi") + createResourceQueryOptionsModel.Name = core.StringPtr("testString") + createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.CreateResourceQueryWithContext(ctx, createResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.CreateResourceQueryWithContext(ctx, createResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createResourceQueryPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + })) + }) + It(`Invoke CreateResourceQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.CreateResourceQuery(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the CreateResourceQueryOptions model + createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) + createResourceQueryOptionsModel.Type = core.StringPtr("vsi") + createResourceQueryOptionsModel.Name = core.StringPtr("testString") + createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateResourceQuery with error: Operation request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the CreateResourceQueryOptions model + createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) + createResourceQueryOptionsModel.Type = core.StringPtr("vsi") + createResourceQueryOptionsModel.Name = core.StringPtr("testString") + createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke CreateResourceQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the CreateResourceQueryOptions model + createResourceQueryOptionsModel := new(schematicsv1.CreateResourceQueryOptions) + createResourceQueryOptionsModel.Type = core.StringPtr("vsi") + createResourceQueryOptionsModel.Name = core.StringPtr("testString") + createResourceQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + createResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.CreateResourceQuery(createResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetResourcesQuery(getResourcesQueryOptions *GetResourcesQueryOptions) - Operation response error`, func() { + getResourcesQueryPath := "/v2/resources_query/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getResourcesQueryPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetResourcesQuery with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetResourcesQueryOptions model + getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) + getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetResourcesQuery(getResourcesQueryOptions *GetResourcesQueryOptions)`, func() { + getResourcesQueryPath := "/v2/resources_query/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getResourcesQueryPath)) + Expect(req.Method).To(Equal("GET")) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + })) + }) + It(`Invoke GetResourcesQuery successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the GetResourcesQueryOptions model + getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) + getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.GetResourcesQueryWithContext(ctx, getResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.GetResourcesQueryWithContext(ctx, getResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getResourcesQueryPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + })) + }) + It(`Invoke GetResourcesQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.GetResourcesQuery(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetResourcesQueryOptions model + getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) + getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetResourcesQuery with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetResourcesQueryOptions model + getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) + getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetResourcesQueryOptions model with no property values + getResourcesQueryOptionsModelNew := new(schematicsv1.GetResourcesQueryOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.GetResourcesQuery(getResourcesQueryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetResourcesQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetResourcesQueryOptions model + getResourcesQueryOptionsModel := new(schematicsv1.GetResourcesQueryOptions) + getResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + getResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.GetResourcesQuery(getResourcesQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceResourcesQuery(replaceResourcesQueryOptions *ReplaceResourcesQueryOptions) - Operation response error`, func() { + replaceResourcesQueryPath := "/v2/resources_query/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceResourcesQueryPath)) + Expect(req.Method).To(Equal("PUT")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ReplaceResourcesQuery with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the ReplaceResourcesQueryOptions model + replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) + replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") + replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceResourcesQuery(replaceResourcesQueryOptions *ReplaceResourcesQueryOptions)`, func() { + replaceResourcesQueryPath := "/v2/resources_query/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceResourcesQueryPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + })) + }) + It(`Invoke ReplaceResourcesQuery successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the ReplaceResourcesQueryOptions model + replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) + replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") + replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.ReplaceResourcesQueryWithContext(ctx, replaceResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.ReplaceResourcesQueryWithContext(ctx, replaceResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceResourcesQueryPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"type": "vsi", "name": "Name", "id": "ID", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "queries": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"]}]}`) + })) + }) + It(`Invoke ReplaceResourcesQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.ReplaceResourcesQuery(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the ReplaceResourcesQueryOptions model + replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) + replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") + replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ReplaceResourcesQuery with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the ReplaceResourcesQueryOptions model + replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) + replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") + replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ReplaceResourcesQueryOptions model with no property values + replaceResourcesQueryOptionsModelNew := new(schematicsv1.ReplaceResourcesQueryOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ReplaceResourcesQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ResourceQueryParam model + resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) + resourceQueryParamModel.Name = core.StringPtr("testString") + resourceQueryParamModel.Value = core.StringPtr("testString") + resourceQueryParamModel.Description = core.StringPtr("testString") + + // Construct an instance of the ResourceQuery model + resourceQueryModel := new(schematicsv1.ResourceQuery) + resourceQueryModel.QueryType = core.StringPtr("workspaces") + resourceQueryModel.QueryCondition = []schematicsv1.ResourceQueryParam{*resourceQueryParamModel} + resourceQueryModel.QuerySelect = []string{"testString"} + + // Construct an instance of the ReplaceResourcesQueryOptions model + replaceResourcesQueryOptionsModel := new(schematicsv1.ReplaceResourcesQueryOptions) + replaceResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Type = core.StringPtr("vsi") + replaceResourcesQueryOptionsModel.Name = core.StringPtr("testString") + replaceResourcesQueryOptionsModel.Queries = []schematicsv1.ResourceQuery{*resourceQueryModel} + replaceResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.ReplaceResourcesQuery(replaceResourcesQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ExecuteResourceQuery(executeResourceQueryOptions *ExecuteResourceQueryOptions) - Operation response error`, func() { + executeResourceQueryPath := "/v2/resources_query/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(executeResourceQueryPath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ExecuteResourceQuery with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ExecuteResourceQueryOptions model + executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) + executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") + executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ExecuteResourceQuery(executeResourceQueryOptions *ExecuteResourceQueryOptions)`, func() { + executeResourceQueryPath := "/v2/resources_query/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(executeResourceQueryPath)) + Expect(req.Method).To(Equal("POST")) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"response": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"], "query_output": [{"name": "Name", "value": "Value"}]}]}`) + })) + }) + It(`Invoke ExecuteResourceQuery successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the ExecuteResourceQueryOptions model + executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) + executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") + executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.ExecuteResourceQueryWithContext(ctx, executeResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.ExecuteResourceQueryWithContext(ctx, executeResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(executeResourceQueryPath)) + Expect(req.Method).To(Equal("POST")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"response": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"], "query_output": [{"name": "Name", "value": "Value"}]}]}`) + })) + }) + It(`Invoke ExecuteResourceQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.ExecuteResourceQuery(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ExecuteResourceQueryOptions model + executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) + executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") + executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ExecuteResourceQuery with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ExecuteResourceQueryOptions model + executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) + executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") + executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ExecuteResourceQueryOptions model with no property values + executeResourceQueryOptionsModelNew := new(schematicsv1.ExecuteResourceQueryOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ExecuteResourceQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ExecuteResourceQueryOptions model + executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) + executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") + executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteResourcesQuery(deleteResourcesQueryOptions *DeleteResourcesQueryOptions)`, func() { + deleteResourcesQueryPath := "/v2/resources_query/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteResourcesQueryPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Force"]).ToNot(BeNil()) + Expect(req.Header["Force"][0]).To(Equal(fmt.Sprintf("%v", true))) + Expect(req.Header["Propagate"]).ToNot(BeNil()) + Expect(req.Header["Propagate"][0]).To(Equal(fmt.Sprintf("%v", true))) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteResourcesQuery successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.DeleteResourcesQuery(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteResourcesQueryOptions model + deleteResourcesQueryOptionsModel := new(schematicsv1.DeleteResourcesQueryOptions) + deleteResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + deleteResourcesQueryOptionsModel.Force = core.BoolPtr(true) + deleteResourcesQueryOptionsModel.Propagate = core.BoolPtr(true) + deleteResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = schematicsService.DeleteResourcesQuery(deleteResourcesQueryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteResourcesQuery with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the DeleteResourcesQueryOptions model + deleteResourcesQueryOptionsModel := new(schematicsv1.DeleteResourcesQueryOptions) + deleteResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") + deleteResourcesQueryOptionsModel.Force = core.BoolPtr(true) + deleteResourcesQueryOptionsModel.Propagate = core.BoolPtr(true) + deleteResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := schematicsService.DeleteResourcesQuery(deleteResourcesQueryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteResourcesQueryOptions model with no property values + deleteResourcesQueryOptionsModelNew := new(schematicsv1.DeleteResourcesQueryOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = schematicsService.DeleteResourcesQuery(deleteResourcesQueryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListAgent(listAgentOptions *ListAgentOptions) - Operation response error`, func() { + listAgentPath := "/v2/settings/agents" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listAgentPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + Expect(req.URL.Query()["filter"]).To(Equal([]string{"all"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListAgent with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListAgentOptions model + listAgentOptionsModel := new(schematicsv1.ListAgentOptions) + listAgentOptionsModel.Offset = core.Int64Ptr(int64(0)) + listAgentOptionsModel.Limit = core.Int64Ptr(int64(1)) + listAgentOptionsModel.Profile = core.StringPtr("summary") + listAgentOptionsModel.Filter = core.StringPtr("all") + listAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.ListAgent(listAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.ListAgent(listAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListAgent(listAgentOptions *ListAgentOptions)`, func() { + listAgentPath := "/v2/settings/agents" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listAgentPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + Expect(req.URL.Query()["filter"]).To(Equal([]string{"all"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "agents": [{"name": "MyDevAgent", "description": "Register agent", "resource_group": "ResourceGroup", "tags": ["Tags"], "agent_location": "us-south", "location": "us-south", "profile_id": "ProfileID", "agent_crn": "AgentCrn", "id": "ID", "registered_at": "2019-01-01T12:00:00.000Z", "registered_by": "RegisteredBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "user_state": {"state": "enable", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "connection_state": {"state": "Connected", "checked_at": "2019-01-01T12:00:00.000Z"}, "system_state": {"state": "error", "message": "Message"}}]}`) + })) + }) + It(`Invoke ListAgent successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the ListAgentOptions model + listAgentOptionsModel := new(schematicsv1.ListAgentOptions) + listAgentOptionsModel.Offset = core.Int64Ptr(int64(0)) + listAgentOptionsModel.Limit = core.Int64Ptr(int64(1)) + listAgentOptionsModel.Profile = core.StringPtr("summary") + listAgentOptionsModel.Filter = core.StringPtr("all") + listAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.ListAgentWithContext(ctx, listAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.ListAgent(listAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.ListAgentWithContext(ctx, listAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listAgentPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + Expect(req.URL.Query()["filter"]).To(Equal([]string{"all"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "agents": [{"name": "MyDevAgent", "description": "Register agent", "resource_group": "ResourceGroup", "tags": ["Tags"], "agent_location": "us-south", "location": "us-south", "profile_id": "ProfileID", "agent_crn": "AgentCrn", "id": "ID", "registered_at": "2019-01-01T12:00:00.000Z", "registered_by": "RegisteredBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "user_state": {"state": "enable", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "connection_state": {"state": "Connected", "checked_at": "2019-01-01T12:00:00.000Z"}, "system_state": {"state": "error", "message": "Message"}}]}`) + })) + }) + It(`Invoke ListAgent successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.ListAgent(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListAgentOptions model + listAgentOptionsModel := new(schematicsv1.ListAgentOptions) + listAgentOptionsModel.Offset = core.Int64Ptr(int64(0)) + listAgentOptionsModel.Limit = core.Int64Ptr(int64(1)) + listAgentOptionsModel.Profile = core.StringPtr("summary") + listAgentOptionsModel.Filter = core.StringPtr("all") + listAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.ListAgent(listAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListAgent with error: Operation request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListAgentOptions model + listAgentOptionsModel := new(schematicsv1.ListAgentOptions) + listAgentOptionsModel.Offset = core.Int64Ptr(int64(0)) + listAgentOptionsModel.Limit = core.Int64Ptr(int64(1)) + listAgentOptionsModel.Profile = core.StringPtr("summary") + listAgentOptionsModel.Filter = core.StringPtr("all") + listAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.ListAgent(listAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListAgent successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListAgentOptions model + listAgentOptionsModel := new(schematicsv1.ListAgentOptions) + listAgentOptionsModel.Offset = core.Int64Ptr(int64(0)) + listAgentOptionsModel.Limit = core.Int64Ptr(int64(1)) + listAgentOptionsModel.Profile = core.StringPtr("summary") + listAgentOptionsModel.Filter = core.StringPtr("all") + listAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.ListAgent(listAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`RegisterAgent(registerAgentOptions *RegisterAgentOptions) - Operation response error`, func() { + registerAgentPath := "/v2/settings/agents" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(registerAgentPath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke RegisterAgent with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the RegisterAgentOptions model + registerAgentOptionsModel := new(schematicsv1.RegisterAgentOptions) + registerAgentOptionsModel.Name = core.StringPtr("MyDevAgent") + registerAgentOptionsModel.AgentLocation = core.StringPtr("us-south") + registerAgentOptionsModel.Location = core.StringPtr("us-south") + registerAgentOptionsModel.ProfileID = core.StringPtr("testString") + registerAgentOptionsModel.Description = core.StringPtr("Register agent") + registerAgentOptionsModel.ResourceGroup = core.StringPtr("testString") + registerAgentOptionsModel.Tags = []string{"testString"} + registerAgentOptionsModel.UserState = agentUserStateModel + registerAgentOptionsModel.ConnectionState = connectionStateModel + registerAgentOptionsModel.SystemState = agentSystemStateModel + registerAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.RegisterAgent(registerAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.RegisterAgent(registerAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`RegisterAgent(registerAgentOptions *RegisterAgentOptions)`, func() { + registerAgentPath := "/v2/settings/agents" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(registerAgentPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"name": "MyDevAgent", "description": "Register agent", "resource_group": "ResourceGroup", "tags": ["Tags"], "agent_location": "us-south", "location": "us-south", "profile_id": "ProfileID", "agent_crn": "AgentCrn", "id": "ID", "registered_at": "2019-01-01T12:00:00.000Z", "registered_by": "RegisteredBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "user_state": {"state": "enable", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "connection_state": {"state": "Connected", "checked_at": "2019-01-01T12:00:00.000Z"}, "system_state": {"state": "error", "message": "Message"}}`) + })) + }) + It(`Invoke RegisterAgent successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the RegisterAgentOptions model + registerAgentOptionsModel := new(schematicsv1.RegisterAgentOptions) + registerAgentOptionsModel.Name = core.StringPtr("MyDevAgent") + registerAgentOptionsModel.AgentLocation = core.StringPtr("us-south") + registerAgentOptionsModel.Location = core.StringPtr("us-south") + registerAgentOptionsModel.ProfileID = core.StringPtr("testString") + registerAgentOptionsModel.Description = core.StringPtr("Register agent") + registerAgentOptionsModel.ResourceGroup = core.StringPtr("testString") + registerAgentOptionsModel.Tags = []string{"testString"} + registerAgentOptionsModel.UserState = agentUserStateModel + registerAgentOptionsModel.ConnectionState = connectionStateModel + registerAgentOptionsModel.SystemState = agentSystemStateModel + registerAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.RegisterAgentWithContext(ctx, registerAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.RegisterAgent(registerAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.RegisterAgentWithContext(ctx, registerAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(registerAgentPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"name": "MyDevAgent", "description": "Register agent", "resource_group": "ResourceGroup", "tags": ["Tags"], "agent_location": "us-south", "location": "us-south", "profile_id": "ProfileID", "agent_crn": "AgentCrn", "id": "ID", "registered_at": "2019-01-01T12:00:00.000Z", "registered_by": "RegisteredBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "user_state": {"state": "enable", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "connection_state": {"state": "Connected", "checked_at": "2019-01-01T12:00:00.000Z"}, "system_state": {"state": "error", "message": "Message"}}`) + })) + }) + It(`Invoke RegisterAgent successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.RegisterAgent(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the RegisterAgentOptions model + registerAgentOptionsModel := new(schematicsv1.RegisterAgentOptions) + registerAgentOptionsModel.Name = core.StringPtr("MyDevAgent") + registerAgentOptionsModel.AgentLocation = core.StringPtr("us-south") + registerAgentOptionsModel.Location = core.StringPtr("us-south") + registerAgentOptionsModel.ProfileID = core.StringPtr("testString") + registerAgentOptionsModel.Description = core.StringPtr("Register agent") + registerAgentOptionsModel.ResourceGroup = core.StringPtr("testString") + registerAgentOptionsModel.Tags = []string{"testString"} + registerAgentOptionsModel.UserState = agentUserStateModel + registerAgentOptionsModel.ConnectionState = connectionStateModel + registerAgentOptionsModel.SystemState = agentSystemStateModel + registerAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.RegisterAgent(registerAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke RegisterAgent with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the RegisterAgentOptions model + registerAgentOptionsModel := new(schematicsv1.RegisterAgentOptions) + registerAgentOptionsModel.Name = core.StringPtr("MyDevAgent") + registerAgentOptionsModel.AgentLocation = core.StringPtr("us-south") + registerAgentOptionsModel.Location = core.StringPtr("us-south") + registerAgentOptionsModel.ProfileID = core.StringPtr("testString") + registerAgentOptionsModel.Description = core.StringPtr("Register agent") + registerAgentOptionsModel.ResourceGroup = core.StringPtr("testString") + registerAgentOptionsModel.Tags = []string{"testString"} + registerAgentOptionsModel.UserState = agentUserStateModel + registerAgentOptionsModel.ConnectionState = connectionStateModel + registerAgentOptionsModel.SystemState = agentSystemStateModel + registerAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.RegisterAgent(registerAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the RegisterAgentOptions model with no property values + registerAgentOptionsModelNew := new(schematicsv1.RegisterAgentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.RegisterAgent(registerAgentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke RegisterAgent successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the RegisterAgentOptions model + registerAgentOptionsModel := new(schematicsv1.RegisterAgentOptions) + registerAgentOptionsModel.Name = core.StringPtr("MyDevAgent") + registerAgentOptionsModel.AgentLocation = core.StringPtr("us-south") + registerAgentOptionsModel.Location = core.StringPtr("us-south") + registerAgentOptionsModel.ProfileID = core.StringPtr("testString") + registerAgentOptionsModel.Description = core.StringPtr("Register agent") + registerAgentOptionsModel.ResourceGroup = core.StringPtr("testString") + registerAgentOptionsModel.Tags = []string{"testString"} + registerAgentOptionsModel.UserState = agentUserStateModel + registerAgentOptionsModel.ConnectionState = connectionStateModel + registerAgentOptionsModel.SystemState = agentSystemStateModel + registerAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.RegisterAgent(registerAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetAgent(getAgentOptions *GetAgentOptions) - Operation response error`, func() { + getAgentPath := "/v2/settings/agents/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getAgentPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetAgent with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetAgentOptions model + getAgentOptionsModel := new(schematicsv1.GetAgentOptions) + getAgentOptionsModel.AgentID = core.StringPtr("testString") + getAgentOptionsModel.Profile = core.StringPtr("summary") + getAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.GetAgent(getAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.GetAgent(getAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetAgent(getAgentOptions *GetAgentOptions)`, func() { + getAgentPath := "/v2/settings/agents/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getAgentPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"name": "MyDevAgent", "description": "Register agent", "resource_group": "ResourceGroup", "tags": ["Tags"], "agent_location": "us-south", "location": "us-south", "profile_id": "ProfileID", "agent_crn": "AgentCrn", "id": "ID", "registered_at": "2019-01-01T12:00:00.000Z", "registered_by": "RegisteredBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "user_state": {"state": "enable", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "connection_state": {"state": "Connected", "checked_at": "2019-01-01T12:00:00.000Z"}, "system_state": {"state": "error", "message": "Message"}}`) + })) + }) + It(`Invoke GetAgent successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the GetAgentOptions model + getAgentOptionsModel := new(schematicsv1.GetAgentOptions) + getAgentOptionsModel.AgentID = core.StringPtr("testString") + getAgentOptionsModel.Profile = core.StringPtr("summary") + getAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.GetAgentWithContext(ctx, getAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.GetAgent(getAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.GetAgentWithContext(ctx, getAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getAgentPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"name": "MyDevAgent", "description": "Register agent", "resource_group": "ResourceGroup", "tags": ["Tags"], "agent_location": "us-south", "location": "us-south", "profile_id": "ProfileID", "agent_crn": "AgentCrn", "id": "ID", "registered_at": "2019-01-01T12:00:00.000Z", "registered_by": "RegisteredBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "user_state": {"state": "enable", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "connection_state": {"state": "Connected", "checked_at": "2019-01-01T12:00:00.000Z"}, "system_state": {"state": "error", "message": "Message"}}`) + })) + }) + It(`Invoke GetAgent successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.GetAgent(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetAgentOptions model + getAgentOptionsModel := new(schematicsv1.GetAgentOptions) + getAgentOptionsModel.AgentID = core.StringPtr("testString") + getAgentOptionsModel.Profile = core.StringPtr("summary") + getAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.GetAgent(getAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetAgent with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetAgentOptions model + getAgentOptionsModel := new(schematicsv1.GetAgentOptions) + getAgentOptionsModel.AgentID = core.StringPtr("testString") + getAgentOptionsModel.Profile = core.StringPtr("summary") + getAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.GetAgent(getAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetAgentOptions model with no property values + getAgentOptionsModelNew := new(schematicsv1.GetAgentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.GetAgent(getAgentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetAgent successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetAgentOptions model + getAgentOptionsModel := new(schematicsv1.GetAgentOptions) + getAgentOptionsModel.AgentID = core.StringPtr("testString") + getAgentOptionsModel.Profile = core.StringPtr("summary") + getAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.GetAgent(getAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteAgent(deleteAgentOptions *DeleteAgentOptions)`, func() { + deleteAgentPath := "/v2/settings/agents/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteAgentPath)) + Expect(req.Method).To(Equal("DELETE")) + + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteAgent successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.DeleteAgent(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteAgentOptions model + deleteAgentOptionsModel := new(schematicsv1.DeleteAgentOptions) + deleteAgentOptionsModel.AgentID = core.StringPtr("testString") + deleteAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = schematicsService.DeleteAgent(deleteAgentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteAgent with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the DeleteAgentOptions model + deleteAgentOptionsModel := new(schematicsv1.DeleteAgentOptions) + deleteAgentOptionsModel.AgentID = core.StringPtr("testString") + deleteAgentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := schematicsService.DeleteAgent(deleteAgentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteAgentOptions model with no property values + deleteAgentOptionsModelNew := new(schematicsv1.DeleteAgentOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = schematicsService.DeleteAgent(deleteAgentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateAgentRegistration(updateAgentRegistrationOptions *UpdateAgentRegistrationOptions) - Operation response error`, func() { + updateAgentRegistrationPath := "/v2/settings/agents/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateAgentRegistrationPath)) + Expect(req.Method).To(Equal("PATCH")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateAgentRegistration with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the UpdateAgentRegistrationOptions model + updateAgentRegistrationOptionsModel := new(schematicsv1.UpdateAgentRegistrationOptions) + updateAgentRegistrationOptionsModel.AgentID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Name = core.StringPtr("MyDevAgent") + updateAgentRegistrationOptionsModel.AgentLocation = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.Location = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.ProfileID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Description = core.StringPtr("Register agent") + updateAgentRegistrationOptionsModel.ResourceGroup = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Tags = []string{"testString"} + updateAgentRegistrationOptionsModel.UserState = agentUserStateModel + updateAgentRegistrationOptionsModel.ConnectionState = connectionStateModel + updateAgentRegistrationOptionsModel.SystemState = agentSystemStateModel + updateAgentRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.UpdateAgentRegistration(updateAgentRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.UpdateAgentRegistration(updateAgentRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateAgentRegistration(updateAgentRegistrationOptions *UpdateAgentRegistrationOptions)`, func() { + updateAgentRegistrationPath := "/v2/settings/agents/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateAgentRegistrationPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"name": "MyDevAgent", "description": "Register agent", "resource_group": "ResourceGroup", "tags": ["Tags"], "agent_location": "us-south", "location": "us-south", "profile_id": "ProfileID", "agent_crn": "AgentCrn", "id": "ID", "registered_at": "2019-01-01T12:00:00.000Z", "registered_by": "RegisteredBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "user_state": {"state": "enable", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "connection_state": {"state": "Connected", "checked_at": "2019-01-01T12:00:00.000Z"}, "system_state": {"state": "error", "message": "Message"}}`) + })) + }) + It(`Invoke UpdateAgentRegistration successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the UpdateAgentRegistrationOptions model + updateAgentRegistrationOptionsModel := new(schematicsv1.UpdateAgentRegistrationOptions) + updateAgentRegistrationOptionsModel.AgentID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Name = core.StringPtr("MyDevAgent") + updateAgentRegistrationOptionsModel.AgentLocation = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.Location = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.ProfileID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Description = core.StringPtr("Register agent") + updateAgentRegistrationOptionsModel.ResourceGroup = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Tags = []string{"testString"} + updateAgentRegistrationOptionsModel.UserState = agentUserStateModel + updateAgentRegistrationOptionsModel.ConnectionState = connectionStateModel + updateAgentRegistrationOptionsModel.SystemState = agentSystemStateModel + updateAgentRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.UpdateAgentRegistrationWithContext(ctx, updateAgentRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.UpdateAgentRegistration(updateAgentRegistrationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.UpdateAgentRegistrationWithContext(ctx, updateAgentRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateAgentRegistrationPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"name": "MyDevAgent", "description": "Register agent", "resource_group": "ResourceGroup", "tags": ["Tags"], "agent_location": "us-south", "location": "us-south", "profile_id": "ProfileID", "agent_crn": "AgentCrn", "id": "ID", "registered_at": "2019-01-01T12:00:00.000Z", "registered_by": "RegisteredBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "user_state": {"state": "enable", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "connection_state": {"state": "Connected", "checked_at": "2019-01-01T12:00:00.000Z"}, "system_state": {"state": "error", "message": "Message"}}`) + })) + }) + It(`Invoke UpdateAgentRegistration successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.UpdateAgentRegistration(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the UpdateAgentRegistrationOptions model + updateAgentRegistrationOptionsModel := new(schematicsv1.UpdateAgentRegistrationOptions) + updateAgentRegistrationOptionsModel.AgentID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Name = core.StringPtr("MyDevAgent") + updateAgentRegistrationOptionsModel.AgentLocation = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.Location = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.ProfileID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Description = core.StringPtr("Register agent") + updateAgentRegistrationOptionsModel.ResourceGroup = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Tags = []string{"testString"} + updateAgentRegistrationOptionsModel.UserState = agentUserStateModel + updateAgentRegistrationOptionsModel.ConnectionState = connectionStateModel + updateAgentRegistrationOptionsModel.SystemState = agentSystemStateModel + updateAgentRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.UpdateAgentRegistration(updateAgentRegistrationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateAgentRegistration with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the UpdateAgentRegistrationOptions model + updateAgentRegistrationOptionsModel := new(schematicsv1.UpdateAgentRegistrationOptions) + updateAgentRegistrationOptionsModel.AgentID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Name = core.StringPtr("MyDevAgent") + updateAgentRegistrationOptionsModel.AgentLocation = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.Location = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.ProfileID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Description = core.StringPtr("Register agent") + updateAgentRegistrationOptionsModel.ResourceGroup = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Tags = []string{"testString"} + updateAgentRegistrationOptionsModel.UserState = agentUserStateModel + updateAgentRegistrationOptionsModel.ConnectionState = connectionStateModel + updateAgentRegistrationOptionsModel.SystemState = agentSystemStateModel + updateAgentRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.UpdateAgentRegistration(updateAgentRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateAgentRegistrationOptions model with no property values + updateAgentRegistrationOptionsModelNew := new(schematicsv1.UpdateAgentRegistrationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.UpdateAgentRegistration(updateAgentRegistrationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke UpdateAgentRegistration successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + agentUserStateModel.State = core.StringPtr("enable") + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + + // Construct an instance of the UpdateAgentRegistrationOptions model + updateAgentRegistrationOptionsModel := new(schematicsv1.UpdateAgentRegistrationOptions) + updateAgentRegistrationOptionsModel.AgentID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Name = core.StringPtr("MyDevAgent") + updateAgentRegistrationOptionsModel.AgentLocation = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.Location = core.StringPtr("us-south") + updateAgentRegistrationOptionsModel.ProfileID = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Description = core.StringPtr("Register agent") + updateAgentRegistrationOptionsModel.ResourceGroup = core.StringPtr("testString") + updateAgentRegistrationOptionsModel.Tags = []string{"testString"} + updateAgentRegistrationOptionsModel.UserState = agentUserStateModel + updateAgentRegistrationOptionsModel.ConnectionState = connectionStateModel + updateAgentRegistrationOptionsModel.SystemState = agentSystemStateModel + updateAgentRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.UpdateAgentRegistration(updateAgentRegistrationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetKmsSettings(getKmsSettingsOptions *GetKmsSettingsOptions) - Operation response error`, func() { + getKmsSettingsPath := "/v2/settings/kms" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getKmsSettingsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetKmsSettings with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetKmsSettingsOptions model + getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) + getKmsSettingsOptionsModel.Location = core.StringPtr("testString") + getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetKmsSettings(getKmsSettingsOptions *GetKmsSettingsOptions)`, func() { + getKmsSettingsPath := "/v2/settings/kms" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getKmsSettingsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "primary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}, "secondary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}}`) + })) + }) + It(`Invoke GetKmsSettings successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the GetKmsSettingsOptions model + getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) + getKmsSettingsOptionsModel.Location = core.StringPtr("testString") + getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.GetKmsSettingsWithContext(ctx, getKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.GetKmsSettingsWithContext(ctx, getKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getKmsSettingsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "primary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}, "secondary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}}`) + })) + }) + It(`Invoke GetKmsSettings successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.GetKmsSettings(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetKmsSettingsOptions model + getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) + getKmsSettingsOptionsModel.Location = core.StringPtr("testString") + getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetKmsSettings with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetKmsSettingsOptions model + getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) + getKmsSettingsOptionsModel.Location = core.StringPtr("testString") + getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetKmsSettingsOptions model with no property values + getKmsSettingsOptionsModelNew := new(schematicsv1.GetKmsSettingsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.GetKmsSettings(getKmsSettingsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetKmsSettings successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetKmsSettingsOptions model + getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) + getKmsSettingsOptionsModel.Location = core.StringPtr("testString") + getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateKmsSettings(updateKmsSettingsOptions *UpdateKmsSettingsOptions) - Operation response error`, func() { + updateKmsSettingsPath := "/v2/settings/kms" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateKmsSettingsPath)) + Expect(req.Method).To(Equal("PUT")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateKmsSettings with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the KMSSettingsPrimaryCrk model + kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) + kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the KMSSettingsSecondaryCrk model + kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) + kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the UpdateKmsSettingsOptions model + updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) + updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") + updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") + updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") + updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel + updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel + updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateKmsSettings(updateKmsSettingsOptions *UpdateKmsSettingsOptions)`, func() { + updateKmsSettingsPath := "/v2/settings/kms" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateKmsSettingsPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "primary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}, "secondary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}}`) + })) + }) + It(`Invoke UpdateKmsSettings successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the KMSSettingsPrimaryCrk model + kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) + kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the KMSSettingsSecondaryCrk model + kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) + kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the UpdateKmsSettingsOptions model + updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) + updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") + updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") + updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") + updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel + updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel + updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.UpdateKmsSettingsWithContext(ctx, updateKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.UpdateKmsSettingsWithContext(ctx, updateKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateKmsSettingsPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "primary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}, "secondary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}}`) + })) + }) + It(`Invoke UpdateKmsSettings successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.UpdateKmsSettings(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the KMSSettingsPrimaryCrk model + kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) + kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the KMSSettingsSecondaryCrk model + kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) + kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the UpdateKmsSettingsOptions model + updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) + updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") + updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") + updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") + updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel + updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel + updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateKmsSettings with error: Operation request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the KMSSettingsPrimaryCrk model + kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) + kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the KMSSettingsSecondaryCrk model + kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) + kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the UpdateKmsSettingsOptions model + updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) + updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") + updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") + updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") + updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel + updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel + updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateKmsSettings successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the KMSSettingsPrimaryCrk model + kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) + kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the KMSSettingsSecondaryCrk model + kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) + kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") + kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") + + // Construct an instance of the UpdateKmsSettingsOptions model + updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) + updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") + updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") + updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") + updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel + updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel + updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListKms(listKmsOptions *ListKmsOptions) - Operation response error`, func() { + listKmsPath := "/v2/settings/kms_instances" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listKmsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["encryption_scheme"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListKms with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListKmsOptions model + listKmsOptionsModel := new(schematicsv1.ListKmsOptions) + listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") + listKmsOptionsModel.Location = core.StringPtr("testString") + listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") + listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKmsOptionsModel.Sort = core.StringPtr("testString") + listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.ListKms(listKmsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.ListKms(listKmsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListKms(listKmsOptions *ListKmsOptions)`, func() { + listKmsPath := "/v2/settings/kms_instances" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listKmsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["encryption_scheme"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "kms_instances": [{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "kms_crn": "KmsCrn", "kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "kms_public_endpoint": "KmsPublicEndpoint", "keys": [{"name": "Name", "crn": "Crn", "error": "Error"}]}]}`) + })) + }) + It(`Invoke ListKms successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the ListKmsOptions model + listKmsOptionsModel := new(schematicsv1.ListKmsOptions) + listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") + listKmsOptionsModel.Location = core.StringPtr("testString") + listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") + listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKmsOptionsModel.Sort = core.StringPtr("testString") + listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.ListKmsWithContext(ctx, listKmsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.ListKms(listKmsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.ListKmsWithContext(ctx, listKmsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listKmsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["encryption_scheme"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "kms_instances": [{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "kms_crn": "KmsCrn", "kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "kms_public_endpoint": "KmsPublicEndpoint", "keys": [{"name": "Name", "crn": "Crn", "error": "Error"}]}]}`) + })) + }) + It(`Invoke ListKms successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.ListKms(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListKmsOptions model + listKmsOptionsModel := new(schematicsv1.ListKmsOptions) + listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") + listKmsOptionsModel.Location = core.StringPtr("testString") + listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") + listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKmsOptionsModel.Sort = core.StringPtr("testString") + listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.ListKms(listKmsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListKms with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListKmsOptions model + listKmsOptionsModel := new(schematicsv1.ListKmsOptions) + listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") + listKmsOptionsModel.Location = core.StringPtr("testString") + listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") + listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKmsOptionsModel.Sort = core.StringPtr("testString") + listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.ListKms(listKmsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListKmsOptions model with no property values + listKmsOptionsModelNew := new(schematicsv1.ListKmsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.ListKms(listKmsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListKms successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the ListKmsOptions model + listKmsOptionsModel := new(schematicsv1.ListKmsOptions) + listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") + listKmsOptionsModel.Location = core.StringPtr("testString") + listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") + listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKmsOptionsModel.Sort = core.StringPtr("testString") + listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.ListKms(listKmsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`FetchJobs(fetchJobsOptions *FetchJobsOptions) - Operation response error`, func() { + fetchJobsPath := "/v2/agent_jobs" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(fetchJobsPath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke FetchJobs with error: Operation response processing error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the FetchJobsOptions model + fetchJobsOptionsModel := new(schematicsv1.FetchJobsOptions) + fetchJobsOptionsModel.AgentID = core.StringPtr("testString") + fetchJobsOptionsModel.JobCount = core.Int64Ptr(int64(1)) + fetchJobsOptionsModel.JobType = core.StringPtr("workspace_job") + fetchJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := schematicsService.FetchJobs(fetchJobsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + schematicsService.EnableRetries(0, 0) + result, response, operationErr = schematicsService.FetchJobs(fetchJobsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`FetchJobs(fetchJobsOptions *FetchJobsOptions)`, func() { + fetchJobsPath := "/v2/agent_jobs" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(fetchJobsPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"agent_id": "AgentID", "job_count": 1, "job_type": "workspace_job", "job_details": [{"job_id": "JobID", "request_id": "RequestID", "job_type": "workspace_job", "workspace_job_details": {"settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "workspace": {"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}, "job": {"action_id": "ActionID", "message": ["Message"], "name": "Name", "performed_at": "2019-01-01T12:00:00.000Z", "performed_by": "PerformedBy", "status": "Status", "templates": [{"end_time": "2019-01-01T12:00:00.000Z", "log_summary": {"activity_status": "ActivityStatus", "detected_template_type": "DetectedTemplateType", "discarded_files": 14, "error": "Error", "resources_added": 14, "resources_destroyed": 18, "resources_modified": 17, "scanned_files": 12, "template_variable_count": 21, "time_taken": 9}, "log_url": "LogURL", "message": "Message", "start_time": "2019-01-01T12:00:00.000Z", "status": "Status", "template_id": "TemplateID", "template_type": "TemplateType"}]}}}], "job_status": [{"agent_sub_id": "AgentSubID", "doc_type": "workspace", "workspace_status": {"workspace_id": "WorkspaceID", "workspace_status": "WorkspaceStatus", "unlock_workspace": false, "job_status": "JobStatus", "job_log_summary": {"activity_status": "ActivityStatus", "detected_template_type": "DetectedTemplateType", "discarded_files": 14, "error": "Error", "resources_added": 14, "resources_destroyed": 18, "resources_modified": 17, "scanned_files": 12, "template_variable_count": 21, "time_taken": 9}}}], "job_variables": [{"doc_type": "workspace", "workspace_variables": {"workspace_id": "WorkspaceID", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}]}}]}`) + })) + }) + It(`Invoke FetchJobs successfully with retries`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + schematicsService.EnableRetries(0, 0) + + // Construct an instance of the FetchJobsOptions model + fetchJobsOptionsModel := new(schematicsv1.FetchJobsOptions) + fetchJobsOptionsModel.AgentID = core.StringPtr("testString") + fetchJobsOptionsModel.JobCount = core.Int64Ptr(int64(1)) + fetchJobsOptionsModel.JobType = core.StringPtr("workspace_job") + fetchJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := schematicsService.FetchJobsWithContext(ctx, fetchJobsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + schematicsService.DisableRetries() + result, response, operationErr := schematicsService.FetchJobs(fetchJobsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = schematicsService.FetchJobsWithContext(ctx, fetchJobsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(fetchJobsPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"agent_id": "AgentID", "job_count": 1, "job_type": "workspace_job", "job_details": [{"job_id": "JobID", "request_id": "RequestID", "job_type": "workspace_job", "workspace_job_details": {"settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "workspace": {"applied_shareddata_ids": ["AppliedShareddataIds"], "catalog_ref": {"dry_run": true, "owning_account": "OwningAccount", "item_icon_url": "ItemIconURL", "item_id": "ItemID", "item_name": "ItemName", "item_readme_url": "ItemReadmeURL", "item_url": "ItemURL", "launch_url": "LaunchURL", "offering_version": "OfferingVersion"}, "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "crn": "Crn", "dependencies": {"parents": ["Parents"], "children": ["Children"]}, "description": "Description", "id": "ID", "last_health_check_at": "2019-01-01T12:00:00.000Z", "location": "Location", "name": "Name", "resource_group": "ResourceGroup", "runtime_data": [{"engine_cmd": "EngineCmd", "engine_name": "EngineName", "engine_version": "EngineVersion", "id": "ID", "log_store_url": "LogStoreURL", "output_values": [{"anyKey": "anyValue"}], "resources": [[{"anyKey": "anyValue"}]], "state_store_url": "StateStoreURL"}], "shared_data": {"cluster_id": "ClusterID", "cluster_name": "ClusterName", "entitlement_keys": [{"anyKey": "anyValue"}], "namespace": "Namespace", "region": "Region", "resource_group_id": "ResourceGroupID"}, "status": "Status", "tags": ["Tags"], "template_data": [{"env_values": [{"hidden": true, "name": "Name", "secure": true, "value": "Value"}], "folder": "Folder", "compact": false, "has_githubtoken": true, "id": "ID", "type": "Type", "uninstall_script_name": "UninstallScriptName", "values": "Values", "values_metadata": [{"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}], "values_url": "ValuesURL", "variablestore": [{"description": "Description", "name": "Name", "secure": true, "type": "Type", "value": "Value"}]}], "template_ref": "TemplateRef", "template_repo": {"branch": "Branch", "full_url": "FullURL", "has_uploadedgitrepotar": false, "release": "Release", "repo_sha_value": "RepoShaValue", "repo_url": "RepoURL", "url": "URL"}, "type": ["Type"], "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "cart_id": "CartID", "last_action_name": "LastActionName", "last_activity_id": "LastActivityID", "last_job": {"job_id": "JobID", "job_name": "JobName", "job_status": "JobStatus"}, "workspace_status": {"frozen": true, "frozen_at": "2019-01-01T12:00:00.000Z", "frozen_by": "FrozenBy", "locked": true, "locked_by": "LockedBy", "locked_time": "2019-01-01T12:00:00.000Z"}, "workspace_status_msg": {"status_code": "StatusCode", "status_msg": "StatusMsg"}, "agent_info": {"id": "ID", "name": "Name", "assignment_policy_id": "AssignmentPolicyID"}}, "job": {"action_id": "ActionID", "message": ["Message"], "name": "Name", "performed_at": "2019-01-01T12:00:00.000Z", "performed_by": "PerformedBy", "status": "Status", "templates": [{"end_time": "2019-01-01T12:00:00.000Z", "log_summary": {"activity_status": "ActivityStatus", "detected_template_type": "DetectedTemplateType", "discarded_files": 14, "error": "Error", "resources_added": 14, "resources_destroyed": 18, "resources_modified": 17, "scanned_files": 12, "template_variable_count": 21, "time_taken": 9}, "log_url": "LogURL", "message": "Message", "start_time": "2019-01-01T12:00:00.000Z", "status": "Status", "template_id": "TemplateID", "template_type": "TemplateType"}]}}}], "job_status": [{"agent_sub_id": "AgentSubID", "doc_type": "workspace", "workspace_status": {"workspace_id": "WorkspaceID", "workspace_status": "WorkspaceStatus", "unlock_workspace": false, "job_status": "JobStatus", "job_log_summary": {"activity_status": "ActivityStatus", "detected_template_type": "DetectedTemplateType", "discarded_files": 14, "error": "Error", "resources_added": 14, "resources_destroyed": 18, "resources_modified": 17, "scanned_files": 12, "template_variable_count": 21, "time_taken": 9}}}], "job_variables": [{"doc_type": "workspace", "workspace_variables": {"workspace_id": "WorkspaceID", "inputs": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "settings": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}]}}]}`) + })) + }) + It(`Invoke FetchJobs successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := schematicsService.FetchJobs(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the FetchJobsOptions model + fetchJobsOptionsModel := new(schematicsv1.FetchJobsOptions) + fetchJobsOptionsModel.AgentID = core.StringPtr("testString") + fetchJobsOptionsModel.JobCount = core.Int64Ptr(int64(1)) + fetchJobsOptionsModel.JobType = core.StringPtr("workspace_job") + fetchJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = schematicsService.FetchJobs(fetchJobsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke FetchJobs with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the FetchJobsOptions model + fetchJobsOptionsModel := new(schematicsv1.FetchJobsOptions) + fetchJobsOptionsModel.AgentID = core.StringPtr("testString") + fetchJobsOptionsModel.JobCount = core.Int64Ptr(int64(1)) + fetchJobsOptionsModel.JobType = core.StringPtr("workspace_job") + fetchJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := schematicsService.FetchJobs(fetchJobsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the FetchJobsOptions model with no property values + fetchJobsOptionsModelNew := new(schematicsv1.FetchJobsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.FetchJobs(fetchJobsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke FetchJobs successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the FetchJobsOptions model + fetchJobsOptionsModel := new(schematicsv1.FetchJobsOptions) + fetchJobsOptionsModel.AgentID = core.StringPtr("testString") + fetchJobsOptionsModel.JobCount = core.Int64Ptr(int64(1)) + fetchJobsOptionsModel.JobType = core.StringPtr("workspace_job") + fetchJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := schematicsService.FetchJobs(fetchJobsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetAgentJobFiles(getAgentJobFilesOptions *GetAgentJobFilesOptions)`, func() { + getAgentJobFilesPath := "/v2/agent_jobs/testString/files" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getAgentJobFilesPath)) + Expect(req.Method).To(Equal("GET")) + + res.WriteHeader(200) + })) + }) + It(`Invoke GetAgentJobFiles successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.GetAgentJobFiles(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the GetAgentJobFilesOptions model + getAgentJobFilesOptionsModel := new(schematicsv1.GetAgentJobFilesOptions) + getAgentJobFilesOptionsModel.JobID = core.StringPtr("testString") + getAgentJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = schematicsService.GetAgentJobFiles(getAgentJobFilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke GetAgentJobFiles with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the GetAgentJobFilesOptions model + getAgentJobFilesOptionsModel := new(schematicsv1.GetAgentJobFilesOptions) + getAgentJobFilesOptionsModel.JobID = core.StringPtr("testString") + getAgentJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := schematicsService.GetAgentJobFiles(getAgentJobFilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the GetAgentJobFilesOptions model with no property values + getAgentJobFilesOptionsModelNew := new(schematicsv1.GetAgentJobFilesOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = schematicsService.GetAgentJobFiles(getAgentJobFilesOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`PostAgentJobFiles(postAgentJobFilesOptions *PostAgentJobFilesOptions)`, func() { + postAgentJobFilesPath := "/v2/agent_jobs/testString/files" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(postAgentJobFilesPath)) + Expect(req.Method).To(Equal("POST")) + + Expect(req.URL.Query()["file_type"]).To(Equal([]string{"template_repo"})) + res.WriteHeader(200) + })) + }) + It(`Invoke PostAgentJobFiles successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.PostAgentJobFiles(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the PostAgentJobFilesOptions model + postAgentJobFilesOptionsModel := new(schematicsv1.PostAgentJobFilesOptions) + postAgentJobFilesOptionsModel.JobID = core.StringPtr("testString") + postAgentJobFilesOptionsModel.FileType = core.StringPtr("template_repo") + postAgentJobFilesOptionsModel.File = CreateMockReader("This is a mock file.") + postAgentJobFilesOptionsModel.FileContentType = core.StringPtr("testString") + postAgentJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = schematicsService.PostAgentJobFiles(postAgentJobFilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke PostAgentJobFiles with error: Param validation error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the PostAgentJobFilesOptions model + postAgentJobFilesOptionsModel := new(schematicsv1.PostAgentJobFilesOptions) + // Invoke operation with invalid options model (negative test) + response, operationErr := schematicsService.PostAgentJobFiles(postAgentJobFilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + It(`Invoke PostAgentJobFiles with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the PostAgentJobFilesOptions model + postAgentJobFilesOptionsModel := new(schematicsv1.PostAgentJobFilesOptions) + postAgentJobFilesOptionsModel.JobID = core.StringPtr("testString") + postAgentJobFilesOptionsModel.FileType = core.StringPtr("template_repo") + postAgentJobFilesOptionsModel.File = CreateMockReader("This is a mock file.") + postAgentJobFilesOptionsModel.FileContentType = core.StringPtr("testString") + postAgentJobFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := schematicsService.PostAgentJobFiles(postAgentJobFilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the PostAgentJobFilesOptions model with no property values + postAgentJobFilesOptionsModelNew := new(schematicsv1.PostAgentJobFilesOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = schematicsService.PostAgentJobFiles(postAgentJobFilesOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateJobStatus(updateJobStatusOptions *UpdateJobStatusOptions)`, func() { + updateJobStatusPath := "/v2/agent_jobs/testString/status" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateJobStatusPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateJobStatus successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.UpdateJobStatus(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the LogSummary model + logSummaryModel := new(schematicsv1.LogSummary) + logSummaryModel.ActivityStatus = core.StringPtr("testString") + logSummaryModel.DetectedTemplateType = core.StringPtr("testString") + logSummaryModel.DiscardedFiles = core.Int64Ptr(int64(26)) + logSummaryModel.Error = core.StringPtr("testString") + logSummaryModel.ResourcesAdded = core.Int64Ptr(int64(26)) + logSummaryModel.ResourcesDestroyed = core.Int64Ptr(int64(26)) + logSummaryModel.ResourcesModified = core.Int64Ptr(int64(26)) + logSummaryModel.ScannedFiles = core.Int64Ptr(int64(26)) + logSummaryModel.TemplateVariableCount = core.Int64Ptr(int64(26)) + logSummaryModel.TimeTaken = core.Float64Ptr(float64(72.5)) + + // Construct an instance of the AgentWorkspaceStatusDoc model + agentWorkspaceStatusDocModel := new(schematicsv1.AgentWorkspaceStatusDoc) + agentWorkspaceStatusDocModel.WorkspaceID = core.StringPtr("testString") + agentWorkspaceStatusDocModel.WorkspaceStatus = core.StringPtr("testString") + agentWorkspaceStatusDocModel.UnlockWorkspace = core.BoolPtr(true) + agentWorkspaceStatusDocModel.JobStatus = core.StringPtr("testString") + agentWorkspaceStatusDocModel.JobLogSummary = logSummaryModel + + // Construct an instance of the UpdateJobStatusOptions model + updateJobStatusOptionsModel := new(schematicsv1.UpdateJobStatusOptions) + updateJobStatusOptionsModel.JobID = core.StringPtr("testString") + updateJobStatusOptionsModel.AgentSubID = core.StringPtr("testString") + updateJobStatusOptionsModel.DocType = core.StringPtr("workspace") + updateJobStatusOptionsModel.WorkspaceStatus = agentWorkspaceStatusDocModel + updateJobStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = schematicsService.UpdateJobStatus(updateJobStatusOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke UpdateJobStatus with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the LogSummary model + logSummaryModel := new(schematicsv1.LogSummary) + logSummaryModel.ActivityStatus = core.StringPtr("testString") + logSummaryModel.DetectedTemplateType = core.StringPtr("testString") + logSummaryModel.DiscardedFiles = core.Int64Ptr(int64(26)) + logSummaryModel.Error = core.StringPtr("testString") + logSummaryModel.ResourcesAdded = core.Int64Ptr(int64(26)) + logSummaryModel.ResourcesDestroyed = core.Int64Ptr(int64(26)) + logSummaryModel.ResourcesModified = core.Int64Ptr(int64(26)) + logSummaryModel.ScannedFiles = core.Int64Ptr(int64(26)) + logSummaryModel.TemplateVariableCount = core.Int64Ptr(int64(26)) + logSummaryModel.TimeTaken = core.Float64Ptr(float64(72.5)) + + // Construct an instance of the AgentWorkspaceStatusDoc model + agentWorkspaceStatusDocModel := new(schematicsv1.AgentWorkspaceStatusDoc) + agentWorkspaceStatusDocModel.WorkspaceID = core.StringPtr("testString") + agentWorkspaceStatusDocModel.WorkspaceStatus = core.StringPtr("testString") + agentWorkspaceStatusDocModel.UnlockWorkspace = core.BoolPtr(true) + agentWorkspaceStatusDocModel.JobStatus = core.StringPtr("testString") + agentWorkspaceStatusDocModel.JobLogSummary = logSummaryModel + + // Construct an instance of the UpdateJobStatusOptions model + updateJobStatusOptionsModel := new(schematicsv1.UpdateJobStatusOptions) + updateJobStatusOptionsModel.JobID = core.StringPtr("testString") + updateJobStatusOptionsModel.AgentSubID = core.StringPtr("testString") + updateJobStatusOptionsModel.DocType = core.StringPtr("workspace") + updateJobStatusOptionsModel.WorkspaceStatus = agentWorkspaceStatusDocModel + updateJobStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := schematicsService.UpdateJobStatus(updateJobStatusOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the UpdateJobStatusOptions model with no property values + updateJobStatusOptionsModelNew := new(schematicsv1.UpdateJobStatusOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = schematicsService.UpdateJobStatus(updateJobStatusOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVariablesMetadata(updateVariablesMetadataOptions *UpdateVariablesMetadataOptions)`, func() { + updateVariablesMetadataPath := "/v2/agent_jobs/testString/workspaces/testString/variables" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateVariablesMetadataPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateVariablesMetadata successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.UpdateVariablesMetadata(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the AgentWorkspaceVariablesDoc model + agentWorkspaceVariablesDocModel := new(schematicsv1.AgentWorkspaceVariablesDoc) + agentWorkspaceVariablesDocModel.WorkspaceID = core.StringPtr("testString") + agentWorkspaceVariablesDocModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + agentWorkspaceVariablesDocModel.Settings = []schematicsv1.VariableData{*variableDataModel} + + // Construct an instance of the UpdateVariablesMetadataOptions model + updateVariablesMetadataOptionsModel := new(schematicsv1.UpdateVariablesMetadataOptions) + updateVariablesMetadataOptionsModel.JobID = core.StringPtr("testString") + updateVariablesMetadataOptionsModel.WID = core.StringPtr("testString") + updateVariablesMetadataOptionsModel.DocType = core.StringPtr("workspace") + updateVariablesMetadataOptionsModel.WorkspaceVariables = agentWorkspaceVariablesDocModel + updateVariablesMetadataOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = schematicsService.UpdateVariablesMetadata(updateVariablesMetadataOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke UpdateVariablesMetadata with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") - // Verify a nil result - Expect(result).To(BeNil()) + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + + // Construct an instance of the AgentWorkspaceVariablesDoc model + agentWorkspaceVariablesDocModel := new(schematicsv1.AgentWorkspaceVariablesDoc) + agentWorkspaceVariablesDocModel.WorkspaceID = core.StringPtr("testString") + agentWorkspaceVariablesDocModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + agentWorkspaceVariablesDocModel.Settings = []schematicsv1.VariableData{*variableDataModel} + + // Construct an instance of the UpdateVariablesMetadataOptions model + updateVariablesMetadataOptionsModel := new(schematicsv1.UpdateVariablesMetadataOptions) + updateVariablesMetadataOptionsModel.JobID = core.StringPtr("testString") + updateVariablesMetadataOptionsModel.WID = core.StringPtr("testString") + updateVariablesMetadataOptionsModel.DocType = core.StringPtr("workspace") + updateVariablesMetadataOptionsModel.WorkspaceVariables = agentWorkspaceVariablesDocModel + updateVariablesMetadataOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := schematicsService.UpdateVariablesMetadata(updateVariablesMetadataOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the UpdateVariablesMetadataOptions model with no property values + updateVariablesMetadataOptionsModelNew := new(schematicsv1.UpdateVariablesMetadataOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = schematicsService.UpdateVariablesMetadata(updateVariablesMetadataOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ExecuteResourceQuery(executeResourceQueryOptions *ExecuteResourceQueryOptions) - Operation response error`, func() { - executeResourceQueryPath := "/v2/resources_query/testString" + Describe(`ListPolicy(listPolicyOptions *ListPolicyOptions) - Operation response error`, func() { + listPolicyPath := "/v2/settings/policies" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(executeResourceQueryPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ExecuteResourceQuery with error: Operation response processing error`, func() { + It(`Invoke ListPolicy with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18519,19 +24188,21 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ExecuteResourceQueryOptions model - executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) - executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") - executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPolicyOptions model + listPolicyOptionsModel := new(schematicsv1.ListPolicyOptions) + listPolicyOptionsModel.Offset = core.Int64Ptr(int64(0)) + listPolicyOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPolicyOptionsModel.Profile = core.StringPtr("summary") + listPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + result, response, operationErr := schematicsService.ListPolicy(listPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + result, response, operationErr = schematicsService.ListPolicy(listPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -18541,27 +24212,30 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ExecuteResourceQuery(executeResourceQueryOptions *ExecuteResourceQueryOptions)`, func() { - executeResourceQueryPath := "/v2/resources_query/testString" + Describe(`ListPolicy(listPolicyOptions *ListPolicyOptions)`, func() { + listPolicyPath := "/v2/settings/policies" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(executeResourceQueryPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"], "query_output": [{"name": "Name", "value": "Value"}]}]}`) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "policies": [{"name": "Agent1-DevWS", "id": "ID", "crn": "Crn", "account": "Account", "description": "Policy for job execution of secured workspaces on agent1", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "policy_kind": "agent_assignment_policy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z"}]}`) })) }) - It(`Invoke ExecuteResourceQuery successfully with retries`, func() { + It(`Invoke ListPolicy successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18570,21 +24244,23 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the ExecuteResourceQueryOptions model - executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) - executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") - executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPolicyOptions model + listPolicyOptionsModel := new(schematicsv1.ListPolicyOptions) + listPolicyOptionsModel.Offset = core.Int64Ptr(int64(0)) + listPolicyOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPolicyOptionsModel.Profile = core.StringPtr("summary") + listPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.ExecuteResourceQueryWithContext(ctx, executeResourceQueryOptionsModel) + _, _, operationErr := schematicsService.ListPolicyWithContext(ctx, listPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + result, response, operationErr := schematicsService.ListPolicy(listPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -18592,7 +24268,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.ExecuteResourceQueryWithContext(ctx, executeResourceQueryOptionsModel) + _, _, operationErr = schematicsService.ListPolicyWithContext(ctx, listPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -18606,16 +24282,19 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(executeResourceQueryPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": [{"query_type": "workspaces", "query_condition": [{"name": "Name", "value": "Value", "description": "Description"}], "query_select": ["QuerySelect"], "query_output": [{"name": "Name", "value": "Value"}]}]}`) + fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "policies": [{"name": "Agent1-DevWS", "id": "ID", "crn": "Crn", "account": "Account", "description": "Policy for job execution of secured workspaces on agent1", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "policy_kind": "agent_assignment_policy", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z"}]}`) })) }) - It(`Invoke ExecuteResourceQuery successfully`, func() { + It(`Invoke ListPolicy successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18624,24 +24303,26 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.ExecuteResourceQuery(nil) + result, response, operationErr := schematicsService.ListPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ExecuteResourceQueryOptions model - executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) - executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") - executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPolicyOptions model + listPolicyOptionsModel := new(schematicsv1.ListPolicyOptions) + listPolicyOptionsModel.Offset = core.Int64Ptr(int64(0)) + listPolicyOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPolicyOptionsModel.Profile = core.StringPtr("summary") + listPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + result, response, operationErr = schematicsService.ListPolicy(listPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ExecuteResourceQuery with error: Operation validation and request error`, func() { + It(`Invoke ListPolicy with error: Operation request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18649,25 +24330,20 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ExecuteResourceQueryOptions model - executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) - executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") - executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPolicyOptions model + listPolicyOptionsModel := new(schematicsv1.ListPolicyOptions) + listPolicyOptionsModel.Offset = core.Int64Ptr(int64(0)) + listPolicyOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPolicyOptionsModel.Profile = core.StringPtr("summary") + listPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + result, response, operationErr := schematicsService.ListPolicy(listPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ExecuteResourceQueryOptions model with no property values - executeResourceQueryOptionsModelNew := new(schematicsv1.ExecuteResourceQueryOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -18682,7 +24358,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ExecuteResourceQuery successfully`, func() { + It(`Invoke ListPolicy successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18690,13 +24366,15 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ExecuteResourceQueryOptions model - executeResourceQueryOptionsModel := new(schematicsv1.ExecuteResourceQueryOptions) - executeResourceQueryOptionsModel.QueryID = core.StringPtr("testString") - executeResourceQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPolicyOptions model + listPolicyOptionsModel := new(schematicsv1.ListPolicyOptions) + listPolicyOptionsModel.Offset = core.Int64Ptr(int64(0)) + listPolicyOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPolicyOptionsModel.Profile = core.StringPtr("summary") + listPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.ExecuteResourceQuery(executeResourceQueryOptionsModel) + result, response, operationErr := schematicsService.ListPolicy(listPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -18708,99 +24386,22 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`DeleteResourcesQuery(deleteResourcesQueryOptions *DeleteResourcesQueryOptions)`, func() { - deleteResourcesQueryPath := "/v2/resources_query/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteResourcesQueryPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Force"]).ToNot(BeNil()) - Expect(req.Header["Force"][0]).To(Equal(fmt.Sprintf("%v", true))) - Expect(req.Header["Propagate"]).ToNot(BeNil()) - Expect(req.Header["Propagate"][0]).To(Equal(fmt.Sprintf("%v", true))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteResourcesQuery successfully`, func() { - schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(schematicsService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := schematicsService.DeleteResourcesQuery(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteResourcesQueryOptions model - deleteResourcesQueryOptionsModel := new(schematicsv1.DeleteResourcesQueryOptions) - deleteResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - deleteResourcesQueryOptionsModel.Force = core.BoolPtr(true) - deleteResourcesQueryOptionsModel.Propagate = core.BoolPtr(true) - deleteResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = schematicsService.DeleteResourcesQuery(deleteResourcesQueryOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteResourcesQuery with error: Operation validation and request error`, func() { - schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(schematicsService).ToNot(BeNil()) - - // Construct an instance of the DeleteResourcesQueryOptions model - deleteResourcesQueryOptionsModel := new(schematicsv1.DeleteResourcesQueryOptions) - deleteResourcesQueryOptionsModel.QueryID = core.StringPtr("testString") - deleteResourcesQueryOptionsModel.Force = core.BoolPtr(true) - deleteResourcesQueryOptionsModel.Propagate = core.BoolPtr(true) - deleteResourcesQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := schematicsService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := schematicsService.DeleteResourcesQuery(deleteResourcesQueryOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteResourcesQueryOptions model with no property values - deleteResourcesQueryOptionsModelNew := new(schematicsv1.DeleteResourcesQueryOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = schematicsService.DeleteResourcesQuery(deleteResourcesQueryOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetKmsSettings(getKmsSettingsOptions *GetKmsSettingsOptions) - Operation response error`, func() { - getKmsSettingsPath := "/v2/settings/kms" + Describe(`CreatePolicy(createPolicyOptions *CreatePolicyOptions) - Operation response error`, func() { + createPolicyPath := "/v2/settings/policies" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getKmsSettingsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) + Expect(req.URL.EscapedPath()).To(Equal(createPolicyPath)) + Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetKmsSettings with error: Operation response processing error`, func() { + It(`Invoke CreatePolicy with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18808,19 +24409,56 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetKmsSettingsOptions model - getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) - getKmsSettingsOptionsModel.Location = core.StringPtr("testString") - getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the CreatePolicyOptions model + createPolicyOptionsModel := new(schematicsv1.CreatePolicyOptions) + createPolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + createPolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + createPolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + createPolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + createPolicyOptionsModel.Tags = []string{"policy:secured-job"} + createPolicyOptionsModel.Location = core.StringPtr("us-south") + createPolicyOptionsModel.State = userStateModel + createPolicyOptionsModel.PolicyTarget = policyObjectsModel + createPolicyOptionsModel.PolicyParameter = policyParameterModel + createPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + result, response, operationErr := schematicsService.CreatePolicy(createPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + result, response, operationErr = schematicsService.CreatePolicy(createPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -18830,28 +24468,43 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`GetKmsSettings(getKmsSettingsOptions *GetKmsSettingsOptions)`, func() { - getKmsSettingsPath := "/v2/settings/kms" + Describe(`CreatePolicy(createPolicyOptions *CreatePolicyOptions)`, func() { + createPolicyPath := "/v2/settings/policies" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getKmsSettingsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPolicyPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "primary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}, "secondary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"name": "Agent1-DevWS", "description": "Policy for job execution of secured workspaces on agent1", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "policy_kind": "agent_assignment_policy", "policy_target": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}, "policy_parameter": {"agent_assignment_policy_parameter": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}}, "id": "ID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke GetKmsSettings successfully with retries`, func() { + It(`Invoke CreatePolicy successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18860,21 +24513,58 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the GetKmsSettingsOptions model - getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) - getKmsSettingsOptionsModel.Location = core.StringPtr("testString") - getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the CreatePolicyOptions model + createPolicyOptionsModel := new(schematicsv1.CreatePolicyOptions) + createPolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + createPolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + createPolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + createPolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + createPolicyOptionsModel.Tags = []string{"policy:secured-job"} + createPolicyOptionsModel.Location = core.StringPtr("us-south") + createPolicyOptionsModel.State = userStateModel + createPolicyOptionsModel.PolicyTarget = policyObjectsModel + createPolicyOptionsModel.PolicyParameter = policyParameterModel + createPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.GetKmsSettingsWithContext(ctx, getKmsSettingsOptionsModel) + _, _, operationErr := schematicsService.CreatePolicyWithContext(ctx, createPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + result, response, operationErr := schematicsService.CreatePolicy(createPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -18882,7 +24572,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.GetKmsSettingsWithContext(ctx, getKmsSettingsOptionsModel) + _, _, operationErr = schematicsService.CreatePolicyWithContext(ctx, createPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -18896,17 +24586,32 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getKmsSettingsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPolicyPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "primary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}, "secondary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"name": "Agent1-DevWS", "description": "Policy for job execution of secured workspaces on agent1", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "policy_kind": "agent_assignment_policy", "policy_target": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}, "policy_parameter": {"agent_assignment_policy_parameter": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}}, "id": "ID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke GetKmsSettings successfully`, func() { + It(`Invoke CreatePolicy successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18915,24 +24620,61 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.GetKmsSettings(nil) + result, response, operationErr := schematicsService.CreatePolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetKmsSettingsOptions model - getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) - getKmsSettingsOptionsModel.Location = core.StringPtr("testString") - getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the CreatePolicyOptions model + createPolicyOptionsModel := new(schematicsv1.CreatePolicyOptions) + createPolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + createPolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + createPolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + createPolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + createPolicyOptionsModel.Tags = []string{"policy:secured-job"} + createPolicyOptionsModel.Location = core.StringPtr("us-south") + createPolicyOptionsModel.State = userStateModel + createPolicyOptionsModel.PolicyTarget = policyObjectsModel + createPolicyOptionsModel.PolicyParameter = policyParameterModel + createPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + result, response, operationErr = schematicsService.CreatePolicy(createPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetKmsSettings with error: Operation validation and request error`, func() { + It(`Invoke CreatePolicy with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18940,22 +24682,59 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetKmsSettingsOptions model - getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) - getKmsSettingsOptionsModel.Location = core.StringPtr("testString") - getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the CreatePolicyOptions model + createPolicyOptionsModel := new(schematicsv1.CreatePolicyOptions) + createPolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + createPolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + createPolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + createPolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + createPolicyOptionsModel.Tags = []string{"policy:secured-job"} + createPolicyOptionsModel.Location = core.StringPtr("us-south") + createPolicyOptionsModel.State = userStateModel + createPolicyOptionsModel.PolicyTarget = policyObjectsModel + createPolicyOptionsModel.PolicyParameter = policyParameterModel + createPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + result, response, operationErr := schematicsService.CreatePolicy(createPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetKmsSettingsOptions model with no property values - getKmsSettingsOptionsModelNew := new(schematicsv1.GetKmsSettingsOptions) + // Construct a second instance of the CreatePolicyOptions model with no property values + createPolicyOptionsModelNew := new(schematicsv1.CreatePolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = schematicsService.GetKmsSettings(getKmsSettingsOptionsModelNew) + result, response, operationErr = schematicsService.CreatePolicy(createPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -18970,10 +24749,10 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetKmsSettings successfully`, func() { + It(`Invoke CreatePolicy successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -18981,13 +24760,50 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the GetKmsSettingsOptions model - getKmsSettingsOptionsModel := new(schematicsv1.GetKmsSettingsOptions) - getKmsSettingsOptionsModel.Location = core.StringPtr("testString") - getKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the CreatePolicyOptions model + createPolicyOptionsModel := new(schematicsv1.CreatePolicyOptions) + createPolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + createPolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + createPolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + createPolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + createPolicyOptionsModel.Tags = []string{"policy:secured-job"} + createPolicyOptionsModel.Location = core.StringPtr("us-south") + createPolicyOptionsModel.State = userStateModel + createPolicyOptionsModel.PolicyTarget = policyObjectsModel + createPolicyOptionsModel.PolicyParameter = policyParameterModel + createPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.GetKmsSettings(getKmsSettingsOptionsModel) + result, response, operationErr := schematicsService.CreatePolicy(createPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -18999,22 +24815,23 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`UpdateKmsSettings(updateKmsSettingsOptions *UpdateKmsSettingsOptions) - Operation response error`, func() { - updateKmsSettingsPath := "/v2/settings/kms" + Describe(`GetPolicy(getPolicyOptions *GetPolicyOptions) - Operation response error`, func() { + getPolicyPath := "/v2/settings/policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateKmsSettingsPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateKmsSettings with error: Operation response processing error`, func() { + It(`Invoke GetPolicy with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19022,35 +24839,20 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the KMSSettingsPrimaryCrk model - kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) - kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the KMSSettingsSecondaryCrk model - kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) - kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the UpdateKmsSettingsOptions model - updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) - updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") - updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") - updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") - updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel - updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel - updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPolicyOptions model + getPolicyOptionsModel := new(schematicsv1.GetPolicyOptions) + getPolicyOptionsModel.PolicyID = core.StringPtr("testString") + getPolicyOptionsModel.Profile = core.StringPtr("summary") + getPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + result, response, operationErr := schematicsService.GetPolicy(getPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + result, response, operationErr = schematicsService.GetPolicy(getPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -19060,43 +24862,28 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`UpdateKmsSettings(updateKmsSettingsOptions *UpdateKmsSettingsOptions)`, func() { - updateKmsSettingsPath := "/v2/settings/kms" + Describe(`GetPolicy(getPolicyOptions *GetPolicyOptions)`, func() { + getPolicyPath := "/v2/settings/policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateKmsSettingsPath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "primary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}, "secondary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}}`) + fmt.Fprintf(res, "%s", `{"name": "Agent1-DevWS", "description": "Policy for job execution of secured workspaces on agent1", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "policy_kind": "agent_assignment_policy", "policy_target": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}, "policy_parameter": {"agent_assignment_policy_parameter": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}}, "id": "ID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke UpdateKmsSettings successfully with retries`, func() { + It(`Invoke GetPolicy successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19105,37 +24892,22 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the KMSSettingsPrimaryCrk model - kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) - kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the KMSSettingsSecondaryCrk model - kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) - kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the UpdateKmsSettingsOptions model - updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) - updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") - updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") - updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") - updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel - updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel - updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPolicyOptions model + getPolicyOptionsModel := new(schematicsv1.GetPolicyOptions) + getPolicyOptionsModel.PolicyID = core.StringPtr("testString") + getPolicyOptionsModel.Profile = core.StringPtr("summary") + getPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.UpdateKmsSettingsWithContext(ctx, updateKmsSettingsOptionsModel) + _, _, operationErr := schematicsService.GetPolicyWithContext(ctx, getPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + result, response, operationErr := schematicsService.GetPolicy(getPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -19143,7 +24915,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.UpdateKmsSettingsWithContext(ctx, updateKmsSettingsOptionsModel) + _, _, operationErr = schematicsService.GetPolicyWithContext(ctx, getPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -19157,32 +24929,17 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateKmsSettingsPath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["profile"]).To(Equal([]string{"summary"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "primary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}, "secondary_crk": {"kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "key_crn": "KeyCrn"}}`) + fmt.Fprintf(res, "%s", `{"name": "Agent1-DevWS", "description": "Policy for job execution of secured workspaces on agent1", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "policy_kind": "agent_assignment_policy", "policy_target": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}, "policy_parameter": {"agent_assignment_policy_parameter": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}}, "id": "ID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke UpdateKmsSettings successfully`, func() { + It(`Invoke GetPolicy successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19191,40 +24948,25 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.UpdateKmsSettings(nil) + result, response, operationErr := schematicsService.GetPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the KMSSettingsPrimaryCrk model - kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) - kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the KMSSettingsSecondaryCrk model - kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) - kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the UpdateKmsSettingsOptions model - updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) - updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") - updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") - updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") - updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel - updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel - updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPolicyOptions model + getPolicyOptionsModel := new(schematicsv1.GetPolicyOptions) + getPolicyOptionsModel.PolicyID = core.StringPtr("testString") + getPolicyOptionsModel.Profile = core.StringPtr("summary") + getPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + result, response, operationErr = schematicsService.GetPolicy(getPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateKmsSettings with error: Operation request error`, func() { + It(`Invoke GetPolicy with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19232,34 +24974,26 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the KMSSettingsPrimaryCrk model - kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) - kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the KMSSettingsSecondaryCrk model - kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) - kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the UpdateKmsSettingsOptions model - updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) - updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") - updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") - updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") - updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel - updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel - updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPolicyOptions model + getPolicyOptionsModel := new(schematicsv1.GetPolicyOptions) + getPolicyOptionsModel.PolicyID = core.StringPtr("testString") + getPolicyOptionsModel.Profile = core.StringPtr("summary") + getPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + result, response, operationErr := schematicsService.GetPolicy(getPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the GetPolicyOptions model with no property values + getPolicyOptionsModelNew := new(schematicsv1.GetPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = schematicsService.GetPolicy(getPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -19274,7 +25008,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateKmsSettings successfully`, func() { + It(`Invoke GetPolicy successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19282,29 +25016,14 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the KMSSettingsPrimaryCrk model - kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) - kmsSettingsPrimaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsPrimaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the KMSSettingsSecondaryCrk model - kmsSettingsSecondaryCrkModel := new(schematicsv1.KMSSettingsSecondaryCrk) - kmsSettingsSecondaryCrkModel.KmsName = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KmsPrivateEndpoint = core.StringPtr("testString") - kmsSettingsSecondaryCrkModel.KeyCrn = core.StringPtr("testString") - - // Construct an instance of the UpdateKmsSettingsOptions model - updateKmsSettingsOptionsModel := new(schematicsv1.UpdateKmsSettingsOptions) - updateKmsSettingsOptionsModel.Location = core.StringPtr("testString") - updateKmsSettingsOptionsModel.EncryptionScheme = core.StringPtr("testString") - updateKmsSettingsOptionsModel.ResourceGroup = core.StringPtr("testString") - updateKmsSettingsOptionsModel.PrimaryCrk = kmsSettingsPrimaryCrkModel - updateKmsSettingsOptionsModel.SecondaryCrk = kmsSettingsSecondaryCrkModel - updateKmsSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPolicyOptions model + getPolicyOptionsModel := new(schematicsv1.GetPolicyOptions) + getPolicyOptionsModel.PolicyID = core.StringPtr("testString") + getPolicyOptionsModel.Profile = core.StringPtr("summary") + getPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.UpdateKmsSettings(updateKmsSettingsOptionsModel) + result, response, operationErr := schematicsService.GetPolicy(getPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -19316,27 +25035,90 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ListKms(listKmsOptions *ListKmsOptions) - Operation response error`, func() { - listKmsPath := "/v2/settings/kms_instances" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeletePolicy(deletePolicyOptions *DeletePolicyOptions)`, func() { + deletePolicyPath := "/v2/settings/policies/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listKmsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["encryption_scheme"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + Expect(req.URL.EscapedPath()).To(Equal(deletePolicyPath)) + Expect(req.Method).To(Equal("DELETE")) + + res.WriteHeader(204) + })) + }) + It(`Invoke DeletePolicy successfully`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := schematicsService.DeletePolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeletePolicyOptions model + deletePolicyOptionsModel := new(schematicsv1.DeletePolicyOptions) + deletePolicyOptionsModel.PolicyID = core.StringPtr("testString") + deletePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = schematicsService.DeletePolicy(deletePolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeletePolicy with error: Operation validation and request error`, func() { + schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(schematicsService).ToNot(BeNil()) + + // Construct an instance of the DeletePolicyOptions model + deletePolicyOptionsModel := new(schematicsv1.DeletePolicyOptions) + deletePolicyOptionsModel.PolicyID = core.StringPtr("testString") + deletePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := schematicsService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := schematicsService.DeletePolicy(deletePolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeletePolicyOptions model with no property values + deletePolicyOptionsModelNew := new(schematicsv1.DeletePolicyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = schematicsService.DeletePolicy(deletePolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdatePolicy(updatePolicyOptions *UpdatePolicyOptions) - Operation response error`, func() { + updatePolicyPath := "/v2/settings/policies/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updatePolicyPath)) + Expect(req.Method).To(Equal("PATCH")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListKms with error: Operation response processing error`, func() { + It(`Invoke UpdatePolicy with error: Operation response processing error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19344,23 +25126,57 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListKmsOptions model - listKmsOptionsModel := new(schematicsv1.ListKmsOptions) - listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") - listKmsOptionsModel.Location = core.StringPtr("testString") - listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") - listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) - listKmsOptionsModel.Sort = core.StringPtr("testString") - listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the UpdatePolicyOptions model + updatePolicyOptionsModel := new(schematicsv1.UpdatePolicyOptions) + updatePolicyOptionsModel.PolicyID = core.StringPtr("testString") + updatePolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + updatePolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + updatePolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + updatePolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + updatePolicyOptionsModel.Tags = []string{"policy:secured-job"} + updatePolicyOptionsModel.Location = core.StringPtr("us-south") + updatePolicyOptionsModel.State = userStateModel + updatePolicyOptionsModel.PolicyTarget = policyObjectsModel + updatePolicyOptionsModel.PolicyParameter = policyParameterModel + updatePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := schematicsService.ListKms(listKmsOptionsModel) + result, response, operationErr := schematicsService.UpdatePolicy(updatePolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again schematicsService.EnableRetries(0, 0) - result, response, operationErr = schematicsService.ListKms(listKmsOptionsModel) + result, response, operationErr = schematicsService.UpdatePolicy(updatePolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -19370,32 +25186,43 @@ var _ = Describe(`SchematicsV1`, func() { }) }) }) - Describe(`ListKms(listKmsOptions *ListKmsOptions)`, func() { - listKmsPath := "/v2/settings/kms_instances" + Describe(`UpdatePolicy(updatePolicyOptions *UpdatePolicyOptions)`, func() { + updatePolicyPath := "/v2/settings/policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listKmsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updatePolicyPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["encryption_scheme"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "kms_instances": [{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "kms_crn": "KmsCrn", "kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "kms_public_endpoint": "KmsPublicEndpoint", "keys": [{"name": "Name", "crn": "Crn", "error": "Error"}]}]}`) + fmt.Fprintf(res, "%s", `{"name": "Agent1-DevWS", "description": "Policy for job execution of secured workspaces on agent1", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "policy_kind": "agent_assignment_policy", "policy_target": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}, "policy_parameter": {"agent_assignment_policy_parameter": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}}, "id": "ID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke ListKms successfully with retries`, func() { + It(`Invoke UpdatePolicy successfully with retries`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19404,25 +25231,59 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) - // Construct an instance of the ListKmsOptions model - listKmsOptionsModel := new(schematicsv1.ListKmsOptions) - listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") - listKmsOptionsModel.Location = core.StringPtr("testString") - listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") - listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) - listKmsOptionsModel.Sort = core.StringPtr("testString") - listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the UpdatePolicyOptions model + updatePolicyOptionsModel := new(schematicsv1.UpdatePolicyOptions) + updatePolicyOptionsModel.PolicyID = core.StringPtr("testString") + updatePolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + updatePolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + updatePolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + updatePolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + updatePolicyOptionsModel.Tags = []string{"policy:secured-job"} + updatePolicyOptionsModel.Location = core.StringPtr("us-south") + updatePolicyOptionsModel.State = userStateModel + updatePolicyOptionsModel.PolicyTarget = policyObjectsModel + updatePolicyOptionsModel.PolicyParameter = policyParameterModel + updatePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := schematicsService.ListKmsWithContext(ctx, listKmsOptionsModel) + _, _, operationErr := schematicsService.UpdatePolicyWithContext(ctx, updatePolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again schematicsService.DisableRetries() - result, response, operationErr := schematicsService.ListKms(listKmsOptionsModel) + result, response, operationErr := schematicsService.UpdatePolicy(updatePolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -19430,7 +25291,7 @@ var _ = Describe(`SchematicsV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = schematicsService.ListKmsWithContext(ctx, listKmsOptionsModel) + _, _, operationErr = schematicsService.UpdatePolicyWithContext(ctx, updatePolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -19444,21 +25305,32 @@ var _ = Describe(`SchematicsV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listKmsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updatePolicyPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["encryption_scheme"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["location"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"total_count": 10, "limit": 5, "offset": 6, "kms_instances": [{"location": "Location", "encryption_scheme": "EncryptionScheme", "resource_group": "ResourceGroup", "kms_crn": "KmsCrn", "kms_name": "KmsName", "kms_private_endpoint": "KmsPrivateEndpoint", "kms_public_endpoint": "KmsPublicEndpoint", "keys": [{"name": "Name", "crn": "Crn", "error": "Error"}]}]}`) + fmt.Fprintf(res, "%s", `{"name": "Agent1-DevWS", "description": "Policy for job execution of secured workspaces on agent1", "resource_group": "Default", "tags": ["Tags"], "location": "us-south", "state": {"state": "draft", "set_by": "SetBy", "set_at": "2019-01-01T12:00:00.000Z"}, "policy_kind": "agent_assignment_policy", "policy_target": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}, "policy_parameter": {"agent_assignment_policy_parameter": {"selector_kind": "ids", "selector_ids": ["SelectorIds"], "selector_scope": [{"kind": "agent", "tags": ["Tags"], "resource_groups": ["ResourceGroups"], "locations": ["us-south"]}]}}, "id": "ID", "crn": "Crn", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke ListKms successfully`, func() { + It(`Invoke UpdatePolicy successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19467,28 +25339,62 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := schematicsService.ListKms(nil) + result, response, operationErr := schematicsService.UpdatePolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListKmsOptions model - listKmsOptionsModel := new(schematicsv1.ListKmsOptions) - listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") - listKmsOptionsModel.Location = core.StringPtr("testString") - listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") - listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) - listKmsOptionsModel.Sort = core.StringPtr("testString") - listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the UpdatePolicyOptions model + updatePolicyOptionsModel := new(schematicsv1.UpdatePolicyOptions) + updatePolicyOptionsModel.PolicyID = core.StringPtr("testString") + updatePolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + updatePolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + updatePolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + updatePolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + updatePolicyOptionsModel.Tags = []string{"policy:secured-job"} + updatePolicyOptionsModel.Location = core.StringPtr("us-south") + updatePolicyOptionsModel.State = userStateModel + updatePolicyOptionsModel.PolicyTarget = policyObjectsModel + updatePolicyOptionsModel.PolicyParameter = policyParameterModel + updatePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = schematicsService.ListKms(listKmsOptionsModel) + result, response, operationErr = schematicsService.UpdatePolicy(updatePolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListKms with error: Operation validation and request error`, func() { + It(`Invoke UpdatePolicy with error: Operation validation and request error`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19496,26 +25402,60 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListKmsOptions model - listKmsOptionsModel := new(schematicsv1.ListKmsOptions) - listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") - listKmsOptionsModel.Location = core.StringPtr("testString") - listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") - listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) - listKmsOptionsModel.Sort = core.StringPtr("testString") - listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the UpdatePolicyOptions model + updatePolicyOptionsModel := new(schematicsv1.UpdatePolicyOptions) + updatePolicyOptionsModel.PolicyID = core.StringPtr("testString") + updatePolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + updatePolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + updatePolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + updatePolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + updatePolicyOptionsModel.Tags = []string{"policy:secured-job"} + updatePolicyOptionsModel.Location = core.StringPtr("us-south") + updatePolicyOptionsModel.State = userStateModel + updatePolicyOptionsModel.PolicyTarget = policyObjectsModel + updatePolicyOptionsModel.PolicyParameter = policyParameterModel + updatePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := schematicsService.ListKms(listKmsOptionsModel) + result, response, operationErr := schematicsService.UpdatePolicy(updatePolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListKmsOptions model with no property values - listKmsOptionsModelNew := new(schematicsv1.ListKmsOptions) + // Construct a second instance of the UpdatePolicyOptions model with no property values + updatePolicyOptionsModelNew := new(schematicsv1.UpdatePolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = schematicsService.ListKms(listKmsOptionsModelNew) + result, response, operationErr = schematicsService.UpdatePolicy(updatePolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -19533,7 +25473,7 @@ var _ = Describe(`SchematicsV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListKms successfully`, func() { + It(`Invoke UpdatePolicy successfully`, func() { schematicsService, serviceErr := schematicsv1.NewSchematicsV1(&schematicsv1.SchematicsV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -19541,17 +25481,51 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) - // Construct an instance of the ListKmsOptions model - listKmsOptionsModel := new(schematicsv1.ListKmsOptions) - listKmsOptionsModel.EncryptionScheme = core.StringPtr("testString") - listKmsOptionsModel.Location = core.StringPtr("testString") - listKmsOptionsModel.ResourceGroup = core.StringPtr("testString") - listKmsOptionsModel.Limit = core.Int64Ptr(int64(1)) - listKmsOptionsModel.Sort = core.StringPtr("testString") - listKmsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + + // Construct an instance of the UpdatePolicyOptions model + updatePolicyOptionsModel := new(schematicsv1.UpdatePolicyOptions) + updatePolicyOptionsModel.PolicyID = core.StringPtr("testString") + updatePolicyOptionsModel.PolicyKind = core.StringPtr("agent_assignment_policy") + updatePolicyOptionsModel.Name = core.StringPtr("Agent1-DevWS") + updatePolicyOptionsModel.Description = core.StringPtr("Policy for job execution of secured workspaces on agent1") + updatePolicyOptionsModel.ResourceGroup = core.StringPtr("Default") + updatePolicyOptionsModel.Tags = []string{"policy:secured-job"} + updatePolicyOptionsModel.Location = core.StringPtr("us-south") + updatePolicyOptionsModel.State = userStateModel + updatePolicyOptionsModel.PolicyTarget = policyObjectsModel + updatePolicyOptionsModel.PolicyParameter = policyParameterModel + updatePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := schematicsService.ListKms(listKmsOptionsModel) + result, response, operationErr := schematicsService.UpdatePolicy(updatePolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -20726,13 +26700,45 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + // Construct an instance of the CreateDatasourceOptions model createDatasourceOptionsModel := new(schematicsv1.CreateDatasourceOptions) createDatasourceOptionsModel.Name = core.StringPtr("testString") createDatasourceOptionsModel.Description = core.StringPtr("testString") createDatasourceOptionsModel.ResourceGroup = core.StringPtr("testString") createDatasourceOptionsModel.Tags = []string{"testString"} + createDatasourceOptionsModel.Type = core.StringPtr("internal") createDatasourceOptionsModel.Connection = core.StringPtr("testString") + createDatasourceOptionsModel.DatasourceProperties = []schematicsv1.VariableData{*variableDataModel} + createDatasourceOptionsModel.Location = core.StringPtr("us-south") createDatasourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := schematicsService.CreateDatasource(createDatasourceOptionsModel) @@ -20785,7 +26791,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Name", "description": "Description", "resource_group": "ResourceGroup", "tags": ["Tags"], "connection": "Connection", "id": "ID", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy"}`) + fmt.Fprintf(res, "%s", `{"name": "Name", "description": "Description", "resource_group": "ResourceGroup", "tags": ["Tags"], "type": "internal", "connection": "Connection", "datasource_properties": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "location": "us-south", "id": "ID", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy"}`) })) }) It(`Invoke CreateDatasource successfully with retries`, func() { @@ -20797,13 +26803,45 @@ var _ = Describe(`SchematicsV1`, func() { Expect(schematicsService).ToNot(BeNil()) schematicsService.EnableRetries(0, 0) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + // Construct an instance of the CreateDatasourceOptions model createDatasourceOptionsModel := new(schematicsv1.CreateDatasourceOptions) createDatasourceOptionsModel.Name = core.StringPtr("testString") createDatasourceOptionsModel.Description = core.StringPtr("testString") createDatasourceOptionsModel.ResourceGroup = core.StringPtr("testString") createDatasourceOptionsModel.Tags = []string{"testString"} + createDatasourceOptionsModel.Type = core.StringPtr("internal") createDatasourceOptionsModel.Connection = core.StringPtr("testString") + createDatasourceOptionsModel.DatasourceProperties = []schematicsv1.VariableData{*variableDataModel} + createDatasourceOptionsModel.Location = core.StringPtr("us-south") createDatasourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -20859,7 +26897,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"name": "Name", "description": "Description", "resource_group": "ResourceGroup", "tags": ["Tags"], "connection": "Connection", "id": "ID", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy"}`) + fmt.Fprintf(res, "%s", `{"name": "Name", "description": "Description", "resource_group": "ResourceGroup", "tags": ["Tags"], "type": "internal", "connection": "Connection", "datasource_properties": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "location": "us-south", "id": "ID", "account": "Account", "created_at": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "updated_at": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy"}`) })) }) It(`Invoke CreateDatasource successfully`, func() { @@ -20876,13 +26914,45 @@ var _ = Describe(`SchematicsV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + // Construct an instance of the CreateDatasourceOptions model createDatasourceOptionsModel := new(schematicsv1.CreateDatasourceOptions) createDatasourceOptionsModel.Name = core.StringPtr("testString") createDatasourceOptionsModel.Description = core.StringPtr("testString") createDatasourceOptionsModel.ResourceGroup = core.StringPtr("testString") createDatasourceOptionsModel.Tags = []string{"testString"} + createDatasourceOptionsModel.Type = core.StringPtr("internal") createDatasourceOptionsModel.Connection = core.StringPtr("testString") + createDatasourceOptionsModel.DatasourceProperties = []schematicsv1.VariableData{*variableDataModel} + createDatasourceOptionsModel.Location = core.StringPtr("us-south") createDatasourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -20900,13 +26970,45 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + // Construct an instance of the CreateDatasourceOptions model createDatasourceOptionsModel := new(schematicsv1.CreateDatasourceOptions) createDatasourceOptionsModel.Name = core.StringPtr("testString") createDatasourceOptionsModel.Description = core.StringPtr("testString") createDatasourceOptionsModel.ResourceGroup = core.StringPtr("testString") createDatasourceOptionsModel.Tags = []string{"testString"} + createDatasourceOptionsModel.Type = core.StringPtr("internal") createDatasourceOptionsModel.Connection = core.StringPtr("testString") + createDatasourceOptionsModel.DatasourceProperties = []schematicsv1.VariableData{*variableDataModel} + createDatasourceOptionsModel.Location = core.StringPtr("us-south") createDatasourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := schematicsService.SetServiceURL("") @@ -20938,13 +27040,45 @@ var _ = Describe(`SchematicsV1`, func() { Expect(serviceErr).To(BeNil()) Expect(schematicsService).ToNot(BeNil()) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + // Construct an instance of the CreateDatasourceOptions model createDatasourceOptionsModel := new(schematicsv1.CreateDatasourceOptions) createDatasourceOptionsModel.Name = core.StringPtr("testString") createDatasourceOptionsModel.Description = core.StringPtr("testString") createDatasourceOptionsModel.ResourceGroup = core.StringPtr("testString") createDatasourceOptionsModel.Tags = []string{"testString"} + createDatasourceOptionsModel.Type = core.StringPtr("internal") createDatasourceOptionsModel.Connection = core.StringPtr("testString") + createDatasourceOptionsModel.DatasourceProperties = []schematicsv1.VariableData{*variableDataModel} + createDatasourceOptionsModel.Location = core.StringPtr("us-south") createDatasourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -21025,7 +27159,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"type": "all", "connection": "Connection", "data": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "version": "Version", "message": "Message", "viewed_at": "2019-01-01T12:00:00.000Z", "viewed_by": "ViewedBy"}`) + fmt.Fprintf(res, "%s", `{"type": "all", "connection": "Connection", "data": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "version": "Version", "message": "Message", "viewed_at": "2019-01-01T12:00:00.000Z", "viewed_by": "ViewedBy"}`) })) }) It(`Invoke GetData successfully with retries`, func() { @@ -21081,7 +27215,7 @@ var _ = Describe(`SchematicsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"type": "all", "connection": "Connection", "data": {"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}, "version": "Version", "message": "Message", "viewed_at": "2019-01-01T12:00:00.000Z", "viewed_by": "ViewedBy"}`) + fmt.Fprintf(res, "%s", `{"type": "all", "connection": "Connection", "data": [{"name": "Name", "value": "Value", "use_default": true, "metadata": {"type": "boolean", "aliases": ["Aliases"], "description": "Description", "cloud_data_type": "CloudDataType", "default_value": "DefaultValue", "link_status": "normal", "secure": true, "immutable": false, "hidden": true, "required": true, "options": ["Options"], "min_value": 8, "max_value": 8, "min_length": 9, "max_length": 9, "matches": "Matches", "position": 8, "group_by": "GroupBy", "source": "Source"}, "link": "Link"}], "version": "Version", "message": "Message", "viewed_at": "2019-01-01T12:00:00.000Z", "viewed_by": "ViewedBy"}`) })) }) It(`Invoke GetData successfully`, func() { @@ -21186,6 +27320,23 @@ var _ = Describe(`SchematicsV1`, func() { URL: "http://schematicsv1modelgenerator.com", Authenticator: &core.NoAuthAuthenticator{}, }) + It(`Invoke NewAgent successfully`, func() { + name := "MyDevAgent" + agentLocation := "us-south" + location := "us-south" + profileID := "testString" + _model, err := schematicsService.NewAgent(name, agentLocation, location, profileID) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewAgentJob successfully`, func() { + agentID := "testString" + jobCount := int64(1) + jobType := "workspace_job" + _model, err := schematicsService.NewAgentJob(agentID, jobCount, jobType) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewApplyWorkspaceCommandOptions successfully`, func() { // Construct an instance of the WorkspaceActivityOptionsTemplate model workspaceActivityOptionsTemplateModel := new(schematicsv1.WorkspaceActivityOptionsTemplate) @@ -21211,6 +27362,12 @@ var _ = Describe(`SchematicsV1`, func() { Expect(applyWorkspaceCommandOptionsModel.DelegatedToken).To(Equal(core.StringPtr("testString"))) Expect(applyWorkspaceCommandOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewBlueprint successfully`, func() { + name := "Toronto Dev Environtment" + _model, err := schematicsService.NewBlueprint(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewCreateActionOptions successfully`, func() { // Construct an instance of the UserState model userStateModel := new(schematicsv1.UserState) @@ -21222,49 +27379,101 @@ var _ = Describe(`SchematicsV1`, func() { Expect(userStateModel.SetBy).To(Equal(core.StringPtr("testString"))) Expect(userStateModel.SetAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - Expect(externalSourceGitModel).ToNot(BeNil()) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - Expect(externalSourceGitModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitToken).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRelease).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitBranch).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - Expect(externalSourceCatalogModel).ToNot(BeNil()) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") - Expect(externalSourceCatalogModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingKind).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + Expect(gitSourceModel).ToNot(BeNil()) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + Expect(gitSourceModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitToken).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRelease).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitBranch).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + Expect(catalogSourceModel).ToNot(BeNil()) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + Expect(catalogSourceModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingKind).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingProvisionerWorkingDirectory).To(Equal(core.StringPtr("testString"))) // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) Expect(externalSourceModel).ToNot(BeNil()) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel Expect(externalSourceModel.SourceType).To(Equal(core.StringPtr("local"))) - Expect(externalSourceModel.Git).To(Equal(externalSourceGitModel)) - Expect(externalSourceModel.Catalog).To(Equal(externalSourceCatalogModel)) + Expect(externalSourceModel.Git).To(Equal(gitSourceModel)) + Expect(externalSourceModel.Catalog).To(Equal(catalogSourceModel)) + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + Expect(credentialVariableMetadataModel).ToNot(BeNil()) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + Expect(credentialVariableMetadataModel.Type).To(Equal(core.StringPtr("string"))) + Expect(credentialVariableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(credentialVariableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(credentialVariableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(credentialVariableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(credentialVariableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(credentialVariableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(credentialVariableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + Expect(credentialVariableDataModel).ToNot(BeNil()) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + Expect(credentialVariableDataModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableDataModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableDataModel.UseDefault).To(Equal(core.BoolPtr(true))) + Expect(credentialVariableDataModel.Metadata).To(Equal(credentialVariableMetadataModel)) + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + Expect(bastionResourceDefinitionModel).ToNot(BeNil()) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") + Expect(bastionResourceDefinitionModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(bastionResourceDefinitionModel.Host).To(Equal(core.StringPtr("testString"))) // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -21320,14 +27529,6 @@ var _ = Describe(`SchematicsV1`, func() { Expect(variableDataModel.UseDefault).To(Equal(core.BoolPtr(true))) Expect(variableDataModel.Metadata).To(Equal(variableMetadataModel)) - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - Expect(bastionResourceDefinitionModel).ToNot(BeNil()) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - Expect(bastionResourceDefinitionModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(bastionResourceDefinitionModel.Host).To(Equal(core.StringPtr("testString"))) - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) Expect(actionStateModel).ToNot(BeNil()) @@ -21363,9 +27564,9 @@ var _ = Describe(`SchematicsV1`, func() { createActionOptionsModel.SetSourceType("local") createActionOptionsModel.SetCommandParameter("testString") createActionOptionsModel.SetInventory("testString") - createActionOptionsModel.SetCredentials([]schematicsv1.VariableData{*variableDataModel}) + createActionOptionsModel.SetCredentials([]schematicsv1.CredentialVariableData{*credentialVariableDataModel}) createActionOptionsModel.SetBastion(bastionResourceDefinitionModel) - createActionOptionsModel.SetBastionCredential(variableDataModel) + createActionOptionsModel.SetBastionCredential(credentialVariableDataModel) createActionOptionsModel.SetTargetsIni("testString") createActionOptionsModel.SetInputs([]schematicsv1.VariableData{*variableDataModel}) createActionOptionsModel.SetOutputs([]schematicsv1.VariableData{*variableDataModel}) @@ -21388,9 +27589,9 @@ var _ = Describe(`SchematicsV1`, func() { Expect(createActionOptionsModel.SourceType).To(Equal(core.StringPtr("local"))) Expect(createActionOptionsModel.CommandParameter).To(Equal(core.StringPtr("testString"))) Expect(createActionOptionsModel.Inventory).To(Equal(core.StringPtr("testString"))) - Expect(createActionOptionsModel.Credentials).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + Expect(createActionOptionsModel.Credentials).To(Equal([]schematicsv1.CredentialVariableData{*credentialVariableDataModel})) Expect(createActionOptionsModel.Bastion).To(Equal(bastionResourceDefinitionModel)) - Expect(createActionOptionsModel.BastionCredential).To(Equal(variableDataModel)) + Expect(createActionOptionsModel.BastionCredential).To(Equal(credentialVariableDataModel)) Expect(createActionOptionsModel.TargetsIni).To(Equal(core.StringPtr("testString"))) Expect(createActionOptionsModel.Inputs).To(Equal([]schematicsv1.VariableData{*variableDataModel})) Expect(createActionOptionsModel.Outputs).To(Equal([]schematicsv1.VariableData{*variableDataModel})) @@ -21400,6 +27601,196 @@ var _ = Describe(`SchematicsV1`, func() { Expect(createActionOptionsModel.XGithubToken).To(Equal(core.StringPtr("testString"))) Expect(createActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateBlueprintOptions successfully`, func() { + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + Expect(gitSourceModel).ToNot(BeNil()) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + Expect(gitSourceModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitToken).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRelease).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitBranch).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + Expect(catalogSourceModel).ToNot(BeNil()) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + Expect(catalogSourceModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingKind).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingProvisionerWorkingDirectory).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + Expect(externalSourceModel).ToNot(BeNil()) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + Expect(externalSourceModel.SourceType).To(Equal(core.StringPtr("local"))) + Expect(externalSourceModel.Git).To(Equal(gitSourceModel)) + Expect(externalSourceModel.Catalog).To(Equal(catalogSourceModel)) + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + Expect(blueprintVariableDataModel).ToNot(BeNil()) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + Expect(blueprintVariableDataModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(blueprintVariableDataModel.Value).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + Expect(blueprintConfigItemModel).ToNot(BeNil()) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + Expect(blueprintConfigItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(blueprintConfigItemModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(blueprintConfigItemModel.Source).To(Equal(externalSourceModel)) + Expect(blueprintConfigItemModel.Inputs).To(Equal([]schematicsv1.BlueprintVariableData{*blueprintVariableDataModel})) + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + Expect(variableMetadataModel).ToNot(BeNil()) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + Expect(variableMetadataModel.Type).To(Equal(core.StringPtr("boolean"))) + Expect(variableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(variableMetadataModel.Secure).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Options).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.MinValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MinLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.Matches).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + Expect(variableDataModel).ToNot(BeNil()) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + Expect(variableDataModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(variableDataModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(variableDataModel.UseDefault).To(Equal(core.BoolPtr(true))) + Expect(variableDataModel.Metadata).To(Equal(variableMetadataModel)) + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + Expect(blueprintFlowModel).ToNot(BeNil()) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + Expect(systemLockModel).ToNot(BeNil()) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(systemLockModel.SysLocked).To(Equal(core.BoolPtr(true))) + Expect(systemLockModel.SysLockedBy).To(Equal(core.StringPtr("testString"))) + Expect(systemLockModel.SysLockedAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + Expect(userStateModel).ToNot(BeNil()) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(userStateModel.State).To(Equal(core.StringPtr("draft"))) + Expect(userStateModel.SetBy).To(Equal(core.StringPtr("testString"))) + Expect(userStateModel.SetAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + Expect(blueprintLiteStateModel).ToNot(BeNil()) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + Expect(blueprintLiteStateModel.StatusCode).To(Equal(core.StringPtr("Blueprint_Create_Init"))) + Expect(blueprintLiteStateModel.StatusMessage).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CreateBlueprintOptions model + createBlueprintOptionsName := "Toronto Dev Environtment" + createBlueprintOptionsModel := schematicsService.NewCreateBlueprintOptions(createBlueprintOptionsName) + createBlueprintOptionsModel.SetName("Toronto Dev Environtment") + createBlueprintOptionsModel.SetSchemaVersion("1.0") + createBlueprintOptionsModel.SetSource(externalSourceModel) + createBlueprintOptionsModel.SetConfig([]schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel}) + createBlueprintOptionsModel.SetDescription("Deploys dev environtment instance in Toronto Region") + createBlueprintOptionsModel.SetResourceGroup("Default") + createBlueprintOptionsModel.SetTags([]string{"blueprint:Tor-Dev"}) + createBlueprintOptionsModel.SetLocation("us-south") + createBlueprintOptionsModel.SetInputs([]schematicsv1.VariableData{*variableDataModel}) + createBlueprintOptionsModel.SetSettings([]schematicsv1.VariableData{*variableDataModel}) + createBlueprintOptionsModel.SetFlow(blueprintFlowModel) + createBlueprintOptionsModel.SetSysLock(systemLockModel) + createBlueprintOptionsModel.SetUserState(userStateModel) + createBlueprintOptionsModel.SetState(blueprintLiteStateModel) + createBlueprintOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createBlueprintOptionsModel).ToNot(BeNil()) + Expect(createBlueprintOptionsModel.Name).To(Equal(core.StringPtr("Toronto Dev Environtment"))) + Expect(createBlueprintOptionsModel.SchemaVersion).To(Equal(core.StringPtr("1.0"))) + Expect(createBlueprintOptionsModel.Source).To(Equal(externalSourceModel)) + Expect(createBlueprintOptionsModel.Config).To(Equal([]schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel})) + Expect(createBlueprintOptionsModel.Description).To(Equal(core.StringPtr("Deploys dev environtment instance in Toronto Region"))) + Expect(createBlueprintOptionsModel.ResourceGroup).To(Equal(core.StringPtr("Default"))) + Expect(createBlueprintOptionsModel.Tags).To(Equal([]string{"blueprint:Tor-Dev"})) + Expect(createBlueprintOptionsModel.Location).To(Equal(core.StringPtr("us-south"))) + Expect(createBlueprintOptionsModel.Inputs).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + Expect(createBlueprintOptionsModel.Settings).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + Expect(createBlueprintOptionsModel.Flow).To(Equal(blueprintFlowModel)) + Expect(createBlueprintOptionsModel.SysLock).To(Equal(systemLockModel)) + Expect(createBlueprintOptionsModel.UserState).To(Equal(userStateModel)) + Expect(createBlueprintOptionsModel.State).To(Equal(blueprintLiteStateModel)) + Expect(createBlueprintOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateConnectionOptions successfully`, func() { // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -21476,20 +27867,80 @@ var _ = Describe(`SchematicsV1`, func() { Expect(createConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateDatasourceOptions successfully`, func() { + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + Expect(variableMetadataModel).ToNot(BeNil()) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + Expect(variableMetadataModel.Type).To(Equal(core.StringPtr("boolean"))) + Expect(variableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(variableMetadataModel.Secure).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Options).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.MinValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MinLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.Matches).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + Expect(variableDataModel).ToNot(BeNil()) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + Expect(variableDataModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(variableDataModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(variableDataModel.UseDefault).To(Equal(core.BoolPtr(true))) + Expect(variableDataModel.Metadata).To(Equal(variableMetadataModel)) + // Construct an instance of the CreateDatasourceOptions model createDatasourceOptionsModel := schematicsService.NewCreateDatasourceOptions() createDatasourceOptionsModel.SetName("testString") createDatasourceOptionsModel.SetDescription("testString") createDatasourceOptionsModel.SetResourceGroup("testString") createDatasourceOptionsModel.SetTags([]string{"testString"}) + createDatasourceOptionsModel.SetType("internal") createDatasourceOptionsModel.SetConnection("testString") + createDatasourceOptionsModel.SetDatasourceProperties([]schematicsv1.VariableData{*variableDataModel}) + createDatasourceOptionsModel.SetLocation("us-south") createDatasourceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createDatasourceOptionsModel).ToNot(BeNil()) Expect(createDatasourceOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(createDatasourceOptionsModel.Description).To(Equal(core.StringPtr("testString"))) Expect(createDatasourceOptionsModel.ResourceGroup).To(Equal(core.StringPtr("testString"))) Expect(createDatasourceOptionsModel.Tags).To(Equal([]string{"testString"})) + Expect(createDatasourceOptionsModel.Type).To(Equal(core.StringPtr("internal"))) Expect(createDatasourceOptionsModel.Connection).To(Equal(core.StringPtr("testString"))) + Expect(createDatasourceOptionsModel.DatasourceProperties).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + Expect(createDatasourceOptionsModel.Location).To(Equal(core.StringPtr("us-south"))) Expect(createDatasourceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateInventoryOptions successfully`, func() { @@ -21772,49 +28223,53 @@ var _ = Describe(`SchematicsV1`, func() { Expect(jobDataSystemModel.SchematicsResourceID).To(Equal([]string{"testString"})) Expect(jobDataSystemModel.UpdatedAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - Expect(externalSourceGitModel).ToNot(BeNil()) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - Expect(externalSourceGitModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitToken).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRelease).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitBranch).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - Expect(externalSourceCatalogModel).ToNot(BeNil()) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") - Expect(externalSourceCatalogModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingKind).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + Expect(gitSourceModel).ToNot(BeNil()) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + Expect(gitSourceModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitToken).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRelease).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitBranch).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + Expect(catalogSourceModel).ToNot(BeNil()) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + Expect(catalogSourceModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingKind).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingProvisionerWorkingDirectory).To(Equal(core.StringPtr("testString"))) // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) Expect(externalSourceModel).ToNot(BeNil()) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel Expect(externalSourceModel.SourceType).To(Equal(core.StringPtr("local"))) - Expect(externalSourceModel.Git).To(Equal(externalSourceGitModel)) - Expect(externalSourceModel.Catalog).To(Equal(externalSourceCatalogModel)) + Expect(externalSourceModel.Git).To(Equal(gitSourceModel)) + Expect(externalSourceModel.Catalog).To(Equal(catalogSourceModel)) // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -21995,6 +28450,80 @@ var _ = Describe(`SchematicsV1`, func() { Expect(createJobOptionsModel.LogSummary).To(Equal(jobLogSummaryModel)) Expect(createJobOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreatePolicyOptions successfully`, func() { + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + Expect(userStateModel).ToNot(BeNil()) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(userStateModel.State).To(Equal(core.StringPtr("draft"))) + Expect(userStateModel.SetBy).To(Equal(core.StringPtr("testString"))) + Expect(userStateModel.SetAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + Expect(policyObjectSelectorModel).ToNot(BeNil()) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + Expect(policyObjectSelectorModel.Kind).To(Equal(core.StringPtr("agent"))) + Expect(policyObjectSelectorModel.Tags).To(Equal([]string{"testString"})) + Expect(policyObjectSelectorModel.ResourceGroups).To(Equal([]string{"testString"})) + Expect(policyObjectSelectorModel.Locations).To(Equal([]string{"us-south"})) + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + Expect(policyObjectsModel).ToNot(BeNil()) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + Expect(policyObjectsModel.SelectorKind).To(Equal(core.StringPtr("ids"))) + Expect(policyObjectsModel.SelectorIds).To(Equal([]string{"testString"})) + Expect(policyObjectsModel.SelectorScope).To(Equal([]schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel})) + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + Expect(agentAssignmentPolicyParameterModel).ToNot(BeNil()) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + Expect(agentAssignmentPolicyParameterModel.SelectorKind).To(Equal(core.StringPtr("ids"))) + Expect(agentAssignmentPolicyParameterModel.SelectorIds).To(Equal([]string{"testString"})) + Expect(agentAssignmentPolicyParameterModel.SelectorScope).To(Equal([]schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel})) + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + Expect(policyParameterModel).ToNot(BeNil()) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + Expect(policyParameterModel.AgentAssignmentPolicyParameter).To(Equal(agentAssignmentPolicyParameterModel)) + + // Construct an instance of the CreatePolicyOptions model + createPolicyOptionsPolicyKind := "agent_assignment_policy" + createPolicyOptionsModel := schematicsService.NewCreatePolicyOptions(createPolicyOptionsPolicyKind) + createPolicyOptionsModel.SetPolicyKind("agent_assignment_policy") + createPolicyOptionsModel.SetName("Agent1-DevWS") + createPolicyOptionsModel.SetDescription("Policy for job execution of secured workspaces on agent1") + createPolicyOptionsModel.SetResourceGroup("Default") + createPolicyOptionsModel.SetTags([]string{"policy:secured-job"}) + createPolicyOptionsModel.SetLocation("us-south") + createPolicyOptionsModel.SetState(userStateModel) + createPolicyOptionsModel.SetPolicyTarget(policyObjectsModel) + createPolicyOptionsModel.SetPolicyParameter(policyParameterModel) + createPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createPolicyOptionsModel).ToNot(BeNil()) + Expect(createPolicyOptionsModel.PolicyKind).To(Equal(core.StringPtr("agent_assignment_policy"))) + Expect(createPolicyOptionsModel.Name).To(Equal(core.StringPtr("Agent1-DevWS"))) + Expect(createPolicyOptionsModel.Description).To(Equal(core.StringPtr("Policy for job execution of secured workspaces on agent1"))) + Expect(createPolicyOptionsModel.ResourceGroup).To(Equal(core.StringPtr("Default"))) + Expect(createPolicyOptionsModel.Tags).To(Equal([]string{"policy:secured-job"})) + Expect(createPolicyOptionsModel.Location).To(Equal(core.StringPtr("us-south"))) + Expect(createPolicyOptionsModel.State).To(Equal(userStateModel)) + Expect(createPolicyOptionsModel.PolicyTarget).To(Equal(policyObjectsModel)) + Expect(createPolicyOptionsModel.PolicyParameter).To(Equal(policyParameterModel)) + Expect(createPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateResourceQueryOptions successfully`, func() { // Construct an instance of the ResourceQueryParam model resourceQueryParamModel := new(schematicsv1.ResourceQueryParam) @@ -22133,6 +28662,48 @@ var _ = Describe(`SchematicsV1`, func() { Expect(injectTerraformTemplateInnerModel.TftName).To(Equal(core.StringPtr("testString"))) Expect(injectTerraformTemplateInnerModel.TftParameters).To(Equal([]schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel})) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + Expect(variableMetadataModel).ToNot(BeNil()) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + Expect(variableMetadataModel.Type).To(Equal(core.StringPtr("boolean"))) + Expect(variableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(variableMetadataModel.Secure).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Options).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.MinValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MinLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.Matches).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) Expect(workspaceVariableRequestModel).ToNot(BeNil()) @@ -22161,7 +28732,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} Expect(templateSourceDataRequestModel.EnvValues).To(Equal([]interface{}{map[string]interface{}{"anyKey": "anyValue"}})) Expect(templateSourceDataRequestModel.EnvValuesMetadata).To(Equal([]schematicsv1.EnvironmentValuesMetadata{*environmentValuesMetadataModel})) @@ -22172,7 +28743,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(templateSourceDataRequestModel.Type).To(Equal(core.StringPtr("testString"))) Expect(templateSourceDataRequestModel.UninstallScriptName).To(Equal(core.StringPtr("testString"))) Expect(templateSourceDataRequestModel.Values).To(Equal(core.StringPtr("testString"))) - Expect(templateSourceDataRequestModel.ValuesMetadata).To(Equal([]interface{}{map[string]interface{}{"anyKey": "anyValue"}})) + Expect(templateSourceDataRequestModel.ValuesMetadata).To(Equal([]schematicsv1.VariableMetadata{*variableMetadataModel})) Expect(templateSourceDataRequestModel.Variablestore).To(Equal([]schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel})) // Construct an instance of the TemplateRepoRequest model @@ -22221,6 +28792,7 @@ var _ = Describe(`SchematicsV1`, func() { createWorkspaceOptionsModel.SetTemplateRepo(templateRepoRequestModel) createWorkspaceOptionsModel.SetType([]string{"testString"}) createWorkspaceOptionsModel.SetWorkspaceStatus(workspaceStatusRequestModel) + createWorkspaceOptionsModel.SetAgentID("testString") createWorkspaceOptionsModel.SetXGithubToken("testString") createWorkspaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createWorkspaceOptionsModel).ToNot(BeNil()) @@ -22238,6 +28810,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(createWorkspaceOptionsModel.TemplateRepo).To(Equal(templateRepoRequestModel)) Expect(createWorkspaceOptionsModel.Type).To(Equal([]string{"testString"})) Expect(createWorkspaceOptionsModel.WorkspaceStatus).To(Equal(workspaceStatusRequestModel)) + Expect(createWorkspaceOptionsModel.AgentID).To(Equal(core.StringPtr("testString"))) Expect(createWorkspaceOptionsModel.XGithubToken).To(Equal(core.StringPtr("testString"))) Expect(createWorkspaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -22255,6 +28828,30 @@ var _ = Describe(`SchematicsV1`, func() { Expect(deleteActionOptionsModel.Propagate).To(Equal(core.BoolPtr(true))) Expect(deleteActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteAgentOptions successfully`, func() { + // Construct an instance of the DeleteAgentOptions model + agentID := "testString" + deleteAgentOptionsModel := schematicsService.NewDeleteAgentOptions(agentID) + deleteAgentOptionsModel.SetAgentID("testString") + deleteAgentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteAgentOptionsModel).ToNot(BeNil()) + Expect(deleteAgentOptionsModel.AgentID).To(Equal(core.StringPtr("testString"))) + Expect(deleteAgentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteBlueprintOptions successfully`, func() { + // Construct an instance of the DeleteBlueprintOptions model + blueprintID := "testString" + deleteBlueprintOptionsModel := schematicsService.NewDeleteBlueprintOptions(blueprintID) + deleteBlueprintOptionsModel.SetBlueprintID("testString") + deleteBlueprintOptionsModel.SetProfile("ids") + deleteBlueprintOptionsModel.SetDestroy(true) + deleteBlueprintOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteBlueprintOptionsModel).ToNot(BeNil()) + Expect(deleteBlueprintOptionsModel.BlueprintID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBlueprintOptionsModel.Profile).To(Equal(core.StringPtr("ids"))) + Expect(deleteBlueprintOptionsModel.Destroy).To(Equal(core.BoolPtr(true))) + Expect(deleteBlueprintOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteConnectionOptions successfully`, func() { // Construct an instance of the DeleteConnectionOptions model connectionID := "testString" @@ -22296,6 +28893,16 @@ var _ = Describe(`SchematicsV1`, func() { Expect(deleteJobOptionsModel.Propagate).To(Equal(core.BoolPtr(true))) Expect(deleteJobOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeletePolicyOptions successfully`, func() { + // Construct an instance of the DeletePolicyOptions model + policyID := "testString" + deletePolicyOptionsModel := schematicsService.NewDeletePolicyOptions(policyID) + deletePolicyOptionsModel.SetPolicyID("testString") + deletePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deletePolicyOptionsModel).ToNot(BeNil()) + Expect(deletePolicyOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) + Expect(deletePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteResourcesQueryOptions successfully`, func() { // Construct an instance of the DeleteResourcesQueryOptions model queryID := "testString" @@ -22379,6 +28986,22 @@ var _ = Describe(`SchematicsV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewFetchJobsOptions successfully`, func() { + // Construct an instance of the FetchJobsOptions model + fetchJobsOptionsAgentID := "testString" + fetchJobsOptionsJobCount := int64(1) + fetchJobsOptionsJobType := "workspace_job" + fetchJobsOptionsModel := schematicsService.NewFetchJobsOptions(fetchJobsOptionsAgentID, fetchJobsOptionsJobCount, fetchJobsOptionsJobType) + fetchJobsOptionsModel.SetAgentID("testString") + fetchJobsOptionsModel.SetJobCount(int64(1)) + fetchJobsOptionsModel.SetJobType("workspace_job") + fetchJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(fetchJobsOptionsModel).ToNot(BeNil()) + Expect(fetchJobsOptionsModel.AgentID).To(Equal(core.StringPtr("testString"))) + Expect(fetchJobsOptionsModel.JobCount).To(Equal(core.Int64Ptr(int64(1)))) + Expect(fetchJobsOptionsModel.JobType).To(Equal(core.StringPtr("workspace_job"))) + Expect(fetchJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetActionOptions successfully`, func() { // Construct an instance of the GetActionOptions model actionID := "testString" @@ -22391,6 +29014,28 @@ var _ = Describe(`SchematicsV1`, func() { Expect(getActionOptionsModel.Profile).To(Equal(core.StringPtr("summary"))) Expect(getActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetAgentJobFilesOptions successfully`, func() { + // Construct an instance of the GetAgentJobFilesOptions model + jobID := "testString" + getAgentJobFilesOptionsModel := schematicsService.NewGetAgentJobFilesOptions(jobID) + getAgentJobFilesOptionsModel.SetJobID("testString") + getAgentJobFilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getAgentJobFilesOptionsModel).ToNot(BeNil()) + Expect(getAgentJobFilesOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) + Expect(getAgentJobFilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetAgentOptions successfully`, func() { + // Construct an instance of the GetAgentOptions model + agentID := "testString" + getAgentOptionsModel := schematicsService.NewGetAgentOptions(agentID) + getAgentOptionsModel.SetAgentID("testString") + getAgentOptionsModel.SetProfile("summary") + getAgentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getAgentOptionsModel).ToNot(BeNil()) + Expect(getAgentOptionsModel.AgentID).To(Equal(core.StringPtr("testString"))) + Expect(getAgentOptionsModel.Profile).To(Equal(core.StringPtr("summary"))) + Expect(getAgentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetAllWorkspaceInputsOptions successfully`, func() { // Construct an instance of the GetAllWorkspaceInputsOptions model wID := "testString" @@ -22401,6 +29046,18 @@ var _ = Describe(`SchematicsV1`, func() { Expect(getAllWorkspaceInputsOptionsModel.WID).To(Equal(core.StringPtr("testString"))) Expect(getAllWorkspaceInputsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetBlueprintOptions successfully`, func() { + // Construct an instance of the GetBlueprintOptions model + blueprintID := "testString" + getBlueprintOptionsModel := schematicsService.NewGetBlueprintOptions(blueprintID) + getBlueprintOptionsModel.SetBlueprintID("testString") + getBlueprintOptionsModel.SetProfile("ids") + getBlueprintOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBlueprintOptionsModel).ToNot(BeNil()) + Expect(getBlueprintOptionsModel.BlueprintID).To(Equal(core.StringPtr("testString"))) + Expect(getBlueprintOptionsModel.Profile).To(Equal(core.StringPtr("ids"))) + Expect(getBlueprintOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetConnectionOptions successfully`, func() { // Construct an instance of the GetConnectionOptions model connectionID := "testString" @@ -22438,14 +29095,14 @@ var _ = Describe(`SchematicsV1`, func() { It(`Invoke NewGetJobFilesOptions successfully`, func() { // Construct an instance of the GetJobFilesOptions model jobID := "testString" - fileType := "state_file" + fileType := "template_repo" getJobFilesOptionsModel := schematicsService.NewGetJobFilesOptions(jobID, fileType) getJobFilesOptionsModel.SetJobID("testString") - getJobFilesOptionsModel.SetFileType("state_file") + getJobFilesOptionsModel.SetFileType("template_repo") getJobFilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getJobFilesOptionsModel).ToNot(BeNil()) Expect(getJobFilesOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) - Expect(getJobFilesOptionsModel.FileType).To(Equal(core.StringPtr("state_file"))) + Expect(getJobFilesOptionsModel.FileType).To(Equal(core.StringPtr("template_repo"))) Expect(getJobFilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetJobOptions successfully`, func() { @@ -22470,6 +29127,18 @@ var _ = Describe(`SchematicsV1`, func() { Expect(getKmsSettingsOptionsModel.Location).To(Equal(core.StringPtr("testString"))) Expect(getKmsSettingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetPolicyOptions successfully`, func() { + // Construct an instance of the GetPolicyOptions model + policyID := "testString" + getPolicyOptionsModel := schematicsService.NewGetPolicyOptions(policyID) + getPolicyOptionsModel.SetPolicyID("testString") + getPolicyOptionsModel.SetProfile("summary") + getPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getPolicyOptionsModel).ToNot(BeNil()) + Expect(getPolicyOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) + Expect(getPolicyOptionsModel.Profile).To(Equal(core.StringPtr("summary"))) + Expect(getPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetResourcesQueryOptions successfully`, func() { // Construct an instance of the GetResourcesQueryOptions model queryID := "testString" @@ -22692,6 +29361,32 @@ var _ = Describe(`SchematicsV1`, func() { Expect(listActionsOptionsModel.Profile).To(Equal(core.StringPtr("ids"))) Expect(listActionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListAgentOptions successfully`, func() { + // Construct an instance of the ListAgentOptions model + listAgentOptionsModel := schematicsService.NewListAgentOptions() + listAgentOptionsModel.SetOffset(int64(0)) + listAgentOptionsModel.SetLimit(int64(1)) + listAgentOptionsModel.SetProfile("summary") + listAgentOptionsModel.SetFilter("all") + listAgentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listAgentOptionsModel).ToNot(BeNil()) + Expect(listAgentOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(0)))) + Expect(listAgentOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listAgentOptionsModel.Profile).To(Equal(core.StringPtr("summary"))) + Expect(listAgentOptionsModel.Filter).To(Equal(core.StringPtr("all"))) + Expect(listAgentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListBlueprintOptions successfully`, func() { + // Construct an instance of the ListBlueprintOptions model + listBlueprintOptionsModel := schematicsService.NewListBlueprintOptions() + listBlueprintOptionsModel.SetOffset(int64(0)) + listBlueprintOptionsModel.SetLimit(int64(1)) + listBlueprintOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBlueprintOptionsModel).ToNot(BeNil()) + Expect(listBlueprintOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(0)))) + Expect(listBlueprintOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBlueprintOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListConnectionOptions successfully`, func() { // Construct an instance of the ListConnectionOptions model listConnectionOptionsModel := schematicsService.NewListConnectionOptions() @@ -22750,9 +29445,10 @@ var _ = Describe(`SchematicsV1`, func() { listJobsOptionsModel.SetLimit(int64(1)) listJobsOptionsModel.SetSort("testString") listJobsOptionsModel.SetProfile("ids") - listJobsOptionsModel.SetResource("workspace") + listJobsOptionsModel.SetResource("workspaces") listJobsOptionsModel.SetResourceID("testString") listJobsOptionsModel.SetActionID("testString") + listJobsOptionsModel.SetWorkspaceID("testString") listJobsOptionsModel.SetList("all") listJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listJobsOptionsModel).ToNot(BeNil()) @@ -22760,9 +29456,10 @@ var _ = Describe(`SchematicsV1`, func() { Expect(listJobsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) Expect(listJobsOptionsModel.Sort).To(Equal(core.StringPtr("testString"))) Expect(listJobsOptionsModel.Profile).To(Equal(core.StringPtr("ids"))) - Expect(listJobsOptionsModel.Resource).To(Equal(core.StringPtr("workspace"))) + Expect(listJobsOptionsModel.Resource).To(Equal(core.StringPtr("workspaces"))) Expect(listJobsOptionsModel.ResourceID).To(Equal(core.StringPtr("testString"))) Expect(listJobsOptionsModel.ActionID).To(Equal(core.StringPtr("testString"))) + Expect(listJobsOptionsModel.WorkspaceID).To(Equal(core.StringPtr("testString"))) Expect(listJobsOptionsModel.List).To(Equal(core.StringPtr("all"))) Expect(listJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -22792,6 +29489,19 @@ var _ = Describe(`SchematicsV1`, func() { Expect(listLocationsOptionsModel).ToNot(BeNil()) Expect(listLocationsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListPolicyOptions successfully`, func() { + // Construct an instance of the ListPolicyOptions model + listPolicyOptionsModel := schematicsService.NewListPolicyOptions() + listPolicyOptionsModel.SetOffset(int64(0)) + listPolicyOptionsModel.SetLimit(int64(1)) + listPolicyOptionsModel.SetProfile("summary") + listPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listPolicyOptionsModel).ToNot(BeNil()) + Expect(listPolicyOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(0)))) + Expect(listPolicyOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listPolicyOptionsModel.Profile).To(Equal(core.StringPtr("summary"))) + Expect(listPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListResourceGroupOptions successfully`, func() { // Construct an instance of the ListResourceGroupOptions model listResourceGroupOptionsModel := schematicsService.NewListResourceGroupOptions() @@ -22840,10 +29550,12 @@ var _ = Describe(`SchematicsV1`, func() { listWorkspacesOptionsModel := schematicsService.NewListWorkspacesOptions() listWorkspacesOptionsModel.SetOffset(int64(0)) listWorkspacesOptionsModel.SetLimit(int64(1)) + listWorkspacesOptionsModel.SetProfile("ids") listWorkspacesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listWorkspacesOptionsModel).ToNot(BeNil()) Expect(listWorkspacesOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(0)))) Expect(listWorkspacesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listWorkspacesOptionsModel.Profile).To(Equal(core.StringPtr("ids"))) Expect(listWorkspacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewPlanWorkspaceCommandOptions successfully`, func() { @@ -22871,50 +29583,77 @@ var _ = Describe(`SchematicsV1`, func() { Expect(planWorkspaceCommandOptionsModel.DelegatedToken).To(Equal(core.StringPtr("testString"))) Expect(planWorkspaceCommandOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewPolicy successfully`, func() { + policyKind := "agent_assignment_policy" + _model, err := schematicsService.NewPolicy(policyKind) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewPostAgentJobFilesOptions successfully`, func() { + // Construct an instance of the PostAgentJobFilesOptions model + jobID := "testString" + fileType := "template_repo" + postAgentJobFilesOptionsModel := schematicsService.NewPostAgentJobFilesOptions(jobID, fileType) + postAgentJobFilesOptionsModel.SetJobID("testString") + postAgentJobFilesOptionsModel.SetFileType("template_repo") + postAgentJobFilesOptionsModel.SetFile(CreateMockReader("This is a mock file.")) + postAgentJobFilesOptionsModel.SetFileContentType("testString") + postAgentJobFilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(postAgentJobFilesOptionsModel).ToNot(BeNil()) + Expect(postAgentJobFilesOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) + Expect(postAgentJobFilesOptionsModel.FileType).To(Equal(core.StringPtr("template_repo"))) + Expect(postAgentJobFilesOptionsModel.File).To(Equal(CreateMockReader("This is a mock file."))) + Expect(postAgentJobFilesOptionsModel.FileContentType).To(Equal(core.StringPtr("testString"))) + Expect(postAgentJobFilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewProcessTemplateMetaDataOptions successfully`, func() { - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - Expect(externalSourceGitModel).ToNot(BeNil()) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - Expect(externalSourceGitModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitToken).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRelease).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitBranch).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - Expect(externalSourceCatalogModel).ToNot(BeNil()) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") - Expect(externalSourceCatalogModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingKind).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + Expect(gitSourceModel).ToNot(BeNil()) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + Expect(gitSourceModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitToken).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRelease).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitBranch).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + Expect(catalogSourceModel).ToNot(BeNil()) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + Expect(catalogSourceModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingKind).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingProvisionerWorkingDirectory).To(Equal(core.StringPtr("testString"))) // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) Expect(externalSourceModel).ToNot(BeNil()) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel Expect(externalSourceModel.SourceType).To(Equal(core.StringPtr("local"))) - Expect(externalSourceModel.Git).To(Equal(externalSourceGitModel)) - Expect(externalSourceModel.Catalog).To(Equal(externalSourceCatalogModel)) + Expect(externalSourceModel.Git).To(Equal(gitSourceModel)) + Expect(externalSourceModel.Catalog).To(Equal(catalogSourceModel)) // Construct an instance of the ProcessTemplateMetaDataOptions model processTemplateMetaDataOptionsTemplateType := "testString" @@ -22949,6 +29688,254 @@ var _ = Describe(`SchematicsV1`, func() { Expect(refreshWorkspaceCommandOptionsModel.DelegatedToken).To(Equal(core.StringPtr("testString"))) Expect(refreshWorkspaceCommandOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewRegisterAgentOptions successfully`, func() { + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + Expect(agentUserStateModel).ToNot(BeNil()) + agentUserStateModel.State = core.StringPtr("enable") + Expect(agentUserStateModel.State).To(Equal(core.StringPtr("enable"))) + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + Expect(connectionStateModel).ToNot(BeNil()) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(connectionStateModel.State).To(Equal(core.StringPtr("Connected"))) + Expect(connectionStateModel.CheckedAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + Expect(agentSystemStateModel).ToNot(BeNil()) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + Expect(agentSystemStateModel.State).To(Equal(core.StringPtr("error"))) + Expect(agentSystemStateModel.Message).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the RegisterAgentOptions model + registerAgentOptionsName := "MyDevAgent" + registerAgentOptionsAgentLocation := "us-south" + registerAgentOptionsLocation := "us-south" + registerAgentOptionsProfileID := "testString" + registerAgentOptionsModel := schematicsService.NewRegisterAgentOptions(registerAgentOptionsName, registerAgentOptionsAgentLocation, registerAgentOptionsLocation, registerAgentOptionsProfileID) + registerAgentOptionsModel.SetName("MyDevAgent") + registerAgentOptionsModel.SetAgentLocation("us-south") + registerAgentOptionsModel.SetLocation("us-south") + registerAgentOptionsModel.SetProfileID("testString") + registerAgentOptionsModel.SetDescription("Register agent") + registerAgentOptionsModel.SetResourceGroup("testString") + registerAgentOptionsModel.SetTags([]string{"testString"}) + registerAgentOptionsModel.SetUserState(agentUserStateModel) + registerAgentOptionsModel.SetConnectionState(connectionStateModel) + registerAgentOptionsModel.SetSystemState(agentSystemStateModel) + registerAgentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(registerAgentOptionsModel).ToNot(BeNil()) + Expect(registerAgentOptionsModel.Name).To(Equal(core.StringPtr("MyDevAgent"))) + Expect(registerAgentOptionsModel.AgentLocation).To(Equal(core.StringPtr("us-south"))) + Expect(registerAgentOptionsModel.Location).To(Equal(core.StringPtr("us-south"))) + Expect(registerAgentOptionsModel.ProfileID).To(Equal(core.StringPtr("testString"))) + Expect(registerAgentOptionsModel.Description).To(Equal(core.StringPtr("Register agent"))) + Expect(registerAgentOptionsModel.ResourceGroup).To(Equal(core.StringPtr("testString"))) + Expect(registerAgentOptionsModel.Tags).To(Equal([]string{"testString"})) + Expect(registerAgentOptionsModel.UserState).To(Equal(agentUserStateModel)) + Expect(registerAgentOptionsModel.ConnectionState).To(Equal(connectionStateModel)) + Expect(registerAgentOptionsModel.SystemState).To(Equal(agentSystemStateModel)) + Expect(registerAgentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewReplaceBlueprintOptions successfully`, func() { + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + Expect(gitSourceModel).ToNot(BeNil()) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + Expect(gitSourceModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitToken).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRelease).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitBranch).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + Expect(catalogSourceModel).ToNot(BeNil()) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + Expect(catalogSourceModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingKind).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingProvisionerWorkingDirectory).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ExternalSource model + externalSourceModel := new(schematicsv1.ExternalSource) + Expect(externalSourceModel).ToNot(BeNil()) + externalSourceModel.SourceType = core.StringPtr("local") + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel + Expect(externalSourceModel.SourceType).To(Equal(core.StringPtr("local"))) + Expect(externalSourceModel.Git).To(Equal(gitSourceModel)) + Expect(externalSourceModel.Catalog).To(Equal(catalogSourceModel)) + + // Construct an instance of the BlueprintVariableData model + blueprintVariableDataModel := new(schematicsv1.BlueprintVariableData) + Expect(blueprintVariableDataModel).ToNot(BeNil()) + blueprintVariableDataModel.Name = core.StringPtr("testString") + blueprintVariableDataModel.Value = core.StringPtr("testString") + Expect(blueprintVariableDataModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(blueprintVariableDataModel.Value).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the BlueprintConfigItem model + blueprintConfigItemModel := new(schematicsv1.BlueprintConfigItem) + Expect(blueprintConfigItemModel).ToNot(BeNil()) + blueprintConfigItemModel.Name = core.StringPtr("testString") + blueprintConfigItemModel.Description = core.StringPtr("testString") + blueprintConfigItemModel.Source = externalSourceModel + blueprintConfigItemModel.Inputs = []schematicsv1.BlueprintVariableData{*blueprintVariableDataModel} + Expect(blueprintConfigItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(blueprintConfigItemModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(blueprintConfigItemModel.Source).To(Equal(externalSourceModel)) + Expect(blueprintConfigItemModel.Inputs).To(Equal([]schematicsv1.BlueprintVariableData{*blueprintVariableDataModel})) + + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + Expect(variableMetadataModel).ToNot(BeNil()) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + Expect(variableMetadataModel.Type).To(Equal(core.StringPtr("boolean"))) + Expect(variableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(variableMetadataModel.Secure).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Options).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.MinValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MinLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.Matches).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + Expect(variableDataModel).ToNot(BeNil()) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + Expect(variableDataModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(variableDataModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(variableDataModel.UseDefault).To(Equal(core.BoolPtr(true))) + Expect(variableDataModel.Metadata).To(Equal(variableMetadataModel)) + + // Construct an instance of the BlueprintFlow model + blueprintFlowModel := new(schematicsv1.BlueprintFlow) + Expect(blueprintFlowModel).ToNot(BeNil()) + + // Construct an instance of the SystemLock model + systemLockModel := new(schematicsv1.SystemLock) + Expect(systemLockModel).ToNot(BeNil()) + systemLockModel.SysLocked = core.BoolPtr(true) + systemLockModel.SysLockedBy = core.StringPtr("testString") + systemLockModel.SysLockedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(systemLockModel.SysLocked).To(Equal(core.BoolPtr(true))) + Expect(systemLockModel.SysLockedBy).To(Equal(core.StringPtr("testString"))) + Expect(systemLockModel.SysLockedAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + Expect(userStateModel).ToNot(BeNil()) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(userStateModel.State).To(Equal(core.StringPtr("draft"))) + Expect(userStateModel.SetBy).To(Equal(core.StringPtr("testString"))) + Expect(userStateModel.SetAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the BlueprintLiteState model + blueprintLiteStateModel := new(schematicsv1.BlueprintLiteState) + Expect(blueprintLiteStateModel).ToNot(BeNil()) + blueprintLiteStateModel.StatusCode = core.StringPtr("Blueprint_Create_Init") + blueprintLiteStateModel.StatusMessage = core.StringPtr("testString") + Expect(blueprintLiteStateModel.StatusCode).To(Equal(core.StringPtr("Blueprint_Create_Init"))) + Expect(blueprintLiteStateModel.StatusMessage).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ReplaceBlueprintOptions model + blueprintID := "testString" + replaceBlueprintOptionsName := "Toronto Dev Environtment" + replaceBlueprintOptionsModel := schematicsService.NewReplaceBlueprintOptions(blueprintID, replaceBlueprintOptionsName) + replaceBlueprintOptionsModel.SetBlueprintID("testString") + replaceBlueprintOptionsModel.SetName("Toronto Dev Environtment") + replaceBlueprintOptionsModel.SetSchemaVersion("1.0") + replaceBlueprintOptionsModel.SetSource(externalSourceModel) + replaceBlueprintOptionsModel.SetConfig([]schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel}) + replaceBlueprintOptionsModel.SetDescription("Deploys dev environtment instance in Toronto Region") + replaceBlueprintOptionsModel.SetResourceGroup("Default") + replaceBlueprintOptionsModel.SetTags([]string{"blueprint:Tor-Dev"}) + replaceBlueprintOptionsModel.SetLocation("us-south") + replaceBlueprintOptionsModel.SetInputs([]schematicsv1.VariableData{*variableDataModel}) + replaceBlueprintOptionsModel.SetSettings([]schematicsv1.VariableData{*variableDataModel}) + replaceBlueprintOptionsModel.SetFlow(blueprintFlowModel) + replaceBlueprintOptionsModel.SetSysLock(systemLockModel) + replaceBlueprintOptionsModel.SetUserState(userStateModel) + replaceBlueprintOptionsModel.SetState(blueprintLiteStateModel) + replaceBlueprintOptionsModel.SetProfile("ids") + replaceBlueprintOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(replaceBlueprintOptionsModel).ToNot(BeNil()) + Expect(replaceBlueprintOptionsModel.BlueprintID).To(Equal(core.StringPtr("testString"))) + Expect(replaceBlueprintOptionsModel.Name).To(Equal(core.StringPtr("Toronto Dev Environtment"))) + Expect(replaceBlueprintOptionsModel.SchemaVersion).To(Equal(core.StringPtr("1.0"))) + Expect(replaceBlueprintOptionsModel.Source).To(Equal(externalSourceModel)) + Expect(replaceBlueprintOptionsModel.Config).To(Equal([]schematicsv1.BlueprintConfigItem{*blueprintConfigItemModel})) + Expect(replaceBlueprintOptionsModel.Description).To(Equal(core.StringPtr("Deploys dev environtment instance in Toronto Region"))) + Expect(replaceBlueprintOptionsModel.ResourceGroup).To(Equal(core.StringPtr("Default"))) + Expect(replaceBlueprintOptionsModel.Tags).To(Equal([]string{"blueprint:Tor-Dev"})) + Expect(replaceBlueprintOptionsModel.Location).To(Equal(core.StringPtr("us-south"))) + Expect(replaceBlueprintOptionsModel.Inputs).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + Expect(replaceBlueprintOptionsModel.Settings).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + Expect(replaceBlueprintOptionsModel.Flow).To(Equal(blueprintFlowModel)) + Expect(replaceBlueprintOptionsModel.SysLock).To(Equal(systemLockModel)) + Expect(replaceBlueprintOptionsModel.UserState).To(Equal(userStateModel)) + Expect(replaceBlueprintOptionsModel.State).To(Equal(blueprintLiteStateModel)) + Expect(replaceBlueprintOptionsModel.Profile).To(Equal(core.StringPtr("ids"))) + Expect(replaceBlueprintOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewReplaceInventoryOptions successfully`, func() { // Construct an instance of the ReplaceInventoryOptions model inventoryID := "testString" @@ -23131,6 +30118,48 @@ var _ = Describe(`SchematicsV1`, func() { Expect(injectTerraformTemplateInnerModel.TftName).To(Equal(core.StringPtr("testString"))) Expect(injectTerraformTemplateInnerModel.TftParameters).To(Equal([]schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel})) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + Expect(variableMetadataModel).ToNot(BeNil()) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + Expect(variableMetadataModel.Type).To(Equal(core.StringPtr("boolean"))) + Expect(variableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(variableMetadataModel.Secure).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Options).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.MinValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MinLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.Matches).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) Expect(workspaceVariableRequestModel).ToNot(BeNil()) @@ -23159,7 +30188,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} Expect(templateSourceDataRequestModel.EnvValues).To(Equal([]interface{}{map[string]interface{}{"anyKey": "anyValue"}})) Expect(templateSourceDataRequestModel.EnvValuesMetadata).To(Equal([]schematicsv1.EnvironmentValuesMetadata{*environmentValuesMetadataModel})) @@ -23170,7 +30199,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(templateSourceDataRequestModel.Type).To(Equal(core.StringPtr("testString"))) Expect(templateSourceDataRequestModel.UninstallScriptName).To(Equal(core.StringPtr("testString"))) Expect(templateSourceDataRequestModel.Values).To(Equal(core.StringPtr("testString"))) - Expect(templateSourceDataRequestModel.ValuesMetadata).To(Equal([]interface{}{map[string]interface{}{"anyKey": "anyValue"}})) + Expect(templateSourceDataRequestModel.ValuesMetadata).To(Equal([]schematicsv1.VariableMetadata{*variableMetadataModel})) Expect(templateSourceDataRequestModel.Variablestore).To(Equal([]schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel})) // Construct an instance of the TemplateRepoUpdateRequest model @@ -23226,6 +30255,7 @@ var _ = Describe(`SchematicsV1`, func() { replaceWorkspaceOptionsModel.SetType([]string{"testString"}) replaceWorkspaceOptionsModel.SetWorkspaceStatus(workspaceStatusUpdateRequestModel) replaceWorkspaceOptionsModel.SetWorkspaceStatusMsg(workspaceStatusMessageModel) + replaceWorkspaceOptionsModel.SetAgentID("testString") replaceWorkspaceOptionsModel.SetXGithubToken("testString") replaceWorkspaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(replaceWorkspaceOptionsModel).ToNot(BeNil()) @@ -23241,6 +30271,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(replaceWorkspaceOptionsModel.Type).To(Equal([]string{"testString"})) Expect(replaceWorkspaceOptionsModel.WorkspaceStatus).To(Equal(workspaceStatusUpdateRequestModel)) Expect(replaceWorkspaceOptionsModel.WorkspaceStatusMsg).To(Equal(workspaceStatusMessageModel)) + Expect(replaceWorkspaceOptionsModel.AgentID).To(Equal(core.StringPtr("testString"))) Expect(replaceWorkspaceOptionsModel.XGithubToken).To(Equal(core.StringPtr("testString"))) Expect(replaceWorkspaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -23309,49 +30340,101 @@ var _ = Describe(`SchematicsV1`, func() { Expect(userStateModel.SetBy).To(Equal(core.StringPtr("testString"))) Expect(userStateModel.SetAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - Expect(externalSourceGitModel).ToNot(BeNil()) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - Expect(externalSourceGitModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitToken).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRelease).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitBranch).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - Expect(externalSourceCatalogModel).ToNot(BeNil()) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") - Expect(externalSourceCatalogModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingKind).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + Expect(gitSourceModel).ToNot(BeNil()) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + Expect(gitSourceModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitToken).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRelease).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitBranch).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + Expect(catalogSourceModel).ToNot(BeNil()) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + Expect(catalogSourceModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingKind).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingProvisionerWorkingDirectory).To(Equal(core.StringPtr("testString"))) // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) Expect(externalSourceModel).ToNot(BeNil()) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel Expect(externalSourceModel.SourceType).To(Equal(core.StringPtr("local"))) - Expect(externalSourceModel.Git).To(Equal(externalSourceGitModel)) - Expect(externalSourceModel.Catalog).To(Equal(externalSourceCatalogModel)) + Expect(externalSourceModel.Git).To(Equal(gitSourceModel)) + Expect(externalSourceModel.Catalog).To(Equal(catalogSourceModel)) + + // Construct an instance of the CredentialVariableMetadata model + credentialVariableMetadataModel := new(schematicsv1.CredentialVariableMetadata) + Expect(credentialVariableMetadataModel).ToNot(BeNil()) + credentialVariableMetadataModel.Type = core.StringPtr("string") + credentialVariableMetadataModel.Aliases = []string{"testString"} + credentialVariableMetadataModel.Description = core.StringPtr("testString") + credentialVariableMetadataModel.CloudDataType = core.StringPtr("testString") + credentialVariableMetadataModel.DefaultValue = core.StringPtr("testString") + credentialVariableMetadataModel.LinkStatus = core.StringPtr("normal") + credentialVariableMetadataModel.Immutable = core.BoolPtr(true) + credentialVariableMetadataModel.Hidden = core.BoolPtr(true) + credentialVariableMetadataModel.Required = core.BoolPtr(true) + credentialVariableMetadataModel.Position = core.Int64Ptr(int64(38)) + credentialVariableMetadataModel.GroupBy = core.StringPtr("testString") + credentialVariableMetadataModel.Source = core.StringPtr("testString") + Expect(credentialVariableMetadataModel.Type).To(Equal(core.StringPtr("string"))) + Expect(credentialVariableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(credentialVariableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(credentialVariableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(credentialVariableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(credentialVariableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(credentialVariableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(credentialVariableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CredentialVariableData model + credentialVariableDataModel := new(schematicsv1.CredentialVariableData) + Expect(credentialVariableDataModel).ToNot(BeNil()) + credentialVariableDataModel.Name = core.StringPtr("testString") + credentialVariableDataModel.Value = core.StringPtr("testString") + credentialVariableDataModel.UseDefault = core.BoolPtr(true) + credentialVariableDataModel.Metadata = credentialVariableMetadataModel + Expect(credentialVariableDataModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableDataModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(credentialVariableDataModel.UseDefault).To(Equal(core.BoolPtr(true))) + Expect(credentialVariableDataModel.Metadata).To(Equal(credentialVariableMetadataModel)) + + // Construct an instance of the BastionResourceDefinition model + bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) + Expect(bastionResourceDefinitionModel).ToNot(BeNil()) + bastionResourceDefinitionModel.Name = core.StringPtr("testString") + bastionResourceDefinitionModel.Host = core.StringPtr("testString") + Expect(bastionResourceDefinitionModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(bastionResourceDefinitionModel.Host).To(Equal(core.StringPtr("testString"))) // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -23407,14 +30490,6 @@ var _ = Describe(`SchematicsV1`, func() { Expect(variableDataModel.UseDefault).To(Equal(core.BoolPtr(true))) Expect(variableDataModel.Metadata).To(Equal(variableMetadataModel)) - // Construct an instance of the BastionResourceDefinition model - bastionResourceDefinitionModel := new(schematicsv1.BastionResourceDefinition) - Expect(bastionResourceDefinitionModel).ToNot(BeNil()) - bastionResourceDefinitionModel.Name = core.StringPtr("testString") - bastionResourceDefinitionModel.Host = core.StringPtr("testString") - Expect(bastionResourceDefinitionModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(bastionResourceDefinitionModel.Host).To(Equal(core.StringPtr("testString"))) - // Construct an instance of the ActionState model actionStateModel := new(schematicsv1.ActionState) Expect(actionStateModel).ToNot(BeNil()) @@ -23452,9 +30527,9 @@ var _ = Describe(`SchematicsV1`, func() { updateActionOptionsModel.SetSourceType("local") updateActionOptionsModel.SetCommandParameter("testString") updateActionOptionsModel.SetInventory("testString") - updateActionOptionsModel.SetCredentials([]schematicsv1.VariableData{*variableDataModel}) + updateActionOptionsModel.SetCredentials([]schematicsv1.CredentialVariableData{*credentialVariableDataModel}) updateActionOptionsModel.SetBastion(bastionResourceDefinitionModel) - updateActionOptionsModel.SetBastionCredential(variableDataModel) + updateActionOptionsModel.SetBastionCredential(credentialVariableDataModel) updateActionOptionsModel.SetTargetsIni("testString") updateActionOptionsModel.SetInputs([]schematicsv1.VariableData{*variableDataModel}) updateActionOptionsModel.SetOutputs([]schematicsv1.VariableData{*variableDataModel}) @@ -23478,9 +30553,9 @@ var _ = Describe(`SchematicsV1`, func() { Expect(updateActionOptionsModel.SourceType).To(Equal(core.StringPtr("local"))) Expect(updateActionOptionsModel.CommandParameter).To(Equal(core.StringPtr("testString"))) Expect(updateActionOptionsModel.Inventory).To(Equal(core.StringPtr("testString"))) - Expect(updateActionOptionsModel.Credentials).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + Expect(updateActionOptionsModel.Credentials).To(Equal([]schematicsv1.CredentialVariableData{*credentialVariableDataModel})) Expect(updateActionOptionsModel.Bastion).To(Equal(bastionResourceDefinitionModel)) - Expect(updateActionOptionsModel.BastionCredential).To(Equal(variableDataModel)) + Expect(updateActionOptionsModel.BastionCredential).To(Equal(credentialVariableDataModel)) Expect(updateActionOptionsModel.TargetsIni).To(Equal(core.StringPtr("testString"))) Expect(updateActionOptionsModel.Inputs).To(Equal([]schematicsv1.VariableData{*variableDataModel})) Expect(updateActionOptionsModel.Outputs).To(Equal([]schematicsv1.VariableData{*variableDataModel})) @@ -23490,6 +30565,62 @@ var _ = Describe(`SchematicsV1`, func() { Expect(updateActionOptionsModel.XGithubToken).To(Equal(core.StringPtr("testString"))) Expect(updateActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateAgentRegistrationOptions successfully`, func() { + // Construct an instance of the AgentUserState model + agentUserStateModel := new(schematicsv1.AgentUserState) + Expect(agentUserStateModel).ToNot(BeNil()) + agentUserStateModel.State = core.StringPtr("enable") + Expect(agentUserStateModel.State).To(Equal(core.StringPtr("enable"))) + + // Construct an instance of the ConnectionState model + connectionStateModel := new(schematicsv1.ConnectionState) + Expect(connectionStateModel).ToNot(BeNil()) + connectionStateModel.State = core.StringPtr("Connected") + connectionStateModel.CheckedAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(connectionStateModel.State).To(Equal(core.StringPtr("Connected"))) + Expect(connectionStateModel.CheckedAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the AgentSystemState model + agentSystemStateModel := new(schematicsv1.AgentSystemState) + Expect(agentSystemStateModel).ToNot(BeNil()) + agentSystemStateModel.State = core.StringPtr("error") + agentSystemStateModel.Message = core.StringPtr("testString") + Expect(agentSystemStateModel.State).To(Equal(core.StringPtr("error"))) + Expect(agentSystemStateModel.Message).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the UpdateAgentRegistrationOptions model + agentID := "testString" + updateAgentRegistrationOptionsName := "MyDevAgent" + updateAgentRegistrationOptionsAgentLocation := "us-south" + updateAgentRegistrationOptionsLocation := "us-south" + updateAgentRegistrationOptionsProfileID := "testString" + updateAgentRegistrationOptionsModel := schematicsService.NewUpdateAgentRegistrationOptions(agentID, updateAgentRegistrationOptionsName, updateAgentRegistrationOptionsAgentLocation, updateAgentRegistrationOptionsLocation, updateAgentRegistrationOptionsProfileID) + updateAgentRegistrationOptionsModel.SetAgentID("testString") + updateAgentRegistrationOptionsModel.SetName("MyDevAgent") + updateAgentRegistrationOptionsModel.SetAgentLocation("us-south") + updateAgentRegistrationOptionsModel.SetLocation("us-south") + updateAgentRegistrationOptionsModel.SetProfileID("testString") + updateAgentRegistrationOptionsModel.SetDescription("Register agent") + updateAgentRegistrationOptionsModel.SetResourceGroup("testString") + updateAgentRegistrationOptionsModel.SetTags([]string{"testString"}) + updateAgentRegistrationOptionsModel.SetUserState(agentUserStateModel) + updateAgentRegistrationOptionsModel.SetConnectionState(connectionStateModel) + updateAgentRegistrationOptionsModel.SetSystemState(agentSystemStateModel) + updateAgentRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateAgentRegistrationOptionsModel).ToNot(BeNil()) + Expect(updateAgentRegistrationOptionsModel.AgentID).To(Equal(core.StringPtr("testString"))) + Expect(updateAgentRegistrationOptionsModel.Name).To(Equal(core.StringPtr("MyDevAgent"))) + Expect(updateAgentRegistrationOptionsModel.AgentLocation).To(Equal(core.StringPtr("us-south"))) + Expect(updateAgentRegistrationOptionsModel.Location).To(Equal(core.StringPtr("us-south"))) + Expect(updateAgentRegistrationOptionsModel.ProfileID).To(Equal(core.StringPtr("testString"))) + Expect(updateAgentRegistrationOptionsModel.Description).To(Equal(core.StringPtr("Register agent"))) + Expect(updateAgentRegistrationOptionsModel.ResourceGroup).To(Equal(core.StringPtr("testString"))) + Expect(updateAgentRegistrationOptionsModel.Tags).To(Equal([]string{"testString"})) + Expect(updateAgentRegistrationOptionsModel.UserState).To(Equal(agentUserStateModel)) + Expect(updateAgentRegistrationOptionsModel.ConnectionState).To(Equal(connectionStateModel)) + Expect(updateAgentRegistrationOptionsModel.SystemState).To(Equal(agentSystemStateModel)) + Expect(updateAgentRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateJobOptions successfully`, func() { // Construct an instance of the VariableMetadata model variableMetadataModel := new(schematicsv1.VariableMetadata) @@ -23751,49 +30882,53 @@ var _ = Describe(`SchematicsV1`, func() { Expect(jobDataSystemModel.SchematicsResourceID).To(Equal([]string{"testString"})) Expect(jobDataSystemModel.UpdatedAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) - // Construct an instance of the ExternalSourceGit model - externalSourceGitModel := new(schematicsv1.ExternalSourceGit) - Expect(externalSourceGitModel).ToNot(BeNil()) - externalSourceGitModel.ComputedGitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitRepoURL = core.StringPtr("testString") - externalSourceGitModel.GitToken = core.StringPtr("testString") - externalSourceGitModel.GitRepoFolder = core.StringPtr("testString") - externalSourceGitModel.GitRelease = core.StringPtr("testString") - externalSourceGitModel.GitBranch = core.StringPtr("testString") - Expect(externalSourceGitModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitToken).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitRelease).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceGitModel.GitBranch).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the ExternalSourceCatalog model - externalSourceCatalogModel := new(schematicsv1.ExternalSourceCatalog) - Expect(externalSourceCatalogModel).ToNot(BeNil()) - externalSourceCatalogModel.CatalogName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingName = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersion = core.StringPtr("testString") - externalSourceCatalogModel.OfferingKind = core.StringPtr("testString") - externalSourceCatalogModel.OfferingID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingVersionID = core.StringPtr("testString") - externalSourceCatalogModel.OfferingRepoURL = core.StringPtr("testString") - Expect(externalSourceCatalogModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingName).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingKind).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) - Expect(externalSourceCatalogModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the GitSource model + gitSourceModel := new(schematicsv1.GitSource) + Expect(gitSourceModel).ToNot(BeNil()) + gitSourceModel.ComputedGitRepoURL = core.StringPtr("testString") + gitSourceModel.GitRepoURL = core.StringPtr("testString") + gitSourceModel.GitToken = core.StringPtr("testString") + gitSourceModel.GitRepoFolder = core.StringPtr("testString") + gitSourceModel.GitRelease = core.StringPtr("testString") + gitSourceModel.GitBranch = core.StringPtr("testString") + Expect(gitSourceModel.ComputedGitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitToken).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRepoFolder).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitRelease).To(Equal(core.StringPtr("testString"))) + Expect(gitSourceModel.GitBranch).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CatalogSource model + catalogSourceModel := new(schematicsv1.CatalogSource) + Expect(catalogSourceModel).ToNot(BeNil()) + catalogSourceModel.CatalogName = core.StringPtr("testString") + catalogSourceModel.OfferingName = core.StringPtr("testString") + catalogSourceModel.OfferingVersion = core.StringPtr("testString") + catalogSourceModel.OfferingKind = core.StringPtr("testString") + catalogSourceModel.CatalogID = core.StringPtr("testString") + catalogSourceModel.OfferingID = core.StringPtr("testString") + catalogSourceModel.OfferingVersionID = core.StringPtr("testString") + catalogSourceModel.OfferingRepoURL = core.StringPtr("testString") + catalogSourceModel.OfferingProvisionerWorkingDirectory = core.StringPtr("testString") + Expect(catalogSourceModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingName).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersion).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingKind).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingVersionID).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingRepoURL).To(Equal(core.StringPtr("testString"))) + Expect(catalogSourceModel.OfferingProvisionerWorkingDirectory).To(Equal(core.StringPtr("testString"))) // Construct an instance of the ExternalSource model externalSourceModel := new(schematicsv1.ExternalSource) Expect(externalSourceModel).ToNot(BeNil()) externalSourceModel.SourceType = core.StringPtr("local") - externalSourceModel.Git = externalSourceGitModel - externalSourceModel.Catalog = externalSourceCatalogModel + externalSourceModel.Git = gitSourceModel + externalSourceModel.Catalog = catalogSourceModel Expect(externalSourceModel.SourceType).To(Equal(core.StringPtr("local"))) - Expect(externalSourceModel.Git).To(Equal(externalSourceGitModel)) - Expect(externalSourceModel.Catalog).To(Equal(externalSourceCatalogModel)) + Expect(externalSourceModel.Git).To(Equal(gitSourceModel)) + Expect(externalSourceModel.Catalog).To(Equal(catalogSourceModel)) // Construct an instance of the JobDataWorkItemLastJob model jobDataWorkItemLastJobModel := new(schematicsv1.JobDataWorkItemLastJob) @@ -23977,6 +31112,60 @@ var _ = Describe(`SchematicsV1`, func() { Expect(updateJobOptionsModel.LogSummary).To(Equal(jobLogSummaryModel)) Expect(updateJobOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateJobStatusOptions successfully`, func() { + // Construct an instance of the LogSummary model + logSummaryModel := new(schematicsv1.LogSummary) + Expect(logSummaryModel).ToNot(BeNil()) + logSummaryModel.ActivityStatus = core.StringPtr("testString") + logSummaryModel.DetectedTemplateType = core.StringPtr("testString") + logSummaryModel.DiscardedFiles = core.Int64Ptr(int64(26)) + logSummaryModel.Error = core.StringPtr("testString") + logSummaryModel.ResourcesAdded = core.Int64Ptr(int64(26)) + logSummaryModel.ResourcesDestroyed = core.Int64Ptr(int64(26)) + logSummaryModel.ResourcesModified = core.Int64Ptr(int64(26)) + logSummaryModel.ScannedFiles = core.Int64Ptr(int64(26)) + logSummaryModel.TemplateVariableCount = core.Int64Ptr(int64(26)) + logSummaryModel.TimeTaken = core.Float64Ptr(float64(72.5)) + Expect(logSummaryModel.ActivityStatus).To(Equal(core.StringPtr("testString"))) + Expect(logSummaryModel.DetectedTemplateType).To(Equal(core.StringPtr("testString"))) + Expect(logSummaryModel.DiscardedFiles).To(Equal(core.Int64Ptr(int64(26)))) + Expect(logSummaryModel.Error).To(Equal(core.StringPtr("testString"))) + Expect(logSummaryModel.ResourcesAdded).To(Equal(core.Int64Ptr(int64(26)))) + Expect(logSummaryModel.ResourcesDestroyed).To(Equal(core.Int64Ptr(int64(26)))) + Expect(logSummaryModel.ResourcesModified).To(Equal(core.Int64Ptr(int64(26)))) + Expect(logSummaryModel.ScannedFiles).To(Equal(core.Int64Ptr(int64(26)))) + Expect(logSummaryModel.TemplateVariableCount).To(Equal(core.Int64Ptr(int64(26)))) + Expect(logSummaryModel.TimeTaken).To(Equal(core.Float64Ptr(float64(72.5)))) + + // Construct an instance of the AgentWorkspaceStatusDoc model + agentWorkspaceStatusDocModel := new(schematicsv1.AgentWorkspaceStatusDoc) + Expect(agentWorkspaceStatusDocModel).ToNot(BeNil()) + agentWorkspaceStatusDocModel.WorkspaceID = core.StringPtr("testString") + agentWorkspaceStatusDocModel.WorkspaceStatus = core.StringPtr("testString") + agentWorkspaceStatusDocModel.UnlockWorkspace = core.BoolPtr(true) + agentWorkspaceStatusDocModel.JobStatus = core.StringPtr("testString") + agentWorkspaceStatusDocModel.JobLogSummary = logSummaryModel + Expect(agentWorkspaceStatusDocModel.WorkspaceID).To(Equal(core.StringPtr("testString"))) + Expect(agentWorkspaceStatusDocModel.WorkspaceStatus).To(Equal(core.StringPtr("testString"))) + Expect(agentWorkspaceStatusDocModel.UnlockWorkspace).To(Equal(core.BoolPtr(true))) + Expect(agentWorkspaceStatusDocModel.JobStatus).To(Equal(core.StringPtr("testString"))) + Expect(agentWorkspaceStatusDocModel.JobLogSummary).To(Equal(logSummaryModel)) + + // Construct an instance of the UpdateJobStatusOptions model + jobID := "testString" + updateJobStatusOptionsModel := schematicsService.NewUpdateJobStatusOptions(jobID) + updateJobStatusOptionsModel.SetJobID("testString") + updateJobStatusOptionsModel.SetAgentSubID("testString") + updateJobStatusOptionsModel.SetDocType("workspace") + updateJobStatusOptionsModel.SetWorkspaceStatus(agentWorkspaceStatusDocModel) + updateJobStatusOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateJobStatusOptionsModel).ToNot(BeNil()) + Expect(updateJobStatusOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) + Expect(updateJobStatusOptionsModel.AgentSubID).To(Equal(core.StringPtr("testString"))) + Expect(updateJobStatusOptionsModel.DocType).To(Equal(core.StringPtr("workspace"))) + Expect(updateJobStatusOptionsModel.WorkspaceStatus).To(Equal(agentWorkspaceStatusDocModel)) + Expect(updateJobStatusOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateKmsSettingsOptions successfully`, func() { // Construct an instance of the KMSSettingsPrimaryCrk model kmsSettingsPrimaryCrkModel := new(schematicsv1.KMSSettingsPrimaryCrk) @@ -24014,6 +31203,164 @@ var _ = Describe(`SchematicsV1`, func() { Expect(updateKmsSettingsOptionsModel.SecondaryCrk).To(Equal(kmsSettingsSecondaryCrkModel)) Expect(updateKmsSettingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdatePolicyOptions successfully`, func() { + // Construct an instance of the UserState model + userStateModel := new(schematicsv1.UserState) + Expect(userStateModel).ToNot(BeNil()) + userStateModel.State = core.StringPtr("draft") + userStateModel.SetBy = core.StringPtr("testString") + userStateModel.SetAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(userStateModel.State).To(Equal(core.StringPtr("draft"))) + Expect(userStateModel.SetBy).To(Equal(core.StringPtr("testString"))) + Expect(userStateModel.SetAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the PolicyObjectSelector model + policyObjectSelectorModel := new(schematicsv1.PolicyObjectSelector) + Expect(policyObjectSelectorModel).ToNot(BeNil()) + policyObjectSelectorModel.Kind = core.StringPtr("agent") + policyObjectSelectorModel.Tags = []string{"testString"} + policyObjectSelectorModel.ResourceGroups = []string{"testString"} + policyObjectSelectorModel.Locations = []string{"us-south"} + Expect(policyObjectSelectorModel.Kind).To(Equal(core.StringPtr("agent"))) + Expect(policyObjectSelectorModel.Tags).To(Equal([]string{"testString"})) + Expect(policyObjectSelectorModel.ResourceGroups).To(Equal([]string{"testString"})) + Expect(policyObjectSelectorModel.Locations).To(Equal([]string{"us-south"})) + + // Construct an instance of the PolicyObjects model + policyObjectsModel := new(schematicsv1.PolicyObjects) + Expect(policyObjectsModel).ToNot(BeNil()) + policyObjectsModel.SelectorKind = core.StringPtr("ids") + policyObjectsModel.SelectorIds = []string{"testString"} + policyObjectsModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + Expect(policyObjectsModel.SelectorKind).To(Equal(core.StringPtr("ids"))) + Expect(policyObjectsModel.SelectorIds).To(Equal([]string{"testString"})) + Expect(policyObjectsModel.SelectorScope).To(Equal([]schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel})) + + // Construct an instance of the AgentAssignmentPolicyParameter model + agentAssignmentPolicyParameterModel := new(schematicsv1.AgentAssignmentPolicyParameter) + Expect(agentAssignmentPolicyParameterModel).ToNot(BeNil()) + agentAssignmentPolicyParameterModel.SelectorKind = core.StringPtr("ids") + agentAssignmentPolicyParameterModel.SelectorIds = []string{"testString"} + agentAssignmentPolicyParameterModel.SelectorScope = []schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel} + Expect(agentAssignmentPolicyParameterModel.SelectorKind).To(Equal(core.StringPtr("ids"))) + Expect(agentAssignmentPolicyParameterModel.SelectorIds).To(Equal([]string{"testString"})) + Expect(agentAssignmentPolicyParameterModel.SelectorScope).To(Equal([]schematicsv1.PolicyObjectSelector{*policyObjectSelectorModel})) + + // Construct an instance of the PolicyParameter model + policyParameterModel := new(schematicsv1.PolicyParameter) + Expect(policyParameterModel).ToNot(BeNil()) + policyParameterModel.AgentAssignmentPolicyParameter = agentAssignmentPolicyParameterModel + Expect(policyParameterModel.AgentAssignmentPolicyParameter).To(Equal(agentAssignmentPolicyParameterModel)) + + // Construct an instance of the UpdatePolicyOptions model + policyID := "testString" + updatePolicyOptionsPolicyKind := "agent_assignment_policy" + updatePolicyOptionsModel := schematicsService.NewUpdatePolicyOptions(policyID, updatePolicyOptionsPolicyKind) + updatePolicyOptionsModel.SetPolicyID("testString") + updatePolicyOptionsModel.SetPolicyKind("agent_assignment_policy") + updatePolicyOptionsModel.SetName("Agent1-DevWS") + updatePolicyOptionsModel.SetDescription("Policy for job execution of secured workspaces on agent1") + updatePolicyOptionsModel.SetResourceGroup("Default") + updatePolicyOptionsModel.SetTags([]string{"policy:secured-job"}) + updatePolicyOptionsModel.SetLocation("us-south") + updatePolicyOptionsModel.SetState(userStateModel) + updatePolicyOptionsModel.SetPolicyTarget(policyObjectsModel) + updatePolicyOptionsModel.SetPolicyParameter(policyParameterModel) + updatePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updatePolicyOptionsModel).ToNot(BeNil()) + Expect(updatePolicyOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) + Expect(updatePolicyOptionsModel.PolicyKind).To(Equal(core.StringPtr("agent_assignment_policy"))) + Expect(updatePolicyOptionsModel.Name).To(Equal(core.StringPtr("Agent1-DevWS"))) + Expect(updatePolicyOptionsModel.Description).To(Equal(core.StringPtr("Policy for job execution of secured workspaces on agent1"))) + Expect(updatePolicyOptionsModel.ResourceGroup).To(Equal(core.StringPtr("Default"))) + Expect(updatePolicyOptionsModel.Tags).To(Equal([]string{"policy:secured-job"})) + Expect(updatePolicyOptionsModel.Location).To(Equal(core.StringPtr("us-south"))) + Expect(updatePolicyOptionsModel.State).To(Equal(userStateModel)) + Expect(updatePolicyOptionsModel.PolicyTarget).To(Equal(policyObjectsModel)) + Expect(updatePolicyOptionsModel.PolicyParameter).To(Equal(policyParameterModel)) + Expect(updatePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVariablesMetadataOptions successfully`, func() { + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + Expect(variableMetadataModel).ToNot(BeNil()) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + Expect(variableMetadataModel.Type).To(Equal(core.StringPtr("boolean"))) + Expect(variableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(variableMetadataModel.Secure).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Options).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.MinValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MinLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.Matches).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the VariableData model + variableDataModel := new(schematicsv1.VariableData) + Expect(variableDataModel).ToNot(BeNil()) + variableDataModel.Name = core.StringPtr("testString") + variableDataModel.Value = core.StringPtr("testString") + variableDataModel.UseDefault = core.BoolPtr(true) + variableDataModel.Metadata = variableMetadataModel + Expect(variableDataModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(variableDataModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(variableDataModel.UseDefault).To(Equal(core.BoolPtr(true))) + Expect(variableDataModel.Metadata).To(Equal(variableMetadataModel)) + + // Construct an instance of the AgentWorkspaceVariablesDoc model + agentWorkspaceVariablesDocModel := new(schematicsv1.AgentWorkspaceVariablesDoc) + Expect(agentWorkspaceVariablesDocModel).ToNot(BeNil()) + agentWorkspaceVariablesDocModel.WorkspaceID = core.StringPtr("testString") + agentWorkspaceVariablesDocModel.Inputs = []schematicsv1.VariableData{*variableDataModel} + agentWorkspaceVariablesDocModel.Settings = []schematicsv1.VariableData{*variableDataModel} + Expect(agentWorkspaceVariablesDocModel.WorkspaceID).To(Equal(core.StringPtr("testString"))) + Expect(agentWorkspaceVariablesDocModel.Inputs).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + Expect(agentWorkspaceVariablesDocModel.Settings).To(Equal([]schematicsv1.VariableData{*variableDataModel})) + + // Construct an instance of the UpdateVariablesMetadataOptions model + jobID := "testString" + wID := "testString" + updateVariablesMetadataOptionsModel := schematicsService.NewUpdateVariablesMetadataOptions(jobID, wID) + updateVariablesMetadataOptionsModel.SetJobID("testString") + updateVariablesMetadataOptionsModel.SetWID("testString") + updateVariablesMetadataOptionsModel.SetDocType("workspace") + updateVariablesMetadataOptionsModel.SetWorkspaceVariables(agentWorkspaceVariablesDocModel) + updateVariablesMetadataOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVariablesMetadataOptionsModel).ToNot(BeNil()) + Expect(updateVariablesMetadataOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) + Expect(updateVariablesMetadataOptionsModel.WID).To(Equal(core.StringPtr("testString"))) + Expect(updateVariablesMetadataOptionsModel.DocType).To(Equal(core.StringPtr("workspace"))) + Expect(updateVariablesMetadataOptionsModel.WorkspaceVariables).To(Equal(agentWorkspaceVariablesDocModel)) + Expect(updateVariablesMetadataOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateWorkspaceOptions successfully`, func() { // Construct an instance of the CatalogRef model catalogRefModel := new(schematicsv1.CatalogRef) @@ -24103,6 +31450,48 @@ var _ = Describe(`SchematicsV1`, func() { Expect(injectTerraformTemplateInnerModel.TftName).To(Equal(core.StringPtr("testString"))) Expect(injectTerraformTemplateInnerModel.TftParameters).To(Equal([]schematicsv1.InjectTerraformTemplateInnerTftParametersItem{*injectTerraformTemplateInnerTftParametersItemModel})) + // Construct an instance of the VariableMetadata model + variableMetadataModel := new(schematicsv1.VariableMetadata) + Expect(variableMetadataModel).ToNot(BeNil()) + variableMetadataModel.Type = core.StringPtr("boolean") + variableMetadataModel.Aliases = []string{"testString"} + variableMetadataModel.Description = core.StringPtr("testString") + variableMetadataModel.CloudDataType = core.StringPtr("testString") + variableMetadataModel.DefaultValue = core.StringPtr("testString") + variableMetadataModel.LinkStatus = core.StringPtr("normal") + variableMetadataModel.Secure = core.BoolPtr(true) + variableMetadataModel.Immutable = core.BoolPtr(true) + variableMetadataModel.Hidden = core.BoolPtr(true) + variableMetadataModel.Required = core.BoolPtr(true) + variableMetadataModel.Options = []string{"testString"} + variableMetadataModel.MinValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxValue = core.Int64Ptr(int64(38)) + variableMetadataModel.MinLength = core.Int64Ptr(int64(38)) + variableMetadataModel.MaxLength = core.Int64Ptr(int64(38)) + variableMetadataModel.Matches = core.StringPtr("testString") + variableMetadataModel.Position = core.Int64Ptr(int64(38)) + variableMetadataModel.GroupBy = core.StringPtr("testString") + variableMetadataModel.Source = core.StringPtr("testString") + Expect(variableMetadataModel.Type).To(Equal(core.StringPtr("boolean"))) + Expect(variableMetadataModel.Aliases).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.CloudDataType).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.LinkStatus).To(Equal(core.StringPtr("normal"))) + Expect(variableMetadataModel.Secure).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Immutable).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Required).To(Equal(core.BoolPtr(true))) + Expect(variableMetadataModel.Options).To(Equal([]string{"testString"})) + Expect(variableMetadataModel.MinValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MinLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.MaxLength).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.Matches).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Position).To(Equal(core.Int64Ptr(int64(38)))) + Expect(variableMetadataModel.GroupBy).To(Equal(core.StringPtr("testString"))) + Expect(variableMetadataModel.Source).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the WorkspaceVariableRequest model workspaceVariableRequestModel := new(schematicsv1.WorkspaceVariableRequest) Expect(workspaceVariableRequestModel).ToNot(BeNil()) @@ -24131,7 +31520,7 @@ var _ = Describe(`SchematicsV1`, func() { templateSourceDataRequestModel.Type = core.StringPtr("testString") templateSourceDataRequestModel.UninstallScriptName = core.StringPtr("testString") templateSourceDataRequestModel.Values = core.StringPtr("testString") - templateSourceDataRequestModel.ValuesMetadata = []interface{}{map[string]interface{}{"anyKey": "anyValue"}} + templateSourceDataRequestModel.ValuesMetadata = []schematicsv1.VariableMetadata{*variableMetadataModel} templateSourceDataRequestModel.Variablestore = []schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel} Expect(templateSourceDataRequestModel.EnvValues).To(Equal([]interface{}{map[string]interface{}{"anyKey": "anyValue"}})) Expect(templateSourceDataRequestModel.EnvValuesMetadata).To(Equal([]schematicsv1.EnvironmentValuesMetadata{*environmentValuesMetadataModel})) @@ -24142,7 +31531,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(templateSourceDataRequestModel.Type).To(Equal(core.StringPtr("testString"))) Expect(templateSourceDataRequestModel.UninstallScriptName).To(Equal(core.StringPtr("testString"))) Expect(templateSourceDataRequestModel.Values).To(Equal(core.StringPtr("testString"))) - Expect(templateSourceDataRequestModel.ValuesMetadata).To(Equal([]interface{}{map[string]interface{}{"anyKey": "anyValue"}})) + Expect(templateSourceDataRequestModel.ValuesMetadata).To(Equal([]schematicsv1.VariableMetadata{*variableMetadataModel})) Expect(templateSourceDataRequestModel.Variablestore).To(Equal([]schematicsv1.WorkspaceVariableRequest{*workspaceVariableRequestModel})) // Construct an instance of the TemplateRepoUpdateRequest model @@ -24198,6 +31587,7 @@ var _ = Describe(`SchematicsV1`, func() { updateWorkspaceOptionsModel.SetType([]string{"testString"}) updateWorkspaceOptionsModel.SetWorkspaceStatus(workspaceStatusUpdateRequestModel) updateWorkspaceOptionsModel.SetWorkspaceStatusMsg(workspaceStatusMessageModel) + updateWorkspaceOptionsModel.SetAgentID("testString") updateWorkspaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateWorkspaceOptionsModel).ToNot(BeNil()) Expect(updateWorkspaceOptionsModel.WID).To(Equal(core.StringPtr("testString"))) @@ -24212,6 +31602,7 @@ var _ = Describe(`SchematicsV1`, func() { Expect(updateWorkspaceOptionsModel.Type).To(Equal([]string{"testString"})) Expect(updateWorkspaceOptionsModel.WorkspaceStatus).To(Equal(workspaceStatusUpdateRequestModel)) Expect(updateWorkspaceOptionsModel.WorkspaceStatusMsg).To(Equal(workspaceStatusMessageModel)) + Expect(updateWorkspaceOptionsModel.AgentID).To(Equal(core.StringPtr("testString"))) Expect(updateWorkspaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUploadTemplateTarActionOptions successfully`, func() {